|
|
@ -137,6 +137,7 @@ let game = new Vue({ |
|
|
|
this.money = this.getSavedMoney(); |
|
|
|
this.money = this.getSavedMoney(); |
|
|
|
this.saveMoney(); |
|
|
|
this.saveMoney(); |
|
|
|
this.loadResources(); |
|
|
|
this.loadResources(); |
|
|
|
|
|
|
|
this.currentQuest = JSON.parse(localStorage.getItem('currentQuest')); |
|
|
|
|
|
|
|
|
|
|
|
this.loadBuildings(); |
|
|
|
this.loadBuildings(); |
|
|
|
this.reloadBuildings(); |
|
|
|
this.reloadBuildings(); |
|
|
@ -203,10 +204,6 @@ let game = new Vue({ |
|
|
|
return this.money.toFixed(0); |
|
|
|
return this.money.toFixed(0); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
getAmountFormatted() { |
|
|
|
|
|
|
|
return Intl.NumberFormat('de-DE', {style: 'currency', currency: 'EUR'}).format(this.money); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
reloadBuildings() { |
|
|
|
reloadBuildings() { |
|
|
|
let game = this; |
|
|
|
let game = this; |
|
|
|
this.buildings.forEach((building) => { |
|
|
|
this.buildings.forEach((building) => { |
|
|
@ -399,6 +396,8 @@ let game = new Vue({ |
|
|
|
this.currentQuest = null; |
|
|
|
this.currentQuest = null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
localStorage.setItem('currentQuest', JSON.stringify(this.currentQuest)); |
|
|
|
|
|
|
|
console.log('New Quest:', this.currentQuest); |
|
|
|
return this.currentQuest; |
|
|
|
return this.currentQuest; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
@ -407,6 +406,27 @@ let game = new Vue({ |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
isQuestRedeemable() { |
|
|
|
isQuestRedeemable() { |
|
|
|
|
|
|
|
console.log( |
|
|
|
|
|
|
|
this.resources.wood + ' wood available', |
|
|
|
|
|
|
|
this.currentQuest.wood + ' wood needed in quest', |
|
|
|
|
|
|
|
this.resources.wood >= this.currentQuest.wood, |
|
|
|
|
|
|
|
this.resources.stone + ' stone available', |
|
|
|
|
|
|
|
this.currentQuest.stone + ' wood needed in quest', |
|
|
|
|
|
|
|
this.resources.stone >= this.currentQuest.stone, |
|
|
|
|
|
|
|
this.resources.iron + ' iron available', |
|
|
|
|
|
|
|
this.currentQuest.iron + ' wood needed in quest', |
|
|
|
|
|
|
|
this.resources.iron >= this.currentQuest.iron, |
|
|
|
|
|
|
|
this.resources.bricks + ' bricks available', |
|
|
|
|
|
|
|
this.currentQuest.bricks + ' wood needed in quest', |
|
|
|
|
|
|
|
this.resources.bricks >= this.currentQuest.bricks, |
|
|
|
|
|
|
|
this.resources.corn + ' corn available', |
|
|
|
|
|
|
|
this.currentQuest.corn + ' wood needed in quest', |
|
|
|
|
|
|
|
this.resources.corn >= this.currentQuest.corn, |
|
|
|
|
|
|
|
this.resources.coal + ' coal available', |
|
|
|
|
|
|
|
this.currentQuest.coa + ' wood needed in quest', |
|
|
|
|
|
|
|
this.resources.coal >= this.currentQuest.coal |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
this.resources.wood >= this.currentQuest.wood && |
|
|
|
this.resources.wood >= this.currentQuest.wood && |
|
|
|
this.resources.stone >= this.currentQuest.stone && |
|
|
|
this.resources.stone >= this.currentQuest.stone && |
|
|
|