From 47733c742a0d698ec36efab33d79cdfa31587fcb Mon Sep 17 00:00:00 2001 From: Nero Ignis Date: Mon, 19 Apr 2021 09:37:24 +0200 Subject: [PATCH] Add debug logs; --- index.html | 14 +++++++------- js/app.js | 28 ++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/index.html b/index.html index fc7a6d5..12f633d 100644 --- a/index.html +++ b/index.html @@ -19,13 +19,13 @@

{{ this.getAmount() }}


- {{ resources.wood }} - {{ resources.planks }} - {{ resources.stone }} - {{ resources.coal }} - {{ resources.iron }} - {{ resources.bricks }} - {{ resources.corn }} +

{{ resources.wood }} Wood

+

{{ resources.planks }} Planks

+

{{ resources.stone }} Stone

+

{{ resources.coal }} Coal

+

{{ resources.iron }} Iron

+

{{ resources.bricks }} Bricks

+

{{ resources.corn }} Corn

diff --git a/js/app.js b/js/app.js index 5740dcc..d838afa 100644 --- a/js/app.js +++ b/js/app.js @@ -137,6 +137,7 @@ let game = new Vue({ this.money = this.getSavedMoney(); this.saveMoney(); this.loadResources(); + this.currentQuest = JSON.parse(localStorage.getItem('currentQuest')); this.loadBuildings(); this.reloadBuildings(); @@ -203,10 +204,6 @@ let game = new Vue({ return this.money.toFixed(0); }, - getAmountFormatted() { - return Intl.NumberFormat('de-DE', {style: 'currency', currency: 'EUR'}).format(this.money); - }, - reloadBuildings() { let game = this; this.buildings.forEach((building) => { @@ -399,6 +396,8 @@ let game = new Vue({ this.currentQuest = null; } + localStorage.setItem('currentQuest', JSON.stringify(this.currentQuest)); + console.log('New Quest:', this.currentQuest); return this.currentQuest; }, @@ -407,6 +406,27 @@ let game = new Vue({ }, 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 ( this.resources.wood >= this.currentQuest.wood && this.resources.stone >= this.currentQuest.stone &&