aboutsummaryrefslogtreecommitdiffstats
path: root/inc/guild.inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc/guild.inc')
-rw-r--r--inc/guild.inc30
1 files changed, 30 insertions, 0 deletions
diff --git a/inc/guild.inc b/inc/guild.inc
index 1666b15..537b87a 100644
--- a/inc/guild.inc
+++ b/inc/guild.inc
@@ -1,6 +1,19 @@
<?php
+/**
+ * Manages miners guild.
+ *
+ * @package inc\guild.inc
+ * @author Alexandre Renoux
+ * @author Pierre-Emmanuel Novac
+ */
+/**
+ * Amount of gold required to build the miners guild.
+ */
define("GUILD_COST",10);
+/**
+ * Amount of gold required to hire a miner.
+ */
define("MINER_COST",5);
function initMinersIfNeeded() {
@@ -10,6 +23,12 @@ function initMinersIfNeeded() {
$_SESSION["mine"]["miners"] = 0;
}
+/**
+ * Create the miners guild in the session.
+ * Debits GUILD_COST from the player's gold.
+ *
+ * @return void
+ */
function createGuild(){
if(!empty($_SESSION["guild"])) {
sendError("guild_already_built");
@@ -20,6 +39,12 @@ function createGuild(){
}
}
+/**
+ * Hire one miner.
+ * Debits MINER_COST from the player's gold.
+ *
+ * @return void
+ */
function hireMiner(){
if(!isset($_SESSION["guild"])){
sendError("guild_not_yet_created");
@@ -31,6 +56,11 @@ function hireMiner(){
}
}
+/**
+ * Returns the number of miners currently in the guild.
+ *
+ * @return int number of miners in the guild
+ */
function sendMiners(){
initMinersIfNeeded();
return $_SESSION["mine"]["miners"];