Compare commits

..

2 Commits

  1. 35
      css/app.css
  2. BIN
      img/tiles/clear_hexagon.png
  3. BIN
      img/tiles/environment/birch_large.png
  4. BIN
      img/tiles/environment/birch_small.png
  5. BIN
      img/tiles/environment/bush.png
  6. BIN
      img/tiles/environment/bush_berries.png
  7. BIN
      img/tiles/environment/fire.png
  8. BIN
      img/tiles/environment/ore_copper.png
  9. BIN
      img/tiles/environment/ore_gold.png
  10. BIN
      img/tiles/environment/spruce_large.png
  11. BIN
      img/tiles/environment/spruce_small.png
  12. BIN
      img/tiles/environment/stone.png
  13. BIN
      img/tiles/environment/stone_0.png
  14. BIN
      img/tiles/environment/stone_1.png
  15. BIN
      img/tiles/environment/stone_3.png
  16. BIN
      img/tiles/environment/wood_log.png
  17. BIN
      img/tiles/environment/wooden_fence.png
  18. BIN
      img/tiles/grass.png
  19. BIN
      img/tiles/roads/corner_n_o.png
  20. BIN
      img/tiles/roads/corner_n_w.png
  21. BIN
      img/tiles/roads/corner_o_s.png
  22. BIN
      img/tiles/roads/corner_s_w.png
  23. BIN
      img/tiles/roads/cross.png
  24. BIN
      img/tiles/roads/end_n.png
  25. BIN
      img/tiles/roads/end_o.png
  26. BIN
      img/tiles/roads/end_s.png
  27. BIN
      img/tiles/roads/end_w.png
  28. BIN
      img/tiles/roads/straight_n_s.png
  29. BIN
      img/tiles/roads/straight_o_w.png
  30. BIN
      img/tiles/roads/t_n_o_s.png
  31. BIN
      img/tiles/roads/t_n_o_w.png
  32. BIN
      img/tiles/roads/t_n_s_w.png
  33. BIN
      img/tiles/roads/t_o_s_w.png
  34. BIN
      img/tiles/singleSpruce.png
  35. BIN
      img/tiles/structure/barn.png
  36. BIN
      img/tiles/structure/blacksmith.png
  37. BIN
      img/tiles/structure/castle_bottom.png
  38. BIN
      img/tiles/structure/castle_top.png
  39. BIN
      img/tiles/structure/church_bottom.png
  40. BIN
      img/tiles/structure/church_top.png
  41. BIN
      img/tiles/structure/house.png
  42. BIN
      img/tiles/structure/house_long.png
  43. BIN
      img/tiles/structure/lifestock_bottom.png
  44. BIN
      img/tiles/structure/lifestock_top.png
  45. BIN
      img/tiles/structure/lumberjack.png
  46. BIN
      img/tiles/structure/market_stand.png
  47. BIN
      img/tiles/structure/mill_bottom.png
  48. BIN
      img/tiles/structure/mill_top.png
  49. BIN
      img/tiles/structure/mill_top_alt.png
  50. BIN
      img/tiles/structure/mill_wheel_1.png
  51. BIN
      img/tiles/structure/mill_wheel_2.png
  52. BIN
      img/tiles/structure/mill_wheel_3.png
  53. BIN
      img/tiles/structure/statue.png
  54. BIN
      img/tiles/structure/storage.png
  55. BIN
      img/tiles/structure/tower_bottom.png
  56. BIN
      img/tiles/structure/tower_top.png
  57. BIN
      img/tiles/structure/wide_house.png
  58. BIN
      img/tiles/trans.png
  59. 253
      index.html
  60. 240
      js/app.js

35
css/app.css

