card_svr/src/cfg/parsers/HeroCfg.ts

35 lines
1.0 KiB
TypeScript

import {Cfg} from "../../common/DataParser";
export class HeroCfg implements Cfg{
name: "HeroCfg";
public id: number;
public herounit_id: number;
public org_gift: number;
public ex_skill: number;
public follower1id: number;
public follower2id: number;
public follower3id: number;
public follower4id: number;
public decode(data: any) {
this.id = data.id;
this.herounit_id = data.herounit_id;
this.org_gift = data.org_gift;
this.ex_skill = data.ex_skill;
this.follower1id = data.follower1id;
this.follower2id = data.follower2id;
this.follower3id = data.follower3id;
this.follower4id = data.follower4id;
};
public isOK (uniqueID: number, param1: any, param2: any): boolean {
if((param1 == undefined || param1 == null) && (param2 == undefined || param2 == null)){
return this.id == uniqueID;
}
if(param2 == undefined || param2 == null){
return this.id == uniqueID && this.id == param1;
}
return this.id == uniqueID && this.id == param1 && this.id == param2;
};
};