card_svr/src/cfg/parsers/SystemCardCfg.ts
2020-12-02 23:20:24 +08:00

24 lines
671 B
TypeScript

import {Cfg} from "../../common/DataParser";
export class SystemCardCfg implements Cfg {
public id: number;
public typeId: number;
public count: number;
public point: number;
public weight: string;
public weightArr: [];
public decode(data: any) {
this.id = data.id;
this.typeId = data.type_id;
this.point = data.point;
this.weight = data.weight;
let arr = this.weight.split('|');
this.weightArr = [];
for (let str of arr) {
let subArr = str.split(':');
// @ts-ignore
this.weightArr.push([parseInt(subArr[0]), parseInt(subArr[1])]);
}
}
}