@ -26,7 +26,6 @@
top: 4px; top: 4px;
right: 10px; right: 10px;
font-size: 2.5em; font-size: 2.5em;
-webkit-text-stroke: 1px lighgrey;
-webkit-text-fill-color: gold; -webkit-text-fill-color: gold;
font-family: Arial, serif; font-family: Arial, serif;
text-shadow: -1px -1px 2px black; text-shadow: -1px -1px 2px black;
@ -36,3 +35,37 @@
display: inline-block; display: inline-block;
width: 90px; width: 90px;
} }
#mapwrapper {
text-align: center;
overflow: auto;
height: 60vh;
overflow-scrolling: auto;
}
.tile {
background-image: url('../img/tiles/grass.png');
}
.tile:hover {
opacity: 70%;
}
.tilebutton {
height: 40px;
width: 35px;
margin: 0.5em;
}
.deco-button {
background-image: url('../img/tiles/clear_hexagon.png');
background-size: 100% 100%;
}
.deco-button {
padding: 3px;
}
#mapwrapper.card-body {
padding: 0;
}

BIN
img/tiles/clear_hexagon.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
img/tiles/environment/birch_large.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
img/tiles/environment/birch_small.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
img/tiles/environment/bush.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
img/tiles/environment/bush_berries.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
img/tiles/environment/fire.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
img/tiles/environment/ore_copper.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
img/tiles/environment/ore_gold.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
img/tiles/environment/spruce_large.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

BIN
img/tiles/environment/spruce_small.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
img/tiles/environment/stone.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
img/tiles/environment/stone_0.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

BIN
img/tiles/environment/stone_1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
img/tiles/environment/stone_3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
img/tiles/environment/wood_log.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
img/tiles/environment/wooden_fence.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
img/tiles/grass.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
img/tiles/roads/corner_n_o.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
img/tiles/roads/corner_n_w.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
img/tiles/roads/corner_o_s.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
img/tiles/roads/corner_s_w.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
img/tiles/roads/cross.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
img/tiles/roads/end_n.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
img/tiles/roads/end_o.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
img/tiles/roads/end_s.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
img/tiles/roads/end_w.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
img/tiles/roads/straight_n_s.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
img/tiles/roads/straight_o_w.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
img/tiles/roads/t_n_o_s.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
img/tiles/roads/t_n_o_w.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
img/tiles/roads/t_n_s_w.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
img/tiles/roads/t_o_s_w.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
img/tiles/singleSpruce.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
img/tiles/structure/barn.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
img/tiles/structure/blacksmith.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
img/tiles/structure/castle_bottom.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
img/tiles/structure/castle_top.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

BIN
img/tiles/structure/church_bottom.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
img/tiles/structure/church_top.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
img/tiles/structure/house.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
img/tiles/structure/house_long.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
img/tiles/structure/lifestock_bottom.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
img/tiles/structure/lifestock_top.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
img/tiles/structure/lumberjack.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
img/tiles/structure/market_stand.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
img/tiles/structure/mill_bottom.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
img/tiles/structure/mill_top.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
img/tiles/structure/mill_top_alt.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
img/tiles/structure/mill_wheel_1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
img/tiles/structure/mill_wheel_2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

BIN
img/tiles/structure/mill_wheel_3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

BIN
img/tiles/structure/statue.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
img/tiles/structure/storage.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

BIN
img/tiles/structure/tower_bottom.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
img/tiles/structure/tower_top.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
img/tiles/structure/wide_house.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
img/tiles/trans.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 993 B

253
index.html

