Skip to main content

CachedAssetsManager

Index

Constructors

constructor

Properties

_cacheUpdater

_cacheUpdater: any

readonly_excels

_excels: (AvatarConfig | ItemConfigAvatar | DamageType | AvatarBaseType | AvatarSkillConfig | AvatarSkillTreeConfig | AvatarRankConfig | AvatarPromotionConfig | EquipmentConfig | ItemConfigEquipment | EquipmentExpType | EquipmentSkillConfig | EquipmentPromotionConfig | RelicConfig | ItemConfigRelic | RelicExpType | RelicMainAffixConfig | RelicSubAffixConfig | RelicSetConfig | RelicSetSkillConfig | RelicBaseType | AvatarPropertyConfig | ItemConfigAvatarPlayerIcon | AvatarPlayerIcon | ItemPlayerCard | PlayerIcon)[]

List of the names of the files this library uses

_githubCache

_githubCache: any

_isFetching

_isFetching: boolean

readonly_langs

_langs: readonly [chs, cht, de, en, es, fr, id, jp, kr, pt, ru, th, vi]

List of supported languages

cacheDirectoryPath

cacheDirectoryPath: string

Path of directory where StarRail cache data is stored

readonlyclient

client: StarRail

The client that instantiated this

readonlydefaultCacheDirectoryPath

defaultCacheDirectoryPath: string

Default path of StarRail cache data directory

Methods

_downloadCacheZip

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

_getExcelData

  • _getExcelData<T>(excel: T): SingleBy<{ AvatarBaseType: readonly [readonly [ID, Unknown]]; AvatarConfig: readonly [AvatarID]; AvatarPlayerIcon: readonly [ID]; AvatarPromotionConfig: readonly [AvatarID, readonly [Promotion, 0]]; AvatarPropertyConfig: readonly [PropertyType]; AvatarRankConfig: readonly [RankID]; AvatarSkillConfig: readonly [SkillID, Level]; AvatarSkillTreeConfig: readonly [PointID, Level]; DamageType: readonly [ID]; EquipmentConfig: readonly [EquipmentID]; EquipmentExpType: readonly [ExpType, Level]; EquipmentPromotionConfig: readonly [EquipmentID, readonly [Promotion, 0]]; EquipmentSkillConfig: readonly [SkillID, Level]; ItemConfigAvatar: readonly [ID]; ItemConfigAvatarPlayerIcon: readonly [ID]; ItemConfigEquipment: readonly [ID]; ItemConfigRelic: readonly [ID]; ItemPlayerCard: readonly [ID]; PlayerIcon: readonly [ID]; RelicBaseType: readonly [readonly [Type, All]]; RelicConfig: readonly [ID]; RelicExpType: readonly [TypeID, readonly [Level, 0]]; RelicMainAffixConfig: readonly [GroupID, AffixID]; RelicSetConfig: readonly [SetID]; RelicSetSkillConfig: readonly [SetID, RequireNum]; RelicSubAffixConfig: readonly [GroupID, AffixID] }[T]>
  • Type parameters

    • T: AvatarConfig | ItemConfigAvatar | DamageType | AvatarBaseType | AvatarSkillConfig | AvatarSkillTreeConfig | AvatarRankConfig | AvatarPromotionConfig | EquipmentConfig | ItemConfigEquipment | EquipmentExpType | EquipmentSkillConfig | EquipmentPromotionConfig | RelicConfig | ItemConfigRelic | RelicExpType | RelicMainAffixConfig | RelicSubAffixConfig | RelicSetConfig | RelicSetSkillConfig | RelicBaseType | AvatarPropertyConfig | ItemConfigAvatarPlayerIcon | AvatarPlayerIcon | ItemPlayerCard | PlayerIcon

    Parameters

    • excel: T

      without extensions (.json)

    Returns SingleBy<{ AvatarBaseType: readonly [readonly [ID, Unknown]]; AvatarConfig: readonly [AvatarID]; AvatarPlayerIcon: readonly [ID]; AvatarPromotionConfig: readonly [AvatarID, readonly [Promotion, 0]]; AvatarPropertyConfig: readonly [PropertyType]; AvatarRankConfig: readonly [RankID]; AvatarSkillConfig: readonly [SkillID, Level]; AvatarSkillTreeConfig: readonly [PointID, Level]; DamageType: readonly [ID]; EquipmentConfig: readonly [EquipmentID]; EquipmentExpType: readonly [ExpType, Level]; EquipmentPromotionConfig: readonly [EquipmentID, readonly [Promotion, 0]]; EquipmentSkillConfig: readonly [SkillID, Level]; ItemConfigAvatar: readonly [ID]; ItemConfigAvatarPlayerIcon: readonly [ID]; ItemConfigEquipment: readonly [ID]; ItemConfigRelic: readonly [ID]; ItemPlayerCard: readonly [ID]; PlayerIcon: readonly [ID]; RelicBaseType: readonly [readonly [Type, All]]; RelicConfig: readonly [ID]; RelicExpType: readonly [TypeID, readonly [Level, 0]]; RelicMainAffixConfig: readonly [GroupID, AffixID]; RelicSetConfig: readonly [SetID]; RelicSetSkillConfig: readonly [SetID, RequireNum]; RelicSubAffixConfig: readonly [GroupID, AffixID] }[T]>

