55 lines
950 B
TypeScript
55 lines
950 B
TypeScript
import { prop } from '@typegoose/typegoose'
|
|
|
|
export class Hero {
|
|
@prop()
|
|
public heroid: number
|
|
/**
|
|
* 是否是免费英雄
|
|
*/
|
|
@prop({ default: false })
|
|
public free: boolean
|
|
/**
|
|
* 是否是试用
|
|
*/
|
|
@prop({ default: false })
|
|
public trial: boolean
|
|
|
|
@prop({ default: 0 })
|
|
public trial_expire: number
|
|
/**
|
|
* 等级
|
|
*/
|
|
@prop({ default: 1 })
|
|
public level: number
|
|
/**
|
|
* 该等级下的经验值
|
|
*/
|
|
@prop({ default: 0 })
|
|
public exp: number
|
|
/**
|
|
* 英雄已解锁卡槽数量
|
|
*/
|
|
@prop({default: 1})
|
|
public slot: number
|
|
|
|
@prop()
|
|
public time: number
|
|
|
|
public toJson() {
|
|
let data: any = {
|
|
heroid: this.heroid,
|
|
usetype: 0,
|
|
level: this.level,
|
|
exp: this.exp,
|
|
free: this.free,
|
|
trial: this.trial,
|
|
trial_expire: this.trial_expire,
|
|
slot: this.slot,
|
|
time: this.time,
|
|
ban: false
|
|
}
|
|
data.owned = !this.trial
|
|
return data
|
|
}
|
|
}
|