羁绊:修改武将羁绊格式

This commit is contained in:
luying
2022-07-08 18:29:53 +08:00
parent 4e12c6e389
commit 868bb07977
16 changed files with 119 additions and 226 deletions
+15 -9
View File
@@ -17,24 +17,30 @@ export interface DicFriendShip {
readonly hids: Array<number>;
// 属性加成
readonly attributes: Array<{id: number, number: number}>
// 消耗铜币
readonly costCoin: number;
// 升到这一级所需的羁绊值
readonly shipValue: number;
}
export const friendShips = new Map<string, DicFriendShip>();
export const friendShipHidAandIds = new Map<number, {actorId: number, level:number}>();
export const friendShips = new Map<string, { level: number, shipValue: number }[]>();
export const friendShipsByLv = new Map<string, DicFriendShip>();
export function loadFriendShip() {
friendShips.clear();
friendShipHidAandIds.clear();
let arr = readFileAndParse(FILENAME.DIC_FRIEND_SHIP);
arr.forEach(o => {
o.attributes = parseAttribute(o.attribute);
o.hids = parseNumberList(o.memberId);
friendShips.set(o.shipId + '_' + o.level, o);
let fiendShipHidAandId = friendShipHidAandIds.get(o.shipId);
if (!fiendShipHidAandId || fiendShipHidAandId.level < o.level)
friendShipHidAandIds.set(o.shipId, {actorId: o.actorId, level: o.level});
let key1 = `${o.actorId}_${o.shipId}`;
let shipSumValue = 0;
if(!friendShips.has(key1)) {
friendShips.set(key1, []);
shipSumValue = 0;
}
shipSumValue += o.shipValue;
friendShips.get(key1).push({ level: o.level, shipValue: shipSumValue });
let key2 = `${o.actorId}_${o.shipId}_${o.level}`;
friendShipsByLv.set(key2, o);
});
arr = undefined;
}
@@ -1,30 +0,0 @@
// 武将羁绊好感等级表
import { readFileAndParse } from '../util';
import { FILENAME } from '../../consts';
export interface DicFriendShipLevel {
// 等级
readonly level: number;
// 下一级经验
readonly exp: number;
// 加成百分比
readonly add: number;
// 到这一级的总经验
readonly expSum: number;
}
export const maxFriendShipLv = { max: 0 };
export const dicFriendShipLevelMap = new Map<number, DicFriendShipLevel>();
export function loadFriendShipLevel() {
maxFriendShipLv.max = 0;
dicFriendShipLevelMap.clear();
let arr = readFileAndParse(FILENAME.DIC_FRIEND_SHIP_LEVEL);
let expSum = 0;
arr.forEach(o => {
expSum += o.exp;
o.expSum = expSum;
dicFriendShipLevelMap.set(o.level, o);
if(o.level > maxFriendShipLv.max) maxFriendShipLv.max = o.level;
});
arr = undefined;
}