aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--craftmine.php2
-rw-r--r--inc/craftmine.inc14
-rw-r--r--inc/mine.inc2
3 files changed, 16 insertions, 2 deletions
diff --git a/craftmine.php b/craftmine.php
index c5f09be..869c83a 100644
--- a/craftmine.php
+++ b/craftmine.php
@@ -35,7 +35,7 @@ if (!isset($_POST["op"])) {
$op = $_POST["op"];
switch($op) {
case "withdrawMine": withdrawMine(); break;
- case "getCraftMine": sendMine(); break;
+ case "getCraftMine": sendCraftMine(); break;
case "buildShop": buildShop(); break;
case "buyItem": buyItem(); break;
default: reportBadRequest();
diff --git a/inc/craftmine.inc b/inc/craftmine.inc
new file mode 100644
index 0000000..a30538c
--- /dev/null
+++ b/inc/craftmine.inc
@@ -0,0 +1,14 @@
+<?php
+
+require_once("mine.inc");
+require_once("shop.inc");
+
+function sendCraftMine() {
+ $data = array("gold" => sendMine(),
+ "shop" => sendShop(),
+ "inventory" => Inventory::sendContent(),
+ );
+ echo json_encode($data);
+}
+
+?>
diff --git a/inc/mine.inc b/inc/mine.inc
index 4293243..6a04cc4 100644
--- a/inc/mine.inc
+++ b/inc/mine.inc
@@ -14,7 +14,7 @@ function withdrawMine() {
function sendMine() {
if(empty($_SESSION["mine"])) initCraftMine();
$mine = $_SESSION["mine"];
- echo $mine["gold"];
+ return $mine["gold"];
}