Element restorationElement = (Element)restorationIterator.next();
int skillId = Integer.parseInt(restorationElement.attributeValue("skill_id"));
int skillLvl = Integer.parseInt(restorationElement.attributeValue("skill_level"));
int consumeItemId = restorationElement.attributeValue("consume_item_id") == null ? -1 : Integer.parseInt(restorationElement.attributeValue("consume_item_id"));
int consumeItemCount = restorationElement.attributeValue("consume_item_count") == null ? 1 : Integer.parseInt(restorationElement.attributeValue("consume_item_count"));
RestorationInfo restorationInfo = new RestorationInfo(skillId, skillLvl, consumeItemId, consumeItemCount);
for (Iterator<?> groupIterator = restorationElement.elementIterator(); groupIterator.hasNext(); )
{
Element groupElement = (Element)groupIterator.next();
double chance = Double.parseDouble(groupElement.attributeValue("chance"));
RestorationGroup restorationGroup = new RestorationGroup(chance);
for (Iterator<?> itemIterator = groupElement.elementIterator(); itemIterator.hasNext(); )
{
Element itemElement = (Element)itemIterator.next();
int id = Integer.parseInt(itemElement.attributeValue("id"));
int minCount = Integer.parseInt(itemElement.attributeValue("min_count"));
int maxCount = itemElement.attributeValue("max_count") == null ? minCount : Integer.parseInt(itemElement.attributeValue("max_count"));
restorationGroup.addRestorationItem(new RestorationItem(id, minCount, maxCount));
}
restorationInfo.addRestorationGroup(restorationGroup);
}
(getHolder()).addRestorationInfo(restorationInfo);
}
}