aboutsummaryrefslogtreecommitdiffstats
path: root/inc/mine.inc
diff options
context:
space:
mode:
authorpiernov <piernov@piernov.org>2016-05-10 22:24:50 +0200
committerpiernov <piernov@piernov.org>2016-05-10 22:24:50 +0200
commit9ad61ab6a23bd6fd51e67b85d743b4a7664ec637 (patch)
tree04c4ef3158c9848db91e56f9318162431a6040b4 /inc/mine.inc
parent204e838a7794bbce0d44fc35efb367abb052d02f (diff)
parent1e52affe15fb13e920f8942de998073238be6d01 (diff)
downloadcandybox-9ad61ab6a23bd6fd51e67b85d743b4a7664ec637.tar.gz
candybox-9ad61ab6a23bd6fd51e67b85d743b4a7664ec637.tar.bz2
candybox-9ad61ab6a23bd6fd51e67b85d743b4a7664ec637.tar.xz
candybox-9ad61ab6a23bd6fd51e67b85d743b4a7664ec637.zip
Merge branch 'phpdoc' into piernov
Diffstat (limited to 'inc/mine.inc')
-rw-r--r--inc/mine.inc22
1 files changed, 22 insertions, 0 deletions
diff --git a/inc/mine.inc b/inc/mine.inc
index 752fc69..d27804a 100644
--- a/inc/mine.inc
+++ b/inc/mine.inc
@@ -1,9 +1,26 @@
<?php
+/**
+ * Manages the mine.
+ *
+ * @packageĀ inc\mine.inc
+ * @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 +28,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"];