diff options
Diffstat (limited to 'inc/Item.inc')
-rw-r--r-- | inc/Item.inc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/inc/Item.inc b/inc/Item.inc index bf77818..8e90998 100644 --- a/inc/Item.inc +++ b/inc/Item.inc @@ -12,6 +12,18 @@ 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); + } + + public static function fromXML($xml) { + return new static((string)$xml->name, +(string)$xml->cost /* convert to number */, (string)$xml->icon, (string)$xml->desc); + } } ?> |