kcwiki-quest-data
v0.8.0
Published
Kancolle Quest Data
Downloads
9
Readme
Kcwiki Quest Data
The Structured data for Kantai Collection quest
Supported features
- Auto complete for quest data
- Hover documentation
- Types support
- JSON schema support
- Unit test
- Linter
- CI/CD
- Monitor new quest data from poi server dump
Instructions
Quest data update
- Clone this repo
- Run
npm install
- Run
npm run generateSchema
- Edit
data/*.json
ordraft/*.json
in vscode
Use in other libraries
To install the latest version, run the following command:
# Stable version
npm install kcwiki-quest-data
# Nightly version
npm install kcwikizh/kcwiki-quest-data#nightly
Or if you're using yarn:
# Stable version
yarn add kcwiki-quest-data
# Nightly version
yarn add kcwikizh/kcwiki-quest-data#nightly
import type { Quest } from 'kcwiki-quest-data' // quest json type
import { questData } from 'kcwiki-quest-data' // all quests json array
import { questDataMap } from 'kcwiki-quest-data' // all quests json keyBy game_id
import quest101 from 'kcwiki-quest-data/data/101.json'
import { QuestHelper } from 'kcwiki-quest-data'
QuestHelper.of(101).ensure()?.unwrap().wiki_id // "A01"
QuestHelper.of(101).ensure(
(questContainer) => console.log(questContainer.unwrap().wiki_id),
(err) => console.error('Error!', err),
) // "A01"
QuestHelper.of(99999999).forceEnsure().unwrap().name // "UNKNOWN_QUEST"
- Or use gh-pages/data.min.json directly
API
Quest
The type of quest json.
QuestHelper
Basic
static QuestHelper.of(gameId: number): MaybeQuest
static QuestHelper.of(quest: Quest): QuestHelper
QuestHelper.id: number
QuestHelper.unwrap(): Quest
Utils
QuestHelper.translate(lng: string): string
QuestHelper.getPrerequisite(): QuestHelper[]
QuestHelper.getPostQuest(): QuestHelper[]
MaybeQuest
MaybeQuest.ensure(): QuestHelper | undefined
MaybeQuest.ensure((questContainer: QuestHelper) => {}, (error: Error) => {})
MaybeQuest.forceEnsure(): QuestHelper<Quest | UNKNOWN_QUEST>