Skip to main content

CachedAssetsManager

Index

Constructors

constructor

Properties

_cacheUpdater

_cacheUpdater: any

readonly_contentsSrc

_contentsSrc: string[]

List of the names of the files this library uses

_githubCache

_githubCache: any

_isFetching

_isFetching: boolean

readonly_langs

_langs: string[]

List of supported languages

cacheDirectoryPath

cacheDirectoryPath: string

Path of directory where genshin cache data is stored

readonlydefaultCacheDirectoryPath

defaultCacheDirectoryPath: string

Default path of genshin cache data directory

readonlyenka

The client that instantiated this

Methods

_downloadCacheZip

  • _downloadCacheZip(options?: { ghproxy?: boolean }): Promise<void>

_validateCache

  • _validateCache(showLog?: boolean): boolean

  • Parameters

    • showLog: boolean = true

    Returns boolean

    whether the cache is valid or not

activateAutoCacheUpdater

  • activateAutoCacheUpdater(options?: { ghproxy?: boolean; instant?: boolean; onError?: (error: Error) => Promise<void>; onUpdateEnd?: () => Promise<void>; onUpdateStart?: () => Promise<void>; timeout?: number; useRawGenshinData?: boolean }): void
  • Parameters

    • options: { ghproxy?: boolean; instant?: boolean; onError?: (error: Error) => Promise<void>; onUpdateEnd?: () => Promise<void>; onUpdateStart?: () => Promise<void>; timeout?: number; useRawGenshinData?: boolean } = {}

    Returns void

cacheDirectorySetup

  • cacheDirectorySetup(): Promise<void>
  • Create the necessary folders and files, and if the directory cacheDirectoryPath did not exist, move the cache files from the default path.


    Returns Promise<void>

checkForUpdates

  • checkForUpdates(useRawGenshinData?: boolean): Promise<boolean>

  • Parameters

    Returns Promise<boolean>

    Whether the game data update is available or not.

deactivateAutoCacheUpdater

  • deactivateAutoCacheUpdater(): void

fetchAllContents

  • fetchAllContents(options?: { ghproxy?: boolean; useRawGenshinData?: boolean }): Promise<void>
  • Parameters

    • options: { ghproxy?: boolean; useRawGenshinData?: boolean } = {}

    Returns Promise<void>

fetchLanguageData

  • Obtains a text map for a specific language.


    Parameters

    Returns Promise<{}>

getGenshinCacheData

  • getGenshinCacheData(name: string): JsonReader
  • Parameters

    • name: string

      without extensions (.json)

    Returns JsonReader

getJSONDataPath

  • getJSONDataPath(name: string): string

  • Parameters

    • name: string

      without extensions (.json)

    Returns string

    excel bin file path

getLanguageData


  • Parameters

    Returns {}

    text map for a specific language

    • [key string]: string

getLanguageDataPath

  • getLanguageDataPath(lang: LanguageCode, directory?: string): string

  • Parameters

    Returns string

    text map file path for a specific language

getObjectKeysManager

hasAllContents

  • hasAllContents(): boolean

  • Returns boolean

    whether all genshin cache data files exist.

refreshAllData

  • refreshAllData(reload?: boolean): void
  • Clean memory of cache data. Then reload data that was loaded before the clean if reload is true. If reload is false, load each file as needed.


    Parameters

    • reload: boolean = false

    Returns void

removeUnusedTextData

updateContents

  • updateContents(options?: { ghproxy?: boolean; onUpdateEnd?: () => Promise<void>; onUpdateStart?: () => Promise<void>; useRawGenshinData?: boolean }): Promise<void>

  • Parameters

    • options: { ghproxy?: boolean; onUpdateEnd?: () => Promise<void>; onUpdateStart?: () => Promise<void>; useRawGenshinData?: boolean } = {}

    Returns Promise<void>

    true if there were any updates, false if there were no updates.