aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--inc/Item.inc9
1 files changed, 8 insertions, 1 deletions
diff --git a/inc/Item.inc b/inc/Item.inc
index f01b709..8eebbf8 100644
--- a/inc/Item.inc
+++ b/inc/Item.inc
@@ -32,11 +32,18 @@ class Item {
$item->addChild("cost", $this->cost);
$item->addChild("icon", $this->icon);
$item->addChild("desc", $this->desc);
+ $xmlfeat = $item->addChild("feat");
+ foreach($this->feat as $k => $v)
+ $xmlfeat->addChild($k, $v);
$item->addChild("count", $count);
}
public static function fromXML($xml) {
- return new static((string)$xml->name, +(string)$xml->cost /* convert to number */, (string)$xml->icon, (string)$xml->desc);
+ $feats = array();
+ foreach($xml->feat[0] as $k => $v)
+ $feats[(string)$k] = (string)$v;
+
+ return new static((string)$xml->name, +(string)$xml->cost /* convert to number */, (string)$xml->icon, (string)$xml->desc, $feats);
}
}