Browse Source

Add debug logs;

master
Nero Ignis 4 years ago
parent
commit
47733c742a
  1. 14
      index.html
  2. 28
      js/app.js

14
index.html

@ -19,13 +19,13 @@ @@ -19,13 +19,13 @@
<div class="card-body" id="collapseResources">
<h1><img class="resource-icon" src="img/gold.png"> {{ this.getAmount() }}</h1>
<br>
<span v-if="resources.wood > 0"><img class="resource-icon" src="img/wood.png"> {{ resources.wood }}</span>
<span v-if="resources.planks > 0"><img class="resource-icon" src="img/planks.png"> {{ resources.planks }}</span>
<span v-if="resources.stone > 0"><img class="resource-icon" src="img/stone.png"> {{ resources.stone }}</span>
<span v-if="resources.coal > 0"><img class="resource-icon" src="img/coal.png"> {{ resources.coal }}</span>
<span v-if="resources.iron > 0"><img class="resource-icon" src="img/iron.png"> {{ resources.iron }}</span>
<span v-if="resources.bricks > 0"><img class="resource-icon" src="img/bricks.png"> {{ resources.bricks }}</span>
<span v-if="resources.corn > 0"><img class="resource-icon" src="img/corn.png"> {{ resources.corn }}</span>
<h3 v-if="resources.wood > 0"><img class="resource-icon" src="img/wood.png"> {{ resources.wood }} Wood</h3>
<h3 v-if="resources.planks > 0"><img class="resource-icon" src="img/planks.png"> {{ resources.planks }} Planks</h3>
<h3 v-if="resources.stone > 0"><img class="resource-icon" src="img/stone.png"> {{ resources.stone }} Stone</h3>
<h3 v-if="resources.coal > 0"><img class="resource-icon" src="img/coal.png"> {{ resources.coal }} Coal</h3>
<h3 v-if="resources.iron > 0"><img class="resource-icon" src="img/iron.png"> {{ resources.iron }} Iron</h3>
<h3 v-if="resources.bricks > 0"><img class="resource-icon" src="img/bricks.png"> {{ resources.bricks }} Bricks</h3>
<h3 v-if="resources.corn > 0"><img class="resource-icon" src="img/corn.png"> {{ resources.corn }} Corn</h3>
</div>
</div>
</div>

28
js/app.js

@ -137,6 +137,7 @@ let game = new Vue({ @@ -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({ @@ -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({ @@ -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({ @@ -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 &&

Loading…
Cancel
Save