diff options
author | piernov <piernov@piernov.org> | 2016-05-07 13:48:28 +0200 |
---|---|---|
committer | piernov <piernov@piernov.org> | 2016-05-07 13:48:28 +0200 |
commit | b91588134f3067c2771011c10af77cda5f9031e8 (patch) | |
tree | a8e5f1bde0bfe9539bb5dd29e249ee8c6b1f36d6 /js/shop.js | |
parent | 8621eae6aa5fcdba0a60f0a5f1136412c61999ec (diff) | |
parent | 80f5826d1ac8f6d42866d5133c6f463943b96bab (diff) | |
download | candybox-b91588134f3067c2771011c10af77cda5f9031e8.tar.gz candybox-b91588134f3067c2771011c10af77cda5f9031e8.tar.bz2 candybox-b91588134f3067c2771011c10af77cda5f9031e8.tar.xz candybox-b91588134f3067c2771011c10af77cda5f9031e8.zip |
Merge branch 'alexichi' into feat/gui
Diffstat (limited to 'js/shop.js')
-rw-r--r-- | js/shop.js | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -66,6 +66,22 @@ function buyItem(name) { function useItem(name) { sendRequest("craftmine.php", "op=useItem&item="+name, function(ret) { + if(parseInt(ret[1])>=0){ + var nb = parseInt(document.getElementById("nbItem").innerHTML); + if(nb>0){ + nb--; + switch(ret[0].name){ + case "Life Bottle": data.hp = parseInt(data.hp) + 3; break; + case "Strength Bottle" : break; // to do + case "Wooden Sword" : break; //to do + case "Metal Sword" : break; //to do + } + } + document.getElementById("nbItem").innerHTML = nb; + sendRequest("craftmine.php", "op=updatePerso&hp="+data.hp+"&xp="+data.xp+"&lv="+data.level, function(){ + displayPerso(data.hp,data.xp,data.level); + }); + } }); } |