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()))
{
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 int npcId = parseInteger(attrs, "id");
Map<String, Object> parameters = null;
@ -108,10 +108,10 @@ public class NpcData implements IGameXmlReader
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title"));
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();
switch (npc_node.getNodeName().toLowerCase())
attrs = npcNode.getAttributes();
switch (npcNode.getNodeName().toLowerCase())
{
case "parameters":
{
@ -119,13 +119,13 @@ public class NpcData implements IGameXmlReader
{
parameters = new HashMap<>();
}
parameters.putAll(parseParameters(npc_node));
parameters.putAll(parseParameters(npcNode));
break;
}
case "race":
case "sex":
{
set.set(npc_node.getNodeName(), npc_node.getTextContent().toUpperCase());
set.set(npcNode.getNodeName(), npcNode.getTextContent().toUpperCase());
break;
}
case "equipment":
@ -159,10 +159,10 @@ public class NpcData implements IGameXmlReader
set.set("baseWIT", parseInteger(attrs, "wit"));
set.set("baseCON", parseInteger(attrs, "con"));
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();
switch (stats_node.getNodeName().toLowerCase())
attrs = statsNode.getAttributes();
switch (statsNode.getNodeName().toLowerCase())
{
case "vitals":
{
@ -204,7 +204,7 @@ public class NpcData implements IGameXmlReader
}
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();
switch (attribute_node.getNodeName().toLowerCase())
@ -264,10 +264,10 @@ public class NpcData implements IGameXmlReader
}
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();
switch (speed_node.getNodeName().toLowerCase())
attrs = speedNode.getAttributes();
switch (speedNode.getNodeName().toLowerCase())
{
case "walk":
{
@ -287,9 +287,9 @@ public class NpcData implements IGameXmlReader
}
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;
}
}
@ -317,14 +317,14 @@ public class NpcData implements IGameXmlReader
set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable"));
break;
}
case "skillList":
case "skilllist":
{
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 skillLevel = parseInteger(attrs, "level");
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
@ -348,19 +348,19 @@ public class NpcData implements IGameXmlReader
set.set("spiritShotChance", parseInteger(attrs, "spiritChance"));
break;
}
case "corpseTime":
case "corpsetime":
{
set.set("corpseTime", npc_node.getTextContent());
set.set("corpseTime", npcNode.getTextContent());
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;
}
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;
}
case "ai":
@ -371,10 +371,10 @@ public class NpcData implements IGameXmlReader
set.set("dodge", parseInteger(attrs, "dodge"));
set.set("isChaos", parseBoolean(attrs, "isChaos"));
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();
switch (ai_node.getNodeName().toLowerCase())
attrs = aiNode.getAttributes();
switch (aiNode.getNodeName().toLowerCase())
{
case "skill":
{
@ -387,12 +387,12 @@ public class NpcData implements IGameXmlReader
set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance"));
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();
switch (clan_list_node.getNodeName().toLowerCase())
attrs = clanListNode.getAttributes();
switch (clanListNode.getNodeName().toLowerCase())
{
case "clan":
{
@ -400,16 +400,16 @@ public class NpcData implements IGameXmlReader
{
clans = new HashSet<>(1);
}
clans.add(getOrCreateClanId(clan_list_node.getTextContent()));
clans.add(getOrCreateClanId(clanListNode.getTextContent()));
break;
}
case "ignoreNpcId":
case "ignorenpcid":
{
if (ignoreClanNpcIds == null)
{
ignoreClanNpcIds = new HashSet<>(1);
}
ignoreClanNpcIds.add(Integer.parseInt(clan_list_node.getTextContent()));
ignoreClanNpcIds.add(Integer.parseInt(clanListNode.getTextContent()));
break;
}
}
@ -420,9 +420,9 @@ public class NpcData implements IGameXmlReader
}
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;
@ -461,10 +461,10 @@ public class NpcData implements IGameXmlReader
}
break;
}
case "extendDrop":
case "extenddrop":
{
final List<Integer> extendDrop = new ArrayList<>();
forEach(npc_node, "id", idNode ->
forEach(npcNode, "id", idNode ->
{
extendDrop.add(Integer.parseInt(idNode.getTextContent()));
});
@ -473,10 +473,10 @@ public class NpcData implements IGameXmlReader
}
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();
switch (collision_node.getNodeName().toLowerCase())
attrs = collisionNode.getAttributes();
switch (collisionNode.getNodeName().toLowerCase())
{
case "radius":
{

View File

@ -88,11 +88,11 @@ public class NpcData implements IGameXmlReader
{
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 int npcId = parseInteger(attrs, "id");
Map<String, Object> parameters = null;
@ -108,10 +108,10 @@ public class NpcData implements IGameXmlReader
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title"));
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();
switch (npc_node.getNodeName().toLowerCase())
attrs = npcNode.getAttributes();
switch (npcNode.getNodeName().toLowerCase())
{
case "parameters":
{
@ -119,13 +119,13 @@ public class NpcData implements IGameXmlReader
{
parameters = new HashMap<>();
}
parameters.putAll(parseParameters(npc_node));
parameters.putAll(parseParameters(npcNode));
break;
}
case "race":
case "sex":
{
set.set(npc_node.getNodeName(), npc_node.getTextContent().toUpperCase());
set.set(npcNode.getNodeName(), npcNode.getTextContent().toUpperCase());
break;
}
case "equipment":
@ -159,10 +159,10 @@ public class NpcData implements IGameXmlReader
set.set("baseWIT", parseInteger(attrs, "wit"));
set.set("baseCON", parseInteger(attrs, "con"));
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();
switch (stats_node.getNodeName().toLowerCase())
attrs = statsNode.getAttributes();
switch (statsNode.getNodeName().toLowerCase())
{
case "vitals":
{
@ -204,7 +204,7 @@ public class NpcData implements IGameXmlReader
}
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();
switch (attribute_node.getNodeName().toLowerCase())
@ -264,10 +264,10 @@ public class NpcData implements IGameXmlReader
}
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();
switch (speed_node.getNodeName().toLowerCase())
attrs = speedNode.getAttributes();
switch (speedNode.getNodeName().toLowerCase())
{
case "walk":
{
@ -287,9 +287,9 @@ public class NpcData implements IGameXmlReader
}
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;
}
}
@ -317,14 +317,14 @@ public class NpcData implements IGameXmlReader
set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable"));
break;
}
case "skillList":
case "skilllist":
{
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 skillLevel = parseInteger(attrs, "level");
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
@ -348,19 +348,19 @@ public class NpcData implements IGameXmlReader
set.set("spiritShotChance", parseInteger(attrs, "spiritChance"));
break;
}
case "corpseTime":
case "corpsetime":
{
set.set("corpseTime", npc_node.getTextContent());
set.set("corpseTime", npcNode.getTextContent());
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;
}
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;
}
case "ai":
@ -371,10 +371,10 @@ public class NpcData implements IGameXmlReader
set.set("dodge", parseInteger(attrs, "dodge"));
set.set("isChaos", parseBoolean(attrs, "isChaos"));
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();
switch (ai_node.getNodeName().toLowerCase())
attrs = aiNode.getAttributes();
switch (aiNode.getNodeName().toLowerCase())
{
case "skill":
{
@ -387,12 +387,12 @@ public class NpcData implements IGameXmlReader
set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance"));
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();
switch (clan_list_node.getNodeName().toLowerCase())
attrs = clanListNode.getAttributes();
switch (clanListNode.getNodeName().toLowerCase())
{
case "clan":
{
@ -400,16 +400,16 @@ public class NpcData implements IGameXmlReader
{
clans = new HashSet<>(1);
}
clans.add(getOrCreateClanId(clan_list_node.getTextContent()));
clans.add(getOrCreateClanId(clanListNode.getTextContent()));
break;
}
case "ignoreNpcId":
case "ignorenpcid":
{
if (ignoreClanNpcIds == null)
{
ignoreClanNpcIds = new HashSet<>(1);
}
ignoreClanNpcIds.add(Integer.parseInt(clan_list_node.getTextContent()));
ignoreClanNpcIds.add(Integer.parseInt(clanListNode.getTextContent()));
break;
}
}
@ -420,9 +420,9 @@ public class NpcData implements IGameXmlReader
}
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;
@ -461,10 +461,10 @@ public class NpcData implements IGameXmlReader
}
break;
}
case "extendDrop":
case "extenddrop":
{
final List<Integer> extendDrop = new ArrayList<>();
forEach(npc_node, "id", idNode ->
forEach(npcNode, "id", idNode ->
{
extendDrop.add(Integer.parseInt(idNode.getTextContent()));
});
@ -473,10 +473,10 @@ public class NpcData implements IGameXmlReader
}
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();
switch (collision_node.getNodeName().toLowerCase())
attrs = collisionNode.getAttributes();
switch (collisionNode.getNodeName().toLowerCase())
{
case "radius":
{

View File

@ -88,11 +88,11 @@ public class NpcData implements IGameXmlReader
{
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 int npcId = parseInteger(attrs, "id");
Map<String, Object> parameters = null;
@ -108,10 +108,10 @@ public class NpcData implements IGameXmlReader
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title"));
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();
switch (npc_node.getNodeName().toLowerCase())
attrs = npcNode.getAttributes();
switch (npcNode.getNodeName().toLowerCase())
{
case "parameters":
{
@ -119,13 +119,13 @@ public class NpcData implements IGameXmlReader
{
parameters = new HashMap<>();
}
parameters.putAll(parseParameters(npc_node));
parameters.putAll(parseParameters(npcNode));
break;
}
case "race":
case "sex":
{
set.set(npc_node.getNodeName(), npc_node.getTextContent().toUpperCase());
set.set(npcNode.getNodeName(), npcNode.getTextContent().toUpperCase());
break;
}
case "equipment":
@ -159,10 +159,10 @@ public class NpcData implements IGameXmlReader
set.set("baseWIT", parseInteger(attrs, "wit"));
set.set("baseCON", parseInteger(attrs, "con"));
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();
switch (stats_node.getNodeName().toLowerCase())
attrs = statsNode.getAttributes();
switch (statsNode.getNodeName().toLowerCase())
{
case "vitals":
{
@ -204,7 +204,7 @@ public class NpcData implements IGameXmlReader
}
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();
switch (attribute_node.getNodeName().toLowerCase())
@ -264,10 +264,10 @@ public class NpcData implements IGameXmlReader
}
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();
switch (speed_node.getNodeName().toLowerCase())
attrs = speedNode.getAttributes();
switch (speedNode.getNodeName().toLowerCase())
{
case "walk":
{
@ -287,9 +287,9 @@ public class NpcData implements IGameXmlReader
}
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;
}
}
@ -317,14 +317,14 @@ public class NpcData implements IGameXmlReader
set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable"));
break;
}
case "skillList":
case "skilllist":
{
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 skillLevel = parseInteger(attrs, "level");
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
@ -348,19 +348,19 @@ public class NpcData implements IGameXmlReader
set.set("spiritShotChance", parseInteger(attrs, "spiritChance"));
break;
}
case "corpseTime":
case "corpsetime":
{
set.set("corpseTime", npc_node.getTextContent());
set.set("corpseTime", npcNode.getTextContent());
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;
}
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;
}
case "ai":
@ -371,10 +371,10 @@ public class NpcData implements IGameXmlReader
set.set("dodge", parseInteger(attrs, "dodge"));
set.set("isChaos", parseBoolean(attrs, "isChaos"));
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();
switch (ai_node.getNodeName().toLowerCase())
attrs = aiNode.getAttributes();
switch (aiNode.getNodeName().toLowerCase())
{
case "skill":
{
@ -387,12 +387,12 @@ public class NpcData implements IGameXmlReader
set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance"));
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();
switch (clan_list_node.getNodeName().toLowerCase())
attrs = clanListNode.getAttributes();
switch (clanListNode.getNodeName().toLowerCase())
{
case "clan":
{
@ -400,16 +400,16 @@ public class NpcData implements IGameXmlReader
{
clans = new HashSet<>(1);
}
clans.add(getOrCreateClanId(clan_list_node.getTextContent()));
clans.add(getOrCreateClanId(clanListNode.getTextContent()));
break;
}
case "ignoreNpcId":
case "ignorenpcid":
{
if (ignoreClanNpcIds == null)
{
ignoreClanNpcIds = new HashSet<>(1);
}
ignoreClanNpcIds.add(Integer.parseInt(clan_list_node.getTextContent()));
ignoreClanNpcIds.add(Integer.parseInt(clanListNode.getTextContent()));
break;
}
}
@ -420,9 +420,9 @@ public class NpcData implements IGameXmlReader
}
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;
@ -461,10 +461,10 @@ public class NpcData implements IGameXmlReader
}
break;
}
case "extendDrop":
case "extenddrop":
{
final List<Integer> extendDrop = new ArrayList<>();
forEach(npc_node, "id", idNode ->
forEach(npcNode, "id", idNode ->
{
extendDrop.add(Integer.parseInt(idNode.getTextContent()));
});
@ -473,10 +473,10 @@ public class NpcData implements IGameXmlReader
}
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();
switch (collision_node.getNodeName().toLowerCase())
attrs = collisionNode.getAttributes();
switch (collisionNode.getNodeName().toLowerCase())
{
case "radius":
{

View File

@ -88,11 +88,11 @@ public class NpcData implements IGameXmlReader
{
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 int npcId = parseInteger(attrs, "id");
Map<String, Object> parameters = null;
@ -108,10 +108,10 @@ public class NpcData implements IGameXmlReader
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title"));
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();
switch (npc_node.getNodeName().toLowerCase())
attrs = npcNode.getAttributes();
switch (npcNode.getNodeName().toLowerCase())
{
case "parameters":
{
@ -119,13 +119,13 @@ public class NpcData implements IGameXmlReader
{
parameters = new HashMap<>();
}
parameters.putAll(parseParameters(npc_node));
parameters.putAll(parseParameters(npcNode));
break;
}
case "race":
case "sex":
{
set.set(npc_node.getNodeName(), npc_node.getTextContent().toUpperCase());
set.set(npcNode.getNodeName(), npcNode.getTextContent().toUpperCase());
break;
}
case "equipment":
@ -159,10 +159,10 @@ public class NpcData implements IGameXmlReader
set.set("baseWIT", parseInteger(attrs, "wit"));
set.set("baseCON", parseInteger(attrs, "con"));
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();
switch (stats_node.getNodeName().toLowerCase())
attrs = statsNode.getAttributes();
switch (statsNode.getNodeName().toLowerCase())
{
case "vitals":
{
@ -204,7 +204,7 @@ public class NpcData implements IGameXmlReader
}
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();
switch (attribute_node.getNodeName().toLowerCase())
@ -264,10 +264,10 @@ public class NpcData implements IGameXmlReader
}
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();
switch (speed_node.getNodeName().toLowerCase())
attrs = speedNode.getAttributes();
switch (speedNode.getNodeName().toLowerCase())
{
case "walk":
{
@ -287,9 +287,9 @@ public class NpcData implements IGameXmlReader
}
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;
}
}
@ -317,14 +317,14 @@ public class NpcData implements IGameXmlReader
set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable"));
break;
}
case "skillList":
case "skilllist":
{
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 skillLevel = parseInteger(attrs, "level");
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
@ -348,19 +348,19 @@ public class NpcData implements IGameXmlReader
set.set("spiritShotChance", parseInteger(attrs, "spiritChance"));
break;
}
case "corpseTime":
case "corpsetime":
{
set.set("corpseTime", npc_node.getTextContent());
set.set("corpseTime", npcNode.getTextContent());
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;
}
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;
}
case "ai":
@ -371,10 +371,10 @@ public class NpcData implements IGameXmlReader
set.set("dodge", parseInteger(attrs, "dodge"));
set.set("isChaos", parseBoolean(attrs, "isChaos"));
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();
switch (ai_node.getNodeName().toLowerCase())
attrs = aiNode.getAttributes();
switch (aiNode.getNodeName().toLowerCase())
{
case "skill":
{
@ -387,12 +387,12 @@ public class NpcData implements IGameXmlReader
set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance"));
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();
switch (clan_list_node.getNodeName().toLowerCase())
attrs = clanListNode.getAttributes();
switch (clanListNode.getNodeName().toLowerCase())
{
case "clan":
{
@ -400,16 +400,16 @@ public class NpcData implements IGameXmlReader
{
clans = new HashSet<>(1);
}
clans.add(getOrCreateClanId(clan_list_node.getTextContent()));
clans.add(getOrCreateClanId(clanListNode.getTextContent()));
break;
}
case "ignoreNpcId":
case "ignorenpcid":
{
if (ignoreClanNpcIds == null)
{
ignoreClanNpcIds = new HashSet<>(1);
}
ignoreClanNpcIds.add(Integer.parseInt(clan_list_node.getTextContent()));
ignoreClanNpcIds.add(Integer.parseInt(clanListNode.getTextContent()));
break;
}
}
@ -420,9 +420,9 @@ public class NpcData implements IGameXmlReader
}
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;
@ -461,10 +461,10 @@ public class NpcData implements IGameXmlReader
}
break;
}
case "extendDrop":
case "extenddrop":
{
final List<Integer> extendDrop = new ArrayList<>();
forEach(npc_node, "id", idNode ->
forEach(npcNode, "id", idNode ->
{
extendDrop.add(Integer.parseInt(idNode.getTextContent()));
});
@ -473,10 +473,10 @@ public class NpcData implements IGameXmlReader
}
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();
switch (collision_node.getNodeName().toLowerCase())
attrs = collisionNode.getAttributes();
switch (collisionNode.getNodeName().toLowerCase())
{
case "radius":
{

View File

@ -88,11 +88,11 @@ public class NpcData implements IGameXmlReader
{
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 int npcId = parseInteger(attrs, "id");
Map<String, Object> parameters = null;
@ -108,10 +108,10 @@ public class NpcData implements IGameXmlReader
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title"));
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();
switch (npc_node.getNodeName().toLowerCase())
attrs = npcNode.getAttributes();
switch (npcNode.getNodeName().toLowerCase())
{
case "parameters":
{
@ -119,13 +119,13 @@ public class NpcData implements IGameXmlReader
{
parameters = new HashMap<>();
}
parameters.putAll(parseParameters(npc_node));
parameters.putAll(parseParameters(npcNode));
break;
}
case "race":
case "sex":
{
set.set(npc_node.getNodeName(), npc_node.getTextContent().toUpperCase());
set.set(npcNode.getNodeName(), npcNode.getTextContent().toUpperCase());
break;
}
case "equipment":
@ -159,10 +159,10 @@ public class NpcData implements IGameXmlReader
set.set("baseWIT", parseInteger(attrs, "wit"));
set.set("baseCON", parseInteger(attrs, "con"));
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();
switch (stats_node.getNodeName().toLowerCase())
attrs = statsNode.getAttributes();
switch (statsNode.getNodeName().toLowerCase())
{
case "vitals":
{
@ -204,7 +204,7 @@ public class NpcData implements IGameXmlReader
}
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();
switch (attribute_node.getNodeName().toLowerCase())
@ -264,10 +264,10 @@ public class NpcData implements IGameXmlReader
}
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();
switch (speed_node.getNodeName().toLowerCase())
attrs = speedNode.getAttributes();
switch (speedNode.getNodeName().toLowerCase())
{
case "walk":
{
@ -287,9 +287,9 @@ public class NpcData implements IGameXmlReader
}
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;
}
}
@ -317,14 +317,14 @@ public class NpcData implements IGameXmlReader
set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable"));
break;
}
case "skillList":
case "skilllist":
{
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 skillLevel = parseInteger(attrs, "level");
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
@ -348,19 +348,19 @@ public class NpcData implements IGameXmlReader
set.set("spiritShotChance", parseInteger(attrs, "spiritChance"));
break;
}
case "corpseTime":
case "corpsetime":
{
set.set("corpseTime", npc_node.getTextContent());
set.set("corpseTime", npcNode.getTextContent());
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;
}
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;
}
case "ai":
@ -371,10 +371,10 @@ public class NpcData implements IGameXmlReader
set.set("dodge", parseInteger(attrs, "dodge"));
set.set("isChaos", parseBoolean(attrs, "isChaos"));
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();
switch (ai_node.getNodeName().toLowerCase())
attrs = aiNode.getAttributes();
switch (aiNode.getNodeName().toLowerCase())
{
case "skill":
{
@ -387,12 +387,12 @@ public class NpcData implements IGameXmlReader
set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance"));
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();
switch (clan_list_node.getNodeName().toLowerCase())
attrs = clanListNode.getAttributes();
switch (clanListNode.getNodeName().toLowerCase())
{
case "clan":
{
@ -400,16 +400,16 @@ public class NpcData implements IGameXmlReader
{
clans = new HashSet<>(1);
}
clans.add(getOrCreateClanId(clan_list_node.getTextContent()));
clans.add(getOrCreateClanId(clanListNode.getTextContent()));
break;
}
case "ignoreNpcId":
case "ignorenpcid":
{
if (ignoreClanNpcIds == null)
{
ignoreClanNpcIds = new HashSet<>(1);
}
ignoreClanNpcIds.add(Integer.parseInt(clan_list_node.getTextContent()));
ignoreClanNpcIds.add(Integer.parseInt(clanListNode.getTextContent()));
break;
}
}
@ -420,9 +420,9 @@ public class NpcData implements IGameXmlReader
}
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;
@ -461,10 +461,10 @@ public class NpcData implements IGameXmlReader
}
break;
}
case "extendDrop":
case "extenddrop":
{
final List<Integer> extendDrop = new ArrayList<>();
forEach(npc_node, "id", idNode ->
forEach(npcNode, "id", idNode ->
{
extendDrop.add(Integer.parseInt(idNode.getTextContent()));
});
@ -473,10 +473,10 @@ public class NpcData implements IGameXmlReader
}
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();
switch (collision_node.getNodeName().toLowerCase())
attrs = collisionNode.getAttributes();
switch (collisionNode.getNodeName().toLowerCase())
{
case "radius":
{

View File

@ -88,11 +88,11 @@ public class NpcData implements IGameXmlReader
{
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 int npcId = parseInteger(attrs, "id");
Map<String, Object> parameters = null;
@ -108,10 +108,10 @@ public class NpcData implements IGameXmlReader
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title"));
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();
switch (npc_node.getNodeName().toLowerCase())
attrs = npcNode.getAttributes();
switch (npcNode.getNodeName().toLowerCase())
{
case "parameters":
{
@ -119,13 +119,13 @@ public class NpcData implements IGameXmlReader
{
parameters = new HashMap<>();
}
parameters.putAll(parseParameters(npc_node));
parameters.putAll(parseParameters(npcNode));
break;
}
case "race":
case "sex":
{
set.set(npc_node.getNodeName(), npc_node.getTextContent().toUpperCase());
set.set(npcNode.getNodeName(), npcNode.getTextContent().toUpperCase());
break;
}
case "equipment":
@ -159,10 +159,10 @@ public class NpcData implements IGameXmlReader
set.set("baseWIT", parseInteger(attrs, "wit"));
set.set("baseCON", parseInteger(attrs, "con"));
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();
switch (stats_node.getNodeName().toLowerCase())
attrs = statsNode.getAttributes();
switch (statsNode.getNodeName().toLowerCase())
{
case "vitals":
{
@ -204,7 +204,7 @@ public class NpcData implements IGameXmlReader
}
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();
switch (attribute_node.getNodeName().toLowerCase())
@ -264,10 +264,10 @@ public class NpcData implements IGameXmlReader
}
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();
switch (speed_node.getNodeName().toLowerCase())
attrs = speedNode.getAttributes();
switch (speedNode.getNodeName().toLowerCase())
{
case "walk":
{
@ -287,9 +287,9 @@ public class NpcData implements IGameXmlReader
}
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;
}
}
@ -317,14 +317,14 @@ public class NpcData implements IGameXmlReader
set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable"));
break;
}
case "skillList":
case "skilllist":
{
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 skillLevel = parseInteger(attrs, "level");
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
@ -348,19 +348,19 @@ public class NpcData implements IGameXmlReader
set.set("spiritShotChance", parseInteger(attrs, "spiritChance"));
break;
}
case "corpseTime":
case "corpsetime":
{
set.set("corpseTime", npc_node.getTextContent());
set.set("corpseTime", npcNode.getTextContent());
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;
}
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;
}
case "ai":
@ -371,10 +371,10 @@ public class NpcData implements IGameXmlReader
set.set("dodge", parseInteger(attrs, "dodge"));
set.set("isChaos", parseBoolean(attrs, "isChaos"));
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();
switch (ai_node.getNodeName().toLowerCase())
attrs = aiNode.getAttributes();
switch (aiNode.getNodeName().toLowerCase())
{
case "skill":
{
@ -387,12 +387,12 @@ public class NpcData implements IGameXmlReader
set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance"));
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();
switch (clan_list_node.getNodeName().toLowerCase())
attrs = clanListNode.getAttributes();
switch (clanListNode.getNodeName().toLowerCase())
{
case "clan":
{
@ -400,16 +400,16 @@ public class NpcData implements IGameXmlReader
{
clans = new HashSet<>(1);
}
clans.add(getOrCreateClanId(clan_list_node.getTextContent()));
clans.add(getOrCreateClanId(clanListNode.getTextContent()));
break;
}
case "ignoreNpcId":
case "ignorenpcid":
{
if (ignoreClanNpcIds == null)
{
ignoreClanNpcIds = new HashSet<>(1);
}
ignoreClanNpcIds.add(Integer.parseInt(clan_list_node.getTextContent()));
ignoreClanNpcIds.add(Integer.parseInt(clanListNode.getTextContent()));
break;
}
}
@ -420,9 +420,9 @@ public class NpcData implements IGameXmlReader
}
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;
@ -461,10 +461,10 @@ public class NpcData implements IGameXmlReader
}
break;
}
case "extendDrop":
case "extenddrop":
{
final List<Integer> extendDrop = new ArrayList<>();
forEach(npc_node, "id", idNode ->
forEach(npcNode, "id", idNode ->
{
extendDrop.add(Integer.parseInt(idNode.getTextContent()));
});
@ -473,10 +473,10 @@ public class NpcData implements IGameXmlReader
}
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();
switch (collision_node.getNodeName().toLowerCase())
attrs = collisionNode.getAttributes();
switch (collisionNode.getNodeName().toLowerCase())
{
case "radius":
{

View File

@ -25,7 +25,6 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@ -54,8 +53,8 @@ import com.l2jmobius.gameserver.model.skills.Skill;
*/
public class NpcData implements IGameXmlReader
{
private final Map<Integer, L2NpcTemplate> _npcs = new ConcurrentHashMap<>();
private final Map<String, Integer> _clans = new ConcurrentHashMap<>();
private final Map<Integer, L2NpcTemplate> _npcs = new HashMap<>();
private final Map<String, Integer> _clans = new HashMap<>();
private static final List<Integer> _masterMonsterIDs = new ArrayList<>();
protected NpcData()
@ -286,30 +285,28 @@ public class NpcData implements IGameXmlReader
}
case "speed":
{
for (Node speedNode = statsNode.getFirstChild(); speedNode != null; speedNode = speedNode.getNextSibling())
{
for (Node speedNode = statsNode.getFirstChild(); speedNode != null; speedNode = speedNode.getNextSibling())
attrs = speedNode.getAttributes();
switch (speedNode.getNodeName().toLowerCase())
{
attrs = speedNode.getAttributes();
switch (speedNode.getNodeName().toLowerCase())
case "walk":
{
case "walk":
{
set.set("baseWalkSpd", parseDouble(attrs, "ground"));
set.set("baseSwimWalkSpd", parseDouble(attrs, "swim"));
set.set("baseFlyWalkSpd", parseDouble(attrs, "fly"));
break;
}
case "run":
{
set.set("baseRunSpd", parseDouble(attrs, "ground"));
set.set("baseSwimRunSpd", parseDouble(attrs, "swim"));
set.set("baseFlyRunSpd", parseDouble(attrs, "fly"));
break;
}
set.set("baseWalkSpd", parseDouble(attrs, "ground"));
set.set("baseSwimWalkSpd", parseDouble(attrs, "swim"));
set.set("baseFlyWalkSpd", parseDouble(attrs, "fly"));
break;
}
case "run":
{
set.set("baseRunSpd", parseDouble(attrs, "ground"));
set.set("baseSwimRunSpd", parseDouble(attrs, "swim"));
set.set("baseFlyRunSpd", parseDouble(attrs, "fly"));
break;
}
}
break;
}
break;
}
case "hittime":
{

View File

@ -88,11 +88,11 @@ public class NpcData implements IGameXmlReader
{
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 int npcId = parseInteger(attrs, "id");
Map<String, Object> parameters = null;
@ -108,10 +108,10 @@ public class NpcData implements IGameXmlReader
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title"));
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();
switch (npc_node.getNodeName().toLowerCase())
attrs = npcNode.getAttributes();
switch (npcNode.getNodeName().toLowerCase())
{
case "parameters":
{
@ -119,13 +119,13 @@ public class NpcData implements IGameXmlReader
{
parameters = new HashMap<>();
}
parameters.putAll(parseParameters(npc_node));
parameters.putAll(parseParameters(npcNode));
break;
}
case "race":
case "sex":
{
set.set(npc_node.getNodeName(), npc_node.getTextContent().toUpperCase());
set.set(npcNode.getNodeName(), npcNode.getTextContent().toUpperCase());
break;
}
case "equipment":
@ -159,10 +159,10 @@ public class NpcData implements IGameXmlReader
set.set("baseWIT", parseInteger(attrs, "wit"));
set.set("baseCON", parseInteger(attrs, "con"));
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();
switch (stats_node.getNodeName().toLowerCase())
attrs = statsNode.getAttributes();
switch (statsNode.getNodeName().toLowerCase())
{
case "vitals":
{
@ -204,7 +204,7 @@ public class NpcData implements IGameXmlReader
}
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();
switch (attribute_node.getNodeName().toLowerCase())
@ -264,10 +264,10 @@ public class NpcData implements IGameXmlReader
}
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();
switch (speed_node.getNodeName().toLowerCase())
attrs = speedNode.getAttributes();
switch (speedNode.getNodeName().toLowerCase())
{
case "walk":
{
@ -287,9 +287,9 @@ public class NpcData implements IGameXmlReader
}
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;
}
}
@ -317,14 +317,14 @@ public class NpcData implements IGameXmlReader
set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable"));
break;
}
case "skillList":
case "skilllist":
{
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 skillLevel = parseInteger(attrs, "level");
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
@ -348,19 +348,19 @@ public class NpcData implements IGameXmlReader
set.set("spiritShotChance", parseInteger(attrs, "spiritChance"));
break;
}
case "corpseTime":
case "corpsetime":
{
set.set("corpseTime", npc_node.getTextContent());
set.set("corpseTime", npcNode.getTextContent());
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;
}
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;
}
case "ai":
@ -371,10 +371,10 @@ public class NpcData implements IGameXmlReader
set.set("dodge", parseInteger(attrs, "dodge"));
set.set("isChaos", parseBoolean(attrs, "isChaos"));
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();
switch (ai_node.getNodeName().toLowerCase())
attrs = aiNode.getAttributes();
switch (aiNode.getNodeName().toLowerCase())
{
case "skill":
{
@ -387,12 +387,12 @@ public class NpcData implements IGameXmlReader
set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance"));
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();
switch (clan_list_node.getNodeName().toLowerCase())
attrs = clanListNode.getAttributes();
switch (clanListNode.getNodeName().toLowerCase())
{
case "clan":
{
@ -400,16 +400,16 @@ public class NpcData implements IGameXmlReader
{
clans = new HashSet<>(1);
}
clans.add(getOrCreateClanId(clan_list_node.getTextContent()));
clans.add(getOrCreateClanId(clanListNode.getTextContent()));
break;
}
case "ignoreNpcId":
case "ignorenpcid":
{
if (ignoreClanNpcIds == null)
{
ignoreClanNpcIds = new HashSet<>(1);
}
ignoreClanNpcIds.add(Integer.parseInt(clan_list_node.getTextContent()));
ignoreClanNpcIds.add(Integer.parseInt(clanListNode.getTextContent()));
break;
}
}
@ -420,9 +420,9 @@ public class NpcData implements IGameXmlReader
}
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;
@ -462,10 +462,10 @@ public class NpcData implements IGameXmlReader
}
break;
}
case "extendDrop":
case "extenddrop":
{
final List<Integer> extendDrop = new ArrayList<>();
forEach(npc_node, "id", idNode ->
forEach(npcNode, "id", idNode ->
{
extendDrop.add(Integer.parseInt(idNode.getTextContent()));
});
@ -474,10 +474,10 @@ public class NpcData implements IGameXmlReader
}
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();
switch (collision_node.getNodeName().toLowerCase())
attrs = collisionNode.getAttributes();
switch (collisionNode.getNodeName().toLowerCase())
{
case "radius":
{

View File

@ -88,11 +88,11 @@ public class NpcData implements IGameXmlReader
{
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 int npcId = parseInteger(attrs, "id");
Map<String, Object> parameters = null;
@ -108,10 +108,10 @@ public class NpcData implements IGameXmlReader
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title"));
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();
switch (npc_node.getNodeName().toLowerCase())
attrs = npcNode.getAttributes();
switch (npcNode.getNodeName().toLowerCase())
{
case "parameters":
{
@ -119,13 +119,13 @@ public class NpcData implements IGameXmlReader
{
parameters = new HashMap<>();
}
parameters.putAll(parseParameters(npc_node));
parameters.putAll(parseParameters(npcNode));
break;
}
case "race":
case "sex":
{
set.set(npc_node.getNodeName(), npc_node.getTextContent().toUpperCase());
set.set(npcNode.getNodeName(), npcNode.getTextContent().toUpperCase());
break;
}
case "equipment":
@ -159,10 +159,10 @@ public class NpcData implements IGameXmlReader
set.set("baseWIT", parseInteger(attrs, "wit"));
set.set("baseCON", parseInteger(attrs, "con"));
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();
switch (stats_node.getNodeName().toLowerCase())
attrs = statsNode.getAttributes();
switch (statsNode.getNodeName().toLowerCase())
{
case "vitals":
{
@ -204,7 +204,7 @@ public class NpcData implements IGameXmlReader
}
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();
switch (attribute_node.getNodeName().toLowerCase())
@ -264,10 +264,10 @@ public class NpcData implements IGameXmlReader
}
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();
switch (speed_node.getNodeName().toLowerCase())
attrs = speedNode.getAttributes();
switch (speedNode.getNodeName().toLowerCase())
{
case "walk":
{
@ -287,9 +287,9 @@ public class NpcData implements IGameXmlReader
}
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;
}
}
@ -317,14 +317,14 @@ public class NpcData implements IGameXmlReader
set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable"));
break;
}
case "skillList":
case "skilllist":
{
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 skillLevel = parseInteger(attrs, "level");
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
@ -348,19 +348,19 @@ public class NpcData implements IGameXmlReader
set.set("spiritShotChance", parseInteger(attrs, "spiritChance"));
break;
}
case "corpseTime":
case "corpsetime":
{
set.set("corpseTime", npc_node.getTextContent());
set.set("corpseTime", npcNode.getTextContent());
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;
}
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;
}
case "ai":
@ -371,10 +371,10 @@ public class NpcData implements IGameXmlReader
set.set("dodge", parseInteger(attrs, "dodge"));
set.set("isChaos", parseBoolean(attrs, "isChaos"));
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();
switch (ai_node.getNodeName().toLowerCase())
attrs = aiNode.getAttributes();
switch (aiNode.getNodeName().toLowerCase())
{
case "skill":
{
@ -387,12 +387,12 @@ public class NpcData implements IGameXmlReader
set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance"));
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();
switch (clan_list_node.getNodeName().toLowerCase())
attrs = clanListNode.getAttributes();
switch (clanListNode.getNodeName().toLowerCase())
{
case "clan":
{
@ -400,16 +400,16 @@ public class NpcData implements IGameXmlReader
{
clans = new HashSet<>(1);
}
clans.add(getOrCreateClanId(clan_list_node.getTextContent()));
clans.add(getOrCreateClanId(clanListNode.getTextContent()));
break;
}
case "ignoreNpcId":
case "ignorenpcid":
{
if (ignoreClanNpcIds == null)
{
ignoreClanNpcIds = new HashSet<>(1);
}
ignoreClanNpcIds.add(Integer.parseInt(clan_list_node.getTextContent()));
ignoreClanNpcIds.add(Integer.parseInt(clanListNode.getTextContent()));
break;
}
}
@ -420,9 +420,9 @@ public class NpcData implements IGameXmlReader
}
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;
@ -462,10 +462,10 @@ public class NpcData implements IGameXmlReader
}
break;
}
case "extendDrop":
case "extenddrop":
{
final List<Integer> extendDrop = new ArrayList<>();
forEach(npc_node, "id", idNode ->
forEach(npcNode, "id", idNode ->
{
extendDrop.add(Integer.parseInt(idNode.getTextContent()));
});
@ -474,10 +474,10 @@ public class NpcData implements IGameXmlReader
}
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();
switch (collision_node.getNodeName().toLowerCase())
attrs = collisionNode.getAttributes();
switch (collisionNode.getNodeName().toLowerCase())
{
case "radius":
{

View File

@ -88,11 +88,11 @@ public class NpcData implements IGameXmlReader
{
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 int npcId = parseInteger(attrs, "id");
Map<String, Object> parameters = null;
@ -108,10 +108,10 @@ public class NpcData implements IGameXmlReader
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title"));
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();
switch (npc_node.getNodeName().toLowerCase())
attrs = npcNode.getAttributes();
switch (npcNode.getNodeName().toLowerCase())
{
case "parameters":
{
@ -119,13 +119,13 @@ public class NpcData implements IGameXmlReader
{
parameters = new HashMap<>();
}
parameters.putAll(parseParameters(npc_node));
parameters.putAll(parseParameters(npcNode));
break;
}
case "race":
case "sex":
{
set.set(npc_node.getNodeName(), npc_node.getTextContent().toUpperCase());
set.set(npcNode.getNodeName(), npcNode.getTextContent().toUpperCase());
break;
}
case "equipment":
@ -159,10 +159,10 @@ public class NpcData implements IGameXmlReader
set.set("baseWIT", parseInteger(attrs, "wit"));
set.set("baseCON", parseInteger(attrs, "con"));
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();
switch (stats_node.getNodeName().toLowerCase())
attrs = statsNode.getAttributes();
switch (statsNode.getNodeName().toLowerCase())
{
case "vitals":
{
@ -204,7 +204,7 @@ public class NpcData implements IGameXmlReader
}
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();
switch (attribute_node.getNodeName().toLowerCase())
@ -264,10 +264,10 @@ public class NpcData implements IGameXmlReader
}
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();
switch (speed_node.getNodeName().toLowerCase())
attrs = speedNode.getAttributes();
switch (speedNode.getNodeName().toLowerCase())
{
case "walk":
{
@ -287,9 +287,9 @@ public class NpcData implements IGameXmlReader
}
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;
}
}
@ -317,14 +317,14 @@ public class NpcData implements IGameXmlReader
set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable"));
break;
}
case "skillList":
case "skilllist":
{
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 skillLevel = parseInteger(attrs, "level");
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
@ -348,19 +348,19 @@ public class NpcData implements IGameXmlReader
set.set("spiritShotChance", parseInteger(attrs, "spiritChance"));
break;
}
case "corpseTime":
case "corpsetime":
{
set.set("corpseTime", npc_node.getTextContent());
set.set("corpseTime", npcNode.getTextContent());
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;
}
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;
}
case "ai":
@ -371,10 +371,10 @@ public class NpcData implements IGameXmlReader
set.set("dodge", parseInteger(attrs, "dodge"));
set.set("isChaos", parseBoolean(attrs, "isChaos"));
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();
switch (ai_node.getNodeName().toLowerCase())
attrs = aiNode.getAttributes();
switch (aiNode.getNodeName().toLowerCase())
{
case "skill":
{
@ -387,12 +387,12 @@ public class NpcData implements IGameXmlReader
set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance"));
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();
switch (clan_list_node.getNodeName().toLowerCase())
attrs = clanListNode.getAttributes();
switch (clanListNode.getNodeName().toLowerCase())
{
case "clan":
{
@ -400,16 +400,16 @@ public class NpcData implements IGameXmlReader
{
clans = new HashSet<>(1);
}
clans.add(getOrCreateClanId(clan_list_node.getTextContent()));
clans.add(getOrCreateClanId(clanListNode.getTextContent()));
break;
}
case "ignoreNpcId":
case "ignorenpcid":
{
if (ignoreClanNpcIds == null)
{
ignoreClanNpcIds = new HashSet<>(1);
}
ignoreClanNpcIds.add(Integer.parseInt(clan_list_node.getTextContent()));
ignoreClanNpcIds.add(Integer.parseInt(clanListNode.getTextContent()));
break;
}
}
@ -420,9 +420,9 @@ public class NpcData implements IGameXmlReader
}
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;
@ -462,10 +462,10 @@ public class NpcData implements IGameXmlReader
}
break;
}
case "extendDrop":
case "extenddrop":
{
final List<Integer> extendDrop = new ArrayList<>();
forEach(npc_node, "id", idNode ->
forEach(npcNode, "id", idNode ->
{
extendDrop.add(Integer.parseInt(idNode.getTextContent()));
});
@ -474,10 +474,10 @@ public class NpcData implements IGameXmlReader
}
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();
switch (collision_node.getNodeName().toLowerCase())
attrs = collisionNode.getAttributes();
switch (collisionNode.getNodeName().toLowerCase())
{
case "radius":
{

View File

@ -88,11 +88,11 @@ public class NpcData implements IGameXmlReader
{
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 int npcId = parseInteger(attrs, "id");
Map<String, Object> parameters = null;
@ -108,10 +108,10 @@ public class NpcData implements IGameXmlReader
set.set("usingServerSideName", parseBoolean(attrs, "usingServerSideName"));
set.set("title", parseString(attrs, "title"));
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();
switch (npc_node.getNodeName().toLowerCase())
attrs = npcNode.getAttributes();
switch (npcNode.getNodeName().toLowerCase())
{
case "parameters":
{
@ -119,13 +119,13 @@ public class NpcData implements IGameXmlReader
{
parameters = new HashMap<>();
}
parameters.putAll(parseParameters(npc_node));
parameters.putAll(parseParameters(npcNode));
break;
}
case "race":
case "sex":
{
set.set(npc_node.getNodeName(), npc_node.getTextContent().toUpperCase());
set.set(npcNode.getNodeName(), npcNode.getTextContent().toUpperCase());
break;
}
case "equipment":
@ -159,10 +159,10 @@ public class NpcData implements IGameXmlReader
set.set("baseWIT", parseInteger(attrs, "wit"));
set.set("baseCON", parseInteger(attrs, "con"));
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();
switch (stats_node.getNodeName().toLowerCase())
attrs = statsNode.getAttributes();
switch (statsNode.getNodeName().toLowerCase())
{
case "vitals":
{
@ -204,7 +204,7 @@ public class NpcData implements IGameXmlReader
}
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();
switch (attribute_node.getNodeName().toLowerCase())
@ -264,10 +264,10 @@ public class NpcData implements IGameXmlReader
}
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();
switch (speed_node.getNodeName().toLowerCase())
attrs = speedNode.getAttributes();
switch (speedNode.getNodeName().toLowerCase())
{
case "walk":
{
@ -287,9 +287,9 @@ public class NpcData implements IGameXmlReader
}
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;
}
}
@ -317,14 +317,14 @@ public class NpcData implements IGameXmlReader
set.set("fakePlayerTalkable", parseBoolean(attrs, "fakePlayerTalkable"));
break;
}
case "skillList":
case "skilllist":
{
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 skillLevel = parseInteger(attrs, "level");
final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel);
@ -348,19 +348,19 @@ public class NpcData implements IGameXmlReader
set.set("spiritShotChance", parseInteger(attrs, "spiritChance"));
break;
}
case "corpseTime":
case "corpsetime":
{
set.set("corpseTime", npc_node.getTextContent());
set.set("corpseTime", npcNode.getTextContent());
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;
}
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;
}
case "ai":
@ -371,10 +371,10 @@ public class NpcData implements IGameXmlReader
set.set("dodge", parseInteger(attrs, "dodge"));
set.set("isChaos", parseBoolean(attrs, "isChaos"));
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();
switch (ai_node.getNodeName().toLowerCase())
attrs = aiNode.getAttributes();
switch (aiNode.getNodeName().toLowerCase())
{
case "skill":
{
@ -387,12 +387,12 @@ public class NpcData implements IGameXmlReader
set.set("longRangeSkillChance", parseInteger(attrs, "longRangeChance"));
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();
switch (clan_list_node.getNodeName().toLowerCase())
attrs = clanListNode.getAttributes();
switch (clanListNode.getNodeName().toLowerCase())
{
case "clan":
{
@ -400,16 +400,16 @@ public class NpcData implements IGameXmlReader
{
clans = new HashSet<>(1);
}
clans.add(getOrCreateClanId(clan_list_node.getTextContent()));
clans.add(getOrCreateClanId(clanListNode.getTextContent()));
break;
}
case "ignoreNpcId":
case "ignorenpcid":
{
if (ignoreClanNpcIds == null)
{
ignoreClanNpcIds = new HashSet<>(1);
}
ignoreClanNpcIds.add(Integer.parseInt(clan_list_node.getTextContent()));
ignoreClanNpcIds.add(Integer.parseInt(clanListNode.getTextContent()));
break;
}
}
@ -420,9 +420,9 @@ public class NpcData implements IGameXmlReader
}
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;
@ -462,10 +462,10 @@ public class NpcData implements IGameXmlReader
}
break;
}
case "extendDrop":
case "extenddrop":
{
final List<Integer> extendDrop = new ArrayList<>();
forEach(npc_node, "id", idNode ->
forEach(npcNode, "id", idNode ->
{
extendDrop.add(Integer.parseInt(idNode.getTextContent()));
});
@ -474,10 +474,10 @@ public class NpcData implements IGameXmlReader
}
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();
switch (collision_node.getNodeName().toLowerCase())
attrs = collisionNode.getAttributes();
switch (collisionNode.getNodeName().toLowerCase())
{
case "radius":
{