diff options
Diffstat (limited to 'js/guild.js')
-rw-r--r-- | js/guild.js | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/js/guild.js b/js/guild.js index 28f58b8..cb9e783 100644 --- a/js/guild.js +++ b/js/guild.js @@ -1,18 +1,26 @@ function hireMiner(){ - sendRequest("craftmine.php", "op=hireMiner", function() { - //datas.gold -= parseInt(datas.mine); + sendRequest("craftmine.php", "op=hireMiner", function(xhr) { + //data.gold -= 40; var ret = xhr.responseText; - console.log(ret); - //datas.gold = ret; - //updateDatas("gold"); - //updateDatas("miners"); + 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"); + } }) } function createGuild(){ - sendRequest("craftmine.php", "op=createGuild", function() { + sendRequest("craftmine.php", "op=createGuild", function(xhr) { var ret = xhr.responseText; - console.log(ret); + if(ret != "g"){ + document.getElementById("guild").innerHTML = ret; + data.gold -= 50; + updateData("gold"); + } }) } |