@ -7,83 +7,223 @@
<link rel="stylesheet" href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css"> <link rel="stylesheet" href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/izitoast/1.4.0/css/iziToast.min.css"/> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/izitoast/1.4.0/css/iziToast.min.css"/>
<link rel="stylesheet" href="css/app.css"> <link rel="stylesheet" href="css/app.css">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no" name="viewport"> <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, shrink-to-fit=no"
name="viewport">
</head> </head>
<body> <body>
<div id="root" class="container mt-2"> <div id="root" class="container-fluid mt-2">
<div class="row"> <div class="modal fade" id="buildingModal" tabindex="-1" aria-labelledby="buildingModalLabel" aria-hidden="true" v-if="modalBuilding">
<div class="col-md-12"> <div class="modal-dialog">
<div class="alert alert-warning"> <div class="modal-content">
This game is in an early state of development, resources could be resetted everytime and bugs may appear. Also not every building is balanced yet. <div class="modal-header">
<h5 class="modal-title" id="buildingModalLabel">{{ modalBuilding.name }}</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<div class="float-right" v-if="modalBuilding.isUpgradeable">
<a href="javascript:" @click="buyUpgrade(modalBuilding)"><i
class="fas fa-arrow-up text-success"></i> {{ modalBuilding.price }} <img
class="resource-icon" src="img/gold.png"> </a>
</div> </div>
<div class="float-left icon-level-container">
<img class="building-icon" :src="'img/' + modalBuilding.icon + '.png'"
:alt="modalBuilding.name + '_icon'">
<div class="level-marker">{{ modalBuilding.level === 10 ? 'X' : modalBuilding.level }}</div>
</div> </div>
<div class="col-sm-6">
{{ modalBuilding.amount }} <img class="resource-icon"
:src="'img/' + modalBuilding.resource + '.png'"
:alt="modalBuilding.resource + '_icon'"> every
{{ modalBuilding.intervalInSeconds }}s<br/>
<span v-if="modalBuilding.hasRequirements" v-html="getRequirementsText(modalBuilding)"></span>
<div class="progress">
<div class="progress-bar progress-bar-success text-light" role="progressbar"
:style="'width: ' + modalBuilding.loader + '%;'" aria-valuenow="10"
aria-valuemin="0"
aria-valuemax="100">
<span v-if="!modalBuilding.hasMissingResources">
{{ modalBuilding.loader }} %
</span>
<span class="text-danger" v-else>
Missing resources!
</span>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-xl-8">
<div class="card"> <div class="card">
<a class="card-header" data-toggle="collapse" href="#collapseResources" role="button" aria-expanded="true" aria-controls="collapseResources"> <div class="card-header">Map</div>
<div class="card-body" id="mapwrapper">
<div class="mapRow" v-for="(row, rowNumber) in map">
<nobr>
<a v-for="(tile, colNumber) in row">
<img :src="tile.asset" alt="" class="tile" style="display: inline-block;" @click="interactWithTile(tile, rowNumber, colNumber)"/>
</a>
</nobr>
</div>
<div class="" style="position: relative; bottom: 43em; width: 5em;">
<div class="card-body">
<div class="nav-item">
<a href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Building
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<button v-for="building in buildings" @click="initiateBuilding(building)" class="tilebutton">
<img :src="'img/' + building.icon + '.png'"
data-toggle="tooltip"
data-placement="left"
:title="building.name + ' (' + getResourcesNeededToBuildText(building) + ')'"/>
</button>
</div>
</div>
<div class="nav-item">
<a href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Deco
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<button class="tilebutton deco-button"
v-for="item in mapDecorations"
@click="selectDecoration(item)"
data-toggle="tooltip"
data-placement="left"
:title="item.name + ' (' + item.price + ' Gold)'">
<img :src="item.path" class="deco-button-image"/>
</button>
</div>
</div>
<div class="nav-item">
<a href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Roads
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<button class="tilebutton deco-button"
v-for="item in roads"
@click="selectDecoration(item)"
data-toggle="tooltip"
data-placement="left"
:title="item.name + ' (' + item.price + ' Gold)'">
<img :src="item.path" class="deco-button-image"/>
</button>
</div>
</div>
<button class="tilebutton deco-button"
@click="selection = {bulldozer: true}"
data-toggle="tooltip"
data-placement="left"
title="Bulldozer">
<img src="img/tiles/environment/fire.png"/>
</button>
<button class="tilebutton deco-button cancel"
v-if="selection"
@click="selection = null"
data-toggle="tooltip"
data-placement="left"
title="Cancel">
<i class="fas fa-ban" style="color: darkred"></i>
</button>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-4">
<div class="card">
<a class="card-header" data-toggle="collapse" href="#collapseResources" role="button"
aria-expanded="true" aria-controls="collapseResources">
<h3>Resources</h3> <h3>Resources</h3>
</a> </a>
<div class="card-body" id="collapseResources"> <div class="card-body" id="collapseResources">
<div class="row"> <div class="row">
<div class="col-md-12" v-for="resource in resources" v-if="resource.amount > 0 || resource.name === 'Gold'"> <div class="col-md-12" v-for="resource in resources"
<div class="float-right">{{ getFormattedNumber(resource.amount) }} <img class="resource-icon" :src="resource.icon"></div> v-if="resource.amount > 0 || resource.name === 'Gold'">
<div class="float-right">{{ getFormattedNumber(resource.amount) }} <img
class="resource-icon" :src="resource.icon"></div>
{{ resource.name }} {{ resource.name }}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="col-sm-6">
<div class="card"> <div class="card">
<a class="card-header" data-toggle="collapse" href="#collapseQuest" role="button" aria-expanded="true" aria-controls="collapseQuest"> <a class="card-header" data-toggle="collapse" href="#collapseQuest" role="button"
aria-expanded="true"
aria-controls="collapseQuest">
<h3>Quests</h3> <h3>Quests</h3>
</a> </a>
<div class="card-body" id="collapseQuest"> <div class="card-body" id="collapseQuest">
<div v-if="currentQuest"> <div v-if="currentQuest">
Items needed: <br/> Items needed: <br/>
<span v-for="resource in Object.keys(resources)" v-if="resources[resource].unlocked && currentQuest[resource] > 0" :style="'color: ' + getColorForQuestResource(currentQuest[resource], resources[resource].amount)"> <span v-for="resource in Object.keys(resources)"
<img :title="resources[resource].name" class="resource-icon" :src="resources[resource].icon"> {{ currentQuest[resource] }} v-if="resources[resource].unlocked && currentQuest[resource] > 0"
:style="'color: ' + getColorForQuestResource(currentQuest[resource], resources[resource].amount)">
<img :title="resources[resource].name" class="resource-icon"
:src="resources[resource].icon"> {{ currentQuest[resource] }}
</span> </span>
<br/> <br/>
<br/> <br/>
<a href="javascript:" class="btn btn-sm btn-success float-right" @click="redeemReward()">Redeem reward ({{ currentQuest.reward }} <img class="resource-icon" src="img/gold.png">)</a> <a href="javascript:" class="btn btn-sm btn-success float-right" @click="redeemReward()">Redeem
<a class="btn btn-sm btn-info float-right" style="margin-right: 1em;" @click="generateQuestWithRandomItems(true)"><i class="fas fa-question"></i> Get a new quest for 250 <img class="resource-icon" src="img/gold.png"> ({{ 3 - questSkipCounter }} left)</a> reward ({{ currentQuest.reward }} <img class="resource-icon" src="img/gold.png">)</a>
<a class="btn btn-sm btn-info float-right" style="margin-right: 1em;"
@click="generateQuestWithRandomItems(true)"><i class="fas fa-question"></i> Get a new
quest
for 250 <img class="resource-icon" src="img/gold.png"> ({{ 3 - questSkipCounter }} left)</a>
</div> </div>
<div v-else> <div v-else>
You don't have a quest at the moment. <br/> You don't have a quest at the moment. <br/>
<br/> <br/>
<br/> <br/>
<a class="btn btn-sm btn-info float-right" @click="generateQuestWithRandomItems()"><i class="fas fa-question"></i> Get a new quest</a> <a class="btn btn-sm btn-info float-right" @click="generateQuestWithRandomItems()"><i
class="fas fa-question"></i> Get a new quest</a>
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="col-md-6">
<div class="card"> <div class="card">
<a class="card-header" data-toggle="collapse" href="#collapseOwned" role="button" aria-expanded="true" aria-controls="collapseOwned"> <a class="card-header" data-toggle="collapse" href="#collapseOwned" role="button"
aria-expanded="true"
aria-controls="collapseOwned">
<h3>Owned buildings</h3> <h3>Owned buildings</h3>
</a> </a>
<div class="card-body" id="collapseOwned"> <div class="card-body" id="collapseOwned">
<ul class="list-group"> <ul class="list-group">
<li class="list-group-item" v-for="building in buildings" v-if="building.isOwned"> <li class="list-group-item" v-for="building in buildings" v-if="building.isOwned">
<div class="float-right" v-if="building.isUpgradeable"> <div class="float-right" v-if="building.isUpgradeable">
<a href="javascript:" @click="buyUpgrade(building)"><i class="fas fa-arrow-up text-success"></i> {{ building.price }} <img class="resource-icon" src="img/gold.png"> </a> <a href="javascript:" @click="buyUpgrade(building)"><i
class="fas fa-arrow-up text-success"></i> {{ building.price }} <img
class="resource-icon" src="img/gold.png"> </a>
</div> </div>
<div class="float-left icon-level-container"> <div class="float-left icon-level-container">
<img class="building-icon" :src="'img/' + building.icon + '.png'" :alt="building.name + '_icon'"> <img class="building-icon" :src="'img/' + building.icon + '.png'"
:alt="building.name + '_icon'">
<div class="level-marker">{{ building.level === 10 ? 'X' : building.level }}</div> <div class="level-marker">{{ building.level === 10 ? 'X' : building.level }}</div>
</div> </div>
<strong>{{ building.name }}</strong><br> <strong>{{ building.name }}</strong><br>
{{ building.amount }} <img class="resource-icon" :src="'img/' + building.resource + '.png'" :alt="building.resource + '_icon'"> every {{ building.intervalInSeconds }}s<br/> {{ building.amount }} <img class="resource-icon"
:src="'img/' + building.resource + '.png'"
:alt="building.resource + '_icon'"> every
{{ building.intervalInSeconds }}s<br/>
<span v-if="building.hasRequirements" v-html="getRequirementsText(building)"></span> <span v-if="building.hasRequirements" v-html="getRequirementsText(building)"></span>
<div class="progress"> <div class="progress">
<div class="progress-bar progress-bar-success text-light" role="progressbar" :style="'width: ' + building.loader + '%;'" aria-valuenow="10" aria-valuemin="0" aria-valuemax="100"> <div class="progress-bar progress-bar-success text-light" role="progressbar"
:style="'width: ' + building.loader + '%;'" aria-valuenow="10"
aria-valuemin="0"
aria-valuemax="100">
<span v-if="!building.hasMissingResources"> <span v-if="!building.hasMissingResources">
{{ building.loader }} % {{ building.loader }} %
</span> </span>
@ -96,11 +236,9 @@
</ul> </ul>
</div> </div>
</div> </div>
</div>
<div class="col-md-6">
<div class="card"> <div class="card">
<a class="card-header" data-toggle="collapse" href="#collapseAvailable" role="button" aria-expanded="true" aria-controls="collapseAvailable"> <a class="card-header" data-toggle="collapse" href="#collapseAvailable" role="button"
aria-expanded="true" aria-controls="collapseAvailable">
<h3>Available buildings</h3> <h3>Available buildings</h3>
</a> </a>
<div class="card-body" id="collapseAvailable"> <div class="card-body" id="collapseAvailable">
@ -111,11 +249,15 @@
<template v-if="building.resourcesToBuild"> <template v-if="building.resourcesToBuild">
<i class="fas fa-hammer text-success"></i> <i class="fas fa-hammer text-success"></i>
<span v-for="(amount, resoureceName) in building.resourcesToBuild"> <span v-for="(amount, resoureceName) in building.resourcesToBuild">
{{ amount }} <img class="resource-icon" :src="resources[resoureceName].icon" :title="resources[resoureceName].icon" :alt="resources[resoureceName].icon"> {{ amount }} <img class="resource-icon" :src="resources[resoureceName].icon"
:title="resources[resoureceName].icon"
:alt="resources[resoureceName].icon">
</span> </span>
</template> </template>
<template v-else> <template v-else>
<i class="fas fa-shopping-basket text-success"></i> {{ building.price }} <img class="resource-icon" src="img/gold.png"> <i class="fas fa-shopping-basket text-success"></i> {{ building.price }}
<img
class="resource-icon" src="img/gold.png">
</template> </template>
</a> </a>
</div> </div>
@ -123,51 +265,56 @@
<img class="building-icon" :src="'img/' + building.icon + '.png'"> <img class="building-icon" :src="'img/' + building.icon + '.png'">
</div> </div>
<strong>{{ building.name }}</strong><br> <strong>{{ building.name }}</strong><br>
{{ building.amount }} <img class="resource-icon" :src="'img/' + building.resource + '.png'"> every {{ building.intervalInSeconds }}s<br/> {{ building.amount }} <img class="resource-icon"
:src="'img/' + building.resource + '.png'">
every {{ building.intervalInSeconds }}s<br/>
<span v-if="building.hasRequirements" v-html="getRequirementsText(building)"></span> <span v-if="building.hasRequirements" v-html="getRequirementsText(building)"></span>
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
</div>
<div class="col-md-12">
<div class="card"> <div class="card">
<a class="card-header" data-toggle="collapse" href="#collapseDebug" role="button" aria-expanded="true" aria-controls="collapseDebug"> <a class="card-header" data-toggle="collapse" href="#collapseDebug" role="button"
aria-expanded="true"
aria-controls="collapseDebug">
<h3>Debug</h3> <h3>Debug</h3>
</a> </a>
<div class="card-body" id="collapseDebug"> <div class="card-body" id="collapseDebug">
<a href="https://git.luna-development.net/neroignis/idle-buildup/issues"><i class="fas fa-bug"></i> Found a bug?</a><br/> <a href="https://git.luna-development.net/neroignis/idle-buildup/issues"><i
class="fas fa-bug"></i>
Found a bug?</a><br/>
<br/> <br/>
<input type="checkbox" v-model="debug.levelSandbox"> Buildings-Sandbox<br/> <input type="checkbox" v-model="debug.levelSandbox"> Buildings-Sandbox<br/>
<input type="checkbox" v-model="debug.buildingsSandbox"> Resource-Sandbox<br/> <input type="checkbox" v-model="debug.buildingsSandbox"> Resource-Sandbox<br/>
<!-- <a class="btn btn-sm btn-danger" style="margin: 0.5em;" href="javascript:" @click="resources = {gold: 500,wood: 50,stone: 50,iron: 50,bricks: 50,corn: 50,coal: 50,planks: 50}">Reset resources</a>--> <!-- <a class="btn btn-sm btn-danger" style="margin: 0.5em;" href="javascript:" @click="resources = {gold: 500,wood: 50,stone: 50,iron: 50,bricks: 50,corn: 50,coal: 50,planks: 50}">Reset resources</a>-->
<a class="btn btn-sm btn-danger" style="margin: 0.5em;" href="javascript:" @click="reset()">Soft reset (everything except resources)</a> <a class="btn btn-sm btn-danger" style="margin: 0.5em;" href="javascript:" @click="reset()">Soft
<a class="btn btn-sm btn-danger" style="margin: 0.5em;" href="javascript:" @click="reset(true)">Hard reset (everything)</a><br/> reset (everything except resources)</a>
</div> <a class="btn btn-sm btn-danger" style="margin: 0.5em;" href="javascript:" @click="reset(true)">Hard
reset (everything)</a><br/>
</div> </div>
</div> </div>
<div class="col-md-12" v-if="debug.levelSandbox"> <div class="card" v-if="debug.levelSandbox">
<div class="card">
<div class="card-header">Buildings Sandbox</div> <div class="card-header">Buildings Sandbox</div>
<div class="card-body"> <div class="card-body">
<template v-for="building in buildings" v-if="building.amountPerLevel || building.intervalPerLevel || building.pricePerLevel"> <template v-for="building in buildings"
v-if="building.amountPerLevel || building.intervalPerLevel || building.pricePerLevel">
<h3><strong>{{ building.name }}</strong></h3> <h3><strong>{{ building.name }}</strong></h3>
Amout per Level:<br/> Amout per Level:<br/>
<input class="form-control form-control-sandbox" type="number" v-for="amount in building.amountPerLevel" :value="amount"><br/> <input class="form-control form-control-sandbox" type="number"
v-for="amount in building.amountPerLevel" :value="amount"><br/>
Interval per Level:<br/> Interval per Level:<br/>
<input class="form-control form-control-sandbox" type="number" v-for="interval in building.intervalPerLevel" :value="interval"><br/> <input class="form-control form-control-sandbox" type="number"
v-for="interval in building.intervalPerLevel" :value="interval"><br/>
Price per Level:<br/> Price per Level:<br/>
<input class="form-control form-control-sandbox" type="number" v-for="price in building.pricePerLevel" :value="price"><br/> <input class="form-control form-control-sandbox" type="number"
<hr/><br/> v-for="price in building.pricePerLevel" :value="price"><br/>
<hr/>
<br/>
</template> </template>
</div> </div>
</div> </div>
</div> <div class="card" v-if="debug.buildingsSandbox">
<div class="col-md-12" v-if="debug.buildingsSandbox">
<div class="card">
<div class="card-header">Resource Sandbox</div> <div class="card-header">Resource Sandbox</div>
<div class="card-body"> <div class="card-body">
<template v-for="resource in resources"> <template v-for="resource in resources">

