import { ApiCall } from "tsrpc";
import { call } from "../public/player";
import { PlayerFun } from "../public/player";


export default class HeroSkinFun {

    /**
     * 获取英雄皮肤列表
     * @param uid 
     * @returns 
     */
    static getHeroSkin(call: call, oids: string | string[] = '') {
        return call.conn.gud.heroskin || {};
    }

    /**
     * 更新英雄皮肤数据
     * 
     * 说明 addAttr 会推送msg_s2c/PlayerChange
     * addEventMsg 会检测 PlayerChange 如果change的key在player中则触发重算战力操作 
     * 所以这个地放更新heroskin数据不需要主动重算战力
     * @param oid
     * @param data
     * @returns
     * */
    static async updateHeroSkinLv(call: ApiCall, change: k_v<number>) {
        let skin = this.getHeroSkin(call);
        skin = Object.assign(skin, change);
        await PlayerFun.addAttr(call, { heroskin: skin });
    }
}