aboutsummaryrefslogtreecommitdiffstats
path: root/js/dungeon.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/dungeon.js')
-rw-r--r--js/dungeon.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/js/dungeon.js b/js/dungeon.js
new file mode 100644
index 0000000..d20a3cf
--- /dev/null
+++ b/js/dungeon.js
@@ -0,0 +1,42 @@
+function buildDungeon(){
+ sendRequest("craftmine.php", "op=buildDungeon", function(ret) {
+ displayDungeon();
+ debitAccount(ret.cost);
+ showInfo("You can acces the dungeon now. Good Luck.");
+ });
+}
+
+function displayDungeon(){
+ var tmphtml = "<br/>";
+ tmphtml += "<button id=\"launch\" type=\"button\" class=\"btn btn-primary\" onclick=\"launchDungeon()\">Launch</button>";
+ document.getElementById("tab4").innerHTML = tmphtml;
+}
+
+function launchDungeon(){
+ sendRequest("craftmine.php", "op=launchDungeon", function(ret) {
+ document.getElementById("launch").style.display = "none";
+ displayBattle(ret);
+ });
+}
+
+function displayBattle(ret){
+ var tmphtml = "<div class=\"row\">";
+ tmphtml += "<h4>Battle</h4>";
+ tmphtml += "<ul class=\"list-inline\">";
+ tmphtml += "<li>";
+ tmphtml += "<button type=\"button\" class=\"btn btn-primary\" style=\"margin-left:30px;\"><span class=\"item-icon\">" + data.icon + "</span><br />" + data.name + "<br/> lv: " + data.level + " <span id=\"lifeMob\">hp: " + data.hp + "</span></button>";
+ tmphtml += "<button type=\"button\" class=\"btn btn-primary\" style=\"margin-left:30px;\"><span class=\"item-icon\">" + ret[0].icon + "</span><br />" + ret[0].name + "<br/> lv: " + ret[0].level + " <span id=\"lifeMob\">hp: " + ret[0].hp + "</span></button>";
+ tmphtml += "</li>";
+ tmphtml += "</ul>";
+ tmphtml += "</div>";
+ tmphtml += "<br/><br/>";
+ tmphtml += "<button type=\"button\" class=\"btn btn-primary\" onclick=\"exitDungeon()\">Exit</button>";
+ document.getElementById("tab4").innerHTML = tmphtml;
+}
+
+function exitDungeon(){
+ sendRequest("craftmine.php", "op=exitDungeon", function() {
+ document.getElementById("tab4").innerHTML = "<h4>Look at how poor you are! You can't access the dungeon, it is only for the elite.</h4>";
+ showInfo("You have left the dungeon");
+ });
+}