protected void readData(Element rootElement) throws Exception
{
for (Iterator<Element> itemIterator = rootElement.elementIterator(); itemIterator.hasNext();)
{
Element optionDataElement = itemIterator.next();
OptionDataTemplate template = new OptionDataTemplate(Integer.parseInt(optionDataElement.attributeValue("id")));
for (Iterator<Element> subIterator = optionDataElement.elementIterator(); subIterator.hasNext();)
{
Element subElement = subIterator.next();
String subName = subElement.getName();
if (subName.equalsIgnoreCase("for"))
{
parseFor(subElement, template);
}
else if (subName.equalsIgnoreCase("triggers"))
{
parseTriggers(subElement, template);
}
else if (subName.equalsIgnoreCase("skills"))
{
for (Iterator<Element> nextIterator = subElement.elementIterator(); nextIterator.hasNext();)
{
Element nextElement = nextIterator.next();
int id = Integer.parseInt(nextElement.attributeValue("id"));
int level = Integer.parseInt(nextElement.attributeValue("level"));
Skill skill = SkillTable.getInstance().getInfo(id, level);
if (skill != null)
{
template.addSkill(skill);
}
else
{
info("Skill not found(" + id + "," + level + ") for option data:" + template.getId() + "; file:" + getCurrentFileName());
}
}
}
}
getHolder().addTemplate(template);