aboutsummaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc')
-rw-r--r--inc/guild.inc29
-rw-r--r--inc/mine.inc2
2 files changed, 30 insertions, 1 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"];
+ }
+}
+
+?>
diff --git a/inc/mine.inc b/inc/mine.inc
index aea04ad..a2ecd09 100644
--- a/inc/mine.inc
+++ b/inc/mine.inc
@@ -1,7 +1,7 @@
<?php
function initCraftMine() {
- $_SESSION["mine"] = array("mine" => 0, "gold" => 0, "miners" => 1);
+ $_SESSION["mine"] = array("mine" => 0, "gold" => 0, "miners" => 0);
}
function withdrawMine() {