diff options
Diffstat (limited to 'inc/mine.inc')
-rw-r--r-- | inc/mine.inc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/inc/mine.inc b/inc/mine.inc index 752fc69..38dc717 100644 --- a/inc/mine.inc +++ b/inc/mine.inc @@ -1,9 +1,25 @@ <?php +/** + * Manages the mine. + * + * @author Alexandre Renoux + * @author Pierre-Emmanuel Novac + */ +/** + * Initializes the gold amount and miners count in the session. + * + * @return void + */ function initCraftMine() { $_SESSION["mine"] = array("gold" => 0, "miners" => 0); } +/** + * Transfers all gold from the mine to the player's account. + * + * @return void + */ function withdrawMine() { $amount = intval($_POST["amount"]); if($amount == 0) return; @@ -11,6 +27,11 @@ function withdrawMine() { echo json_encode($_SESSION["mine"]["gold"]); } +/** + * Returns the amount of gold currently owned by the player. + * + * @return int amount of gold available + */ function sendMine() { if(empty($_SESSION["mine"])) initCraftMine(); $mine = $_SESSION["mine"]; |