genshin-manager
Version:
<div align="center"> <p> <a href="https://www.npmjs.com/package/genshin-manager"><img src="https://img.shields.io/npm/v/genshin-manager.svg?maxAge=3600" alt="npm version" /></a> <a href="https://www.npmjs.com/package/genshin-manager"><img src="https:
79 lines (78 loc) • 3.36 kB
JavaScript
;
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CharacterInherentSkill = void 0;
const Client_1 = require("../../client/Client");
const ImageAssets_1 = require("../../models/assets/ImageAssets");
const CharacterInfo_1 = require("../../models/character/CharacterInfo");
const StatProperty_1 = require("../../models/StatProperty");
/**
* Class of character's inherent skill
*/
class CharacterInherentSkill {
/**
* Create a Inherent Skill
* @param inherentSkillId Inherent Skill ID
*/
constructor(inherentSkillId) {
this.id = inherentSkillId;
const proudSkillGroupId = inherentSkillId;
const proudSkillJson = Client_1.Client._getJsonFromCachedExcelBinOutput('ProudSkillExcelConfigData', proudSkillGroupId)[1];
this.name =
Client_1.Client._cachedTextMap.get(String(proudSkillJson.nameTextMapHash)) || '';
this.description =
Client_1.Client._cachedTextMap.get(String(proudSkillJson.descTextMapHash)) || '';
this.icon = new ImageAssets_1.ImageAssets(proudSkillJson.icon);
this.addProps = proudSkillJson.addProps
.map((addProp) => {
var _b;
return addProp.propType !== undefined &&
addProp.propType !== 'FIGHT_PROP_NONE' &&
addProp.value !== undefined
? new StatProperty_1.StatProperty(addProp.propType, ((_b = addProp.value) !== null && _b !== void 0 ? _b : 0))
: undefined;
})
.filter((k) => k !== undefined);
}
/**
* Get all inherent skill IDs
* @returns All inherent skill IDs
*/
static get allInherentSkillIds() {
const characterIds = CharacterInfo_1.CharacterInfo.allCharacterIds;
return characterIds.flatMap((characterId) => {
if ([10000005, 10000007].includes(characterId)) {
return CharacterInfo_1.CharacterInfo.getTravelerSkillDepotIds(characterId).flatMap((skillDepotId) => {
return new CharacterInfo_1.CharacterInfo(characterId, skillDepotId)
.inherentSkillOrder;
});
}
return new CharacterInfo_1.CharacterInfo(characterId).inherentSkillOrder;
});
}
/**
* Get inherent skill order by character ID
* @param characterId Character ID
* @param skillDepotId Skill depot ID
* @returns Inherent skill order
*/
static getInherentSkillOrderByCharacterId(characterId, skillDepotId) {
const avatarJson = Client_1.Client._getJsonFromCachedExcelBinOutput('AvatarExcelConfigData', characterId);
const depotId = skillDepotId && [10000005, 10000007].includes(characterId)
? skillDepotId
: avatarJson.skillDepotId;
const depotJson = Client_1.Client._getJsonFromCachedExcelBinOutput('AvatarSkillDepotExcelConfigData', depotId);
const result = [];
depotJson.inherentProudSkillOpens.forEach((k) => {
if (k.proudSkillGroupId === undefined)
return;
result.push(k.proudSkillGroupId);
});
return result;
}
}
exports.CharacterInherentSkill = CharacterInherentSkill;
_a = CharacterInherentSkill;
(() => {
Client_1.Client._addExcelBinOutputKeyFromClassPrototype(_a.prototype);
})();