aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiernov <piernov@piernov.org>2016-04-24 22:23:04 +0200
committerpiernov <piernov@piernov.org>2016-04-24 22:23:04 +0200
commit7f345404a79e6e0f25bafa6f25c8ba1edf6aef73 (patch)
treee98e36b0382ce443e0cf5fae1e81240ffa4afd99
parentbd688fc969dfdda43e180db17095733d6f63da56 (diff)
downloadcandybox-7f345404a79e6e0f25bafa6f25c8ba1edf6aef73.tar.gz
candybox-7f345404a79e6e0f25bafa6f25c8ba1edf6aef73.tar.bz2
candybox-7f345404a79e6e0f25bafa6f25c8ba1edf6aef73.tar.xz
candybox-7f345404a79e6e0f25bafa6f25c8ba1edf6aef73.zip
Add JS debitAccount() helper
-rw-r--r--js/craftmine.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/js/craftmine.js b/js/craftmine.js
index bbb1074..46c726a 100644
--- a/js/craftmine.js
+++ b/js/craftmine.js
@@ -24,6 +24,11 @@ function updateData() {
}
}
+function debitAccount(amount) {
+ data.gold -= amount;
+ updateData("gold");
+}
+
function withdrawMine() {
sendRequest("craftmine.php", "op=withdrawMine&amount="+data.mine, function(xhr) {
var gold = parseInt(xhr.responseText); // Server's response is a string