Skip to content

Commit

Permalink
fixed a parsing error with servant skills in HSR v3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yuko1101 committed Jan 13, 2025
1 parent abf5882 commit ae6a076
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 9 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/client/CachedAssetsManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion src/models/character/skill/Skill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,20 @@ export class Skill {
readonly skillIcon: ImageAssets;
/** Available only when [skillType](#skillType) is "Ultra" */
readonly ultraSkillIcon: ImageAssets;
readonly isServant: boolean;

readonly _skillsData: JsonObject[];

constructor(id: number, client: StarRail, skillIndexToUse = 0) {
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[];

Expand Down

0 comments on commit ae6a076

Please sign in to comment.