Minor NpcData adjustments.

This commit is contained in:
MobiusDev 2018-12-21 04:11:48 +00:00
parent 503ffe3d3e
commit 251c83368f
11 changed files with 458 additions and 461 deletions

View File

@ -88,11 +88,11 @@ public class NpcData implements IGameXmlReader
{ {
if ("list".equalsIgnoreCase(node.getNodeName())) if ("list".equalsIgnoreCase(node.getNodeName()))
{ {
for (Node list_node = node.getFirstChild(); list_node != null; list_node = list_node.getNextSibling()) for (Node listNode = node.getFirstChild(); listNode != null; listNode = listNode.getNextSibling())
{ {
if ("npc".equalsIgnoreCase(list_node.getNodeName())) if ("npc".equalsIgnoreCase(listNode.getNodeName()))
{ {
NamedNodeMap attrs = list_node.getAttributes(); NamedNodeMap attrs = listNode.getAttributes();
final StatsSet set = new StatsSet(new HashMap<>()); final StatsSet set = new StatsSet(new HashMap<>());
final int npcId = parseInteger(attrs, "id"); final int npcId = parseInteger(attrs, "id");
Map<String, Object> parameters = null; Map<String, Object> parameters = null;
@ -108,10 +108,10 @@ public class NpcData implements IGameXmlReader
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName")); set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title")); set.set("title", parseString(attrs, "title"));
set.set("usingServerSideTitle", parseBoolean(attrs, "usingServerSideTitle")); set.set("usingServerSideTitle", parseBoolean(attrs, "usingServerSideTitle"));
for (Node npc_node = list_node.getFirstChild(); npc_node != null; npc_node = npc_node.getNextSibling()) for (Node npcNode = listNode.getFirstChild(); npcNode != null; npcNode = npcNode.getNextSibling())
{ {
attrs = npc_node.getAttributes(); attrs = npcNode.getAttributes();
switch (npc_node.getNodeName().toLowerCase()) switch (npcNode.getNodeName().toLowerCase())
{ {
case "parameters": case "parameters":
{ {
@ -119,13 +119,13 @@ public class NpcData implements IGameXmlReader
{ {
parameters = new HashMap<>(); parameters = new HashMap<>();
} }
parameters.putAll(parseParameters(npc_node)); parameters.putAll(parseParameters(npcNode));
break; break;
} }
case "race": case "race":
case "sex": case "sex":
{ {
set.set(npc_node.getNodeName(), npc_node.getTextContent().toUpperCase()); set.set(npcNode.getNodeName(), npcNode.getTextContent().toUpperCase());
break; break;
} }
case "equipment": case "equipment":
@ -159,10 +159,10 @@ public class NpcData implements IGameXmlReader
set.set("baseWIT", parseInteger(attrs, "wit")); set.set("baseWIT", parseInteger(attrs, "wit"));
set.set("baseCON", parseInteger(attrs, "con")); set.set("baseCON", parseInteger(attrs, "con"));
set.set("baseMEN", parseInteger(attrs, "men")); set.set("baseMEN", parseInteger(attrs, "men"));
for (Node stats_node = npc_node.getFirstChild(); stats_node != null; stats_node = stats_node.getNextSibling()) for (Node statsNode = npcNode.getFirstChild(); statsNode != null; statsNode = statsNode.getNextSibling())
{ {
attrs = stats_node.getAttributes(); attrs = statsNode.getAttributes();
switch (stats_node.getNodeName().toLowerCase()) switch (statsNode.getNodeName().toLowerCase())
{ {
case "vitals": case "vitals":
{ {
@ -204,7 +204,7 @@ public class NpcData implements IGameXmlReader
} }
case "attribute": case "attribute":
{ {
for (Node attribute_node = stats_node.getFirstChild(); attribute_node != null; attribute_node = attribute_node.getNextSibling()) for (Node attribute_node = statsNode.getFirstChild(); attribute_node != null; attribute_node = attribute_node.getNextSibling())
{ {
attrs = attribute_node.getAttributes(); attrs = attribute_node.getAttributes();
switch (attribute_node.getNodeName().toLowerCase()) switch (attribute_node.getNodeName().toLowerCase())
@ -264,10 +264,10 @@ public class NpcData implements IGameXmlReader
} }
case "speed": case "speed":
{ {
for (Node speed_node = stats_node.getFirstChild(); speed_node != null; speed_node = speed_node.getNextSibling()) for (Node speedNode = statsNode.getFirstChild(); speedNode != null; speedNode = speedNode.getNextSibling())
{ {
attrs = speed_node.getAttributes(); attrs = speedNode.getAttributes();
switch (speed_node.getNodeName().toLowerCase()) switch (speedNode.getNodeName().toLowerCase())
{ {
case "walk": case "walk":
{ {
@ -287,9 +287,9 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "hitTime": case "hittime":
{ {
set.set("hitTime", npc_node.getTextContent()); // TODO: Implement me default 600 (value in ms) set.set("hitTime", npcNode.getTextContent()); // TODO: Implement me default 600 (value in ms)
break; break;
} }
} }
@ -317,14 +317,14 @@ public class NpcData implements IGameXmlReader
set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable")); set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable"));
break; break;
} }
case "skillList": case "skilllist":
{ {
skills = new HashMap<>(); skills = new HashMap<>();
for (Node skill_list_node = npc_node.getFirstChild(); skill_list_node != null; skill_list_node = skill_list_node.getNextSibling()) for (Node skillListNode = npcNode.getFirstChild(); skillListNode != null; skillListNode = skillListNode.getNextSibling())
{ {
if ("skill".equalsIgnoreCase(skill_list_node.getNodeName())) if ("skill".equalsIgnoreCase(skillListNode.getNodeName()))
{ {
attrs = skill_list_node.getAttributes(); attrs = skillListNode.getAttributes();
final int skillId = parseInteger(attrs, "id"); final int skillId = parseInteger(attrs, "id");
final int skillLevel = parseInteger(attrs, "level"); final int skillLevel = parseInteger(attrs, "level");
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
@ -348,19 +348,19 @@ public class NpcData implements IGameXmlReader
set.set("spiritShotChance", parseInteger(attrs, "spiritChance")); set.set("spiritShotChance", parseInteger(attrs, "spiritChance"));
break; break;
} }
case "corpseTime": case "corpsetime":
{ {
set.set("corpseTime", npc_node.getTextContent()); set.set("corpseTime", npcNode.getTextContent());
break; break;
} }
case "exCrtEffect": case "excrteffect":
{ {
set.set("exCrtEffect", npc_node.getTextContent()); // TODO: Implement me default ? type boolean set.set("exCrtEffect", npcNode.getTextContent()); // TODO: Implement me default ? type boolean
break; break;
} }
case "sNpcPropHpRate": case "snpcprophprate":
{ {
set.set("sNpcPropHpRate", npc_node.getTextContent()); // TODO: Implement me default 1 type double set.set("sNpcPropHpRate", npcNode.getTextContent()); // TODO: Implement me default 1 type double
break; break;
} }
case "ai": case "ai":
@ -371,10 +371,10 @@ public class NpcData implements IGameXmlReader
set.set("dodge", parseInteger(attrs, "dodge")); set.set("dodge", parseInteger(attrs, "dodge"));
set.set("isChaos", parseBoolean(attrs, "isChaos")); set.set("isChaos", parseBoolean(attrs, "isChaos"));
set.set("isAggressive", parseBoolean(attrs, "isAggressive")); set.set("isAggressive", parseBoolean(attrs, "isAggressive"));
for (Node ai_node = npc_node.getFirstChild(); ai_node != null; ai_node = ai_node.getNextSibling()) for (Node aiNode = npcNode.getFirstChild(); aiNode != null; aiNode = aiNode.getNextSibling())
{ {
attrs = ai_node.getAttributes(); attrs = aiNode.getAttributes();
switch (ai_node.getNodeName().toLowerCase()) switch (aiNode.getNodeName().toLowerCase())
{ {
case "skill": case "skill":
{ {
@ -387,12 +387,12 @@ public class NpcData implements IGameXmlReader
set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance")); set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance"));
break; break;
} }
case "clanList": case "clanlist":
{ {
for (Node clan_list_node = ai_node.getFirstChild(); clan_list_node != null; clan_list_node = clan_list_node.getNextSibling()) for (Node clanListNode = aiNode.getFirstChild(); clanListNode != null; clanListNode = clanListNode.getNextSibling())
{ {
attrs = clan_list_node.getAttributes(); attrs = clanListNode.getAttributes();
switch (clan_list_node.getNodeName().toLowerCase()) switch (clanListNode.getNodeName().toLowerCase())
{ {
case "clan": case "clan":
{ {
@ -400,16 +400,16 @@ public class NpcData implements IGameXmlReader
{ {
clans = new HashSet<>(1); clans = new HashSet<>(1);
} }
clans.add(getOrCreateClanId(clan_list_node.getTextContent())); clans.add(getOrCreateClanId(clanListNode.getTextContent()));
break; break;
} }
case "ignoreNpcId": case "ignorenpcid":
{ {
if (ignoreClanNpcIds == null) if (ignoreClanNpcIds == null)
{ {
ignoreClanNpcIds = new HashSet<>(1); ignoreClanNpcIds = new HashSet<>(1);
} }
ignoreClanNpcIds.add(Integer.parseInt(clan_list_node.getTextContent())); ignoreClanNpcIds.add(Integer.parseInt(clanListNode.getTextContent()));
break; break;
} }
} }
@ -420,9 +420,9 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "dropLists": case "droplists":
{ {
for (Node drop_lists_node = npc_node.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling()) for (Node drop_lists_node = npcNode.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling())
{ {
DropType dropType = null; DropType dropType = null;
@ -461,10 +461,10 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "extendDrop": case "extenddrop":
{ {
final List<Integer> extendDrop = new ArrayList<>(); final List<Integer> extendDrop = new ArrayList<>();
forEach(npc_node, "id", idNode -> forEach(npcNode, "id", idNode ->
{ {
extendDrop.add(Integer.parseInt(idNode.getTextContent())); extendDrop.add(Integer.parseInt(idNode.getTextContent()));
}); });
@ -473,10 +473,10 @@ public class NpcData implements IGameXmlReader
} }
case "collision": case "collision":
{ {
for (Node collision_node = npc_node.getFirstChild(); collision_node != null; collision_node = collision_node.getNextSibling()) for (Node collisionNode = npcNode.getFirstChild(); collisionNode != null; collisionNode = collisionNode.getNextSibling())
{ {
attrs = collision_node.getAttributes(); attrs = collisionNode.getAttributes();
switch (collision_node.getNodeName().toLowerCase()) switch (collisionNode.getNodeName().toLowerCase())
{ {
case "radius": case "radius":
{ {

View File

@ -88,11 +88,11 @@ public class NpcData implements IGameXmlReader
{ {
if ("list".equalsIgnoreCase(node.getNodeName())) if ("list".equalsIgnoreCase(node.getNodeName()))
{ {
for (Node list_node = node.getFirstChild(); list_node != null; list_node = list_node.getNextSibling()) for (Node listNode = node.getFirstChild(); listNode != null; listNode = listNode.getNextSibling())
{ {
if ("npc".equalsIgnoreCase(list_node.getNodeName())) if ("npc".equalsIgnoreCase(listNode.getNodeName()))
{ {
NamedNodeMap attrs = list_node.getAttributes(); NamedNodeMap attrs = listNode.getAttributes();
final StatsSet set = new StatsSet(new HashMap<>()); final StatsSet set = new StatsSet(new HashMap<>());
final int npcId = parseInteger(attrs, "id"); final int npcId = parseInteger(attrs, "id");
Map<String, Object> parameters = null; Map<String, Object> parameters = null;
@ -108,10 +108,10 @@ public class NpcData implements IGameXmlReader
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName")); set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title")); set.set("title", parseString(attrs, "title"));
set.set("usingServerSideTitle", parseBoolean(attrs, "usingServerSideTitle")); set.set("usingServerSideTitle", parseBoolean(attrs, "usingServerSideTitle"));
for (Node npc_node = list_node.getFirstChild(); npc_node != null; npc_node = npc_node.getNextSibling()) for (Node npcNode = listNode.getFirstChild(); npcNode != null; npcNode = npcNode.getNextSibling())
{ {
attrs = npc_node.getAttributes(); attrs = npcNode.getAttributes();
switch (npc_node.getNodeName().toLowerCase()) switch (npcNode.getNodeName().toLowerCase())
{ {
case "parameters": case "parameters":
{ {
@ -119,13 +119,13 @@ public class NpcData implements IGameXmlReader
{ {
parameters = new HashMap<>(); parameters = new HashMap<>();
} }
parameters.putAll(parseParameters(npc_node)); parameters.putAll(parseParameters(npcNode));
break; break;
} }
case "race": case "race":
case "sex": case "sex":
{ {
set.set(npc_node.getNodeName(), npc_node.getTextContent().toUpperCase()); set.set(npcNode.getNodeName(), npcNode.getTextContent().toUpperCase());
break; break;
} }
case "equipment": case "equipment":
@ -159,10 +159,10 @@ public class NpcData implements IGameXmlReader
set.set("baseWIT", parseInteger(attrs, "wit")); set.set("baseWIT", parseInteger(attrs, "wit"));
set.set("baseCON", parseInteger(attrs, "con")); set.set("baseCON", parseInteger(attrs, "con"));
set.set("baseMEN", parseInteger(attrs, "men")); set.set("baseMEN", parseInteger(attrs, "men"));
for (Node stats_node = npc_node.getFirstChild(); stats_node != null; stats_node = stats_node.getNextSibling()) for (Node statsNode = npcNode.getFirstChild(); statsNode != null; statsNode = statsNode.getNextSibling())
{ {
attrs = stats_node.getAttributes(); attrs = statsNode.getAttributes();
switch (stats_node.getNodeName().toLowerCase()) switch (statsNode.getNodeName().toLowerCase())
{ {
case "vitals": case "vitals":
{ {
@ -204,7 +204,7 @@ public class NpcData implements IGameXmlReader
} }
case "attribute": case "attribute":
{ {
for (Node attribute_node = stats_node.getFirstChild(); attribute_node != null; attribute_node = attribute_node.getNextSibling()) for (Node attribute_node = statsNode.getFirstChild(); attribute_node != null; attribute_node = attribute_node.getNextSibling())
{ {
attrs = attribute_node.getAttributes(); attrs = attribute_node.getAttributes();
switch (attribute_node.getNodeName().toLowerCase()) switch (attribute_node.getNodeName().toLowerCase())
@ -264,10 +264,10 @@ public class NpcData implements IGameXmlReader
} }
case "speed": case "speed":
{ {
for (Node speed_node = stats_node.getFirstChild(); speed_node != null; speed_node = speed_node.getNextSibling()) for (Node speedNode = statsNode.getFirstChild(); speedNode != null; speedNode = speedNode.getNextSibling())
{ {
attrs = speed_node.getAttributes(); attrs = speedNode.getAttributes();
switch (speed_node.getNodeName().toLowerCase()) switch (speedNode.getNodeName().toLowerCase())
{ {
case "walk": case "walk":
{ {
@ -287,9 +287,9 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "hitTime": case "hittime":
{ {
set.set("hitTime", npc_node.getTextContent()); // TODO: Implement me default 600 (value in ms) set.set("hitTime", npcNode.getTextContent()); // TODO: Implement me default 600 (value in ms)
break; break;
} }
} }
@ -317,14 +317,14 @@ public class NpcData implements IGameXmlReader
set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable")); set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable"));
break; break;
} }
case "skillList": case "skilllist":
{ {
skills = new HashMap<>(); skills = new HashMap<>();
for (Node skill_list_node = npc_node.getFirstChild(); skill_list_node != null; skill_list_node = skill_list_node.getNextSibling()) for (Node skillListNode = npcNode.getFirstChild(); skillListNode != null; skillListNode = skillListNode.getNextSibling())
{ {
if ("skill".equalsIgnoreCase(skill_list_node.getNodeName())) if ("skill".equalsIgnoreCase(skillListNode.getNodeName()))
{ {
attrs = skill_list_node.getAttributes(); attrs = skillListNode.getAttributes();
final int skillId = parseInteger(attrs, "id"); final int skillId = parseInteger(attrs, "id");
final int skillLevel = parseInteger(attrs, "level"); final int skillLevel = parseInteger(attrs, "level");
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
@ -348,19 +348,19 @@ public class NpcData implements IGameXmlReader
set.set("spiritShotChance", parseInteger(attrs, "spiritChance")); set.set("spiritShotChance", parseInteger(attrs, "spiritChance"));
break; break;
} }
case "corpseTime": case "corpsetime":
{ {
set.set("corpseTime", npc_node.getTextContent()); set.set("corpseTime", npcNode.getTextContent());
break; break;
} }
case "exCrtEffect": case "excrteffect":
{ {
set.set("exCrtEffect", npc_node.getTextContent()); // TODO: Implement me default ? type boolean set.set("exCrtEffect", npcNode.getTextContent()); // TODO: Implement me default ? type boolean
break; break;
} }
case "sNpcPropHpRate": case "snpcprophprate":
{ {
set.set("sNpcPropHpRate", npc_node.getTextContent()); // TODO: Implement me default 1 type double set.set("sNpcPropHpRate", npcNode.getTextContent()); // TODO: Implement me default 1 type double
break; break;
} }
case "ai": case "ai":
@ -371,10 +371,10 @@ public class NpcData implements IGameXmlReader
set.set("dodge", parseInteger(attrs, "dodge")); set.set("dodge", parseInteger(attrs, "dodge"));
set.set("isChaos", parseBoolean(attrs, "isChaos")); set.set("isChaos", parseBoolean(attrs, "isChaos"));
set.set("isAggressive", parseBoolean(attrs, "isAggressive")); set.set("isAggressive", parseBoolean(attrs, "isAggressive"));
for (Node ai_node = npc_node.getFirstChild(); ai_node != null; ai_node = ai_node.getNextSibling()) for (Node aiNode = npcNode.getFirstChild(); aiNode != null; aiNode = aiNode.getNextSibling())
{ {
attrs = ai_node.getAttributes(); attrs = aiNode.getAttributes();
switch (ai_node.getNodeName().toLowerCase()) switch (aiNode.getNodeName().toLowerCase())
{ {
case "skill": case "skill":
{ {
@ -387,12 +387,12 @@ public class NpcData implements IGameXmlReader
set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance")); set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance"));
break; break;
} }
case "clanList": case "clanlist":
{ {
for (Node clan_list_node = ai_node.getFirstChild(); clan_list_node != null; clan_list_node = clan_list_node.getNextSibling()) for (Node clanListNode = aiNode.getFirstChild(); clanListNode != null; clanListNode = clanListNode.getNextSibling())
{ {
attrs = clan_list_node.getAttributes(); attrs = clanListNode.getAttributes();
switch (clan_list_node.getNodeName().toLowerCase()) switch (clanListNode.getNodeName().toLowerCase())
{ {
case "clan": case "clan":
{ {
@ -400,16 +400,16 @@ public class NpcData implements IGameXmlReader
{ {
clans = new HashSet<>(1); clans = new HashSet<>(1);
} }
clans.add(getOrCreateClanId(clan_list_node.getTextContent())); clans.add(getOrCreateClanId(clanListNode.getTextContent()));
break; break;
} }
case "ignoreNpcId": case "ignorenpcid":
{ {
if (ignoreClanNpcIds == null) if (ignoreClanNpcIds == null)
{ {
ignoreClanNpcIds = new HashSet<>(1); ignoreClanNpcIds = new HashSet<>(1);
} }
ignoreClanNpcIds.add(Integer.parseInt(clan_list_node.getTextContent())); ignoreClanNpcIds.add(Integer.parseInt(clanListNode.getTextContent()));
break; break;
} }
} }
@ -420,9 +420,9 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "dropLists": case "droplists":
{ {
for (Node drop_lists_node = npc_node.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling()) for (Node drop_lists_node = npcNode.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling())
{ {
DropType dropType = null; DropType dropType = null;
@ -461,10 +461,10 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "extendDrop": case "extenddrop":
{ {
final List<Integer> extendDrop = new ArrayList<>(); final List<Integer> extendDrop = new ArrayList<>();
forEach(npc_node, "id", idNode -> forEach(npcNode, "id", idNode ->
{ {
extendDrop.add(Integer.parseInt(idNode.getTextContent())); extendDrop.add(Integer.parseInt(idNode.getTextContent()));
}); });
@ -473,10 +473,10 @@ public class NpcData implements IGameXmlReader
} }
case "collision": case "collision":
{ {
for (Node collision_node = npc_node.getFirstChild(); collision_node != null; collision_node = collision_node.getNextSibling()) for (Node collisionNode = npcNode.getFirstChild(); collisionNode != null; collisionNode = collisionNode.getNextSibling())
{ {
attrs = collision_node.getAttributes(); attrs = collisionNode.getAttributes();
switch (collision_node.getNodeName().toLowerCase()) switch (collisionNode.getNodeName().toLowerCase())
{ {
case "radius": case "radius":
{ {

View File

@ -88,11 +88,11 @@ public class NpcData implements IGameXmlReader
{ {
if ("list".equalsIgnoreCase(node.getNodeName())) if ("list".equalsIgnoreCase(node.getNodeName()))
{ {
for (Node list_node = node.getFirstChild(); list_node != null; list_node = list_node.getNextSibling()) for (Node listNode = node.getFirstChild(); listNode != null; listNode = listNode.getNextSibling())
{ {
if ("npc".equalsIgnoreCase(list_node.getNodeName())) if ("npc".equalsIgnoreCase(listNode.getNodeName()))
{ {
NamedNodeMap attrs = list_node.getAttributes(); NamedNodeMap attrs = listNode.getAttributes();
final StatsSet set = new StatsSet(new HashMap<>()); final StatsSet set = new StatsSet(new HashMap<>());
final int npcId = parseInteger(attrs, "id"); final int npcId = parseInteger(attrs, "id");
Map<String, Object> parameters = null; Map<String, Object> parameters = null;
@ -108,10 +108,10 @@ public class NpcData implements IGameXmlReader
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName")); set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title")); set.set("title", parseString(attrs, "title"));
set.set("usingServerSideTitle", parseBoolean(attrs, "usingServerSideTitle")); set.set("usingServerSideTitle", parseBoolean(attrs, "usingServerSideTitle"));
for (Node npc_node = list_node.getFirstChild(); npc_node != null; npc_node = npc_node.getNextSibling()) for (Node npcNode = listNode.getFirstChild(); npcNode != null; npcNode = npcNode.getNextSibling())
{ {
attrs = npc_node.getAttributes(); attrs = npcNode.getAttributes();
switch (npc_node.getNodeName().toLowerCase()) switch (npcNode.getNodeName().toLowerCase())
{ {
case "parameters": case "parameters":
{ {
@ -119,13 +119,13 @@ public class NpcData implements IGameXmlReader
{ {
parameters = new HashMap<>(); parameters = new HashMap<>();
} }
parameters.putAll(parseParameters(npc_node)); parameters.putAll(parseParameters(npcNode));
break; break;
} }
case "race": case "race":
case "sex": case "sex":
{ {
set.set(npc_node.getNodeName(), npc_node.getTextContent().toUpperCase()); set.set(npcNode.getNodeName(), npcNode.getTextContent().toUpperCase());
break; break;
} }
case "equipment": case "equipment":
@ -159,10 +159,10 @@ public class NpcData implements IGameXmlReader
set.set("baseWIT", parseInteger(attrs, "wit")); set.set("baseWIT", parseInteger(attrs, "wit"));
set.set("baseCON", parseInteger(attrs, "con")); set.set("baseCON", parseInteger(attrs, "con"));
set.set("baseMEN", parseInteger(attrs, "men")); set.set("baseMEN", parseInteger(attrs, "men"));
for (Node stats_node = npc_node.getFirstChild(); stats_node != null; stats_node = stats_node.getNextSibling()) for (Node statsNode = npcNode.getFirstChild(); statsNode != null; statsNode = statsNode.getNextSibling())
{ {
attrs = stats_node.getAttributes(); attrs = statsNode.getAttributes();
switch (stats_node.getNodeName().toLowerCase()) switch (statsNode.getNodeName().toLowerCase())
{ {
case "vitals": case "vitals":
{ {
@ -204,7 +204,7 @@ public class NpcData implements IGameXmlReader
} }
case "attribute": case "attribute":
{ {
for (Node attribute_node = stats_node.getFirstChild(); attribute_node != null; attribute_node = attribute_node.getNextSibling()) for (Node attribute_node = statsNode.getFirstChild(); attribute_node != null; attribute_node = attribute_node.getNextSibling())
{ {
attrs = attribute_node.getAttributes(); attrs = attribute_node.getAttributes();
switch (attribute_node.getNodeName().toLowerCase()) switch (attribute_node.getNodeName().toLowerCase())
@ -264,10 +264,10 @@ public class NpcData implements IGameXmlReader
} }
case "speed": case "speed":
{ {
for (Node speed_node = stats_node.getFirstChild(); speed_node != null; speed_node = speed_node.getNextSibling()) for (Node speedNode = statsNode.getFirstChild(); speedNode != null; speedNode = speedNode.getNextSibling())
{ {
attrs = speed_node.getAttributes(); attrs = speedNode.getAttributes();
switch (speed_node.getNodeName().toLowerCase()) switch (speedNode.getNodeName().toLowerCase())
{ {
case "walk": case "walk":
{ {
@ -287,9 +287,9 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "hitTime": case "hittime":
{ {
set.set("hitTime", npc_node.getTextContent()); // TODO: Implement me default 600 (value in ms) set.set("hitTime", npcNode.getTextContent()); // TODO: Implement me default 600 (value in ms)
break; break;
} }
} }
@ -317,14 +317,14 @@ public class NpcData implements IGameXmlReader
set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable")); set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable"));
break; break;
} }
case "skillList": case "skilllist":
{ {
skills = new HashMap<>(); skills = new HashMap<>();
for (Node skill_list_node = npc_node.getFirstChild(); skill_list_node != null; skill_list_node = skill_list_node.getNextSibling()) for (Node skillListNode = npcNode.getFirstChild(); skillListNode != null; skillListNode = skillListNode.getNextSibling())
{ {
if ("skill".equalsIgnoreCase(skill_list_node.getNodeName())) if ("skill".equalsIgnoreCase(skillListNode.getNodeName()))
{ {
attrs = skill_list_node.getAttributes(); attrs = skillListNode.getAttributes();
final int skillId = parseInteger(attrs, "id"); final int skillId = parseInteger(attrs, "id");
final int skillLevel = parseInteger(attrs, "level"); final int skillLevel = parseInteger(attrs, "level");
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
@ -348,19 +348,19 @@ public class NpcData implements IGameXmlReader
set.set("spiritShotChance", parseInteger(attrs, "spiritChance")); set.set("spiritShotChance", parseInteger(attrs, "spiritChance"));
break; break;
} }
case "corpseTime": case "corpsetime":
{ {
set.set("corpseTime", npc_node.getTextContent()); set.set("corpseTime", npcNode.getTextContent());
break; break;
} }
case "exCrtEffect": case "excrteffect":
{ {
set.set("exCrtEffect", npc_node.getTextContent()); // TODO: Implement me default ? type boolean set.set("exCrtEffect", npcNode.getTextContent()); // TODO: Implement me default ? type boolean
break; break;
} }
case "sNpcPropHpRate": case "snpcprophprate":
{ {
set.set("sNpcPropHpRate", npc_node.getTextContent()); // TODO: Implement me default 1 type double set.set("sNpcPropHpRate", npcNode.getTextContent()); // TODO: Implement me default 1 type double
break; break;
} }
case "ai": case "ai":
@ -371,10 +371,10 @@ public class NpcData implements IGameXmlReader
set.set("dodge", parseInteger(attrs, "dodge")); set.set("dodge", parseInteger(attrs, "dodge"));
set.set("isChaos", parseBoolean(attrs, "isChaos")); set.set("isChaos", parseBoolean(attrs, "isChaos"));
set.set("isAggressive", parseBoolean(attrs, "isAggressive")); set.set("isAggressive", parseBoolean(attrs, "isAggressive"));
for (Node ai_node = npc_node.getFirstChild(); ai_node != null; ai_node = ai_node.getNextSibling()) for (Node aiNode = npcNode.getFirstChild(); aiNode != null; aiNode = aiNode.getNextSibling())
{ {
attrs = ai_node.getAttributes(); attrs = aiNode.getAttributes();
switch (ai_node.getNodeName().toLowerCase()) switch (aiNode.getNodeName().toLowerCase())
{ {
case "skill": case "skill":
{ {
@ -387,12 +387,12 @@ public class NpcData implements IGameXmlReader
set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance")); set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance"));
break; break;
} }
case "clanList": case "clanlist":
{ {
for (Node clan_list_node = ai_node.getFirstChild(); clan_list_node != null; clan_list_node = clan_list_node.getNextSibling()) for (Node clanListNode = aiNode.getFirstChild(); clanListNode != null; clanListNode = clanListNode.getNextSibling())
{ {
attrs = clan_list_node.getAttributes(); attrs = clanListNode.getAttributes();
switch (clan_list_node.getNodeName().toLowerCase()) switch (clanListNode.getNodeName().toLowerCase())
{ {
case "clan": case "clan":
{ {
@ -400,16 +400,16 @@ public class NpcData implements IGameXmlReader
{ {
clans = new HashSet<>(1); clans = new HashSet<>(1);
} }
clans.add(getOrCreateClanId(clan_list_node.getTextContent())); clans.add(getOrCreateClanId(clanListNode.getTextContent()));
break; break;
} }
case "ignoreNpcId": case "ignorenpcid":
{ {
if (ignoreClanNpcIds == null) if (ignoreClanNpcIds == null)
{ {
ignoreClanNpcIds = new HashSet<>(1); ignoreClanNpcIds = new HashSet<>(1);
} }
ignoreClanNpcIds.add(Integer.parseInt(clan_list_node.getTextContent())); ignoreClanNpcIds.add(Integer.parseInt(clanListNode.getTextContent()));
break; break;
} }
} }
@ -420,9 +420,9 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "dropLists": case "droplists":
{ {
for (Node drop_lists_node = npc_node.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling()) for (Node drop_lists_node = npcNode.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling())
{ {
DropType dropType = null; DropType dropType = null;
@ -461,10 +461,10 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "extendDrop": case "extenddrop":
{ {
final List<Integer> extendDrop = new ArrayList<>(); final List<Integer> extendDrop = new ArrayList<>();
forEach(npc_node, "id", idNode -> forEach(npcNode, "id", idNode ->
{ {
extendDrop.add(Integer.parseInt(idNode.getTextContent())); extendDrop.add(Integer.parseInt(idNode.getTextContent()));
}); });
@ -473,10 +473,10 @@ public class NpcData implements IGameXmlReader
} }
case "collision": case "collision":
{ {
for (Node collision_node = npc_node.getFirstChild(); collision_node != null; collision_node = collision_node.getNextSibling()) for (Node collisionNode = npcNode.getFirstChild(); collisionNode != null; collisionNode = collisionNode.getNextSibling())
{ {
attrs = collision_node.getAttributes(); attrs = collisionNode.getAttributes();
switch (collision_node.getNodeName().toLowerCase()) switch (collisionNode.getNodeName().toLowerCase())
{ {
case "radius": case "radius":
{ {

View File

@ -88,11 +88,11 @@ public class NpcData implements IGameXmlReader
{ {
if ("list".equalsIgnoreCase(node.getNodeName())) if ("list".equalsIgnoreCase(node.getNodeName()))
{ {
for (Node list_node = node.getFirstChild(); list_node != null; list_node = list_node.getNextSibling()) for (Node listNode = node.getFirstChild(); listNode != null; listNode = listNode.getNextSibling())
{ {
if ("npc".equalsIgnoreCase(list_node.getNodeName())) if ("npc".equalsIgnoreCase(listNode.getNodeName()))
{ {
NamedNodeMap attrs = list_node.getAttributes(); NamedNodeMap attrs = listNode.getAttributes();
final StatsSet set = new StatsSet(new HashMap<>()); final StatsSet set = new StatsSet(new HashMap<>());
final int npcId = parseInteger(attrs, "id"); final int npcId = parseInteger(attrs, "id");
Map<String, Object> parameters = null; Map<String, Object> parameters = null;
@ -108,10 +108,10 @@ public class NpcData implements IGameXmlReader
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName")); set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title")); set.set("title", parseString(attrs, "title"));
set.set("usingServerSideTitle", parseBoolean(attrs, "usingServerSideTitle")); set.set("usingServerSideTitle", parseBoolean(attrs, "usingServerSideTitle"));
for (Node npc_node = list_node.getFirstChild(); npc_node != null; npc_node = npc_node.getNextSibling()) for (Node npcNode = listNode.getFirstChild(); npcNode != null; npcNode = npcNode.getNextSibling())
{ {
attrs = npc_node.getAttributes(); attrs = npcNode.getAttributes();
switch (npc_node.getNodeName().toLowerCase()) switch (npcNode.getNodeName().toLowerCase())
{ {
case "parameters": case "parameters":
{ {
@ -119,13 +119,13 @@ public class NpcData implements IGameXmlReader
{ {
parameters = new HashMap<>(); parameters = new HashMap<>();
} }
parameters.putAll(parseParameters(npc_node)); parameters.putAll(parseParameters(npcNode));
break; break;
} }
case "race": case "race":
case "sex": case "sex":
{ {
set.set(npc_node.getNodeName(), npc_node.getTextContent().toUpperCase()); set.set(npcNode.getNodeName(), npcNode.getTextContent().toUpperCase());
break; break;
} }
case "equipment": case "equipment":
@ -159,10 +159,10 @@ public class NpcData implements IGameXmlReader
set.set("baseWIT", parseInteger(attrs, "wit")); set.set("baseWIT", parseInteger(attrs, "wit"));
set.set("baseCON", parseInteger(attrs, "con")); set.set("baseCON", parseInteger(attrs, "con"));
set.set("baseMEN", parseInteger(attrs, "men")); set.set("baseMEN", parseInteger(attrs, "men"));
for (Node stats_node = npc_node.getFirstChild(); stats_node != null; stats_node = stats_node.getNextSibling()) for (Node statsNode = npcNode.getFirstChild(); statsNode != null; statsNode = statsNode.getNextSibling())
{ {
attrs = stats_node.getAttributes(); attrs = statsNode.getAttributes();
switch (stats_node.getNodeName().toLowerCase()) switch (statsNode.getNodeName().toLowerCase())
{ {
case "vitals": case "vitals":
{ {
@ -204,7 +204,7 @@ public class NpcData implements IGameXmlReader
} }
case "attribute": case "attribute":
{ {
for (Node attribute_node = stats_node.getFirstChild(); attribute_node != null; attribute_node = attribute_node.getNextSibling()) for (Node attribute_node = statsNode.getFirstChild(); attribute_node != null; attribute_node = attribute_node.getNextSibling())
{ {
attrs = attribute_node.getAttributes(); attrs = attribute_node.getAttributes();
switch (attribute_node.getNodeName().toLowerCase()) switch (attribute_node.getNodeName().toLowerCase())
@ -264,10 +264,10 @@ public class NpcData implements IGameXmlReader
} }
case "speed": case "speed":
{ {
for (Node speed_node = stats_node.getFirstChild(); speed_node != null; speed_node = speed_node.getNextSibling()) for (Node speedNode = statsNode.getFirstChild(); speedNode != null; speedNode = speedNode.getNextSibling())
{ {
attrs = speed_node.getAttributes(); attrs = speedNode.getAttributes();
switch (speed_node.getNodeName().toLowerCase()) switch (speedNode.getNodeName().toLowerCase())
{ {
case "walk": case "walk":
{ {
@ -287,9 +287,9 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "hitTime": case "hittime":
{ {
set.set("hitTime", npc_node.getTextContent()); // TODO: Implement me default 600 (value in ms) set.set("hitTime", npcNode.getTextContent()); // TODO: Implement me default 600 (value in ms)
break; break;
} }
} }
@ -317,14 +317,14 @@ public class NpcData implements IGameXmlReader
set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable")); set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable"));
break; break;
} }
case "skillList": case "skilllist":
{ {
skills = new HashMap<>(); skills = new HashMap<>();
for (Node skill_list_node = npc_node.getFirstChild(); skill_list_node != null; skill_list_node = skill_list_node.getNextSibling()) for (Node skillListNode = npcNode.getFirstChild(); skillListNode != null; skillListNode = skillListNode.getNextSibling())
{ {
if ("skill".equalsIgnoreCase(skill_list_node.getNodeName())) if ("skill".equalsIgnoreCase(skillListNode.getNodeName()))
{ {
attrs = skill_list_node.getAttributes(); attrs = skillListNode.getAttributes();
final int skillId = parseInteger(attrs, "id"); final int skillId = parseInteger(attrs, "id");
final int skillLevel = parseInteger(attrs, "level"); final int skillLevel = parseInteger(attrs, "level");
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
@ -348,19 +348,19 @@ public class NpcData implements IGameXmlReader
set.set("spiritShotChance", parseInteger(attrs, "spiritChance")); set.set("spiritShotChance", parseInteger(attrs, "spiritChance"));
break; break;
} }
case "corpseTime": case "corpsetime":
{ {
set.set("corpseTime", npc_node.getTextContent()); set.set("corpseTime", npcNode.getTextContent());
break; break;
} }
case "exCrtEffect": case "excrteffect":
{ {
set.set("exCrtEffect", npc_node.getTextContent()); // TODO: Implement me default ? type boolean set.set("exCrtEffect", npcNode.getTextContent()); // TODO: Implement me default ? type boolean
break; break;
} }
case "sNpcPropHpRate": case "snpcprophprate":
{ {
set.set("sNpcPropHpRate", npc_node.getTextContent()); // TODO: Implement me default 1 type double set.set("sNpcPropHpRate", npcNode.getTextContent()); // TODO: Implement me default 1 type double
break; break;
} }
case "ai": case "ai":
@ -371,10 +371,10 @@ public class NpcData implements IGameXmlReader
set.set("dodge", parseInteger(attrs, "dodge")); set.set("dodge", parseInteger(attrs, "dodge"));
set.set("isChaos", parseBoolean(attrs, "isChaos")); set.set("isChaos", parseBoolean(attrs, "isChaos"));
set.set("isAggressive", parseBoolean(attrs, "isAggressive")); set.set("isAggressive", parseBoolean(attrs, "isAggressive"));
for (Node ai_node = npc_node.getFirstChild(); ai_node != null; ai_node = ai_node.getNextSibling()) for (Node aiNode = npcNode.getFirstChild(); aiNode != null; aiNode = aiNode.getNextSibling())
{ {
attrs = ai_node.getAttributes(); attrs = aiNode.getAttributes();
switch (ai_node.getNodeName().toLowerCase()) switch (aiNode.getNodeName().toLowerCase())
{ {
case "skill": case "skill":
{ {
@ -387,12 +387,12 @@ public class NpcData implements IGameXmlReader
set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance")); set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance"));
break; break;
} }
case "clanList": case "clanlist":
{ {
for (Node clan_list_node = ai_node.getFirstChild(); clan_list_node != null; clan_list_node = clan_list_node.getNextSibling()) for (Node clanListNode = aiNode.getFirstChild(); clanListNode != null; clanListNode = clanListNode.getNextSibling())
{ {
attrs = clan_list_node.getAttributes(); attrs = clanListNode.getAttributes();
switch (clan_list_node.getNodeName().toLowerCase()) switch (clanListNode.getNodeName().toLowerCase())
{ {
case "clan": case "clan":
{ {
@ -400,16 +400,16 @@ public class NpcData implements IGameXmlReader
{ {
clans = new HashSet<>(1); clans = new HashSet<>(1);
} }
clans.add(getOrCreateClanId(clan_list_node.getTextContent())); clans.add(getOrCreateClanId(clanListNode.getTextContent()));
break; break;
} }
case "ignoreNpcId": case "ignorenpcid":
{ {
if (ignoreClanNpcIds == null) if (ignoreClanNpcIds == null)
{ {
ignoreClanNpcIds = new HashSet<>(1); ignoreClanNpcIds = new HashSet<>(1);
} }
ignoreClanNpcIds.add(Integer.parseInt(clan_list_node.getTextContent())); ignoreClanNpcIds.add(Integer.parseInt(clanListNode.getTextContent()));
break; break;
} }
} }
@ -420,9 +420,9 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "dropLists": case "droplists":
{ {
for (Node drop_lists_node = npc_node.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling()) for (Node drop_lists_node = npcNode.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling())
{ {
DropType dropType = null; DropType dropType = null;
@ -461,10 +461,10 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "extendDrop": case "extenddrop":
{ {
final List<Integer> extendDrop = new ArrayList<>(); final List<Integer> extendDrop = new ArrayList<>();
forEach(npc_node, "id", idNode -> forEach(npcNode, "id", idNode ->
{ {
extendDrop.add(Integer.parseInt(idNode.getTextContent())); extendDrop.add(Integer.parseInt(idNode.getTextContent()));
}); });
@ -473,10 +473,10 @@ public class NpcData implements IGameXmlReader
} }
case "collision": case "collision":
{ {
for (Node collision_node = npc_node.getFirstChild(); collision_node != null; collision_node = collision_node.getNextSibling()) for (Node collisionNode = npcNode.getFirstChild(); collisionNode != null; collisionNode = collisionNode.getNextSibling())
{ {
attrs = collision_node.getAttributes(); attrs = collisionNode.getAttributes();
switch (collision_node.getNodeName().toLowerCase()) switch (collisionNode.getNodeName().toLowerCase())
{ {
case "radius": case "radius":
{ {

View File

@ -88,11 +88,11 @@ public class NpcData implements IGameXmlReader
{ {
if ("list".equalsIgnoreCase(node.getNodeName())) if ("list".equalsIgnoreCase(node.getNodeName()))
{ {
for (Node list_node = node.getFirstChild(); list_node != null; list_node = list_node.getNextSibling()) for (Node listNode = node.getFirstChild(); listNode != null; listNode = listNode.getNextSibling())
{ {
if ("npc".equalsIgnoreCase(list_node.getNodeName())) if ("npc".equalsIgnoreCase(listNode.getNodeName()))
{ {
NamedNodeMap attrs = list_node.getAttributes(); NamedNodeMap attrs = listNode.getAttributes();
final StatsSet set = new StatsSet(new HashMap<>()); final StatsSet set = new StatsSet(new HashMap<>());
final int npcId = parseInteger(attrs, "id"); final int npcId = parseInteger(attrs, "id");
Map<String, Object> parameters = null; Map<String, Object> parameters = null;
@ -108,10 +108,10 @@ public class NpcData implements IGameXmlReader
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName")); set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title")); set.set("title", parseString(attrs, "title"));
set.set("usingServerSideTitle", parseBoolean(attrs, "usingServerSideTitle")); set.set("usingServerSideTitle", parseBoolean(attrs, "usingServerSideTitle"));
for (Node npc_node = list_node.getFirstChild(); npc_node != null; npc_node = npc_node.getNextSibling()) for (Node npcNode = listNode.getFirstChild(); npcNode != null; npcNode = npcNode.getNextSibling())
{ {
attrs = npc_node.getAttributes(); attrs = npcNode.getAttributes();
switch (npc_node.getNodeName().toLowerCase()) switch (npcNode.getNodeName().toLowerCase())
{ {
case "parameters": case "parameters":
{ {
@ -119,13 +119,13 @@ public class NpcData implements IGameXmlReader
{ {
parameters = new HashMap<>(); parameters = new HashMap<>();
} }
parameters.putAll(parseParameters(npc_node)); parameters.putAll(parseParameters(npcNode));
break; break;
} }
case "race": case "race":
case "sex": case "sex":
{ {
set.set(npc_node.getNodeName(), npc_node.getTextContent().toUpperCase()); set.set(npcNode.getNodeName(), npcNode.getTextContent().toUpperCase());
break; break;
} }
case "equipment": case "equipment":
@ -159,10 +159,10 @@ public class NpcData implements IGameXmlReader
set.set("baseWIT", parseInteger(attrs, "wit")); set.set("baseWIT", parseInteger(attrs, "wit"));
set.set("baseCON", parseInteger(attrs, "con")); set.set("baseCON", parseInteger(attrs, "con"));
set.set("baseMEN", parseInteger(attrs, "men")); set.set("baseMEN", parseInteger(attrs, "men"));
for (Node stats_node = npc_node.getFirstChild(); stats_node != null; stats_node = stats_node.getNextSibling()) for (Node statsNode = npcNode.getFirstChild(); statsNode != null; statsNode = statsNode.getNextSibling())
{ {
attrs = stats_node.getAttributes(); attrs = statsNode.getAttributes();
switch (stats_node.getNodeName().toLowerCase()) switch (statsNode.getNodeName().toLowerCase())
{ {
case "vitals": case "vitals":
{ {
@ -204,7 +204,7 @@ public class NpcData implements IGameXmlReader
} }
case "attribute": case "attribute":
{ {
for (Node attribute_node = stats_node.getFirstChild(); attribute_node != null; attribute_node = attribute_node.getNextSibling()) for (Node attribute_node = statsNode.getFirstChild(); attribute_node != null; attribute_node = attribute_node.getNextSibling())
{ {
attrs = attribute_node.getAttributes(); attrs = attribute_node.getAttributes();
switch (attribute_node.getNodeName().toLowerCase()) switch (attribute_node.getNodeName().toLowerCase())
@ -264,10 +264,10 @@ public class NpcData implements IGameXmlReader
} }
case "speed": case "speed":
{ {
for (Node speed_node = stats_node.getFirstChild(); speed_node != null; speed_node = speed_node.getNextSibling()) for (Node speedNode = statsNode.getFirstChild(); speedNode != null; speedNode = speedNode.getNextSibling())
{ {
attrs = speed_node.getAttributes(); attrs = speedNode.getAttributes();
switch (speed_node.getNodeName().toLowerCase()) switch (speedNode.getNodeName().toLowerCase())
{ {
case "walk": case "walk":
{ {
@ -287,9 +287,9 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "hitTime": case "hittime":
{ {
set.set("hitTime", npc_node.getTextContent()); // TODO: Implement me default 600 (value in ms) set.set("hitTime", npcNode.getTextContent()); // TODO: Implement me default 600 (value in ms)
break; break;
} }
} }
@ -317,14 +317,14 @@ public class NpcData implements IGameXmlReader
set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable")); set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable"));
break; break;
} }
case "skillList": case "skilllist":
{ {
skills = new HashMap<>(); skills = new HashMap<>();
for (Node skill_list_node = npc_node.getFirstChild(); skill_list_node != null; skill_list_node = skill_list_node.getNextSibling()) for (Node skillListNode = npcNode.getFirstChild(); skillListNode != null; skillListNode = skillListNode.getNextSibling())
{ {
if ("skill".equalsIgnoreCase(skill_list_node.getNodeName())) if ("skill".equalsIgnoreCase(skillListNode.getNodeName()))
{ {
attrs = skill_list_node.getAttributes(); attrs = skillListNode.getAttributes();
final int skillId = parseInteger(attrs, "id"); final int skillId = parseInteger(attrs, "id");
final int skillLevel = parseInteger(attrs, "level"); final int skillLevel = parseInteger(attrs, "level");
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
@ -348,19 +348,19 @@ public class NpcData implements IGameXmlReader
set.set("spiritShotChance", parseInteger(attrs, "spiritChance")); set.set("spiritShotChance", parseInteger(attrs, "spiritChance"));
break; break;
} }
case "corpseTime": case "corpsetime":
{ {
set.set("corpseTime", npc_node.getTextContent()); set.set("corpseTime", npcNode.getTextContent());
break; break;
} }
case "exCrtEffect": case "excrteffect":
{ {
set.set("exCrtEffect", npc_node.getTextContent()); // TODO: Implement me default ? type boolean set.set("exCrtEffect", npcNode.getTextContent()); // TODO: Implement me default ? type boolean
break; break;
} }
case "sNpcPropHpRate": case "snpcprophprate":
{ {
set.set("sNpcPropHpRate", npc_node.getTextContent()); // TODO: Implement me default 1 type double set.set("sNpcPropHpRate", npcNode.getTextContent()); // TODO: Implement me default 1 type double
break; break;
} }
case "ai": case "ai":
@ -371,10 +371,10 @@ public class NpcData implements IGameXmlReader
set.set("dodge", parseInteger(attrs, "dodge")); set.set("dodge", parseInteger(attrs, "dodge"));
set.set("isChaos", parseBoolean(attrs, "isChaos")); set.set("isChaos", parseBoolean(attrs, "isChaos"));
set.set("isAggressive", parseBoolean(attrs, "isAggressive")); set.set("isAggressive", parseBoolean(attrs, "isAggressive"));
for (Node ai_node = npc_node.getFirstChild(); ai_node != null; ai_node = ai_node.getNextSibling()) for (Node aiNode = npcNode.getFirstChild(); aiNode != null; aiNode = aiNode.getNextSibling())
{ {
attrs = ai_node.getAttributes(); attrs = aiNode.getAttributes();
switch (ai_node.getNodeName().toLowerCase()) switch (aiNode.getNodeName().toLowerCase())
{ {
case "skill": case "skill":
{ {
@ -387,12 +387,12 @@ public class NpcData implements IGameXmlReader
set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance")); set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance"));
break; break;
} }
case "clanList": case "clanlist":
{ {
for (Node clan_list_node = ai_node.getFirstChild(); clan_list_node != null; clan_list_node = clan_list_node.getNextSibling()) for (Node clanListNode = aiNode.getFirstChild(); clanListNode != null; clanListNode = clanListNode.getNextSibling())
{ {
attrs = clan_list_node.getAttributes(); attrs = clanListNode.getAttributes();
switch (clan_list_node.getNodeName().toLowerCase()) switch (clanListNode.getNodeName().toLowerCase())
{ {
case "clan": case "clan":
{ {
@ -400,16 +400,16 @@ public class NpcData implements IGameXmlReader
{ {
clans = new HashSet<>(1); clans = new HashSet<>(1);
} }
clans.add(getOrCreateClanId(clan_list_node.getTextContent())); clans.add(getOrCreateClanId(clanListNode.getTextContent()));
break; break;
} }
case "ignoreNpcId": case "ignorenpcid":
{ {
if (ignoreClanNpcIds == null) if (ignoreClanNpcIds == null)
{ {
ignoreClanNpcIds = new HashSet<>(1); ignoreClanNpcIds = new HashSet<>(1);
} }
ignoreClanNpcIds.add(Integer.parseInt(clan_list_node.getTextContent())); ignoreClanNpcIds.add(Integer.parseInt(clanListNode.getTextContent()));
break; break;
} }
} }
@ -420,9 +420,9 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "dropLists": case "droplists":
{ {
for (Node drop_lists_node = npc_node.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling()) for (Node drop_lists_node = npcNode.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling())
{ {
DropType dropType = null; DropType dropType = null;
@ -461,10 +461,10 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "extendDrop": case "extenddrop":
{ {
final List<Integer> extendDrop = new ArrayList<>(); final List<Integer> extendDrop = new ArrayList<>();
forEach(npc_node, "id", idNode -> forEach(npcNode, "id", idNode ->
{ {
extendDrop.add(Integer.parseInt(idNode.getTextContent())); extendDrop.add(Integer.parseInt(idNode.getTextContent()));
}); });
@ -473,10 +473,10 @@ public class NpcData implements IGameXmlReader
} }
case "collision": case "collision":
{ {
for (Node collision_node = npc_node.getFirstChild(); collision_node != null; collision_node = collision_node.getNextSibling()) for (Node collisionNode = npcNode.getFirstChild(); collisionNode != null; collisionNode = collisionNode.getNextSibling())
{ {
attrs = collision_node.getAttributes(); attrs = collisionNode.getAttributes();
switch (collision_node.getNodeName().toLowerCase()) switch (collisionNode.getNodeName().toLowerCase())
{ {
case "radius": case "radius":
{ {

View File

@ -88,11 +88,11 @@ public class NpcData implements IGameXmlReader
{ {
if ("list".equalsIgnoreCase(node.getNodeName())) if ("list".equalsIgnoreCase(node.getNodeName()))
{ {
for (Node list_node = node.getFirstChild(); list_node != null; list_node = list_node.getNextSibling()) for (Node listNode = node.getFirstChild(); listNode != null; listNode = listNode.getNextSibling())
{ {
if ("npc".equalsIgnoreCase(list_node.getNodeName())) if ("npc".equalsIgnoreCase(listNode.getNodeName()))
{ {
NamedNodeMap attrs = list_node.getAttributes(); NamedNodeMap attrs = listNode.getAttributes();
final StatsSet set = new StatsSet(new HashMap<>()); final StatsSet set = new StatsSet(new HashMap<>());
final int npcId = parseInteger(attrs, "id"); final int npcId = parseInteger(attrs, "id");
Map<String, Object> parameters = null; Map<String, Object> parameters = null;
@ -108,10 +108,10 @@ public class NpcData implements IGameXmlReader
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName")); set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title")); set.set("title", parseString(attrs, "title"));
set.set("usingServerSideTitle", parseBoolean(attrs, "usingServerSideTitle")); set.set("usingServerSideTitle", parseBoolean(attrs, "usingServerSideTitle"));
for (Node npc_node = list_node.getFirstChild(); npc_node != null; npc_node = npc_node.getNextSibling()) for (Node npcNode = listNode.getFirstChild(); npcNode != null; npcNode = npcNode.getNextSibling())
{ {
attrs = npc_node.getAttributes(); attrs = npcNode.getAttributes();
switch (npc_node.getNodeName().toLowerCase()) switch (npcNode.getNodeName().toLowerCase())
{ {
case "parameters": case "parameters":
{ {
@ -119,13 +119,13 @@ public class NpcData implements IGameXmlReader
{ {
parameters = new HashMap<>(); parameters = new HashMap<>();
} }
parameters.putAll(parseParameters(npc_node)); parameters.putAll(parseParameters(npcNode));
break; break;
} }
case "race": case "race":
case "sex": case "sex":
{ {
set.set(npc_node.getNodeName(), npc_node.getTextContent().toUpperCase()); set.set(npcNode.getNodeName(), npcNode.getTextContent().toUpperCase());
break; break;
} }
case "equipment": case "equipment":
@ -159,10 +159,10 @@ public class NpcData implements IGameXmlReader
set.set("baseWIT", parseInteger(attrs, "wit")); set.set("baseWIT", parseInteger(attrs, "wit"));
set.set("baseCON", parseInteger(attrs, "con")); set.set("baseCON", parseInteger(attrs, "con"));
set.set("baseMEN", parseInteger(attrs, "men")); set.set("baseMEN", parseInteger(attrs, "men"));
for (Node stats_node = npc_node.getFirstChild(); stats_node != null; stats_node = stats_node.getNextSibling()) for (Node statsNode = npcNode.getFirstChild(); statsNode != null; statsNode = statsNode.getNextSibling())
{ {
attrs = stats_node.getAttributes(); attrs = statsNode.getAttributes();
switch (stats_node.getNodeName().toLowerCase()) switch (statsNode.getNodeName().toLowerCase())
{ {
case "vitals": case "vitals":
{ {
@ -204,7 +204,7 @@ public class NpcData implements IGameXmlReader
} }
case "attribute": case "attribute":
{ {
for (Node attribute_node = stats_node.getFirstChild(); attribute_node != null; attribute_node = attribute_node.getNextSibling()) for (Node attribute_node = statsNode.getFirstChild(); attribute_node != null; attribute_node = attribute_node.getNextSibling())
{ {
attrs = attribute_node.getAttributes(); attrs = attribute_node.getAttributes();
switch (attribute_node.getNodeName().toLowerCase()) switch (attribute_node.getNodeName().toLowerCase())
@ -264,10 +264,10 @@ public class NpcData implements IGameXmlReader
} }
case "speed": case "speed":
{ {
for (Node speed_node = stats_node.getFirstChild(); speed_node != null; speed_node = speed_node.getNextSibling()) for (Node speedNode = statsNode.getFirstChild(); speedNode != null; speedNode = speedNode.getNextSibling())
{ {
attrs = speed_node.getAttributes(); attrs = speedNode.getAttributes();
switch (speed_node.getNodeName().toLowerCase()) switch (speedNode.getNodeName().toLowerCase())
{ {
case "walk": case "walk":
{ {
@ -287,9 +287,9 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "hitTime": case "hittime":
{ {
set.set("hitTime", npc_node.getTextContent()); // TODO: Implement me default 600 (value in ms) set.set("hitTime", npcNode.getTextContent()); // TODO: Implement me default 600 (value in ms)
break; break;
} }
} }
@ -317,14 +317,14 @@ public class NpcData implements IGameXmlReader
set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable")); set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable"));
break; break;
} }
case "skillList": case "skilllist":
{ {
skills = new HashMap<>(); skills = new HashMap<>();
for (Node skill_list_node = npc_node.getFirstChild(); skill_list_node != null; skill_list_node = skill_list_node.getNextSibling()) for (Node skillListNode = npcNode.getFirstChild(); skillListNode != null; skillListNode = skillListNode.getNextSibling())
{ {
if ("skill".equalsIgnoreCase(skill_list_node.getNodeName())) if ("skill".equalsIgnoreCase(skillListNode.getNodeName()))
{ {
attrs = skill_list_node.getAttributes(); attrs = skillListNode.getAttributes();
final int skillId = parseInteger(attrs, "id"); final int skillId = parseInteger(attrs, "id");
final int skillLevel = parseInteger(attrs, "level"); final int skillLevel = parseInteger(attrs, "level");
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
@ -348,19 +348,19 @@ public class NpcData implements IGameXmlReader
set.set("spiritShotChance", parseInteger(attrs, "spiritChance")); set.set("spiritShotChance", parseInteger(attrs, "spiritChance"));
break; break;
} }
case "corpseTime": case "corpsetime":
{ {
set.set("corpseTime", npc_node.getTextContent()); set.set("corpseTime", npcNode.getTextContent());
break; break;
} }
case "exCrtEffect": case "excrteffect":
{ {
set.set("exCrtEffect", npc_node.getTextContent()); // TODO: Implement me default ? type boolean set.set("exCrtEffect", npcNode.getTextContent()); // TODO: Implement me default ? type boolean
break; break;
} }
case "sNpcPropHpRate": case "snpcprophprate":
{ {
set.set("sNpcPropHpRate", npc_node.getTextContent()); // TODO: Implement me default 1 type double set.set("sNpcPropHpRate", npcNode.getTextContent()); // TODO: Implement me default 1 type double
break; break;
} }
case "ai": case "ai":
@ -371,10 +371,10 @@ public class NpcData implements IGameXmlReader
set.set("dodge", parseInteger(attrs, "dodge")); set.set("dodge", parseInteger(attrs, "dodge"));
set.set("isChaos", parseBoolean(attrs, "isChaos")); set.set("isChaos", parseBoolean(attrs, "isChaos"));
set.set("isAggressive", parseBoolean(attrs, "isAggressive")); set.set("isAggressive", parseBoolean(attrs, "isAggressive"));
for (Node ai_node = npc_node.getFirstChild(); ai_node != null; ai_node = ai_node.getNextSibling()) for (Node aiNode = npcNode.getFirstChild(); aiNode != null; aiNode = aiNode.getNextSibling())
{ {
attrs = ai_node.getAttributes(); attrs = aiNode.getAttributes();
switch (ai_node.getNodeName().toLowerCase()) switch (aiNode.getNodeName().toLowerCase())
{ {
case "skill": case "skill":
{ {
@ -387,12 +387,12 @@ public class NpcData implements IGameXmlReader
set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance")); set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance"));
break; break;
} }
case "clanList": case "clanlist":
{ {
for (Node clan_list_node = ai_node.getFirstChild(); clan_list_node != null; clan_list_node = clan_list_node.getNextSibling()) for (Node clanListNode = aiNode.getFirstChild(); clanListNode != null; clanListNode = clanListNode.getNextSibling())
{ {
attrs = clan_list_node.getAttributes(); attrs = clanListNode.getAttributes();
switch (clan_list_node.getNodeName().toLowerCase()) switch (clanListNode.getNodeName().toLowerCase())
{ {
case "clan": case "clan":
{ {
@ -400,16 +400,16 @@ public class NpcData implements IGameXmlReader
{ {
clans = new HashSet<>(1); clans = new HashSet<>(1);
} }
clans.add(getOrCreateClanId(clan_list_node.getTextContent())); clans.add(getOrCreateClanId(clanListNode.getTextContent()));
break; break;
} }
case "ignoreNpcId": case "ignorenpcid":
{ {
if (ignoreClanNpcIds == null) if (ignoreClanNpcIds == null)
{ {
ignoreClanNpcIds = new HashSet<>(1); ignoreClanNpcIds = new HashSet<>(1);
} }
ignoreClanNpcIds.add(Integer.parseInt(clan_list_node.getTextContent())); ignoreClanNpcIds.add(Integer.parseInt(clanListNode.getTextContent()));
break; break;
} }
} }
@ -420,9 +420,9 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "dropLists": case "droplists":
{ {
for (Node drop_lists_node = npc_node.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling()) for (Node drop_lists_node = npcNode.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling())
{ {
DropType dropType = null; DropType dropType = null;
@ -461,10 +461,10 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "extendDrop": case "extenddrop":
{ {
final List<Integer> extendDrop = new ArrayList<>(); final List<Integer> extendDrop = new ArrayList<>();
forEach(npc_node, "id", idNode -> forEach(npcNode, "id", idNode ->
{ {
extendDrop.add(Integer.parseInt(idNode.getTextContent())); extendDrop.add(Integer.parseInt(idNode.getTextContent()));
}); });
@ -473,10 +473,10 @@ public class NpcData implements IGameXmlReader
} }
case "collision": case "collision":
{ {
for (Node collision_node = npc_node.getFirstChild(); collision_node != null; collision_node = collision_node.getNextSibling()) for (Node collisionNode = npcNode.getFirstChild(); collisionNode != null; collisionNode = collisionNode.getNextSibling())
{ {
attrs = collision_node.getAttributes(); attrs = collisionNode.getAttributes();
switch (collision_node.getNodeName().toLowerCase()) switch (collisionNode.getNodeName().toLowerCase())
{ {
case "radius": case "radius":
{ {

View File

@ -25,7 +25,6 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -54,8 +53,8 @@ import com.l2jmobius.gameserver.model.skills.Skill;
*/ */
public class NpcData implements IGameXmlReader public class NpcData implements IGameXmlReader
{ {
private final Map<Integer, L2NpcTemplate> _npcs = new ConcurrentHashMap<>(); private final Map<Integer, L2NpcTemplate> _npcs = new HashMap<>();
private final Map<String, Integer> _clans = new ConcurrentHashMap<>(); private final Map<String, Integer> _clans = new HashMap<>();
private static final List<Integer> _masterMonsterIDs = new ArrayList<>(); private static final List<Integer> _masterMonsterIDs = new ArrayList<>();
protected NpcData() protected NpcData()
@ -285,7 +284,6 @@ public class NpcData implements IGameXmlReader
break; break;
} }
case "speed": case "speed":
{
{ {
for (Node speedNode = statsNode.getFirstChild(); speedNode != null; speedNode = speedNode.getNextSibling()) for (Node speedNode = statsNode.getFirstChild(); speedNode != null; speedNode = speedNode.getNextSibling())
{ {
@ -310,7 +308,6 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
}
case "hittime": case "hittime":
{ {
set.set("hitTime", npcNode.getTextContent()); // TODO: Implement me default 600 (value in ms) set.set("hitTime", npcNode.getTextContent()); // TODO: Implement me default 600 (value in ms)

View File

@ -88,11 +88,11 @@ public class NpcData implements IGameXmlReader
{ {
if ("list".equalsIgnoreCase(node.getNodeName())) if ("list".equalsIgnoreCase(node.getNodeName()))
{ {
for (Node list_node = node.getFirstChild(); list_node != null; list_node = list_node.getNextSibling()) for (Node listNode = node.getFirstChild(); listNode != null; listNode = listNode.getNextSibling())
{ {
if ("npc".equalsIgnoreCase(list_node.getNodeName())) if ("npc".equalsIgnoreCase(listNode.getNodeName()))
{ {
NamedNodeMap attrs = list_node.getAttributes(); NamedNodeMap attrs = listNode.getAttributes();
final StatsSet set = new StatsSet(new HashMap<>()); final StatsSet set = new StatsSet(new HashMap<>());
final int npcId = parseInteger(attrs, "id"); final int npcId = parseInteger(attrs, "id");
Map<String, Object> parameters = null; Map<String, Object> parameters = null;
@ -108,10 +108,10 @@ public class NpcData implements IGameXmlReader
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName")); set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title")); set.set("title", parseString(attrs, "title"));
set.set("usingServerSideTitle", parseBoolean(attrs, "usingServerSideTitle")); set.set("usingServerSideTitle", parseBoolean(attrs, "usingServerSideTitle"));
for (Node npc_node = list_node.getFirstChild(); npc_node != null; npc_node = npc_node.getNextSibling()) for (Node npcNode = listNode.getFirstChild(); npcNode != null; npcNode = npcNode.getNextSibling())
{ {
attrs = npc_node.getAttributes(); attrs = npcNode.getAttributes();
switch (npc_node.getNodeName().toLowerCase()) switch (npcNode.getNodeName().toLowerCase())
{ {
case "parameters": case "parameters":
{ {
@ -119,13 +119,13 @@ public class NpcData implements IGameXmlReader
{ {
parameters = new HashMap<>(); parameters = new HashMap<>();
} }
parameters.putAll(parseParameters(npc_node)); parameters.putAll(parseParameters(npcNode));
break; break;
} }
case "race": case "race":
case "sex": case "sex":
{ {
set.set(npc_node.getNodeName(), npc_node.getTextContent().toUpperCase()); set.set(npcNode.getNodeName(), npcNode.getTextContent().toUpperCase());
break; break;
} }
case "equipment": case "equipment":
@ -159,10 +159,10 @@ public class NpcData implements IGameXmlReader
set.set("baseWIT", parseInteger(attrs, "wit")); set.set("baseWIT", parseInteger(attrs, "wit"));
set.set("baseCON", parseInteger(attrs, "con")); set.set("baseCON", parseInteger(attrs, "con"));
set.set("baseMEN", parseInteger(attrs, "men")); set.set("baseMEN", parseInteger(attrs, "men"));
for (Node stats_node = npc_node.getFirstChild(); stats_node != null; stats_node = stats_node.getNextSibling()) for (Node statsNode = npcNode.getFirstChild(); statsNode != null; statsNode = statsNode.getNextSibling())
{ {
attrs = stats_node.getAttributes(); attrs = statsNode.getAttributes();
switch (stats_node.getNodeName().toLowerCase()) switch (statsNode.getNodeName().toLowerCase())
{ {
case "vitals": case "vitals":
{ {
@ -204,7 +204,7 @@ public class NpcData implements IGameXmlReader
} }
case "attribute": case "attribute":
{ {
for (Node attribute_node = stats_node.getFirstChild(); attribute_node != null; attribute_node = attribute_node.getNextSibling()) for (Node attribute_node = statsNode.getFirstChild(); attribute_node != null; attribute_node = attribute_node.getNextSibling())
{ {
attrs = attribute_node.getAttributes(); attrs = attribute_node.getAttributes();
switch (attribute_node.getNodeName().toLowerCase()) switch (attribute_node.getNodeName().toLowerCase())
@ -264,10 +264,10 @@ public class NpcData implements IGameXmlReader
} }
case "speed": case "speed":
{ {
for (Node speed_node = stats_node.getFirstChild(); speed_node != null; speed_node = speed_node.getNextSibling()) for (Node speedNode = statsNode.getFirstChild(); speedNode != null; speedNode = speedNode.getNextSibling())
{ {
attrs = speed_node.getAttributes(); attrs = speedNode.getAttributes();
switch (speed_node.getNodeName().toLowerCase()) switch (speedNode.getNodeName().toLowerCase())
{ {
case "walk": case "walk":
{ {
@ -287,9 +287,9 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "hitTime": case "hittime":
{ {
set.set("hitTime", npc_node.getTextContent()); // TODO: Implement me default 600 (value in ms) set.set("hitTime", npcNode.getTextContent()); // TODO: Implement me default 600 (value in ms)
break; break;
} }
} }
@ -317,14 +317,14 @@ public class NpcData implements IGameXmlReader
set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable")); set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable"));
break; break;
} }
case "skillList": case "skilllist":
{ {
skills = new HashMap<>(); skills = new HashMap<>();
for (Node skill_list_node = npc_node.getFirstChild(); skill_list_node != null; skill_list_node = skill_list_node.getNextSibling()) for (Node skillListNode = npcNode.getFirstChild(); skillListNode != null; skillListNode = skillListNode.getNextSibling())
{ {
if ("skill".equalsIgnoreCase(skill_list_node.getNodeName())) if ("skill".equalsIgnoreCase(skillListNode.getNodeName()))
{ {
attrs = skill_list_node.getAttributes(); attrs = skillListNode.getAttributes();
final int skillId = parseInteger(attrs, "id"); final int skillId = parseInteger(attrs, "id");
final int skillLevel = parseInteger(attrs, "level"); final int skillLevel = parseInteger(attrs, "level");
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
@ -348,19 +348,19 @@ public class NpcData implements IGameXmlReader
set.set("spiritShotChance", parseInteger(attrs, "spiritChance")); set.set("spiritShotChance", parseInteger(attrs, "spiritChance"));
break; break;
} }
case "corpseTime": case "corpsetime":
{ {
set.set("corpseTime", npc_node.getTextContent()); set.set("corpseTime", npcNode.getTextContent());
break; break;
} }
case "exCrtEffect": case "excrteffect":
{ {
set.set("exCrtEffect", npc_node.getTextContent()); // TODO: Implement me default ? type boolean set.set("exCrtEffect", npcNode.getTextContent()); // TODO: Implement me default ? type boolean
break; break;
} }
case "sNpcPropHpRate": case "snpcprophprate":
{ {
set.set("sNpcPropHpRate", npc_node.getTextContent()); // TODO: Implement me default 1 type double set.set("sNpcPropHpRate", npcNode.getTextContent()); // TODO: Implement me default 1 type double
break; break;
} }
case "ai": case "ai":
@ -371,10 +371,10 @@ public class NpcData implements IGameXmlReader
set.set("dodge", parseInteger(attrs, "dodge")); set.set("dodge", parseInteger(attrs, "dodge"));
set.set("isChaos", parseBoolean(attrs, "isChaos")); set.set("isChaos", parseBoolean(attrs, "isChaos"));
set.set("isAggressive", parseBoolean(attrs, "isAggressive")); set.set("isAggressive", parseBoolean(attrs, "isAggressive"));
for (Node ai_node = npc_node.getFirstChild(); ai_node != null; ai_node = ai_node.getNextSibling()) for (Node aiNode = npcNode.getFirstChild(); aiNode != null; aiNode = aiNode.getNextSibling())
{ {
attrs = ai_node.getAttributes(); attrs = aiNode.getAttributes();
switch (ai_node.getNodeName().toLowerCase()) switch (aiNode.getNodeName().toLowerCase())
{ {
case "skill": case "skill":
{ {
@ -387,12 +387,12 @@ public class NpcData implements IGameXmlReader
set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance")); set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance"));
break; break;
} }
case "clanList": case "clanlist":
{ {
for (Node clan_list_node = ai_node.getFirstChild(); clan_list_node != null; clan_list_node = clan_list_node.getNextSibling()) for (Node clanListNode = aiNode.getFirstChild(); clanListNode != null; clanListNode = clanListNode.getNextSibling())
{ {
attrs = clan_list_node.getAttributes(); attrs = clanListNode.getAttributes();
switch (clan_list_node.getNodeName().toLowerCase()) switch (clanListNode.getNodeName().toLowerCase())
{ {
case "clan": case "clan":
{ {
@ -400,16 +400,16 @@ public class NpcData implements IGameXmlReader
{ {
clans = new HashSet<>(1); clans = new HashSet<>(1);
} }
clans.add(getOrCreateClanId(clan_list_node.getTextContent())); clans.add(getOrCreateClanId(clanListNode.getTextContent()));
break; break;
} }
case "ignoreNpcId": case "ignorenpcid":
{ {
if (ignoreClanNpcIds == null) if (ignoreClanNpcIds == null)
{ {
ignoreClanNpcIds = new HashSet<>(1); ignoreClanNpcIds = new HashSet<>(1);
} }
ignoreClanNpcIds.add(Integer.parseInt(clan_list_node.getTextContent())); ignoreClanNpcIds.add(Integer.parseInt(clanListNode.getTextContent()));
break; break;
} }
} }
@ -420,9 +420,9 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "dropLists": case "droplists":
{ {
for (Node drop_lists_node = npc_node.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling()) for (Node drop_lists_node = npcNode.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling())
{ {
DropType dropType = null; DropType dropType = null;
@ -462,10 +462,10 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "extendDrop": case "extenddrop":
{ {
final List<Integer> extendDrop = new ArrayList<>(); final List<Integer> extendDrop = new ArrayList<>();
forEach(npc_node, "id", idNode -> forEach(npcNode, "id", idNode ->
{ {
extendDrop.add(Integer.parseInt(idNode.getTextContent())); extendDrop.add(Integer.parseInt(idNode.getTextContent()));
}); });
@ -474,10 +474,10 @@ public class NpcData implements IGameXmlReader
} }
case "collision": case "collision":
{ {
for (Node collision_node = npc_node.getFirstChild(); collision_node != null; collision_node = collision_node.getNextSibling()) for (Node collisionNode = npcNode.getFirstChild(); collisionNode != null; collisionNode = collisionNode.getNextSibling())
{ {
attrs = collision_node.getAttributes(); attrs = collisionNode.getAttributes();
switch (collision_node.getNodeName().toLowerCase()) switch (collisionNode.getNodeName().toLowerCase())
{ {
case "radius": case "radius":
{ {

View File

@ -88,11 +88,11 @@ public class NpcData implements IGameXmlReader
{ {
if ("list".equalsIgnoreCase(node.getNodeName())) if ("list".equalsIgnoreCase(node.getNodeName()))
{ {
for (Node list_node = node.getFirstChild(); list_node != null; list_node = list_node.getNextSibling()) for (Node listNode = node.getFirstChild(); listNode != null; listNode = listNode.getNextSibling())
{ {
if ("npc".equalsIgnoreCase(list_node.getNodeName())) if ("npc".equalsIgnoreCase(listNode.getNodeName()))
{ {
NamedNodeMap attrs = list_node.getAttributes(); NamedNodeMap attrs = listNode.getAttributes();
final StatsSet set = new StatsSet(new HashMap<>()); final StatsSet set = new StatsSet(new HashMap<>());
final int npcId = parseInteger(attrs, "id"); final int npcId = parseInteger(attrs, "id");
Map<String, Object> parameters = null; Map<String, Object> parameters = null;
@ -108,10 +108,10 @@ public class NpcData implements IGameXmlReader
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName")); set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title")); set.set("title", parseString(attrs, "title"));
set.set("usingServerSideTitle", parseBoolean(attrs, "usingServerSideTitle")); set.set("usingServerSideTitle", parseBoolean(attrs, "usingServerSideTitle"));
for (Node npc_node = list_node.getFirstChild(); npc_node != null; npc_node = npc_node.getNextSibling()) for (Node npcNode = listNode.getFirstChild(); npcNode != null; npcNode = npcNode.getNextSibling())
{ {
attrs = npc_node.getAttributes(); attrs = npcNode.getAttributes();
switch (npc_node.getNodeName().toLowerCase()) switch (npcNode.getNodeName().toLowerCase())
{ {
case "parameters": case "parameters":
{ {
@ -119,13 +119,13 @@ public class NpcData implements IGameXmlReader
{ {
parameters = new HashMap<>(); parameters = new HashMap<>();
} }
parameters.putAll(parseParameters(npc_node)); parameters.putAll(parseParameters(npcNode));
break; break;
} }
case "race": case "race":
case "sex": case "sex":
{ {
set.set(npc_node.getNodeName(), npc_node.getTextContent().toUpperCase()); set.set(npcNode.getNodeName(), npcNode.getTextContent().toUpperCase());
break; break;
} }
case "equipment": case "equipment":
@ -159,10 +159,10 @@ public class NpcData implements IGameXmlReader
set.set("baseWIT", parseInteger(attrs, "wit")); set.set("baseWIT", parseInteger(attrs, "wit"));
set.set("baseCON", parseInteger(attrs, "con")); set.set("baseCON", parseInteger(attrs, "con"));
set.set("baseMEN", parseInteger(attrs, "men")); set.set("baseMEN", parseInteger(attrs, "men"));
for (Node stats_node = npc_node.getFirstChild(); stats_node != null; stats_node = stats_node.getNextSibling()) for (Node statsNode = npcNode.getFirstChild(); statsNode != null; statsNode = statsNode.getNextSibling())
{ {
attrs = stats_node.getAttributes(); attrs = statsNode.getAttributes();
switch (stats_node.getNodeName().toLowerCase()) switch (statsNode.getNodeName().toLowerCase())
{ {
case "vitals": case "vitals":
{ {
@ -204,7 +204,7 @@ public class NpcData implements IGameXmlReader
} }
case "attribute": case "attribute":
{ {
for (Node attribute_node = stats_node.getFirstChild(); attribute_node != null; attribute_node = attribute_node.getNextSibling()) for (Node attribute_node = statsNode.getFirstChild(); attribute_node != null; attribute_node = attribute_node.getNextSibling())
{ {
attrs = attribute_node.getAttributes(); attrs = attribute_node.getAttributes();
switch (attribute_node.getNodeName().toLowerCase()) switch (attribute_node.getNodeName().toLowerCase())
@ -264,10 +264,10 @@ public class NpcData implements IGameXmlReader
} }
case "speed": case "speed":
{ {
for (Node speed_node = stats_node.getFirstChild(); speed_node != null; speed_node = speed_node.getNextSibling()) for (Node speedNode = statsNode.getFirstChild(); speedNode != null; speedNode = speedNode.getNextSibling())
{ {
attrs = speed_node.getAttributes(); attrs = speedNode.getAttributes();
switch (speed_node.getNodeName().toLowerCase()) switch (speedNode.getNodeName().toLowerCase())
{ {
case "walk": case "walk":
{ {
@ -287,9 +287,9 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "hitTime": case "hittime":
{ {
set.set("hitTime", npc_node.getTextContent()); // TODO: Implement me default 600 (value in ms) set.set("hitTime", npcNode.getTextContent()); // TODO: Implement me default 600 (value in ms)
break; break;
} }
} }
@ -317,14 +317,14 @@ public class NpcData implements IGameXmlReader
set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable")); set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable"));
break; break;
} }
case "skillList": case "skilllist":
{ {
skills = new HashMap<>(); skills = new HashMap<>();
for (Node skill_list_node = npc_node.getFirstChild(); skill_list_node != null; skill_list_node = skill_list_node.getNextSibling()) for (Node skillListNode = npcNode.getFirstChild(); skillListNode != null; skillListNode = skillListNode.getNextSibling())
{ {
if ("skill".equalsIgnoreCase(skill_list_node.getNodeName())) if ("skill".equalsIgnoreCase(skillListNode.getNodeName()))
{ {
attrs = skill_list_node.getAttributes(); attrs = skillListNode.getAttributes();
final int skillId = parseInteger(attrs, "id"); final int skillId = parseInteger(attrs, "id");
final int skillLevel = parseInteger(attrs, "level"); final int skillLevel = parseInteger(attrs, "level");
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
@ -348,19 +348,19 @@ public class NpcData implements IGameXmlReader
set.set("spiritShotChance", parseInteger(attrs, "spiritChance")); set.set("spiritShotChance", parseInteger(attrs, "spiritChance"));
break; break;
} }
case "corpseTime": case "corpsetime":
{ {
set.set("corpseTime", npc_node.getTextContent()); set.set("corpseTime", npcNode.getTextContent());
break; break;
} }
case "exCrtEffect": case "excrteffect":
{ {
set.set("exCrtEffect", npc_node.getTextContent()); // TODO: Implement me default ? type boolean set.set("exCrtEffect", npcNode.getTextContent()); // TODO: Implement me default ? type boolean
break; break;
} }
case "sNpcPropHpRate": case "snpcprophprate":
{ {
set.set("sNpcPropHpRate", npc_node.getTextContent()); // TODO: Implement me default 1 type double set.set("sNpcPropHpRate", npcNode.getTextContent()); // TODO: Implement me default 1 type double
break; break;
} }
case "ai": case "ai":
@ -371,10 +371,10 @@ public class NpcData implements IGameXmlReader
set.set("dodge", parseInteger(attrs, "dodge")); set.set("dodge", parseInteger(attrs, "dodge"));
set.set("isChaos", parseBoolean(attrs, "isChaos")); set.set("isChaos", parseBoolean(attrs, "isChaos"));
set.set("isAggressive", parseBoolean(attrs, "isAggressive")); set.set("isAggressive", parseBoolean(attrs, "isAggressive"));
for (Node ai_node = npc_node.getFirstChild(); ai_node != null; ai_node = ai_node.getNextSibling()) for (Node aiNode = npcNode.getFirstChild(); aiNode != null; aiNode = aiNode.getNextSibling())
{ {
attrs = ai_node.getAttributes(); attrs = aiNode.getAttributes();
switch (ai_node.getNodeName().toLowerCase()) switch (aiNode.getNodeName().toLowerCase())
{ {
case "skill": case "skill":
{ {
@ -387,12 +387,12 @@ public class NpcData implements IGameXmlReader
set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance")); set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance"));
break; break;
} }
case "clanList": case "clanlist":
{ {
for (Node clan_list_node = ai_node.getFirstChild(); clan_list_node != null; clan_list_node = clan_list_node.getNextSibling()) for (Node clanListNode = aiNode.getFirstChild(); clanListNode != null; clanListNode = clanListNode.getNextSibling())
{ {
attrs = clan_list_node.getAttributes(); attrs = clanListNode.getAttributes();
switch (clan_list_node.getNodeName().toLowerCase()) switch (clanListNode.getNodeName().toLowerCase())
{ {
case "clan": case "clan":
{ {
@ -400,16 +400,16 @@ public class NpcData implements IGameXmlReader
{ {
clans = new HashSet<>(1); clans = new HashSet<>(1);
} }
clans.add(getOrCreateClanId(clan_list_node.getTextContent())); clans.add(getOrCreateClanId(clanListNode.getTextContent()));
break; break;
} }
case "ignoreNpcId": case "ignorenpcid":
{ {
if (ignoreClanNpcIds == null) if (ignoreClanNpcIds == null)
{ {
ignoreClanNpcIds = new HashSet<>(1); ignoreClanNpcIds = new HashSet<>(1);
} }
ignoreClanNpcIds.add(Integer.parseInt(clan_list_node.getTextContent())); ignoreClanNpcIds.add(Integer.parseInt(clanListNode.getTextContent()));
break; break;
} }
} }
@ -420,9 +420,9 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "dropLists": case "droplists":
{ {
for (Node drop_lists_node = npc_node.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling()) for (Node drop_lists_node = npcNode.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling())
{ {
DropType dropType = null; DropType dropType = null;
@ -462,10 +462,10 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "extendDrop": case "extenddrop":
{ {
final List<Integer> extendDrop = new ArrayList<>(); final List<Integer> extendDrop = new ArrayList<>();
forEach(npc_node, "id", idNode -> forEach(npcNode, "id", idNode ->
{ {
extendDrop.add(Integer.parseInt(idNode.getTextContent())); extendDrop.add(Integer.parseInt(idNode.getTextContent()));
}); });
@ -474,10 +474,10 @@ public class NpcData implements IGameXmlReader
} }
case "collision": case "collision":
{ {
for (Node collision_node = npc_node.getFirstChild(); collision_node != null; collision_node = collision_node.getNextSibling()) for (Node collisionNode = npcNode.getFirstChild(); collisionNode != null; collisionNode = collisionNode.getNextSibling())
{ {
attrs = collision_node.getAttributes(); attrs = collisionNode.getAttributes();
switch (collision_node.getNodeName().toLowerCase()) switch (collisionNode.getNodeName().toLowerCase())
{ {
case "radius": case "radius":
{ {

View File

@ -88,11 +88,11 @@ public class NpcData implements IGameXmlReader
{ {
if ("list".equalsIgnoreCase(node.getNodeName())) if ("list".equalsIgnoreCase(node.getNodeName()))
{ {
for (Node list_node = node.getFirstChild(); list_node != null; list_node = list_node.getNextSibling()) for (Node listNode = node.getFirstChild(); listNode != null; listNode = listNode.getNextSibling())
{ {
if ("npc".equalsIgnoreCase(list_node.getNodeName())) if ("npc".equalsIgnoreCase(listNode.getNodeName()))
{ {
NamedNodeMap attrs = list_node.getAttributes(); NamedNodeMap attrs = listNode.getAttributes();
final StatsSet set = new StatsSet(new HashMap<>()); final StatsSet set = new StatsSet(new HashMap<>());
final int npcId = parseInteger(attrs, "id"); final int npcId = parseInteger(attrs, "id");
Map<String, Object> parameters = null; Map<String, Object> parameters = null;
@ -108,10 +108,10 @@ public class NpcData implements IGameXmlReader
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName")); set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title")); set.set("title", parseString(attrs, "title"));
set.set("usingServerSideTitle", parseBoolean(attrs, "usingServerSideTitle")); set.set("usingServerSideTitle", parseBoolean(attrs, "usingServerSideTitle"));
for (Node npc_node = list_node.getFirstChild(); npc_node != null; npc_node = npc_node.getNextSibling()) for (Node npcNode = listNode.getFirstChild(); npcNode != null; npcNode = npcNode.getNextSibling())
{ {
attrs = npc_node.getAttributes(); attrs = npcNode.getAttributes();
switch (npc_node.getNodeName().toLowerCase()) switch (npcNode.getNodeName().toLowerCase())
{ {
case "parameters": case "parameters":
{ {
@ -119,13 +119,13 @@ public class NpcData implements IGameXmlReader
{ {
parameters = new HashMap<>(); parameters = new HashMap<>();
} }
parameters.putAll(parseParameters(npc_node)); parameters.putAll(parseParameters(npcNode));
break; break;
} }
case "race": case "race":
case "sex": case "sex":
{ {
set.set(npc_node.getNodeName(), npc_node.getTextContent().toUpperCase()); set.set(npcNode.getNodeName(), npcNode.getTextContent().toUpperCase());
break; break;
} }
case "equipment": case "equipment":
@ -159,10 +159,10 @@ public class NpcData implements IGameXmlReader
set.set("baseWIT", parseInteger(attrs, "wit")); set.set("baseWIT", parseInteger(attrs, "wit"));
set.set("baseCON", parseInteger(attrs, "con")); set.set("baseCON", parseInteger(attrs, "con"));
set.set("baseMEN", parseInteger(attrs, "men")); set.set("baseMEN", parseInteger(attrs, "men"));
for (Node stats_node = npc_node.getFirstChild(); stats_node != null; stats_node = stats_node.getNextSibling()) for (Node statsNode = npcNode.getFirstChild(); statsNode != null; statsNode = statsNode.getNextSibling())
{ {
attrs = stats_node.getAttributes(); attrs = statsNode.getAttributes();
switch (stats_node.getNodeName().toLowerCase()) switch (statsNode.getNodeName().toLowerCase())
{ {
case "vitals": case "vitals":
{ {
@ -204,7 +204,7 @@ public class NpcData implements IGameXmlReader
} }
case "attribute": case "attribute":
{ {
for (Node attribute_node = stats_node.getFirstChild(); attribute_node != null; attribute_node = attribute_node.getNextSibling()) for (Node attribute_node = statsNode.getFirstChild(); attribute_node != null; attribute_node = attribute_node.getNextSibling())
{ {
attrs = attribute_node.getAttributes(); attrs = attribute_node.getAttributes();
switch (attribute_node.getNodeName().toLowerCase()) switch (attribute_node.getNodeName().toLowerCase())
@ -264,10 +264,10 @@ public class NpcData implements IGameXmlReader
} }
case "speed": case "speed":
{ {
for (Node speed_node = stats_node.getFirstChild(); speed_node != null; speed_node = speed_node.getNextSibling()) for (Node speedNode = statsNode.getFirstChild(); speedNode != null; speedNode = speedNode.getNextSibling())
{ {
attrs = speed_node.getAttributes(); attrs = speedNode.getAttributes();
switch (speed_node.getNodeName().toLowerCase()) switch (speedNode.getNodeName().toLowerCase())
{ {
case "walk": case "walk":
{ {
@ -287,9 +287,9 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "hitTime": case "hittime":
{ {
set.set("hitTime", npc_node.getTextContent()); // TODO: Implement me default 600 (value in ms) set.set("hitTime", npcNode.getTextContent()); // TODO: Implement me default 600 (value in ms)
break; break;
} }
} }
@ -317,14 +317,14 @@ public class NpcData implements IGameXmlReader
set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable")); set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable"));
break; break;
} }
case "skillList": case "skilllist":
{ {
skills = new HashMap<>(); skills = new HashMap<>();
for (Node skill_list_node = npc_node.getFirstChild(); skill_list_node != null; skill_list_node = skill_list_node.getNextSibling()) for (Node skillListNode = npcNode.getFirstChild(); skillListNode != null; skillListNode = skillListNode.getNextSibling())
{ {
if ("skill".equalsIgnoreCase(skill_list_node.getNodeName())) if ("skill".equalsIgnoreCase(skillListNode.getNodeName()))
{ {
attrs = skill_list_node.getAttributes(); attrs = skillListNode.getAttributes();
final int skillId = parseInteger(attrs, "id"); final int skillId = parseInteger(attrs, "id");
final int skillLevel = parseInteger(attrs, "level"); final int skillLevel = parseInteger(attrs, "level");
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
@ -348,19 +348,19 @@ public class NpcData implements IGameXmlReader
set.set("spiritShotChance", parseInteger(attrs, "spiritChance")); set.set("spiritShotChance", parseInteger(attrs, "spiritChance"));
break; break;
} }
case "corpseTime": case "corpsetime":
{ {
set.set("corpseTime", npc_node.getTextContent()); set.set("corpseTime", npcNode.getTextContent());
break; break;
} }
case "exCrtEffect": case "excrteffect":
{ {
set.set("exCrtEffect", npc_node.getTextContent()); // TODO: Implement me default ? type boolean set.set("exCrtEffect", npcNode.getTextContent()); // TODO: Implement me default ? type boolean
break; break;
} }
case "sNpcPropHpRate": case "snpcprophprate":
{ {
set.set("sNpcPropHpRate", npc_node.getTextContent()); // TODO: Implement me default 1 type double set.set("sNpcPropHpRate", npcNode.getTextContent()); // TODO: Implement me default 1 type double
break; break;
} }
case "ai": case "ai":
@ -371,10 +371,10 @@ public class NpcData implements IGameXmlReader
set.set("dodge", parseInteger(attrs, "dodge")); set.set("dodge", parseInteger(attrs, "dodge"));
set.set("isChaos", parseBoolean(attrs, "isChaos")); set.set("isChaos", parseBoolean(attrs, "isChaos"));
set.set("isAggressive", parseBoolean(attrs, "isAggressive")); set.set("isAggressive", parseBoolean(attrs, "isAggressive"));
for (Node ai_node = npc_node.getFirstChild(); ai_node != null; ai_node = ai_node.getNextSibling()) for (Node aiNode = npcNode.getFirstChild(); aiNode != null; aiNode = aiNode.getNextSibling())
{ {
attrs = ai_node.getAttributes(); attrs = aiNode.getAttributes();
switch (ai_node.getNodeName().toLowerCase()) switch (aiNode.getNodeName().toLowerCase())
{ {
case "skill": case "skill":
{ {
@ -387,12 +387,12 @@ public class NpcData implements IGameXmlReader
set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance")); set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance"));
break; break;
} }
case "clanList": case "clanlist":
{ {
for (Node clan_list_node = ai_node.getFirstChild(); clan_list_node != null; clan_list_node = clan_list_node.getNextSibling()) for (Node clanListNode = aiNode.getFirstChild(); clanListNode != null; clanListNode = clanListNode.getNextSibling())
{ {
attrs = clan_list_node.getAttributes(); attrs = clanListNode.getAttributes();
switch (clan_list_node.getNodeName().toLowerCase()) switch (clanListNode.getNodeName().toLowerCase())
{ {
case "clan": case "clan":
{ {
@ -400,16 +400,16 @@ public class NpcData implements IGameXmlReader
{ {
clans = new HashSet<>(1); clans = new HashSet<>(1);
} }
clans.add(getOrCreateClanId(clan_list_node.getTextContent())); clans.add(getOrCreateClanId(clanListNode.getTextContent()));
break; break;
} }
case "ignoreNpcId": case "ignorenpcid":
{ {
if (ignoreClanNpcIds == null) if (ignoreClanNpcIds == null)
{ {
ignoreClanNpcIds = new HashSet<>(1); ignoreClanNpcIds = new HashSet<>(1);
} }
ignoreClanNpcIds.add(Integer.parseInt(clan_list_node.getTextContent())); ignoreClanNpcIds.add(Integer.parseInt(clanListNode.getTextContent()));
break; break;
} }
} }
@ -420,9 +420,9 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "dropLists": case "droplists":
{ {
for (Node drop_lists_node = npc_node.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling()) for (Node drop_lists_node = npcNode.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling())
{ {
DropType dropType = null; DropType dropType = null;
@ -462,10 +462,10 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "extendDrop": case "extenddrop":
{ {
final List<Integer> extendDrop = new ArrayList<>(); final List<Integer> extendDrop = new ArrayList<>();
forEach(npc_node, "id", idNode -> forEach(npcNode, "id", idNode ->
{ {
extendDrop.add(Integer.parseInt(idNode.getTextContent())); extendDrop.add(Integer.parseInt(idNode.getTextContent()));
}); });
@ -474,10 +474,10 @@ public class NpcData implements IGameXmlReader
} }
case "collision": case "collision":
{ {
for (Node collision_node = npc_node.getFirstChild(); collision_node != null; collision_node = collision_node.getNextSibling()) for (Node collisionNode = npcNode.getFirstChild(); collisionNode != null; collisionNode = collisionNode.getNextSibling())
{ {
attrs = collision_node.getAttributes(); attrs = collisionNode.getAttributes();
switch (collision_node.getNodeName().toLowerCase()) switch (collisionNode.getNodeName().toLowerCase())
{ {
case "radius": case "radius":
{ {

View File

@ -88,11 +88,11 @@ public class NpcData implements IGameXmlReader
{ {
if ("list".equalsIgnoreCase(node.getNodeName())) if ("list".equalsIgnoreCase(node.getNodeName()))
{ {
for (Node list_node = node.getFirstChild(); list_node != null; list_node = list_node.getNextSibling()) for (Node listNode = node.getFirstChild(); listNode != null; listNode = listNode.getNextSibling())
{ {
if ("npc".equalsIgnoreCase(list_node.getNodeName())) if ("npc".equalsIgnoreCase(listNode.getNodeName()))
{ {
NamedNodeMap attrs = list_node.getAttributes(); NamedNodeMap attrs = listNode.getAttributes();
final StatsSet set = new StatsSet(new HashMap<>()); final StatsSet set = new StatsSet(new HashMap<>());
final int npcId = parseInteger(attrs, "id"); final int npcId = parseInteger(attrs, "id");
Map<String, Object> parameters = null; Map<String, Object> parameters = null;
@ -108,10 +108,10 @@ public class NpcData implements IGameXmlReader
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName")); set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title")); set.set("title", parseString(attrs, "title"));
set.set("usingServerSideTitle", parseBoolean(attrs, "usingServerSideTitle")); set.set("usingServerSideTitle", parseBoolean(attrs, "usingServerSideTitle"));
for (Node npc_node = list_node.getFirstChild(); npc_node != null; npc_node = npc_node.getNextSibling()) for (Node npcNode = listNode.getFirstChild(); npcNode != null; npcNode = npcNode.getNextSibling())
{ {
attrs = npc_node.getAttributes(); attrs = npcNode.getAttributes();
switch (npc_node.getNodeName().toLowerCase()) switch (npcNode.getNodeName().toLowerCase())
{ {
case "parameters": case "parameters":
{ {
@ -119,13 +119,13 @@ public class NpcData implements IGameXmlReader
{ {
parameters = new HashMap<>(); parameters = new HashMap<>();
} }
parameters.putAll(parseParameters(npc_node)); parameters.putAll(parseParameters(npcNode));
break; break;
} }
case "race": case "race":
case "sex": case "sex":
{ {
set.set(npc_node.getNodeName(), npc_node.getTextContent().toUpperCase()); set.set(npcNode.getNodeName(), npcNode.getTextContent().toUpperCase());
break; break;
} }
case "equipment": case "equipment":
@ -159,10 +159,10 @@ public class NpcData implements IGameXmlReader
set.set("baseWIT", parseInteger(attrs, "wit")); set.set("baseWIT", parseInteger(attrs, "wit"));
set.set("baseCON", parseInteger(attrs, "con")); set.set("baseCON", parseInteger(attrs, "con"));
set.set("baseMEN", parseInteger(attrs, "men")); set.set("baseMEN", parseInteger(attrs, "men"));
for (Node stats_node = npc_node.getFirstChild(); stats_node != null; stats_node = stats_node.getNextSibling()) for (Node statsNode = npcNode.getFirstChild(); statsNode != null; statsNode = statsNode.getNextSibling())
{ {
attrs = stats_node.getAttributes(); attrs = statsNode.getAttributes();
switch (stats_node.getNodeName().toLowerCase()) switch (statsNode.getNodeName().toLowerCase())
{ {
case "vitals": case "vitals":
{ {
@ -204,7 +204,7 @@ public class NpcData implements IGameXmlReader
} }
case "attribute": case "attribute":
{ {
for (Node attribute_node = stats_node.getFirstChild(); attribute_node != null; attribute_node = attribute_node.getNextSibling()) for (Node attribute_node = statsNode.getFirstChild(); attribute_node != null; attribute_node = attribute_node.getNextSibling())
{ {
attrs = attribute_node.getAttributes(); attrs = attribute_node.getAttributes();
switch (attribute_node.getNodeName().toLowerCase()) switch (attribute_node.getNodeName().toLowerCase())
@ -264,10 +264,10 @@ public class NpcData implements IGameXmlReader
} }
case "speed": case "speed":
{ {
for (Node speed_node = stats_node.getFirstChild(); speed_node != null; speed_node = speed_node.getNextSibling()) for (Node speedNode = statsNode.getFirstChild(); speedNode != null; speedNode = speedNode.getNextSibling())
{ {
attrs = speed_node.getAttributes(); attrs = speedNode.getAttributes();
switch (speed_node.getNodeName().toLowerCase()) switch (speedNode.getNodeName().toLowerCase())
{ {
case "walk": case "walk":
{ {
@ -287,9 +287,9 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "hitTime": case "hittime":
{ {
set.set("hitTime", npc_node.getTextContent()); // TODO: Implement me default 600 (value in ms) set.set("hitTime", npcNode.getTextContent()); // TODO: Implement me default 600 (value in ms)
break; break;
} }
} }
@ -317,14 +317,14 @@ public class NpcData implements IGameXmlReader
set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable")); set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable"));
break; break;
} }
case "skillList": case "skilllist":
{ {
skills = new HashMap<>(); skills = new HashMap<>();
for (Node skill_list_node = npc_node.getFirstChild(); skill_list_node != null; skill_list_node = skill_list_node.getNextSibling()) for (Node skillListNode = npcNode.getFirstChild(); skillListNode != null; skillListNode = skillListNode.getNextSibling())
{ {
if ("skill".equalsIgnoreCase(skill_list_node.getNodeName())) if ("skill".equalsIgnoreCase(skillListNode.getNodeName()))
{ {
attrs = skill_list_node.getAttributes(); attrs = skillListNode.getAttributes();
final int skillId = parseInteger(attrs, "id"); final int skillId = parseInteger(attrs, "id");
final int skillLevel = parseInteger(attrs, "level"); final int skillLevel = parseInteger(attrs, "level");
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
@ -348,19 +348,19 @@ public class NpcData implements IGameXmlReader
set.set("spiritShotChance", parseInteger(attrs, "spiritChance")); set.set("spiritShotChance", parseInteger(attrs, "spiritChance"));
break; break;
} }
case "corpseTime": case "corpsetime":
{ {
set.set("corpseTime", npc_node.getTextContent()); set.set("corpseTime", npcNode.getTextContent());
break; break;
} }
case "exCrtEffect": case "excrteffect":
{ {
set.set("exCrtEffect", npc_node.getTextContent()); // TODO: Implement me default ? type boolean set.set("exCrtEffect", npcNode.getTextContent()); // TODO: Implement me default ? type boolean
break; break;
} }
case "sNpcPropHpRate": case "snpcprophprate":
{ {
set.set("sNpcPropHpRate", npc_node.getTextContent()); // TODO: Implement me default 1 type double set.set("sNpcPropHpRate", npcNode.getTextContent()); // TODO: Implement me default 1 type double
break; break;
} }
case "ai": case "ai":
@ -371,10 +371,10 @@ public class NpcData implements IGameXmlReader
set.set("dodge", parseInteger(attrs, "dodge")); set.set("dodge", parseInteger(attrs, "dodge"));
set.set("isChaos", parseBoolean(attrs, "isChaos")); set.set("isChaos", parseBoolean(attrs, "isChaos"));
set.set("isAggressive", parseBoolean(attrs, "isAggressive")); set.set("isAggressive", parseBoolean(attrs, "isAggressive"));
for (Node ai_node = npc_node.getFirstChild(); ai_node != null; ai_node = ai_node.getNextSibling()) for (Node aiNode = npcNode.getFirstChild(); aiNode != null; aiNode = aiNode.getNextSibling())
{ {
attrs = ai_node.getAttributes(); attrs = aiNode.getAttributes();
switch (ai_node.getNodeName().toLowerCase()) switch (aiNode.getNodeName().toLowerCase())
{ {
case "skill": case "skill":
{ {
@ -387,12 +387,12 @@ public class NpcData implements IGameXmlReader
set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance")); set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance"));
break; break;
} }
case "clanList": case "clanlist":
{ {
for (Node clan_list_node = ai_node.getFirstChild(); clan_list_node != null; clan_list_node = clan_list_node.getNextSibling()) for (Node clanListNode = aiNode.getFirstChild(); clanListNode != null; clanListNode = clanListNode.getNextSibling())
{ {
attrs = clan_list_node.getAttributes(); attrs = clanListNode.getAttributes();
switch (clan_list_node.getNodeName().toLowerCase()) switch (clanListNode.getNodeName().toLowerCase())
{ {
case "clan": case "clan":
{ {
@ -400,16 +400,16 @@ public class NpcData implements IGameXmlReader
{ {
clans = new HashSet<>(1); clans = new HashSet<>(1);
} }
clans.add(getOrCreateClanId(clan_list_node.getTextContent())); clans.add(getOrCreateClanId(clanListNode.getTextContent()));
break; break;
} }
case "ignoreNpcId": case "ignorenpcid":
{ {
if (ignoreClanNpcIds == null) if (ignoreClanNpcIds == null)
{ {
ignoreClanNpcIds = new HashSet<>(1); ignoreClanNpcIds = new HashSet<>(1);
} }
ignoreClanNpcIds.add(Integer.parseInt(clan_list_node.getTextContent())); ignoreClanNpcIds.add(Integer.parseInt(clanListNode.getTextContent()));
break; break;
} }
} }
@ -420,9 +420,9 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "dropLists": case "droplists":
{ {
for (Node drop_lists_node = npc_node.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling()) for (Node drop_lists_node = npcNode.getFirstChild(); drop_lists_node != null; drop_lists_node = drop_lists_node.getNextSibling())
{ {
DropType dropType = null; DropType dropType = null;
@ -462,10 +462,10 @@ public class NpcData implements IGameXmlReader
} }
break; break;
} }
case "extendDrop": case "extenddrop":
{ {
final List<Integer> extendDrop = new ArrayList<>(); final List<Integer> extendDrop = new ArrayList<>();
forEach(npc_node, "id", idNode -> forEach(npcNode, "id", idNode ->
{ {
extendDrop.add(Integer.parseInt(idNode.getTextContent())); extendDrop.add(Integer.parseInt(idNode.getTextContent()));
}); });
@ -474,10 +474,10 @@ public class NpcData implements IGameXmlReader
} }
case "collision": case "collision":
{ {
for (Node collision_node = npc_node.getFirstChild(); collision_node != null; collision_node = collision_node.getNextSibling()) for (Node collisionNode = npcNode.getFirstChild(); collisionNode != null; collisionNode = collisionNode.getNextSibling())
{ {
attrs = collision_node.getAttributes(); attrs = collisionNode.getAttributes();
switch (collision_node.getNodeName().toLowerCase()) switch (collisionNode.getNodeName().toLowerCase())
{ {
case "radius": case "radius":
{ {