aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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"];
+ }
+}
+
+?>