poi-plugin-quest-info-2 0.8.9 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.changeset/README.md +8 -0
- package/.changeset/config.json +11 -0
- package/CHANGELOG.md +26 -0
- package/README.md +3 -2
- package/build/kcQuestsData/DATA_VERSION +1 -1
- package/build/kcQuestsData/index.ts +1 -1
- package/build/kcQuestsData/quests-scn-new.json +8 -1
- package/build/kcQuestsData/quests-scn.json +116 -16
- package/build/kcanotifyGamedata/DATA_VERSION +1 -1
- package/build/kcanotifyGamedata/index.ts +1 -1
- package/build/prePostQuest.json +85 -5
- package/build/questCategory.json +7 -1
- package/build/questCodeMap.json +12 -2
- package/i18n/en-US.json +8 -3
- package/i18n/index.ts +23 -4
- package/i18n/ja-JP.json +3 -3
- package/i18n/ko-KR.json +3 -2
- package/i18n/zh-CN.json +3 -3
- package/i18n/zh-TW.json +3 -3
- package/package.json +5 -2
- package/shims/globals.d.ts +6 -0
- package/src/Settings.tsx +67 -7
- package/src/Toolbar.tsx +53 -33
- package/src/__tests__/fixtures/firstLoginWithOneComplete.json +72 -0
- package/src/__tests__/fixtures/questList.json +338 -0
- package/src/__tests__/kcanotifyData.spec.ts +1 -1
- package/src/__tests__/kcwikiData.spec.ts +1 -1
- package/src/__tests__/questCategory.spec.ts +1 -1
- package/src/components/QuestCard/index.tsx +3 -3
- package/src/components/QuestCard/utils.tsx +3 -3
- package/src/patch.ts +3 -4
- package/src/poi/env.ts +4 -0
- package/src/poi/hooks.ts +55 -2
- package/src/poi/store.ts +25 -8
- package/src/poi/utils.ts +50 -0
- package/src/store/filterTags.ts +34 -13
- package/src/store/gameQuest.tsx +108 -5
- package/src/store/quest.ts +27 -83
- package/src/store/store.tsx +25 -19
- package/src/tags.tsx +83 -24
- package/tsconfig.json +1 -1
package/i18n/ko-KR.json
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
"Show task information & enhance task panel": "임무 공략 데이터와 임무 패널 강화. 데이터는 [kcanotify](https://github.com/antest1/kcanotify-gamedata) & [KC3Kai](https://github.com/KC3Kai/kc3-translations) 에서 제공되고 있습니다.",
|
|
4
4
|
"Search": "검색",
|
|
5
5
|
"All": "전체",
|
|
6
|
-
"Locked": "잠김",
|
|
6
|
+
"Locked": "잠김 {{number}}",
|
|
7
|
+
"Unlocked": "잠김 풀림 {{number}}",
|
|
7
8
|
"In Progress": "진행 중 {{number}}",
|
|
8
9
|
"Completed": "달성",
|
|
9
|
-
"Already Completed": "완료",
|
|
10
|
+
"Already Completed": "완료 {{number}}",
|
|
10
11
|
"Unknown": "알 수 없는 상태",
|
|
11
12
|
"Version": "버전: {{version}}",
|
|
12
13
|
"Data Version": "데이터 버전: {{version}}",
|
package/i18n/zh-CN.json
CHANGED
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
"Quarterly": "季常",
|
|
19
19
|
"Yearly": "年常",
|
|
20
20
|
"One-time": "单次",
|
|
21
|
-
"Locked": "未解锁",
|
|
21
|
+
"Locked": "未解锁 {{number}}",
|
|
22
|
+
"Unlocked": "已解锁 {{number}}",
|
|
22
23
|
"In Progress": "进行中 {{number}}",
|
|
23
24
|
"Completed": "达成",
|
|
24
|
-
"Already Completed": "已完成",
|
|
25
|
+
"Already Completed": "已完成 {{number}}",
|
|
25
26
|
"Unknown": "状态未知",
|
|
26
27
|
"TotalQuests": "一共 {{number}} 个任务",
|
|
27
|
-
"Sync with game": "与游戏同步(仅展示游戏内任务)",
|
|
28
28
|
"Version": "版本: {{version}}",
|
|
29
29
|
"Data Version": "数据版本: {{version}}",
|
|
30
30
|
"View source code on GitHub": "去 GitHub 查看源码",
|
package/i18n/zh-TW.json
CHANGED
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
"Quarterly": "每季",
|
|
19
19
|
"Yearly": "每年",
|
|
20
20
|
"One-time": "單次",
|
|
21
|
-
"Locked": "未解鎖",
|
|
21
|
+
"Locked": "未解鎖 {{number}}",
|
|
22
|
+
"Unlocked": "已解鎖 {{number}}",
|
|
22
23
|
"In Progress": "進行中 {{number}}",
|
|
23
24
|
"Completed": "達成",
|
|
24
|
-
"Already Completed": "已完成",
|
|
25
|
+
"Already Completed": "已完成 {{number}}",
|
|
25
26
|
"Unknown": "未知狀態",
|
|
26
27
|
"TotalQuests": "一共 {{number}} 個任務",
|
|
27
|
-
"Sync with game": "與遊戲同步",
|
|
28
28
|
"Version": "版本: {{version}}",
|
|
29
29
|
"Data Version": "資料版本: {{version}}",
|
|
30
30
|
"View source code on GitHub": "去 GitHub 查看源碼",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poi-plugin-quest-info-2",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "show quest info",
|
|
6
6
|
"homepage": "https://github.com/lawvs/poi-plugin-quest-2/",
|
|
@@ -31,7 +31,9 @@
|
|
|
31
31
|
"storybook": "start-storybook -p 6006",
|
|
32
32
|
"test": "jest",
|
|
33
33
|
"typeCheck": "tsc --noEmit",
|
|
34
|
-
"update": "npm run downloadKcanotifyData && npm run downloadKcQuestsData && npm run genQuestData"
|
|
34
|
+
"update": "npm run downloadKcanotifyData && npm run downloadKcQuestsData && npm run genQuestData",
|
|
35
|
+
"changeset": "changeset",
|
|
36
|
+
"release": "npm run build && npm publish"
|
|
35
37
|
},
|
|
36
38
|
"dependencies": {
|
|
37
39
|
"moize": "^6.1.1",
|
|
@@ -42,6 +44,7 @@
|
|
|
42
44
|
"devDependencies": {
|
|
43
45
|
"@babel/core": "^7.12.10",
|
|
44
46
|
"@blueprintjs/core": "^3.52.0",
|
|
47
|
+
"@changesets/cli": "^2.25.0",
|
|
45
48
|
"@storybook/addon-actions": "^6.3.4",
|
|
46
49
|
"@storybook/addon-essentials": "^6.3.4",
|
|
47
50
|
"@storybook/addon-links": "^6.3.4",
|
package/shims/globals.d.ts
CHANGED
|
@@ -21,4 +21,10 @@ interface Window {
|
|
|
21
21
|
language: string
|
|
22
22
|
getStore: (path?: string) => any
|
|
23
23
|
isMain: boolean
|
|
24
|
+
|
|
25
|
+
toast: (message: string) => void
|
|
26
|
+
// log: (message: string) => void
|
|
27
|
+
// warn: (message: string) => void
|
|
28
|
+
// error: (message: string) => void
|
|
29
|
+
// success: (message: string) => void
|
|
24
30
|
}
|
package/src/Settings.tsx
CHANGED
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import {
|
|
2
|
+
AnchorButton,
|
|
3
|
+
Button,
|
|
4
|
+
Checkbox,
|
|
5
|
+
Intent,
|
|
6
|
+
Text,
|
|
7
|
+
TextArea,
|
|
8
|
+
} from '@blueprintjs/core'
|
|
3
9
|
import { IconNames } from '@blueprintjs/icons'
|
|
10
|
+
import type { ChangeEvent } from 'react'
|
|
11
|
+
import React, { StrictMode, useCallback, useState } from 'react'
|
|
4
12
|
import styled from 'styled-components'
|
|
5
|
-
import { version as PACKAGE_VERSION, homepage } from '../package.json'
|
|
6
13
|
import { version as DATA_VERSION } from '../build/kcanotifyGamedata'
|
|
7
|
-
import {
|
|
14
|
+
import { homepage, version as PACKAGE_VERSION } from '../package.json'
|
|
15
|
+
import { IN_POI } from './poi/env'
|
|
16
|
+
import { usePluginTranslation, useStateExporter } from './poi/hooks'
|
|
17
|
+
import { tips } from './poi/utils'
|
|
8
18
|
import {
|
|
9
|
-
useRemoveStorage,
|
|
10
19
|
StoreProvider,
|
|
11
20
|
useLanguage,
|
|
12
21
|
usePreferKcwiki,
|
|
22
|
+
useRemoveStorage,
|
|
13
23
|
} from './store'
|
|
14
24
|
|
|
15
25
|
const Container = styled.div`
|
|
@@ -25,6 +35,54 @@ const Container = styled.div`
|
|
|
25
35
|
|
|
26
36
|
const useIsSimplifiedChinese = () => useLanguage() === 'zh-CN'
|
|
27
37
|
|
|
38
|
+
const DataExportArea = () => {
|
|
39
|
+
const [text, setText] = useState<string>('')
|
|
40
|
+
const { t } = usePluginTranslation()
|
|
41
|
+
const { exportQuestDataToClipboard, importAsPoiState } = useStateExporter()
|
|
42
|
+
|
|
43
|
+
const handleChange = useCallback((e: ChangeEvent<HTMLTextAreaElement>) => {
|
|
44
|
+
setText(e.target.value)
|
|
45
|
+
}, [])
|
|
46
|
+
|
|
47
|
+
const handleImportData = useCallback(() => {
|
|
48
|
+
importAsPoiState(text)
|
|
49
|
+
setText('')
|
|
50
|
+
tips.success(t('Import data success'))
|
|
51
|
+
}, [importAsPoiState, t, text])
|
|
52
|
+
|
|
53
|
+
const handleExportData = useCallback(async () => {
|
|
54
|
+
try {
|
|
55
|
+
await exportQuestDataToClipboard()
|
|
56
|
+
tips.success(t('Copied data to clipboard'))
|
|
57
|
+
} catch (error) {
|
|
58
|
+
console.error(error)
|
|
59
|
+
tips.error(t('Failed to export quest data! Please sync quest data first'))
|
|
60
|
+
}
|
|
61
|
+
}, [exportQuestDataToClipboard, t])
|
|
62
|
+
|
|
63
|
+
return IN_POI ? (
|
|
64
|
+
<Button
|
|
65
|
+
icon={IconNames.EXPORT}
|
|
66
|
+
text={t('Export quest data')}
|
|
67
|
+
onClick={handleExportData}
|
|
68
|
+
/>
|
|
69
|
+
) : (
|
|
70
|
+
<>
|
|
71
|
+
<TextArea
|
|
72
|
+
growVertically={false}
|
|
73
|
+
intent={Intent.PRIMARY}
|
|
74
|
+
onChange={handleChange}
|
|
75
|
+
value={text}
|
|
76
|
+
/>
|
|
77
|
+
<Button
|
|
78
|
+
icon={IconNames.IMPORT}
|
|
79
|
+
text={t('Import quest data')}
|
|
80
|
+
onClick={handleImportData}
|
|
81
|
+
/>
|
|
82
|
+
</>
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
|
|
28
86
|
const SettingsMain = () => {
|
|
29
87
|
const { t } = usePluginTranslation()
|
|
30
88
|
const isSimplifiedChinese = useIsSimplifiedChinese()
|
|
@@ -52,13 +110,15 @@ const SettingsMain = () => {
|
|
|
52
110
|
text={t('View source code on GitHub')}
|
|
53
111
|
href={homepage}
|
|
54
112
|
target="_blank"
|
|
55
|
-
|
|
113
|
+
/>
|
|
56
114
|
|
|
57
115
|
<Button
|
|
58
116
|
icon={IconNames.TRASH}
|
|
59
117
|
text={t('Restore defaults')}
|
|
60
118
|
onClick={removeStorage}
|
|
61
|
-
|
|
119
|
+
/>
|
|
120
|
+
|
|
121
|
+
<DataExportArea />
|
|
62
122
|
</>
|
|
63
123
|
)
|
|
64
124
|
}
|
package/src/Toolbar.tsx
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { Button, InputGroup
|
|
1
|
+
import { Button, InputGroup } from '@blueprintjs/core'
|
|
2
2
|
import { IconNames } from '@blueprintjs/icons'
|
|
3
3
|
import type { ChangeEvent } from 'react'
|
|
4
4
|
import React, { useCallback } from 'react'
|
|
5
5
|
import { useThrottle } from 'react-use'
|
|
6
6
|
import styled from 'styled-components'
|
|
7
|
-
import { IN_POI } from './poi/env'
|
|
8
7
|
import { usePluginTranslation } from './poi/hooks'
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { QUEST_STATUS, UnionQuest } from './questHelper'
|
|
9
|
+
import { PROGRESS_TAG, useQuest } from './store'
|
|
10
|
+
import {
|
|
11
|
+
useFilterProgressTag,
|
|
12
|
+
useFilterTags,
|
|
13
|
+
useSyncGameTagEffect,
|
|
14
|
+
} from './store/filterTags'
|
|
15
|
+
import { useGlobalQuestStatusQuery } from './store/gameQuest'
|
|
12
16
|
import { useSearchInput } from './store/search'
|
|
13
17
|
import { CategoryTags, CATEGORY_TAGS, TypeTags, TYPE_TAGS } from './tags'
|
|
14
18
|
import { And, Or } from './utils'
|
|
@@ -23,30 +27,6 @@ const ToolbarWrapper = styled.div`
|
|
|
23
27
|
}
|
|
24
28
|
`
|
|
25
29
|
|
|
26
|
-
const SyncButton = () => {
|
|
27
|
-
const { t } = usePluginTranslation()
|
|
28
|
-
const { searchInput } = useSearchInput()
|
|
29
|
-
const { syncWithGame, toggleSyncWithGame } = useSyncWithGame()
|
|
30
|
-
const handleClick = useCallback(() => {
|
|
31
|
-
toggleSyncWithGame()
|
|
32
|
-
}, [toggleSyncWithGame])
|
|
33
|
-
const intent = syncWithGame
|
|
34
|
-
? searchInput
|
|
35
|
-
? Intent.WARNING
|
|
36
|
-
: Intent.SUCCESS
|
|
37
|
-
: Intent.NONE
|
|
38
|
-
return (
|
|
39
|
-
<Tooltip content={t('Sync with game')}>
|
|
40
|
-
<Button
|
|
41
|
-
icon={IconNames.EXCHANGE}
|
|
42
|
-
intent={intent}
|
|
43
|
-
disabled={!IN_POI}
|
|
44
|
-
onClick={handleClick}
|
|
45
|
-
/>
|
|
46
|
-
</Tooltip>
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
30
|
export const SearchInput: React.FC = () => {
|
|
51
31
|
const { t } = usePluginTranslation()
|
|
52
32
|
const { searchInput, setSearchInput } = useSearchInput()
|
|
@@ -70,7 +50,6 @@ export const SearchInput: React.FC = () => {
|
|
|
70
50
|
{!!searchInput && (
|
|
71
51
|
<Button icon={IconNames.CROSS} onClick={handleClear} />
|
|
72
52
|
)}
|
|
73
|
-
<SyncButton></SyncButton>
|
|
74
53
|
</>
|
|
75
54
|
}
|
|
76
55
|
type="text"
|
|
@@ -79,6 +58,7 @@ export const SearchInput: React.FC = () => {
|
|
|
79
58
|
}
|
|
80
59
|
|
|
81
60
|
export const Toolbar = () => {
|
|
61
|
+
// TODO remove
|
|
82
62
|
useSyncGameTagEffect()
|
|
83
63
|
|
|
84
64
|
return (
|
|
@@ -116,10 +96,43 @@ const useInputStringFilter = () => {
|
|
|
116
96
|
return stringFilter
|
|
117
97
|
}
|
|
118
98
|
|
|
119
|
-
const useToolbarFilter = () => {
|
|
120
|
-
const
|
|
99
|
+
const useToolbarFilter = (): ((quest: UnionQuest) => boolean) => {
|
|
100
|
+
const searchFilter = useInputStringFilter()
|
|
121
101
|
const { typeTags, categoryTags } = useFilterTags()
|
|
122
102
|
|
|
103
|
+
const { progressTag } = useFilterProgressTag()
|
|
104
|
+
const questStatusQuery = useGlobalQuestStatusQuery()
|
|
105
|
+
|
|
106
|
+
const progressTagFilter = useCallback(
|
|
107
|
+
(quest: UnionQuest): boolean => {
|
|
108
|
+
const questStatus = questStatusQuery(quest.gameId)
|
|
109
|
+
switch (progressTag) {
|
|
110
|
+
case PROGRESS_TAG.All:
|
|
111
|
+
return true
|
|
112
|
+
case PROGRESS_TAG.Locked:
|
|
113
|
+
return (
|
|
114
|
+
questStatus === QUEST_STATUS.LOCKED ||
|
|
115
|
+
questStatus === QUEST_STATUS.UNKNOWN
|
|
116
|
+
)
|
|
117
|
+
case PROGRESS_TAG.Unlocked:
|
|
118
|
+
return (
|
|
119
|
+
questStatus === QUEST_STATUS.DEFAULT ||
|
|
120
|
+
questStatus === QUEST_STATUS.IN_PROGRESS ||
|
|
121
|
+
questStatus === QUEST_STATUS.COMPLETED
|
|
122
|
+
)
|
|
123
|
+
case PROGRESS_TAG.AlreadyCompleted:
|
|
124
|
+
return (
|
|
125
|
+
questStatus === QUEST_STATUS.COMPLETED ||
|
|
126
|
+
questStatus === QUEST_STATUS.ALREADY_COMPLETED
|
|
127
|
+
)
|
|
128
|
+
default:
|
|
129
|
+
console.warn('Unknown progressTag type!', progressTag)
|
|
130
|
+
}
|
|
131
|
+
return true
|
|
132
|
+
},
|
|
133
|
+
[progressTag, questStatusQuery]
|
|
134
|
+
)
|
|
135
|
+
|
|
123
136
|
const typeTagsFilter = Or(
|
|
124
137
|
...TYPE_TAGS.filter((tag) => typeTags[tag.name]).map((tag) => tag.filter)
|
|
125
138
|
)
|
|
@@ -128,7 +141,14 @@ const useToolbarFilter = () => {
|
|
|
128
141
|
(tag) => tag.filter
|
|
129
142
|
)
|
|
130
143
|
)
|
|
131
|
-
|
|
144
|
+
|
|
145
|
+
const toolbarFilter = And(
|
|
146
|
+
searchFilter,
|
|
147
|
+
typeTagsFilter,
|
|
148
|
+
categoryTagsFilter,
|
|
149
|
+
progressTagFilter
|
|
150
|
+
)
|
|
151
|
+
|
|
132
152
|
return toolbarFilter
|
|
133
153
|
}
|
|
134
154
|
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"api_no": 101,
|
|
4
|
+
"api_category": 1,
|
|
5
|
+
"api_type": 4,
|
|
6
|
+
"api_label_type": 1,
|
|
7
|
+
"api_state": 2,
|
|
8
|
+
"api_title": "はじめての「編成」!",
|
|
9
|
+
"api_detail": "2隻以上の艦で構成される「艦隊」を編成せよ!",
|
|
10
|
+
"api_voice_id": 0,
|
|
11
|
+
"api_get_material": [20, 20, 0, 0],
|
|
12
|
+
"api_bonus_flag": 1,
|
|
13
|
+
"api_progress_flag": 0,
|
|
14
|
+
"api_invalid_flag": 0
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"api_no": 202,
|
|
18
|
+
"api_category": 2,
|
|
19
|
+
"api_type": 4,
|
|
20
|
+
"api_label_type": 1,
|
|
21
|
+
"api_state": 2,
|
|
22
|
+
"api_title": "はじめての「出撃」!",
|
|
23
|
+
"api_detail": "艦隊を出撃させ、敵艦隊と交戦せよ!",
|
|
24
|
+
"api_voice_id": 0,
|
|
25
|
+
"api_get_material": [20, 20, 0, 0],
|
|
26
|
+
"api_bonus_flag": 1,
|
|
27
|
+
"api_progress_flag": 0,
|
|
28
|
+
"api_invalid_flag": 0
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"api_no": 301,
|
|
32
|
+
"api_category": 3,
|
|
33
|
+
"api_type": 4,
|
|
34
|
+
"api_label_type": 1,
|
|
35
|
+
"api_state": 3,
|
|
36
|
+
"api_title": "はじめての「演習」!",
|
|
37
|
+
"api_detail": "他の提督(プレイヤー)の艦隊と「演習」を行おう!",
|
|
38
|
+
"api_voice_id": 0,
|
|
39
|
+
"api_get_material": [10, 10, 0, 0],
|
|
40
|
+
"api_bonus_flag": 1,
|
|
41
|
+
"api_progress_flag": 0,
|
|
42
|
+
"api_invalid_flag": 0
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"api_no": 601,
|
|
46
|
+
"api_category": 6,
|
|
47
|
+
"api_type": 4,
|
|
48
|
+
"api_label_type": 1,
|
|
49
|
+
"api_state": 2,
|
|
50
|
+
"api_title": "はじめての「建造」!",
|
|
51
|
+
"api_detail": "「工廠」で鋼材などの資材を使って新しい艦を「建造」しよう!",
|
|
52
|
+
"api_voice_id": 0,
|
|
53
|
+
"api_get_material": [50, 50, 50, 50],
|
|
54
|
+
"api_bonus_flag": 1,
|
|
55
|
+
"api_progress_flag": 0,
|
|
56
|
+
"api_invalid_flag": 0
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"api_no": 701,
|
|
60
|
+
"api_category": 7,
|
|
61
|
+
"api_type": 4,
|
|
62
|
+
"api_label_type": 1,
|
|
63
|
+
"api_state": 1,
|
|
64
|
+
"api_title": "はじめての「近代化改修」!",
|
|
65
|
+
"api_detail": "任意の艦を近代化改修(合成)して、強化せよ!",
|
|
66
|
+
"api_voice_id": 0,
|
|
67
|
+
"api_get_material": [0, 0, 50, 30],
|
|
68
|
+
"api_bonus_flag": 1,
|
|
69
|
+
"api_progress_flag": 0,
|
|
70
|
+
"api_invalid_flag": 0
|
|
71
|
+
}
|
|
72
|
+
]
|