From ae6a076d0f4ebdf275a3c0361871f30c6002fe67 Mon Sep 17 00:00:00 2001 From: yuko1101 <68993883+yuko1101@users.noreply.github.com> Date: Mon, 13 Jan 2025 19:11:05 +0900 Subject: [PATCH] fixed a parsing error with servant skills in HSR v3.0 --- CHANGELOG.md | 2 ++ package-lock.json | 16 +++++++++------- src/client/CachedAssetsManager.ts | 2 ++ src/models/character/skill/Skill.ts | 8 +++++++- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d86f653..82441b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +# 1.7.4 +- Fixed a parsing error with servant skills in HSR v3.0. # 1.7.3 - Updated the repo for StarRailData. # 1.7.2 diff --git a/package-lock.json b/package-lock.json index 686c60e..5feaafe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -690,10 +690,11 @@ "dev": true }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { "path-key": "^3.1.0", "shebang-command": "^2.0.0", @@ -1351,12 +1352,13 @@ } }, "node_modules/micromatch": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", - "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", "dev": true, + "license": "MIT", "dependencies": { - "braces": "^3.0.2", + "braces": "^3.0.3", "picomatch": "^2.3.1" }, "engines": { diff --git a/src/client/CachedAssetsManager.ts b/src/client/CachedAssetsManager.ts index 6244ed2..229c01f 100644 --- a/src/client/CachedAssetsManager.ts +++ b/src/client/CachedAssetsManager.ts @@ -18,9 +18,11 @@ export const excelKeyMap = { "DamageType": ["ID"], // Combat Types "AvatarBaseType": [["ID", "Unknown"]], // Paths "AvatarSkillConfig": ["SkillID", "Level"], // Character Skills + "AvatarServantSkillConfig": ["SkillID", "Level"], // Character Servant Skills "AvatarSkillTreeConfig": ["PointID", "Level"], // Character Skill Trees "AvatarRankConfig": ["RankID"], // Character Eidolons "AvatarPromotionConfig": ["AvatarID", ["Promotion", 0]], // Character Promotions and Character Basic Stats. + "EquipmentConfig": ["EquipmentID"], // Light Cones "ItemConfigEquipment": ["ID"], // Light Cones as Items "EquipmentExpType": ["ExpType", "Level"], // Light Cone Exp Types diff --git a/src/models/character/skill/Skill.ts b/src/models/character/skill/Skill.ts index 51c747b..205d9b5 100644 --- a/src/models/character/skill/Skill.ts +++ b/src/models/character/skill/Skill.ts @@ -25,6 +25,7 @@ export class Skill { readonly skillIcon: ImageAssets; /** Available only when [skillType](#skillType) is "Ultra" */ readonly ultraSkillIcon: ImageAssets; + readonly isServant: boolean; readonly _skillsData: JsonObject[]; @@ -32,7 +33,12 @@ export class Skill { this.id = id; this.client = client; - const _data = client.cachedAssetsManager.getExcelData("AvatarSkillConfig", this.id); + let _data = client.cachedAssetsManager.getExcelData("AvatarSkillConfig", this.id); + this.isServant = false; + if (!_data) { + _data = client.cachedAssetsManager.getExcelData("AvatarServantSkillConfig", this.id); + this.isServant = true; + } if (!_data) throw new AssetsNotFoundError("Skill", this.id); this._skillsData = Object.values(_data) as JsonObject[];