From 64b1663e55544e1ed0e072c4f624688625691c9f Mon Sep 17 00:00:00 2001 From: alexichi Date: Sun, 1 May 2016 13:55:08 +0200 Subject: Add dungeon without fight system You can buy a "ticket" to access the dungeon If you exit you have to buy another ticket Problem when we update the page, the default sentence is displayed while it said that you can access the dungeon --- js/craftmine.js | 5 ++++- js/dungeon.js | 30 +++++++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) (limited to 'js') diff --git a/js/craftmine.js b/js/craftmine.js index 92fa45a..c40106c 100644 --- a/js/craftmine.js +++ b/js/craftmine.js @@ -1,8 +1,11 @@ data = { + name: "You", gold: 0, mine: 0, miners: 0, - level: 1 + level: 1, + hp: 1, + icon : "H" } function sendRequest(url, params, callback) { diff --git a/js/dungeon.js b/js/dungeon.js index 1760afa..d20a3cf 100644 --- a/js/dungeon.js +++ b/js/dungeon.js @@ -8,11 +8,35 @@ function buildDungeon(){ function displayDungeon(){ var tmphtml = "
"; - tmphtml += ""; - //tmphtml += ""; + tmphtml += ""; document.getElementById("tab4").innerHTML = tmphtml; } function launchDungeon(){ - console.log("Battle!"); + sendRequest("craftmine.php", "op=launchDungeon", function(ret) { + document.getElementById("launch").style.display = "none"; + displayBattle(ret); + }); +} + +function displayBattle(ret){ + var tmphtml = "
"; + tmphtml += "

Battle

"; + tmphtml += ""; + tmphtml += "
"; + tmphtml += "

"; + tmphtml += ""; + document.getElementById("tab4").innerHTML = tmphtml; +} + +function exitDungeon(){ + sendRequest("craftmine.php", "op=exitDungeon", function() { + document.getElementById("tab4").innerHTML = "

Look at how poor you are! You can't access the dungeon, it is only for the elite.

"; + showInfo("You have left the dungeon"); + }); } -- cgit v1.2.3-70-g09d2