/kcwiki-quest-data

The Structured data for the Kantai Collection quest

Primary LanguageTypeScript

Kcwiki Quest Data

npm npm bundle size build

The Structured data for Kantai Collection quest

Supported features

  • Auto complete for quest data

image

  • Hover documentation

image

  • Types support
  • JSON schema support
  • Unit test
  • Linter
  • CI/CD
  • Monitor new quest data from poi server dump

image

Instructions

Quest data update

  • Clone this repo
  • Run npm install
  • Run npm run generateSchema
  • Edit data/*.json or draft/*.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"

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>

Reference