aboutsummaryrefslogtreecommitdiffstats
path: root/js/guild.js
diff options
context:
space:
mode:
authoralexichi <alexbankai96@gmail.com>2016-04-25 13:37:08 +0200
committeralexichi <alexbankai96@gmail.com>2016-04-25 13:37:08 +0200
commit29d23898c7ec5d3280e9a7f01a6209f8c8f2d5f8 (patch)
treecbfaaea85e3739abd0b4c59c1bef4e28ff69a84a /js/guild.js
parent1ffba62faae83e18597270b68580a90ac3032a31 (diff)
downloadcandybox-29d23898c7ec5d3280e9a7f01a6209f8c8f2d5f8.tar.gz
candybox-29d23898c7ec5d3280e9a7f01a6209f8c8f2d5f8.tar.bz2
candybox-29d23898c7ec5d3280e9a7f01a6209f8c8f2d5f8.tar.xz
candybox-29d23898c7ec5d3280e9a7f01a6209f8c8f2d5f8.zip
Mise en commun du shop et de la guilde
Diffstat (limited to 'js/guild.js')
-rw-r--r--js/guild.js27
1 files changed, 9 insertions, 18 deletions
diff --git a/js/guild.js b/js/guild.js
index cb9e783..8d4d91b 100644
--- a/js/guild.js
+++ b/js/guild.js
@@ -1,26 +1,17 @@
function hireMiner(){
- sendRequest("craftmine.php", "op=hireMiner", function(xhr) {
- //data.gold -= 40;
- var ret = xhr.responseText;
- if(ret != "you need to create a guild first" && ret!=""){
- console.log(ret);
- var tmp = ret.split(",");
- console.log(tmp);
- data.gold = parseInt(tmp[0]);
- data.miners = parseInt(tmp[1]);
- updateData("gold","miners");
+ sendRequest("craftmine.php", "op=hireMiner", function(ret) {
+ debitAccount(parseInt(ret.cost));
+ data.miners = parseInt(ret.miners);
+ updateData("miners");
}
- })
+ )
}
function createGuild(){
- sendRequest("craftmine.php", "op=createGuild", function(xhr) {
- var ret = xhr.responseText;
- if(ret != "g"){
- document.getElementById("guild").innerHTML = ret;
- data.gold -= 50;
- updateData("gold");
+ sendRequest("craftmine.php", "op=createGuild", function(ret) {
+ showInfo("Your guild has been successfully created");
+ debitAccount(parseInt(ret.cost));
}
- })
+ )
}