### Install starrail.js Source: https://starrail.vercel.app/api/index Installs the starrail.js library using npm. Supports options for using a proxy or skipping cache data download. ```bash npm install starrail.js@latest ``` ```bash npm install starrail.js@latest --sr-ghproxy=true ``` ```bash npm install starrail.js@latest --sr-nocache=true ``` -------------------------------- ### Cache Directory Setup Source: https://starrail.vercel.app/api/class/CachedAssetsManager Sets up the cache directory by creating necessary folders and files. If the directory does not exist, it moves cache files from the default path. ```APIDOC ## POST /cacheDirectorySetup ### Description Sets up the cache directory by creating necessary folders and files. If the directory does not exist, it moves cache files from the default path. ### Method POST ### Endpoint /cacheDirectorySetup ### Response #### Success Response (200) - **void** - Indicates that the cache directory setup is complete. #### Response Example ```json { "message": "Cache directory setup complete" } ``` ``` -------------------------------- ### Get All Star Rail Light Cones Source: https://starrail.vercel.app/api/index Retrieves a list of all available Light Cones in Honkai: Star Rail. The example demonstrates how to map and print the names of these Light Cones in Japanese. ```javascript const { StarRail } = require("starrail.js"); const client = new StarRail(); const lightCones = client.getAllLightCones(); // print light cone names in language "jp" console.log(lightCones.map(w => w.name.get("jp"))); ``` -------------------------------- ### Get All Star Rail Characters Source: https://starrail.vercel.app/api/index Fetches a list of all available characters in Honkai: Star Rail. The example shows how to map and print the names of these characters in English. ```javascript const { StarRail } = require("starrail.js"); const client = new StarRail(); const characters = client.getAllCharacters(); // print character names in language "en" console.log(characters.map(c => c.name.get("en"))); ``` -------------------------------- ### Cache Directory Setup Source: https://starrail.vercel.app/api/class/CachedAssetsManager Sets up the cache directory by creating necessary folders and files. If the specified directory does not exist, it moves cache files from a default location. ```typescript declare function __cacheDirectorySetup(): Promise; ``` -------------------------------- ### Get Light Cone Stats by Level Source: https://starrail.vercel.app/api/class/LightConeData Retrieves the stats of a Light Cone at a specific ascension and level. ```APIDOC ## GET /websites/starrail_vercel_app_api/LightConeData/{id}/stats ### Description Retrieves the stats of a Light Cone at a specific ascension and level. ### Method GET ### Endpoint /websites/starrail_vercel_app_api/LightConeData/{id}/stats ### Parameters #### Path Parameters - **id** (number) - Required - The unique identifier for the Light Cone. #### Query Parameters - **ascension** (number) - Required - The ascension level of the Light Cone. - **level** (number) - Required - The level of the Light Cone. ### Response #### Success Response (200) - **StatPropertyValue[]** (array) - An array of stat property values for the Light Cone at the specified level. #### Response Example ```json [ { "type": "HP", "value": 1000 }, { "type": "ATK", "value": 500 } ] ``` ``` -------------------------------- ### Get Replaced Text Source: https://starrail.vercel.app/api/class/DynamicTextAssets Retrieves text with replacements applied. It accepts an array of parameters for replacement and an optional language. This method throws an error if the asset is not found. ```typescript __getReplacedText(replaceWith?: paramList[], lang?: chs | cht | de | en | es | fr | id | jp | kr | pt | ru | th | vi): string ``` -------------------------------- ### Get Light Cone Superimposition Stats Source: https://starrail.vercel.app/api/class/LightConeData Retrieves the stats of a Light Cone at a specific superimposition level. ```APIDOC ## GET /websites/starrail_vercel_app_api/LightConeData/{id}/superimpositionStats ### Description Retrieves the stats of a Light Cone at a specific superimposition level. ### Method GET ### Endpoint /websites/starrail_vercel_app_api/LightConeData/{id}/superimpositionStats ### Parameters #### Path Parameters - **id** (number) - Required - The unique identifier for the Light Cone. #### Query Parameters - **superimposition** (number) - Required - The superimposition level of the Light Cone. ### Response #### Success Response (200) - **StatPropertyValue[]** (array) - An array of stat property values for the Light Cone at the specified superimposition level. #### Response Example ```json [ { "type": "CRIT Rate", "value": 0.05 }, { "type": "DMG Boost", "value": 0.10 } ] ``` ``` -------------------------------- ### GET /api/hasAllContents Source: https://starrail.vercel.app/api/class/CachedAssetsManager Checks if all Star Rail cache data files exist on the server. ```APIDOC ## GET /api/hasAllContents ### Description Checks if all Star Rail cache data files exist on the server. ### Method GET ### Endpoint /api/hasAllContents ### Parameters None ### Response #### Success Response (200) - **exists** (boolean) - True if all cache data files exist, false otherwise. #### Response Example ```json { "exists": true } ``` ``` -------------------------------- ### CharacterBuilder Constructor Source: https://starrail.vercel.app/api/class/CharacterBuilder Initializes a new instance of the CharacterBuilder class. This constructor is used to start the character building process. ```typescript new CharacterBuilder(): CharacterBuilder ``` -------------------------------- ### Get Next Skill Tree Nodes Source: https://starrail.vercel.app/api/class/LeveledSkillTreeNode Returns an array of SkillTreeNode objects that are directly accessible from the current node. ```typescript __getNextNodes(): SkillTreeNode[] ``` -------------------------------- ### Get Text Asset by Language Source: https://starrail.vercel.app/api/class/DynamicTextAssets Retrieves a text asset for a specified language. If the language is not provided, it defaults to a system default. This method may throw an error if the asset is not found. ```typescript __get(lang?: chs | cht | de | en | es | fr | id | jp | kr | pt | ru | th | vi): string ``` -------------------------------- ### Get Nullable Text Asset Source: https://starrail.vercel.app/api/class/DynamicTextAssets Retrieves a text asset as a string, returning null instead of throwing an error if the asset is not found. Supports language specification. ```typescript __getNullable(lang?: chs | cht | de | en | es | fr | id | jp | kr | pt | ru | th | vi): null | string ``` -------------------------------- ### GET /api/getObjectKeysManager Source: https://starrail.vercel.app/api/class/CachedAssetsManager Returns an instance of ObjectKeysManager, which likely manages keys for various game objects. ```APIDOC ## GET /api/getObjectKeysManager ### Description Returns an instance of ObjectKeysManager, which likely manages keys for various game objects. ### Method GET ### Endpoint /api/getObjectKeysManager ### Parameters None ### Response #### Success Response (200) - **manager** (ObjectKeysManager) - An instance of the ObjectKeysManager. #### Response Example ```json { "manager": "[ObjectKeysManager Instance]" } ``` ``` -------------------------------- ### Get Nullable Replaced Text Source: https://starrail.vercel.app/api/class/DynamicTextAssets Retrieves text with replacements applied, returning null if the asset is not found. It accepts an array of parameters for replacement and an optional language. ```typescript __getNullableReplacedText(replaceWith?: paramList[], lang?: chs | cht | de | en | es | fr | id | jp | kr | pt | ru | th | vi): null | string ``` -------------------------------- ### Get Skill Tree Node by Level Source: https://starrail.vercel.app/api/class/LeveledSkillTreeNode Retrieves a specific LeveledSkillTreeNode based on the provided SkillLevel. ```typescript __getSkillTreeNodeByLevel(level: SkillLevel): LeveledSkillTreeNode ``` -------------------------------- ### Get Formatted Text Asset Source: https://starrail.vercel.app/api/class/DynamicTextAssets Retrieves a text asset and returns it as a FormattedText object. It supports specifying the language. This method may throw an error if the asset is not found. ```typescript __getAsFormattedText(lang?: chs | cht | de | en | es | fr | id | jp | kr | pt | ru | th | vi): FormattedText ``` -------------------------------- ### GET /api/getLanguageData Source: https://starrail.vercel.app/api/class/CachedAssetsManager Fetches text data for a specified language. This is useful for displaying in-game text, item descriptions, and other localized content. ```APIDOC ## GET /api/getLanguageData ### Description Fetches text data for a specified language. This is useful for displaying in-game text, item descriptions, and other localized content. ### Method GET ### Endpoint /api/getLanguageData ### Parameters #### Query Parameters - **lang** (string) - Required - The language code for the desired text data. Supported values: chs, cht, de, en, es, fr, id, jp, kr, pt, ru, th, vi. ### Request Example ```json { "lang": "en" } ``` ### Response #### Success Response (200) - **data** (JsonObject) - A JSON object containing key-value pairs of localized text strings. #### Response Example ```json { "data": { "UI_Common_Confirm": "Confirm", "Item_Name_1001": "Trailblaze Power" } } ``` ``` -------------------------------- ### Get Previous Skill Tree Node Source: https://starrail.vercel.app/api/class/LeveledSkillTreeNode Returns the SkillTreeNode object that precedes the current node in the skill tree, or null if there is no previous node. ```typescript __getPreviousNodes(): null | SkillTreeNode ``` -------------------------------- ### Get Replaced Data Source: https://starrail.vercel.app/api/class/DynamicTextAssets Retrieves text with replacements applied. It accepts an array of parameters for replacement and an optional language. The output includes the replaced text and indices of used parameters. This method throws an error if the asset is not found. ```typescript __getReplacedData(replaceWith?: paramList[], lang?: chs | cht | de | en | es | fr | id | jp | kr | pt | ru | th | vi): { text: string; usedParamIndices: number[] } ``` -------------------------------- ### Get All StarRail Light Cones Source: https://starrail.vercel.app/api/class/StarRail Returns an array containing data for all Light Cones in the game. An optional parameter can be used to exclude test Light Cones from the results. ```typescript __getAllLightCones(excludeTestLightCones?: boolean): LightConeData[] ``` -------------------------------- ### Get Nullable Formatted Text Asset Source: https://starrail.vercel.app/api/class/DynamicTextAssets Retrieves a text asset as a FormattedText object, returning null instead of throwing an error if the asset is not found. Supports language specification. ```typescript __getAsNullableFormattedText(lang?: chs | cht | de | en | es | fr | id | jp | kr | pt | ru | th | vi): null | FormattedText ``` -------------------------------- ### Get Full Description for LeveledSkillTreeNode Source: https://starrail.vercel.app/api/class/LeveledSkillTreeNode Retrieves the full description of the skill tree node, optionally in a simplified format. This method returns an array of objects, each containing the description text and a reference to a related skill or stat. ```typescript __getFullDescription(simple: boolean): { desc: DynamicTextAssets; ref: null | LeveledSkill | StatPropertyValue; simple: boolean }[] ``` -------------------------------- ### Get Nullable Replaced Data Source: https://starrail.vercel.app/api/class/DynamicTextAssets Retrieves text with replacements applied, returning null if the asset is not found. It accepts an array of parameters for replacement and an optional language. The output includes the replaced text and indices of used parameters. ```typescript __getNullableReplacedData(replaceWith?: paramList[], lang?: chs | cht | de | en | es | fr | id | jp | kr | pt | ru | th | vi): null | { text: string; usedParamIndices: number[] } ``` -------------------------------- ### Get LightCone Level (TypeScript) Source: https://starrail.vercel.app/api/class/LightConeExpType Shows how to retrieve a specific LightConeLevel object using the getLevel method. This method takes a level number as input and returns the corresponding LightConeLevel data. ```typescript const levelData = expTypeInstance.getLevel(5); ``` -------------------------------- ### Get Skill by Level - TypeScript Source: https://starrail.vercel.app/api/class/Skill Retrieves detailed skill information for a specific level. This method is crucial for accessing level-dependent skill effects and attributes. ```typescript __getSkillByLevel(level: SkillLevel): LeveledSkill ``` -------------------------------- ### Get Character Build from JSON Source: https://starrail.vercel.app/api/class/StarRail Constructs a StarRailCharacterBuild object from provided JSON data, username, and hash. This is likely used for parsing raw API responses into a usable build format. ```typescript __getCharacterBuild(data: JsonObject, username: string, hash: string): StarRailCharacterBuild ``` -------------------------------- ### GET /api/getExcelData Source: https://starrail.vercel.app/api/class/CachedAssetsManager Retrieves specific data from Excel files based on the provided keys. This function is generic and can fetch data for various game configurations like Avatar, Equipment, Relics, and more. ```APIDOC ## GET /api/getExcelData ### Description Retrieves specific data from Excel files based on the provided keys. This function is generic and can fetch data for various game configurations like Avatar, Equipment, Relics, and more. ### Method GET ### Endpoint /api/getExcelData ### Parameters #### Query Parameters - **excel** (T) - Required - The type of Excel data to retrieve. Can be one of: AvatarConfig, ItemConfigAvatar, DamageType, AvatarBaseType, AvatarSkillConfig, AvatarServantSkillConfig, AvatarSkillTreeConfig, AvatarRankConfig, AvatarPromotionConfig, AvatarSkin, EquipmentConfig, ItemConfigEquipment, EquipmentExpType, EquipmentSkillConfig, EquipmentPromotionConfig, RelicConfig, ItemConfigRelic, RelicExpType, RelicMainAffixConfig, RelicSubAffixConfig, RelicSetConfig, RelicSetSkillConfig, RelicBaseType, AvatarPropertyConfig, ItemConfigAvatarPlayerIcon, AvatarPlayerIcon, ItemPlayerCard, PlayerIcon. - **keys** (U[]) - Required - An array of keys (string or number) to specify the exact data points to retrieve within the selected Excel type. ### Request Example ```json { "excel": "AvatarConfig", "keys": ["1001"] } ``` ### Response #### Success Response (200) - **data** (JsonObject) - An object containing the requested data, indexed by the provided keys. #### Response Example ```json { "data": { "1001": { "AvatarID": 1001, "Name": "Trailblaze", "SkillID": 1001 } } } ``` ``` -------------------------------- ### Activate Auto Cache Updater Source: https://starrail.vercel.app/api/index Configures an automatic cache updater for Star Rail data. This includes options for immediate first update, interval timing, and callbacks for update start and end events. It's recommended to place the cache directory directly within your project folder when using this feature. ```javascript const { StarRail } = require("starrail.js"); const client = new StarRail(); client.cachedAssetsManager.activateAutoCacheUpdater({ instant: true, // Run the first update check immediately timeout: 60 * 60 * 1000, // 1 hour interval onUpdateStart: async () => { console.log("Updating Star Rail Data..."); }, onUpdateEnd: async () => { client.cachedAssetsManager.refreshAllData(); // Refresh memory console.log("Updating Completed!"); } }); // // deactivate // client.cachedAssetsManager.deactivateAutoCacheUpdater(); ``` -------------------------------- ### Update Contents API Source: https://starrail.vercel.app/api/class/CachedAssetsManager This endpoint allows for updating the application's content. It supports various options to customize the update process, such as enabling a proxy, defining callbacks for the start and end of the update, and choosing whether to use raw Star Rail data. ```APIDOC ## POST /websites/starrail_vercel_app_api/updateContents ### Description Allows for updating the application's content with customizable options. ### Method POST ### Endpoint /websites/starrail_vercel_app_api/updateContents ### Parameters #### Query Parameters - **ghproxy** (boolean) - Optional - Use ghproxy for updates. - **useRawStarRailData** (boolean) - Optional - Use raw Star Rail data. #### Request Body - **onUpdateStart** (function) - Optional - Callback function to execute at the start of the update. - **onUpdateEnd** (function) - Optional - Callback function to execute at the end of the update. ### Request Example ```json { "onUpdateStart": "() => Promise.resolve()", "onUpdateEnd": "() => Promise.resolve()" } ``` ### Response #### Success Response (200) - **message** (string) - Indicates the status of the update operation. #### Response Example ```json { "message": "Content updated successfully." } ``` ``` -------------------------------- ### LightConeData Constructor Source: https://starrail.vercel.app/api/class/LightConeData Initializes a new LightConeData object. ```APIDOC ## POST /websites/starrail_vercel_app_api/LightConeData ### Description Initializes a new LightConeData object with the provided ID and client. ### Method POST ### Endpoint /websites/starrail_vercel_app_api/LightConeData ### Parameters #### Request Body - **id** (number) - Required - The unique identifier for the Light Cone. - **client** (StarRail) - Required - The StarRail client instance. ### Request Example ```json { "id": 1001, "client": "StarRailClientInstance" } ``` ### Response #### Success Response (200) - **LightConeData** (object) - The newly created LightConeData object. #### Response Example ```json { "id": 1001, "name": {"en": "Something"}, "description": {"en": "Something"}, "icon": {"path": "/icon/path"}, "stars": 5, "path": "Attack", "coinCost": 1000, "expProvide": 5000, "maxAscension": 6, "maxSuperimposition": 5, "superimpositions": [], "_data": {}, "_itemData": {}, "cardImage": {"path": "/card/image/path"}, "client": "StarRailClientInstance", "expType": "Normal", "itemDescription": {"en": "Something"} } ``` ``` -------------------------------- ### Instantiate LightConeExpType (TypeScript) Source: https://starrail.vercel.app/api/class/LightConeExpType Demonstrates how to create a new instance of the LightConeExpType class. It requires an experience type identifier and a StarRail client instance for initialization. ```typescript const expTypeInstance = new LightConeExpType(1, starRailClient); ``` -------------------------------- ### LightConeExpType Constructor Source: https://starrail.vercel.app/api/class/LightConeExpType Initializes a new instance of the LightConeExpType class. ```APIDOC ## POST /websites/starrail_vercel_app_api/LightConeExpType ### Description Initializes a new instance of the LightConeExpType class. ### Method POST ### Endpoint /websites/starrail_vercel_app_api/LightConeExpType ### Parameters #### Request Body - **expType** (number) - Required - The experience type. - **client** (StarRail) - Required - The StarRail client instance. ### Request Example ```json { "expType": 1, "client": { ... StarRail instance ... } } ``` ### Response #### Success Response (200) - **instance** (LightConeExpType) - The newly created LightConeExpType instance. #### Response Example ```json { "instance": { ... LightConeExpType instance ... } } ``` ``` -------------------------------- ### ImageAssets Constructor Source: https://starrail.vercel.app/api/class/ImageAssets Initializes a new instance of the ImageAssets class. This constructor is used to create an ImageAssets object with a specified path, client, and optional maximum priority. ```APIDOC ## ImageAssets Constructor ### Description Initializes a new instance of the ImageAssets class. ### Method CONSTRUCTOR ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "path": "/path/to/image", "client": "StarRailClientInstance", "maxPriority": 10 } ``` ### Response #### Success Response (200) Returns a new instance of ImageAssets. #### Response Example ```json { "instance": "ImageAssetsInstance" } ``` ``` -------------------------------- ### LeveledSkill Constructor Source: https://starrail.vercel.app/api/class/LeveledSkill Initializes a new LeveledSkill object with provided data, level, and client. ```APIDOC ## LeveledSkill Constructor ### Description Initializes a new LeveledSkill object. ### Method `__new` ### Parameters - **data** (JsonObject) - The JSON data for the skill. - **level** (SkillLevel) - The current level of the skill. - **client** (StarRail) - The StarRail client instance. ### Returns LeveledSkill - A new instance of LeveledSkill. ``` -------------------------------- ### Constructor for DynamicTextAssets Source: https://starrail.vercel.app/api/class/DynamicTextAssets Initializes a new instance of the DynamicTextAssets class. It requires an ID, optional dynamic data, and a StarRail client instance. ```typescript new DynamicTextAssets(id: HashKey, data: Partial, client: StarRail): DynamicTextAssets ``` -------------------------------- ### GET /api/getLanguageDataPath Source: https://starrail.vercel.app/api/class/CachedAssetsManager Retrieves the file path for the text data of a specified language. This can be used to directly access language files. ```APIDOC ## GET /api/getLanguageDataPath ### Description Retrieves the file path for the text data of a specified language. This can be used to directly access language files. ### Method GET ### Endpoint /api/getLanguageDataPath ### Parameters #### Query Parameters - **lang** (string) - Required - The language code for which to get the file path. Supported values: chs, cht, de, en, es, fr, id, jp, kr, pt, ru, th, vi. ### Request Example ```json { "lang": "en" } ``` ### Response #### Success Response (200) - **path** (string) - The file path to the language data file. #### Response Example ```json { "path": "/path/to/starrail/data/lang/en.json" } ``` ``` -------------------------------- ### StarRail Constructor Source: https://starrail.vercel.app/api/class/StarRail Initializes a new StarRail client instance with optional configuration options. The client manages interactions with the StarRail API. ```typescript new StarRail(options?: Partial): StarRail ``` -------------------------------- ### LeveledSkill Methods Source: https://starrail.vercel.app/api/class/LeveledSkill Provides methods for interacting with LeveledSkill objects, such as retrieving skills by level. ```APIDOC ## LeveledSkill Methods ### Description Provides methods for interacting with LeveledSkill objects. ### Methods #### `__getSkillByLevel` - **Description**: Retrieves a LeveledSkill object for a specific level. - **Parameters**: - **level** (SkillLevel) - The desired skill level. - **Returns**: - LeveledSkill - The LeveledSkill object corresponding to the specified level. ``` -------------------------------- ### Instantiate LightCone (TypeScript) Source: https://starrail.vercel.app/api/class/LightCone Creates a new LightCone instance. Requires game data and a client instance. Returns a LightCone object. ```typescript new LightCone(data: JsonObject, client: StarRail): LightCone ``` -------------------------------- ### StarRailCharacterBuild Constructor Source: https://starrail.vercel.app/api/class/StarRailCharacterBuild Initializes a new instance of the StarRailCharacterBuild class. It requires data, a client instance, username, and a hash string as parameters. ```typescript constructor(data: JsonObject, client: StarRail, username: string, hash: string): StarRailCharacterBuild ``` -------------------------------- ### Get All StarRail Characters Source: https://starrail.vercel.app/api/class/StarRail Retrieves an array of all available character data. An optional parameter allows filtering to include only playable characters. ```typescript __getAllCharacters(playableOnly?: boolean): CharacterData[] ``` -------------------------------- ### Get Matched Damage Bonus Source: https://starrail.vercel.app/api/class/OverallStatList Retrieves a stat property value representing the matched damage bonus. This function does not require any parameters and returns a StatPropertyValue object. ```typescript function __getMatchedDamageBonus(): StatPropertyValue; ``` -------------------------------- ### ImageAssets Methods Source: https://starrail.vercel.app/api/class/ImageAssets Details the available methods for the ImageAssets class, specifically the `__nextSource` method. ```APIDOC ## ImageAssets Methods ### Description Provides details about the methods available for the ImageAssets class. ### Method GET ### Endpoint N/A ### Parameters None ### Request Example None ### Response #### Success Response (200) Returns a new instance of ImageAssets with another imageBaseUrl or null. #### Response Example ```json { "nextInstance": "ImageAssetsInstance" } ``` ``` -------------------------------- ### LeveledSkillTreeNode Constructor Source: https://starrail.vercel.app/api/class/LeveledSkillTreeNode Initializes a new LeveledSkillTreeNode instance. It requires data, a skill level, and the StarRail client as parameters. ```typescript new LeveledSkillTreeNode(data: JsonObject, level: SkillLevel, client: StarRail): LeveledSkillTreeNode ``` -------------------------------- ### Instantiate RelicExpType Source: https://starrail.vercel.app/api/class/RelicExpType Demonstrates how to create a new instance of the RelicExpType class. This constructor requires an experience type (number) and a StarRail client instance as parameters. ```typescript const relicExpType = new RelicExpType(expType: number, client: StarRail): RelicExpType; ``` -------------------------------- ### Get All StarRail Relics Source: https://starrail.vercel.app/api/class/StarRail Fetches an array of all available Relic data. This method provides comprehensive information about all relic sets and individual relics. ```typescript __getAllRelics(): RelicData[] ``` -------------------------------- ### LightConeSuperimposition Constructor - TypeScript Source: https://starrail.vercel.app/api/class/LightConeSuperimposition Defines the constructor for the LightConeSuperimposition class. It initializes an instance with an ID, level, and a StarRail client. The constructor takes these parameters and sets up the object's internal state. ```typescript class LightConeSuperimposition { constructor(id: number, level: number, client: StarRail): LightConeSuperimposition; } ``` -------------------------------- ### RelicData Constructor Source: https://starrail.vercel.app/api/class/RelicData Initializes a new instance of the RelicData class. ```APIDOC ## Constructor RelicData ### Description Initializes a new instance of the RelicData class. ### Method Constructor ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "id": 1001, "client": "StarRailClientInstance" } ``` ### Response #### Success Response (200) N/A (Constructor) #### Response Example N/A (Constructor) ``` -------------------------------- ### UserIcon Constructor Source: https://starrail.vercel.app/api/class/UserIcon Initializes a new UserIcon object. It requires a unique identifier and a StarRail client instance. The constructor returns a UserIcon instance. ```typescript new UserIcon(id: number, client: StarRail): UserIcon ``` -------------------------------- ### Default Client Options (TypeScript) Source: https://starrail.vercel.app/api/index Defines the default configuration options for the client, with a specific type override to allow the 'enkaSystem' property to be null. This sets up initial client settings. ```typescript type DefaultClientOptions = Overwrite; const defaultClientOption: DefaultClientOptions = { // ... implementation details ... enkaSystem: null }; ``` -------------------------------- ### StatList Constructor Source: https://starrail.vercel.app/api/class/StatList Initializes a new StatList object with provided statistics, combat type, and client instance. It requires a record of stat properties, a combat type identifier, and a StarRail client object. ```typescript new StatList(list: Record, combatTypeId: CombatTypeId, client: StarRail): StatList ``` -------------------------------- ### Get Excel Data Path Source: https://starrail.vercel.app/api/class/CachedAssetsManager Retrieves the file path for a specified Excel data configuration. This function supports various configuration types like AvatarConfig, ItemConfigAvatar, and more. ```APIDOC ## GET /_getExcelDataPath ### Description Retrieves the file path for a specified Excel data configuration. This function supports various configuration types like AvatarConfig, ItemConfigAvatar, and more. ### Method GET ### Endpoint /_getExcelDataPath ### Parameters #### Query Parameters - **excel** (AvatarConfig | ItemConfigAvatar | DamageType | AvatarBaseType | AvatarSkillConfig | AvatarServantSkillConfig | AvatarSkillTreeConfig | AvatarRankConfig | AvatarPromotionConfig | AvatarSkin | EquipmentConfig | ItemConfigEquipment | EquipmentExpType | EquipmentSkillConfig | EquipmentPromotionConfig | RelicConfig | ItemConfigRelic | RelicExpType | RelicMainAffixConfig | RelicSubAffixConfig | RelicSetConfig | RelicSetSkillConfig | RelicBaseType | AvatarPropertyConfig | ItemConfigAvatarPlayerIcon | AvatarPlayerIcon | ItemPlayerCard | PlayerIcon) - Required - The type of Excel configuration to retrieve the path for. ### Response #### Success Response (200) - **string** - The file path to the requested Excel data. #### Response Example ``` "path/to/excel/data.json" ``` ``` -------------------------------- ### Configure Star Rail Cache Directory Source: https://starrail.vercel.app/api/index Demonstrates how to change the directory where Star Rail cache data is stored or initialize the client with a specified cache directory. Requires Node.js 16 or newer. ```javascript const { StarRail } = require("starrail.js"); // Change the directory to store cache data. // Default directory is node_modules/starrail.js/cache. const client = new StarRail(); client.cachedAssetsManager.cacheDirectoryPath = "./cache"; client.cachedAssetsManager.cacheDirectorySetup(); // OR const client = new StarRail({ cacheDirectory: "./cache" }); client.cachedAssetsManager.cacheDirectorySetup(); ``` -------------------------------- ### Get Stat Property by Type Source: https://starrail.vercel.app/api/class/OverallStatList Retrieves a stat property value based on the specified type. This function accepts a wide range of stat types as input and returns a StatPropertyValue object. ```typescript function __getByType(type: Defence | MaxHP | Attack | Speed | CriticalChance | CriticalDamage | BreakDamageAddedRatio | BreakDamageAddedRatioBase | HealRatio | MaxSP | SPRatio | StatusProbability | StatusResistance | CriticalChanceBase | CriticalDamageBase | HealRatioBase | StanceBreakAddedRatio | SPRatioBase | StatusProbabilityBase | StatusResistanceBase | PhysicalAddedRatio | PhysicalResistance | FireAddedRatio | FireResistance | IceAddedRatio | IceResistance | ThunderAddedRatio | ThunderResistance | WindAddedRatio | WindResistance | QuantumAddedRatio | QuantumResistance | ImaginaryAddedRatio | ImaginaryResistance | BaseHP | HPDelta | HPAddedRatio | BaseAttack | AttackDelta | AttackAddedRatio | BaseDefence | DefenceDelta | DefenceAddedRatio | BaseSpeed | HealTakenRatio | PhysicalResistanceDelta | FireResistanceDelta | IceResistanceDelta | ThunderResistanceDelta | WindResistanceDelta | QuantumResistanceDelta | ImaginaryResistanceDelta | SpeedDelta | ElationDamageAddedRatioBase | SpeedAddedRatio): StatPropertyValue; ``` -------------------------------- ### SkillTreeNode Constructor Source: https://starrail.vercel.app/api/class/SkillTreeNode Initializes a new SkillTreeNode instance. It requires a unique ID and a StarRail client instance. An optional node index can be provided to specify which node to use. ```typescript new SkillTreeNode(id: number, client: StarRail, nodeIndexToUse?: number): SkillTreeNode ``` -------------------------------- ### Get Matched Damage Bonus Source: https://starrail.vercel.app/api/class/StatList Retrieves the matched damage bonus. This function does not take any parameters and returns a StatPropertyValue object representing the damage bonus. ```typescript function __getMatchedDamageBonus(): StatPropertyValue ``` -------------------------------- ### Instantiate Costume Object (TypeScript) Source: https://starrail.vercel.app/api/class/Costume Demonstrates how to create a new Costume object using its constructor. Requires an ID (number) and a StarRail client instance as parameters. ```typescript const costume = new Costume(123, starRailClient); ``` -------------------------------- ### Convert Text Asset to String Source: https://starrail.vercel.app/api/class/DynamicTextAssets Converts the text asset to its string representation. ```typescript __toString(): string ``` -------------------------------- ### LightConeExpType Properties Source: https://starrail.vercel.app/api/class/LightConeExpType Provides access to the properties of a LightConeExpType instance. ```APIDOC ## GET /websites/starrail_vercel_app_api/LightConeExpType/{expType} ### Description Retrieves the properties of a LightConeExpType instance. ### Method GET ### Endpoint /websites/starrail_vercel_app_app_api/LightConeExpType/{expType} ### Parameters #### Path Parameters - **expType** (number) - Required - The experience type to retrieve properties for. #### Query Parameters - **client** (StarRail) - Required - The StarRail client instance. ### Response #### Success Response (200) - **_data** (JsonObject) - The data associated with the experience type. - **client** (StarRail) - The StarRail client instance. - **expType** (number) - The experience type. - **levels** (LightConeLevel[]) - An array of LightConeLevel objects. #### Response Example ```json { "_data": { ... JsonObject ... }, "client": { ... StarRail instance ... }, "expType": 1, "levels": [ ... LightConeLevel array ... ] } ``` ``` -------------------------------- ### Fetch All Contents Source: https://starrail.vercel.app/api/class/CachedAssetsManager Fetches all necessary contents for the application, with options to use a GitHub proxy and raw Star Rail data. ```typescript declare function __fetchAllContents(options: { ghproxy?: boolean; useRawStarRailData?: boolean }): Promise; ``` -------------------------------- ### Get Excel Data by Type Source: https://starrail.vercel.app/api/class/CachedAssetsManager Retrieves specific Excel data based on the provided type. This method is generic and can fetch data for various configurations like AvatarConfig, ItemConfigRelic, etc. ```typescript ___getExcelData (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]; AvatarServantSkillConfig: readonly [SkillID, Level]; AvatarSkillConfig: readonly [SkillID, Level]; AvatarSkillTreeConfig: readonly [PointID, Level]; AvatarSkin: readonly [ID]; 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]> ``` -------------------------------- ### SkillLevel Constructor Source: https://starrail.vercel.app/api/class/SkillLevel Defines the constructor for the SkillLevel class. It takes two number parameters, 'base' and 'extra', and returns a new SkillLevel instance. This constructor is essential for initializing SkillLevel objects with specific base and extra values. ```TypeScript new SkillLevel(base: number, extra: number): SkillLevel ``` -------------------------------- ### Skill Constructor - TypeScript Source: https://starrail.vercel.app/api/class/Skill Initializes a new Skill object. It requires a unique ID and a StarRail client instance. An optional skill index can be provided to specify which skill to use if a character has multiple. ```typescript new Skill(id: number, client: StarRail, skillIndexToUse?: number): Skill ``` -------------------------------- ### Get User from JSON Source: https://starrail.vercel.app/api/class/StarRail Parses a JSON object to construct a StarRailUser object. This method is used to convert raw user data from an API response into a structured user object. ```typescript __getUser(data: JsonObject): StarRailUser ``` -------------------------------- ### Get Excel Data Path Source: https://starrail.vercel.app/api/class/CachedAssetsManager Retrieves the file path for a given Excel data configuration. It accepts a wide range of configuration types as input and returns a string representing the file path. ```typescript declare function __getExcelDataPath(excel: AvatarConfig | ItemConfigAvatar | DamageType | AvatarBaseType | AvatarSkillConfig | AvatarServantSkillConfig | AvatarSkillTreeConfig | AvatarRankConfig | AvatarPromotionConfig | AvatarSkin | EquipmentConfig | ItemConfigEquipment | EquipmentExpType | EquipmentSkillConfig | EquipmentPromotionConfig | RelicConfig | ItemConfigRelic | RelicExpType | RelicMainAffixConfig | RelicSubAffixConfig | RelicSetConfig | RelicSetSkillConfig | RelicBaseType | AvatarPropertyConfig | ItemConfigAvatarPlayerIcon | AvatarPlayerIcon | ItemPlayerCard | PlayerIcon): string; ``` -------------------------------- ### RelicSubStat Class Documentation Source: https://starrail.vercel.app/api/class/RelicSubStat Provides details on the RelicSubStat class, including its constructor, properties, and accessors. ```APIDOC ## RelicSubStat Class ### Description Represents a sub-statistic for a relic in the game, including its value, enhancement count, and steps. ### Hierarchy - StatPropertyValue - RelicSubStat ### Constructors #### `__new RelicSubStat(subStatData: RelicSubStatData, count: number, steps: number): RelicSubStat` Initializes a new instance of the RelicSubStat class. ##### Parameters - **subStatData** (RelicSubStatData) - The base data for the sub-statistic. - **count** (number) - The number of times this sub-statistic has been enhanced. - **steps** (number) - The number of enhancement steps applied. ### Properties - **`__client`** (StarRail) - Readonly. The associated StarRail client instance. - **`__count`** (number) - Readonly. The number of times this SubStat has been enhanced. - **`__isPercent`** (boolean) - Readonly. Indicates if the sub-statistic is a percentage value. - **`__nameSkillTree`** (null | DynamicTextAssets) - Readonly. The name of the skill tree associated with the stat, or null if not applicable. - **`__statProperty`** (null | StatProperty) - Readonly. The property details of the stat, or null if the type is 'OtherStatPropertyType'. - **`__steps`** (number) - Readonly. The number of enhancement steps. - **`__subStatData`** (RelicSubStatData) - Readonly. The base data for the sub-statistic. - **`__type`** (Defence | MaxHP | Attack | Speed | CriticalChance | CriticalDamage | BreakDamageAddedRatio | BreakDamageAddedRatioBase | HealRatio | MaxSP | SPRatio | StatusProbability | StatusResistance | CriticalChanceBase | CriticalDamageBase | HealRatioBase | StanceBreakAddedRatio | SPRatioBase | StatusProbabilityBase | StatusResistanceBase | PhysicalAddedRatio | PhysicalResistance | FireAddedRatio | FireResistance | IceAddedRatio | IceResistance | ThunderAddedRatio | ThunderResistance | WindAddedRatio | WindResistance | QuantumAddedRatio | QuantumResistance | ImaginaryAddedRatio | ImaginaryResistance | BaseHP | HPDelta | HPAddedRatio | BaseAttack | AttackDelta | AttackAddedRatio | BaseDefence | DefenceDelta | DefenceAddedRatio | BaseSpeed | HealTakenRatio | PhysicalResistanceDelta | FireResistanceDelta | IceResistanceDelta | ThunderResistanceDelta | WindResistanceDelta | QuantumResistanceDelta | ImaginaryResistanceDelta | SpeedDelta | ElationDamageAddedRatioBase | SpeedAddedRatio) - Readonly. The type of the sub-statistic. - **`__value`** (number) - Readonly. The calculated value of the sub-statistic (baseValue * count + stepValue * steps). ### Accessors - **`valueText(): string`** - Returns the formatted string representation of the sub-statistic's value. ``` -------------------------------- ### TextAssets Constructor Source: https://starrail.vercel.app/api/class/TextAssets Initializes a new TextAssets object. It requires a unique ID and a StarRail client instance. This constructor is fundamental for creating and managing text assets within the Star Rail ecosystem. ```typescript new TextAssets(id: HashKey, client: StarRail): TextAssets ``` -------------------------------- ### Get Stat Property by Type Source: https://starrail.vercel.app/api/class/StatList Retrieves a specific stat property based on its type. This function accepts a wide range of stat types as input and returns a StatPropertyValue object. ```typescript function __getByType(type: Defence | MaxHP | Attack | Speed | CriticalChance | CriticalDamage | BreakDamageAddedRatio | BreakDamageAddedRatioBase | HealRatio | MaxSP | SPRatio | StatusProbability | StatusResistance | CriticalChanceBase | CriticalDamageBase | HealRatioBase | StanceBreakAddedRatio | SPRatioBase | StatusProbabilityBase | StatusResistanceBase | PhysicalAddedRatio | PhysicalResistance | FireAddedRatio | FireResistance | IceAddedRatio | IceResistance | ThunderAddedRatio | ThunderResistance | WindAddedRatio | WindResistance | QuantumAddedRatio | QuantumResistance | ImaginaryAddedRatio | ImaginaryResistance | BaseHP | HPDelta | HPAddedRatio | BaseAttack | AttackDelta | AttackAddedRatio | BaseDefence | DefenceDelta | DefenceAddedRatio | BaseSpeed | HealTakenRatio | PhysicalResistanceDelta | FireResistanceDelta | IceResistanceDelta | ThunderResistanceDelta | WindResistanceDelta | QuantumResistanceDelta | ImaginaryResistanceDelta | SpeedDelta | ElationDamageAddedRatioBase | SpeedAddedRatio): StatPropertyValue ``` -------------------------------- ### ImageAssets Properties Source: https://starrail.vercel.app/api/class/ImageAssets Provides details about the properties of an ImageAssets instance, including client, imageBaseUrl, isAvailable, path, and url. ```APIDOC ## ImageAssets Properties ### Description Details the properties available for an ImageAssets object. ### Method GET ### Endpoint N/A ### Parameters None ### Request Example None ### Response #### Success Response (200) Returns the properties of the ImageAssets instance. #### Response Example ```json { "client": "StarRailClientInstance", "imageBaseUrl": { "url": "http://example.com/images/", "priority": 5 }, "isAvailable": true, "path": "/path/to/image", "url": "http://example.com/images/path/to/image" } ``` ``` -------------------------------- ### Get Relic Level Data Source: https://starrail.vercel.app/api/class/RelicExpType Shows how to retrieve specific relic level data using the __getLevel method. This method takes a level number as input and returns a RelicLevel object. ```typescript const relicLevel = __getLevel(level: number): RelicLevel; ``` -------------------------------- ### RelicSet Constructor Source: https://starrail.vercel.app/api/class/RelicSet Initializes a new RelicSet object. Requires a unique ID and a StarRail client instance for data retrieval and context. ```typescript new RelicSet(id: number, client: StarRail): RelicSet ``` -------------------------------- ### Fetch All Contents Source: https://starrail.vercel.app/api/class/CachedAssetsManager Fetches all available contents, with options to use a GitHub proxy and specify whether to use raw Star Rail data. ```APIDOC ## POST /fetchAllContents ### Description Fetches all available contents, with options to use a GitHub proxy and specify whether to use raw Star Rail data. ### Method POST ### Endpoint /fetchAllContents ### Parameters #### Request Body - **options** (object) - Required - Fetching options. - **ghproxy** (boolean) - Use GitHub proxy. - **useRawStarRailData** (boolean) - Use raw Star Rail data. ### Response #### Success Response (200) - **void** - Indicates that all contents have been fetched. #### Response Example ```json { "message": "All contents fetched successfully" } ``` ``` -------------------------------- ### Instantiate RelicSubStatGroup (TypeScript) Source: https://starrail.vercel.app/api/class/RelicSubStatGroup Demonstrates how to create a new instance of RelicSubStatGroup. This constructor requires a unique numeric ID and an instance of the StarRail client to initialize the object. ```typescript const relicSubStatGroup = new RelicSubStatGroup(123, starRailClient); ``` -------------------------------- ### Instantiate AssetsNotFoundError Source: https://starrail.vercel.app/api/class/AssetsNotFoundError Demonstrates how to create a new instance of the AssetsNotFoundError class. It requires a category (string) and an ID (string, number, or bigint) as parameters. ```typescript const error = new AssetsNotFoundError("texture", "player_model_01"); ```