poi-plugin-quest-info-2
Advanced tools
Comparing version 0.5.1 to 0.5.2
@@ -7,2 +7,2 @@ import zh_CN from './quests-scn.json' | ||
export const version = 'eb8a7fca38fed2c16e027f2563e93e826d24e30f' | ||
export const version = '8b04b6a053b2c3459768b91b6b32792a6068d25a' |
{ | ||
"name": "poi-plugin-quest-info-2", | ||
"version": "0.5.1", | ||
"version": "0.5.2", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "description": "show quest info", |
@@ -10,2 +10,4 @@ import { name as PACKAGE_NAME } from '../package.json' | ||
} from './store' | ||
import type { i18n } from 'i18next' | ||
const LEGACY_QUEST_PLUGIN_ID = 'poi-plugin-quest-info' | ||
@@ -61,32 +63,33 @@ const HACK_KEY = `__patched-from-${PACKAGE_NAME}` | ||
const language = (globalThis as any).i18next.language | ||
const initState = { | ||
[HACK_KEY]: true, | ||
quests: getQuestState(language), | ||
questStatus: {}, | ||
} | ||
try { | ||
const i18next: i18n = await importFromPoi('views/env-parts/i18next') | ||
const language = i18next.language | ||
const initState = { | ||
[HACK_KEY]: true, | ||
quests: getQuestState(language), | ||
questStatus: {}, | ||
} | ||
const reducer = ( | ||
state = initState, | ||
action: { type: string; [x: string]: any } | ||
) => { | ||
switch (action.type) { | ||
case '@@Config': | ||
// change language | ||
if (action.path === 'poi.misc.language') { | ||
const newLanguage = action.value | ||
return { | ||
...state, | ||
quests: getQuestState(newLanguage), | ||
const reducer = ( | ||
state = initState, | ||
action: { type: string; [x: string]: any } | ||
) => { | ||
switch (action.type) { | ||
case '@@Config': | ||
// change language | ||
if (action.path === 'poi.misc.language') { | ||
const newLanguage = action.value | ||
return { | ||
...state, | ||
quests: getQuestState(newLanguage), | ||
} | ||
} | ||
} | ||
} | ||
return state | ||
} | ||
return state | ||
} | ||
try { | ||
const { extendReducer } = await importFromPoi('views/create-store') | ||
extendReducer(LEGACY_QUEST_PLUGIN_ID, reducer) | ||
} catch (e) { | ||
console.warn('Hack quest plugin reducer error', e) | ||
console.error('Hack quest plugin reducer error', e) | ||
} | ||
@@ -110,4 +113,4 @@ } | ||
} catch (e) { | ||
console.warn('Clear hack quest plugin reducer error', e) | ||
console.error('Clear hack quest plugin reducer error', e) | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
1453414
24065