aboutsummaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
authoralexichi <alexbankai96@gmail.com>2016-04-23 20:39:13 +0200
committeralexichi <alexbankai96@gmail.com>2016-04-23 20:39:13 +0200
commitd46a4d75594cebef5fc0c25104bde6242be0571e (patch)
treee48048eab794950ddb9158d76166746890ccc720 /inc
parent56145311017bb5ede4b65f531e50d92a1edc1544 (diff)
downloadcandybox-d46a4d75594cebef5fc0c25104bde6242be0571e.tar.gz
candybox-d46a4d75594cebef5fc0c25104bde6242be0571e.tar.bz2
candybox-d46a4d75594cebef5fc0c25104bde6242be0571e.tar.xz
candybox-d46a4d75594cebef5fc0c25104bde6242be0571e.zip
add file for server side
Diffstat (limited to 'inc')
-rw-r--r--inc/guild.inc29
1 files changed, 29 insertions, 0 deletions
diff --git a/inc/guild.inc b/inc/guild.inc
new file mode 100644
index 0000000..5ede1f6
--- /dev/null
+++ b/inc/guild.inc
@@ -0,0 +1,29 @@
+<?php
+
+function createGuild(){
+ if($_SESSION["mine"]["gold"] >= 150){
+ $_SESSION["guild"]= array("miners" => 1);
+ $_SESSION["mine"]["gold"] -= 150;
+ echo "Guild has been successfully created";
+ }
+ else{
+ echo "Not enough money";
+ }
+}
+
+function hireMiner(){
+ if(!isset($_SESSION["guild"])){
+ echo "<p>you need to create a guild first";
+ }
+ if($_SESSION["mine"]["gold"] >= 40){
+ $_SESSION["guild"]["miners"]++;
+ $_SESSION["mine"]["gold"] -= 40;
+ $_SESSION["mine"]["miners"] = $_SESSION["guild"]["miners"];
+ $mine = $_SESSION["mine"];
+ $guild = $_SESSION["guild"];
+ echo $mine["gold"];
+ echo $mine["miners"];
+ }
+}
+
+?>