Changed option data to directly use skills.

This commit is contained in:
MobiusDevelopment
2022-03-18 23:07:01 +00:00
parent ca95c046e7
commit 4d12be9964
226 changed files with 4252 additions and 4677 deletions
@@ -28,10 +28,10 @@ import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.handler.EffectHandler;
import org.l2jmobius.gameserver.model.StatSet; 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.Options;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.Skill;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -88,27 +88,77 @@ public class OptionData implements IXmlReader
} }
case "active_skill": 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; break;
} }
case "passive_skill": 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; break;
} }
case "attack_skill": 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; break;
} }
case "magic_skill": 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; break;
} }
case "critical_skill": 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; break;
} }
} }
@@ -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.EtcItemType;
import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.item.type.WeaponType;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory; import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.AbnormalType;
import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffFinishTask;
import org.l2jmobius.gameserver.model.skill.BuffInfo; 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 boolean _lethalable = true;
private Map<Integer, OptionsSkillHolder> _triggerSkills; private Map<Integer, OptionSkillHolder> _triggerSkills;
private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects; private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects;
/** Creatures effect list. */ /** Creatures effect list. */
@@ -3903,9 +3903,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (_triggerSkills != null) 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); 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(); return (_triggerSkills != null) && !_triggerSkills.isEmpty();
} }
public Map<Integer, OptionsSkillHolder> getTriggerSkills() public Map<Integer, OptionSkillHolder> getTriggerSkills()
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
@@ -4942,21 +4942,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
_triggerSkills = new ConcurrentHashMap<>(); _triggerSkills = new ConcurrentHashMap<>(1);
} }
} }
} }
return _triggerSkills; 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());
} }
/** /**
@@ -16,36 +16,41 @@
*/ */
package org.l2jmobius.gameserver.model.options; 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 double _chance;
private final OptionSkillType _type;
/** /**
* @param skillId * @param skill
* @param skillLevel
* @param type * @param type
* @param chance * @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; _chance = chance;
_type = type; _type = type;
} }
public OptionsSkillType getSkillType() public Skill getSkill()
{ {
return _type; return _skill;
} }
public double getChance() public double getChance()
{ {
return _chance; return _chance;
} }
public OptionSkillType getSkillType()
{
return _type;
}
} }
@@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.model.options;
/** /**
* @author UnAfraid * @author UnAfraid
*/ */
public enum OptionsSkillType public enum OptionSkillType
{ {
ATTACK, ATTACK,
MAGIC, MAGIC,
@@ -22,7 +22,6 @@ import java.util.List;
import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.enums.SkillFinishType;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.AbstractEffect; 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.BuffInfo;
import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
@@ -34,9 +33,9 @@ public class Options
{ {
private final int _id; private final int _id;
private List<AbstractEffect> _effects = null; private List<AbstractEffect> _effects = null;
private List<SkillHolder> _activeSkill = null; private List<Skill> _activeSkill = null;
private List<SkillHolder> _passiveSkill = null; private List<Skill> _passiveSkill = null;
private List<OptionsSkillHolder> _activationSkills = null; private List<OptionSkillHolder> _activationSkills = null;
/** /**
* @param id * @param id
@@ -75,12 +74,12 @@ public class Options
return _activeSkill != null; return _activeSkill != null;
} }
public List<SkillHolder> getActiveSkills() public List<Skill> getActiveSkills()
{ {
return _activeSkill; return _activeSkill;
} }
public void addActiveSkill(SkillHolder holder) public void addActiveSkill(Skill holder)
{ {
if (_activeSkill == null) if (_activeSkill == null)
{ {
@@ -94,12 +93,12 @@ public class Options
return _passiveSkill != null; return _passiveSkill != null;
} }
public List<SkillHolder> getPassiveSkills() public List<Skill> getPassiveSkills()
{ {
return _passiveSkill; return _passiveSkill;
} }
public void addPassiveSkill(SkillHolder holder) public void addPassiveSkill(Skill holder)
{ {
if (_passiveSkill == null) if (_passiveSkill == null)
{ {
@@ -113,11 +112,11 @@ public class Options
return _activationSkills != null; return _activationSkills != null;
} }
public boolean hasActivationSkills(OptionsSkillType type) public boolean hasActivationSkills(OptionSkillType type)
{ {
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -128,17 +127,17 @@ public class Options
return false; return false;
} }
public List<OptionsSkillHolder> getActivationsSkills() public List<OptionSkillHolder> getActivationSkills()
{ {
return _activationSkills; return _activationSkills;
} }
public List<OptionsSkillHolder> getActivationsSkills(OptionsSkillType type) public List<OptionSkillHolder> getActivationSkills(OptionSkillType type)
{ {
final List<OptionsSkillHolder> temp = new ArrayList<>(); final List<OptionSkillHolder> temp = new ArrayList<>();
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -149,7 +148,7 @@ public class Options
return temp; return temp;
} }
public void addActivationSkill(OptionsSkillHolder holder) public void addActivationSkill(OptionSkillHolder holder)
{ {
if (_activationSkills == null) if (_activationSkills == null)
{ {
@@ -189,21 +188,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.addTriggerSkill(holder); player.addTriggerSkill(holder);
} }
@@ -227,21 +226,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
player.removeSkill(holder.getSkill(), false, false); player.removeSkill(skill, false, false);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
player.removeSkill(holder.getSkill(), false, true); player.removeSkill(skill, false, true);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.removeTriggerSkill(holder); player.removeTriggerSkill(holder);
} }
@@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate;
import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.Weapon;
import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.item.type.ActionType; import org.l2jmobius.gameserver.model.item.type.ActionType;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.skill.targets.TargetType;
import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.stats.Formulas;
import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.model.zone.ZoneId;
@@ -602,9 +602,9 @@ public class SkillCaster implements Runnable
if (caster.hasTriggerSkills()) 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); triggerCast(caster, creature, holder.getSkill(), null, false);
} }
@@ -294,15 +294,12 @@
</option> </option>
<option id="31996" name="infinite_odyssey"> <option id="31996" name="infinite_odyssey">
<!-- Passive: Petrification Resistance + 2%. --> <!-- Passive: Petrification Resistance + 2%. -->
<passive_skill id="13765" level="7" />
</option> </option>
<option id="31997" name="infinite_odyssey"> <option id="31997" name="infinite_odyssey">
<!-- Passive: Petrification Resistance + 3%. --> <!-- Passive: Petrification Resistance + 3%. -->
<passive_skill id="13765" level="8" />
</option> </option>
<option id="31998" name="infinite_odyssey"> <option id="31998" name="infinite_odyssey">
<!-- Passive: Petrification Resistance + 4%. --> <!-- Passive: Petrification Resistance + 4%. -->
<passive_skill id="13765" level="9" />
</option> </option>
<option id="31999" name="infinite_odyssey"> <option id="31999" name="infinite_odyssey">
<!-- Stun/Hold Resistance + 6% --> <!-- Stun/Hold Resistance + 6% -->
@@ -28,10 +28,10 @@ import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.handler.EffectHandler;
import org.l2jmobius.gameserver.model.StatSet; 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.Options;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.Skill;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -88,27 +88,77 @@ public class OptionData implements IXmlReader
} }
case "active_skill": 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; break;
} }
case "passive_skill": 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; break;
} }
case "attack_skill": 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; break;
} }
case "magic_skill": 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; break;
} }
case "critical_skill": 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; break;
} }
} }
@@ -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.EtcItemType;
import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.item.type.WeaponType;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory; import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.AbnormalType;
import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffFinishTask;
import org.l2jmobius.gameserver.model.skill.BuffInfo; 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 boolean _lethalable = true;
private Map<Integer, OptionsSkillHolder> _triggerSkills; private Map<Integer, OptionSkillHolder> _triggerSkills;
private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects; private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects;
/** Creatures effect list. */ /** Creatures effect list. */
@@ -3903,9 +3903,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (_triggerSkills != null) 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); 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(); return (_triggerSkills != null) && !_triggerSkills.isEmpty();
} }
public Map<Integer, OptionsSkillHolder> getTriggerSkills() public Map<Integer, OptionSkillHolder> getTriggerSkills()
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
@@ -4942,21 +4942,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
_triggerSkills = new ConcurrentHashMap<>(); _triggerSkills = new ConcurrentHashMap<>(1);
} }
} }
} }
return _triggerSkills; 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());
} }
/** /**
@@ -16,36 +16,41 @@
*/ */
package org.l2jmobius.gameserver.model.options; 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 double _chance;
private final OptionSkillType _type;
/** /**
* @param skillId * @param skill
* @param skillLevel
* @param type * @param type
* @param chance * @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; _chance = chance;
_type = type; _type = type;
} }
public OptionsSkillType getSkillType() public Skill getSkill()
{ {
return _type; return _skill;
} }
public double getChance() public double getChance()
{ {
return _chance; return _chance;
} }
public OptionSkillType getSkillType()
{
return _type;
}
} }
@@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.model.options;
/** /**
* @author UnAfraid * @author UnAfraid
*/ */
public enum OptionsSkillType public enum OptionSkillType
{ {
ATTACK, ATTACK,
MAGIC, MAGIC,
@@ -22,7 +22,6 @@ import java.util.List;
import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.enums.SkillFinishType;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.AbstractEffect; 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.BuffInfo;
import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
@@ -34,9 +33,9 @@ public class Options
{ {
private final int _id; private final int _id;
private List<AbstractEffect> _effects = null; private List<AbstractEffect> _effects = null;
private List<SkillHolder> _activeSkill = null; private List<Skill> _activeSkill = null;
private List<SkillHolder> _passiveSkill = null; private List<Skill> _passiveSkill = null;
private List<OptionsSkillHolder> _activationSkills = null; private List<OptionSkillHolder> _activationSkills = null;
/** /**
* @param id * @param id
@@ -75,12 +74,12 @@ public class Options
return _activeSkill != null; return _activeSkill != null;
} }
public List<SkillHolder> getActiveSkills() public List<Skill> getActiveSkills()
{ {
return _activeSkill; return _activeSkill;
} }
public void addActiveSkill(SkillHolder holder) public void addActiveSkill(Skill holder)
{ {
if (_activeSkill == null) if (_activeSkill == null)
{ {
@@ -94,12 +93,12 @@ public class Options
return _passiveSkill != null; return _passiveSkill != null;
} }
public List<SkillHolder> getPassiveSkills() public List<Skill> getPassiveSkills()
{ {
return _passiveSkill; return _passiveSkill;
} }
public void addPassiveSkill(SkillHolder holder) public void addPassiveSkill(Skill holder)
{ {
if (_passiveSkill == null) if (_passiveSkill == null)
{ {
@@ -113,11 +112,11 @@ public class Options
return _activationSkills != null; return _activationSkills != null;
} }
public boolean hasActivationSkills(OptionsSkillType type) public boolean hasActivationSkills(OptionSkillType type)
{ {
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -128,17 +127,17 @@ public class Options
return false; return false;
} }
public List<OptionsSkillHolder> getActivationsSkills() public List<OptionSkillHolder> getActivationSkills()
{ {
return _activationSkills; return _activationSkills;
} }
public List<OptionsSkillHolder> getActivationsSkills(OptionsSkillType type) public List<OptionSkillHolder> getActivationSkills(OptionSkillType type)
{ {
final List<OptionsSkillHolder> temp = new ArrayList<>(); final List<OptionSkillHolder> temp = new ArrayList<>();
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -149,7 +148,7 @@ public class Options
return temp; return temp;
} }
public void addActivationSkill(OptionsSkillHolder holder) public void addActivationSkill(OptionSkillHolder holder)
{ {
if (_activationSkills == null) if (_activationSkills == null)
{ {
@@ -189,21 +188,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.addTriggerSkill(holder); player.addTriggerSkill(holder);
} }
@@ -227,21 +226,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
player.removeSkill(holder.getSkill(), false, false); player.removeSkill(skill, false, false);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
player.removeSkill(holder.getSkill(), false, true); player.removeSkill(skill, false, true);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.removeTriggerSkill(holder); player.removeTriggerSkill(holder);
} }
@@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate;
import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.Weapon;
import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.item.type.ActionType; import org.l2jmobius.gameserver.model.item.type.ActionType;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.skill.targets.TargetType;
import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.stats.Formulas;
import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.model.zone.ZoneId;
@@ -602,9 +602,9 @@ public class SkillCaster implements Runnable
if (caster.hasTriggerSkills()) 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); triggerCast(caster, creature, holder.getSkill(), null, false);
} }
@@ -294,15 +294,12 @@
</option> </option>
<option id="31996" name="infinite_odyssey"> <option id="31996" name="infinite_odyssey">
<!-- Passive: Petrification Resistance + 2%. --> <!-- Passive: Petrification Resistance + 2%. -->
<passive_skill id="13765" level="7" />
</option> </option>
<option id="31997" name="infinite_odyssey"> <option id="31997" name="infinite_odyssey">
<!-- Passive: Petrification Resistance + 3%. --> <!-- Passive: Petrification Resistance + 3%. -->
<passive_skill id="13765" level="8" />
</option> </option>
<option id="31998" name="infinite_odyssey"> <option id="31998" name="infinite_odyssey">
<!-- Passive: Petrification Resistance + 4%. --> <!-- Passive: Petrification Resistance + 4%. -->
<passive_skill id="13765" level="9" />
</option> </option>
<option id="31999" name="infinite_odyssey"> <option id="31999" name="infinite_odyssey">
<!-- Stun/Hold Resistance + 6% --> <!-- Stun/Hold Resistance + 6% -->
@@ -28,10 +28,10 @@ import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.handler.EffectHandler;
import org.l2jmobius.gameserver.model.StatSet; 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.Options;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.Skill;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -88,27 +88,77 @@ public class OptionData implements IXmlReader
} }
case "active_skill": 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; break;
} }
case "passive_skill": 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; break;
} }
case "attack_skill": 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; break;
} }
case "magic_skill": 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; break;
} }
case "critical_skill": 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; break;
} }
} }
@@ -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.EtcItemType;
import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.item.type.WeaponType;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory; import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.AbnormalType;
import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffFinishTask;
import org.l2jmobius.gameserver.model.skill.BuffInfo; 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 boolean _lethalable = true;
private Map<Integer, OptionsSkillHolder> _triggerSkills; private Map<Integer, OptionSkillHolder> _triggerSkills;
private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects; private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects;
/** Creatures effect list. */ /** Creatures effect list. */
@@ -3903,9 +3903,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (_triggerSkills != null) 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); 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(); return (_triggerSkills != null) && !_triggerSkills.isEmpty();
} }
public Map<Integer, OptionsSkillHolder> getTriggerSkills() public Map<Integer, OptionSkillHolder> getTriggerSkills()
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
@@ -4942,21 +4942,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
_triggerSkills = new ConcurrentHashMap<>(); _triggerSkills = new ConcurrentHashMap<>(1);
} }
} }
} }
return _triggerSkills; 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());
} }
/** /**
@@ -16,36 +16,41 @@
*/ */
package org.l2jmobius.gameserver.model.options; 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 double _chance;
private final OptionSkillType _type;
/** /**
* @param skillId * @param skill
* @param skillLevel
* @param type * @param type
* @param chance * @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; _chance = chance;
_type = type; _type = type;
} }
public OptionsSkillType getSkillType() public Skill getSkill()
{ {
return _type; return _skill;
} }
public double getChance() public double getChance()
{ {
return _chance; return _chance;
} }
public OptionSkillType getSkillType()
{
return _type;
}
} }
@@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.model.options;
/** /**
* @author UnAfraid * @author UnAfraid
*/ */
public enum OptionsSkillType public enum OptionSkillType
{ {
ATTACK, ATTACK,
MAGIC, MAGIC,
@@ -22,7 +22,6 @@ import java.util.List;
import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.enums.SkillFinishType;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.AbstractEffect; 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.BuffInfo;
import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
@@ -34,9 +33,9 @@ public class Options
{ {
private final int _id; private final int _id;
private List<AbstractEffect> _effects = null; private List<AbstractEffect> _effects = null;
private List<SkillHolder> _activeSkill = null; private List<Skill> _activeSkill = null;
private List<SkillHolder> _passiveSkill = null; private List<Skill> _passiveSkill = null;
private List<OptionsSkillHolder> _activationSkills = null; private List<OptionSkillHolder> _activationSkills = null;
/** /**
* @param id * @param id
@@ -75,12 +74,12 @@ public class Options
return _activeSkill != null; return _activeSkill != null;
} }
public List<SkillHolder> getActiveSkills() public List<Skill> getActiveSkills()
{ {
return _activeSkill; return _activeSkill;
} }
public void addActiveSkill(SkillHolder holder) public void addActiveSkill(Skill holder)
{ {
if (_activeSkill == null) if (_activeSkill == null)
{ {
@@ -94,12 +93,12 @@ public class Options
return _passiveSkill != null; return _passiveSkill != null;
} }
public List<SkillHolder> getPassiveSkills() public List<Skill> getPassiveSkills()
{ {
return _passiveSkill; return _passiveSkill;
} }
public void addPassiveSkill(SkillHolder holder) public void addPassiveSkill(Skill holder)
{ {
if (_passiveSkill == null) if (_passiveSkill == null)
{ {
@@ -113,11 +112,11 @@ public class Options
return _activationSkills != null; return _activationSkills != null;
} }
public boolean hasActivationSkills(OptionsSkillType type) public boolean hasActivationSkills(OptionSkillType type)
{ {
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -128,17 +127,17 @@ public class Options
return false; return false;
} }
public List<OptionsSkillHolder> getActivationsSkills() public List<OptionSkillHolder> getActivationSkills()
{ {
return _activationSkills; return _activationSkills;
} }
public List<OptionsSkillHolder> getActivationsSkills(OptionsSkillType type) public List<OptionSkillHolder> getActivationSkills(OptionSkillType type)
{ {
final List<OptionsSkillHolder> temp = new ArrayList<>(); final List<OptionSkillHolder> temp = new ArrayList<>();
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -149,7 +148,7 @@ public class Options
return temp; return temp;
} }
public void addActivationSkill(OptionsSkillHolder holder) public void addActivationSkill(OptionSkillHolder holder)
{ {
if (_activationSkills == null) if (_activationSkills == null)
{ {
@@ -189,21 +188,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.addTriggerSkill(holder); player.addTriggerSkill(holder);
} }
@@ -227,21 +226,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
player.removeSkill(holder.getSkill(), false, false); player.removeSkill(skill, false, false);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
player.removeSkill(holder.getSkill(), false, true); player.removeSkill(skill, false, true);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.removeTriggerSkill(holder); player.removeTriggerSkill(holder);
} }
@@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate;
import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.Weapon;
import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.item.type.ActionType; import org.l2jmobius.gameserver.model.item.type.ActionType;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.skill.targets.TargetType;
import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.stats.Formulas;
import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.model.zone.ZoneId;
@@ -602,9 +602,9 @@ public class SkillCaster implements Runnable
if (caster.hasTriggerSkills()) 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); triggerCast(caster, creature, holder.getSkill(), null, false);
} }
@@ -819,15 +819,12 @@
</option> </option>
<option id="31996" name="helios_opt"> <option id="31996" name="helios_opt">
<!-- Passive: Petrification Resistance + 2%. --> <!-- Passive: Petrification Resistance + 2%. -->
<passive_skill id="13765" level="7" />
</option> </option>
<option id="31997" name="helios_opt"> <option id="31997" name="helios_opt">
<!-- Passive: Petrification Resistance + 3%. --> <!-- Passive: Petrification Resistance + 3%. -->
<passive_skill id="13765" level="8" />
</option> </option>
<option id="31998" name="helios_opt"> <option id="31998" name="helios_opt">
<!-- Passive: Petrification Resistance + 4%. --> <!-- Passive: Petrification Resistance + 4%. -->
<passive_skill id="13765" level="9" />
</option> </option>
<option id="31999" name="helios_opt"> <option id="31999" name="helios_opt">
<!-- Stun/Hold Resistance + 6% --> <!-- Stun/Hold Resistance + 6% -->
@@ -28,10 +28,10 @@ import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.handler.EffectHandler;
import org.l2jmobius.gameserver.model.StatSet; 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.Options;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.Skill;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -88,27 +88,77 @@ public class OptionData implements IXmlReader
} }
case "active_skill": 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; break;
} }
case "passive_skill": 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; break;
} }
case "attack_skill": 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; break;
} }
case "magic_skill": 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; break;
} }
case "critical_skill": 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; break;
} }
} }
@@ -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.EtcItemType;
import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.item.type.WeaponType;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory; import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.AbnormalType;
import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffFinishTask;
import org.l2jmobius.gameserver.model.skill.BuffInfo; 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 boolean _lethalable = true;
private Map<Integer, OptionsSkillHolder> _triggerSkills; private Map<Integer, OptionSkillHolder> _triggerSkills;
private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects; private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects;
/** Creatures effect list. */ /** Creatures effect list. */
@@ -3903,9 +3903,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (_triggerSkills != null) 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); 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(); return (_triggerSkills != null) && !_triggerSkills.isEmpty();
} }
public Map<Integer, OptionsSkillHolder> getTriggerSkills() public Map<Integer, OptionSkillHolder> getTriggerSkills()
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
@@ -4942,21 +4942,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
_triggerSkills = new ConcurrentHashMap<>(); _triggerSkills = new ConcurrentHashMap<>(1);
} }
} }
} }
return _triggerSkills; 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());
} }
/** /**
@@ -16,36 +16,41 @@
*/ */
package org.l2jmobius.gameserver.model.options; 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 double _chance;
private final OptionSkillType _type;
/** /**
* @param skillId * @param skill
* @param skillLevel
* @param type * @param type
* @param chance * @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; _chance = chance;
_type = type; _type = type;
} }
public OptionsSkillType getSkillType() public Skill getSkill()
{ {
return _type; return _skill;
} }
public double getChance() public double getChance()
{ {
return _chance; return _chance;
} }
public OptionSkillType getSkillType()
{
return _type;
}
} }
@@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.model.options;
/** /**
* @author UnAfraid * @author UnAfraid
*/ */
public enum OptionsSkillType public enum OptionSkillType
{ {
ATTACK, ATTACK,
MAGIC, MAGIC,
@@ -22,7 +22,6 @@ import java.util.List;
import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.enums.SkillFinishType;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.AbstractEffect; 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.BuffInfo;
import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
@@ -34,9 +33,9 @@ public class Options
{ {
private final int _id; private final int _id;
private List<AbstractEffect> _effects = null; private List<AbstractEffect> _effects = null;
private List<SkillHolder> _activeSkill = null; private List<Skill> _activeSkill = null;
private List<SkillHolder> _passiveSkill = null; private List<Skill> _passiveSkill = null;
private List<OptionsSkillHolder> _activationSkills = null; private List<OptionSkillHolder> _activationSkills = null;
/** /**
* @param id * @param id
@@ -75,12 +74,12 @@ public class Options
return _activeSkill != null; return _activeSkill != null;
} }
public List<SkillHolder> getActiveSkills() public List<Skill> getActiveSkills()
{ {
return _activeSkill; return _activeSkill;
} }
public void addActiveSkill(SkillHolder holder) public void addActiveSkill(Skill holder)
{ {
if (_activeSkill == null) if (_activeSkill == null)
{ {
@@ -94,12 +93,12 @@ public class Options
return _passiveSkill != null; return _passiveSkill != null;
} }
public List<SkillHolder> getPassiveSkills() public List<Skill> getPassiveSkills()
{ {
return _passiveSkill; return _passiveSkill;
} }
public void addPassiveSkill(SkillHolder holder) public void addPassiveSkill(Skill holder)
{ {
if (_passiveSkill == null) if (_passiveSkill == null)
{ {
@@ -113,11 +112,11 @@ public class Options
return _activationSkills != null; return _activationSkills != null;
} }
public boolean hasActivationSkills(OptionsSkillType type) public boolean hasActivationSkills(OptionSkillType type)
{ {
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -128,17 +127,17 @@ public class Options
return false; return false;
} }
public List<OptionsSkillHolder> getActivationsSkills() public List<OptionSkillHolder> getActivationSkills()
{ {
return _activationSkills; return _activationSkills;
} }
public List<OptionsSkillHolder> getActivationsSkills(OptionsSkillType type) public List<OptionSkillHolder> getActivationSkills(OptionSkillType type)
{ {
final List<OptionsSkillHolder> temp = new ArrayList<>(); final List<OptionSkillHolder> temp = new ArrayList<>();
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -149,7 +148,7 @@ public class Options
return temp; return temp;
} }
public void addActivationSkill(OptionsSkillHolder holder) public void addActivationSkill(OptionSkillHolder holder)
{ {
if (_activationSkills == null) if (_activationSkills == null)
{ {
@@ -189,21 +188,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.addTriggerSkill(holder); player.addTriggerSkill(holder);
} }
@@ -227,21 +226,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
player.removeSkill(holder.getSkill(), false, false); player.removeSkill(skill, false, false);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
player.removeSkill(holder.getSkill(), false, true); player.removeSkill(skill, false, true);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.removeTriggerSkill(holder); player.removeTriggerSkill(holder);
} }
@@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate;
import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.Weapon;
import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.item.type.ActionType; import org.l2jmobius.gameserver.model.item.type.ActionType;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.skill.targets.TargetType;
import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.stats.Formulas;
import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.model.zone.ZoneId;
@@ -602,9 +602,9 @@ public class SkillCaster implements Runnable
if (caster.hasTriggerSkills()) 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); triggerCast(caster, creature, holder.getSkill(), null, false);
} }
+1 -1
View File
@@ -251,7 +251,7 @@
<!-- Agathion Charm - Zaken's Spirit Swords --> <!-- Agathion Charm - Zaken's Spirit Swords -->
<agathion id="48135" enchant="0" mainSkill="23236,1" /> <agathion id="48135" enchant="0" mainSkill="23236,1" />
<!-- Training Fairy Agathion Charm - 1-day --> <!-- Training Fairy Agathion Charm - 1-day -->
<agathion id="48268" enchant="0" mainSkill="32195,1;32196,1" /> <agathion id="48268" enchant="0" mainSkill="32196,1" /> <!-- mainSkill="32195,1;32196,1" -->
<!-- Agathion Charm - Guardian of Dawn Kallesin --> <!-- Agathion Charm - Guardian of Dawn Kallesin -->
<agathion id="28763" enchant="0" mainSkill="6918,1" /> <agathion id="28763" enchant="0" mainSkill="6918,1" />
<!-- Agathion Charm - Freya (30-day) --> <!-- Agathion Charm - Freya (30-day) -->
@@ -819,15 +819,12 @@
</option> </option>
<option id="31996" name="helios_opt"> <option id="31996" name="helios_opt">
<!-- Passive: Petrification Resistance + 2%. --> <!-- Passive: Petrification Resistance + 2%. -->
<passive_skill id="13765" level="7" />
</option> </option>
<option id="31997" name="helios_opt"> <option id="31997" name="helios_opt">
<!-- Passive: Petrification Resistance + 3%. --> <!-- Passive: Petrification Resistance + 3%. -->
<passive_skill id="13765" level="8" />
</option> </option>
<option id="31998" name="helios_opt"> <option id="31998" name="helios_opt">
<!-- Passive: Petrification Resistance + 4%. --> <!-- Passive: Petrification Resistance + 4%. -->
<passive_skill id="13765" level="9" />
</option> </option>
<option id="31999" name="helios_opt"> <option id="31999" name="helios_opt">
<!-- Stun/Hold Resistance + 6% --> <!-- Stun/Hold Resistance + 6% -->
@@ -352,66 +352,4 @@
<!-- Bonus EXP obtained in Vitality state +20%. --> <!-- Bonus EXP obtained in Vitality state +20%. -->
<passive_skill id="28020" level="3" /> <passive_skill id="28020" level="3" />
</option> </option>
<option id="40988" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="1" />
<passive_skill id="39224" level="1" />
</option>
<option id="40989" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="2" />
<passive_skill id="39224" level="2" />
</option>
<option id="40990" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="3" />
<passive_skill id="39224" level="3" />
</option>
<option id="40991" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="4" />
<passive_skill id="39224" level="4" />
</option>
<option id="40992" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="5" />
<passive_skill id="39224" level="5" />
<passive_skill id="39225" level="1" />
</option>
<option id="40993" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="6" />
<passive_skill id="39224" level="6" />
<passive_skill id="39225" level="1" />
</option>
<option id="40994" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="7" />
<passive_skill id="39224" level="7" />
<passive_skill id="39225" level="2" />
</option>
<option id="40995" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="8" />
<passive_skill id="39224" level="8" />
<passive_skill id="39225" level="2" />
</option>
<option id="40996" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="9" />
<passive_skill id="39224" level="9" />
<passive_skill id="39225" level="3" />
</option>
<option id="40997" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="10" />
<passive_skill id="39224" level="10" />
<passive_skill id="39225" level="3" />
</option>
<option id="40998" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="11" />
<passive_skill id="39224" level="11" />
<passive_skill id="39225" level="4" />
</option>
</list> </list>
@@ -1,127 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/optionsData.xsd">
<option id="41000" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="1" />
<passive_skill id="39228" level="1" />
</option>
<option id="41001" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="2" />
<passive_skill id="39228" level="2" />
</option>
<option id="41002" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="3" />
<passive_skill id="39228" level="3" />
</option>
<option id="41003" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="4" />
<passive_skill id="39228" level="4" />
</option>
<option id="41004" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="5" />
<passive_skill id="39228" level="5" />
<passive_skill id="39229" level="1" />
</option>
<option id="41005" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="6" />
<passive_skill id="39228" level="6" />
<passive_skill id="39229" level="1" />
</option>
<option id="41006" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="7" />
<passive_skill id="39228" level="7" />
<passive_skill id="39229" level="2" />
</option>
<option id="41007" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="8" />
<passive_skill id="39228" level="8" />
<passive_skill id="39229" level="2" />
</option>
<option id="41008" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="9" />
<passive_skill id="39228" level="9" />
<passive_skill id="39229" level="3" />
</option>
<option id="41009" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="10" />
<passive_skill id="39228" level="10" />
<passive_skill id="39229" level="3" />
</option>
<option id="41010" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="11" />
<passive_skill id="39228" level="11" />
<passive_skill id="39229" level="4" />
</option>
<option id="41011" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="1" />
<passive_skill id="39332" level="1" />
</option>
<option id="41012" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="2" />
<passive_skill id="39332" level="2" />
</option>
<option id="41013" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="3" />
<passive_skill id="39332" level="3" />
</option>
<option id="41014" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="4" />
<passive_skill id="39332" level="4" />
</option>
<option id="41015" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="5" />
<passive_skill id="39332" level="5" />
<passive_skill id="39333" level="1" />
</option>
<option id="41016" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="6" />
<passive_skill id="39332" level="6" />
<passive_skill id="39333" level="1" />
</option>
<option id="41017" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="7" />
<passive_skill id="39332" level="7" />
<passive_skill id="39333" level="2" />
</option>
<option id="41018" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="8" />
<passive_skill id="39332" level="8" />
<passive_skill id="39333" level="2" />
</option>
<option id="41019" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="9" />
<passive_skill id="39332" level="9" />
<passive_skill id="39333" level="3" />
</option>
<option id="41020" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="10" />
<passive_skill id="39332" level="10" />
<passive_skill id="39333" level="3" />
</option>
<option id="41021" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="11" />
<passive_skill id="39332" level="11" />
<passive_skill id="39333" level="4" />
</option>
</list>
@@ -28,10 +28,10 @@ import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.handler.EffectHandler;
import org.l2jmobius.gameserver.model.StatSet; 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.Options;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.Skill;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -88,27 +88,77 @@ public class OptionData implements IXmlReader
} }
case "active_skill": 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; break;
} }
case "passive_skill": 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; break;
} }
case "attack_skill": 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; break;
} }
case "magic_skill": 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; break;
} }
case "critical_skill": 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; break;
} }
} }
@@ -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.EtcItemType;
import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.item.type.WeaponType;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory; import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.AbnormalType;
import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffFinishTask;
import org.l2jmobius.gameserver.model.skill.BuffInfo; 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 boolean _lethalable = true;
private Map<Integer, OptionsSkillHolder> _triggerSkills; private Map<Integer, OptionSkillHolder> _triggerSkills;
private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects; private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects;
/** Creatures effect list. */ /** Creatures effect list. */
@@ -3903,9 +3903,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (_triggerSkills != null) 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); 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(); return (_triggerSkills != null) && !_triggerSkills.isEmpty();
} }
public Map<Integer, OptionsSkillHolder> getTriggerSkills() public Map<Integer, OptionSkillHolder> getTriggerSkills()
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
@@ -4951,21 +4951,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
_triggerSkills = new ConcurrentHashMap<>(); _triggerSkills = new ConcurrentHashMap<>(1);
} }
} }
} }
return _triggerSkills; 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());
} }
/** /**
@@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}
@@ -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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.options;
/**
* @author UnAfraid
*/
public enum OptionSkillType
{
ATTACK,
MAGIC,
CRITICAL
}
@@ -22,7 +22,6 @@ import java.util.List;
import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.enums.SkillFinishType;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.AbstractEffect; 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.BuffInfo;
import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
@@ -34,9 +33,9 @@ public class Options
{ {
private final int _id; private final int _id;
private List<AbstractEffect> _effects = null; private List<AbstractEffect> _effects = null;
private List<SkillHolder> _activeSkill = null; private List<Skill> _activeSkill = null;
private List<SkillHolder> _passiveSkill = null; private List<Skill> _passiveSkill = null;
private List<OptionsSkillHolder> _activationSkills = null; private List<OptionSkillHolder> _activationSkills = null;
/** /**
* @param id * @param id
@@ -75,12 +74,12 @@ public class Options
return _activeSkill != null; return _activeSkill != null;
} }
public List<SkillHolder> getActiveSkills() public List<Skill> getActiveSkills()
{ {
return _activeSkill; return _activeSkill;
} }
public void addActiveSkill(SkillHolder holder) public void addActiveSkill(Skill holder)
{ {
if (_activeSkill == null) if (_activeSkill == null)
{ {
@@ -94,12 +93,12 @@ public class Options
return _passiveSkill != null; return _passiveSkill != null;
} }
public List<SkillHolder> getPassiveSkills() public List<Skill> getPassiveSkills()
{ {
return _passiveSkill; return _passiveSkill;
} }
public void addPassiveSkill(SkillHolder holder) public void addPassiveSkill(Skill holder)
{ {
if (_passiveSkill == null) if (_passiveSkill == null)
{ {
@@ -113,11 +112,11 @@ public class Options
return _activationSkills != null; return _activationSkills != null;
} }
public boolean hasActivationSkills(OptionsSkillType type) public boolean hasActivationSkills(OptionSkillType type)
{ {
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -128,17 +127,17 @@ public class Options
return false; return false;
} }
public List<OptionsSkillHolder> getActivationsSkills() public List<OptionSkillHolder> getActivationSkills()
{ {
return _activationSkills; return _activationSkills;
} }
public List<OptionsSkillHolder> getActivationsSkills(OptionsSkillType type) public List<OptionSkillHolder> getActivationSkills(OptionSkillType type)
{ {
final List<OptionsSkillHolder> temp = new ArrayList<>(); final List<OptionSkillHolder> temp = new ArrayList<>();
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -149,7 +148,7 @@ public class Options
return temp; return temp;
} }
public void addActivationSkill(OptionsSkillHolder holder) public void addActivationSkill(OptionSkillHolder holder)
{ {
if (_activationSkills == null) if (_activationSkills == null)
{ {
@@ -189,21 +188,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.addTriggerSkill(holder); player.addTriggerSkill(holder);
} }
@@ -227,21 +226,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
player.removeSkill(holder.getSkill(), false, false); player.removeSkill(skill, false, false);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
player.removeSkill(holder.getSkill(), false, true); player.removeSkill(skill, false, true);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.removeTriggerSkill(holder); player.removeTriggerSkill(holder);
} }
@@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}
@@ -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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.options;
/**
* @author UnAfraid
*/
public enum OptionsSkillType
{
ATTACK,
MAGIC,
CRITICAL
}
@@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate;
import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.Weapon;
import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.item.type.ActionType; import org.l2jmobius.gameserver.model.item.type.ActionType;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.skill.targets.TargetType;
import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.stats.Formulas;
import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.model.zone.ZoneId;
@@ -602,9 +602,9 @@ public class SkillCaster implements Runnable
if (caster.hasTriggerSkills()) 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); triggerCast(caster, creature, holder.getSkill(), null, false);
} }
@@ -819,15 +819,12 @@
</option> </option>
<option id="31996" name="helios_opt"> <option id="31996" name="helios_opt">
<!-- Passive: Petrification Resistance + 2%. --> <!-- Passive: Petrification Resistance + 2%. -->
<passive_skill id="13765" level="7" />
</option> </option>
<option id="31997" name="helios_opt"> <option id="31997" name="helios_opt">
<!-- Passive: Petrification Resistance + 3%. --> <!-- Passive: Petrification Resistance + 3%. -->
<passive_skill id="13765" level="8" />
</option> </option>
<option id="31998" name="helios_opt"> <option id="31998" name="helios_opt">
<!-- Passive: Petrification Resistance + 4%. --> <!-- Passive: Petrification Resistance + 4%. -->
<passive_skill id="13765" level="9" />
</option> </option>
<option id="31999" name="helios_opt"> <option id="31999" name="helios_opt">
<!-- Stun/Hold Resistance + 6% --> <!-- Stun/Hold Resistance + 6% -->
@@ -352,66 +352,4 @@
<!-- Bonus EXP obtained in Vitality state +20%. --> <!-- Bonus EXP obtained in Vitality state +20%. -->
<passive_skill id="28020" level="3" /> <passive_skill id="28020" level="3" />
</option> </option>
<option id="40988" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="1" />
<passive_skill id="39224" level="1" />
</option>
<option id="40989" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="2" />
<passive_skill id="39224" level="2" />
</option>
<option id="40990" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="3" />
<passive_skill id="39224" level="3" />
</option>
<option id="40991" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="4" />
<passive_skill id="39224" level="4" />
</option>
<option id="40992" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="5" />
<passive_skill id="39224" level="5" />
<passive_skill id="39225" level="1" />
</option>
<option id="40993" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="6" />
<passive_skill id="39224" level="6" />
<passive_skill id="39225" level="1" />
</option>
<option id="40994" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="7" />
<passive_skill id="39224" level="7" />
<passive_skill id="39225" level="2" />
</option>
<option id="40995" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="8" />
<passive_skill id="39224" level="8" />
<passive_skill id="39225" level="2" />
</option>
<option id="40996" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="9" />
<passive_skill id="39224" level="9" />
<passive_skill id="39225" level="3" />
</option>
<option id="40997" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="10" />
<passive_skill id="39224" level="10" />
<passive_skill id="39225" level="3" />
</option>
<option id="40998" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="11" />
<passive_skill id="39224" level="11" />
<passive_skill id="39225" level="4" />
</option>
</list> </list>
@@ -1,127 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/optionsData.xsd">
<option id="41000" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="1" />
<passive_skill id="39228" level="1" />
</option>
<option id="41001" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="2" />
<passive_skill id="39228" level="2" />
</option>
<option id="41002" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="3" />
<passive_skill id="39228" level="3" />
</option>
<option id="41003" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="4" />
<passive_skill id="39228" level="4" />
</option>
<option id="41004" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="5" />
<passive_skill id="39228" level="5" />
<passive_skill id="39229" level="1" />
</option>
<option id="41005" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="6" />
<passive_skill id="39228" level="6" />
<passive_skill id="39229" level="1" />
</option>
<option id="41006" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="7" />
<passive_skill id="39228" level="7" />
<passive_skill id="39229" level="2" />
</option>
<option id="41007" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="8" />
<passive_skill id="39228" level="8" />
<passive_skill id="39229" level="2" />
</option>
<option id="41008" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="9" />
<passive_skill id="39228" level="9" />
<passive_skill id="39229" level="3" />
</option>
<option id="41009" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="10" />
<passive_skill id="39228" level="10" />
<passive_skill id="39229" level="3" />
</option>
<option id="41010" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="11" />
<passive_skill id="39228" level="11" />
<passive_skill id="39229" level="4" />
</option>
<option id="41011" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="1" />
<passive_skill id="39332" level="1" />
</option>
<option id="41012" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="2" />
<passive_skill id="39332" level="2" />
</option>
<option id="41013" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="3" />
<passive_skill id="39332" level="3" />
</option>
<option id="41014" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="4" />
<passive_skill id="39332" level="4" />
</option>
<option id="41015" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="5" />
<passive_skill id="39332" level="5" />
<passive_skill id="39333" level="1" />
</option>
<option id="41016" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="6" />
<passive_skill id="39332" level="6" />
<passive_skill id="39333" level="1" />
</option>
<option id="41017" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="7" />
<passive_skill id="39332" level="7" />
<passive_skill id="39333" level="2" />
</option>
<option id="41018" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="8" />
<passive_skill id="39332" level="8" />
<passive_skill id="39333" level="2" />
</option>
<option id="41019" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="9" />
<passive_skill id="39332" level="9" />
<passive_skill id="39333" level="3" />
</option>
<option id="41020" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="10" />
<passive_skill id="39332" level="10" />
<passive_skill id="39333" level="3" />
</option>
<option id="41021" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="11" />
<passive_skill id="39332" level="11" />
<passive_skill id="39333" level="4" />
</option>
</list>
@@ -28,10 +28,10 @@ import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.handler.EffectHandler;
import org.l2jmobius.gameserver.model.StatSet; 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.Options;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.Skill;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -88,27 +88,77 @@ public class OptionData implements IXmlReader
} }
case "active_skill": 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; break;
} }
case "passive_skill": 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; break;
} }
case "attack_skill": 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; break;
} }
case "magic_skill": 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; break;
} }
case "critical_skill": 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; break;
} }
} }
@@ -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.EtcItemType;
import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.item.type.WeaponType;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory; import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.AbnormalType;
import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffFinishTask;
import org.l2jmobius.gameserver.model.skill.BuffInfo; 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 boolean _lethalable = true;
private Map<Integer, OptionsSkillHolder> _triggerSkills; private Map<Integer, OptionSkillHolder> _triggerSkills;
private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects; private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects;
/** Creatures effect list. */ /** Creatures effect list. */
@@ -3903,9 +3903,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (_triggerSkills != null) 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); 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(); return (_triggerSkills != null) && !_triggerSkills.isEmpty();
} }
public Map<Integer, OptionsSkillHolder> getTriggerSkills() public Map<Integer, OptionSkillHolder> getTriggerSkills()
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
@@ -4951,21 +4951,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
_triggerSkills = new ConcurrentHashMap<>(); _triggerSkills = new ConcurrentHashMap<>(1);
} }
} }
} }
return _triggerSkills; 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());
} }
/** /**
@@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}
@@ -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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.options;
/**
* @author UnAfraid
*/
public enum OptionSkillType
{
ATTACK,
MAGIC,
CRITICAL
}
@@ -22,7 +22,6 @@ import java.util.List;
import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.enums.SkillFinishType;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.AbstractEffect; 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.BuffInfo;
import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
@@ -34,9 +33,9 @@ public class Options
{ {
private final int _id; private final int _id;
private List<AbstractEffect> _effects = null; private List<AbstractEffect> _effects = null;
private List<SkillHolder> _activeSkill = null; private List<Skill> _activeSkill = null;
private List<SkillHolder> _passiveSkill = null; private List<Skill> _passiveSkill = null;
private List<OptionsSkillHolder> _activationSkills = null; private List<OptionSkillHolder> _activationSkills = null;
/** /**
* @param id * @param id
@@ -75,12 +74,12 @@ public class Options
return _activeSkill != null; return _activeSkill != null;
} }
public List<SkillHolder> getActiveSkills() public List<Skill> getActiveSkills()
{ {
return _activeSkill; return _activeSkill;
} }
public void addActiveSkill(SkillHolder holder) public void addActiveSkill(Skill holder)
{ {
if (_activeSkill == null) if (_activeSkill == null)
{ {
@@ -94,12 +93,12 @@ public class Options
return _passiveSkill != null; return _passiveSkill != null;
} }
public List<SkillHolder> getPassiveSkills() public List<Skill> getPassiveSkills()
{ {
return _passiveSkill; return _passiveSkill;
} }
public void addPassiveSkill(SkillHolder holder) public void addPassiveSkill(Skill holder)
{ {
if (_passiveSkill == null) if (_passiveSkill == null)
{ {
@@ -113,11 +112,11 @@ public class Options
return _activationSkills != null; return _activationSkills != null;
} }
public boolean hasActivationSkills(OptionsSkillType type) public boolean hasActivationSkills(OptionSkillType type)
{ {
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -128,17 +127,17 @@ public class Options
return false; return false;
} }
public List<OptionsSkillHolder> getActivationsSkills() public List<OptionSkillHolder> getActivationSkills()
{ {
return _activationSkills; return _activationSkills;
} }
public List<OptionsSkillHolder> getActivationsSkills(OptionsSkillType type) public List<OptionSkillHolder> getActivationSkills(OptionSkillType type)
{ {
final List<OptionsSkillHolder> temp = new ArrayList<>(); final List<OptionSkillHolder> temp = new ArrayList<>();
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -149,7 +148,7 @@ public class Options
return temp; return temp;
} }
public void addActivationSkill(OptionsSkillHolder holder) public void addActivationSkill(OptionSkillHolder holder)
{ {
if (_activationSkills == null) if (_activationSkills == null)
{ {
@@ -189,21 +188,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.addTriggerSkill(holder); player.addTriggerSkill(holder);
} }
@@ -227,21 +226,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
player.removeSkill(holder.getSkill(), false, false); player.removeSkill(skill, false, false);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
player.removeSkill(holder.getSkill(), false, true); player.removeSkill(skill, false, true);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.removeTriggerSkill(holder); player.removeTriggerSkill(holder);
} }
@@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}
@@ -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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.options;
/**
* @author UnAfraid
*/
public enum OptionsSkillType
{
ATTACK,
MAGIC,
CRITICAL
}
@@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate;
import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.Weapon;
import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.item.type.ActionType; import org.l2jmobius.gameserver.model.item.type.ActionType;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.skill.targets.TargetType;
import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.stats.Formulas;
import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.model.zone.ZoneId;
@@ -602,9 +602,9 @@ public class SkillCaster implements Runnable
if (caster.hasTriggerSkills()) 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); triggerCast(caster, creature, holder.getSkill(), null, false);
} }
@@ -819,15 +819,12 @@
</option> </option>
<option id="31996" name="helios_opt"> <option id="31996" name="helios_opt">
<!-- Passive: Petrification Resistance + 2%. --> <!-- Passive: Petrification Resistance + 2%. -->
<passive_skill id="13765" level="7" />
</option> </option>
<option id="31997" name="helios_opt"> <option id="31997" name="helios_opt">
<!-- Passive: Petrification Resistance + 3%. --> <!-- Passive: Petrification Resistance + 3%. -->
<passive_skill id="13765" level="8" />
</option> </option>
<option id="31998" name="helios_opt"> <option id="31998" name="helios_opt">
<!-- Passive: Petrification Resistance + 4%. --> <!-- Passive: Petrification Resistance + 4%. -->
<passive_skill id="13765" level="9" />
</option> </option>
<option id="31999" name="helios_opt"> <option id="31999" name="helios_opt">
<!-- Stun/Hold Resistance + 6% --> <!-- Stun/Hold Resistance + 6% -->
@@ -352,66 +352,4 @@
<!-- Bonus EXP obtained in Vitality state +20%. --> <!-- Bonus EXP obtained in Vitality state +20%. -->
<passive_skill id="28020" level="3" /> <passive_skill id="28020" level="3" />
</option> </option>
<option id="40988" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="1" />
<passive_skill id="39224" level="1" />
</option>
<option id="40989" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="2" />
<passive_skill id="39224" level="2" />
</option>
<option id="40990" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="3" />
<passive_skill id="39224" level="3" />
</option>
<option id="40991" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="4" />
<passive_skill id="39224" level="4" />
</option>
<option id="40992" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="5" />
<passive_skill id="39224" level="5" />
<passive_skill id="39225" level="1" />
</option>
<option id="40993" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="6" />
<passive_skill id="39224" level="6" />
<passive_skill id="39225" level="1" />
</option>
<option id="40994" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="7" />
<passive_skill id="39224" level="7" />
<passive_skill id="39225" level="2" />
</option>
<option id="40995" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="8" />
<passive_skill id="39224" level="8" />
<passive_skill id="39225" level="2" />
</option>
<option id="40996" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="9" />
<passive_skill id="39224" level="9" />
<passive_skill id="39225" level="3" />
</option>
<option id="40997" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="10" />
<passive_skill id="39224" level="10" />
<passive_skill id="39225" level="3" />
</option>
<option id="40998" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="11" />
<passive_skill id="39224" level="11" />
<passive_skill id="39225" level="4" />
</option>
</list> </list>
@@ -1,127 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/optionsData.xsd">
<option id="41000" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="1" />
<passive_skill id="39228" level="1" />
</option>
<option id="41001" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="2" />
<passive_skill id="39228" level="2" />
</option>
<option id="41002" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="3" />
<passive_skill id="39228" level="3" />
</option>
<option id="41003" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="4" />
<passive_skill id="39228" level="4" />
</option>
<option id="41004" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="5" />
<passive_skill id="39228" level="5" />
<passive_skill id="39229" level="1" />
</option>
<option id="41005" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="6" />
<passive_skill id="39228" level="6" />
<passive_skill id="39229" level="1" />
</option>
<option id="41006" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="7" />
<passive_skill id="39228" level="7" />
<passive_skill id="39229" level="2" />
</option>
<option id="41007" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="8" />
<passive_skill id="39228" level="8" />
<passive_skill id="39229" level="2" />
</option>
<option id="41008" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="9" />
<passive_skill id="39228" level="9" />
<passive_skill id="39229" level="3" />
</option>
<option id="41009" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="10" />
<passive_skill id="39228" level="10" />
<passive_skill id="39229" level="3" />
</option>
<option id="41010" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="11" />
<passive_skill id="39228" level="11" />
<passive_skill id="39229" level="4" />
</option>
<option id="41011" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="1" />
<passive_skill id="39332" level="1" />
</option>
<option id="41012" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="2" />
<passive_skill id="39332" level="2" />
</option>
<option id="41013" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="3" />
<passive_skill id="39332" level="3" />
</option>
<option id="41014" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="4" />
<passive_skill id="39332" level="4" />
</option>
<option id="41015" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="5" />
<passive_skill id="39332" level="5" />
<passive_skill id="39333" level="1" />
</option>
<option id="41016" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="6" />
<passive_skill id="39332" level="6" />
<passive_skill id="39333" level="1" />
</option>
<option id="41017" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="7" />
<passive_skill id="39332" level="7" />
<passive_skill id="39333" level="2" />
</option>
<option id="41018" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="8" />
<passive_skill id="39332" level="8" />
<passive_skill id="39333" level="2" />
</option>
<option id="41019" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="9" />
<passive_skill id="39332" level="9" />
<passive_skill id="39333" level="3" />
</option>
<option id="41020" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="10" />
<passive_skill id="39332" level="10" />
<passive_skill id="39333" level="3" />
</option>
<option id="41021" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="11" />
<passive_skill id="39332" level="11" />
<passive_skill id="39333" level="4" />
</option>
</list>
@@ -28,10 +28,10 @@ import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.handler.EffectHandler;
import org.l2jmobius.gameserver.model.StatSet; 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.Options;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.Skill;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -88,27 +88,77 @@ public class OptionData implements IXmlReader
} }
case "active_skill": 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; break;
} }
case "passive_skill": 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; break;
} }
case "attack_skill": 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; break;
} }
case "magic_skill": 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; break;
} }
case "critical_skill": 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; break;
} }
} }
@@ -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.EtcItemType;
import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.item.type.WeaponType;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory; import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.AbnormalType;
import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffFinishTask;
import org.l2jmobius.gameserver.model.skill.BuffInfo; 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 boolean _lethalable = true;
private Map<Integer, OptionsSkillHolder> _triggerSkills; private Map<Integer, OptionSkillHolder> _triggerSkills;
private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects; private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects;
/** Creatures effect list. */ /** Creatures effect list. */
@@ -3903,9 +3903,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (_triggerSkills != null) 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); 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(); return (_triggerSkills != null) && !_triggerSkills.isEmpty();
} }
public Map<Integer, OptionsSkillHolder> getTriggerSkills() public Map<Integer, OptionSkillHolder> getTriggerSkills()
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
@@ -4951,21 +4951,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
_triggerSkills = new ConcurrentHashMap<>(); _triggerSkills = new ConcurrentHashMap<>(1);
} }
} }
} }
return _triggerSkills; 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());
} }
/** /**
@@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}
@@ -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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.options;
/**
* @author UnAfraid
*/
public enum OptionSkillType
{
ATTACK,
MAGIC,
CRITICAL
}
@@ -22,7 +22,6 @@ import java.util.List;
import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.enums.SkillFinishType;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.AbstractEffect; 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.BuffInfo;
import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
@@ -34,9 +33,9 @@ public class Options
{ {
private final int _id; private final int _id;
private List<AbstractEffect> _effects = null; private List<AbstractEffect> _effects = null;
private List<SkillHolder> _activeSkill = null; private List<Skill> _activeSkill = null;
private List<SkillHolder> _passiveSkill = null; private List<Skill> _passiveSkill = null;
private List<OptionsSkillHolder> _activationSkills = null; private List<OptionSkillHolder> _activationSkills = null;
/** /**
* @param id * @param id
@@ -75,12 +74,12 @@ public class Options
return _activeSkill != null; return _activeSkill != null;
} }
public List<SkillHolder> getActiveSkills() public List<Skill> getActiveSkills()
{ {
return _activeSkill; return _activeSkill;
} }
public void addActiveSkill(SkillHolder holder) public void addActiveSkill(Skill holder)
{ {
if (_activeSkill == null) if (_activeSkill == null)
{ {
@@ -94,12 +93,12 @@ public class Options
return _passiveSkill != null; return _passiveSkill != null;
} }
public List<SkillHolder> getPassiveSkills() public List<Skill> getPassiveSkills()
{ {
return _passiveSkill; return _passiveSkill;
} }
public void addPassiveSkill(SkillHolder holder) public void addPassiveSkill(Skill holder)
{ {
if (_passiveSkill == null) if (_passiveSkill == null)
{ {
@@ -113,11 +112,11 @@ public class Options
return _activationSkills != null; return _activationSkills != null;
} }
public boolean hasActivationSkills(OptionsSkillType type) public boolean hasActivationSkills(OptionSkillType type)
{ {
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -128,17 +127,17 @@ public class Options
return false; return false;
} }
public List<OptionsSkillHolder> getActivationsSkills() public List<OptionSkillHolder> getActivationSkills()
{ {
return _activationSkills; return _activationSkills;
} }
public List<OptionsSkillHolder> getActivationsSkills(OptionsSkillType type) public List<OptionSkillHolder> getActivationSkills(OptionSkillType type)
{ {
final List<OptionsSkillHolder> temp = new ArrayList<>(); final List<OptionSkillHolder> temp = new ArrayList<>();
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -149,7 +148,7 @@ public class Options
return temp; return temp;
} }
public void addActivationSkill(OptionsSkillHolder holder) public void addActivationSkill(OptionSkillHolder holder)
{ {
if (_activationSkills == null) if (_activationSkills == null)
{ {
@@ -189,21 +188,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.addTriggerSkill(holder); player.addTriggerSkill(holder);
} }
@@ -227,21 +226,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
player.removeSkill(holder.getSkill(), false, false); player.removeSkill(skill, false, false);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
player.removeSkill(holder.getSkill(), false, true); player.removeSkill(skill, false, true);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.removeTriggerSkill(holder); player.removeTriggerSkill(holder);
} }
@@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}
@@ -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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.options;
/**
* @author UnAfraid
*/
public enum OptionsSkillType
{
ATTACK,
MAGIC,
CRITICAL
}
@@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate;
import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.Weapon;
import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.item.type.ActionType; import org.l2jmobius.gameserver.model.item.type.ActionType;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.skill.targets.TargetType;
import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.stats.Formulas;
import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.model.zone.ZoneId;
@@ -602,9 +602,9 @@ public class SkillCaster implements Runnable
if (caster.hasTriggerSkills()) 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); triggerCast(caster, creature, holder.getSkill(), null, false);
} }
@@ -819,15 +819,12 @@
</option> </option>
<option id="31996" name="helios_opt"> <option id="31996" name="helios_opt">
<!-- Passive: Petrification Resistance + 2%. --> <!-- Passive: Petrification Resistance + 2%. -->
<passive_skill id="13765" level="7" />
</option> </option>
<option id="31997" name="helios_opt"> <option id="31997" name="helios_opt">
<!-- Passive: Petrification Resistance + 3%. --> <!-- Passive: Petrification Resistance + 3%. -->
<passive_skill id="13765" level="8" />
</option> </option>
<option id="31998" name="helios_opt"> <option id="31998" name="helios_opt">
<!-- Passive: Petrification Resistance + 4%. --> <!-- Passive: Petrification Resistance + 4%. -->
<passive_skill id="13765" level="9" />
</option> </option>
<option id="31999" name="helios_opt"> <option id="31999" name="helios_opt">
<!-- Stun/Hold Resistance + 6% --> <!-- Stun/Hold Resistance + 6% -->
@@ -352,66 +352,4 @@
<!-- Bonus EXP obtained in Vitality state +20%. --> <!-- Bonus EXP obtained in Vitality state +20%. -->
<passive_skill id="28020" level="3" /> <passive_skill id="28020" level="3" />
</option> </option>
<option id="40988" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="1" />
<passive_skill id="39224" level="1" />
</option>
<option id="40989" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="2" />
<passive_skill id="39224" level="2" />
</option>
<option id="40990" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="3" />
<passive_skill id="39224" level="3" />
</option>
<option id="40991" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="4" />
<passive_skill id="39224" level="4" />
</option>
<option id="40992" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="5" />
<passive_skill id="39224" level="5" />
<passive_skill id="39225" level="1" />
</option>
<option id="40993" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="6" />
<passive_skill id="39224" level="6" />
<passive_skill id="39225" level="1" />
</option>
<option id="40994" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="7" />
<passive_skill id="39224" level="7" />
<passive_skill id="39225" level="2" />
</option>
<option id="40995" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="8" />
<passive_skill id="39224" level="8" />
<passive_skill id="39225" level="2" />
</option>
<option id="40996" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="9" />
<passive_skill id="39224" level="9" />
<passive_skill id="39225" level="3" />
</option>
<option id="40997" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="10" />
<passive_skill id="39224" level="10" />
<passive_skill id="39225" level="3" />
</option>
<option id="40998" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39223" level="11" />
<passive_skill id="39224" level="11" />
<passive_skill id="39225" level="4" />
</option>
</list> </list>
@@ -1,127 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/optionsData.xsd">
<option id="41000" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="1" />
<passive_skill id="39228" level="1" />
</option>
<option id="41001" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="2" />
<passive_skill id="39228" level="2" />
</option>
<option id="41002" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="3" />
<passive_skill id="39228" level="3" />
</option>
<option id="41003" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="4" />
<passive_skill id="39228" level="4" />
</option>
<option id="41004" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="5" />
<passive_skill id="39228" level="5" />
<passive_skill id="39229" level="1" />
</option>
<option id="41005" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="6" />
<passive_skill id="39228" level="6" />
<passive_skill id="39229" level="1" />
</option>
<option id="41006" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="7" />
<passive_skill id="39228" level="7" />
<passive_skill id="39229" level="2" />
</option>
<option id="41007" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="8" />
<passive_skill id="39228" level="8" />
<passive_skill id="39229" level="2" />
</option>
<option id="41008" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="9" />
<passive_skill id="39228" level="9" />
<passive_skill id="39229" level="3" />
</option>
<option id="41009" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="10" />
<passive_skill id="39228" level="10" />
<passive_skill id="39229" level="3" />
</option>
<option id="41010" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39227" level="11" />
<passive_skill id="39228" level="11" />
<passive_skill id="39229" level="4" />
</option>
<option id="41011" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="1" />
<passive_skill id="39332" level="1" />
</option>
<option id="41012" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="2" />
<passive_skill id="39332" level="2" />
</option>
<option id="41013" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="3" />
<passive_skill id="39332" level="3" />
</option>
<option id="41014" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="4" />
<passive_skill id="39332" level="4" />
</option>
<option id="41015" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="5" />
<passive_skill id="39332" level="5" />
<passive_skill id="39333" level="1" />
</option>
<option id="41016" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="6" />
<passive_skill id="39332" level="6" />
<passive_skill id="39333" level="1" />
</option>
<option id="41017" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="7" />
<passive_skill id="39332" level="7" />
<passive_skill id="39333" level="2" />
</option>
<option id="41018" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="8" />
<passive_skill id="39332" level="8" />
<passive_skill id="39333" level="2" />
</option>
<option id="41019" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="9" />
<passive_skill id="39332" level="9" />
<passive_skill id="39333" level="3" />
</option>
<option id="41020" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="10" />
<passive_skill id="39332" level="10" />
<passive_skill id="39333" level="3" />
</option>
<option id="41021" name="guard_agathion">
<!-- Custom use for Guard Agathions -->
<passive_skill id="39331" level="11" />
<passive_skill id="39332" level="11" />
<passive_skill id="39333" level="4" />
</option>
</list>
@@ -28,10 +28,10 @@ import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.handler.EffectHandler;
import org.l2jmobius.gameserver.model.StatSet; 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.Options;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.Skill;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -88,27 +88,77 @@ public class OptionData implements IXmlReader
} }
case "active_skill": 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; break;
} }
case "passive_skill": 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; break;
} }
case "attack_skill": 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; break;
} }
case "magic_skill": 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; break;
} }
case "critical_skill": 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; break;
} }
} }
@@ -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.EtcItemType;
import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.item.type.WeaponType;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory; import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.AbnormalType;
import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffFinishTask;
import org.l2jmobius.gameserver.model.skill.BuffInfo; 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 boolean _lethalable = true;
private Map<Integer, OptionsSkillHolder> _triggerSkills; private Map<Integer, OptionSkillHolder> _triggerSkills;
private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects; private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects;
/** Creatures effect list. */ /** Creatures effect list. */
@@ -3902,9 +3902,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (_triggerSkills != null) 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); 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(); return (_triggerSkills != null) && !_triggerSkills.isEmpty();
} }
public Map<Integer, OptionsSkillHolder> getTriggerSkills() public Map<Integer, OptionSkillHolder> getTriggerSkills()
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
@@ -4950,21 +4950,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
_triggerSkills = new ConcurrentHashMap<>(); _triggerSkills = new ConcurrentHashMap<>(1);
} }
} }
} }
return _triggerSkills; 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());
} }
/** /**
@@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}
@@ -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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.options;
/**
* @author UnAfraid
*/
public enum OptionSkillType
{
ATTACK,
MAGIC,
CRITICAL
}
@@ -22,7 +22,6 @@ import java.util.List;
import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.enums.SkillFinishType;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.AbstractEffect; 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.BuffInfo;
import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
@@ -34,9 +33,9 @@ public class Options
{ {
private final int _id; private final int _id;
private List<AbstractEffect> _effects = null; private List<AbstractEffect> _effects = null;
private List<SkillHolder> _activeSkill = null; private List<Skill> _activeSkill = null;
private List<SkillHolder> _passiveSkill = null; private List<Skill> _passiveSkill = null;
private List<OptionsSkillHolder> _activationSkills = null; private List<OptionSkillHolder> _activationSkills = null;
/** /**
* @param id * @param id
@@ -75,12 +74,12 @@ public class Options
return _activeSkill != null; return _activeSkill != null;
} }
public List<SkillHolder> getActiveSkills() public List<Skill> getActiveSkills()
{ {
return _activeSkill; return _activeSkill;
} }
public void addActiveSkill(SkillHolder holder) public void addActiveSkill(Skill holder)
{ {
if (_activeSkill == null) if (_activeSkill == null)
{ {
@@ -94,12 +93,12 @@ public class Options
return _passiveSkill != null; return _passiveSkill != null;
} }
public List<SkillHolder> getPassiveSkills() public List<Skill> getPassiveSkills()
{ {
return _passiveSkill; return _passiveSkill;
} }
public void addPassiveSkill(SkillHolder holder) public void addPassiveSkill(Skill holder)
{ {
if (_passiveSkill == null) if (_passiveSkill == null)
{ {
@@ -113,11 +112,11 @@ public class Options
return _activationSkills != null; return _activationSkills != null;
} }
public boolean hasActivationSkills(OptionsSkillType type) public boolean hasActivationSkills(OptionSkillType type)
{ {
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -128,17 +127,17 @@ public class Options
return false; return false;
} }
public List<OptionsSkillHolder> getActivationsSkills() public List<OptionSkillHolder> getActivationSkills()
{ {
return _activationSkills; return _activationSkills;
} }
public List<OptionsSkillHolder> getActivationsSkills(OptionsSkillType type) public List<OptionSkillHolder> getActivationSkills(OptionSkillType type)
{ {
final List<OptionsSkillHolder> temp = new ArrayList<>(); final List<OptionSkillHolder> temp = new ArrayList<>();
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -149,7 +148,7 @@ public class Options
return temp; return temp;
} }
public void addActivationSkill(OptionsSkillHolder holder) public void addActivationSkill(OptionSkillHolder holder)
{ {
if (_activationSkills == null) if (_activationSkills == null)
{ {
@@ -189,21 +188,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.addTriggerSkill(holder); player.addTriggerSkill(holder);
} }
@@ -227,21 +226,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
player.removeSkill(holder.getSkill(), false, false); player.removeSkill(skill, false, false);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
player.removeSkill(holder.getSkill(), false, true); player.removeSkill(skill, false, true);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.removeTriggerSkill(holder); player.removeTriggerSkill(holder);
} }
@@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}
@@ -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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.options;
/**
* @author UnAfraid
*/
public enum OptionsSkillType
{
ATTACK,
MAGIC,
CRITICAL
}
@@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate;
import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.Weapon;
import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.item.type.ActionType; import org.l2jmobius.gameserver.model.item.type.ActionType;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.skill.targets.TargetType;
import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.stats.Formulas;
import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.model.zone.ZoneId;
@@ -602,9 +602,9 @@ public class SkillCaster implements Runnable
if (caster.hasTriggerSkills()) 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); triggerCast(caster, creature, holder.getSkill(), null, false);
} }
@@ -819,15 +819,12 @@
</option> </option>
<option id="31996" name="helios_opt"> <option id="31996" name="helios_opt">
<!-- Passive: Petrification Resistance + 2%. --> <!-- Passive: Petrification Resistance + 2%. -->
<passive_skill id="13765" level="7" />
</option> </option>
<option id="31997" name="helios_opt"> <option id="31997" name="helios_opt">
<!-- Passive: Petrification Resistance + 3%. --> <!-- Passive: Petrification Resistance + 3%. -->
<passive_skill id="13765" level="8" />
</option> </option>
<option id="31998" name="helios_opt"> <option id="31998" name="helios_opt">
<!-- Passive: Petrification Resistance + 4%. --> <!-- Passive: Petrification Resistance + 4%. -->
<passive_skill id="13765" level="9" />
</option> </option>
<option id="31999" name="helios_opt"> <option id="31999" name="helios_opt">
<!-- Stun/Hold Resistance + 6% --> <!-- Stun/Hold Resistance + 6% -->
@@ -28,10 +28,10 @@ import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.handler.EffectHandler;
import org.l2jmobius.gameserver.model.StatSet; 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.Options;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.Skill;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -88,27 +88,77 @@ public class OptionData implements IXmlReader
} }
case "active_skill": 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; break;
} }
case "passive_skill": 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; break;
} }
case "attack_skill": 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; break;
} }
case "magic_skill": 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; break;
} }
case "critical_skill": 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; break;
} }
} }
@@ -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.EtcItemType;
import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.item.type.WeaponType;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory; import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.AbnormalType;
import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffFinishTask;
import org.l2jmobius.gameserver.model.skill.BuffInfo; 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 boolean _lethalable = true;
private Map<Integer, OptionsSkillHolder> _triggerSkills; private Map<Integer, OptionSkillHolder> _triggerSkills;
private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects; private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects;
/** Creatures effect list. */ /** Creatures effect list. */
@@ -3902,9 +3902,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (_triggerSkills != null) 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); 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(); return (_triggerSkills != null) && !_triggerSkills.isEmpty();
} }
public Map<Integer, OptionsSkillHolder> getTriggerSkills() public Map<Integer, OptionSkillHolder> getTriggerSkills()
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
@@ -4950,21 +4950,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
_triggerSkills = new ConcurrentHashMap<>(); _triggerSkills = new ConcurrentHashMap<>(1);
} }
} }
} }
return _triggerSkills; 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());
} }
/** /**
@@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}
@@ -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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.options;
/**
* @author UnAfraid
*/
public enum OptionSkillType
{
ATTACK,
MAGIC,
CRITICAL
}
@@ -22,7 +22,6 @@ import java.util.List;
import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.enums.SkillFinishType;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.AbstractEffect; 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.BuffInfo;
import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
@@ -34,9 +33,9 @@ public class Options
{ {
private final int _id; private final int _id;
private List<AbstractEffect> _effects = null; private List<AbstractEffect> _effects = null;
private List<SkillHolder> _activeSkill = null; private List<Skill> _activeSkill = null;
private List<SkillHolder> _passiveSkill = null; private List<Skill> _passiveSkill = null;
private List<OptionsSkillHolder> _activationSkills = null; private List<OptionSkillHolder> _activationSkills = null;
/** /**
* @param id * @param id
@@ -75,12 +74,12 @@ public class Options
return _activeSkill != null; return _activeSkill != null;
} }
public List<SkillHolder> getActiveSkills() public List<Skill> getActiveSkills()
{ {
return _activeSkill; return _activeSkill;
} }
public void addActiveSkill(SkillHolder holder) public void addActiveSkill(Skill holder)
{ {
if (_activeSkill == null) if (_activeSkill == null)
{ {
@@ -94,12 +93,12 @@ public class Options
return _passiveSkill != null; return _passiveSkill != null;
} }
public List<SkillHolder> getPassiveSkills() public List<Skill> getPassiveSkills()
{ {
return _passiveSkill; return _passiveSkill;
} }
public void addPassiveSkill(SkillHolder holder) public void addPassiveSkill(Skill holder)
{ {
if (_passiveSkill == null) if (_passiveSkill == null)
{ {
@@ -113,11 +112,11 @@ public class Options
return _activationSkills != null; return _activationSkills != null;
} }
public boolean hasActivationSkills(OptionsSkillType type) public boolean hasActivationSkills(OptionSkillType type)
{ {
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -128,17 +127,17 @@ public class Options
return false; return false;
} }
public List<OptionsSkillHolder> getActivationsSkills() public List<OptionSkillHolder> getActivationSkills()
{ {
return _activationSkills; return _activationSkills;
} }
public List<OptionsSkillHolder> getActivationsSkills(OptionsSkillType type) public List<OptionSkillHolder> getActivationSkills(OptionSkillType type)
{ {
final List<OptionsSkillHolder> temp = new ArrayList<>(); final List<OptionSkillHolder> temp = new ArrayList<>();
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -149,7 +148,7 @@ public class Options
return temp; return temp;
} }
public void addActivationSkill(OptionsSkillHolder holder) public void addActivationSkill(OptionSkillHolder holder)
{ {
if (_activationSkills == null) if (_activationSkills == null)
{ {
@@ -189,21 +188,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.addTriggerSkill(holder); player.addTriggerSkill(holder);
} }
@@ -227,21 +226,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
player.removeSkill(holder.getSkill(), false, false); player.removeSkill(skill, false, false);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
player.removeSkill(holder.getSkill(), false, true); player.removeSkill(skill, false, true);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.removeTriggerSkill(holder); player.removeTriggerSkill(holder);
} }
@@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}
@@ -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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.options;
/**
* @author UnAfraid
*/
public enum OptionsSkillType
{
ATTACK,
MAGIC,
CRITICAL
}
@@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate;
import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.Weapon;
import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.item.type.ActionType; import org.l2jmobius.gameserver.model.item.type.ActionType;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.skill.targets.TargetType;
import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.stats.Formulas;
import org.l2jmobius.gameserver.model.stats.Stat; import org.l2jmobius.gameserver.model.stats.Stat;
@@ -603,9 +603,9 @@ public class SkillCaster implements Runnable
if (caster.hasTriggerSkills()) 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); triggerCast(caster, creature, holder.getSkill(), null, false);
} }
@@ -819,15 +819,12 @@
</option> </option>
<option id="31996" name="helios_opt"> <option id="31996" name="helios_opt">
<!-- Passive: Petrification Resistance + 2%. --> <!-- Passive: Petrification Resistance + 2%. -->
<passive_skill id="13765" level="7" />
</option> </option>
<option id="31997" name="helios_opt"> <option id="31997" name="helios_opt">
<!-- Passive: Petrification Resistance + 3%. --> <!-- Passive: Petrification Resistance + 3%. -->
<passive_skill id="13765" level="8" />
</option> </option>
<option id="31998" name="helios_opt"> <option id="31998" name="helios_opt">
<!-- Passive: Petrification Resistance + 4%. --> <!-- Passive: Petrification Resistance + 4%. -->
<passive_skill id="13765" level="9" />
</option> </option>
<option id="31999" name="helios_opt"> <option id="31999" name="helios_opt">
<!-- Stun/Hold Resistance + 6% --> <!-- Stun/Hold Resistance + 6% -->
@@ -28,10 +28,10 @@ import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.handler.EffectHandler;
import org.l2jmobius.gameserver.model.StatSet; 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.Options;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.Skill;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -88,27 +88,77 @@ public class OptionData implements IXmlReader
} }
case "active_skill": 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; break;
} }
case "passive_skill": 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; break;
} }
case "attack_skill": 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; break;
} }
case "magic_skill": 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; break;
} }
case "critical_skill": 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; break;
} }
} }
@@ -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.EtcItemType;
import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.item.type.WeaponType;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory; import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.AbnormalType;
import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffFinishTask;
import org.l2jmobius.gameserver.model.skill.BuffInfo; 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 boolean _lethalable = true;
private Map<Integer, OptionsSkillHolder> _triggerSkills; private Map<Integer, OptionSkillHolder> _triggerSkills;
private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects; private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects;
/** Creatures effect list. */ /** Creatures effect list. */
@@ -3902,9 +3902,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (_triggerSkills != null) 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); 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(); return (_triggerSkills != null) && !_triggerSkills.isEmpty();
} }
public Map<Integer, OptionsSkillHolder> getTriggerSkills() public Map<Integer, OptionSkillHolder> getTriggerSkills()
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
@@ -4950,21 +4950,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
_triggerSkills = new ConcurrentHashMap<>(); _triggerSkills = new ConcurrentHashMap<>(1);
} }
} }
} }
return _triggerSkills; 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());
} }
/** /**
@@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}
@@ -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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.options;
/**
* @author UnAfraid
*/
public enum OptionSkillType
{
ATTACK,
MAGIC,
CRITICAL
}
@@ -22,7 +22,6 @@ import java.util.List;
import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.enums.SkillFinishType;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.AbstractEffect; 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.BuffInfo;
import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
@@ -34,9 +33,9 @@ public class Options
{ {
private final int _id; private final int _id;
private List<AbstractEffect> _effects = null; private List<AbstractEffect> _effects = null;
private List<SkillHolder> _activeSkill = null; private List<Skill> _activeSkill = null;
private List<SkillHolder> _passiveSkill = null; private List<Skill> _passiveSkill = null;
private List<OptionsSkillHolder> _activationSkills = null; private List<OptionSkillHolder> _activationSkills = null;
/** /**
* @param id * @param id
@@ -75,12 +74,12 @@ public class Options
return _activeSkill != null; return _activeSkill != null;
} }
public List<SkillHolder> getActiveSkills() public List<Skill> getActiveSkills()
{ {
return _activeSkill; return _activeSkill;
} }
public void addActiveSkill(SkillHolder holder) public void addActiveSkill(Skill holder)
{ {
if (_activeSkill == null) if (_activeSkill == null)
{ {
@@ -94,12 +93,12 @@ public class Options
return _passiveSkill != null; return _passiveSkill != null;
} }
public List<SkillHolder> getPassiveSkills() public List<Skill> getPassiveSkills()
{ {
return _passiveSkill; return _passiveSkill;
} }
public void addPassiveSkill(SkillHolder holder) public void addPassiveSkill(Skill holder)
{ {
if (_passiveSkill == null) if (_passiveSkill == null)
{ {
@@ -113,11 +112,11 @@ public class Options
return _activationSkills != null; return _activationSkills != null;
} }
public boolean hasActivationSkills(OptionsSkillType type) public boolean hasActivationSkills(OptionSkillType type)
{ {
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -128,17 +127,17 @@ public class Options
return false; return false;
} }
public List<OptionsSkillHolder> getActivationsSkills() public List<OptionSkillHolder> getActivationSkills()
{ {
return _activationSkills; return _activationSkills;
} }
public List<OptionsSkillHolder> getActivationsSkills(OptionsSkillType type) public List<OptionSkillHolder> getActivationSkills(OptionSkillType type)
{ {
final List<OptionsSkillHolder> temp = new ArrayList<>(); final List<OptionSkillHolder> temp = new ArrayList<>();
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -149,7 +148,7 @@ public class Options
return temp; return temp;
} }
public void addActivationSkill(OptionsSkillHolder holder) public void addActivationSkill(OptionSkillHolder holder)
{ {
if (_activationSkills == null) if (_activationSkills == null)
{ {
@@ -189,21 +188,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.addTriggerSkill(holder); player.addTriggerSkill(holder);
} }
@@ -227,21 +226,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
player.removeSkill(holder.getSkill(), false, false); player.removeSkill(skill, false, false);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
player.removeSkill(holder.getSkill(), false, true); player.removeSkill(skill, false, true);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.removeTriggerSkill(holder); player.removeTriggerSkill(holder);
} }
@@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}
@@ -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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.options;
/**
* @author UnAfraid
*/
public enum OptionsSkillType
{
ATTACK,
MAGIC,
CRITICAL
}
@@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate;
import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.Weapon;
import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.item.type.ActionType; import org.l2jmobius.gameserver.model.item.type.ActionType;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.skill.targets.TargetType;
import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.stats.Formulas;
import org.l2jmobius.gameserver.model.stats.Stat; import org.l2jmobius.gameserver.model.stats.Stat;
@@ -603,9 +603,9 @@ public class SkillCaster implements Runnable
if (caster.hasTriggerSkills()) 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); triggerCast(caster, creature, holder.getSkill(), null, false);
} }
@@ -819,15 +819,12 @@
</option> </option>
<option id="31996" name="helios_opt"> <option id="31996" name="helios_opt">
<!-- Passive: Petrification Resistance + 2%. --> <!-- Passive: Petrification Resistance + 2%. -->
<passive_skill id="13765" level="7" />
</option> </option>
<option id="31997" name="helios_opt"> <option id="31997" name="helios_opt">
<!-- Passive: Petrification Resistance + 3%. --> <!-- Passive: Petrification Resistance + 3%. -->
<passive_skill id="13765" level="8" />
</option> </option>
<option id="31998" name="helios_opt"> <option id="31998" name="helios_opt">
<!-- Passive: Petrification Resistance + 4%. --> <!-- Passive: Petrification Resistance + 4%. -->
<passive_skill id="13765" level="9" />
</option> </option>
<option id="31999" name="helios_opt"> <option id="31999" name="helios_opt">
<!-- Stun/Hold Resistance + 6% --> <!-- Stun/Hold Resistance + 6% -->
@@ -28,10 +28,10 @@ import org.w3c.dom.Document;
import org.l2jmobius.commons.util.IXmlReader; import org.l2jmobius.commons.util.IXmlReader;
import org.l2jmobius.gameserver.handler.EffectHandler; import org.l2jmobius.gameserver.handler.EffectHandler;
import org.l2jmobius.gameserver.model.StatSet; 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.Options;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.Skill;
/** /**
* @author UnAfraid * @author UnAfraid
@@ -88,27 +88,77 @@ public class OptionData implements IXmlReader
} }
case "active_skill": 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; break;
} }
case "passive_skill": 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; break;
} }
case "attack_skill": 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; break;
} }
case "magic_skill": 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; break;
} }
case "critical_skill": 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; break;
} }
} }
@@ -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.EtcItemType;
import org.l2jmobius.gameserver.model.item.type.WeaponType; import org.l2jmobius.gameserver.model.item.type.WeaponType;
import org.l2jmobius.gameserver.model.itemcontainer.Inventory; import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.AbnormalType; import org.l2jmobius.gameserver.model.skill.AbnormalType;
import org.l2jmobius.gameserver.model.skill.BuffFinishTask; import org.l2jmobius.gameserver.model.skill.BuffFinishTask;
import org.l2jmobius.gameserver.model.skill.BuffInfo; 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 boolean _lethalable = true;
private Map<Integer, OptionsSkillHolder> _triggerSkills; private Map<Integer, OptionSkillHolder> _triggerSkills;
private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects; private Map<Integer, IgnoreSkillHolder> _ignoreSkillEffects;
/** Creatures effect list. */ /** Creatures effect list. */
@@ -3902,9 +3902,9 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
if (_triggerSkills != null) 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); 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(); return (_triggerSkills != null) && !_triggerSkills.isEmpty();
} }
public Map<Integer, OptionsSkillHolder> getTriggerSkills() public Map<Integer, OptionSkillHolder> getTriggerSkills()
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
@@ -4950,21 +4950,21 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{ {
if (_triggerSkills == null) if (_triggerSkills == null)
{ {
_triggerSkills = new ConcurrentHashMap<>(); _triggerSkills = new ConcurrentHashMap<>(1);
} }
} }
} }
return _triggerSkills; 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());
} }
/** /**
@@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}
@@ -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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.options;
/**
* @author UnAfraid
*/
public enum OptionSkillType
{
ATTACK,
MAGIC,
CRITICAL
}
@@ -22,7 +22,6 @@ import java.util.List;
import org.l2jmobius.gameserver.enums.SkillFinishType; import org.l2jmobius.gameserver.enums.SkillFinishType;
import org.l2jmobius.gameserver.model.actor.Player; import org.l2jmobius.gameserver.model.actor.Player;
import org.l2jmobius.gameserver.model.effects.AbstractEffect; 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.BuffInfo;
import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.model.skill.Skill;
import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime; import org.l2jmobius.gameserver.network.serverpackets.SkillCoolTime;
@@ -34,9 +33,9 @@ public class Options
{ {
private final int _id; private final int _id;
private List<AbstractEffect> _effects = null; private List<AbstractEffect> _effects = null;
private List<SkillHolder> _activeSkill = null; private List<Skill> _activeSkill = null;
private List<SkillHolder> _passiveSkill = null; private List<Skill> _passiveSkill = null;
private List<OptionsSkillHolder> _activationSkills = null; private List<OptionSkillHolder> _activationSkills = null;
/** /**
* @param id * @param id
@@ -75,12 +74,12 @@ public class Options
return _activeSkill != null; return _activeSkill != null;
} }
public List<SkillHolder> getActiveSkills() public List<Skill> getActiveSkills()
{ {
return _activeSkill; return _activeSkill;
} }
public void addActiveSkill(SkillHolder holder) public void addActiveSkill(Skill holder)
{ {
if (_activeSkill == null) if (_activeSkill == null)
{ {
@@ -94,12 +93,12 @@ public class Options
return _passiveSkill != null; return _passiveSkill != null;
} }
public List<SkillHolder> getPassiveSkills() public List<Skill> getPassiveSkills()
{ {
return _passiveSkill; return _passiveSkill;
} }
public void addPassiveSkill(SkillHolder holder) public void addPassiveSkill(Skill holder)
{ {
if (_passiveSkill == null) if (_passiveSkill == null)
{ {
@@ -113,11 +112,11 @@ public class Options
return _activationSkills != null; return _activationSkills != null;
} }
public boolean hasActivationSkills(OptionsSkillType type) public boolean hasActivationSkills(OptionSkillType type)
{ {
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -128,17 +127,17 @@ public class Options
return false; return false;
} }
public List<OptionsSkillHolder> getActivationsSkills() public List<OptionSkillHolder> getActivationSkills()
{ {
return _activationSkills; return _activationSkills;
} }
public List<OptionsSkillHolder> getActivationsSkills(OptionsSkillType type) public List<OptionSkillHolder> getActivationSkills(OptionSkillType type)
{ {
final List<OptionsSkillHolder> temp = new ArrayList<>(); final List<OptionSkillHolder> temp = new ArrayList<>();
if (_activationSkills != null) if (_activationSkills != null)
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
if (holder.getSkillType() == type) if (holder.getSkillType() == type)
{ {
@@ -149,7 +148,7 @@ public class Options
return temp; return temp;
} }
public void addActivationSkill(OptionsSkillHolder holder) public void addActivationSkill(OptionSkillHolder holder)
{ {
if (_activationSkills == null) if (_activationSkills == null)
{ {
@@ -189,21 +188,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
addSkill(player, holder.getSkill()); addSkill(player, skill);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.addTriggerSkill(holder); player.addTriggerSkill(holder);
} }
@@ -227,21 +226,21 @@ public class Options
} }
if (hasActiveSkills()) if (hasActiveSkills())
{ {
for (SkillHolder holder : _activeSkill) for (Skill skill : _activeSkill)
{ {
player.removeSkill(holder.getSkill(), false, false); player.removeSkill(skill, false, false);
} }
} }
if (hasPassiveSkills()) if (hasPassiveSkills())
{ {
for (SkillHolder holder : _passiveSkill) for (Skill skill : _passiveSkill)
{ {
player.removeSkill(holder.getSkill(), false, true); player.removeSkill(skill, false, true);
} }
} }
if (hasActivationSkills()) if (hasActivationSkills())
{ {
for (OptionsSkillHolder holder : _activationSkills) for (OptionSkillHolder holder : _activationSkills)
{ {
player.removeTriggerSkill(holder); player.removeTriggerSkill(holder);
} }
@@ -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 <http://www.gnu.org/licenses/>.
*/
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;
}
}
@@ -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 <http://www.gnu.org/licenses/>.
*/
package org.l2jmobius.gameserver.model.options;
/**
* @author UnAfraid
*/
public enum OptionsSkillType
{
ATTACK,
MAGIC,
CRITICAL
}
@@ -62,8 +62,8 @@ import org.l2jmobius.gameserver.model.item.ItemTemplate;
import org.l2jmobius.gameserver.model.item.Weapon; import org.l2jmobius.gameserver.model.item.Weapon;
import org.l2jmobius.gameserver.model.item.instance.Item; import org.l2jmobius.gameserver.model.item.instance.Item;
import org.l2jmobius.gameserver.model.item.type.ActionType; import org.l2jmobius.gameserver.model.item.type.ActionType;
import org.l2jmobius.gameserver.model.options.OptionsSkillHolder; import org.l2jmobius.gameserver.model.options.OptionSkillHolder;
import org.l2jmobius.gameserver.model.options.OptionsSkillType; import org.l2jmobius.gameserver.model.options.OptionSkillType;
import org.l2jmobius.gameserver.model.skill.targets.TargetType; import org.l2jmobius.gameserver.model.skill.targets.TargetType;
import org.l2jmobius.gameserver.model.stats.Formulas; import org.l2jmobius.gameserver.model.stats.Formulas;
import org.l2jmobius.gameserver.model.stats.Stat; import org.l2jmobius.gameserver.model.stats.Stat;
@@ -603,9 +603,9 @@ public class SkillCaster implements Runnable
if (caster.hasTriggerSkills()) 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); triggerCast(caster, creature, holder.getSkill(), null, false);
} }
@@ -819,15 +819,12 @@
</option> </option>
<option id="31996" name="helios_opt"> <option id="31996" name="helios_opt">
<!-- Passive: Petrification Resistance + 2%. --> <!-- Passive: Petrification Resistance + 2%. -->
<passive_skill id="13765" level="7" />
</option> </option>
<option id="31997" name="helios_opt"> <option id="31997" name="helios_opt">
<!-- Passive: Petrification Resistance + 3%. --> <!-- Passive: Petrification Resistance + 3%. -->
<passive_skill id="13765" level="8" />
</option> </option>
<option id="31998" name="helios_opt"> <option id="31998" name="helios_opt">
<!-- Passive: Petrification Resistance + 4%. --> <!-- Passive: Petrification Resistance + 4%. -->
<passive_skill id="13765" level="9" />
</option> </option>
<option id="31999" name="helios_opt"> <option id="31999" name="helios_opt">
<!-- Stun/Hold Resistance + 6% --> <!-- Stun/Hold Resistance + 6% -->

Some files were not shown because too many files have changed in this diff Show More