poi-plugin-quest-info-2 0.12.2 → 0.12.4
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/CHANGELOG.md +13 -0
- package/build/kcQuestsData/DATA_VERSION +1 -1
- package/build/kcQuestsData/index.ts +1 -1
- package/build/kcQuestsData/quests-scn-new.json +0 -5
- package/build/kcQuestsData/quests-scn.json +5 -57
- package/build/kcanotifyGamedata/DATA_VERSION +1 -1
- package/build/kcanotifyGamedata/index.ts +1 -1
- package/build/kcanotifyGamedata/quests-en.json +220 -100
- package/build/kcanotifyGamedata/quests-jp.json +228 -105
- package/build/kcanotifyGamedata/quests-ko.json +228 -105
- package/build/kcanotifyGamedata/quests-scn.json +228 -105
- package/build/kcanotifyGamedata/quests-tcn.json +228 -105
- package/build/prePostQuest.json +2 -44
- package/build/questCategory.json +12 -6
- package/build/questCodeMap.json +0 -5
- package/package.json +1 -1
- package/src/App.tsx +4 -4
- package/src/__tests__/__snapshots__/questCategory.spec.ts.snap +2 -2
- package/src/__tests__/__snapshots__/questHelper.spec.ts.snap +0 -4
- 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/patch.ts +25 -13
package/src/patch.ts
CHANGED
|
@@ -19,7 +19,7 @@ const isLegacyQuestPluginEnabled = async () => {
|
|
|
19
19
|
const poiStore = await getPoiStore()
|
|
20
20
|
const legacyQuestPlugin = poiStore
|
|
21
21
|
.getState()
|
|
22
|
-
.plugins
|
|
22
|
+
.plugins?.find((i) => i.id === LEGACY_QUEST_PLUGIN_ID)
|
|
23
23
|
if (legacyQuestPlugin && legacyQuestPlugin.enabled) {
|
|
24
24
|
return true
|
|
25
25
|
}
|
|
@@ -40,13 +40,21 @@ const getQuestState = (maybeLanguage: string) => {
|
|
|
40
40
|
: QuestData[maybeLanguage]
|
|
41
41
|
|
|
42
42
|
return Object.fromEntries(
|
|
43
|
-
Object.entries(data).map(([apiNo,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
Object.entries(data).map(([apiNo, d]) => {
|
|
44
|
+
const typedData = d as (typeof data)[keyof typeof data]
|
|
45
|
+
return [
|
|
46
|
+
apiNo,
|
|
47
|
+
{
|
|
48
|
+
wiki_id: typedData.code,
|
|
49
|
+
condition: [
|
|
50
|
+
'memo2' in typedData ? typedData.memo2 : undefined,
|
|
51
|
+
typedData.desc,
|
|
52
|
+
]
|
|
53
|
+
.filter(Boolean)
|
|
54
|
+
.join(' | '),
|
|
55
|
+
},
|
|
56
|
+
]
|
|
57
|
+
}),
|
|
50
58
|
)
|
|
51
59
|
}
|
|
52
60
|
|
|
@@ -57,13 +65,17 @@ const getQuestState = (maybeLanguage: string) => {
|
|
|
57
65
|
*/
|
|
58
66
|
export const patchLegacyQuestPluginReducer = async () => {
|
|
59
67
|
if (await isLegacyQuestPluginEnabled()) {
|
|
60
|
-
//
|
|
68
|
+
// skip patch if legacy quest plugin enabled
|
|
61
69
|
return
|
|
62
70
|
}
|
|
63
71
|
|
|
64
72
|
try {
|
|
65
|
-
const i18next: i18n
|
|
66
|
-
|
|
73
|
+
const i18next: i18n | { default: i18n; __esModule: true } =
|
|
74
|
+
await importFromPoi('views/env-parts/i18next')
|
|
75
|
+
// Fix https://github.com/poooi/poi/issues/2539
|
|
76
|
+
const language =
|
|
77
|
+
'__esModule' in i18next ? i18next.default.language : i18next.language
|
|
78
|
+
|
|
67
79
|
const initState = {
|
|
68
80
|
[HACK_KEY]: true,
|
|
69
81
|
quests: getQuestState(language),
|
|
@@ -102,13 +114,13 @@ export const patchLegacyQuestPluginReducer = async () => {
|
|
|
102
114
|
*/
|
|
103
115
|
export const clearPatchLegacyQuestPluginReducer = async () => {
|
|
104
116
|
if (await isLegacyQuestPluginEnabled()) {
|
|
105
|
-
//
|
|
117
|
+
// skip clear if legacy quest plugin enabled
|
|
106
118
|
return
|
|
107
119
|
}
|
|
108
120
|
try {
|
|
109
121
|
const { extendReducer } = await importFromPoi('views/create-store')
|
|
110
122
|
const clearReducer = undefined
|
|
111
|
-
extendReducer(
|
|
123
|
+
extendReducer(LEGACY_QUEST_PLUGIN_ID, clearReducer)
|
|
112
124
|
} catch (e) {
|
|
113
125
|
console.error('Clear hack quest plugin reducer error', e)
|
|
114
126
|
}
|