// 武将羁绊好感等级表
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() {

    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;
}