diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/data/xml/OptionData.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/data/xml/OptionData.java index f563b02755..86e0c8f1fb 100644 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/data/xml/OptionData.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/data/xml/OptionData.java @@ -28,10 +28,10 @@ import org.w3c.dom.Document; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.options.Options; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; +import org.l2jmobius.gameserver.model.skill.Skill; /** * @author UnAfraid @@ -88,27 +88,77 @@ public class OptionData implements IXmlReader } case "active_skill": { - option.addActiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "passive_skill": { - option.addPassiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addPassiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "attack_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.ATTACK)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.ATTACK)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "magic_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.MAGIC)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.MAGIC)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "critical_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.CRITICAL)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.CRITICAL)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } } diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java index cfc166ae5e..92a7c04f0b 100644 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -121,8 +121,8 @@ import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.EtcItemType; import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffInfo; @@ -236,7 +236,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe private boolean _lethalable = true; - private Map _triggerSkills; + private Map _triggerSkills; private Map _ignoreSkillEffects; /** Creatures effect list. */ @@ -3903,9 +3903,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (_triggerSkills != null) { - for (OptionsSkillHolder holder : _triggerSkills.values()) + for (OptionSkillHolder holder : _triggerSkills.values()) { - if (((!hit.isCritical() && (holder.getSkillType() == OptionsSkillType.ATTACK)) || ((holder.getSkillType() == OptionsSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) + if (((!hit.isCritical() && (holder.getSkillType() == OptionSkillType.ATTACK)) || ((holder.getSkillType() == OptionSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) { SkillCaster.triggerCast(this, target, holder.getSkill(), null, false); } @@ -4934,7 +4934,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return (_triggerSkills != null) && !_triggerSkills.isEmpty(); } - public Map getTriggerSkills() + public Map getTriggerSkills() { if (_triggerSkills == null) { @@ -4942,21 +4942,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe { if (_triggerSkills == null) { - _triggerSkills = new ConcurrentHashMap<>(); + _triggerSkills = new ConcurrentHashMap<>(1); } } } return _triggerSkills; } - public void addTriggerSkill(OptionsSkillHolder holder) + public void addTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().put(holder.getSkillId(), holder); + getTriggerSkills().put(holder.getSkill().getId(), holder); } - public void removeTriggerSkill(OptionsSkillHolder holder) + public void removeTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().remove(holder.getSkillId()); + getTriggerSkills().remove(holder.getSkill().getId()); } /** diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java similarity index 68% rename from L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java rename to L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java index fc42843b8a..52f00e5d78 100644 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java @@ -16,36 +16,41 @@ */ package org.l2jmobius.gameserver.model.options; -import org.l2jmobius.gameserver.model.holders.SkillHolder; +import org.l2jmobius.gameserver.model.skill.Skill; /** - * @author UnAfraid + * @author UnAfraid, Mobius */ -public class OptionsSkillHolder extends SkillHolder +public class OptionSkillHolder { - private final OptionsSkillType _type; + private final Skill _skill; private final double _chance; + private final OptionSkillType _type; /** - * @param skillId - * @param skillLevel + * @param skill * @param type * @param chance */ - public OptionsSkillHolder(int skillId, int skillLevel, double chance, OptionsSkillType type) + public OptionSkillHolder(Skill skill, double chance, OptionSkillType type) { - super(skillId, skillLevel); + _skill = skill; _chance = chance; _type = type; } - public OptionsSkillType getSkillType() + public Skill getSkill() { - return _type; + return _skill; } public double getChance() { return _chance; } + + public OptionSkillType getSkillType() + { + return _type; + } } diff --git a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java similarity index 93% rename from L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java rename to L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java index 7c216d20f7..689c956312 100644 --- a/L2J_Mobius_03.0_Helios/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java @@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.model.options; /** * @author UnAfraid */ -public enum OptionsSkillType +public enum OptionSkillType { ATTACK, MAGIC, diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/options/Options.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/options/Options.java index 9eb5d46e9e..0299901a34 100644 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/options/Options.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/options/Options.java @@ -22,7 +22,6 @@ import java.util.List; import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.skill.BuffInfo; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; @@ -34,9 +33,9 @@ public class Options { private final int _id; private List _effects = null; - private List _activeSkill = null; - private List _passiveSkill = null; - private List _activationSkills = null; + private List _activeSkill = null; + private List _passiveSkill = null; + private List _activationSkills = null; /** * @param id @@ -75,12 +74,12 @@ public class Options return _activeSkill != null; } - public List getActiveSkills() + public List getActiveSkills() { return _activeSkill; } - public void addActiveSkill(SkillHolder holder) + public void addActiveSkill(Skill holder) { if (_activeSkill == null) { @@ -94,12 +93,12 @@ public class Options return _passiveSkill != null; } - public List getPassiveSkills() + public List getPassiveSkills() { return _passiveSkill; } - public void addPassiveSkill(SkillHolder holder) + public void addPassiveSkill(Skill holder) { if (_passiveSkill == null) { @@ -113,11 +112,11 @@ public class Options return _activationSkills != null; } - public boolean hasActivationSkills(OptionsSkillType type) + public boolean hasActivationSkills(OptionSkillType type) { if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -128,17 +127,17 @@ public class Options return false; } - public List getActivationsSkills() + public List getActivationSkills() { return _activationSkills; } - public List getActivationsSkills(OptionsSkillType type) + public List getActivationSkills(OptionSkillType type) { - final List temp = new ArrayList<>(); + final List temp = new ArrayList<>(); if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -149,7 +148,7 @@ public class Options return temp; } - public void addActivationSkill(OptionsSkillHolder holder) + public void addActivationSkill(OptionSkillHolder holder) { if (_activationSkills == null) { @@ -189,21 +188,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.addTriggerSkill(holder); } @@ -227,21 +226,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - player.removeSkill(holder.getSkill(), false, false); + player.removeSkill(skill, false, false); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - player.removeSkill(holder.getSkill(), false, true); + player.removeSkill(skill, false, true); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.removeTriggerSkill(holder); } diff --git a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java index b118a37bb6..7647a79b7e 100644 --- a/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java +++ b/L2J_Mobius_01.0_Ertheia/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java @@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate; import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.ActionType; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.zone.ZoneId; @@ -602,9 +602,9 @@ public class SkillCaster implements Runnable if (caster.hasTriggerSkills()) { - for (OptionsSkillHolder holder : caster.getTriggerSkills().values()) + for (OptionSkillHolder holder : caster.getTriggerSkills().values()) { - if (((skill.isMagic() && (holder.getSkillType() == OptionsSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionsSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) + if (((skill.isMagic() && (holder.getSkillType() == OptionSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) { triggerCast(caster, creature, holder.getSkill(), null, false); } diff --git a/L2J_Mobius_02.5_Underground/dist/game/data/stats/augmentation/options/31900-31999.xml b/L2J_Mobius_02.5_Underground/dist/game/data/stats/augmentation/options/31900-31999.xml index d1403e190b..60b7e14754 100644 --- a/L2J_Mobius_02.5_Underground/dist/game/data/stats/augmentation/options/31900-31999.xml +++ b/L2J_Mobius_02.5_Underground/dist/game/data/stats/augmentation/options/31900-31999.xml @@ -294,15 +294,12 @@ - - - - - - - - - - - diff --git a/L2J_Mobius_05.0_Salvation/dist/game/data/stats/augmentation/options/41000-41099.xml b/L2J_Mobius_05.0_Salvation/dist/game/data/stats/augmentation/options/41000-41099.xml deleted file mode 100644 index 26de4d23e5..0000000000 --- a/L2J_Mobius_05.0_Salvation/dist/game/data/stats/augmentation/options/41000-41099.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/data/xml/OptionData.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/data/xml/OptionData.java index f563b02755..86e0c8f1fb 100644 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/data/xml/OptionData.java +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/data/xml/OptionData.java @@ -28,10 +28,10 @@ import org.w3c.dom.Document; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.options.Options; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; +import org.l2jmobius.gameserver.model.skill.Skill; /** * @author UnAfraid @@ -88,27 +88,77 @@ public class OptionData implements IXmlReader } case "active_skill": { - option.addActiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "passive_skill": { - option.addPassiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addPassiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "attack_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.ATTACK)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.ATTACK)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "magic_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.MAGIC)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.MAGIC)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "critical_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.CRITICAL)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.CRITICAL)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } } diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java index f6b4b70beb..e247586795 100644 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -121,8 +121,8 @@ import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.EtcItemType; import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffInfo; @@ -236,7 +236,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe private boolean _lethalable = true; - private Map _triggerSkills; + private Map _triggerSkills; private Map _ignoreSkillEffects; /** Creatures effect list. */ @@ -3903,9 +3903,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (_triggerSkills != null) { - for (OptionsSkillHolder holder : _triggerSkills.values()) + for (OptionSkillHolder holder : _triggerSkills.values()) { - if (((!hit.isCritical() && (holder.getSkillType() == OptionsSkillType.ATTACK)) || ((holder.getSkillType() == OptionsSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) + if (((!hit.isCritical() && (holder.getSkillType() == OptionSkillType.ATTACK)) || ((holder.getSkillType() == OptionSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) { SkillCaster.triggerCast(this, target, holder.getSkill(), null, false); } @@ -4943,7 +4943,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return (_triggerSkills != null) && !_triggerSkills.isEmpty(); } - public Map getTriggerSkills() + public Map getTriggerSkills() { if (_triggerSkills == null) { @@ -4951,21 +4951,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe { if (_triggerSkills == null) { - _triggerSkills = new ConcurrentHashMap<>(); + _triggerSkills = new ConcurrentHashMap<>(1); } } } return _triggerSkills; } - public void addTriggerSkill(OptionsSkillHolder holder) + public void addTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().put(holder.getSkillId(), holder); + getTriggerSkills().put(holder.getSkill().getId(), holder); } - public void removeTriggerSkill(OptionsSkillHolder holder) + public void removeTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().remove(holder.getSkillId()); + getTriggerSkills().remove(holder.getSkill().getId()); } /** diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java new file mode 100644 index 0000000000..52f00e5d78 --- /dev/null +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java @@ -0,0 +1,56 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +import org.l2jmobius.gameserver.model.skill.Skill; + +/** + * @author UnAfraid, Mobius + */ +public class OptionSkillHolder +{ + private final Skill _skill; + private final double _chance; + private final OptionSkillType _type; + + /** + * @param skill + * @param type + * @param chance + */ + public OptionSkillHolder(Skill skill, double chance, OptionSkillType type) + { + _skill = skill; + _chance = chance; + _type = type; + } + + public Skill getSkill() + { + return _skill; + } + + public double getChance() + { + return _chance; + } + + public OptionSkillType getSkillType() + { + return _type; + } +} diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java new file mode 100644 index 0000000000..689c956312 --- /dev/null +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java @@ -0,0 +1,27 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +/** + * @author UnAfraid + */ +public enum OptionSkillType +{ + ATTACK, + MAGIC, + CRITICAL +} diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/options/Options.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/options/Options.java index 9eb5d46e9e..0299901a34 100644 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/options/Options.java +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/options/Options.java @@ -22,7 +22,6 @@ import java.util.List; import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.skill.BuffInfo; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; @@ -34,9 +33,9 @@ public class Options { private final int _id; private List _effects = null; - private List _activeSkill = null; - private List _passiveSkill = null; - private List _activationSkills = null; + private List _activeSkill = null; + private List _passiveSkill = null; + private List _activationSkills = null; /** * @param id @@ -75,12 +74,12 @@ public class Options return _activeSkill != null; } - public List getActiveSkills() + public List getActiveSkills() { return _activeSkill; } - public void addActiveSkill(SkillHolder holder) + public void addActiveSkill(Skill holder) { if (_activeSkill == null) { @@ -94,12 +93,12 @@ public class Options return _passiveSkill != null; } - public List getPassiveSkills() + public List getPassiveSkills() { return _passiveSkill; } - public void addPassiveSkill(SkillHolder holder) + public void addPassiveSkill(Skill holder) { if (_passiveSkill == null) { @@ -113,11 +112,11 @@ public class Options return _activationSkills != null; } - public boolean hasActivationSkills(OptionsSkillType type) + public boolean hasActivationSkills(OptionSkillType type) { if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -128,17 +127,17 @@ public class Options return false; } - public List getActivationsSkills() + public List getActivationSkills() { return _activationSkills; } - public List getActivationsSkills(OptionsSkillType type) + public List getActivationSkills(OptionSkillType type) { - final List temp = new ArrayList<>(); + final List temp = new ArrayList<>(); if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -149,7 +148,7 @@ public class Options return temp; } - public void addActivationSkill(OptionsSkillHolder holder) + public void addActivationSkill(OptionSkillHolder holder) { if (_activationSkills == null) { @@ -189,21 +188,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.addTriggerSkill(holder); } @@ -227,21 +226,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - player.removeSkill(holder.getSkill(), false, false); + player.removeSkill(skill, false, false); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - player.removeSkill(holder.getSkill(), false, true); + player.removeSkill(skill, false, true); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.removeTriggerSkill(holder); } diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java deleted file mode 100644 index fc42843b8a..0000000000 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -import org.l2jmobius.gameserver.model.holders.SkillHolder; - -/** - * @author UnAfraid - */ -public class OptionsSkillHolder extends SkillHolder -{ - private final OptionsSkillType _type; - private final double _chance; - - /** - * @param skillId - * @param skillLevel - * @param type - * @param chance - */ - public OptionsSkillHolder(int skillId, int skillLevel, double chance, OptionsSkillType type) - { - super(skillId, skillLevel); - _chance = chance; - _type = type; - } - - public OptionsSkillType getSkillType() - { - return _type; - } - - public double getChance() - { - return _chance; - } -} diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java deleted file mode 100644 index 7c216d20f7..0000000000 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -/** - * @author UnAfraid - */ -public enum OptionsSkillType -{ - ATTACK, - MAGIC, - CRITICAL -} diff --git a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java index f53f8fe0dd..4cd475b3a5 100644 --- a/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java +++ b/L2J_Mobius_05.0_Salvation/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java @@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate; import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.ActionType; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.zone.ZoneId; @@ -602,9 +602,9 @@ public class SkillCaster implements Runnable if (caster.hasTriggerSkills()) { - for (OptionsSkillHolder holder : caster.getTriggerSkills().values()) + for (OptionSkillHolder holder : caster.getTriggerSkills().values()) { - if (((skill.isMagic() && (holder.getSkillType() == OptionsSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionsSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) + if (((skill.isMagic() && (holder.getSkillType() == OptionSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) { triggerCast(caster, creature, holder.getSkill(), null, false); } diff --git a/L2J_Mobius_05.5_EtinasFate/dist/game/data/stats/augmentation/options/31900-31999.xml b/L2J_Mobius_05.5_EtinasFate/dist/game/data/stats/augmentation/options/31900-31999.xml index be0482ea1b..b6608f9db4 100644 --- a/L2J_Mobius_05.5_EtinasFate/dist/game/data/stats/augmentation/options/31900-31999.xml +++ b/L2J_Mobius_05.5_EtinasFate/dist/game/data/stats/augmentation/options/31900-31999.xml @@ -819,15 +819,12 @@ - - - - - - - - - - - diff --git a/L2J_Mobius_05.5_EtinasFate/dist/game/data/stats/augmentation/options/41000-41099.xml b/L2J_Mobius_05.5_EtinasFate/dist/game/data/stats/augmentation/options/41000-41099.xml deleted file mode 100644 index 26de4d23e5..0000000000 --- a/L2J_Mobius_05.5_EtinasFate/dist/game/data/stats/augmentation/options/41000-41099.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/data/xml/OptionData.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/data/xml/OptionData.java index f563b02755..86e0c8f1fb 100644 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/data/xml/OptionData.java +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/data/xml/OptionData.java @@ -28,10 +28,10 @@ import org.w3c.dom.Document; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.options.Options; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; +import org.l2jmobius.gameserver.model.skill.Skill; /** * @author UnAfraid @@ -88,27 +88,77 @@ public class OptionData implements IXmlReader } case "active_skill": { - option.addActiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "passive_skill": { - option.addPassiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addPassiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "attack_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.ATTACK)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.ATTACK)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "magic_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.MAGIC)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.MAGIC)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "critical_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.CRITICAL)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.CRITICAL)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } } diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java index f6b4b70beb..e247586795 100644 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -121,8 +121,8 @@ import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.EtcItemType; import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffInfo; @@ -236,7 +236,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe private boolean _lethalable = true; - private Map _triggerSkills; + private Map _triggerSkills; private Map _ignoreSkillEffects; /** Creatures effect list. */ @@ -3903,9 +3903,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (_triggerSkills != null) { - for (OptionsSkillHolder holder : _triggerSkills.values()) + for (OptionSkillHolder holder : _triggerSkills.values()) { - if (((!hit.isCritical() && (holder.getSkillType() == OptionsSkillType.ATTACK)) || ((holder.getSkillType() == OptionsSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) + if (((!hit.isCritical() && (holder.getSkillType() == OptionSkillType.ATTACK)) || ((holder.getSkillType() == OptionSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) { SkillCaster.triggerCast(this, target, holder.getSkill(), null, false); } @@ -4943,7 +4943,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return (_triggerSkills != null) && !_triggerSkills.isEmpty(); } - public Map getTriggerSkills() + public Map getTriggerSkills() { if (_triggerSkills == null) { @@ -4951,21 +4951,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe { if (_triggerSkills == null) { - _triggerSkills = new ConcurrentHashMap<>(); + _triggerSkills = new ConcurrentHashMap<>(1); } } } return _triggerSkills; } - public void addTriggerSkill(OptionsSkillHolder holder) + public void addTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().put(holder.getSkillId(), holder); + getTriggerSkills().put(holder.getSkill().getId(), holder); } - public void removeTriggerSkill(OptionsSkillHolder holder) + public void removeTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().remove(holder.getSkillId()); + getTriggerSkills().remove(holder.getSkill().getId()); } /** diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java new file mode 100644 index 0000000000..52f00e5d78 --- /dev/null +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java @@ -0,0 +1,56 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +import org.l2jmobius.gameserver.model.skill.Skill; + +/** + * @author UnAfraid, Mobius + */ +public class OptionSkillHolder +{ + private final Skill _skill; + private final double _chance; + private final OptionSkillType _type; + + /** + * @param skill + * @param type + * @param chance + */ + public OptionSkillHolder(Skill skill, double chance, OptionSkillType type) + { + _skill = skill; + _chance = chance; + _type = type; + } + + public Skill getSkill() + { + return _skill; + } + + public double getChance() + { + return _chance; + } + + public OptionSkillType getSkillType() + { + return _type; + } +} diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java new file mode 100644 index 0000000000..689c956312 --- /dev/null +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java @@ -0,0 +1,27 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +/** + * @author UnAfraid + */ +public enum OptionSkillType +{ + ATTACK, + MAGIC, + CRITICAL +} diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/options/Options.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/options/Options.java index 9eb5d46e9e..0299901a34 100644 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/options/Options.java +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/options/Options.java @@ -22,7 +22,6 @@ import java.util.List; import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.skill.BuffInfo; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; @@ -34,9 +33,9 @@ public class Options { private final int _id; private List _effects = null; - private List _activeSkill = null; - private List _passiveSkill = null; - private List _activationSkills = null; + private List _activeSkill = null; + private List _passiveSkill = null; + private List _activationSkills = null; /** * @param id @@ -75,12 +74,12 @@ public class Options return _activeSkill != null; } - public List getActiveSkills() + public List getActiveSkills() { return _activeSkill; } - public void addActiveSkill(SkillHolder holder) + public void addActiveSkill(Skill holder) { if (_activeSkill == null) { @@ -94,12 +93,12 @@ public class Options return _passiveSkill != null; } - public List getPassiveSkills() + public List getPassiveSkills() { return _passiveSkill; } - public void addPassiveSkill(SkillHolder holder) + public void addPassiveSkill(Skill holder) { if (_passiveSkill == null) { @@ -113,11 +112,11 @@ public class Options return _activationSkills != null; } - public boolean hasActivationSkills(OptionsSkillType type) + public boolean hasActivationSkills(OptionSkillType type) { if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -128,17 +127,17 @@ public class Options return false; } - public List getActivationsSkills() + public List getActivationSkills() { return _activationSkills; } - public List getActivationsSkills(OptionsSkillType type) + public List getActivationSkills(OptionSkillType type) { - final List temp = new ArrayList<>(); + final List temp = new ArrayList<>(); if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -149,7 +148,7 @@ public class Options return temp; } - public void addActivationSkill(OptionsSkillHolder holder) + public void addActivationSkill(OptionSkillHolder holder) { if (_activationSkills == null) { @@ -189,21 +188,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.addTriggerSkill(holder); } @@ -227,21 +226,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - player.removeSkill(holder.getSkill(), false, false); + player.removeSkill(skill, false, false); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - player.removeSkill(holder.getSkill(), false, true); + player.removeSkill(skill, false, true); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.removeTriggerSkill(holder); } diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java deleted file mode 100644 index fc42843b8a..0000000000 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -import org.l2jmobius.gameserver.model.holders.SkillHolder; - -/** - * @author UnAfraid - */ -public class OptionsSkillHolder extends SkillHolder -{ - private final OptionsSkillType _type; - private final double _chance; - - /** - * @param skillId - * @param skillLevel - * @param type - * @param chance - */ - public OptionsSkillHolder(int skillId, int skillLevel, double chance, OptionsSkillType type) - { - super(skillId, skillLevel); - _chance = chance; - _type = type; - } - - public OptionsSkillType getSkillType() - { - return _type; - } - - public double getChance() - { - return _chance; - } -} diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java deleted file mode 100644 index 7c216d20f7..0000000000 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -/** - * @author UnAfraid - */ -public enum OptionsSkillType -{ - ATTACK, - MAGIC, - CRITICAL -} diff --git a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java index f53f8fe0dd..4cd475b3a5 100644 --- a/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java +++ b/L2J_Mobius_05.5_EtinasFate/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java @@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate; import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.ActionType; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.zone.ZoneId; @@ -602,9 +602,9 @@ public class SkillCaster implements Runnable if (caster.hasTriggerSkills()) { - for (OptionsSkillHolder holder : caster.getTriggerSkills().values()) + for (OptionSkillHolder holder : caster.getTriggerSkills().values()) { - if (((skill.isMagic() && (holder.getSkillType() == OptionsSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionsSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) + if (((skill.isMagic() && (holder.getSkillType() == OptionSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) { triggerCast(caster, creature, holder.getSkill(), null, false); } diff --git a/L2J_Mobius_06.0_Fafurion/dist/game/data/stats/augmentation/options/31900-31999.xml b/L2J_Mobius_06.0_Fafurion/dist/game/data/stats/augmentation/options/31900-31999.xml index be0482ea1b..b6608f9db4 100644 --- a/L2J_Mobius_06.0_Fafurion/dist/game/data/stats/augmentation/options/31900-31999.xml +++ b/L2J_Mobius_06.0_Fafurion/dist/game/data/stats/augmentation/options/31900-31999.xml @@ -819,15 +819,12 @@ - - - - - - - - - - - diff --git a/L2J_Mobius_06.0_Fafurion/dist/game/data/stats/augmentation/options/41000-41099.xml b/L2J_Mobius_06.0_Fafurion/dist/game/data/stats/augmentation/options/41000-41099.xml deleted file mode 100644 index 26de4d23e5..0000000000 --- a/L2J_Mobius_06.0_Fafurion/dist/game/data/stats/augmentation/options/41000-41099.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/data/xml/OptionData.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/data/xml/OptionData.java index f563b02755..86e0c8f1fb 100644 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/data/xml/OptionData.java +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/data/xml/OptionData.java @@ -28,10 +28,10 @@ import org.w3c.dom.Document; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.options.Options; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; +import org.l2jmobius.gameserver.model.skill.Skill; /** * @author UnAfraid @@ -88,27 +88,77 @@ public class OptionData implements IXmlReader } case "active_skill": { - option.addActiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "passive_skill": { - option.addPassiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addPassiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "attack_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.ATTACK)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.ATTACK)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "magic_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.MAGIC)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.MAGIC)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "critical_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.CRITICAL)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.CRITICAL)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } } diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java index f6b4b70beb..e247586795 100644 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -121,8 +121,8 @@ import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.EtcItemType; import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffInfo; @@ -236,7 +236,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe private boolean _lethalable = true; - private Map _triggerSkills; + private Map _triggerSkills; private Map _ignoreSkillEffects; /** Creatures effect list. */ @@ -3903,9 +3903,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (_triggerSkills != null) { - for (OptionsSkillHolder holder : _triggerSkills.values()) + for (OptionSkillHolder holder : _triggerSkills.values()) { - if (((!hit.isCritical() && (holder.getSkillType() == OptionsSkillType.ATTACK)) || ((holder.getSkillType() == OptionsSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) + if (((!hit.isCritical() && (holder.getSkillType() == OptionSkillType.ATTACK)) || ((holder.getSkillType() == OptionSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) { SkillCaster.triggerCast(this, target, holder.getSkill(), null, false); } @@ -4943,7 +4943,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return (_triggerSkills != null) && !_triggerSkills.isEmpty(); } - public Map getTriggerSkills() + public Map getTriggerSkills() { if (_triggerSkills == null) { @@ -4951,21 +4951,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe { if (_triggerSkills == null) { - _triggerSkills = new ConcurrentHashMap<>(); + _triggerSkills = new ConcurrentHashMap<>(1); } } } return _triggerSkills; } - public void addTriggerSkill(OptionsSkillHolder holder) + public void addTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().put(holder.getSkillId(), holder); + getTriggerSkills().put(holder.getSkill().getId(), holder); } - public void removeTriggerSkill(OptionsSkillHolder holder) + public void removeTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().remove(holder.getSkillId()); + getTriggerSkills().remove(holder.getSkill().getId()); } /** diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java new file mode 100644 index 0000000000..52f00e5d78 --- /dev/null +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java @@ -0,0 +1,56 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +import org.l2jmobius.gameserver.model.skill.Skill; + +/** + * @author UnAfraid, Mobius + */ +public class OptionSkillHolder +{ + private final Skill _skill; + private final double _chance; + private final OptionSkillType _type; + + /** + * @param skill + * @param type + * @param chance + */ + public OptionSkillHolder(Skill skill, double chance, OptionSkillType type) + { + _skill = skill; + _chance = chance; + _type = type; + } + + public Skill getSkill() + { + return _skill; + } + + public double getChance() + { + return _chance; + } + + public OptionSkillType getSkillType() + { + return _type; + } +} diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java new file mode 100644 index 0000000000..689c956312 --- /dev/null +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java @@ -0,0 +1,27 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +/** + * @author UnAfraid + */ +public enum OptionSkillType +{ + ATTACK, + MAGIC, + CRITICAL +} diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/options/Options.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/options/Options.java index 9eb5d46e9e..0299901a34 100644 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/options/Options.java +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/options/Options.java @@ -22,7 +22,6 @@ import java.util.List; import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.skill.BuffInfo; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; @@ -34,9 +33,9 @@ public class Options { private final int _id; private List _effects = null; - private List _activeSkill = null; - private List _passiveSkill = null; - private List _activationSkills = null; + private List _activeSkill = null; + private List _passiveSkill = null; + private List _activationSkills = null; /** * @param id @@ -75,12 +74,12 @@ public class Options return _activeSkill != null; } - public List getActiveSkills() + public List getActiveSkills() { return _activeSkill; } - public void addActiveSkill(SkillHolder holder) + public void addActiveSkill(Skill holder) { if (_activeSkill == null) { @@ -94,12 +93,12 @@ public class Options return _passiveSkill != null; } - public List getPassiveSkills() + public List getPassiveSkills() { return _passiveSkill; } - public void addPassiveSkill(SkillHolder holder) + public void addPassiveSkill(Skill holder) { if (_passiveSkill == null) { @@ -113,11 +112,11 @@ public class Options return _activationSkills != null; } - public boolean hasActivationSkills(OptionsSkillType type) + public boolean hasActivationSkills(OptionSkillType type) { if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -128,17 +127,17 @@ public class Options return false; } - public List getActivationsSkills() + public List getActivationSkills() { return _activationSkills; } - public List getActivationsSkills(OptionsSkillType type) + public List getActivationSkills(OptionSkillType type) { - final List temp = new ArrayList<>(); + final List temp = new ArrayList<>(); if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -149,7 +148,7 @@ public class Options return temp; } - public void addActivationSkill(OptionsSkillHolder holder) + public void addActivationSkill(OptionSkillHolder holder) { if (_activationSkills == null) { @@ -189,21 +188,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.addTriggerSkill(holder); } @@ -227,21 +226,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - player.removeSkill(holder.getSkill(), false, false); + player.removeSkill(skill, false, false); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - player.removeSkill(holder.getSkill(), false, true); + player.removeSkill(skill, false, true); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.removeTriggerSkill(holder); } diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java deleted file mode 100644 index fc42843b8a..0000000000 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -import org.l2jmobius.gameserver.model.holders.SkillHolder; - -/** - * @author UnAfraid - */ -public class OptionsSkillHolder extends SkillHolder -{ - private final OptionsSkillType _type; - private final double _chance; - - /** - * @param skillId - * @param skillLevel - * @param type - * @param chance - */ - public OptionsSkillHolder(int skillId, int skillLevel, double chance, OptionsSkillType type) - { - super(skillId, skillLevel); - _chance = chance; - _type = type; - } - - public OptionsSkillType getSkillType() - { - return _type; - } - - public double getChance() - { - return _chance; - } -} diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java deleted file mode 100644 index 7c216d20f7..0000000000 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -/** - * @author UnAfraid - */ -public enum OptionsSkillType -{ - ATTACK, - MAGIC, - CRITICAL -} diff --git a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java index f53f8fe0dd..4cd475b3a5 100644 --- a/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java +++ b/L2J_Mobius_06.0_Fafurion/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java @@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate; import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.ActionType; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.zone.ZoneId; @@ -602,9 +602,9 @@ public class SkillCaster implements Runnable if (caster.hasTriggerSkills()) { - for (OptionsSkillHolder holder : caster.getTriggerSkills().values()) + for (OptionSkillHolder holder : caster.getTriggerSkills().values()) { - if (((skill.isMagic() && (holder.getSkillType() == OptionsSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionsSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) + if (((skill.isMagic() && (holder.getSkillType() == OptionSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) { triggerCast(caster, creature, holder.getSkill(), null, false); } diff --git a/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/stats/augmentation/options/31900-31999.xml b/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/stats/augmentation/options/31900-31999.xml index be0482ea1b..b6608f9db4 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/stats/augmentation/options/31900-31999.xml +++ b/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/stats/augmentation/options/31900-31999.xml @@ -819,15 +819,12 @@ - - - - - - - - - - - diff --git a/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/stats/augmentation/options/41000-41099.xml b/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/stats/augmentation/options/41000-41099.xml deleted file mode 100644 index 26de4d23e5..0000000000 --- a/L2J_Mobius_07.0_PreludeOfWar/dist/game/data/stats/augmentation/options/41000-41099.xml +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/data/xml/OptionData.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/data/xml/OptionData.java index f563b02755..86e0c8f1fb 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/data/xml/OptionData.java +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/data/xml/OptionData.java @@ -28,10 +28,10 @@ import org.w3c.dom.Document; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.options.Options; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; +import org.l2jmobius.gameserver.model.skill.Skill; /** * @author UnAfraid @@ -88,27 +88,77 @@ public class OptionData implements IXmlReader } case "active_skill": { - option.addActiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "passive_skill": { - option.addPassiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addPassiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "attack_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.ATTACK)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.ATTACK)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "magic_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.MAGIC)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.MAGIC)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "critical_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.CRITICAL)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.CRITICAL)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } } diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java index a696eec632..2fb2fca802 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -121,8 +121,8 @@ import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.EtcItemType; import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffInfo; @@ -236,7 +236,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe private boolean _lethalable = true; - private Map _triggerSkills; + private Map _triggerSkills; private Map _ignoreSkillEffects; /** Creatures effect list. */ @@ -3902,9 +3902,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (_triggerSkills != null) { - for (OptionsSkillHolder holder : _triggerSkills.values()) + for (OptionSkillHolder holder : _triggerSkills.values()) { - if (((!hit.isCritical() && (holder.getSkillType() == OptionsSkillType.ATTACK)) || ((holder.getSkillType() == OptionsSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) + if (((!hit.isCritical() && (holder.getSkillType() == OptionSkillType.ATTACK)) || ((holder.getSkillType() == OptionSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) { SkillCaster.triggerCast(this, target, holder.getSkill(), null, false); } @@ -4942,7 +4942,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return (_triggerSkills != null) && !_triggerSkills.isEmpty(); } - public Map getTriggerSkills() + public Map getTriggerSkills() { if (_triggerSkills == null) { @@ -4950,21 +4950,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe { if (_triggerSkills == null) { - _triggerSkills = new ConcurrentHashMap<>(); + _triggerSkills = new ConcurrentHashMap<>(1); } } } return _triggerSkills; } - public void addTriggerSkill(OptionsSkillHolder holder) + public void addTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().put(holder.getSkillId(), holder); + getTriggerSkills().put(holder.getSkill().getId(), holder); } - public void removeTriggerSkill(OptionsSkillHolder holder) + public void removeTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().remove(holder.getSkillId()); + getTriggerSkills().remove(holder.getSkill().getId()); } /** diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java new file mode 100644 index 0000000000..52f00e5d78 --- /dev/null +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java @@ -0,0 +1,56 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +import org.l2jmobius.gameserver.model.skill.Skill; + +/** + * @author UnAfraid, Mobius + */ +public class OptionSkillHolder +{ + private final Skill _skill; + private final double _chance; + private final OptionSkillType _type; + + /** + * @param skill + * @param type + * @param chance + */ + public OptionSkillHolder(Skill skill, double chance, OptionSkillType type) + { + _skill = skill; + _chance = chance; + _type = type; + } + + public Skill getSkill() + { + return _skill; + } + + public double getChance() + { + return _chance; + } + + public OptionSkillType getSkillType() + { + return _type; + } +} diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java new file mode 100644 index 0000000000..689c956312 --- /dev/null +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java @@ -0,0 +1,27 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +/** + * @author UnAfraid + */ +public enum OptionSkillType +{ + ATTACK, + MAGIC, + CRITICAL +} diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/options/Options.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/options/Options.java index 9eb5d46e9e..0299901a34 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/options/Options.java +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/options/Options.java @@ -22,7 +22,6 @@ import java.util.List; import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.skill.BuffInfo; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; @@ -34,9 +33,9 @@ public class Options { private final int _id; private List _effects = null; - private List _activeSkill = null; - private List _passiveSkill = null; - private List _activationSkills = null; + private List _activeSkill = null; + private List _passiveSkill = null; + private List _activationSkills = null; /** * @param id @@ -75,12 +74,12 @@ public class Options return _activeSkill != null; } - public List getActiveSkills() + public List getActiveSkills() { return _activeSkill; } - public void addActiveSkill(SkillHolder holder) + public void addActiveSkill(Skill holder) { if (_activeSkill == null) { @@ -94,12 +93,12 @@ public class Options return _passiveSkill != null; } - public List getPassiveSkills() + public List getPassiveSkills() { return _passiveSkill; } - public void addPassiveSkill(SkillHolder holder) + public void addPassiveSkill(Skill holder) { if (_passiveSkill == null) { @@ -113,11 +112,11 @@ public class Options return _activationSkills != null; } - public boolean hasActivationSkills(OptionsSkillType type) + public boolean hasActivationSkills(OptionSkillType type) { if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -128,17 +127,17 @@ public class Options return false; } - public List getActivationsSkills() + public List getActivationSkills() { return _activationSkills; } - public List getActivationsSkills(OptionsSkillType type) + public List getActivationSkills(OptionSkillType type) { - final List temp = new ArrayList<>(); + final List temp = new ArrayList<>(); if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -149,7 +148,7 @@ public class Options return temp; } - public void addActivationSkill(OptionsSkillHolder holder) + public void addActivationSkill(OptionSkillHolder holder) { if (_activationSkills == null) { @@ -189,21 +188,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.addTriggerSkill(holder); } @@ -227,21 +226,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - player.removeSkill(holder.getSkill(), false, false); + player.removeSkill(skill, false, false); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - player.removeSkill(holder.getSkill(), false, true); + player.removeSkill(skill, false, true); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.removeTriggerSkill(holder); } diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java deleted file mode 100644 index fc42843b8a..0000000000 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -import org.l2jmobius.gameserver.model.holders.SkillHolder; - -/** - * @author UnAfraid - */ -public class OptionsSkillHolder extends SkillHolder -{ - private final OptionsSkillType _type; - private final double _chance; - - /** - * @param skillId - * @param skillLevel - * @param type - * @param chance - */ - public OptionsSkillHolder(int skillId, int skillLevel, double chance, OptionsSkillType type) - { - super(skillId, skillLevel); - _chance = chance; - _type = type; - } - - public OptionsSkillType getSkillType() - { - return _type; - } - - public double getChance() - { - return _chance; - } -} diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java deleted file mode 100644 index 7c216d20f7..0000000000 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -/** - * @author UnAfraid - */ -public enum OptionsSkillType -{ - ATTACK, - MAGIC, - CRITICAL -} diff --git a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java index 0f89b9a012..83fa8eec42 100644 --- a/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java +++ b/L2J_Mobius_07.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java @@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate; import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.ActionType; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.zone.ZoneId; @@ -602,9 +602,9 @@ public class SkillCaster implements Runnable if (caster.hasTriggerSkills()) { - for (OptionsSkillHolder holder : caster.getTriggerSkills().values()) + for (OptionSkillHolder holder : caster.getTriggerSkills().values()) { - if (((skill.isMagic() && (holder.getSkillType() == OptionsSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionsSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) + if (((skill.isMagic() && (holder.getSkillType() == OptionSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) { triggerCast(caster, creature, holder.getSkill(), null, false); } diff --git a/L2J_Mobius_08.2_Homunculus/dist/game/data/stats/augmentation/options/31900-31999.xml b/L2J_Mobius_08.2_Homunculus/dist/game/data/stats/augmentation/options/31900-31999.xml index be0482ea1b..b6608f9db4 100644 --- a/L2J_Mobius_08.2_Homunculus/dist/game/data/stats/augmentation/options/31900-31999.xml +++ b/L2J_Mobius_08.2_Homunculus/dist/game/data/stats/augmentation/options/31900-31999.xml @@ -819,15 +819,12 @@ + + + + + diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/data/xml/OptionData.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/data/xml/OptionData.java index 696f93dfa8..79b9935825 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/data/xml/OptionData.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/data/xml/OptionData.java @@ -28,10 +28,10 @@ import org.w3c.dom.Document; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.options.Options; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; +import org.l2jmobius.gameserver.model.skill.Skill; /** * @author UnAfraid @@ -88,27 +88,77 @@ public class OptionData implements IXmlReader } case "active_skill": { - option.addActiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "passive_skill": { - option.addPassiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addPassiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "attack_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.ATTACK)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.ATTACK)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "magic_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.MAGIC)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.MAGIC)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "critical_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.CRITICAL)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.CRITICAL)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } } diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/Creature.java index 703815ff22..2c9afe3d56 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -121,8 +121,8 @@ import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.EtcItemType; import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffInfo; @@ -236,7 +236,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe private boolean _lethalable = true; - private Map _triggerSkills; + private Map _triggerSkills; private Map _ignoreSkillEffects; /** Creatures effect list. */ @@ -3902,9 +3902,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (_triggerSkills != null) { - for (OptionsSkillHolder holder : _triggerSkills.values()) + for (OptionSkillHolder holder : _triggerSkills.values()) { - if (((!hit.isCritical() && (holder.getSkillType() == OptionsSkillType.ATTACK)) || ((holder.getSkillType() == OptionsSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) + if (((!hit.isCritical() && (holder.getSkillType() == OptionSkillType.ATTACK)) || ((holder.getSkillType() == OptionSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) { SkillCaster.triggerCast(this, target, holder.getSkill(), null, false); } @@ -4942,7 +4942,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return (_triggerSkills != null) && !_triggerSkills.isEmpty(); } - public Map getTriggerSkills() + public Map getTriggerSkills() { if (_triggerSkills == null) { @@ -4950,21 +4950,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe { if (_triggerSkills == null) { - _triggerSkills = new ConcurrentHashMap<>(); + _triggerSkills = new ConcurrentHashMap<>(1); } } } return _triggerSkills; } - public void addTriggerSkill(OptionsSkillHolder holder) + public void addTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().put(holder.getSkillId(), holder); + getTriggerSkills().put(holder.getSkill().getId(), holder); } - public void removeTriggerSkill(OptionsSkillHolder holder) + public void removeTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().remove(holder.getSkillId()); + getTriggerSkills().remove(holder.getSkill().getId()); } /** diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java new file mode 100644 index 0000000000..52f00e5d78 --- /dev/null +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java @@ -0,0 +1,56 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +import org.l2jmobius.gameserver.model.skill.Skill; + +/** + * @author UnAfraid, Mobius + */ +public class OptionSkillHolder +{ + private final Skill _skill; + private final double _chance; + private final OptionSkillType _type; + + /** + * @param skill + * @param type + * @param chance + */ + public OptionSkillHolder(Skill skill, double chance, OptionSkillType type) + { + _skill = skill; + _chance = chance; + _type = type; + } + + public Skill getSkill() + { + return _skill; + } + + public double getChance() + { + return _chance; + } + + public OptionSkillType getSkillType() + { + return _type; + } +} diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java new file mode 100644 index 0000000000..689c956312 --- /dev/null +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java @@ -0,0 +1,27 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +/** + * @author UnAfraid + */ +public enum OptionSkillType +{ + ATTACK, + MAGIC, + CRITICAL +} diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/options/Options.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/options/Options.java index 9eb5d46e9e..0299901a34 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/options/Options.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/options/Options.java @@ -22,7 +22,6 @@ import java.util.List; import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.skill.BuffInfo; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; @@ -34,9 +33,9 @@ public class Options { private final int _id; private List _effects = null; - private List _activeSkill = null; - private List _passiveSkill = null; - private List _activationSkills = null; + private List _activeSkill = null; + private List _passiveSkill = null; + private List _activationSkills = null; /** * @param id @@ -75,12 +74,12 @@ public class Options return _activeSkill != null; } - public List getActiveSkills() + public List getActiveSkills() { return _activeSkill; } - public void addActiveSkill(SkillHolder holder) + public void addActiveSkill(Skill holder) { if (_activeSkill == null) { @@ -94,12 +93,12 @@ public class Options return _passiveSkill != null; } - public List getPassiveSkills() + public List getPassiveSkills() { return _passiveSkill; } - public void addPassiveSkill(SkillHolder holder) + public void addPassiveSkill(Skill holder) { if (_passiveSkill == null) { @@ -113,11 +112,11 @@ public class Options return _activationSkills != null; } - public boolean hasActivationSkills(OptionsSkillType type) + public boolean hasActivationSkills(OptionSkillType type) { if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -128,17 +127,17 @@ public class Options return false; } - public List getActivationsSkills() + public List getActivationSkills() { return _activationSkills; } - public List getActivationsSkills(OptionsSkillType type) + public List getActivationSkills(OptionSkillType type) { - final List temp = new ArrayList<>(); + final List temp = new ArrayList<>(); if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -149,7 +148,7 @@ public class Options return temp; } - public void addActivationSkill(OptionsSkillHolder holder) + public void addActivationSkill(OptionSkillHolder holder) { if (_activationSkills == null) { @@ -189,21 +188,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.addTriggerSkill(holder); } @@ -227,21 +226,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - player.removeSkill(holder.getSkill(), false, false); + player.removeSkill(skill, false, false); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - player.removeSkill(holder.getSkill(), false, true); + player.removeSkill(skill, false, true); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.removeTriggerSkill(holder); } diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java deleted file mode 100644 index fc42843b8a..0000000000 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -import org.l2jmobius.gameserver.model.holders.SkillHolder; - -/** - * @author UnAfraid - */ -public class OptionsSkillHolder extends SkillHolder -{ - private final OptionsSkillType _type; - private final double _chance; - - /** - * @param skillId - * @param skillLevel - * @param type - * @param chance - */ - public OptionsSkillHolder(int skillId, int skillLevel, double chance, OptionsSkillType type) - { - super(skillId, skillLevel); - _chance = chance; - _type = type; - } - - public OptionsSkillType getSkillType() - { - return _type; - } - - public double getChance() - { - return _chance; - } -} diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java deleted file mode 100644 index 7c216d20f7..0000000000 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -/** - * @author UnAfraid - */ -public enum OptionsSkillType -{ - ATTACK, - MAGIC, - CRITICAL -} diff --git a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java index 59756978e0..cb701ae625 100644 --- a/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java +++ b/L2J_Mobius_09.2_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java @@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate; import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.ActionType; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.stats.Stat; @@ -603,9 +603,9 @@ public class SkillCaster implements Runnable if (caster.hasTriggerSkills()) { - for (OptionsSkillHolder holder : caster.getTriggerSkills().values()) + for (OptionSkillHolder holder : caster.getTriggerSkills().values()) { - if (((skill.isMagic() && (holder.getSkillType() == OptionsSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionsSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) + if (((skill.isMagic() && (holder.getSkillType() == OptionSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) { triggerCast(caster, creature, holder.getSkill(), null, false); } diff --git a/L2J_Mobius_10.1_MasterClass/dist/game/data/stats/augmentation/options/31900-31999.xml b/L2J_Mobius_10.1_MasterClass/dist/game/data/stats/augmentation/options/31900-31999.xml index be0482ea1b..b6608f9db4 100644 --- a/L2J_Mobius_10.1_MasterClass/dist/game/data/stats/augmentation/options/31900-31999.xml +++ b/L2J_Mobius_10.1_MasterClass/dist/game/data/stats/augmentation/options/31900-31999.xml @@ -819,15 +819,12 @@ + + + + + diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/data/xml/OptionData.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/data/xml/OptionData.java index 696f93dfa8..79b9935825 100644 --- a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/data/xml/OptionData.java +++ b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/data/xml/OptionData.java @@ -28,10 +28,10 @@ import org.w3c.dom.Document; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.options.Options; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; +import org.l2jmobius.gameserver.model.skill.Skill; /** * @author UnAfraid @@ -88,27 +88,77 @@ public class OptionData implements IXmlReader } case "active_skill": { - option.addActiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "passive_skill": { - option.addPassiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addPassiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "attack_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.ATTACK)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.ATTACK)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "magic_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.MAGIC)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.MAGIC)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "critical_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.CRITICAL)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.CRITICAL)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } } diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/actor/Creature.java index fa0cf6a568..2098460543 100644 --- a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -121,8 +121,8 @@ import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.EtcItemType; import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffInfo; @@ -236,7 +236,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe private boolean _lethalable = true; - private Map _triggerSkills; + private Map _triggerSkills; private Map _ignoreSkillEffects; /** Creatures effect list. */ @@ -3902,9 +3902,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (_triggerSkills != null) { - for (OptionsSkillHolder holder : _triggerSkills.values()) + for (OptionSkillHolder holder : _triggerSkills.values()) { - if (((!hit.isCritical() && (holder.getSkillType() == OptionsSkillType.ATTACK)) || ((holder.getSkillType() == OptionsSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) + if (((!hit.isCritical() && (holder.getSkillType() == OptionSkillType.ATTACK)) || ((holder.getSkillType() == OptionSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) { SkillCaster.triggerCast(this, target, holder.getSkill(), null, false); } @@ -4942,7 +4942,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return (_triggerSkills != null) && !_triggerSkills.isEmpty(); } - public Map getTriggerSkills() + public Map getTriggerSkills() { if (_triggerSkills == null) { @@ -4950,21 +4950,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe { if (_triggerSkills == null) { - _triggerSkills = new ConcurrentHashMap<>(); + _triggerSkills = new ConcurrentHashMap<>(1); } } } return _triggerSkills; } - public void addTriggerSkill(OptionsSkillHolder holder) + public void addTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().put(holder.getSkillId(), holder); + getTriggerSkills().put(holder.getSkill().getId(), holder); } - public void removeTriggerSkill(OptionsSkillHolder holder) + public void removeTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().remove(holder.getSkillId()); + getTriggerSkills().remove(holder.getSkill().getId()); } /** diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java new file mode 100644 index 0000000000..52f00e5d78 --- /dev/null +++ b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java @@ -0,0 +1,56 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +import org.l2jmobius.gameserver.model.skill.Skill; + +/** + * @author UnAfraid, Mobius + */ +public class OptionSkillHolder +{ + private final Skill _skill; + private final double _chance; + private final OptionSkillType _type; + + /** + * @param skill + * @param type + * @param chance + */ + public OptionSkillHolder(Skill skill, double chance, OptionSkillType type) + { + _skill = skill; + _chance = chance; + _type = type; + } + + public Skill getSkill() + { + return _skill; + } + + public double getChance() + { + return _chance; + } + + public OptionSkillType getSkillType() + { + return _type; + } +} diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java new file mode 100644 index 0000000000..689c956312 --- /dev/null +++ b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java @@ -0,0 +1,27 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +/** + * @author UnAfraid + */ +public enum OptionSkillType +{ + ATTACK, + MAGIC, + CRITICAL +} diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/options/Options.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/options/Options.java index 9eb5d46e9e..0299901a34 100644 --- a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/options/Options.java +++ b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/options/Options.java @@ -22,7 +22,6 @@ import java.util.List; import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.skill.BuffInfo; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; @@ -34,9 +33,9 @@ public class Options { private final int _id; private List _effects = null; - private List _activeSkill = null; - private List _passiveSkill = null; - private List _activationSkills = null; + private List _activeSkill = null; + private List _passiveSkill = null; + private List _activationSkills = null; /** * @param id @@ -75,12 +74,12 @@ public class Options return _activeSkill != null; } - public List getActiveSkills() + public List getActiveSkills() { return _activeSkill; } - public void addActiveSkill(SkillHolder holder) + public void addActiveSkill(Skill holder) { if (_activeSkill == null) { @@ -94,12 +93,12 @@ public class Options return _passiveSkill != null; } - public List getPassiveSkills() + public List getPassiveSkills() { return _passiveSkill; } - public void addPassiveSkill(SkillHolder holder) + public void addPassiveSkill(Skill holder) { if (_passiveSkill == null) { @@ -113,11 +112,11 @@ public class Options return _activationSkills != null; } - public boolean hasActivationSkills(OptionsSkillType type) + public boolean hasActivationSkills(OptionSkillType type) { if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -128,17 +127,17 @@ public class Options return false; } - public List getActivationsSkills() + public List getActivationSkills() { return _activationSkills; } - public List getActivationsSkills(OptionsSkillType type) + public List getActivationSkills(OptionSkillType type) { - final List temp = new ArrayList<>(); + final List temp = new ArrayList<>(); if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -149,7 +148,7 @@ public class Options return temp; } - public void addActivationSkill(OptionsSkillHolder holder) + public void addActivationSkill(OptionSkillHolder holder) { if (_activationSkills == null) { @@ -189,21 +188,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.addTriggerSkill(holder); } @@ -227,21 +226,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - player.removeSkill(holder.getSkill(), false, false); + player.removeSkill(skill, false, false); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - player.removeSkill(holder.getSkill(), false, true); + player.removeSkill(skill, false, true); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.removeTriggerSkill(holder); } diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java deleted file mode 100644 index fc42843b8a..0000000000 --- a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -import org.l2jmobius.gameserver.model.holders.SkillHolder; - -/** - * @author UnAfraid - */ -public class OptionsSkillHolder extends SkillHolder -{ - private final OptionsSkillType _type; - private final double _chance; - - /** - * @param skillId - * @param skillLevel - * @param type - * @param chance - */ - public OptionsSkillHolder(int skillId, int skillLevel, double chance, OptionsSkillType type) - { - super(skillId, skillLevel); - _chance = chance; - _type = type; - } - - public OptionsSkillType getSkillType() - { - return _type; - } - - public double getChance() - { - return _chance; - } -} diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java deleted file mode 100644 index 7c216d20f7..0000000000 --- a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -/** - * @author UnAfraid - */ -public enum OptionsSkillType -{ - ATTACK, - MAGIC, - CRITICAL -} diff --git a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java index 0b6fcfea92..a722b7be86 100644 --- a/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java +++ b/L2J_Mobius_10.1_MasterClass/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java @@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate; import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.ActionType; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.stats.Stat; @@ -603,9 +603,9 @@ public class SkillCaster implements Runnable if (caster.hasTriggerSkills()) { - for (OptionsSkillHolder holder : caster.getTriggerSkills().values()) + for (OptionSkillHolder holder : caster.getTriggerSkills().values()) { - if (((skill.isMagic() && (holder.getSkillType() == OptionsSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionsSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) + if (((skill.isMagic() && (holder.getSkillType() == OptionSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) { triggerCast(caster, creature, holder.getSkill(), null, false); } diff --git a/L2J_Mobius_10.2_MasterClass/dist/game/data/stats/augmentation/options/31900-31999.xml b/L2J_Mobius_10.2_MasterClass/dist/game/data/stats/augmentation/options/31900-31999.xml index be0482ea1b..b6608f9db4 100644 --- a/L2J_Mobius_10.2_MasterClass/dist/game/data/stats/augmentation/options/31900-31999.xml +++ b/L2J_Mobius_10.2_MasterClass/dist/game/data/stats/augmentation/options/31900-31999.xml @@ -819,15 +819,12 @@ + + + + + diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/data/xml/OptionData.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/data/xml/OptionData.java index 696f93dfa8..79b9935825 100644 --- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/data/xml/OptionData.java +++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/data/xml/OptionData.java @@ -28,10 +28,10 @@ import org.w3c.dom.Document; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.options.Options; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; +import org.l2jmobius.gameserver.model.skill.Skill; /** * @author UnAfraid @@ -88,27 +88,77 @@ public class OptionData implements IXmlReader } case "active_skill": { - option.addActiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "passive_skill": { - option.addPassiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addPassiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "attack_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.ATTACK)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.ATTACK)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "magic_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.MAGIC)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.MAGIC)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "critical_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.CRITICAL)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.CRITICAL)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } } diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/actor/Creature.java index fa0cf6a568..2098460543 100644 --- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -121,8 +121,8 @@ import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.EtcItemType; import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffInfo; @@ -236,7 +236,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe private boolean _lethalable = true; - private Map _triggerSkills; + private Map _triggerSkills; private Map _ignoreSkillEffects; /** Creatures effect list. */ @@ -3902,9 +3902,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (_triggerSkills != null) { - for (OptionsSkillHolder holder : _triggerSkills.values()) + for (OptionSkillHolder holder : _triggerSkills.values()) { - if (((!hit.isCritical() && (holder.getSkillType() == OptionsSkillType.ATTACK)) || ((holder.getSkillType() == OptionsSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) + if (((!hit.isCritical() && (holder.getSkillType() == OptionSkillType.ATTACK)) || ((holder.getSkillType() == OptionSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) { SkillCaster.triggerCast(this, target, holder.getSkill(), null, false); } @@ -4942,7 +4942,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return (_triggerSkills != null) && !_triggerSkills.isEmpty(); } - public Map getTriggerSkills() + public Map getTriggerSkills() { if (_triggerSkills == null) { @@ -4950,21 +4950,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe { if (_triggerSkills == null) { - _triggerSkills = new ConcurrentHashMap<>(); + _triggerSkills = new ConcurrentHashMap<>(1); } } } return _triggerSkills; } - public void addTriggerSkill(OptionsSkillHolder holder) + public void addTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().put(holder.getSkillId(), holder); + getTriggerSkills().put(holder.getSkill().getId(), holder); } - public void removeTriggerSkill(OptionsSkillHolder holder) + public void removeTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().remove(holder.getSkillId()); + getTriggerSkills().remove(holder.getSkill().getId()); } /** diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java new file mode 100644 index 0000000000..52f00e5d78 --- /dev/null +++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java @@ -0,0 +1,56 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +import org.l2jmobius.gameserver.model.skill.Skill; + +/** + * @author UnAfraid, Mobius + */ +public class OptionSkillHolder +{ + private final Skill _skill; + private final double _chance; + private final OptionSkillType _type; + + /** + * @param skill + * @param type + * @param chance + */ + public OptionSkillHolder(Skill skill, double chance, OptionSkillType type) + { + _skill = skill; + _chance = chance; + _type = type; + } + + public Skill getSkill() + { + return _skill; + } + + public double getChance() + { + return _chance; + } + + public OptionSkillType getSkillType() + { + return _type; + } +} diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java new file mode 100644 index 0000000000..689c956312 --- /dev/null +++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java @@ -0,0 +1,27 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +/** + * @author UnAfraid + */ +public enum OptionSkillType +{ + ATTACK, + MAGIC, + CRITICAL +} diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/options/Options.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/options/Options.java index 9eb5d46e9e..0299901a34 100644 --- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/options/Options.java +++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/options/Options.java @@ -22,7 +22,6 @@ import java.util.List; import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.skill.BuffInfo; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; @@ -34,9 +33,9 @@ public class Options { private final int _id; private List _effects = null; - private List _activeSkill = null; - private List _passiveSkill = null; - private List _activationSkills = null; + private List _activeSkill = null; + private List _passiveSkill = null; + private List _activationSkills = null; /** * @param id @@ -75,12 +74,12 @@ public class Options return _activeSkill != null; } - public List getActiveSkills() + public List getActiveSkills() { return _activeSkill; } - public void addActiveSkill(SkillHolder holder) + public void addActiveSkill(Skill holder) { if (_activeSkill == null) { @@ -94,12 +93,12 @@ public class Options return _passiveSkill != null; } - public List getPassiveSkills() + public List getPassiveSkills() { return _passiveSkill; } - public void addPassiveSkill(SkillHolder holder) + public void addPassiveSkill(Skill holder) { if (_passiveSkill == null) { @@ -113,11 +112,11 @@ public class Options return _activationSkills != null; } - public boolean hasActivationSkills(OptionsSkillType type) + public boolean hasActivationSkills(OptionSkillType type) { if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -128,17 +127,17 @@ public class Options return false; } - public List getActivationsSkills() + public List getActivationSkills() { return _activationSkills; } - public List getActivationsSkills(OptionsSkillType type) + public List getActivationSkills(OptionSkillType type) { - final List temp = new ArrayList<>(); + final List temp = new ArrayList<>(); if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -149,7 +148,7 @@ public class Options return temp; } - public void addActivationSkill(OptionsSkillHolder holder) + public void addActivationSkill(OptionSkillHolder holder) { if (_activationSkills == null) { @@ -189,21 +188,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.addTriggerSkill(holder); } @@ -227,21 +226,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - player.removeSkill(holder.getSkill(), false, false); + player.removeSkill(skill, false, false); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - player.removeSkill(holder.getSkill(), false, true); + player.removeSkill(skill, false, true); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.removeTriggerSkill(holder); } diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java deleted file mode 100644 index fc42843b8a..0000000000 --- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -import org.l2jmobius.gameserver.model.holders.SkillHolder; - -/** - * @author UnAfraid - */ -public class OptionsSkillHolder extends SkillHolder -{ - private final OptionsSkillType _type; - private final double _chance; - - /** - * @param skillId - * @param skillLevel - * @param type - * @param chance - */ - public OptionsSkillHolder(int skillId, int skillLevel, double chance, OptionsSkillType type) - { - super(skillId, skillLevel); - _chance = chance; - _type = type; - } - - public OptionsSkillType getSkillType() - { - return _type; - } - - public double getChance() - { - return _chance; - } -} diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java deleted file mode 100644 index 7c216d20f7..0000000000 --- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -/** - * @author UnAfraid - */ -public enum OptionsSkillType -{ - ATTACK, - MAGIC, - CRITICAL -} diff --git a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java index 0b6fcfea92..a722b7be86 100644 --- a/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java +++ b/L2J_Mobius_10.2_MasterClass/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java @@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate; import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.ActionType; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.stats.Stat; @@ -603,9 +603,9 @@ public class SkillCaster implements Runnable if (caster.hasTriggerSkills()) { - for (OptionsSkillHolder holder : caster.getTriggerSkills().values()) + for (OptionSkillHolder holder : caster.getTriggerSkills().values()) { - if (((skill.isMagic() && (holder.getSkillType() == OptionsSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionsSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) + if (((skill.isMagic() && (holder.getSkillType() == OptionSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) { triggerCast(caster, creature, holder.getSkill(), null, false); } diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/xml/OptionData.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/xml/OptionData.java index e15522e184..15c2bf9b20 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/xml/OptionData.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/data/xml/OptionData.java @@ -28,10 +28,10 @@ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.l2jmobius.commons.util.IXmlReader; -import org.l2jmobius.gameserver.model.holders.SkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.options.Options; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.model.stats.Stat; import org.l2jmobius.gameserver.model.stats.functions.FuncTemplate; @@ -106,27 +106,77 @@ public class OptionData implements IXmlReader } case "active_skill": { - option.setActiveSkill(new SkillHolder(parseInteger(cd.getAttributes(), "id"), parseInteger(cd.getAttributes(), "level"))); + final int skillId = parseInteger(cd.getAttributes(), "id"); + final int skillLevel = parseInteger(cd.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.setActiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "passive_skill": { - option.setPassiveSkill(new SkillHolder(parseInteger(cd.getAttributes(), "id"), parseInteger(cd.getAttributes(), "level"))); + final int skillId = parseInteger(cd.getAttributes(), "id"); + final int skillLevel = parseInteger(cd.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.setPassiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "attack_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(cd.getAttributes(), "id"), parseInteger(cd.getAttributes(), "level"), parseDouble(cd.getAttributes(), "chance"), OptionsSkillType.ATTACK)); + final int skillId = parseInteger(cd.getAttributes(), "id"); + final int skillLevel = parseInteger(cd.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(cd.getAttributes(), "chance"), OptionSkillType.ATTACK)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "magic_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(cd.getAttributes(), "id"), parseInteger(cd.getAttributes(), "level"), parseDouble(cd.getAttributes(), "chance"), OptionsSkillType.MAGIC)); + final int skillId = parseInteger(cd.getAttributes(), "id"); + final int skillLevel = parseInteger(cd.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(cd.getAttributes(), "chance"), OptionSkillType.MAGIC)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "critical_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(cd.getAttributes(), "id"), parseInteger(cd.getAttributes(), "level"), parseDouble(cd.getAttributes(), "chance"), OptionsSkillType.CRITICAL)); + final int skillId = parseInteger(cd.getAttributes(), "id"); + final int skillLevel = parseInteger(cd.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(cd.getAttributes(), "chance"), OptionSkillType.CRITICAL)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } } diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Creature.java index 5281c97dc1..c7c9aab217 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -117,8 +117,8 @@ import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.AbnormalVisualEffect; import org.l2jmobius.gameserver.model.skill.BuffFinishTask; @@ -239,7 +239,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe private boolean _lethalable = true; - private Map _triggerSkills; + private Map _triggerSkills; private Map _invulAgainst; /** Creatures effect list. */ @@ -4910,9 +4910,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (_triggerSkills != null) { - for (OptionsSkillHolder holder : _triggerSkills.values()) + for (OptionSkillHolder holder : _triggerSkills.values()) { - if (((!crit && (holder.getSkillType() == OptionsSkillType.ATTACK)) || ((holder.getSkillType() == OptionsSkillType.CRITICAL) && crit)) && (Rnd.get(100) < holder.getChance())) + if (((!crit && (holder.getSkillType() == OptionSkillType.ATTACK)) || ((holder.getSkillType() == OptionSkillType.CRITICAL) && crit)) && (Rnd.get(100) < holder.getChance())) { makeTriggerCast(holder.getSkill(), target); } @@ -5729,9 +5729,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (_triggerSkills != null) { - for (OptionsSkillHolder holder : _triggerSkills.values()) + for (OptionSkillHolder holder : _triggerSkills.values()) { - if (((skill.isMagic() && (holder.getSkillType() == OptionsSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionsSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) + if (((skill.isMagic() && (holder.getSkillType() == OptionSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) { makeTriggerCast(holder.getSkill(), target); } @@ -6371,7 +6371,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return _lethalable; } - public Map getTriggerSkills() + public Map getTriggerSkills() { if (_triggerSkills == null) { @@ -6386,14 +6386,14 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return _triggerSkills; } - public void addTriggerSkill(OptionsSkillHolder holder) + public void addTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().put(holder.getSkillId(), holder); + getTriggerSkills().put(holder.getSkill().getId(), holder); } - public void removeTriggerSkill(OptionsSkillHolder holder) + public void removeTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().remove(holder.getSkillId()); + getTriggerSkills().remove(holder.getSkill().getId()); } public void makeTriggerCast(Skill skill, Creature target, boolean ignoreTargetType) diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java new file mode 100644 index 0000000000..52f00e5d78 --- /dev/null +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java @@ -0,0 +1,56 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +import org.l2jmobius.gameserver.model.skill.Skill; + +/** + * @author UnAfraid, Mobius + */ +public class OptionSkillHolder +{ + private final Skill _skill; + private final double _chance; + private final OptionSkillType _type; + + /** + * @param skill + * @param type + * @param chance + */ + public OptionSkillHolder(Skill skill, double chance, OptionSkillType type) + { + _skill = skill; + _chance = chance; + _type = type; + } + + public Skill getSkill() + { + return _skill; + } + + public double getChance() + { + return _chance; + } + + public OptionSkillType getSkillType() + { + return _type; + } +} diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java new file mode 100644 index 0000000000..689c956312 --- /dev/null +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java @@ -0,0 +1,27 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +/** + * @author UnAfraid + */ +public enum OptionSkillType +{ + ATTACK, + MAGIC, + CRITICAL +} diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/options/Options.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/options/Options.java index a89f18824e..209380dc1c 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/options/Options.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/options/Options.java @@ -22,7 +22,6 @@ import java.util.List; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.model.stats.functions.AbstractFunction; @@ -36,11 +35,9 @@ public class Options { private final int _id; private final List _funcs = new ArrayList<>(); - - private SkillHolder _activeSkill = null; - private SkillHolder _passiveSkill = null; - - private final List _activationSkills = new ArrayList<>(); + private Skill _activeSkill = null; + private Skill _passiveSkill = null; + private final List _activationSkills = new ArrayList<>(); /** * @param id @@ -89,14 +86,14 @@ public class Options return _activeSkill != null; } - public SkillHolder getActiveSkill() + public Skill getActiveSkill() { return _activeSkill; } - public void setActiveSkill(SkillHolder holder) + public void setActiveSkill(Skill skill) { - _activeSkill = holder; + _activeSkill = skill; } public boolean hasPassiveSkill() @@ -104,14 +101,14 @@ public class Options return _passiveSkill != null; } - public SkillHolder getPassiveSkill() + public Skill getPassiveSkill() { return _passiveSkill; } - public void setPassiveSkill(SkillHolder holder) + public void setPassiveSkill(Skill skill) { - _passiveSkill = holder; + _passiveSkill = skill; } public boolean hasActivationSkills() @@ -119,9 +116,9 @@ public class Options return !_activationSkills.isEmpty(); } - public boolean hasActivationSkills(OptionsSkillType type) + public boolean hasActivationSkills(OptionSkillType type) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -131,15 +128,15 @@ public class Options return false; } - public List getActivationsSkills() + public List getActivationSkills() { return _activationSkills; } - public List getActivationsSkills(OptionsSkillType type) + public List getActivationSkills(OptionSkillType type) { - final List temp = new ArrayList<>(); - for (OptionsSkillHolder holder : _activationSkills) + final List temp = new ArrayList<>(); + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -149,7 +146,7 @@ public class Options return temp; } - public void addActivationSkill(OptionsSkillHolder holder) + public void addActivationSkill(OptionSkillHolder holder) { _activationSkills.add(holder); } @@ -162,15 +159,15 @@ public class Options } if (hasActiveSkill()) { - addSkill(player, _activeSkill.getSkill()); + addSkill(player, _activeSkill); } if (hasPassiveSkill()) { - addSkill(player, _passiveSkill.getSkill()); + addSkill(player, _passiveSkill); } if (!_activationSkills.isEmpty()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.addTriggerSkill(holder); } @@ -187,15 +184,15 @@ public class Options } if (hasActiveSkill()) { - player.removeSkill(_activeSkill.getSkill(), false, false); + player.removeSkill(_activeSkill, false, false); } if (hasPassiveSkill()) { - player.removeSkill(_passiveSkill.getSkill(), false, true); + player.removeSkill(_passiveSkill, false, true); } if (!_activationSkills.isEmpty()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.removeTriggerSkill(holder); } diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java deleted file mode 100644 index fc42843b8a..0000000000 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -import org.l2jmobius.gameserver.model.holders.SkillHolder; - -/** - * @author UnAfraid - */ -public class OptionsSkillHolder extends SkillHolder -{ - private final OptionsSkillType _type; - private final double _chance; - - /** - * @param skillId - * @param skillLevel - * @param type - * @param chance - */ - public OptionsSkillHolder(int skillId, int skillLevel, double chance, OptionsSkillType type) - { - super(skillId, skillLevel); - _chance = chance; - _type = type; - } - - public OptionsSkillType getSkillType() - { - return _type; - } - - public double getChance() - { - return _chance; - } -} diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java deleted file mode 100644 index 7c216d20f7..0000000000 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -/** - * @author UnAfraid - */ -public enum OptionsSkillType -{ - ATTACK, - MAGIC, - CRITICAL -} diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/xml/OptionData.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/xml/OptionData.java index e15522e184..15c2bf9b20 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/xml/OptionData.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/data/xml/OptionData.java @@ -28,10 +28,10 @@ import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.l2jmobius.commons.util.IXmlReader; -import org.l2jmobius.gameserver.model.holders.SkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.options.Options; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.model.stats.Stat; import org.l2jmobius.gameserver.model.stats.functions.FuncTemplate; @@ -106,27 +106,77 @@ public class OptionData implements IXmlReader } case "active_skill": { - option.setActiveSkill(new SkillHolder(parseInteger(cd.getAttributes(), "id"), parseInteger(cd.getAttributes(), "level"))); + final int skillId = parseInteger(cd.getAttributes(), "id"); + final int skillLevel = parseInteger(cd.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.setActiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "passive_skill": { - option.setPassiveSkill(new SkillHolder(parseInteger(cd.getAttributes(), "id"), parseInteger(cd.getAttributes(), "level"))); + final int skillId = parseInteger(cd.getAttributes(), "id"); + final int skillLevel = parseInteger(cd.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.setPassiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "attack_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(cd.getAttributes(), "id"), parseInteger(cd.getAttributes(), "level"), parseDouble(cd.getAttributes(), "chance"), OptionsSkillType.ATTACK)); + final int skillId = parseInteger(cd.getAttributes(), "id"); + final int skillLevel = parseInteger(cd.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(cd.getAttributes(), "chance"), OptionSkillType.ATTACK)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "magic_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(cd.getAttributes(), "id"), parseInteger(cd.getAttributes(), "level"), parseDouble(cd.getAttributes(), "chance"), OptionsSkillType.MAGIC)); + final int skillId = parseInteger(cd.getAttributes(), "id"); + final int skillLevel = parseInteger(cd.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(cd.getAttributes(), "chance"), OptionSkillType.MAGIC)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "critical_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(cd.getAttributes(), "id"), parseInteger(cd.getAttributes(), "level"), parseDouble(cd.getAttributes(), "chance"), OptionsSkillType.CRITICAL)); + final int skillId = parseInteger(cd.getAttributes(), "id"); + final int skillLevel = parseInteger(cd.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(cd.getAttributes(), "chance"), OptionSkillType.CRITICAL)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java index 8ce5252197..82ead40d6c 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -117,8 +117,8 @@ import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.AbnormalVisualEffect; import org.l2jmobius.gameserver.model.skill.BuffFinishTask; @@ -240,7 +240,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe private boolean _lethalable = true; - private Map _triggerSkills; + private Map _triggerSkills; private Map _invulAgainst; /** Creatures effect list. */ @@ -4912,9 +4912,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (_triggerSkills != null) { - for (OptionsSkillHolder holder : _triggerSkills.values()) + for (OptionSkillHolder holder : _triggerSkills.values()) { - if (((!crit && (holder.getSkillType() == OptionsSkillType.ATTACK)) || ((holder.getSkillType() == OptionsSkillType.CRITICAL) && crit)) && (Rnd.get(100) < holder.getChance())) + if (((!crit && (holder.getSkillType() == OptionSkillType.ATTACK)) || ((holder.getSkillType() == OptionSkillType.CRITICAL) && crit)) && (Rnd.get(100) < holder.getChance())) { makeTriggerCast(holder.getSkill(), target); } @@ -5731,9 +5731,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (_triggerSkills != null) { - for (OptionsSkillHolder holder : _triggerSkills.values()) + for (OptionSkillHolder holder : _triggerSkills.values()) { - if (((skill.isMagic() && (holder.getSkillType() == OptionsSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionsSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) + if (((skill.isMagic() && (holder.getSkillType() == OptionSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) { makeTriggerCast(holder.getSkill(), target); } @@ -6373,7 +6373,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return _lethalable; } - public Map getTriggerSkills() + public Map getTriggerSkills() { if (_triggerSkills == null) { @@ -6388,14 +6388,14 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return _triggerSkills; } - public void addTriggerSkill(OptionsSkillHolder holder) + public void addTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().put(holder.getSkillId(), holder); + getTriggerSkills().put(holder.getSkill().getId(), holder); } - public void removeTriggerSkill(OptionsSkillHolder holder) + public void removeTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().remove(holder.getSkillId()); + getTriggerSkills().remove(holder.getSkill().getId()); } public void makeTriggerCast(Skill skill, Creature target, boolean ignoreTargetType) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java new file mode 100644 index 0000000000..52f00e5d78 --- /dev/null +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java @@ -0,0 +1,56 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +import org.l2jmobius.gameserver.model.skill.Skill; + +/** + * @author UnAfraid, Mobius + */ +public class OptionSkillHolder +{ + private final Skill _skill; + private final double _chance; + private final OptionSkillType _type; + + /** + * @param skill + * @param type + * @param chance + */ + public OptionSkillHolder(Skill skill, double chance, OptionSkillType type) + { + _skill = skill; + _chance = chance; + _type = type; + } + + public Skill getSkill() + { + return _skill; + } + + public double getChance() + { + return _chance; + } + + public OptionSkillType getSkillType() + { + return _type; + } +} diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java new file mode 100644 index 0000000000..689c956312 --- /dev/null +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java @@ -0,0 +1,27 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +/** + * @author UnAfraid + */ +public enum OptionSkillType +{ + ATTACK, + MAGIC, + CRITICAL +} diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/options/Options.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/options/Options.java index a89f18824e..209380dc1c 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/options/Options.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/options/Options.java @@ -22,7 +22,6 @@ import java.util.List; import org.l2jmobius.gameserver.model.actor.Creature; import org.l2jmobius.gameserver.model.actor.Player; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.model.stats.functions.AbstractFunction; @@ -36,11 +35,9 @@ public class Options { private final int _id; private final List _funcs = new ArrayList<>(); - - private SkillHolder _activeSkill = null; - private SkillHolder _passiveSkill = null; - - private final List _activationSkills = new ArrayList<>(); + private Skill _activeSkill = null; + private Skill _passiveSkill = null; + private final List _activationSkills = new ArrayList<>(); /** * @param id @@ -89,14 +86,14 @@ public class Options return _activeSkill != null; } - public SkillHolder getActiveSkill() + public Skill getActiveSkill() { return _activeSkill; } - public void setActiveSkill(SkillHolder holder) + public void setActiveSkill(Skill skill) { - _activeSkill = holder; + _activeSkill = skill; } public boolean hasPassiveSkill() @@ -104,14 +101,14 @@ public class Options return _passiveSkill != null; } - public SkillHolder getPassiveSkill() + public Skill getPassiveSkill() { return _passiveSkill; } - public void setPassiveSkill(SkillHolder holder) + public void setPassiveSkill(Skill skill) { - _passiveSkill = holder; + _passiveSkill = skill; } public boolean hasActivationSkills() @@ -119,9 +116,9 @@ public class Options return !_activationSkills.isEmpty(); } - public boolean hasActivationSkills(OptionsSkillType type) + public boolean hasActivationSkills(OptionSkillType type) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -131,15 +128,15 @@ public class Options return false; } - public List getActivationsSkills() + public List getActivationSkills() { return _activationSkills; } - public List getActivationsSkills(OptionsSkillType type) + public List getActivationSkills(OptionSkillType type) { - final List temp = new ArrayList<>(); - for (OptionsSkillHolder holder : _activationSkills) + final List temp = new ArrayList<>(); + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -149,7 +146,7 @@ public class Options return temp; } - public void addActivationSkill(OptionsSkillHolder holder) + public void addActivationSkill(OptionSkillHolder holder) { _activationSkills.add(holder); } @@ -162,15 +159,15 @@ public class Options } if (hasActiveSkill()) { - addSkill(player, _activeSkill.getSkill()); + addSkill(player, _activeSkill); } if (hasPassiveSkill()) { - addSkill(player, _passiveSkill.getSkill()); + addSkill(player, _passiveSkill); } if (!_activationSkills.isEmpty()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.addTriggerSkill(holder); } @@ -187,15 +184,15 @@ public class Options } if (hasActiveSkill()) { - player.removeSkill(_activeSkill.getSkill(), false, false); + player.removeSkill(_activeSkill, false, false); } if (hasPassiveSkill()) { - player.removeSkill(_passiveSkill.getSkill(), false, true); + player.removeSkill(_passiveSkill, false, true); } if (!_activationSkills.isEmpty()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.removeTriggerSkill(holder); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java deleted file mode 100644 index fc42843b8a..0000000000 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -import org.l2jmobius.gameserver.model.holders.SkillHolder; - -/** - * @author UnAfraid - */ -public class OptionsSkillHolder extends SkillHolder -{ - private final OptionsSkillType _type; - private final double _chance; - - /** - * @param skillId - * @param skillLevel - * @param type - * @param chance - */ - public OptionsSkillHolder(int skillId, int skillLevel, double chance, OptionsSkillType type) - { - super(skillId, skillLevel); - _chance = chance; - _type = type; - } - - public OptionsSkillType getSkillType() - { - return _type; - } - - public double getChance() - { - return _chance; - } -} diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java deleted file mode 100644 index 7c216d20f7..0000000000 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -/** - * @author UnAfraid - */ -public enum OptionsSkillType -{ - ATTACK, - MAGIC, - CRITICAL -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/data/xml/OptionData.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/data/xml/OptionData.java index f563b02755..86e0c8f1fb 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/data/xml/OptionData.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/data/xml/OptionData.java @@ -28,10 +28,10 @@ import org.w3c.dom.Document; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.options.Options; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; +import org.l2jmobius.gameserver.model.skill.Skill; /** * @author UnAfraid @@ -88,27 +88,77 @@ public class OptionData implements IXmlReader } case "active_skill": { - option.addActiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "passive_skill": { - option.addPassiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addPassiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "attack_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.ATTACK)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.ATTACK)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "magic_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.MAGIC)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.MAGIC)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "critical_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.CRITICAL)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.CRITICAL)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java index cbeb5dedc4..89ba9ecc97 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -121,8 +121,8 @@ import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.EtcItemType; import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffInfo; @@ -236,7 +236,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe private boolean _lethalable = true; - private Map _triggerSkills; + private Map _triggerSkills; private Map _ignoreSkillEffects; /** Creatures effect list. */ @@ -3903,9 +3903,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (_triggerSkills != null) { - for (OptionsSkillHolder holder : _triggerSkills.values()) + for (OptionSkillHolder holder : _triggerSkills.values()) { - if (((!hit.isCritical() && (holder.getSkillType() == OptionsSkillType.ATTACK)) || ((holder.getSkillType() == OptionsSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) + if (((!hit.isCritical() && (holder.getSkillType() == OptionSkillType.ATTACK)) || ((holder.getSkillType() == OptionSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) { SkillCaster.triggerCast(this, target, holder.getSkill(), null, false); } @@ -4933,7 +4933,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return (_triggerSkills != null) && !_triggerSkills.isEmpty(); } - public Map getTriggerSkills() + public Map getTriggerSkills() { if (_triggerSkills == null) { @@ -4941,21 +4941,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe { if (_triggerSkills == null) { - _triggerSkills = new ConcurrentHashMap<>(); + _triggerSkills = new ConcurrentHashMap<>(1); } } } return _triggerSkills; } - public void addTriggerSkill(OptionsSkillHolder holder) + public void addTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().put(holder.getSkillId(), holder); + getTriggerSkills().put(holder.getSkill().getId(), holder); } - public void removeTriggerSkill(OptionsSkillHolder holder) + public void removeTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().remove(holder.getSkillId()); + getTriggerSkills().remove(holder.getSkill().getId()); } /** diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java new file mode 100644 index 0000000000..52f00e5d78 --- /dev/null +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java @@ -0,0 +1,56 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +import org.l2jmobius.gameserver.model.skill.Skill; + +/** + * @author UnAfraid, Mobius + */ +public class OptionSkillHolder +{ + private final Skill _skill; + private final double _chance; + private final OptionSkillType _type; + + /** + * @param skill + * @param type + * @param chance + */ + public OptionSkillHolder(Skill skill, double chance, OptionSkillType type) + { + _skill = skill; + _chance = chance; + _type = type; + } + + public Skill getSkill() + { + return _skill; + } + + public double getChance() + { + return _chance; + } + + public OptionSkillType getSkillType() + { + return _type; + } +} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java new file mode 100644 index 0000000000..689c956312 --- /dev/null +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java @@ -0,0 +1,27 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +/** + * @author UnAfraid + */ +public enum OptionSkillType +{ + ATTACK, + MAGIC, + CRITICAL +} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/options/Options.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/options/Options.java index 9eb5d46e9e..0299901a34 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/options/Options.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/options/Options.java @@ -22,7 +22,6 @@ import java.util.List; import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.skill.BuffInfo; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; @@ -34,9 +33,9 @@ public class Options { private final int _id; private List _effects = null; - private List _activeSkill = null; - private List _passiveSkill = null; - private List _activationSkills = null; + private List _activeSkill = null; + private List _passiveSkill = null; + private List _activationSkills = null; /** * @param id @@ -75,12 +74,12 @@ public class Options return _activeSkill != null; } - public List getActiveSkills() + public List getActiveSkills() { return _activeSkill; } - public void addActiveSkill(SkillHolder holder) + public void addActiveSkill(Skill holder) { if (_activeSkill == null) { @@ -94,12 +93,12 @@ public class Options return _passiveSkill != null; } - public List getPassiveSkills() + public List getPassiveSkills() { return _passiveSkill; } - public void addPassiveSkill(SkillHolder holder) + public void addPassiveSkill(Skill holder) { if (_passiveSkill == null) { @@ -113,11 +112,11 @@ public class Options return _activationSkills != null; } - public boolean hasActivationSkills(OptionsSkillType type) + public boolean hasActivationSkills(OptionSkillType type) { if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -128,17 +127,17 @@ public class Options return false; } - public List getActivationsSkills() + public List getActivationSkills() { return _activationSkills; } - public List getActivationsSkills(OptionsSkillType type) + public List getActivationSkills(OptionSkillType type) { - final List temp = new ArrayList<>(); + final List temp = new ArrayList<>(); if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -149,7 +148,7 @@ public class Options return temp; } - public void addActivationSkill(OptionsSkillHolder holder) + public void addActivationSkill(OptionSkillHolder holder) { if (_activationSkills == null) { @@ -189,21 +188,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.addTriggerSkill(holder); } @@ -227,21 +226,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - player.removeSkill(holder.getSkill(), false, false); + player.removeSkill(skill, false, false); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - player.removeSkill(holder.getSkill(), false, true); + player.removeSkill(skill, false, true); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.removeTriggerSkill(holder); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java deleted file mode 100644 index fc42843b8a..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -import org.l2jmobius.gameserver.model.holders.SkillHolder; - -/** - * @author UnAfraid - */ -public class OptionsSkillHolder extends SkillHolder -{ - private final OptionsSkillType _type; - private final double _chance; - - /** - * @param skillId - * @param skillLevel - * @param type - * @param chance - */ - public OptionsSkillHolder(int skillId, int skillLevel, double chance, OptionsSkillType type) - { - super(skillId, skillLevel); - _chance = chance; - _type = type; - } - - public OptionsSkillType getSkillType() - { - return _type; - } - - public double getChance() - { - return _chance; - } -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java deleted file mode 100644 index 7c216d20f7..0000000000 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -/** - * @author UnAfraid - */ -public enum OptionsSkillType -{ - ATTACK, - MAGIC, - CRITICAL -} diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java index 55101d8139..64e90fbae2 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java @@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate; import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.ActionType; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.zone.ZoneId; @@ -602,9 +602,9 @@ public class SkillCaster implements Runnable if (caster.hasTriggerSkills()) { - for (OptionsSkillHolder holder : caster.getTriggerSkills().values()) + for (OptionSkillHolder holder : caster.getTriggerSkills().values()) { - if (((skill.isMagic() && (holder.getSkillType() == OptionsSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionsSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) + if (((skill.isMagic() && (holder.getSkillType() == OptionSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) { triggerCast(caster, creature, holder.getSkill(), null, false); } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/data/xml/OptionData.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/data/xml/OptionData.java index f563b02755..86e0c8f1fb 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/data/xml/OptionData.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/data/xml/OptionData.java @@ -28,10 +28,10 @@ import org.w3c.dom.Document; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.options.Options; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; +import org.l2jmobius.gameserver.model.skill.Skill; /** * @author UnAfraid @@ -88,27 +88,77 @@ public class OptionData implements IXmlReader } case "active_skill": { - option.addActiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "passive_skill": { - option.addPassiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addPassiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "attack_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.ATTACK)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.ATTACK)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "magic_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.MAGIC)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.MAGIC)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "critical_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.CRITICAL)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.CRITICAL)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java index cbeb5dedc4..89ba9ecc97 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -121,8 +121,8 @@ import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.EtcItemType; import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffInfo; @@ -236,7 +236,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe private boolean _lethalable = true; - private Map _triggerSkills; + private Map _triggerSkills; private Map _ignoreSkillEffects; /** Creatures effect list. */ @@ -3903,9 +3903,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (_triggerSkills != null) { - for (OptionsSkillHolder holder : _triggerSkills.values()) + for (OptionSkillHolder holder : _triggerSkills.values()) { - if (((!hit.isCritical() && (holder.getSkillType() == OptionsSkillType.ATTACK)) || ((holder.getSkillType() == OptionsSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) + if (((!hit.isCritical() && (holder.getSkillType() == OptionSkillType.ATTACK)) || ((holder.getSkillType() == OptionSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) { SkillCaster.triggerCast(this, target, holder.getSkill(), null, false); } @@ -4933,7 +4933,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return (_triggerSkills != null) && !_triggerSkills.isEmpty(); } - public Map getTriggerSkills() + public Map getTriggerSkills() { if (_triggerSkills == null) { @@ -4941,21 +4941,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe { if (_triggerSkills == null) { - _triggerSkills = new ConcurrentHashMap<>(); + _triggerSkills = new ConcurrentHashMap<>(1); } } } return _triggerSkills; } - public void addTriggerSkill(OptionsSkillHolder holder) + public void addTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().put(holder.getSkillId(), holder); + getTriggerSkills().put(holder.getSkill().getId(), holder); } - public void removeTriggerSkill(OptionsSkillHolder holder) + public void removeTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().remove(holder.getSkillId()); + getTriggerSkills().remove(holder.getSkill().getId()); } /** diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java new file mode 100644 index 0000000000..52f00e5d78 --- /dev/null +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java @@ -0,0 +1,56 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +import org.l2jmobius.gameserver.model.skill.Skill; + +/** + * @author UnAfraid, Mobius + */ +public class OptionSkillHolder +{ + private final Skill _skill; + private final double _chance; + private final OptionSkillType _type; + + /** + * @param skill + * @param type + * @param chance + */ + public OptionSkillHolder(Skill skill, double chance, OptionSkillType type) + { + _skill = skill; + _chance = chance; + _type = type; + } + + public Skill getSkill() + { + return _skill; + } + + public double getChance() + { + return _chance; + } + + public OptionSkillType getSkillType() + { + return _type; + } +} diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java new file mode 100644 index 0000000000..689c956312 --- /dev/null +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java @@ -0,0 +1,27 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +/** + * @author UnAfraid + */ +public enum OptionSkillType +{ + ATTACK, + MAGIC, + CRITICAL +} diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/options/Options.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/options/Options.java index 9eb5d46e9e..0299901a34 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/options/Options.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/options/Options.java @@ -22,7 +22,6 @@ import java.util.List; import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.skill.BuffInfo; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; @@ -34,9 +33,9 @@ public class Options { private final int _id; private List _effects = null; - private List _activeSkill = null; - private List _passiveSkill = null; - private List _activationSkills = null; + private List _activeSkill = null; + private List _passiveSkill = null; + private List _activationSkills = null; /** * @param id @@ -75,12 +74,12 @@ public class Options return _activeSkill != null; } - public List getActiveSkills() + public List getActiveSkills() { return _activeSkill; } - public void addActiveSkill(SkillHolder holder) + public void addActiveSkill(Skill holder) { if (_activeSkill == null) { @@ -94,12 +93,12 @@ public class Options return _passiveSkill != null; } - public List getPassiveSkills() + public List getPassiveSkills() { return _passiveSkill; } - public void addPassiveSkill(SkillHolder holder) + public void addPassiveSkill(Skill holder) { if (_passiveSkill == null) { @@ -113,11 +112,11 @@ public class Options return _activationSkills != null; } - public boolean hasActivationSkills(OptionsSkillType type) + public boolean hasActivationSkills(OptionSkillType type) { if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -128,17 +127,17 @@ public class Options return false; } - public List getActivationsSkills() + public List getActivationSkills() { return _activationSkills; } - public List getActivationsSkills(OptionsSkillType type) + public List getActivationSkills(OptionSkillType type) { - final List temp = new ArrayList<>(); + final List temp = new ArrayList<>(); if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -149,7 +148,7 @@ public class Options return temp; } - public void addActivationSkill(OptionsSkillHolder holder) + public void addActivationSkill(OptionSkillHolder holder) { if (_activationSkills == null) { @@ -189,21 +188,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.addTriggerSkill(holder); } @@ -227,21 +226,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - player.removeSkill(holder.getSkill(), false, false); + player.removeSkill(skill, false, false); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - player.removeSkill(holder.getSkill(), false, true); + player.removeSkill(skill, false, true); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.removeTriggerSkill(holder); } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java deleted file mode 100644 index fc42843b8a..0000000000 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -import org.l2jmobius.gameserver.model.holders.SkillHolder; - -/** - * @author UnAfraid - */ -public class OptionsSkillHolder extends SkillHolder -{ - private final OptionsSkillType _type; - private final double _chance; - - /** - * @param skillId - * @param skillLevel - * @param type - * @param chance - */ - public OptionsSkillHolder(int skillId, int skillLevel, double chance, OptionsSkillType type) - { - super(skillId, skillLevel); - _chance = chance; - _type = type; - } - - public OptionsSkillType getSkillType() - { - return _type; - } - - public double getChance() - { - return _chance; - } -} diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java deleted file mode 100644 index 7c216d20f7..0000000000 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -/** - * @author UnAfraid - */ -public enum OptionsSkillType -{ - ATTACK, - MAGIC, - CRITICAL -} diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java index 55101d8139..64e90fbae2 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java @@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate; import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.ActionType; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.zone.ZoneId; @@ -602,9 +602,9 @@ public class SkillCaster implements Runnable if (caster.hasTriggerSkills()) { - for (OptionsSkillHolder holder : caster.getTriggerSkills().values()) + for (OptionSkillHolder holder : caster.getTriggerSkills().values()) { - if (((skill.isMagic() && (holder.getSkillType() == OptionsSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionsSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) + if (((skill.isMagic() && (holder.getSkillType() == OptionSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) { triggerCast(caster, creature, holder.getSkill(), null, false); } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/data/xml/OptionData.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/data/xml/OptionData.java index f563b02755..86e0c8f1fb 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/data/xml/OptionData.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/data/xml/OptionData.java @@ -28,10 +28,10 @@ import org.w3c.dom.Document; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.options.Options; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; +import org.l2jmobius.gameserver.model.skill.Skill; /** * @author UnAfraid @@ -88,27 +88,77 @@ public class OptionData implements IXmlReader } case "active_skill": { - option.addActiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "passive_skill": { - option.addPassiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addPassiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "attack_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.ATTACK)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.ATTACK)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "magic_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.MAGIC)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.MAGIC)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "critical_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.CRITICAL)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.CRITICAL)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java index abffd63702..2efa54a0ba 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -121,8 +121,8 @@ import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.EtcItemType; import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffInfo; @@ -236,7 +236,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe private boolean _lethalable = true; - private Map _triggerSkills; + private Map _triggerSkills; private Map _ignoreSkillEffects; /** Creatures effect list. */ @@ -3903,9 +3903,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (_triggerSkills != null) { - for (OptionsSkillHolder holder : _triggerSkills.values()) + for (OptionSkillHolder holder : _triggerSkills.values()) { - if (((!hit.isCritical() && (holder.getSkillType() == OptionsSkillType.ATTACK)) || ((holder.getSkillType() == OptionsSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) + if (((!hit.isCritical() && (holder.getSkillType() == OptionSkillType.ATTACK)) || ((holder.getSkillType() == OptionSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) { SkillCaster.triggerCast(this, target, holder.getSkill(), null, false); } @@ -4942,7 +4942,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return (_triggerSkills != null) && !_triggerSkills.isEmpty(); } - public Map getTriggerSkills() + public Map getTriggerSkills() { if (_triggerSkills == null) { @@ -4950,21 +4950,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe { if (_triggerSkills == null) { - _triggerSkills = new ConcurrentHashMap<>(); + _triggerSkills = new ConcurrentHashMap<>(1); } } } return _triggerSkills; } - public void addTriggerSkill(OptionsSkillHolder holder) + public void addTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().put(holder.getSkillId(), holder); + getTriggerSkills().put(holder.getSkill().getId(), holder); } - public void removeTriggerSkill(OptionsSkillHolder holder) + public void removeTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().remove(holder.getSkillId()); + getTriggerSkills().remove(holder.getSkill().getId()); } /** diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java new file mode 100644 index 0000000000..52f00e5d78 --- /dev/null +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java @@ -0,0 +1,56 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +import org.l2jmobius.gameserver.model.skill.Skill; + +/** + * @author UnAfraid, Mobius + */ +public class OptionSkillHolder +{ + private final Skill _skill; + private final double _chance; + private final OptionSkillType _type; + + /** + * @param skill + * @param type + * @param chance + */ + public OptionSkillHolder(Skill skill, double chance, OptionSkillType type) + { + _skill = skill; + _chance = chance; + _type = type; + } + + public Skill getSkill() + { + return _skill; + } + + public double getChance() + { + return _chance; + } + + public OptionSkillType getSkillType() + { + return _type; + } +} diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java new file mode 100644 index 0000000000..689c956312 --- /dev/null +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java @@ -0,0 +1,27 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +/** + * @author UnAfraid + */ +public enum OptionSkillType +{ + ATTACK, + MAGIC, + CRITICAL +} diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/options/Options.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/options/Options.java index 9eb5d46e9e..0299901a34 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/options/Options.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/options/Options.java @@ -22,7 +22,6 @@ import java.util.List; import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.skill.BuffInfo; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; @@ -34,9 +33,9 @@ public class Options { private final int _id; private List _effects = null; - private List _activeSkill = null; - private List _passiveSkill = null; - private List _activationSkills = null; + private List _activeSkill = null; + private List _passiveSkill = null; + private List _activationSkills = null; /** * @param id @@ -75,12 +74,12 @@ public class Options return _activeSkill != null; } - public List getActiveSkills() + public List getActiveSkills() { return _activeSkill; } - public void addActiveSkill(SkillHolder holder) + public void addActiveSkill(Skill holder) { if (_activeSkill == null) { @@ -94,12 +93,12 @@ public class Options return _passiveSkill != null; } - public List getPassiveSkills() + public List getPassiveSkills() { return _passiveSkill; } - public void addPassiveSkill(SkillHolder holder) + public void addPassiveSkill(Skill holder) { if (_passiveSkill == null) { @@ -113,11 +112,11 @@ public class Options return _activationSkills != null; } - public boolean hasActivationSkills(OptionsSkillType type) + public boolean hasActivationSkills(OptionSkillType type) { if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -128,17 +127,17 @@ public class Options return false; } - public List getActivationsSkills() + public List getActivationSkills() { return _activationSkills; } - public List getActivationsSkills(OptionsSkillType type) + public List getActivationSkills(OptionSkillType type) { - final List temp = new ArrayList<>(); + final List temp = new ArrayList<>(); if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -149,7 +148,7 @@ public class Options return temp; } - public void addActivationSkill(OptionsSkillHolder holder) + public void addActivationSkill(OptionSkillHolder holder) { if (_activationSkills == null) { @@ -189,21 +188,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.addTriggerSkill(holder); } @@ -227,21 +226,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - player.removeSkill(holder.getSkill(), false, false); + player.removeSkill(skill, false, false); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - player.removeSkill(holder.getSkill(), false, true); + player.removeSkill(skill, false, true); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.removeTriggerSkill(holder); } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java deleted file mode 100644 index fc42843b8a..0000000000 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -import org.l2jmobius.gameserver.model.holders.SkillHolder; - -/** - * @author UnAfraid - */ -public class OptionsSkillHolder extends SkillHolder -{ - private final OptionsSkillType _type; - private final double _chance; - - /** - * @param skillId - * @param skillLevel - * @param type - * @param chance - */ - public OptionsSkillHolder(int skillId, int skillLevel, double chance, OptionsSkillType type) - { - super(skillId, skillLevel); - _chance = chance; - _type = type; - } - - public OptionsSkillType getSkillType() - { - return _type; - } - - public double getChance() - { - return _chance; - } -} diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java deleted file mode 100644 index 7c216d20f7..0000000000 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -/** - * @author UnAfraid - */ -public enum OptionsSkillType -{ - ATTACK, - MAGIC, - CRITICAL -} diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java index 55101d8139..64e90fbae2 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java @@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate; import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.ActionType; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.zone.ZoneId; @@ -602,9 +602,9 @@ public class SkillCaster implements Runnable if (caster.hasTriggerSkills()) { - for (OptionsSkillHolder holder : caster.getTriggerSkills().values()) + for (OptionSkillHolder holder : caster.getTriggerSkills().values()) { - if (((skill.isMagic() && (holder.getSkillType() == OptionsSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionsSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) + if (((skill.isMagic() && (holder.getSkillType() == OptionSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) { triggerCast(caster, creature, holder.getSkill(), null, false); } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/data/xml/OptionData.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/data/xml/OptionData.java index f563b02755..86e0c8f1fb 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/data/xml/OptionData.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/data/xml/OptionData.java @@ -28,10 +28,10 @@ import org.w3c.dom.Document; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.options.Options; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; +import org.l2jmobius.gameserver.model.skill.Skill; /** * @author UnAfraid @@ -88,27 +88,77 @@ public class OptionData implements IXmlReader } case "active_skill": { - option.addActiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "passive_skill": { - option.addPassiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addPassiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "attack_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.ATTACK)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.ATTACK)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "magic_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.MAGIC)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.MAGIC)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "critical_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.CRITICAL)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.CRITICAL)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java index d04d0b4d75..005696e3e2 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -122,8 +122,8 @@ import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.EtcItemType; import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffInfo; @@ -237,7 +237,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe private boolean _lethalable = true; - private Map _triggerSkills; + private Map _triggerSkills; private Map _ignoreSkillEffects; /** Creatures effect list. */ @@ -3916,9 +3916,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (_triggerSkills != null) { - for (OptionsSkillHolder holder : _triggerSkills.values()) + for (OptionSkillHolder holder : _triggerSkills.values()) { - if (((!hit.isCritical() && (holder.getSkillType() == OptionsSkillType.ATTACK)) || ((holder.getSkillType() == OptionsSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) + if (((!hit.isCritical() && (holder.getSkillType() == OptionSkillType.ATTACK)) || ((holder.getSkillType() == OptionSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) { SkillCaster.triggerCast(this, target, holder.getSkill(), null, false); } @@ -4967,7 +4967,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return (_triggerSkills != null) && !_triggerSkills.isEmpty(); } - public Map getTriggerSkills() + public Map getTriggerSkills() { if (_triggerSkills == null) { @@ -4975,21 +4975,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe { if (_triggerSkills == null) { - _triggerSkills = new ConcurrentHashMap<>(); + _triggerSkills = new ConcurrentHashMap<>(1); } } } return _triggerSkills; } - public void addTriggerSkill(OptionsSkillHolder holder) + public void addTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().put(holder.getSkillId(), holder); + getTriggerSkills().put(holder.getSkill().getId(), holder); } - public void removeTriggerSkill(OptionsSkillHolder holder) + public void removeTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().remove(holder.getSkillId()); + getTriggerSkills().remove(holder.getSkill().getId()); } /** diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java new file mode 100644 index 0000000000..52f00e5d78 --- /dev/null +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java @@ -0,0 +1,56 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +import org.l2jmobius.gameserver.model.skill.Skill; + +/** + * @author UnAfraid, Mobius + */ +public class OptionSkillHolder +{ + private final Skill _skill; + private final double _chance; + private final OptionSkillType _type; + + /** + * @param skill + * @param type + * @param chance + */ + public OptionSkillHolder(Skill skill, double chance, OptionSkillType type) + { + _skill = skill; + _chance = chance; + _type = type; + } + + public Skill getSkill() + { + return _skill; + } + + public double getChance() + { + return _chance; + } + + public OptionSkillType getSkillType() + { + return _type; + } +} diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java new file mode 100644 index 0000000000..689c956312 --- /dev/null +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java @@ -0,0 +1,27 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +/** + * @author UnAfraid + */ +public enum OptionSkillType +{ + ATTACK, + MAGIC, + CRITICAL +} diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/options/Options.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/options/Options.java index 9eb5d46e9e..0299901a34 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/options/Options.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/options/Options.java @@ -22,7 +22,6 @@ import java.util.List; import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.skill.BuffInfo; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; @@ -34,9 +33,9 @@ public class Options { private final int _id; private List _effects = null; - private List _activeSkill = null; - private List _passiveSkill = null; - private List _activationSkills = null; + private List _activeSkill = null; + private List _passiveSkill = null; + private List _activationSkills = null; /** * @param id @@ -75,12 +74,12 @@ public class Options return _activeSkill != null; } - public List getActiveSkills() + public List getActiveSkills() { return _activeSkill; } - public void addActiveSkill(SkillHolder holder) + public void addActiveSkill(Skill holder) { if (_activeSkill == null) { @@ -94,12 +93,12 @@ public class Options return _passiveSkill != null; } - public List getPassiveSkills() + public List getPassiveSkills() { return _passiveSkill; } - public void addPassiveSkill(SkillHolder holder) + public void addPassiveSkill(Skill holder) { if (_passiveSkill == null) { @@ -113,11 +112,11 @@ public class Options return _activationSkills != null; } - public boolean hasActivationSkills(OptionsSkillType type) + public boolean hasActivationSkills(OptionSkillType type) { if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -128,17 +127,17 @@ public class Options return false; } - public List getActivationsSkills() + public List getActivationSkills() { return _activationSkills; } - public List getActivationsSkills(OptionsSkillType type) + public List getActivationSkills(OptionSkillType type) { - final List temp = new ArrayList<>(); + final List temp = new ArrayList<>(); if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -149,7 +148,7 @@ public class Options return temp; } - public void addActivationSkill(OptionsSkillHolder holder) + public void addActivationSkill(OptionSkillHolder holder) { if (_activationSkills == null) { @@ -189,21 +188,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.addTriggerSkill(holder); } @@ -227,21 +226,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - player.removeSkill(holder.getSkill(), false, false); + player.removeSkill(skill, false, false); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - player.removeSkill(holder.getSkill(), false, true); + player.removeSkill(skill, false, true); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.removeTriggerSkill(holder); } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java deleted file mode 100644 index fc42843b8a..0000000000 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -import org.l2jmobius.gameserver.model.holders.SkillHolder; - -/** - * @author UnAfraid - */ -public class OptionsSkillHolder extends SkillHolder -{ - private final OptionsSkillType _type; - private final double _chance; - - /** - * @param skillId - * @param skillLevel - * @param type - * @param chance - */ - public OptionsSkillHolder(int skillId, int skillLevel, double chance, OptionsSkillType type) - { - super(skillId, skillLevel); - _chance = chance; - _type = type; - } - - public OptionsSkillType getSkillType() - { - return _type; - } - - public double getChance() - { - return _chance; - } -} diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java deleted file mode 100644 index 7c216d20f7..0000000000 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -/** - * @author UnAfraid - */ -public enum OptionsSkillType -{ - ATTACK, - MAGIC, - CRITICAL -} diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java index 55101d8139..64e90fbae2 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java @@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate; import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.ActionType; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.zone.ZoneId; @@ -602,9 +602,9 @@ public class SkillCaster implements Runnable if (caster.hasTriggerSkills()) { - for (OptionsSkillHolder holder : caster.getTriggerSkills().values()) + for (OptionSkillHolder holder : caster.getTriggerSkills().values()) { - if (((skill.isMagic() && (holder.getSkillType() == OptionsSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionsSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) + if (((skill.isMagic() && (holder.getSkillType() == OptionSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) { triggerCast(caster, creature, holder.getSkill(), null, false); } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/data/xml/OptionData.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/data/xml/OptionData.java index f563b02755..86e0c8f1fb 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/data/xml/OptionData.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/data/xml/OptionData.java @@ -28,10 +28,10 @@ import org.w3c.dom.Document; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.options.Options; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; +import org.l2jmobius.gameserver.model.skill.Skill; /** * @author UnAfraid @@ -88,27 +88,77 @@ public class OptionData implements IXmlReader } case "active_skill": { - option.addActiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "passive_skill": { - option.addPassiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addPassiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "attack_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.ATTACK)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.ATTACK)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "magic_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.MAGIC)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.MAGIC)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "critical_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.CRITICAL)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.CRITICAL)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java index d04d0b4d75..005696e3e2 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -122,8 +122,8 @@ import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.EtcItemType; import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffInfo; @@ -237,7 +237,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe private boolean _lethalable = true; - private Map _triggerSkills; + private Map _triggerSkills; private Map _ignoreSkillEffects; /** Creatures effect list. */ @@ -3916,9 +3916,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (_triggerSkills != null) { - for (OptionsSkillHolder holder : _triggerSkills.values()) + for (OptionSkillHolder holder : _triggerSkills.values()) { - if (((!hit.isCritical() && (holder.getSkillType() == OptionsSkillType.ATTACK)) || ((holder.getSkillType() == OptionsSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) + if (((!hit.isCritical() && (holder.getSkillType() == OptionSkillType.ATTACK)) || ((holder.getSkillType() == OptionSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) { SkillCaster.triggerCast(this, target, holder.getSkill(), null, false); } @@ -4967,7 +4967,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return (_triggerSkills != null) && !_triggerSkills.isEmpty(); } - public Map getTriggerSkills() + public Map getTriggerSkills() { if (_triggerSkills == null) { @@ -4975,21 +4975,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe { if (_triggerSkills == null) { - _triggerSkills = new ConcurrentHashMap<>(); + _triggerSkills = new ConcurrentHashMap<>(1); } } } return _triggerSkills; } - public void addTriggerSkill(OptionsSkillHolder holder) + public void addTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().put(holder.getSkillId(), holder); + getTriggerSkills().put(holder.getSkill().getId(), holder); } - public void removeTriggerSkill(OptionsSkillHolder holder) + public void removeTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().remove(holder.getSkillId()); + getTriggerSkills().remove(holder.getSkill().getId()); } /** diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java new file mode 100644 index 0000000000..52f00e5d78 --- /dev/null +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java @@ -0,0 +1,56 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +import org.l2jmobius.gameserver.model.skill.Skill; + +/** + * @author UnAfraid, Mobius + */ +public class OptionSkillHolder +{ + private final Skill _skill; + private final double _chance; + private final OptionSkillType _type; + + /** + * @param skill + * @param type + * @param chance + */ + public OptionSkillHolder(Skill skill, double chance, OptionSkillType type) + { + _skill = skill; + _chance = chance; + _type = type; + } + + public Skill getSkill() + { + return _skill; + } + + public double getChance() + { + return _chance; + } + + public OptionSkillType getSkillType() + { + return _type; + } +} diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java new file mode 100644 index 0000000000..689c956312 --- /dev/null +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java @@ -0,0 +1,27 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +/** + * @author UnAfraid + */ +public enum OptionSkillType +{ + ATTACK, + MAGIC, + CRITICAL +} diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/options/Options.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/options/Options.java index 9eb5d46e9e..0299901a34 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/options/Options.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/options/Options.java @@ -22,7 +22,6 @@ import java.util.List; import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.skill.BuffInfo; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; @@ -34,9 +33,9 @@ public class Options { private final int _id; private List _effects = null; - private List _activeSkill = null; - private List _passiveSkill = null; - private List _activationSkills = null; + private List _activeSkill = null; + private List _passiveSkill = null; + private List _activationSkills = null; /** * @param id @@ -75,12 +74,12 @@ public class Options return _activeSkill != null; } - public List getActiveSkills() + public List getActiveSkills() { return _activeSkill; } - public void addActiveSkill(SkillHolder holder) + public void addActiveSkill(Skill holder) { if (_activeSkill == null) { @@ -94,12 +93,12 @@ public class Options return _passiveSkill != null; } - public List getPassiveSkills() + public List getPassiveSkills() { return _passiveSkill; } - public void addPassiveSkill(SkillHolder holder) + public void addPassiveSkill(Skill holder) { if (_passiveSkill == null) { @@ -113,11 +112,11 @@ public class Options return _activationSkills != null; } - public boolean hasActivationSkills(OptionsSkillType type) + public boolean hasActivationSkills(OptionSkillType type) { if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -128,17 +127,17 @@ public class Options return false; } - public List getActivationsSkills() + public List getActivationSkills() { return _activationSkills; } - public List getActivationsSkills(OptionsSkillType type) + public List getActivationSkills(OptionSkillType type) { - final List temp = new ArrayList<>(); + final List temp = new ArrayList<>(); if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -149,7 +148,7 @@ public class Options return temp; } - public void addActivationSkill(OptionsSkillHolder holder) + public void addActivationSkill(OptionSkillHolder holder) { if (_activationSkills == null) { @@ -189,21 +188,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.addTriggerSkill(holder); } @@ -227,21 +226,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - player.removeSkill(holder.getSkill(), false, false); + player.removeSkill(skill, false, false); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - player.removeSkill(holder.getSkill(), false, true); + player.removeSkill(skill, false, true); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.removeTriggerSkill(holder); } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java deleted file mode 100644 index fc42843b8a..0000000000 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -import org.l2jmobius.gameserver.model.holders.SkillHolder; - -/** - * @author UnAfraid - */ -public class OptionsSkillHolder extends SkillHolder -{ - private final OptionsSkillType _type; - private final double _chance; - - /** - * @param skillId - * @param skillLevel - * @param type - * @param chance - */ - public OptionsSkillHolder(int skillId, int skillLevel, double chance, OptionsSkillType type) - { - super(skillId, skillLevel); - _chance = chance; - _type = type; - } - - public OptionsSkillType getSkillType() - { - return _type; - } - - public double getChance() - { - return _chance; - } -} diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java deleted file mode 100644 index 7c216d20f7..0000000000 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -/** - * @author UnAfraid - */ -public enum OptionsSkillType -{ - ATTACK, - MAGIC, - CRITICAL -} diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java index 55101d8139..64e90fbae2 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java @@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate; import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.ActionType; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.zone.ZoneId; @@ -602,9 +602,9 @@ public class SkillCaster implements Runnable if (caster.hasTriggerSkills()) { - for (OptionsSkillHolder holder : caster.getTriggerSkills().values()) + for (OptionSkillHolder holder : caster.getTriggerSkills().values()) { - if (((skill.isMagic() && (holder.getSkillType() == OptionsSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionsSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) + if (((skill.isMagic() && (holder.getSkillType() == OptionSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) { triggerCast(caster, creature, holder.getSkill(), null, false); } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/data/xml/OptionData.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/data/xml/OptionData.java index f563b02755..86e0c8f1fb 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/data/xml/OptionData.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/data/xml/OptionData.java @@ -28,10 +28,10 @@ import org.w3c.dom.Document; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.options.Options; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; +import org.l2jmobius.gameserver.model.skill.Skill; /** * @author UnAfraid @@ -88,27 +88,77 @@ public class OptionData implements IXmlReader } case "active_skill": { - option.addActiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "passive_skill": { - option.addPassiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addPassiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "attack_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.ATTACK)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.ATTACK)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "magic_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.MAGIC)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.MAGIC)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "critical_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.CRITICAL)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.CRITICAL)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java index 07cf3929db..991e259f3d 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -122,8 +122,8 @@ import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.EtcItemType; import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffInfo; @@ -237,7 +237,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe private boolean _lethalable = true; - private Map _triggerSkills; + private Map _triggerSkills; private Map _ignoreSkillEffects; /** Creatures effect list. */ @@ -3915,9 +3915,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (_triggerSkills != null) { - for (OptionsSkillHolder holder : _triggerSkills.values()) + for (OptionSkillHolder holder : _triggerSkills.values()) { - if (((!hit.isCritical() && (holder.getSkillType() == OptionsSkillType.ATTACK)) || ((holder.getSkillType() == OptionsSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) + if (((!hit.isCritical() && (holder.getSkillType() == OptionSkillType.ATTACK)) || ((holder.getSkillType() == OptionSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) { SkillCaster.triggerCast(this, target, holder.getSkill(), null, false); } @@ -4966,7 +4966,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return (_triggerSkills != null) && !_triggerSkills.isEmpty(); } - public Map getTriggerSkills() + public Map getTriggerSkills() { if (_triggerSkills == null) { @@ -4974,21 +4974,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe { if (_triggerSkills == null) { - _triggerSkills = new ConcurrentHashMap<>(); + _triggerSkills = new ConcurrentHashMap<>(1); } } } return _triggerSkills; } - public void addTriggerSkill(OptionsSkillHolder holder) + public void addTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().put(holder.getSkillId(), holder); + getTriggerSkills().put(holder.getSkill().getId(), holder); } - public void removeTriggerSkill(OptionsSkillHolder holder) + public void removeTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().remove(holder.getSkillId()); + getTriggerSkills().remove(holder.getSkill().getId()); } /** diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java new file mode 100644 index 0000000000..52f00e5d78 --- /dev/null +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java @@ -0,0 +1,56 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +import org.l2jmobius.gameserver.model.skill.Skill; + +/** + * @author UnAfraid, Mobius + */ +public class OptionSkillHolder +{ + private final Skill _skill; + private final double _chance; + private final OptionSkillType _type; + + /** + * @param skill + * @param type + * @param chance + */ + public OptionSkillHolder(Skill skill, double chance, OptionSkillType type) + { + _skill = skill; + _chance = chance; + _type = type; + } + + public Skill getSkill() + { + return _skill; + } + + public double getChance() + { + return _chance; + } + + public OptionSkillType getSkillType() + { + return _type; + } +} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java new file mode 100644 index 0000000000..689c956312 --- /dev/null +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java @@ -0,0 +1,27 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +/** + * @author UnAfraid + */ +public enum OptionSkillType +{ + ATTACK, + MAGIC, + CRITICAL +} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/options/Options.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/options/Options.java index 9eb5d46e9e..0299901a34 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/options/Options.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/options/Options.java @@ -22,7 +22,6 @@ import java.util.List; import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.skill.BuffInfo; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; @@ -34,9 +33,9 @@ public class Options { private final int _id; private List _effects = null; - private List _activeSkill = null; - private List _passiveSkill = null; - private List _activationSkills = null; + private List _activeSkill = null; + private List _passiveSkill = null; + private List _activationSkills = null; /** * @param id @@ -75,12 +74,12 @@ public class Options return _activeSkill != null; } - public List getActiveSkills() + public List getActiveSkills() { return _activeSkill; } - public void addActiveSkill(SkillHolder holder) + public void addActiveSkill(Skill holder) { if (_activeSkill == null) { @@ -94,12 +93,12 @@ public class Options return _passiveSkill != null; } - public List getPassiveSkills() + public List getPassiveSkills() { return _passiveSkill; } - public void addPassiveSkill(SkillHolder holder) + public void addPassiveSkill(Skill holder) { if (_passiveSkill == null) { @@ -113,11 +112,11 @@ public class Options return _activationSkills != null; } - public boolean hasActivationSkills(OptionsSkillType type) + public boolean hasActivationSkills(OptionSkillType type) { if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -128,17 +127,17 @@ public class Options return false; } - public List getActivationsSkills() + public List getActivationSkills() { return _activationSkills; } - public List getActivationsSkills(OptionsSkillType type) + public List getActivationSkills(OptionSkillType type) { - final List temp = new ArrayList<>(); + final List temp = new ArrayList<>(); if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -149,7 +148,7 @@ public class Options return temp; } - public void addActivationSkill(OptionsSkillHolder holder) + public void addActivationSkill(OptionSkillHolder holder) { if (_activationSkills == null) { @@ -189,21 +188,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.addTriggerSkill(holder); } @@ -227,21 +226,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - player.removeSkill(holder.getSkill(), false, false); + player.removeSkill(skill, false, false); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - player.removeSkill(holder.getSkill(), false, true); + player.removeSkill(skill, false, true); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.removeTriggerSkill(holder); } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java deleted file mode 100644 index fc42843b8a..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -import org.l2jmobius.gameserver.model.holders.SkillHolder; - -/** - * @author UnAfraid - */ -public class OptionsSkillHolder extends SkillHolder -{ - private final OptionsSkillType _type; - private final double _chance; - - /** - * @param skillId - * @param skillLevel - * @param type - * @param chance - */ - public OptionsSkillHolder(int skillId, int skillLevel, double chance, OptionsSkillType type) - { - super(skillId, skillLevel); - _chance = chance; - _type = type; - } - - public OptionsSkillType getSkillType() - { - return _type; - } - - public double getChance() - { - return _chance; - } -} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java deleted file mode 100644 index 7c216d20f7..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -/** - * @author UnAfraid - */ -public enum OptionsSkillType -{ - ATTACK, - MAGIC, - CRITICAL -} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java index 9913fa60fa..117ff1f52a 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java @@ -63,8 +63,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate; import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.ActionType; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.zone.ZoneId; @@ -607,9 +607,9 @@ public class SkillCaster implements Runnable if (caster.hasTriggerSkills()) { - for (OptionsSkillHolder holder : caster.getTriggerSkills().values()) + for (OptionSkillHolder holder : caster.getTriggerSkills().values()) { - if (((skill.isMagic() && (holder.getSkillType() == OptionsSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionsSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) + if (((skill.isMagic() && (holder.getSkillType() == OptionSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) { triggerCast(caster, creature, holder.getSkill(), null, false); } diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/stats/augmentation/options/31900-31999.xml b/L2J_Mobius_Classic_Interlude/dist/game/data/stats/augmentation/options/31900-31999.xml index be0482ea1b..b6608f9db4 100644 --- a/L2J_Mobius_Classic_Interlude/dist/game/data/stats/augmentation/options/31900-31999.xml +++ b/L2J_Mobius_Classic_Interlude/dist/game/data/stats/augmentation/options/31900-31999.xml @@ -819,15 +819,12 @@ \ No newline at end of file diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/data/xml/OptionData.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/data/xml/OptionData.java index 696f93dfa8..79b9935825 100644 --- a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/data/xml/OptionData.java +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/data/xml/OptionData.java @@ -28,10 +28,10 @@ import org.w3c.dom.Document; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.options.Options; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; +import org.l2jmobius.gameserver.model.skill.Skill; /** * @author UnAfraid @@ -88,27 +88,77 @@ public class OptionData implements IXmlReader } case "active_skill": { - option.addActiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "passive_skill": { - option.addPassiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addPassiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "attack_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.ATTACK)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.ATTACK)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "magic_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.MAGIC)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.MAGIC)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "critical_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.CRITICAL)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.CRITICAL)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } } diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/actor/Creature.java index f3ffd6fdf6..a545d2e3f1 100644 --- a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -122,8 +122,8 @@ import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.EtcItemType; import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffInfo; @@ -237,7 +237,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe private boolean _lethalable = true; - private Map _triggerSkills; + private Map _triggerSkills; private Map _ignoreSkillEffects; /** Creatures effect list. */ @@ -3925,9 +3925,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (_triggerSkills != null) { - for (OptionsSkillHolder holder : _triggerSkills.values()) + for (OptionSkillHolder holder : _triggerSkills.values()) { - if (((!hit.isCritical() && (holder.getSkillType() == OptionsSkillType.ATTACK)) || ((holder.getSkillType() == OptionsSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) + if (((!hit.isCritical() && (holder.getSkillType() == OptionSkillType.ATTACK)) || ((holder.getSkillType() == OptionSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) { SkillCaster.triggerCast(this, target, holder.getSkill(), null, false); } @@ -4986,7 +4986,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return (_triggerSkills != null) && !_triggerSkills.isEmpty(); } - public Map getTriggerSkills() + public Map getTriggerSkills() { if (_triggerSkills == null) { @@ -4994,21 +4994,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe { if (_triggerSkills == null) { - _triggerSkills = new ConcurrentHashMap<>(); + _triggerSkills = new ConcurrentHashMap<>(1); } } } return _triggerSkills; } - public void addTriggerSkill(OptionsSkillHolder holder) + public void addTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().put(holder.getSkillId(), holder); + getTriggerSkills().put(holder.getSkill().getId(), holder); } - public void removeTriggerSkill(OptionsSkillHolder holder) + public void removeTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().remove(holder.getSkillId()); + getTriggerSkills().remove(holder.getSkill().getId()); } /** diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java new file mode 100644 index 0000000000..52f00e5d78 --- /dev/null +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java @@ -0,0 +1,56 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +import org.l2jmobius.gameserver.model.skill.Skill; + +/** + * @author UnAfraid, Mobius + */ +public class OptionSkillHolder +{ + private final Skill _skill; + private final double _chance; + private final OptionSkillType _type; + + /** + * @param skill + * @param type + * @param chance + */ + public OptionSkillHolder(Skill skill, double chance, OptionSkillType type) + { + _skill = skill; + _chance = chance; + _type = type; + } + + public Skill getSkill() + { + return _skill; + } + + public double getChance() + { + return _chance; + } + + public OptionSkillType getSkillType() + { + return _type; + } +} diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java new file mode 100644 index 0000000000..689c956312 --- /dev/null +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java @@ -0,0 +1,27 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +/** + * @author UnAfraid + */ +public enum OptionSkillType +{ + ATTACK, + MAGIC, + CRITICAL +} diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/options/Options.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/options/Options.java index 9eb5d46e9e..0299901a34 100644 --- a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/options/Options.java +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/options/Options.java @@ -22,7 +22,6 @@ import java.util.List; import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.skill.BuffInfo; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; @@ -34,9 +33,9 @@ public class Options { private final int _id; private List _effects = null; - private List _activeSkill = null; - private List _passiveSkill = null; - private List _activationSkills = null; + private List _activeSkill = null; + private List _passiveSkill = null; + private List _activationSkills = null; /** * @param id @@ -75,12 +74,12 @@ public class Options return _activeSkill != null; } - public List getActiveSkills() + public List getActiveSkills() { return _activeSkill; } - public void addActiveSkill(SkillHolder holder) + public void addActiveSkill(Skill holder) { if (_activeSkill == null) { @@ -94,12 +93,12 @@ public class Options return _passiveSkill != null; } - public List getPassiveSkills() + public List getPassiveSkills() { return _passiveSkill; } - public void addPassiveSkill(SkillHolder holder) + public void addPassiveSkill(Skill holder) { if (_passiveSkill == null) { @@ -113,11 +112,11 @@ public class Options return _activationSkills != null; } - public boolean hasActivationSkills(OptionsSkillType type) + public boolean hasActivationSkills(OptionSkillType type) { if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -128,17 +127,17 @@ public class Options return false; } - public List getActivationsSkills() + public List getActivationSkills() { return _activationSkills; } - public List getActivationsSkills(OptionsSkillType type) + public List getActivationSkills(OptionSkillType type) { - final List temp = new ArrayList<>(); + final List temp = new ArrayList<>(); if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -149,7 +148,7 @@ public class Options return temp; } - public void addActivationSkill(OptionsSkillHolder holder) + public void addActivationSkill(OptionSkillHolder holder) { if (_activationSkills == null) { @@ -189,21 +188,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.addTriggerSkill(holder); } @@ -227,21 +226,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - player.removeSkill(holder.getSkill(), false, false); + player.removeSkill(skill, false, false); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - player.removeSkill(holder.getSkill(), false, true); + player.removeSkill(skill, false, true); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.removeTriggerSkill(holder); } diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java deleted file mode 100644 index fc42843b8a..0000000000 --- a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -import org.l2jmobius.gameserver.model.holders.SkillHolder; - -/** - * @author UnAfraid - */ -public class OptionsSkillHolder extends SkillHolder -{ - private final OptionsSkillType _type; - private final double _chance; - - /** - * @param skillId - * @param skillLevel - * @param type - * @param chance - */ - public OptionsSkillHolder(int skillId, int skillLevel, double chance, OptionsSkillType type) - { - super(skillId, skillLevel); - _chance = chance; - _type = type; - } - - public OptionsSkillType getSkillType() - { - return _type; - } - - public double getChance() - { - return _chance; - } -} diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java deleted file mode 100644 index 7c216d20f7..0000000000 --- a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -/** - * @author UnAfraid - */ -public enum OptionsSkillType -{ - ATTACK, - MAGIC, - CRITICAL -} diff --git a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java index a96613a94e..06878b17d4 100644 --- a/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java +++ b/L2J_Mobius_Essence_6.1_BattleChronicle/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java @@ -63,8 +63,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate; import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.ActionType; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.stats.Stat; @@ -608,9 +608,9 @@ public class SkillCaster implements Runnable if (caster.hasTriggerSkills()) { - for (OptionsSkillHolder holder : caster.getTriggerSkills().values()) + for (OptionSkillHolder holder : caster.getTriggerSkills().values()) { - if (((skill.isMagic() && (holder.getSkillType() == OptionsSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionsSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) + if (((skill.isMagic() && (holder.getSkillType() == OptionSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) { triggerCast(caster, creature, holder.getSkill(), null, false); } diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/stats/augmentation/options/34300-34399.xml b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/stats/augmentation/options/34300-34399.xml index 0c75fe4bab..b06a6639bc 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/stats/augmentation/options/34300-34399.xml +++ b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/stats/augmentation/options/34300-34399.xml @@ -165,19 +165,13 @@ - - - - - - + \ No newline at end of file diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/data/xml/OptionData.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/data/xml/OptionData.java index 696f93dfa8..79b9935825 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/data/xml/OptionData.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/data/xml/OptionData.java @@ -28,10 +28,10 @@ import org.w3c.dom.Document; import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.options.Options; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; +import org.l2jmobius.gameserver.model.skill.Skill; /** * @author UnAfraid @@ -88,27 +88,77 @@ public class OptionData implements IXmlReader } case "active_skill": { - option.addActiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "passive_skill": { - option.addPassiveSkill(new SkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"))); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addPassiveSkill(skill); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "attack_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.ATTACK)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.ATTACK)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "magic_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.MAGIC)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.MAGIC)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } case "critical_skill": { - option.addActivationSkill(new OptionsSkillHolder(parseInteger(innerNode.getAttributes(), "id"), parseInteger(innerNode.getAttributes(), "level"), parseDouble(innerNode.getAttributes(), "chance"), OptionsSkillType.CRITICAL)); + final int skillId = parseInteger(innerNode.getAttributes(), "id"); + final int skillLevel = parseInteger(innerNode.getAttributes(), "level"); + final Skill skill = SkillData.getInstance().getSkill(skillId, skillLevel); + if (skill != null) + { + option.addActivationSkill(new OptionSkillHolder(skill, parseDouble(innerNode.getAttributes(), "chance"), OptionSkillType.CRITICAL)); + } + else + { + LOGGER.info(getClass().getSimpleName() + ": Could not find skill " + skillId + "(" + skillLevel + ") used by option " + id + "."); + } break; } } diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/actor/Creature.java index f3ffd6fdf6..a545d2e3f1 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/actor/Creature.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/actor/Creature.java @@ -122,8 +122,8 @@ import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.EtcItemType; import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.itemcontainer.Inventory; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffInfo; @@ -237,7 +237,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe private boolean _lethalable = true; - private Map _triggerSkills; + private Map _triggerSkills; private Map _ignoreSkillEffects; /** Creatures effect list. */ @@ -3925,9 +3925,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe if (_triggerSkills != null) { - for (OptionsSkillHolder holder : _triggerSkills.values()) + for (OptionSkillHolder holder : _triggerSkills.values()) { - if (((!hit.isCritical() && (holder.getSkillType() == OptionsSkillType.ATTACK)) || ((holder.getSkillType() == OptionsSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) + if (((!hit.isCritical() && (holder.getSkillType() == OptionSkillType.ATTACK)) || ((holder.getSkillType() == OptionSkillType.CRITICAL) && hit.isCritical())) && (Rnd.get(100) < holder.getChance())) { SkillCaster.triggerCast(this, target, holder.getSkill(), null, false); } @@ -4986,7 +4986,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe return (_triggerSkills != null) && !_triggerSkills.isEmpty(); } - public Map getTriggerSkills() + public Map getTriggerSkills() { if (_triggerSkills == null) { @@ -4994,21 +4994,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe { if (_triggerSkills == null) { - _triggerSkills = new ConcurrentHashMap<>(); + _triggerSkills = new ConcurrentHashMap<>(1); } } } return _triggerSkills; } - public void addTriggerSkill(OptionsSkillHolder holder) + public void addTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().put(holder.getSkillId(), holder); + getTriggerSkills().put(holder.getSkill().getId(), holder); } - public void removeTriggerSkill(OptionsSkillHolder holder) + public void removeTriggerSkill(OptionSkillHolder holder) { - getTriggerSkills().remove(holder.getSkillId()); + getTriggerSkills().remove(holder.getSkill().getId()); } /** diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java new file mode 100644 index 0000000000..52f00e5d78 --- /dev/null +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/options/OptionSkillHolder.java @@ -0,0 +1,56 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +import org.l2jmobius.gameserver.model.skill.Skill; + +/** + * @author UnAfraid, Mobius + */ +public class OptionSkillHolder +{ + private final Skill _skill; + private final double _chance; + private final OptionSkillType _type; + + /** + * @param skill + * @param type + * @param chance + */ + public OptionSkillHolder(Skill skill, double chance, OptionSkillType type) + { + _skill = skill; + _chance = chance; + _type = type; + } + + public Skill getSkill() + { + return _skill; + } + + public double getChance() + { + return _chance; + } + + public OptionSkillType getSkillType() + { + return _type; + } +} diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java new file mode 100644 index 0000000000..689c956312 --- /dev/null +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/options/OptionSkillType.java @@ -0,0 +1,27 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.options; + +/** + * @author UnAfraid + */ +public enum OptionSkillType +{ + ATTACK, + MAGIC, + CRITICAL +} diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/options/Options.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/options/Options.java index 9eb5d46e9e..0299901a34 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/options/Options.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/options/Options.java @@ -22,7 +22,6 @@ import java.util.List; import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.holders.SkillHolder; import org.l2jmobius.gameserver.model.skill.BuffInfo; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; @@ -34,9 +33,9 @@ public class Options { private final int _id; private List _effects = null; - private List _activeSkill = null; - private List _passiveSkill = null; - private List _activationSkills = null; + private List _activeSkill = null; + private List _passiveSkill = null; + private List _activationSkills = null; /** * @param id @@ -75,12 +74,12 @@ public class Options return _activeSkill != null; } - public List getActiveSkills() + public List getActiveSkills() { return _activeSkill; } - public void addActiveSkill(SkillHolder holder) + public void addActiveSkill(Skill holder) { if (_activeSkill == null) { @@ -94,12 +93,12 @@ public class Options return _passiveSkill != null; } - public List getPassiveSkills() + public List getPassiveSkills() { return _passiveSkill; } - public void addPassiveSkill(SkillHolder holder) + public void addPassiveSkill(Skill holder) { if (_passiveSkill == null) { @@ -113,11 +112,11 @@ public class Options return _activationSkills != null; } - public boolean hasActivationSkills(OptionsSkillType type) + public boolean hasActivationSkills(OptionSkillType type) { if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -128,17 +127,17 @@ public class Options return false; } - public List getActivationsSkills() + public List getActivationSkills() { return _activationSkills; } - public List getActivationsSkills(OptionsSkillType type) + public List getActivationSkills(OptionSkillType type) { - final List temp = new ArrayList<>(); + final List temp = new ArrayList<>(); if (_activationSkills != null) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { if (holder.getSkillType() == type) { @@ -149,7 +148,7 @@ public class Options return temp; } - public void addActivationSkill(OptionsSkillHolder holder) + public void addActivationSkill(OptionSkillHolder holder) { if (_activationSkills == null) { @@ -189,21 +188,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - addSkill(player, holder.getSkill()); + addSkill(player, skill); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.addTriggerSkill(holder); } @@ -227,21 +226,21 @@ public class Options } if (hasActiveSkills()) { - for (SkillHolder holder : _activeSkill) + for (Skill skill : _activeSkill) { - player.removeSkill(holder.getSkill(), false, false); + player.removeSkill(skill, false, false); } } if (hasPassiveSkills()) { - for (SkillHolder holder : _passiveSkill) + for (Skill skill : _passiveSkill) { - player.removeSkill(holder.getSkill(), false, true); + player.removeSkill(skill, false, true); } } if (hasActivationSkills()) { - for (OptionsSkillHolder holder : _activationSkills) + for (OptionSkillHolder holder : _activationSkills) { player.removeTriggerSkill(holder); } diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java deleted file mode 100644 index fc42843b8a..0000000000 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/options/OptionsSkillHolder.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -import org.l2jmobius.gameserver.model.holders.SkillHolder; - -/** - * @author UnAfraid - */ -public class OptionsSkillHolder extends SkillHolder -{ - private final OptionsSkillType _type; - private final double _chance; - - /** - * @param skillId - * @param skillLevel - * @param type - * @param chance - */ - public OptionsSkillHolder(int skillId, int skillLevel, double chance, OptionsSkillType type) - { - super(skillId, skillLevel); - _chance = chance; - _type = type; - } - - public OptionsSkillType getSkillType() - { - return _type; - } - - public double getChance() - { - return _chance; - } -} diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java deleted file mode 100644 index 7c216d20f7..0000000000 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/options/OptionsSkillType.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.l2jmobius.gameserver.model.options; - -/** - * @author UnAfraid - */ -public enum OptionsSkillType -{ - ATTACK, - MAGIC, - CRITICAL -} diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java index a96613a94e..06878b17d4 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/skill/SkillCaster.java @@ -63,8 +63,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate; import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.type.ActionType; -import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; -import org.l2jmobius.gameserver.model.options.OptionsSkillType; +import org.l2jmobius.gameserver.model.options.OptionSkillHolder; +import org.l2jmobius.gameserver.model.options.OptionSkillType; import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.stats.Stat; @@ -608,9 +608,9 @@ public class SkillCaster implements Runnable if (caster.hasTriggerSkills()) { - for (OptionsSkillHolder holder : caster.getTriggerSkills().values()) + for (OptionSkillHolder holder : caster.getTriggerSkills().values()) { - if (((skill.isMagic() && (holder.getSkillType() == OptionsSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionsSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) + if (((skill.isMagic() && (holder.getSkillType() == OptionSkillType.MAGIC)) || (skill.isPhysical() && (holder.getSkillType() == OptionSkillType.ATTACK))) && (Rnd.get(100) < holder.getChance())) { triggerCast(caster, creature, holder.getSkill(), null, false); }