Skip to content

Commit

Permalink
[fix]Key name changes due to animeGameDatav4.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Rollphes committed Apr 22, 2024
1 parent d641cb9 commit c55dbab
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 39 deletions.
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "genshin-manager",
"version": "1.1.1",
"version": "1.1.2",
"homepage": "https://rollphes.github.io/genshin-manager/",
"bugs": "https://github.com/Rollphes/genshin-manager/issues",
"main": "dist/index.js",
Expand Down Expand Up @@ -59,20 +59,20 @@
"@types/cheerio": "^0.22.35",
"@types/cli-progress": "^3.11.5",
"@types/html-escaper": "^3.0.2",
"@types/node": "^20.11.30",
"@types/node": "^20.12.2",
"@types/node-cron": "^3.0.11",
"@typescript-eslint/eslint-plugin": "^7.3.1",
"@typescript-eslint/parser": "^7.3.1",
"@typescript-eslint/eslint-plugin": "^7.5.0",
"@typescript-eslint/parser": "^7.5.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jsdoc": "^48.2.1",
"eslint-plugin-jsdoc": "^48.2.2",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-simple-import-sort": "^12.0.0",
"prettier": "^3.2.5",
"ts-node": "^10.9.2",
"tsc-alias": "^1.8.8",
"tsconfig-paths": "^4.2.0",
"typedoc": "^0.25.12",
"typescript": "^5.4.2"
"typescript": "^5.4.3"
}
}
2 changes: 1 addition & 1 deletion src/models/Artifact.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class Artifact {
'ReliquarySetExcelConfigData',
this.setId,
)
const equipAffixId = (setJson.EquipAffixId as number) * 10 + 0
const equipAffixId = (setJson.equipAffixId as number) * 10 + 0
const equipAffixJson = Client._getJsonFromCachedExcelBinOutput(
'EquipAffixExcelConfigData',
equipAffixId,
Expand Down
46 changes: 22 additions & 24 deletions src/models/ProfilePicture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export class ProfilePicture {
* @description Exists only if type is `PROFILE_PICTURE_UNLOCK_BY_ITEM`
*/
public readonly materialId?: number
/**
* Quest ID
* @description Exists only if type is `PROFILE_PICTURE_UNLOCK_BY_PARENT_QUEST`
*/
public readonly questId?: number
/**
* Profile picture icon
*/
Expand All @@ -47,30 +52,23 @@ export class ProfilePicture {
this.id,
)

const infoId = profilePictureJson.infoId as number
const cachedAvatar = Client._getCachedExcelBinOutputByName(
'AvatarExcelConfigData',
)
const cachedCostume = Client._getCachedExcelBinOutputByName(
'AvatarCostumeExcelConfigData',
)
const cachedMaterial = Client._getCachedExcelBinOutputByName(
'MaterialExcelConfigData',
)
if (String(infoId) in cachedAvatar) {
this.characterId = infoId
const characterInfo = new CharacterInfo(infoId)
this.costumeId = characterInfo.defaultCostumeId
} else if (String(infoId) in cachedCostume) {
this.costumeId = infoId
const costume = new CharacterCostume(infoId)
this.characterId = costume.characterId
} else if (String(infoId) in cachedMaterial) {
this.materialId = infoId
} else {
throw new Error(
`ProfilePictureId ${this.id} has invalid infoId ${infoId}`,
)
const unlockParam = profilePictureJson.unlockParam as number

switch (profilePictureJson.type) {
case 'PROFILE_PICTURE_UNLOCK_BY_AVATAR':
this.characterId = unlockParam
this.costumeId = new CharacterInfo(unlockParam).defaultCostumeId
break
case 'PROFILE_PICTURE_UNLOCK_BY_COSTUME':
this.costumeId = unlockParam
this.characterId = new CharacterCostume(unlockParam).characterId
break
case 'PROFILE_PICTURE_UNLOCK_BY_ITEM':
this.materialId = unlockParam
break
case 'PROFILE_PICTURE_UNLOCK_BY_PARENT_QUEST':
this.questId = unlockParam
break
}

this.icon = new ImageAssets(profilePictureJson.iconPath as string)
Expand Down
8 changes: 0 additions & 8 deletions src/utils/ObjectKeyDecoder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,6 @@ export class ObjectKeyDecoder {
(data) => data.id === 99999,
) as JsonObject

this.replaceDatas.push(
new ReplaceData(
Object.entries(dummyProfilePicture).find(
([, v]) => v === 320001,
)?.[0] as string,
'infoId',
),
)
this.replaceDatas.push(
new ReplaceData(
Object.entries(dummyProfilePicture).find(
Expand Down

0 comments on commit c55dbab

Please sign in to comment.