aboutsummaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc')
-rw-r--r--inc/shop.inc13
1 files changed, 11 insertions, 2 deletions
diff --git a/inc/shop.inc b/inc/shop.inc
index 32ecea2..69161e1 100644
--- a/inc/shop.inc
+++ b/inc/shop.inc
@@ -4,6 +4,7 @@ require_once("messages.inc");
require_once("account.inc");
require_once("Item.inc");
require_once("Inventory.inc");
+require_once("perso.inc");
function loadShop(){
$items = simplexml_load_file('data/items.xml');
@@ -12,7 +13,15 @@ function loadShop(){
$category = (string)$cat["name"];
$shop["items"][$category] = array();
foreach($cat as $item){
- $shop["items"][$category][] = new Item((string)$item->name,intval($item->cost),(string)$item->icon,(string)$item->description);
+ $feats = array();
+ foreach($item->features[0] as $k => $v)
+ $feats[(string)$k] = (string)$v;
+ $shop["items"][$category][] = new Item(
+ (string)$item->name,
+ intval($item->cost),
+ (string)$item->icon,
+ (string)$item->description,
+ $feats);
}
}
return $shop;
@@ -63,7 +72,7 @@ function buyItem() {
function useItem(){
$item = getItem($_POST["item"]);
$it = Inventory::useItem($item);
- echo json_encode($it);
+ echo json_encode(array("perso" => sendPerso(), "item" => $it));
}