Code improvements.
This commit is contained in:
@ -60,10 +60,7 @@ public final class AbilityPointsData implements IXmlReader
|
||||
if ("points".equalsIgnoreCase(d.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap attrs = d.getAttributes();
|
||||
final int from = parseInteger(attrs, "from");
|
||||
final int to = parseInteger(attrs, "to");
|
||||
final int costs = parseInteger(attrs, "costs");
|
||||
_points.add(new RangeAbilityPointsHolder(from, to, costs));
|
||||
_points.add(new RangeAbilityPointsHolder(parseInteger(attrs, "from"), parseInteger(attrs, "to"), parseInteger(attrs, "costs")));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -86,18 +83,12 @@ public final class AbilityPointsData implements IXmlReader
|
||||
{
|
||||
points++; // for next point
|
||||
final RangeAbilityPointsHolder holder = getHolder(points);
|
||||
if (holder == null)
|
||||
if (holder != null)
|
||||
{
|
||||
final RangeAbilityPointsHolder prevHolder = getHolder(points - 1);
|
||||
if (prevHolder != null)
|
||||
{
|
||||
return prevHolder.getSP();
|
||||
}
|
||||
|
||||
// No data found
|
||||
return points >= 13 ? 1_000_000_000 : points >= 9 ? 750_000_000 : points >= 5 ? 500_000_000 : 250_000_000;
|
||||
return holder.getSP();
|
||||
}
|
||||
return holder.getSP();
|
||||
final RangeAbilityPointsHolder prevHolder = getHolder(points - 1);
|
||||
return prevHolder != null ? prevHolder.getSP() : points >= 13 ? 1_000_000_000 : points >= 9 ? 750_000_000 : points >= 5 ? 500_000_000 : 250_000_000;
|
||||
}
|
||||
|
||||
public static final AbilityPointsData getInstance()
|
||||
|
@ -120,7 +120,7 @@ public final class AdminData implements IXmlReader
|
||||
{
|
||||
return _accessLevels.get(-1);
|
||||
}
|
||||
else if (!_accessLevels.containsKey(accessLevelNum))
|
||||
if (!_accessLevels.containsKey(accessLevelNum))
|
||||
{
|
||||
_accessLevels.put(accessLevelNum, new L2AccessLevel());
|
||||
}
|
||||
|
@ -124,8 +124,7 @@ public final class BeautyShopData implements IXmlReader
|
||||
att = attrs.item(i);
|
||||
set.set(att.getNodeName(), att.getNodeValue());
|
||||
}
|
||||
final BeautyItem face = new BeautyItem(set);
|
||||
beautyData.addFace(face);
|
||||
beautyData.addFace((new BeautyItem(set)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -146,11 +145,7 @@ public final class BeautyShopData implements IXmlReader
|
||||
|
||||
public BeautyData getBeautyData(Race race, Sex sex)
|
||||
{
|
||||
if (_beautyList.containsKey(race))
|
||||
{
|
||||
return _beautyList.get(race).get(sex);
|
||||
}
|
||||
return null;
|
||||
return _beautyList.containsKey(race) ? _beautyList.get(race).get(sex) : null;
|
||||
}
|
||||
|
||||
public static BeautyShopData getInstance()
|
||||
|
@ -153,8 +153,7 @@ public final class BuyListData implements IXmlReader
|
||||
{
|
||||
if ("npc".equalsIgnoreCase(npcs_node.getNodeName()))
|
||||
{
|
||||
final int npcId = Integer.parseInt(npcs_node.getTextContent());
|
||||
buyList.addAllowedNpc(npcId);
|
||||
buyList.addAllowedNpc(Integer.parseInt(npcs_node.getTextContent()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,13 +74,7 @@ public final class CastleData implements IXmlReader
|
||||
if ("npc".equals(npcNode.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap np = npcNode.getAttributes();
|
||||
final int npcId = parseInteger(np, "id");
|
||||
final int x = parseInteger(np, "x");
|
||||
final int y = parseInteger(np, "y");
|
||||
final int z = parseInteger(np, "z");
|
||||
final int heading = parseInteger(np, "heading");
|
||||
|
||||
spawns.add(new CastleSpawnHolder(npcId, side, x, y, z, heading));
|
||||
spawns.add(new CastleSpawnHolder(parseInteger(np, "id"), side, parseInteger(np, "x"), parseInteger(np, "y"), parseInteger(np, "z"), parseInteger(np, "heading")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -68,8 +68,7 @@ public final class ClassListData implements IXmlReader
|
||||
attr = attrs.getNamedItem("name");
|
||||
final String className = attr.getNodeValue();
|
||||
attr = attrs.getNamedItem("parentClassId");
|
||||
final ClassId parentClassId = (attr != null) ? ClassId.getClassId(parseInteger(attr)) : null;
|
||||
_classData.put(classId, new ClassInfo(classId, className, parentClassId));
|
||||
_classData.put(classId, new ClassInfo(classId, className, ((attr != null) ? ClassId.getClassId(parseInteger(attr)) : null)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -131,8 +131,7 @@ public class DailyMissionData implements IXmlReader
|
||||
}
|
||||
else
|
||||
{
|
||||
final String[] s = att.getNodeValue().split(",");
|
||||
for (String element : s)
|
||||
for (String element : att.getNodeValue().split(","))
|
||||
{
|
||||
classesList.add(Integer.parseInt(element));
|
||||
}
|
||||
@ -142,9 +141,7 @@ public class DailyMissionData implements IXmlReader
|
||||
{
|
||||
if ("reward".equalsIgnoreCase(c.getNodeName()))
|
||||
{
|
||||
final int itemId = Integer.parseInt(c.getAttributes().getNamedItem("item").getNodeValue());
|
||||
final int itemCount = Integer.parseInt(c.getAttributes().getNamedItem("count").getNodeValue());
|
||||
rewards.put(itemId, itemCount);
|
||||
rewards.put(Integer.parseInt(c.getAttributes().getNamedItem("item").getNodeValue()), Integer.parseInt(c.getAttributes().getNamedItem("count").getNodeValue()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,8 +100,7 @@ public class DoorData implements IXmlReader
|
||||
pos = set.getString("node2").split(",");
|
||||
posX = Integer.parseInt(pos[0]);
|
||||
posY = Integer.parseInt(pos[1]);
|
||||
int collisionRadius; // (max) radius for movement checks
|
||||
collisionRadius = Math.min(Math.abs(nodeX - posX), Math.abs(nodeY - posY));
|
||||
int collisionRadius = Math.min(Math.abs(nodeX - posX), Math.abs(nodeY - posY)); // (max) radius for movement checks
|
||||
if (collisionRadius < 20)
|
||||
{
|
||||
collisionRadius = 20;
|
||||
|
@ -17,7 +17,6 @@
|
||||
package com.l2jmobius.gameserver.data.xml.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -85,75 +84,85 @@ public class EnchantItemBonusData implements IXmlReader
|
||||
}
|
||||
}
|
||||
|
||||
if (!_armorHPBonuses.isEmpty())
|
||||
if (_armorHPBonuses.isEmpty())
|
||||
{
|
||||
final ItemTable it = ItemTable.getInstance();
|
||||
// Armors
|
||||
final Collection<Integer> armorIds = it.getAllArmorsId();
|
||||
for (Integer itemId : armorIds)
|
||||
return;
|
||||
}
|
||||
|
||||
final ItemTable it = ItemTable.getInstance();
|
||||
for (Integer itemId : it.getAllArmorsId())
|
||||
{
|
||||
final L2Item item = it.getTemplate(itemId);
|
||||
if ((item != null) && (item.getCrystalType() != CrystalType.NONE))
|
||||
{
|
||||
final L2Item item = it.getTemplate(itemId);
|
||||
if ((item != null) && (item.getCrystalType() != CrystalType.NONE))
|
||||
switch (item.getBodyPart())
|
||||
{
|
||||
switch (item.getBodyPart())
|
||||
case L2Item.SLOT_CHEST:
|
||||
{
|
||||
case L2Item.SLOT_CHEST:
|
||||
if (item.getCrystalTypePlus() == CrystalType.R)
|
||||
{
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTPATK.getName(), -1, Stats.POWER_ATTACK, 0));
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTMATK.getName(), -1, Stats.MAGIC_ATTACK, 0));
|
||||
break;
|
||||
}
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTHP.getName(), -1, Stats.MAX_HP, 0));
|
||||
break;
|
||||
case L2Item.SLOT_FEET:
|
||||
if (item.getCrystalTypePlus() == CrystalType.R)
|
||||
{
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTRUNSPD.getName(), -1, Stats.MOVE_SPEED, 0));
|
||||
break;
|
||||
}
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTHP.getName(), -1, Stats.MAX_HP, 0));
|
||||
break;
|
||||
case L2Item.SLOT_GLOVES:
|
||||
if (item.getCrystalTypePlus() == CrystalType.R)
|
||||
{
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTACCEVAS.getName(), -1, Stats.ACCURACY_COMBAT, 0));
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTACCEVAS.getName(), -1, Stats.ACCURACY_MAGIC, 0));
|
||||
break;
|
||||
}
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTHP.getName(), -1, Stats.MAX_HP, 0));
|
||||
break;
|
||||
case L2Item.SLOT_HEAD:
|
||||
if (item.getCrystalTypePlus() == CrystalType.R)
|
||||
{
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTACCEVAS.getName(), -1, Stats.EVASION_RATE, 0));
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTACCEVAS.getName(), -1, Stats.MAGIC_EVASION_RATE, 0));
|
||||
break;
|
||||
}
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTHP.getName(), -1, Stats.MAX_HP, 0));
|
||||
break;
|
||||
case L2Item.SLOT_LEGS:
|
||||
if (item.getCrystalTypePlus() == CrystalType.R)
|
||||
{
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTPMCRITRATE.getName(), -1, Stats.CRITICAL_RATE, 0));
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTPMCRITRATE.getName(), -1, Stats.MCRITICAL_RATE, 0));
|
||||
break;
|
||||
}
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTHP.getName(), -1, Stats.MAX_HP, 0));
|
||||
break;
|
||||
case L2Item.SLOT_BACK:
|
||||
case L2Item.SLOT_FULL_ARMOR:
|
||||
case L2Item.SLOT_UNDERWEAR:
|
||||
case L2Item.SLOT_L_HAND:
|
||||
case L2Item.SLOT_BELT:
|
||||
if (item.getCrystalTypePlus() == CrystalType.R)
|
||||
{
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTHP.getName(), -1, Stats.MAX_HP, 0));
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTPATK.getName(), -1, Stats.POWER_ATTACK, 0));
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTMATK.getName(), -1, Stats.MAGIC_ATTACK, 0));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTHP.getName(), -1, Stats.MAX_HP, 0));
|
||||
break;
|
||||
}
|
||||
case L2Item.SLOT_FEET:
|
||||
{
|
||||
if (item.getCrystalTypePlus() == CrystalType.R)
|
||||
{
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTRUNSPD.getName(), -1, Stats.MOVE_SPEED, 0));
|
||||
break;
|
||||
}
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTHP.getName(), -1, Stats.MAX_HP, 0));
|
||||
break;
|
||||
}
|
||||
case L2Item.SLOT_GLOVES:
|
||||
{
|
||||
if (item.getCrystalTypePlus() == CrystalType.R)
|
||||
{
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTACCEVAS.getName(), -1, Stats.ACCURACY_COMBAT, 0));
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTACCEVAS.getName(), -1, Stats.ACCURACY_MAGIC, 0));
|
||||
break;
|
||||
}
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTHP.getName(), -1, Stats.MAX_HP, 0));
|
||||
break;
|
||||
}
|
||||
case L2Item.SLOT_HEAD:
|
||||
{
|
||||
if (item.getCrystalTypePlus() == CrystalType.R)
|
||||
{
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTACCEVAS.getName(), -1, Stats.EVASION_RATE, 0));
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTACCEVAS.getName(), -1, Stats.MAGIC_EVASION_RATE, 0));
|
||||
break;
|
||||
}
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTHP.getName(), -1, Stats.MAX_HP, 0));
|
||||
break;
|
||||
}
|
||||
case L2Item.SLOT_LEGS:
|
||||
{
|
||||
if (item.getCrystalTypePlus() == CrystalType.R)
|
||||
{
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTPMCRITRATE.getName(), -1, Stats.CRITICAL_RATE, 0));
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTPMCRITRATE.getName(), -1, Stats.MCRITICAL_RATE, 0));
|
||||
break;
|
||||
}
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTHP.getName(), -1, Stats.MAX_HP, 0));
|
||||
break;
|
||||
}
|
||||
case L2Item.SLOT_BACK:
|
||||
case L2Item.SLOT_FULL_ARMOR:
|
||||
case L2Item.SLOT_UNDERWEAR:
|
||||
case L2Item.SLOT_L_HAND:
|
||||
case L2Item.SLOT_BELT:
|
||||
{
|
||||
item.attach(new FuncTemplate(null, null, StatFunction.ENCHANTHP.getName(), -1, Stats.MAX_HP, 0));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -172,15 +181,9 @@ public class EnchantItemBonusData implements IXmlReader
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
double blessedArmorBonus = item.isBlessedItem() ? 1.5 : 1;
|
||||
|
||||
final double blessedArmorBonus = item.isBlessedItem() ? 1.5 : 1;
|
||||
final int bonus = values.get(Math.min(item.getOlyEnchantLevel(), values.size()) - 1);
|
||||
if (item.getItem().getBodyPart() == L2Item.SLOT_FULL_ARMOR)
|
||||
{
|
||||
return (int) (bonus * FULL_ARMOR_MODIFIER * blessedArmorBonus);
|
||||
}
|
||||
return bonus;
|
||||
return item.getItem().getBodyPart() == L2Item.SLOT_FULL_ARMOR ? (int) (bonus * FULL_ARMOR_MODIFIER * blessedArmorBonus) : bonus;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,11 +96,7 @@ public class EnchantItemOptionsData implements IXmlReader
|
||||
*/
|
||||
public EnchantOptions getOptions(int itemId, int enchantLevel)
|
||||
{
|
||||
if (!_data.containsKey(itemId) || !_data.get(itemId).containsKey(enchantLevel))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return _data.get(itemId).get(enchantLevel);
|
||||
return !_data.containsKey(itemId) || !_data.get(itemId).containsKey(enchantLevel) ? null : _data.get(itemId).get(enchantLevel);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -161,11 +161,7 @@ public class EnchantSkillGroupsData implements IXmlReader
|
||||
{
|
||||
// there is enchantment for this skill and we have the required level of it
|
||||
final L2EnchantSkillLearn esl = getSkillEnchantmentBySkillId(skill.getId());
|
||||
if ((esl != null) && (skill.getLevel() >= esl.getBaseLevel()))
|
||||
{
|
||||
return esl;
|
||||
}
|
||||
return null;
|
||||
return (esl != null) && (skill.getLevel() >= esl.getBaseLevel()) ? esl : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -102,11 +102,7 @@ public final class FishingMonstersData implements IXmlReader
|
||||
*/
|
||||
public L2FishingMonster getFishingMonsterById(int id)
|
||||
{
|
||||
if (_fishingMonstersData.containsKey(id))
|
||||
{
|
||||
return _fishingMonstersData.get(id);
|
||||
}
|
||||
return null;
|
||||
return _fishingMonstersData.containsKey(id) ? _fishingMonstersData.get(id) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -130,9 +130,7 @@ public final class HennaData implements IXmlReader
|
||||
{
|
||||
if ("skill".equals(i.getNodeName()))
|
||||
{
|
||||
final int skillId = Integer.parseInt(i.getAttributes().getNamedItem("id").getNodeValue());
|
||||
final int skillLevel = Integer.parseInt(i.getAttributes().getNamedItem("level").getNodeValue());
|
||||
skills.add(new SkillHolder(skillId, skillLevel));
|
||||
skills.add(new SkillHolder(Integer.parseInt(i.getAttributes().getNamedItem("id").getNodeValue()), Integer.parseInt(i.getAttributes().getNamedItem("level").getNodeValue())));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -216,12 +216,7 @@ public final class InitialShortcutData implements IXmlReader
|
||||
private Shortcut createShortcut(int pageId, Node b)
|
||||
{
|
||||
final NamedNodeMap attrs = b.getAttributes();
|
||||
final int slotId = parseInteger(attrs, "slotId");
|
||||
final ShortcutType shortcutType = parseEnum(attrs, ShortcutType.class, "shortcutType");
|
||||
final int shortcutId = parseInteger(attrs, "shortcutId");
|
||||
final int shortcutLevel = parseInteger(attrs, "shortcutLevel", 0);
|
||||
final int characterType = parseInteger(attrs, "characterType", 0);
|
||||
return new Shortcut(slotId, pageId, shortcutType, shortcutId, shortcutLevel, characterType);
|
||||
return new Shortcut(parseInteger(attrs, "slotId"), pageId, parseEnum(attrs, ShortcutType.class, "shortcutType"), parseInteger(attrs, "shortcutId"), parseInteger(attrs, "shortcutLevel", 0), parseInteger(attrs, "characterType", 0));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,10 +65,7 @@ public final class ItemCrystalizationData implements IXmlReader
|
||||
if ("item".equalsIgnoreCase(c.getNodeName()))
|
||||
{
|
||||
final NamedNodeMap attrs = c.getAttributes();
|
||||
final int itemId = parseInteger(attrs, "id");
|
||||
final long itemCount = parseLong(attrs, "count");
|
||||
final double itemChance = parseDouble(attrs, "chance");
|
||||
data.addItem(new ItemChanceHolder(itemId, itemChance, itemCount));
|
||||
data.addItem(new ItemChanceHolder(parseInteger(attrs, "id"), parseDouble(attrs, "chance"), parseLong(attrs, "count")));
|
||||
}
|
||||
}
|
||||
_items.put(id, data);
|
||||
|
@ -129,19 +129,15 @@ public final class MultisellData implements IXmlReader
|
||||
{
|
||||
if ("item".equalsIgnoreCase(d.getNodeName()))
|
||||
{
|
||||
final Entry e = parseEntry(d, entryId++, list);
|
||||
list.getEntries().add(e);
|
||||
list.getEntries().add(parseEntry(d, entryId++, list));
|
||||
}
|
||||
else if ("npcs".equalsIgnoreCase(d.getNodeName()))
|
||||
{
|
||||
for (Node b = d.getFirstChild(); b != null; b = b.getNextSibling())
|
||||
{
|
||||
if ("npc".equalsIgnoreCase(b.getNodeName()))
|
||||
if ("npc".equalsIgnoreCase(b.getNodeName()) && Util.isDigit(b.getTextContent()))
|
||||
{
|
||||
if (Util.isDigit(b.getTextContent()))
|
||||
{
|
||||
list.allowNpc(Integer.parseInt(b.getTextContent()));
|
||||
}
|
||||
list.allowNpc(Integer.parseInt(b.getTextContent()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -281,12 +277,12 @@ public final class MultisellData implements IXmlReader
|
||||
{
|
||||
case PC_BANG_POINTS:
|
||||
{
|
||||
if (player.getPcBangPoints() < amount)
|
||||
if (player.getPcBangPoints() >= amount)
|
||||
{
|
||||
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_ARE_SHORT_OF_PC_POINTS));
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_ARE_SHORT_OF_PC_POINTS));
|
||||
break;
|
||||
}
|
||||
case CLAN_REPUTATION:
|
||||
{
|
||||
@ -300,12 +296,12 @@ public final class MultisellData implements IXmlReader
|
||||
player.sendPacket(SystemMessageId.ONLY_THE_CLAN_LEADER_IS_ENABLED);
|
||||
break;
|
||||
}
|
||||
if (player.getClan().getReputationScore() < amount)
|
||||
if (player.getClan().getReputationScore() >= amount)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.THE_CLAN_REPUTATION_IS_TOO_LOW);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
player.sendPacket(SystemMessageId.THE_CLAN_REPUTATION_IS_TOO_LOW);
|
||||
break;
|
||||
}
|
||||
case FAME:
|
||||
{
|
||||
@ -317,12 +313,12 @@ public final class MultisellData implements IXmlReader
|
||||
}
|
||||
case RAID_POINTS:
|
||||
{
|
||||
if (player.getRaidPoints() < amount)
|
||||
if (player.getRaidPoints() >= amount)
|
||||
{
|
||||
player.sendPacket(SystemMessageId.NOT_ENOUGH_RAID_POINTS);
|
||||
break;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
player.sendPacket(SystemMessageId.NOT_ENOUGH_RAID_POINTS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -510,15 +510,7 @@ public class NpcData implements IXmlReader
|
||||
parameters.putIfAbsent("Privates", _minionData._tempMinions.get(npcId));
|
||||
}
|
||||
|
||||
if (parameters != null)
|
||||
{
|
||||
// Using unmodifiable map parameters of template are not meant to be changed at runtime.
|
||||
template.setParameters(new StatsSet(Collections.unmodifiableMap(parameters)));
|
||||
}
|
||||
else
|
||||
{
|
||||
template.setParameters(StatsSet.EMPTY_STATSET);
|
||||
}
|
||||
template.setParameters(parameters != null ? new StatsSet(Collections.unmodifiableMap(parameters)) : StatsSet.EMPTY_STATSET);
|
||||
|
||||
if (skills != null)
|
||||
{
|
||||
@ -645,12 +637,11 @@ public class NpcData implements IXmlReader
|
||||
{
|
||||
for (Node dropNode = dropListNode.getFirstChild(); dropNode != null; dropNode = dropNode.getNextSibling())
|
||||
{
|
||||
final NamedNodeMap attrs = dropNode.getAttributes();
|
||||
switch (dropNode.getNodeName().toLowerCase())
|
||||
{
|
||||
case "group":
|
||||
{
|
||||
final GroupedGeneralDropItem dropItem = dropListScope.newGroupedDropItem(parseDouble(attrs, "chance"));
|
||||
final GroupedGeneralDropItem dropItem = dropListScope.newGroupedDropItem(parseDouble(dropNode.getAttributes(), "chance"));
|
||||
final List<IDropItem> groupedDropList = new ArrayList<>(2);
|
||||
for (Node groupNode = dropNode.getFirstChild(); groupNode != null; groupNode = groupNode.getNextSibling())
|
||||
{
|
||||
|
@ -58,8 +58,7 @@ public final class PetDataTable implements IXmlReader
|
||||
public void parseDocument(Document doc)
|
||||
{
|
||||
NamedNodeMap attrs;
|
||||
final Node n = doc.getFirstChild();
|
||||
for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
|
||||
for (Node d = doc.getFirstChild().getFirstChild(); d != null; d = d.getNextSibling())
|
||||
{
|
||||
if (d.getNodeName().equals("pet"))
|
||||
{
|
||||
@ -174,11 +173,7 @@ public final class PetDataTable implements IXmlReader
|
||||
public L2PetLevelData getPetLevelData(int petId, int petLevel)
|
||||
{
|
||||
final L2PetData pd = getPetData(petId);
|
||||
if (pd != null)
|
||||
{
|
||||
return pd.getPetLevelData(petLevel);
|
||||
}
|
||||
return null;
|
||||
return pd != null ? pd.getPetLevelData(petLevel) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -71,12 +71,12 @@ public final class PlayerXpPercentLostData implements IXmlReader
|
||||
|
||||
public double getXpPercent(int level)
|
||||
{
|
||||
if (level > _maxlevel)
|
||||
if (level <= _maxlevel)
|
||||
{
|
||||
LOGGER.warning("Require to high level inside PlayerXpPercentLostData (" + level + ")");
|
||||
return _playerXpPercentLost[_maxlevel];
|
||||
return _playerXpPercentLost[level];
|
||||
}
|
||||
return _playerXpPercentLost[level];
|
||||
LOGGER.warning("Require to high level inside PlayerXpPercentLostData (" + level + ")");
|
||||
return _playerXpPercentLost[_maxlevel];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -51,15 +51,7 @@ public class PrimeShopData implements IXmlReader
|
||||
{
|
||||
_primeItems.clear();
|
||||
parseDatapackFile("PrimeShop.xml");
|
||||
|
||||
if (_primeItems.size() > 0)
|
||||
{
|
||||
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _primeItems.size() + " items");
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGGER.info(getClass().getSimpleName() + ": System is disabled.");
|
||||
}
|
||||
LOGGER.info(_primeItems.size() > 0 ? getClass().getSimpleName() + ": Loaded " + _primeItems.size() + " items" : getClass().getSimpleName() + ": System is disabled.");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -161,9 +161,7 @@ public class RecipeData implements IXmlReader
|
||||
}
|
||||
else if ("ingredient".equalsIgnoreCase(c.getNodeName()))
|
||||
{
|
||||
final int ingId = Integer.parseInt(c.getAttributes().getNamedItem("id").getNodeValue());
|
||||
final int ingCount = Integer.parseInt(c.getAttributes().getNamedItem("count").getNodeValue());
|
||||
recipePartList.add(new L2RecipeInstance(ingId, ingCount));
|
||||
recipePartList.add(new L2RecipeInstance(Integer.parseInt(c.getAttributes().getNamedItem("id").getNodeValue()), Integer.parseInt(c.getAttributes().getNamedItem("count").getNodeValue())));
|
||||
}
|
||||
else if ("production".equalsIgnoreCase(c.getNodeName()))
|
||||
{
|
||||
|
@ -49,11 +49,12 @@ public class SiegeScheduleData implements IXmlReader
|
||||
_scheduleData.clear();
|
||||
parseDatapackFile("../config/SiegeSchedule.xml");
|
||||
LOGGER.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + _scheduleData.size() + " siege schedulers.");
|
||||
if (_scheduleData.isEmpty())
|
||||
if (!_scheduleData.isEmpty())
|
||||
{
|
||||
_scheduleData.add(new SiegeScheduleDate(new StatsSet()));
|
||||
LOGGER.log(Level.INFO, getClass().getSimpleName() + ": Emergency Loaded: " + _scheduleData.size() + " default siege schedulers.");
|
||||
return;
|
||||
}
|
||||
_scheduleData.add(new SiegeScheduleDate(new StatsSet()));
|
||||
LOGGER.log(Level.INFO, getClass().getSimpleName() + ": Emergency Loaded: " + _scheduleData.size() + " default siege schedulers.");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -76,12 +77,9 @@ public class SiegeScheduleData implements IXmlReader
|
||||
final Node node = attrs.item(i);
|
||||
final String key = node.getNodeName();
|
||||
String val = node.getNodeValue();
|
||||
if ("day".equals(key))
|
||||
if ("day".equals(key) && !Util.isDigit(val))
|
||||
{
|
||||
if (!Util.isDigit(val))
|
||||
{
|
||||
val = Integer.toString(getValueForField(val));
|
||||
}
|
||||
val = Integer.toString(getValueForField(val));
|
||||
}
|
||||
set.set(key, val);
|
||||
}
|
||||
@ -121,5 +119,4 @@ public class SiegeScheduleData implements IXmlReader
|
||||
{
|
||||
protected static final SiegeScheduleData _instance = new SiegeScheduleData();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -638,11 +638,7 @@ public final class SkillTreesData implements IXmlReader
|
||||
continue;
|
||||
}
|
||||
final Skill oldSkill = player.getKnownSkill(skill.getSkillId());
|
||||
if ((oldSkill != null) && (oldSkill.getLevel() == (skill.getSkillLevel() - 1)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if ((oldSkill == null) && (skill.getSkillLevel() == 1))
|
||||
if (((oldSkill != null) && (oldSkill.getLevel() == (skill.getSkillLevel() - 1))) || ((oldSkill == null) && (skill.getSkillLevel() == 1)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -789,8 +785,7 @@ public final class SkillTreesData implements IXmlReader
|
||||
{
|
||||
for (L2SkillLearn s : learnable)
|
||||
{
|
||||
final Skill sk = SkillData.getInstance().getSkill(s.getSkillId(), s.getSkillLevel());
|
||||
holder.addSkill(sk);
|
||||
holder.addSkill(SkillData.getInstance().getSkill(s.getSkillId(), s.getSkillLevel()));
|
||||
}
|
||||
|
||||
// Get new available skills, some skills depend of previous skills to be available.
|
||||
@ -908,9 +903,7 @@ public final class SkillTreesData implements IXmlReader
|
||||
|
||||
for (L2SkillLearn skill : revelationSkills.values())
|
||||
{
|
||||
final Skill oldSkill = player.getSkills().get(skill.getSkillId());
|
||||
|
||||
if (oldSkill == null)
|
||||
if (player.getSkills().get(skill.getSkillId()) == null)
|
||||
{
|
||||
result.add(skill);
|
||||
}
|
||||
@ -1398,11 +1391,7 @@ public final class SkillTreesData implements IXmlReader
|
||||
*/
|
||||
public L2SkillLearn getTransferSkill(int id, int lvl, ClassId classId)
|
||||
{
|
||||
if (_transferSkillTrees.get(classId) != null)
|
||||
{
|
||||
return _transferSkillTrees.get(classId).get(SkillData.getSkillHashCode(id, lvl));
|
||||
}
|
||||
return null;
|
||||
return _transferSkillTrees.get(classId) != null ? _transferSkillTrees.get(classId).get(SkillData.getSkillHashCode(id, lvl)) : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1497,12 +1486,9 @@ public final class SkillTreesData implements IXmlReader
|
||||
{
|
||||
for (L2SkillLearn s : skillTree.values())
|
||||
{
|
||||
if ((player.getLevel() < s.getGetLevel()) || (player.getDualClassLevel() < s.getDualClassLevel()))
|
||||
if (((player.getLevel() < s.getGetLevel()) || (player.getDualClassLevel() < s.getDualClassLevel())) && ((minLevel == 0) || ((minLevel > s.getGetLevel()) && (minLevel > s.getDualClassLevel()))))
|
||||
{
|
||||
if ((minLevel == 0) || ((minLevel > s.getGetLevel()) && (minLevel > s.getDualClassLevel())))
|
||||
{
|
||||
minLevel = s.getGetLevel();
|
||||
}
|
||||
minLevel = s.getGetLevel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,9 +124,7 @@ public final class TransformData implements IXmlReader
|
||||
if ("skill".equals(s.getNodeName()))
|
||||
{
|
||||
attrs = s.getAttributes();
|
||||
final int skillId = parseInteger(attrs, "id");
|
||||
final int skillLevel = parseInteger(attrs, "level");
|
||||
templateData.addSkill(new SkillHolder(skillId, skillLevel));
|
||||
templateData.addSkill(new SkillHolder(parseInteger(attrs, "id"), parseInteger(attrs, "level")));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -155,10 +153,7 @@ public final class TransformData implements IXmlReader
|
||||
if ("skill".equals(s.getNodeName()))
|
||||
{
|
||||
attrs = s.getAttributes();
|
||||
final int skillId = parseInteger(attrs, "id");
|
||||
final int skillLevel = parseInteger(attrs, "level");
|
||||
final int minLevel = parseInteger(attrs, "minLevel");
|
||||
templateData.addAdditionalSkill(new AdditionalSkillHolder(skillId, skillLevel, minLevel));
|
||||
templateData.addAdditionalSkill(new AdditionalSkillHolder(parseInteger(attrs, "id"), parseInteger(attrs, "level"), parseInteger(attrs, "minLevel")));
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -175,9 +170,7 @@ public final class TransformData implements IXmlReader
|
||||
if ("item".equals(s.getNodeName()))
|
||||
{
|
||||
attrs = s.getAttributes();
|
||||
final int itemId = parseInteger(attrs, "id");
|
||||
final boolean allowed = parseBoolean(attrs, "allowed");
|
||||
templateData.addAdditionalItem(new AdditionalItemHolder(itemId, allowed));
|
||||
templateData.addAdditionalItem(new AdditionalItemHolder(parseInteger(attrs, "id"), parseBoolean(attrs, "allowed")));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Reference in New Issue
Block a user