Commented skill checks for readability.

This commit is contained in:
MobiusDevelopment
2021-04-22 21:28:16 +00:00
parent d7e785613d
commit 784f009190
4 changed files with 281 additions and 255 deletions

View File

@@ -3043,23 +3043,26 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
}
}
final Skill tempskill = newEffect.getSkill();
// Remove first Buff if number of buffs > BUFFS_MAX_AMOUNT
if ((getBuffCount() >= getMaxBuffCount()) && !doesStack(tempskill) && ((tempskill.getSkillType() == SkillType.BUFF) || (tempskill.getSkillType() == SkillType.REFLECT) || (tempskill.getSkillType() == SkillType.HEAL_PERCENT) || (tempskill.getSkillType() == SkillType.MANAHEAL_PERCENT)) && ((tempskill.getId() <= 4360) || (tempskill.getId() >= 4367)) && ((tempskill.getId() <= 4550) || (tempskill.getId() >= 4555)))
final Skill skill = newEffect.getSkill();
if ((getBuffCount() >= getMaxBuffCount()) //
&& !doesStack(skill) //
&& ((skill.getSkillType() == SkillType.BUFF) || (skill.getSkillType() == SkillType.REFLECT) || (skill.getSkillType() == SkillType.HEAL_PERCENT) || (skill.getSkillType() == SkillType.MANAHEAL_PERCENT)) //
&& ((skill.getId() <= 4360) || (skill.getId() >= 4367)) // Curse of Destruction, Blessing of Prophecy
&& ((skill.getId() <= 4550) || (skill.getId() >= 4555))) // Hot Springs Rheumatism, Hot Springs Cholera, Hot Springs Flu, Hot Springs Malaria
{
if (newEffect.isHerbEffect())
{
newEffect.exit(false);
return;
}
removeFirstBuff(tempskill.getId());
removeFirstBuff(skill.getId());
}
// Remove first DeBuff if number of debuffs > DEBUFFS_MAX_AMOUNT
if ((getDeBuffCount() >= Config.DEBUFFS_MAX_AMOUNT) && !doesStack(tempskill) && tempskill.isDebuff())
if ((getDeBuffCount() >= Config.DEBUFFS_MAX_AMOUNT) && !doesStack(skill) && skill.isDebuff())
{
removeFirstDeBuff(tempskill.getId());
removeFirstDeBuff(skill.getId());
}
// Add the Effect to all effect in progress on the Creature
@@ -3867,9 +3870,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
effect.addIcon(mi);
}
// Like L2OFF toggle and healing potions must not be showed on party buff list
if ((ps != null) && !effect.getSkill().isToggle() && (effect.getSkill().getId() != 2031) && (effect.getSkill().getId() != 2037) && (effect.getSkill().getId() != 2032))
if (ps != null)
{
effect.addPartySpelledIcon(ps);
final Skill skill = effect.getSkill();
if (!skill.isToggle() //
&& (skill.getId() != 2031) // Lesser Healing Potion
&& (skill.getId() != 2032) // Healing potion
&& (skill.getId() != 2037)) // Greater Healing Potion
{
effect.addPartySpelledIcon(ps);
}
}
if (os != null)
{
@@ -6787,7 +6797,13 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
int numBuffs = 0;
for (Effect effect : _effects)
{
if (((effect.getSkill().getSkillType() == SkillType.BUFF) || (effect.getSkill().getId() == 1416) || (effect.getSkill().getSkillType() == SkillType.REFLECT) || (effect.getSkill().getSkillType() == SkillType.HEAL_PERCENT) || (effect.getSkill().getSkillType() == SkillType.MANAHEAL_PERCENT)) && ((effect.getSkill().getId() <= 4360) || (effect.getSkill().getId() >= 4367))) // 7s
final Skill skill = effect.getSkill();
if (((skill.getSkillType() == SkillType.BUFF) //
|| (skill.getId() == 1416) // Pa'agrio's Fist
|| (skill.getSkillType() == SkillType.REFLECT) //
|| (skill.getSkillType() == SkillType.HEAL_PERCENT) //
|| (skill.getSkillType() == SkillType.MANAHEAL_PERCENT)) //
&& ((skill.getId() <= 4360) || (skill.getId() >= 4367))) // Curse of Destruction, Blessing of Prophecy
{
numBuffs++;
}
@@ -6831,7 +6847,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
Effect removeMe = null;
for (Effect effect : _effects)
{
if (((effect.getSkill().getSkillType() == SkillType.BUFF) || (effect.getSkill().getSkillType() == SkillType.REFLECT) || (effect.getSkill().getSkillType() == SkillType.HEAL_PERCENT) || (effect.getSkill().getSkillType() == SkillType.MANAHEAL_PERCENT)) && ((effect.getSkill().getId() <= 4360) || (effect.getSkill().getId() >= 4367)))
final Skill skill = effect.getSkill();
if (((skill.getSkillType() == SkillType.BUFF) //
|| (skill.getSkillType() == SkillType.REFLECT) //
|| (skill.getSkillType() == SkillType.HEAL_PERCENT) //
|| (skill.getSkillType() == SkillType.MANAHEAL_PERCENT)) //
&& ((skill.getId() <= 4360) || (skill.getId() >= 4367))) // Curse of Destruction, Blessing of Prophecy
{
if (preferSkill == 0)
{
@@ -7270,7 +7291,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
// if the skill has changed the character's state to something other than STATE_CASTING
// then just leave it that way, otherwise switch back to STATE_IDLE.
if ((skill.getId() != 345) && (skill.getId() != 346) && (_target != null) && _target.canBeAttacked())
if ((skill.getId() != 345 /* Sonic Rage */) && (skill.getId() != 346 /* Raging Force */) && (_target != null) && _target.canBeAttacked())
{
// Like L2OFF while use a skill and next intention == null the char stop auto attack
if (((getAI().getNextIntention() == null) && ((skill.getSkillType() == SkillType.PDAM) && (skill.getCastRange() < 400))) || (skill.getSkillType() == SkillType.BLOW) || (skill.getSkillType() == SkillType.DRAIN_SOUL) || (skill.getSkillType() == SkillType.SOW) || (skill.getSkillType() == SkillType.SPOIL))
@@ -7291,7 +7312,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
{
getAI().setIntention(AI_INTENTION_ATTACK, _target);
}
else if ((skill.isOffensive()) && (skill.getSkillType() != SkillType.UNLOCK) && (skill.getSkillType() != SkillType.BLOW) && (skill.getSkillType() != SkillType.DELUXE_KEY_UNLOCK) && (skill.getId() != 345) && (skill.getId() != 346))
else if ((skill.isOffensive()) && (skill.getSkillType() != SkillType.UNLOCK) && (skill.getSkillType() != SkillType.BLOW) && (skill.getSkillType() != SkillType.DELUXE_KEY_UNLOCK))
{
getAI().setIntention(AI_INTENTION_ATTACK, _target);
getAI().clientStartAutoAttack();
@@ -7302,7 +7323,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
{
final PlayerInstance currPlayer = (PlayerInstance) this;
final SkillUseHolder skillUseHolder = currPlayer.getCurrentSkill();
if ((skillUseHolder != null) && !skillUseHolder.isCtrlPressed() && (skill.isOffensive()) && (skill.getSkillType() != SkillType.UNLOCK) && (skill.getSkillType() != SkillType.BLOW) && (skill.getSkillType() != SkillType.DELUXE_KEY_UNLOCK) && (skill.getId() != 345) && (skill.getId() != 346))
if ((skillUseHolder != null) && !skillUseHolder.isCtrlPressed() && (skill.isOffensive()) && (skill.getSkillType() != SkillType.UNLOCK) && (skill.getSkillType() != SkillType.BLOW) && (skill.getSkillType() != SkillType.DELUXE_KEY_UNLOCK))
{
if (!skill.isMagic() && skill.nextActionIsAttack())
{
@@ -7311,7 +7332,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
getAI().clientStartAutoAttack();
}
}
else if ((skill.isOffensive()) && (skill.getSkillType() != SkillType.UNLOCK) && (skill.getSkillType() != SkillType.BLOW) && (skill.getSkillType() != SkillType.DELUXE_KEY_UNLOCK) && (skill.getId() != 345) && (skill.getId() != 346))
else if ((skill.isOffensive()) && (skill.getSkillType() != SkillType.UNLOCK) && (skill.getSkillType() != SkillType.BLOW) && (skill.getSkillType() != SkillType.DELUXE_KEY_UNLOCK))
{
if (!skill.isMagic())
{

View File

@@ -696,7 +696,8 @@ public class PlayerInstance extends Playable
// Like L2OFF you can use cupid bow skills on peace zone
// Like L2OFF players can use TARGET_AURA skills on peace zone, all targets will be ignored.
if (skill.isOffensive() && (isInsidePeaceZone(PlayerInstance.this, getTarget()) && (skill.getTargetType() != SkillTargetType.TARGET_AURA)) && ((skill.getId() != 3261) && (skill.getId() != 3260) && (skill.getId() != 3262))) // check limited to active target
// Check limited to active target.
if (skill.isOffensive() && (isInsidePeaceZone(PlayerInstance.this, getTarget()) && (skill.getTargetType() != SkillTargetType.TARGET_AURA)) && ((skill.getId() != 3260 /* Forgiveness */) && (skill.getId() != 3261 /* Heart Shot */) && (skill.getId() != 3262/* Double Heart Shot */)))
{
sendPacket(ActionFailed.STATIC_PACKET);
return;
@@ -2849,7 +2850,7 @@ public class PlayerInstance extends Playable
}
// Penality skill are not auto learn
if ((sk.getId() == 4267) || (sk.getId() == 4270))
if ((sk.getId() == 4267 /* Grade Penalty */) || (sk.getId() == 4270 /* Weight Penalty */))
{
continue;
}
@@ -8895,109 +8896,87 @@ public class PlayerInstance extends Playable
}
/**
* check player skills and remove unlegit ones (excludes hero, noblesse and cursed weapon skills).
* Check player skills and remove unlegit ones (excludes hero, noblesse and cursed weapon skills).
*/
public void checkAllowedSkills()
{
boolean foundskill = false;
if (!isGM())
// Exclude GM characters.
if (isGM())
{
final Collection<SkillLearn> skillTree = SkillTreeTable.getInstance().getAllowedSkills(getClassId());
// loop through all skills of player
for (Skill skill : getAllSkills())
return;
}
final Collection<SkillLearn> skillTree = SkillTreeTable.getInstance().getAllowedSkills(getClassId());
boolean foundskill;
// Loop through all player skills.
for (Skill skill : getAllSkills())
{
final int skillId = skill.getId();
foundskill = false;
// Loop through all skills in player skilltree.
for (SkillLearn temp : skillTree)
{
final int skillId = skill.getId();
// int skilllevel = skill.getLevel();
foundskill = false;
// loop through all skills in players skilltree
for (SkillLearn temp : skillTree)
{
// if the skill was found and the level is possible to obtain for his class everything is ok
if (temp.getId() == skillId)
{
foundskill = true;
}
}
// exclude noble skills
if (isNoble() && (skillId >= 325) && (skillId <= 397))
if (temp.getId() == skillId)
{
foundskill = true;
}
if (isNoble() && (skillId >= 1323) && (skillId <= 1327))
{
foundskill = true;
}
// exclude hero skills
if (isHero() && (skillId >= 395) && (skillId <= 396))
{
foundskill = true;
}
if (isHero() && (skillId >= 1374) && (skillId <= 1376))
{
foundskill = true;
}
// exclude clan skills
if ((getClan() != null) && (skillId >= 370) && (skillId <= 391))
{
foundskill = true;
}
// exclude seal of ruler / build siege hq
if ((getClan() != null) && ((skillId == 246) || (skillId == 247)) && (getClan().getLeaderId() == getObjectId()))
{
foundskill = true;
}
// exclude fishing skills and common skills + dwarfen craft
if ((skillId >= 1312) && (skillId <= 1322))
{
foundskill = true;
}
if ((skillId >= 1368) && (skillId <= 1373))
{
foundskill = true;
}
// exclude sa / enchant bonus / penality etc. skills
if ((skillId >= 3000) && (skillId < 7000))
{
foundskill = true;
}
// exclude Skills from AllowedSkills in options.ini
if (Config.ALLOWED_SKILLS_LIST.contains(skillId))
{
foundskill = true;
}
// exclude Donator character
if (isDonator())
{
foundskill = true;
}
// exclude Aio character
if (isAio())
{
foundskill = true;
}
// remove skill and do a lil LOGGER message
if (!foundskill)
{
removeSkill(skill);
}
}
// Update skill list
sendSkillList();
if (!foundskill)
{
// Exclude noble skills.
if (isNoble() && (((skillId >= 325) && (skillId <= 397)) || ((skillId >= 1323) && (skillId <= 1327))))
{
foundskill = true;
}
// Exclude hero skills.
else if (isHero() && (((skillId >= 395) && (skillId <= 396)) || ((skillId >= 1374) && (skillId <= 1376))))
{
foundskill = true;
}
// Exclude clan skills. Exclude seal of ruler / build siege HQ.
else if ((getClan() != null) && (((skillId >= 370) && (skillId <= 391)) || ((getClan().getLeaderId() == getObjectId()) && ((skillId == 246) || (skillId == 247)))))
{
foundskill = true;
}
// Exclude fishing skills and common skills + dwarfen craft.
else if (((skillId >= 1312) && (skillId <= 1322)) || ((skillId >= 1368) && (skillId <= 1373)))
{
foundskill = true;
}
// Exclude AS / enchant bonus / penalty etc skills.
else if ((skillId >= 3000) && (skillId < 7000))
{
foundskill = true;
}
// Exclude Skills from AllowedSkills in custom/Other.ini
else if (Config.ALLOWED_SKILLS_LIST.contains(skillId))
{
foundskill = true;
}
// Exclude Donator character.
else if (isDonator())
{
foundskill = true;
}
// Exclude Aio character.
else if (isAio())
{
foundskill = true;
}
}
// Remove skill.
if (!foundskill)
{
removeSkill(skill);
}
}
// Update skill list.
sendSkillList();
}
/**
@@ -9718,7 +9697,7 @@ public class PlayerInstance extends Playable
if (skill.isToggle())
{
// Like L2OFF you can't use fake death if you are mounted
if ((skill.getId() == 60) && isMounted())
if ((skill.getId() == 60 /* Fake Death */) && isMounted())
{
return;
}
@@ -9738,7 +9717,7 @@ public class PlayerInstance extends Playable
if (effect != null)
{
// fake death exception
if (skill.getId() != 60)
if (skill.getId() != 60 /* Fake Death */)
{
effect.exit(false);
}
@@ -9786,14 +9765,8 @@ public class PlayerInstance extends Playable
// Check if skill is in reuse time
if (isSkillDisabled(skill))
{
if ((skill.getId() != 2166))
{
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_IS_NOT_AVAILABLE_AT_THIS_TIME_BEING_PREPARED_FOR_REUSE);
sm.addSkillName(skill.getId(), skill.getLevel());
sendPacket(sm);
}
// Cp potion message like L2OFF
else if ((skill.getId() == 2166))
if ((skill.getId() == 2166 /* CP Gauge Potion */))
{
if (skill.getLevel() == 2)
{
@@ -9804,6 +9777,12 @@ public class PlayerInstance extends Playable
sendMessage("CP Potion is not available at this time: being prepared for reuse.");
}
}
else
{
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_IS_NOT_AVAILABLE_AT_THIS_TIME_BEING_PREPARED_FOR_REUSE);
sm.addSkillName(skill.getId(), skill.getLevel());
sendPacket(sm);
}
sendPacket(ActionFailed.STATIC_PACKET);
return;
@@ -10064,8 +10043,9 @@ public class PlayerInstance extends Playable
// Check if this is offensive magic skill
if (skill.isOffensive())
{
if (isInsidePeaceZone(this, target) && ((skill.getId() != 3261) // Like L2OFF you can use cupid bow skills on peace zone
&& (skill.getId() != 3260) && (skill.getId() != 3262) && (sklTargetType != SkillTargetType.TARGET_AURA))) // Like L2OFF people can use TARGET_AURE skills on peace zone
if (isInsidePeaceZone(this, target) // Like L2OFF you can use cupid bow skills on peace zone
&& ((skill.getId() != 3260 /* Forgiveness */) && (skill.getId() != 3261 /* Heart Shot */) && (skill.getId() != 3262 /* Double Heart Shot */) //
&& (sklTargetType != SkillTargetType.TARGET_AURA))) // Like L2OFF people can use TARGET_AURE skills on peace zone
{
// If Creature or target is in a peace zone, send a system message TARGET_IN_PEACEZONE a Server->Client packet ActionFailed
sendPacket(SystemMessageId.YOU_MAY_NOT_ATTACK_THIS_TARGET_IN_A_PEACEFUL_ZONE);
@@ -10086,7 +10066,18 @@ public class PlayerInstance extends Playable
}
// Check if a Forced ATTACK is in progress on non-attackable target
if (!target.isAutoAttackable(this) && (!forceUse && ((skill.getId() != 3261) && (skill.getId() != 3260) && (skill.getId() != 3262))) && (!_inEventTvT || !TvT.isStarted()) && (!_inEventDM || !DM.hasStarted()) && (!_inEventCTF || !CTF.isStarted()) && (!_inEventVIP || !VIP._started) && (sklTargetType != SkillTargetType.TARGET_AURA) && (sklTargetType != SkillTargetType.TARGET_CLAN) && (sklTargetType != SkillTargetType.TARGET_ALLY) && (sklTargetType != SkillTargetType.TARGET_PARTY) && (sklTargetType != SkillTargetType.TARGET_SELF) && (sklTargetType != SkillTargetType.TARGET_GROUND))
if (!target.isAutoAttackable(this) //
&& (!forceUse && ((skill.getId() != 3260 /* Forgiveness */) && (skill.getId() != 3261 /* Heart Shot */) && (skill.getId() != 3262 /* Double Heart Shot */))) //
&& (!_inEventTvT || !TvT.isStarted()) //
&& (!_inEventDM || !DM.hasStarted()) //
&& (!_inEventCTF || !CTF.isStarted()) //
&& (!_inEventVIP || !VIP._started) //
&& (sklTargetType != SkillTargetType.TARGET_AURA) //
&& (sklTargetType != SkillTargetType.TARGET_CLAN) //
&& (sklTargetType != SkillTargetType.TARGET_ALLY) //
&& (sklTargetType != SkillTargetType.TARGET_PARTY) //
&& (sklTargetType != SkillTargetType.TARGET_SELF) //
&& (sklTargetType != SkillTargetType.TARGET_GROUND))
{
// Send a Server->Client packet ActionFailed to the PlayerInstance
sendPacket(ActionFailed.STATIC_PACKET);
@@ -10209,7 +10200,8 @@ public class PlayerInstance extends Playable
default:
{
// if pvp skill is not allowed for given target
if (!checkPvpSkill(target, skill) && !getAccessLevel().allowPeaceAttack() && ((skill.getId() != 3261) && (skill.getId() != 3260) && (skill.getId() != 3262)))
if (!checkPvpSkill(target, skill) && !getAccessLevel().allowPeaceAttack() //
&& ((skill.getId() != 3260 /* Forgiveness */) && (skill.getId() != 3261 /* Heart Shot */) && (skill.getId() != 3262 /* Double Heart Shot */)))
{
// Send a System Message to the PlayerInstance
sendPacket(SystemMessageId.THAT_IS_THE_INCORRECT_TARGET);
@@ -11720,9 +11712,10 @@ public class PlayerInstance extends Playable
continue;
}
// Fake skills to change base stats.
if (s.getId() > 9000)
{
continue; // Fake skills to change base stats
continue;
}
if (s.bestowed())
@@ -13670,7 +13663,6 @@ public class PlayerInstance extends Playable
{
return;
}
}
}
@@ -14141,7 +14133,7 @@ public class PlayerInstance extends Playable
int skillLevel = getSkillLevel(1315);
for (Effect e : effects)
{
if (e.getSkill().getId() == 2274)
if (e.getSkill().getId() == 2274 /* Fisherman's Potion */)
{
skillLevel = (int) e.getSkill().getPower(this);
}
@@ -14602,7 +14594,7 @@ public class PlayerInstance extends Playable
{
for (Skill skill : getAllSkills())
{
if ((skill != null) && skill.isActive() && (skill.getId() != 1324))
if ((skill != null) && skill.isActive() && (skill.getId() != 1324 /* Summon CP Potion */))
{
enableSkill(skill);
}

View File

@@ -3095,23 +3095,26 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
}
}
final Skill tempskill = newEffect.getSkill();
// Remove first Buff if number of buffs > BUFFS_MAX_AMOUNT
if ((getBuffCount() >= getMaxBuffCount()) && !doesStack(tempskill) && ((tempskill.getSkillType() == SkillType.BUFF) || (tempskill.getSkillType() == SkillType.REFLECT) || (tempskill.getSkillType() == SkillType.HEAL_PERCENT) || (tempskill.getSkillType() == SkillType.MANAHEAL_PERCENT)) && ((tempskill.getId() <= 4360) || (tempskill.getId() >= 4367)) && ((tempskill.getId() <= 4550) || (tempskill.getId() >= 4555)))
final Skill skill = newEffect.getSkill();
if ((getBuffCount() >= getMaxBuffCount()) //
&& !doesStack(skill) //
&& ((skill.getSkillType() == SkillType.BUFF) || (skill.getSkillType() == SkillType.REFLECT) || (skill.getSkillType() == SkillType.HEAL_PERCENT) || (skill.getSkillType() == SkillType.MANAHEAL_PERCENT)) //
&& ((skill.getId() <= 4360) || (skill.getId() >= 4367)) // Curse of Destruction, Blessing of Prophecy
&& ((skill.getId() <= 4550) || (skill.getId() >= 4555))) // Hot Springs Rheumatism, Hot Springs Cholera, Hot Springs Flu, Hot Springs Malaria
{
if (newEffect.isHerbEffect())
{
newEffect.exit(false);
return;
}
removeFirstBuff(tempskill.getId());
removeFirstBuff(skill.getId());
}
// Remove first DeBuff if number of debuffs > DEBUFFS_MAX_AMOUNT
if ((getDeBuffCount() >= Config.DEBUFFS_MAX_AMOUNT) && !doesStack(tempskill) && tempskill.isDebuff())
if ((getDeBuffCount() >= Config.DEBUFFS_MAX_AMOUNT) && !doesStack(skill) && skill.isDebuff())
{
removeFirstDeBuff(tempskill.getId());
removeFirstDeBuff(skill.getId());
}
// Add the Effect to all effect in progress on the Creature
@@ -3913,9 +3916,16 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
effect.addIcon(mi);
}
// Like L2OFF toggle and healing potions must not be showed on party buff list
if ((ps != null) && !effect.getSkill().isToggle() && (effect.getSkill().getId() != 2031) && (effect.getSkill().getId() != 2037) && (effect.getSkill().getId() != 2032))
if (ps != null)
{
effect.addPartySpelledIcon(ps);
final Skill skill = effect.getSkill();
if (!skill.isToggle() //
&& (skill.getId() != 2031) // Lesser Healing Potion
&& (skill.getId() != 2032) // Healing potion
&& (skill.getId() != 2037)) // Greater Healing Potion
{
effect.addPartySpelledIcon(ps);
}
}
if (os != null)
{
@@ -6834,7 +6844,13 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
int numBuffs = 0;
for (Effect effect : _effects)
{
if (((effect.getSkill().getSkillType() == SkillType.BUFF) || (effect.getSkill().getId() == 1416) || (effect.getSkill().getSkillType() == SkillType.REFLECT) || (effect.getSkill().getSkillType() == SkillType.HEAL_PERCENT) || (effect.getSkill().getSkillType() == SkillType.MANAHEAL_PERCENT)) && ((effect.getSkill().getId() <= 4360) || (effect.getSkill().getId() >= 4367))) // 7s
final Skill skill = effect.getSkill();
if (((skill.getSkillType() == SkillType.BUFF) //
|| (skill.getId() == 1416) // Pa'agrio's Fist
|| (skill.getSkillType() == SkillType.REFLECT) //
|| (skill.getSkillType() == SkillType.HEAL_PERCENT) //
|| (skill.getSkillType() == SkillType.MANAHEAL_PERCENT)) //
&& ((skill.getId() <= 4360) || (skill.getId() >= 4367))) // Curse of Destruction, Blessing of Prophecy
{
numBuffs++;
}
@@ -6878,7 +6894,12 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
Effect removeMe = null;
for (Effect effect : _effects)
{
if (((effect.getSkill().getSkillType() == SkillType.BUFF) || (effect.getSkill().getSkillType() == SkillType.REFLECT) || (effect.getSkill().getSkillType() == SkillType.HEAL_PERCENT) || (effect.getSkill().getSkillType() == SkillType.MANAHEAL_PERCENT)) && ((effect.getSkill().getId() <= 4360) || (effect.getSkill().getId() >= 4367)))
final Skill skill = effect.getSkill();
if (((skill.getSkillType() == SkillType.BUFF) //
|| (skill.getSkillType() == SkillType.REFLECT) //
|| (skill.getSkillType() == SkillType.HEAL_PERCENT) //
|| (skill.getSkillType() == SkillType.MANAHEAL_PERCENT)) //
&& ((skill.getId() <= 4360) || (skill.getId() >= 4367))) // Curse of Destruction, Blessing of Prophecy
{
if (preferSkill == 0)
{
@@ -7317,7 +7338,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
// if the skill has changed the character's state to something other than STATE_CASTING
// then just leave it that way, otherwise switch back to STATE_IDLE.
if ((skill.getId() != 345) && (skill.getId() != 346) && (_target != null) && _target.canBeAttacked())
if ((skill.getId() != 345 /* Sonic Rage */) && (skill.getId() != 346 /* Raging Force */) && (_target != null) && _target.canBeAttacked())
{
// Like L2OFF while use a skill and next intention == null the char stop auto attack
if (((getAI().getNextIntention() == null) && ((skill.getSkillType() == SkillType.PDAM) && (skill.getCastRange() < 400))) || (skill.getSkillType() == SkillType.BLOW) || (skill.getSkillType() == SkillType.DRAIN_SOUL) || (skill.getSkillType() == SkillType.SOW) || (skill.getSkillType() == SkillType.SPOIL))
@@ -7338,7 +7359,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
{
getAI().setIntention(AI_INTENTION_ATTACK, _target);
}
else if ((skill.isOffensive()) && (skill.getSkillType() != SkillType.UNLOCK) && (skill.getSkillType() != SkillType.BLOW) && (skill.getSkillType() != SkillType.DELUXE_KEY_UNLOCK) && (skill.getId() != 345) && (skill.getId() != 346))
else if ((skill.isOffensive()) && (skill.getSkillType() != SkillType.UNLOCK) && (skill.getSkillType() != SkillType.BLOW) && (skill.getSkillType() != SkillType.DELUXE_KEY_UNLOCK))
{
getAI().setIntention(AI_INTENTION_ATTACK, _target);
getAI().clientStartAutoAttack();
@@ -7349,7 +7370,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
{
final PlayerInstance currPlayer = (PlayerInstance) this;
final SkillUseHolder skillUseHolder = currPlayer.getCurrentSkill();
if ((skillUseHolder != null) && !skillUseHolder.isCtrlPressed() && (skill.isOffensive()) && (skill.getSkillType() != SkillType.UNLOCK) && (skill.getSkillType() != SkillType.BLOW) && (skill.getSkillType() != SkillType.DELUXE_KEY_UNLOCK) && (skill.getId() != 345) && (skill.getId() != 346))
if ((skillUseHolder != null) && !skillUseHolder.isCtrlPressed() && (skill.isOffensive()) && (skill.getSkillType() != SkillType.UNLOCK) && (skill.getSkillType() != SkillType.BLOW) && (skill.getSkillType() != SkillType.DELUXE_KEY_UNLOCK))
{
if (!skill.isMagic() && skill.nextActionIsAttack())
{
@@ -7358,7 +7379,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder
getAI().clientStartAutoAttack();
}
}
else if ((skill.isOffensive()) && (skill.getSkillType() != SkillType.UNLOCK) && (skill.getSkillType() != SkillType.BLOW) && (skill.getSkillType() != SkillType.DELUXE_KEY_UNLOCK) && (skill.getId() != 345) && (skill.getId() != 346))
else if ((skill.isOffensive()) && (skill.getSkillType() != SkillType.UNLOCK) && (skill.getSkillType() != SkillType.BLOW) && (skill.getSkillType() != SkillType.DELUXE_KEY_UNLOCK))
{
if (!skill.isMagic())
{

View File

@@ -710,7 +710,8 @@ public class PlayerInstance extends Playable
// Like L2OFF you can use cupid bow skills on peace zone
// Like L2OFF players can use TARGET_AURA skills on peace zone, all targets will be ignored.
if (skill.isOffensive() && (isInsidePeaceZone(PlayerInstance.this, getTarget()) && (skill.getTargetType() != SkillTargetType.TARGET_AURA)) && ((skill.getId() != 3261) && (skill.getId() != 3260) && (skill.getId() != 3262))) // check limited to active target
// Check limited to active target.
if (skill.isOffensive() && (isInsidePeaceZone(PlayerInstance.this, getTarget()) && (skill.getTargetType() != SkillTargetType.TARGET_AURA)) && ((skill.getId() != 3260 /* Forgiveness */) && (skill.getId() != 3261 /* Heart Shot */) && (skill.getId() != 3262/* Double Heart Shot */)))
{
sendPacket(ActionFailed.STATIC_PACKET);
return;
@@ -2917,7 +2918,7 @@ public class PlayerInstance extends Playable
}
// Penality skill are not auto learn
if ((sk.getId() == 4267) || (sk.getId() == 4270))
if ((sk.getId() == 4267 /* Grade Penalty */) || (sk.getId() == 4270 /* Weight Penalty */))
{
continue;
}
@@ -9047,115 +9048,92 @@ public class PlayerInstance extends Playable
}
/**
* check player skills and remove unlegit ones (excludes hero, noblesse and cursed weapon skills).
* Check player skills and remove unlegit ones (excludes hero, noblesse and cursed weapon skills).
*/
public void checkAllowedSkills()
{
boolean foundskill = false;
if (!isGM())
// Exclude GM characters.
if (isGM())
{
final Collection<SkillLearn> skillTree = SkillTreeTable.getInstance().getAllowedSkills(getClassId());
// loop through all skills of player
for (Skill skill : getAllSkills())
return;
}
final Collection<SkillLearn> skillTree = SkillTreeTable.getInstance().getAllowedSkills(getClassId());
boolean foundskill;
// Loop through all player skills.
for (Skill skill : getAllSkills())
{
final int skillId = skill.getId();
foundskill = false;
// Loop through all skills in player skilltree.
for (SkillLearn temp : skillTree)
{
final int skillId = skill.getId();
// int skilllevel = skill.getLevel();
foundskill = false;
// loop through all skills in players skilltree
for (SkillLearn temp : skillTree)
{
// if the skill was found and the level is possible to obtain for his class everything is ok
if (temp.getId() == skillId)
{
foundskill = true;
}
}
// exclude noble skills
if (isNoble() && (skillId >= 325) && (skillId <= 397))
if (temp.getId() == skillId)
{
foundskill = true;
}
if (isNoble() && (skillId >= 1323) && (skillId <= 1327))
{
foundskill = true;
}
// exclude hero skills
if (isHero() && (skillId >= 395) && (skillId <= 396))
{
foundskill = true;
}
if (isHero() && (skillId >= 1374) && (skillId <= 1376))
{
foundskill = true;
}
// exclude cursed weapon skills
if (isCursedWeaponEquiped() && (skillId == CursedWeaponsManager.getInstance().getCursedWeapon(_cursedWeaponEquipedId).getSkillId()))
{
foundskill = true;
}
// exclude clan skills
if ((getClan() != null) && (skillId >= 370) && (skillId <= 391))
{
foundskill = true;
}
// exclude seal of ruler / build siege hq
if ((getClan() != null) && ((skillId == 246) || (skillId == 247)) && (getClan().getLeaderId() == getObjectId()))
{
foundskill = true;
}
// exclude fishing skills and common skills + dwarfen craft
if ((skillId >= 1312) && (skillId <= 1322))
{
foundskill = true;
}
if ((skillId >= 1368) && (skillId <= 1373))
{
foundskill = true;
}
// exclude sa / enchant bonus / penality etc. skills
if ((skillId >= 3000) && (skillId < 7000))
{
foundskill = true;
}
// exclude Skills from AllowedSkills in options.ini
if (Config.ALLOWED_SKILLS_LIST.contains(skillId))
{
foundskill = true;
}
// exclude Donator character
if (isDonator())
{
foundskill = true;
}
// exclude Aio character
if (isAio())
{
foundskill = true;
}
// remove skill and do a lil LOGGER message
if (!foundskill)
{
removeSkill(skill);
}
}
// Update skill list
sendSkillList();
if (!foundskill)
{
// Exclude noble skills.
if (isNoble() && (((skillId >= 325) && (skillId <= 397)) || ((skillId >= 1323) && (skillId <= 1327))))
{
foundskill = true;
}
// Exclude hero skills.
else if (isHero() && (((skillId >= 395) && (skillId <= 396)) || ((skillId >= 1374) && (skillId <= 1376))))
{
foundskill = true;
}
// Exclude cursed weapon skills.
else if (isCursedWeaponEquiped() && (skillId == CursedWeaponsManager.getInstance().getCursedWeapon(_cursedWeaponEquipedId).getSkillId()))
{
foundskill = true;
}
// Exclude clan skills. Exclude seal of ruler / build siege HQ.
else if ((getClan() != null) && (((skillId >= 370) && (skillId <= 391)) || ((getClan().getLeaderId() == getObjectId()) && ((skillId == 246) || (skillId == 247)))))
{
foundskill = true;
}
// Exclude fishing skills and common skills + dwarfen craft.
else if (((skillId >= 1312) && (skillId <= 1322)) || ((skillId >= 1368) && (skillId <= 1373)))
{
foundskill = true;
}
// Exclude AS / enchant bonus / penalty etc skills.
else if ((skillId >= 3000) && (skillId < 7000))
{
foundskill = true;
}
// Exclude Skills from AllowedSkills in custom/Other.ini
else if (Config.ALLOWED_SKILLS_LIST.contains(skillId))
{
foundskill = true;
}
// Exclude Donator character.
else if (isDonator())
{
foundskill = true;
}
// Exclude Aio character.
else if (isAio())
{
foundskill = true;
}
}
// Remove skill.
if (!foundskill)
{
removeSkill(skill);
}
}
// Update skill list.
sendSkillList();
}
/**
@@ -9881,7 +9859,7 @@ public class PlayerInstance extends Playable
if (skill.isToggle())
{
// Like L2OFF you can't use fake death if you are mounted
if ((skill.getId() == 60) && isMounted())
if ((skill.getId() == 60 /* Fake Death */) && isMounted())
{
return;
}
@@ -9901,7 +9879,7 @@ public class PlayerInstance extends Playable
if (effect != null)
{
// fake death exception
if (skill.getId() != 60)
if (skill.getId() != 60 /* Fake Death */)
{
effect.exit(false);
}
@@ -9949,14 +9927,8 @@ public class PlayerInstance extends Playable
// Check if skill is in reuse time
if (isSkillDisabled(skill))
{
if ((skill.getId() != 2166))
{
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_IS_NOT_AVAILABLE_AT_THIS_TIME_BEING_PREPARED_FOR_REUSE);
sm.addSkillName(skill.getId(), skill.getLevel());
sendPacket(sm);
}
// Cp potion message like L2OFF
else if ((skill.getId() == 2166))
if ((skill.getId() == 2166 /* CP Gauge Potion */))
{
if (skill.getLevel() == 2)
{
@@ -9967,6 +9939,12 @@ public class PlayerInstance extends Playable
sendMessage("CP Potion is not available at this time: being prepared for reuse.");
}
}
else
{
final SystemMessage sm = new SystemMessage(SystemMessageId.S1_IS_NOT_AVAILABLE_AT_THIS_TIME_BEING_PREPARED_FOR_REUSE);
sm.addSkillName(skill.getId(), skill.getLevel());
sendPacket(sm);
}
sendPacket(ActionFailed.STATIC_PACKET);
return;
@@ -10236,8 +10214,9 @@ public class PlayerInstance extends Playable
// Check if this is offensive magic skill
if (skill.isOffensive())
{
if (isInsidePeaceZone(this, target) && ((skill.getId() != 3261) // Like L2OFF you can use cupid bow skills on peace zone
&& (skill.getId() != 3260) && (skill.getId() != 3262) && (sklTargetType != SkillTargetType.TARGET_AURA))) // Like L2OFF people can use TARGET_AURE skills on peace zone
if (isInsidePeaceZone(this, target) // Like L2OFF you can use cupid bow skills on peace zone
&& ((skill.getId() != 3260 /* Forgiveness */) && (skill.getId() != 3261 /* Heart Shot */) && (skill.getId() != 3262 /* Double Heart Shot */) //
&& (sklTargetType != SkillTargetType.TARGET_AURA))) // Like L2OFF people can use TARGET_AURE skills on peace zone
{
// If Creature or target is in a peace zone, send a system message TARGET_IN_PEACEZONE a Server->Client packet ActionFailed
sendPacket(SystemMessageId.YOU_MAY_NOT_ATTACK_THIS_TARGET_IN_A_PEACEFUL_ZONE);
@@ -10258,7 +10237,18 @@ public class PlayerInstance extends Playable
}
// Check if a Forced ATTACK is in progress on non-attackable target
if (!target.isAutoAttackable(this) && (!forceUse && ((skill.getId() != 3261) && (skill.getId() != 3260) && (skill.getId() != 3262))) && (!_inEventTvT || !TvT.isStarted()) && (!_inEventDM || !DM.hasStarted()) && (!_inEventCTF || !CTF.isStarted()) && (!_inEventVIP || !VIP._started) && (sklTargetType != SkillTargetType.TARGET_AURA) && (sklTargetType != SkillTargetType.TARGET_CLAN) && (sklTargetType != SkillTargetType.TARGET_ALLY) && (sklTargetType != SkillTargetType.TARGET_PARTY) && (sklTargetType != SkillTargetType.TARGET_SELF) && (sklTargetType != SkillTargetType.TARGET_GROUND))
if (!target.isAutoAttackable(this) //
&& (!forceUse && ((skill.getId() != 3260 /* Forgiveness */) && (skill.getId() != 3261 /* Heart Shot */) && (skill.getId() != 3262 /* Double Heart Shot */))) //
&& (!_inEventTvT || !TvT.isStarted()) //
&& (!_inEventDM || !DM.hasStarted()) //
&& (!_inEventCTF || !CTF.isStarted()) //
&& (!_inEventVIP || !VIP._started) //
&& (sklTargetType != SkillTargetType.TARGET_AURA) //
&& (sklTargetType != SkillTargetType.TARGET_CLAN) //
&& (sklTargetType != SkillTargetType.TARGET_ALLY) //
&& (sklTargetType != SkillTargetType.TARGET_PARTY) //
&& (sklTargetType != SkillTargetType.TARGET_SELF) //
&& (sklTargetType != SkillTargetType.TARGET_GROUND))
{
// Send a Server->Client packet ActionFailed to the PlayerInstance
sendPacket(ActionFailed.STATIC_PACKET);
@@ -10381,7 +10371,8 @@ public class PlayerInstance extends Playable
default:
{
// if pvp skill is not allowed for given target
if (!checkPvpSkill(target, skill) && !getAccessLevel().allowPeaceAttack() && ((skill.getId() != 3261) && (skill.getId() != 3260) && (skill.getId() != 3262)))
if (!checkPvpSkill(target, skill) && !getAccessLevel().allowPeaceAttack() //
&& ((skill.getId() != 3260 /* Forgiveness */) && (skill.getId() != 3261 /* Heart Shot */) && (skill.getId() != 3262 /* Double Heart Shot */)))
{
// Send a System Message to the PlayerInstance
sendPacket(SystemMessageId.THAT_IS_THE_INCORRECT_TARGET);
@@ -12021,9 +12012,10 @@ public class PlayerInstance extends Playable
continue;
}
// Fake skills to change base stats.
if (s.getId() > 9000)
{
continue; // Fake skills to change base stats
continue;
}
if (s.bestowed())
@@ -14466,7 +14458,7 @@ public class PlayerInstance extends Playable
int skillLevel = getSkillLevel(1315);
for (Effect e : effects)
{
if (e.getSkill().getId() == 2274)
if (e.getSkill().getId() == 2274 /* Fisherman's Potion */)
{
skillLevel = (int) e.getSkill().getPower(this);
}
@@ -14959,7 +14951,7 @@ public class PlayerInstance extends Playable
{
for (Skill skill : getAllSkills())
{
if ((skill != null) && skill.isActive() && (skill.getId() != 1324))
if ((skill != null) && skill.isActive() && (skill.getId() != 1324 /* Summon CP Potion */))
{
enableSkill(skill);
}