240
js/app.js

@ -6,6 +6,7 @@ let game = new Vue({
levelSandbox: false, levelSandbox: false,
buildingsSandbox: false buildingsSandbox: false
}, },
map: [],
resources: { resources: {
gold: { gold: {
amount: 500, amount: 500,
@ -205,9 +206,163 @@ let game = new Vue({
}, },
currentQuest: null, currentQuest: null,
questSkipCounter: 0, questSkipCounter: 0,
loadedIntervals: [] loadedIntervals: [],
selectedBuilding: null,
selectedDecoration: null,
selection: null,
modalBuilding: null,
mapDecorations: [
{
path: 'img/tiles/environment/birch_small.png',
name: 'dummy',
price: 50
},
{
path: 'img/tiles/environment/birch_large.png',
name: 'dummy',
price: 50
},
{
path: 'img/tiles/environment/spruce_small.png',
name: 'dummy',
price: 50
},
{
path: 'img/tiles/environment/spruce_large.png',
name: 'dummy',
price: 50
},
{
path: 'img/tiles/environment/bush.png',
name: 'dummy',
price: 50
},
{
path: 'img/tiles/environment/bush_berries.png',
name: 'dummy',
price: 50
},
{
path: 'img/tiles/environment/stone.png',
name: 'dummy',
price: 50
},
{
path: 'img/tiles/environment/stone_0.png',
name: 'Stone 1',
price: 50
},
{
path: 'img/tiles/environment/stone_1.png',
name: 'Stone 2',
price: 50
},
{
path: 'img/tiles/environment/stone_3.png',
name: 'Stone 3',
price: 50
},
{
path: 'img/tiles/dummy/dummy',
name: 'dummy',
price: 50
},
{
path: 'img/tiles/environment/wood_log.png',
name: 'Log',
price: 50
},
],
roads: [
{
path: 'img/tiles/roads/corner_n_o.png',
name: 'Log',
price: 50
},
{
path: 'img/tiles/roads/corner_n_w.png',
name: 'Log',
price: 50
},
{
path: 'img/tiles/roads/corner_o_s.png',
name: 'Log',
price: 50
},
{
path: 'img/tiles/roads/corner_s_w.png',
name: 'Log',
price: 50
},
{
path: 'img/tiles/roads/cross.png',
name: 'Log',
price: 50
},
{
path: 'img/tiles/roads/end_n.png',
name: 'Log',
price: 50
},
{
path: 'img/tiles/roads/end_o.png',
name: 'Log',
price: 50
},
{
path: 'img/tiles/roads/end_s.png',
name: 'Log',
price: 50
},
{
path: 'img/tiles/roads/end_w.png',
name: 'Log',
price: 50
},
{
path: 'img/tiles/roads/straight_n_s.png',
name: 'Log',
price: 50
},
{
path: 'img/tiles/roads/straight_o_w.png',
name: 'Log',
price: 50
},
{
path: 'img/tiles/roads/t_n_o_s.png',
name: 'Log',
price: 50
},
{
path: 'img/tiles/roads/t_n_o_w.png',
name: 'Log',
price: 50
},
{
path: 'img/tiles/roads/t_n_s_w.png',
name: 'Log',
price: 50
},
{
path: 'img/tiles/roads/t_o_s_w.png',
name: 'Log',
price: 50
},
]
}, },
created() { created() {
let game = this;
this.generateMap(10, 10);
$(function () {
$('[data-toggle="tooltip"]').tooltip()
});
$('#buildingModal').on('close.bs.modal', function (event) {
game.modalBuilding = null;
});
this.storageNames = { this.storageNames = {
lastVersion: 'lastVersion', lastVersion: 'lastVersion',
resources: 'resources' + this.version, resources: 'resources' + this.version,
@ -222,6 +377,89 @@ let game = new Vue({
this.reloadBuildings(); this.reloadBuildings();
}, },
methods: { methods: {
// Map system
getResourcesNeededToBuildText(building) {
let game = this;
let message = '';
if (building.resourcesToBuild) {
Object.keys(building.resourcesToBuild).forEach((resourceName, resourceAmount) => {
if (message.length > 0) {
message += ', '
}
message += building.resourcesToBuild[resourceName] + ' ' + game.resources[resourceName].name;
});
} else {
message += building.price + '<img class="resource-icon" src="img/gold.png"/>';
}
return message;
},
initiateBuilding(building) {
this.selection = {
building: building
};
},
selectDecoration(item) {
this.selection = {
decoration: item
};
},
generateMap(rows, cols) {
let map = [];
for (let i = 0; i < rows; i++) {
let newRow = [];
for (let j = 0; j < cols; j++) {
newRow.push({
asset: 'img/tiles/trans.png',
building: null
});
}
map.push(newRow);
}
this.map = map;
},
setTile(x, y, tile) {
this.map[x-1][y-1] = tile;
},
interactWithTile(tile, x, y) {
if (game.selection) {
if (game.selection.building) {
tile.asset = 'img/tiles/structure/' + game.selection.building.name.toLowerCase() + '.png';
tile.building = game.selection.building.name.toLowerCase();
this.selection = null;
}
if (game.selection.decoration) {
tile.asset = game.selection.decoration.path;
tile.building = null;
// decorations can only be cancelled by cancel button
}
if (game.selection.bulldozer) {
tile.asset = 'img/tiles/trans.png';
tile.building = null;
// bulldozer can only be cancelled by cancel button
}
}
if (tile.building) {
this.modalBuilding = this.buildings[tile.building];
$('#buildingModal').modal('show');
this.$forceUpdate();
}
},
// System & Saving // System & Saving
// Check if a new version is played and notify the user of the loss of his beloved score & progress // Check if a new version is played and notify the user of the loss of his beloved score & progress
checkVersion() { checkVersion() {

Loading…
Cancel
Save