aboutsummaryrefslogtreecommitdiffstats
path: root/js/craftmine.js
diff options
context:
space:
mode:
authorpiernov <piernov@piernov.org>2016-05-07 13:48:28 +0200
committerpiernov <piernov@piernov.org>2016-05-07 13:48:28 +0200
commitb91588134f3067c2771011c10af77cda5f9031e8 (patch)
treea8e5f1bde0bfe9539bb5dd29e249ee8c6b1f36d6 /js/craftmine.js
parent8621eae6aa5fcdba0a60f0a5f1136412c61999ec (diff)
parent80f5826d1ac8f6d42866d5133c6f463943b96bab (diff)
downloadcandybox-b91588134f3067c2771011c10af77cda5f9031e8.tar.gz
candybox-b91588134f3067c2771011c10af77cda5f9031e8.tar.bz2
candybox-b91588134f3067c2771011c10af77cda5f9031e8.tar.xz
candybox-b91588134f3067c2771011c10af77cda5f9031e8.zip
Merge branch 'alexichi' into feat/gui
Diffstat (limited to 'js/craftmine.js')
-rw-r--r--js/craftmine.js18
1 files changed, 14 insertions, 4 deletions
diff --git a/js/craftmine.js b/js/craftmine.js
index 0e95aa3..347ce65 100644
--- a/js/craftmine.js
+++ b/js/craftmine.js
@@ -3,8 +3,9 @@ data = {
gold: 0,
mine: 0,
miners: 0,
- level: 1,
- hp: 1,
+ level: 3,
+ hp: 5,
+ xp: 0,
icon : "H"
}
@@ -52,11 +53,20 @@ function withdrawMine() {
function initCraftMine() {
sendRequest("craftmine.php", "op=getCraftMine", function(ret) {
+ console.log(ret.perso);
data.gold = parseInt(ret.gold); // Server's response is a string
data.mine = 0; // Reset mine
+ if(ret.perso){
+ data.hp = ret.perso.hp;
+ data.xp = ret.perso.xp;
+ data.level = ret.perso.lv;
+ displayPerso(ret.perso.hp,ret.perso.xp,ret.perso.lv);
+ }
if(ret.shop) displayShop(ret.shop);
- displayInventory(ret.inventory);
- if(ret.dungeon) displayDungeon();
+ if(ret.inventory) displayInventory(ret.inventory);
+ if(ret.dungeon == false){}//if we have left the donjon
+ else if(typeof ret.dungeon.mob == "undefined") displayDungeon(0,1,true); //if we have reload just after buying the ticket
+ else displayDungeon(ret.dungeon.mob,ret.dungeon.flat,true);//if we have reload in the middle of the dungeon
data.miners = parseInt(ret.miners);
updateData("gold", "mine", "miners");
})