2023-12-16 04:07:32 +00:00
|
|
|
import { Egg, GachaType } from "../data/egg";
|
|
|
|
|
|
|
|
export default class EggData {
|
|
|
|
public id: integer;
|
|
|
|
public gachaType: GachaType;
|
2023-12-20 04:51:48 +00:00
|
|
|
public hatchWaves: integer;
|
2023-12-16 04:07:32 +00:00
|
|
|
public timestamp: integer;
|
|
|
|
|
|
|
|
constructor(source: Egg | any) {
|
|
|
|
const sourceEgg = source instanceof Egg ? source as Egg : null;
|
|
|
|
this.id = sourceEgg ? sourceEgg.id : source.id;
|
|
|
|
this.gachaType = sourceEgg ? sourceEgg.gachaType : source.gachaType;
|
2023-12-20 04:51:48 +00:00
|
|
|
this.hatchWaves = sourceEgg ? sourceEgg.hatchWaves : source.hatchWaves;
|
2023-12-16 04:07:32 +00:00
|
|
|
this.timestamp = sourceEgg ? sourceEgg.timestamp : source.timestamp;
|
|
|
|
}
|
|
|
|
|
|
|
|
toEgg(): Egg {
|
2023-12-20 04:51:48 +00:00
|
|
|
return new Egg(this.id, this.gachaType, this.hatchWaves, this.timestamp);
|
2023-12-16 04:07:32 +00:00
|
|
|
}
|
|
|
|
}
|