diff options
author | alexichi <alexbankai96@gmail.com> | 2016-05-05 23:06:29 +0200 |
---|---|---|
committer | alexichi <alexbankai96@gmail.com> | 2016-05-05 23:09:21 +0200 |
commit | f171811a44364f605712aff1ca0808bfe570ef6e (patch) | |
tree | a970a69853e19ef43d97c2f48d61a6fb34637ff6 /js/craftmine.js | |
parent | 1efc4a15c8ab913bf8bdb1aef9f3b5720b3b7762 (diff) | |
download | candybox-f171811a44364f605712aff1ca0808bfe570ef6e.tar.gz candybox-f171811a44364f605712aff1ca0808bfe570ef6e.tar.bz2 candybox-f171811a44364f605712aff1ca0808bfe570ef6e.tar.xz candybox-f171811a44364f605712aff1ca0808bfe570ef6e.zip |
add xp system and perso server side
Diffstat (limited to 'js/craftmine.js')
-rw-r--r-- | js/craftmine.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/js/craftmine.js b/js/craftmine.js index 9af9b9f..c7a396f 100644 --- a/js/craftmine.js +++ b/js/craftmine.js @@ -5,6 +5,7 @@ data = { miners: 0, level: 4, hp: 5, + xp: 0, icon : "H" } @@ -52,12 +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(typeof ret.dungeon.mob == "undefined") displayDungeon(0,1,true); - else displayDungeon(ret.dungeon.mob,ret.dungeon.flat,true); + 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"); }) |