aboutsummaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc')
-rw-r--r--inc/Inventory.inc5
-rw-r--r--inc/Item.inc8
2 files changed, 13 insertions, 0 deletions
diff --git a/inc/Inventory.inc b/inc/Inventory.inc
index efe54f2..0a93d7f 100644
--- a/inc/Inventory.inc
+++ b/inc/Inventory.inc
@@ -36,6 +36,11 @@ class Inventory {
$inv = self::get();
$inv->_removeItem($item);
}
+
+ public function addToXML($root) {
+ foreach($this->items as $item)
+ $item->addToXML($root);
+ }
}
?>
diff --git a/inc/Item.inc b/inc/Item.inc
index bf77818..bef6d00 100644
--- a/inc/Item.inc
+++ b/inc/Item.inc
@@ -12,6 +12,14 @@ class Item {
$this->icon = $icon;
$this->desc = $desc;
}
+
+ function addToXML($root) {
+ $item = $root->addChild("item");
+ $item->addChild("name", $this->name);
+ $item->addChild("cost", $this->cost);
+ $item->addChild("icon", $this->icon);
+ $item->addChild("desc", $this->desc);
+ }
}
?>