export default class BuildingModel { /**@type {number} */ rateUnit = 0; /**@type {number} */ hasNext = 0; /**@type {number} */ buildingId = 0; /**@type {number} */ level = 0; /**@type {string} */ name = ""; /**@type {number} */ nextRate = 0; /**@type {number} */ nextUpScore = 0; /**@type {number} */ rate = 0; /**@type {number} */ jobId = 0; /**@type {number} */ unlockScore = 0; /**@type {number} */ isUnlocked = 0; /**@type {number} */ coinCount = 0; constructor(data) { this.coinCount = data.coinCount || 0; this.rateUnit = data.rateUnit; this.hasNext = data.hasNext; this.buildingId = (data.buildingId === undefined) ? data.id : data.buildingId; this.level = data.level; this.name = data.name; this.nextRate = data.nextRate; this.nextUpScore = data.nextUpScore; this.rate = data.rate; this.jobId = data.jobId; if (data.unlockScore && data.unlockScore !== 0) { this.unlockScore = data.unlockScore; this.isUnlocked = 0; } else { this.isUnlocked = 1; } } isFull() { if (this.level && this.level == 25) { return true; } else { return false; } } }