activateAutoCacheUpdater

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

    • options: { ghproxy?: boolean; instant?: boolean; onError?: (error: Error) => Promise<void>; onUpdateEnd?: () => Promise<void>; onUpdateStart?: () => Promise<void>; timeout?: number; useRawStarRailData?: 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(useRawStarRailData?: boolean): Promise<boolean>

  • Parameters

    Returns Promise<boolean>

    Whether the game data update is available or not.

deactivateAutoCacheUpdater

  • deactivateAutoCacheUpdater(): void

fetchAllContents

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

    • options: { ghproxy?: boolean; useRawStarRailData?: boolean }

    Returns Promise<void>

fetchLanguageData

  • fetchLanguageData(lang: chs | cht | de | en | es | fr | id | jp | kr | pt | ru | th | vi): Promise<{}>
  • Obtains a text map for a specific language.


    Parameters

    • lang: chs | cht | de | en | es | fr | id | jp | kr | pt | ru | th | vi

    Returns Promise<{}>

formatExcel

  • formatExcel<T>(excel: T, data: JsonObject[]): SingleBy<{ AvatarBaseType: readonly [readonly [ID, Unknown]]; AvatarConfig: readonly [AvatarID]; AvatarPlayerIcon: readonly [ID]; AvatarPromotionConfig: readonly [AvatarID, readonly [Promotion, 0]]; AvatarPropertyConfig: readonly [PropertyType]; AvatarRankConfig: readonly [RankID]; AvatarSkillConfig: readonly [SkillID, Level]; AvatarSkillTreeConfig: readonly [PointID, Level]; DamageType: readonly [ID]; EquipmentConfig: readonly [EquipmentID]; EquipmentExpType: readonly [ExpType, Level]; EquipmentPromotionConfig: readonly [EquipmentID, readonly [Promotion, 0]]; EquipmentSkillConfig: readonly [SkillID, Level]; ItemConfigAvatar: readonly [ID]; ItemConfigAvatarPlayerIcon: readonly [ID]; ItemConfigEquipment: readonly [ID]; ItemConfigRelic: readonly [ID]; ItemPlayerCard: readonly [ID]; PlayerIcon: readonly [ID]; RelicBaseType: readonly [readonly [Type, All]]; RelicConfig: readonly [ID]; RelicExpType: readonly [TypeID, readonly [Level, 0]]; RelicMainAffixConfig: readonly [GroupID, AffixID]; RelicSetConfig: readonly [SetID]; RelicSetSkillConfig: readonly [SetID, RequireNum]; RelicSubAffixConfig: readonly [GroupID, AffixID] }[T]>
  • Type parameters

    • T: AvatarConfig | ItemConfigAvatar | DamageType | AvatarBaseType | AvatarSkillConfig | AvatarSkillTreeConfig | AvatarRankConfig | AvatarPromotionConfig | EquipmentConfig | ItemConfigEquipment | EquipmentExpType | EquipmentSkillConfig | EquipmentPromotionConfig | RelicConfig | ItemConfigRelic | RelicExpType | RelicMainAffixConfig | RelicSubAffixConfig | RelicSetConfig | RelicSetSkillConfig | RelicBaseType | AvatarPropertyConfig | ItemConfigAvatarPlayerIcon | AvatarPlayerIcon | ItemPlayerCard | PlayerIcon

    Parameters

    • excel: T
    • data: JsonObject[]

    Returns SingleBy<{ AvatarBaseType: readonly [readonly [ID, Unknown]]; AvatarConfig: readonly [AvatarID]; AvatarPlayerIcon: readonly [ID]; AvatarPromotionConfig: readonly [AvatarID, readonly [Promotion, 0]]; AvatarPropertyConfig: readonly [PropertyType]; AvatarRankConfig: readonly [RankID]; AvatarSkillConfig: readonly [SkillID, Level]; AvatarSkillTreeConfig: readonly [PointID, Level]; DamageType: readonly [ID]; EquipmentConfig: readonly [EquipmentID]; EquipmentExpType: readonly [ExpType, Level]; EquipmentPromotionConfig: readonly [EquipmentID, readonly [Promotion, 0]]; EquipmentSkillConfig: readonly [SkillID, Level]; ItemConfigAvatar: readonly [ID]; ItemConfigAvatarPlayerIcon: readonly [ID]; ItemConfigEquipment: readonly [ID]; ItemConfigRelic: readonly [ID]; ItemPlayerCard: readonly [ID]; PlayerIcon: readonly [ID]; RelicBaseType: readonly [readonly [Type, All]]; RelicConfig: readonly [ID]; RelicExpType: readonly [TypeID, readonly [Level, 0]]; RelicMainAffixConfig: readonly [GroupID, AffixID]; RelicSetConfig: readonly [SetID]; RelicSetSkillConfig: readonly [SetID, RequireNum]; RelicSubAffixConfig: readonly [GroupID, AffixID] }[T]>

getExcelData

  • getExcelData<T, U>(excel: T, ...keys: U): IndexBy<SingleBy<{ AvatarBaseType: readonly [readonly [ID, Unknown]]; AvatarConfig: readonly [AvatarID]; AvatarPlayerIcon: readonly [ID]; AvatarPromotionConfig: readonly [AvatarID, readonly [Promotion, 0]]; AvatarPropertyConfig: readonly [PropertyType]; AvatarRankConfig: readonly [RankID]; AvatarSkillConfig: readonly [SkillID, Level]; AvatarSkillTreeConfig: readonly [PointID, Level]; DamageType: readonly [ID]; EquipmentConfig: readonly [EquipmentID]; EquipmentExpType: readonly [ExpType, Level]; EquipmentPromotionConfig: readonly [EquipmentID, readonly [Promotion, 0]]; EquipmentSkillConfig: readonly [SkillID, Level]; ItemConfigAvatar: readonly [ID]; ItemConfigAvatarPlayerIcon: readonly [ID]; ItemConfigEquipment: readonly [ID]; ItemConfigRelic: readonly [ID]; ItemPlayerCard: readonly [ID]; PlayerIcon: readonly [ID]; RelicBaseType: readonly [readonly [Type, All]]; RelicConfig: readonly [ID]; RelicExpType: readonly [TypeID, readonly [Level, 0]]; RelicMainAffixConfig: readonly [GroupID, AffixID]; RelicSetConfig: readonly [SetID]; RelicSetSkillConfig: readonly [SetID, RequireNum]; RelicSubAffixConfig: readonly [GroupID, AffixID] }[T]>, U>
  • Type parameters

    • T: AvatarConfig | ItemConfigAvatar | DamageType | AvatarBaseType | AvatarSkillConfig | AvatarSkillTreeConfig | AvatarRankConfig | AvatarPromotionConfig | EquipmentConfig | ItemConfigEquipment | EquipmentExpType | EquipmentSkillConfig | EquipmentPromotionConfig | RelicConfig | ItemConfigRelic | RelicExpType | RelicMainAffixConfig | RelicSubAffixConfig | RelicSetConfig | RelicSetSkillConfig | RelicBaseType | AvatarPropertyConfig | ItemConfigAvatarPlayerIcon | AvatarPlayerIcon | ItemPlayerCard | PlayerIcon
    • U: (string | number)[]

    Parameters

    • excel: T

      without extension (.json)

    • rest...keys: U

    Returns IndexBy<SingleBy<{ AvatarBaseType: readonly [readonly [ID, Unknown]]; AvatarConfig: readonly [AvatarID]; AvatarPlayerIcon: readonly [ID]; AvatarPromotionConfig: readonly [AvatarID, readonly [Promotion, 0]]; AvatarPropertyConfig: readonly [PropertyType]; AvatarRankConfig: readonly [RankID]; AvatarSkillConfig: readonly [SkillID, Level]; AvatarSkillTreeConfig: readonly [PointID, Level]; DamageType: readonly [ID]; EquipmentConfig: readonly [EquipmentID]; EquipmentExpType: readonly [ExpType, Level]; EquipmentPromotionConfig: readonly [EquipmentID, readonly [Promotion, 0]]; EquipmentSkillConfig: readonly [SkillID, Level]; ItemConfigAvatar: readonly [ID]; ItemConfigAvatarPlayerIcon: readonly [ID]; ItemConfigEquipment: readonly [ID]; ItemConfigRelic: readonly [ID]; ItemPlayerCard: readonly [ID]; PlayerIcon: readonly [ID]; RelicBaseType: readonly [readonly [Type, All]]; RelicConfig: readonly [ID]; RelicExpType: readonly [TypeID, readonly [Level, 0]]; RelicMainAffixConfig: readonly [GroupID, AffixID]; RelicSetConfig: readonly [SetID]; RelicSetSkillConfig: readonly [SetID, RequireNum]; RelicSubAffixConfig: readonly [GroupID, AffixID] }[T]>, U>

getJSONDataPath

  • getJSONDataPath(name: string): string

  • Parameters

    • name: string

      without extensions (.json)

    Returns string

    excel bin file path

getLanguageData

  • getLanguageData(lang: chs | cht | de | en | es | fr | id | jp | kr | pt | ru | th | vi): {}

  • Parameters

    • lang: chs | cht | de | en | es | fr | id | jp | kr | pt | ru | th | vi

    Returns {}

    text map for a specific language

    • [key string]: string

getLanguageDataPath

  • getLanguageDataPath(lang: chs | cht | de | en | es | fr | id | jp | kr | pt | ru | th | vi): string

  • Parameters

    • lang: chs | cht | de | en | es | fr | id | jp | kr | pt | ru | th | vi

    Returns string

    text map file path for a specific language

getObjectKeysManager

hasAllContents

  • hasAllContents(): boolean

  • Returns boolean

    whether all StarRail 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>; useRawStarRailData?: boolean }): Promise<void>

  • Parameters

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

    Returns Promise<void>

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