aboutsummaryrefslogtreecommitdiffstats
path: root/inc/guild.inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc/guild.inc')
-rw-r--r--inc/guild.inc31
1 files changed, 31 insertions, 0 deletions
diff --git a/inc/guild.inc b/inc/guild.inc
new file mode 100644
index 0000000..c0e8264
--- /dev/null
+++ b/inc/guild.inc
@@ -0,0 +1,31 @@
+<?php
+
+define("GUILD_COST",10);
+define("MINER_COST",5);
+
+function createGuild(){
+ if(!empty($_SESSION["guild"])) {
+ sendError("guild_already_built");
+ }
+ elseif(debitAccount(GUILD_COST)) {
+ $_SESSION["guild"] = true;
+ echo json_encode(array("cost" => GUILD_COST));
+ }
+}
+
+function hireMiner(){
+ if(!isset($_SESSION["guild"])){
+ sendError("guild_not_yet_created");
+ }
+ elseif(debitAccount(MINER_COST)){
+ $_SESSION["mine"]["miners"]++;
+ echo json_encode(array("cost" => MINER_COST , "miners" => $_SESSION["mine"]["miners"]));
+ }
+}
+
+function sendMiners(){
+ return $_SESSION["mine"]["miners"];
+}
+
+
+?>