Removal of AltPlayerProtectionLevel configuration.

Contributed by G-hamsteR.
This commit is contained in:
MobiusDevelopment 2020-08-28 10:46:13 +00:00
parent 0667ad1f10
commit 54f429504a
6 changed files with 78 additions and 336 deletions

View File

@ -161,11 +161,6 @@ SpawnZ = -3414
# Default: True
AllowRaidBossPetrified = True
# Newbie player PK/PVP protection.
# When is set to 39, then players level 1-39 cannot attack or be attacked by level 40+.
# Retail: 0
AltPlayerProtectionLevel = 0
# PvP only in the same grade (0-19, 20-39, 40-51, 52-60, 61-76, 76-85).
# Default: False
AllowLowLvlProtect = False

View File

@ -651,7 +651,6 @@ public class Config
public static int HERO_COUNT;
public static int CRUMA_TOWER_LEVEL_RESTRICT;
public static boolean ALLOW_RAID_BOSS_PETRIFIED;
public static int ALT_PLAYER_PROTECTION_LEVEL;
public static boolean ALLOW_LOW_LEVEL_TRADE;
public static boolean USE_CHAT_FILTER;
public static int MONSTER_RETURN_DELAY;
@ -1886,7 +1885,6 @@ public class Config
HERO_COUNT = customServerConfig.getInt("HeroCount", 1);
CRUMA_TOWER_LEVEL_RESTRICT = customServerConfig.getInt("CrumaTowerLevelRestrict", 56);
ALLOW_RAID_BOSS_PETRIFIED = customServerConfig.getBoolean("AllowRaidBossPetrified", true);
ALT_PLAYER_PROTECTION_LEVEL = customServerConfig.getInt("AltPlayerProtectionLevel", 0);
MONSTER_RETURN_DELAY = customServerConfig.getInt("MonsterReturnDelay", 1200);
SCROLL_STACKABLE = customServerConfig.getBoolean("ScrollStackable", false);
ALLOW_CHAR_KILL_PROTECT = customServerConfig.getBoolean("AllowLowLvlProtect", false);

View File

@ -628,7 +628,7 @@ public class PlayerInstance extends Playable
*/
public void doPickupItem(WorldObject object)
{
PlayerInstance.this.doPickupItem(object);
this.doPickupItem(object);
}
/**
@ -637,13 +637,13 @@ public class PlayerInstance extends Playable
*/
public void doInteract(Creature target)
{
PlayerInstance.this.doInteract(target);
this.doInteract(target);
}
@Override
public void doAttack(Creature target)
{
if (isInsidePeaceZone(PlayerInstance.this, target))
if (Creature.isInsidePeaceZone(PlayerInstance.this, target))
{
sendPacket(ActionFailed.STATIC_PACKET);
return;
@ -657,11 +657,17 @@ public class PlayerInstance extends Playable
}
// Pk protection config
if (!isGM() && (target instanceof PlayerInstance) && (((PlayerInstance) target).getPvpFlag() == 0) && (((PlayerInstance) target).getKarma() == 0) && ((getLevel() < Config.ALT_PLAYER_PROTECTION_LEVEL) || (target.getLevel() < Config.ALT_PLAYER_PROTECTION_LEVEL)))
if (Config.ALLOW_CHAR_KILL_PROTECT && !isGM() && target.isPlayer() && (target.getActingPlayer().getPvpFlag() == 0) && (target.getActingPlayer().getKarma() == 0))
{
sendMessage("You can't hit a player that is lower level from you. Target's level: " + Config.ALT_PLAYER_PROTECTION_LEVEL + ".");
sendPacket(ActionFailed.STATIC_PACKET);
return;
final int thisLevel = getLevel();
final int targetLevel = target.getActingPlayer().getLevel();
final Siege siege = SiegeManager.getInstance().getSiege(PlayerInstance.this);
if ((((siege == null) || !siege.isInProgress()) && ((thisLevel >= 20) && (targetLevel < 20))) || ((thisLevel >= 40) && (targetLevel < 40)) || ((thisLevel >= 52) && (targetLevel < 52)) || ((thisLevel >= 61) && (targetLevel < 61)) || ((thisLevel >= 76) && (targetLevel < 76)))
{
sendMessage("You can only engage in PvP if your target is in your level grade.");
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
}
super.doAttack(target);
@ -4360,73 +4366,6 @@ public class PlayerInstance extends Playable
}
else if (isAutoAttackable(player))
{
if (Config.ALLOW_CHAR_KILL_PROTECT)
{
final Siege siege = SiegeManager.getInstance().getSiege(player);
if ((siege != null) && siege.isInProgress())
{
if ((player.getLevel() > 20) && (((Creature) player.getTarget()).getLevel() < 20))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() > 40) && (((Creature) player.getTarget()).getLevel() < 40))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() > 52) && (((Creature) player.getTarget()).getLevel() < 52))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() > 61) && (((Creature) player.getTarget()).getLevel() < 61))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() > 76) && (((Creature) player.getTarget()).getLevel() < 76))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() < 20) && (((Creature) player.getTarget()).getLevel() > 20))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() < 40) && (((Creature) player.getTarget()).getLevel() > 40))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() < 52) && (((Creature) player.getTarget()).getLevel() > 52))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() < 61) && (((Creature) player.getTarget()).getLevel() > 61))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() < 76) && (((Creature) player.getTarget()).getLevel() > 76))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
}
}
if (Config.PATHFINDING)
{
if (GeoEngine.getInstance().canSeeTarget(player, this))
@ -4539,73 +4478,6 @@ public class PlayerInstance extends Playable
}
else if (isAutoAttackable(player))
{
if (Config.ALLOW_CHAR_KILL_PROTECT)
{
final Siege siege = SiegeManager.getInstance().getSiege(player);
if ((siege != null) && siege.isInProgress())
{
if ((player.getLevel() > 20) && (((Creature) player.getTarget()).getLevel() < 20))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() > 40) && (((Creature) player.getTarget()).getLevel() < 40))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() > 52) && (((Creature) player.getTarget()).getLevel() < 52))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() > 61) && (((Creature) player.getTarget()).getLevel() < 61))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() > 76) && (((Creature) player.getTarget()).getLevel() < 76))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() < 20) && (((Creature) player.getTarget()).getLevel() > 20))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() < 40) && (((Creature) player.getTarget()).getLevel() > 40))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() < 52) && (((Creature) player.getTarget()).getLevel() > 52))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() < 61) && (((Creature) player.getTarget()).getLevel() > 61))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() < 76) && (((Creature) player.getTarget()).getLevel() > 76))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
}
}
if (Config.PATHFINDING)
{
if (GeoEngine.getInstance().canSeeTarget(player, this))
@ -5696,7 +5568,7 @@ public class PlayerInstance extends Playable
{
if (answer == 1)
{
CoupleManager.getInstance().createCouple(ptarget, PlayerInstance.this);
CoupleManager.getInstance().createCouple(ptarget, this);
ptarget.sendMessage("Request to Engage has been >ACCEPTED<");
}
else
@ -9968,13 +9840,13 @@ public class PlayerInstance extends Playable
// Like L2OFF you can't heal random purple people without using CTRL
final SkillUseHolder skillUseHolder = getCurrentSkill();
if ((skillUseHolder != null) && (skill.getSkillType() == SkillType.HEAL) && !skillUseHolder.isCtrlPressed() && (target instanceof PlayerInstance) && (((PlayerInstance) target).getPvpFlag() == 1) && (this != target))
if ((skillUseHolder != null) && (skill.getSkillType() == SkillType.HEAL) && !skillUseHolder.isCtrlPressed() && (target instanceof PlayerInstance) && (target.getActingPlayer().getPvpFlag() == 1) && (this != target))
{
if (((getClanId() == 0) || (((PlayerInstance) target).getClanId() == 0)) || (getClanId() != ((PlayerInstance) target).getClanId()))
if (((getClanId() == 0) || (target.getActingPlayer().getClanId() == 0)) || (getClanId() != target.getActingPlayer().getClanId()))
{
if (((getAllyId() == 0) || (((PlayerInstance) target).getAllyId() == 0)) || (getAllyId() != ((PlayerInstance) target).getAllyId()))
if (((getAllyId() == 0) || (target.getActingPlayer().getAllyId() == 0)) || (getAllyId() != target.getActingPlayer().getAllyId()))
{
if (((getParty() == null) || (((PlayerInstance) target).getParty() == null)) || (!getParty().equals(((PlayerInstance) target).getParty())))
if (((getParty() == null) || (target.getActingPlayer().getParty() == null)) || (!getParty().equals(target.getActingPlayer().getParty())))
{
sendPacket(SystemMessageId.INVALID_TARGET);
sendPacket(ActionFailed.STATIC_PACKET);
@ -9985,11 +9857,17 @@ public class PlayerInstance extends Playable
}
// Pk protection config
if (skill.isOffensive() && !isGM() && (target instanceof PlayerInstance) && (((PlayerInstance) target).getPvpFlag() == 0) && (((PlayerInstance) target).getKarma() == 0) && ((getLevel() < Config.ALT_PLAYER_PROTECTION_LEVEL) || (((PlayerInstance) target).getLevel() < Config.ALT_PLAYER_PROTECTION_LEVEL)))
if (Config.ALLOW_CHAR_KILL_PROTECT && skill.isOffensive() && !isGM() && target.isPlayer() && (target.getActingPlayer().getPvpFlag() == 0) && (target.getActingPlayer().getKarma() == 0))
{
sendMessage("You can't hit a player that is lower level from you. Target's level: " + Config.ALT_PLAYER_PROTECTION_LEVEL + ".");
sendPacket(ActionFailed.STATIC_PACKET);
return;
final int thisLevel = getLevel();
final int targetLevel = target.getActingPlayer().getLevel();
final Siege siege = SiegeManager.getInstance().getSiege(this);
if ((((siege == null) || !siege.isInProgress()) && ((thisLevel >= 20) && (targetLevel < 20))) || ((thisLevel >= 40) && (targetLevel < 40)) || ((thisLevel >= 52) && (targetLevel < 52)) || ((thisLevel >= 61) && (targetLevel < 61)) || ((thisLevel >= 76) && (targetLevel < 76)))
{
sendMessage("You can only engage in PvP if your target is in your level grade.");
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
}
// ************************************* Check skill availability *******************************************
@ -10381,7 +10259,7 @@ public class PlayerInstance extends Playable
// Check if player and target are in events and on the same team.
if (target instanceof PlayerInstance)
{
if ((skill.isOffensive() && (_inEventTvT && ((PlayerInstance) target)._inEventTvT && TvT.isStarted() && !_teamNameTvT.equals(((PlayerInstance) target)._teamNameTvT))) || (_inEventCTF && ((PlayerInstance) target)._inEventCTF && CTF.isStarted() && !_teamNameCTF.equals(((PlayerInstance) target)._teamNameCTF)) || (_inEventDM && ((PlayerInstance) target)._inEventDM && DM.hasStarted()) || (_inEventVIP && ((PlayerInstance) target)._inEventVIP && VIP._started))
if ((skill.isOffensive() && (_inEventTvT && target.getActingPlayer()._inEventTvT && TvT.isStarted() && !_teamNameTvT.equals(target.getActingPlayer()._teamNameTvT))) || (_inEventCTF && target.getActingPlayer()._inEventCTF && CTF.isStarted() && !_teamNameCTF.equals(target.getActingPlayer()._teamNameCTF)) || (_inEventDM && target.getActingPlayer()._inEventDM && DM.hasStarted()) || (_inEventVIP && target.getActingPlayer()._inEventVIP && VIP._started))
{
return true;
}
@ -10401,29 +10279,29 @@ public class PlayerInstance extends Playable
(target != this) && // target is not self and
(target instanceof PlayerInstance) && // target is PlayerInstance and
!isInsideZone(ZoneId.PVP) && // Pc is not in PvP zone
!((PlayerInstance) target).isInsideZone(ZoneId.PVP)) // target is not in PvP zone
!target.getActingPlayer().isInsideZone(ZoneId.PVP)) // target is not in PvP zone
{
final SkillUseHolder skillUseHolder = getCurrentSkill();
if (skill.isPvpSkill()) // pvp skill
{
if ((getClan() != null) && (((PlayerInstance) target).getClan() != null) && getClan().isAtWarWith(((PlayerInstance) target).getClan().getClanId()) && ((PlayerInstance) target).getClan().isAtWarWith(getClan().getClanId()))
if ((getClan() != null) && (target.getActingPlayer().getClan() != null) && getClan().isAtWarWith(target.getActingPlayer().getClan().getClanId()) && target.getActingPlayer().getClan().isAtWarWith(getClan().getClanId()))
{
return true; // in clan war player can attack whites even with sleep etc.
}
if ((((PlayerInstance) target).getPvpFlag() == 0) && // target's pvp flag is not set and
(((PlayerInstance) target).getKarma() == 0)) // target has no karma
if ((target.getActingPlayer().getPvpFlag() == 0) && // target's pvp flag is not set and
(target.getActingPlayer().getKarma() == 0)) // target has no karma
{
return false;
}
}
else if ((skillUseHolder != null) && !skillUseHolder.isCtrlPressed() && skill.isOffensive() && !srcIsSummon)
{
if ((getClan() != null) && (((PlayerInstance) target).getClan() != null) && getClan().isAtWarWith(((PlayerInstance) target).getClan().getClanId()) && ((PlayerInstance) target).getClan().isAtWarWith(getClan().getClanId()))
if ((getClan() != null) && (target.getActingPlayer().getClan() != null) && getClan().isAtWarWith(target.getActingPlayer().getClan().getClanId()) && target.getActingPlayer().getClan().isAtWarWith(getClan().getClanId()))
{
return true; // in clan war player can attack whites even without ctrl
}
if ((((PlayerInstance) target).getPvpFlag() == 0) && // target's pvp flag is not set and
(((PlayerInstance) target).getKarma() == 0)) // target has no karma
if ((target.getActingPlayer().getPvpFlag() == 0) && // target's pvp flag is not set and
(target.getActingPlayer().getKarma() == 0)) // target has no karma
{
return false;
}
@ -11116,7 +10994,7 @@ public class PlayerInstance extends Playable
if (!_observerMode)
{
LOGGER.warning("Player " + getName() + " request leave observer mode when he not use it!");
Util.handleIllegalPlayerAction(PlayerInstance.this, "Warning!! Character " + getName() + " tried to cheat in observer mode.", Config.DEFAULT_PUNISH);
Util.handleIllegalPlayerAction(this, "Warning!! Character " + getName() + " tried to cheat in observer mode.", Config.DEFAULT_PUNISH);
}
setTarget(null);
setXYZ(_obsX, _obsY, _obsZ);
@ -14708,7 +14586,7 @@ public class PlayerInstance extends Playable
}
if (isInOlympiadMode() && (target instanceof PlayerInstance) && ((PlayerInstance) target).isInOlympiadMode() && (((PlayerInstance) target).getOlympiadGameId() == getOlympiadGameId()))
if (isInOlympiadMode() && (target instanceof PlayerInstance) && target.getActingPlayer().isInOlympiadMode() && (target.getActingPlayer().getOlympiadGameId() == getOlympiadGameId()))
{
Olympiad.getInstance().notifyCompetitorDamage(this, damage, getOlympiadGameId());
}

View File

@ -161,11 +161,6 @@ SpawnZ = -3414
# Default: True
AllowRaidBossPetrified = True
# Newbie player PK/PVP protection.
# When is set to 39, then players level 1-39 cannot attack or be attacked by level 40+.
# Retail: 0
AltPlayerProtectionLevel = 0
# PvP only in the same grade (0-19, 20-39, 40-51, 52-60, 61-76, 76-85).
# Default: False
AllowLowLvlProtect = False

View File

@ -673,7 +673,6 @@ public class Config
public static int HERO_COUNT;
public static int CRUMA_TOWER_LEVEL_RESTRICT;
public static boolean ALLOW_RAID_BOSS_PETRIFIED;
public static int ALT_PLAYER_PROTECTION_LEVEL;
public static boolean ALLOW_LOW_LEVEL_TRADE;
public static boolean USE_CHAT_FILTER;
public static int MONSTER_RETURN_DELAY;
@ -1939,7 +1938,6 @@ public class Config
HERO_COUNT = customServerConfig.getInt("HeroCount", 1);
CRUMA_TOWER_LEVEL_RESTRICT = customServerConfig.getInt("CrumaTowerLevelRestrict", 56);
ALLOW_RAID_BOSS_PETRIFIED = customServerConfig.getBoolean("AllowRaidBossPetrified", true);
ALT_PLAYER_PROTECTION_LEVEL = customServerConfig.getInt("AltPlayerProtectionLevel", 0);
MONSTER_RETURN_DELAY = customServerConfig.getInt("MonsterReturnDelay", 1200);
SCROLL_STACKABLE = customServerConfig.getBoolean("ScrollStackable", false);
ALLOW_CHAR_KILL_PROTECT = customServerConfig.getBoolean("AllowLowLvlProtect", false);

View File

@ -642,7 +642,7 @@ public class PlayerInstance extends Playable
*/
public void doPickupItem(WorldObject object)
{
PlayerInstance.this.doPickupItem(object);
this.doPickupItem(object);
}
/**
@ -651,7 +651,7 @@ public class PlayerInstance extends Playable
*/
public void doInteract(Creature target)
{
PlayerInstance.this.doInteract(target);
this.doInteract(target);
}
@Override
@ -671,11 +671,17 @@ public class PlayerInstance extends Playable
}
// Pk protection config
if (!isGM() && (target instanceof PlayerInstance) && (((PlayerInstance) target).getPvpFlag() == 0) && (((PlayerInstance) target).getKarma() == 0) && ((getLevel() < Config.ALT_PLAYER_PROTECTION_LEVEL) || (target.getLevel() < Config.ALT_PLAYER_PROTECTION_LEVEL)))
if (Config.ALLOW_CHAR_KILL_PROTECT && !isGM() && target.isPlayer() && (target.getActingPlayer().getPvpFlag() == 0) && (target.getActingPlayer().getKarma() == 0))
{
sendMessage("You can't hit a player that is lower level from you. Target's level: " + Config.ALT_PLAYER_PROTECTION_LEVEL + ".");
sendPacket(ActionFailed.STATIC_PACKET);
return;
final int thisLevel = getLevel();
final int targetLevel = target.getActingPlayer().getLevel();
final Siege siege = SiegeManager.getInstance().getSiege(PlayerInstance.this);
if ((((siege == null) || !siege.isInProgress()) && ((thisLevel >= 20) && (targetLevel < 20))) || ((thisLevel >= 40) && (targetLevel < 40)) || ((thisLevel >= 52) && (targetLevel < 52)) || ((thisLevel >= 61) && (targetLevel < 61)) || ((thisLevel >= 76) && (targetLevel < 76)))
{
sendMessage("You can only engage in PvP if your target is in your level grade.");
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
}
super.doAttack(target);
@ -4436,73 +4442,6 @@ public class PlayerInstance extends Playable
}
else if (isAutoAttackable(player))
{
if (Config.ALLOW_CHAR_KILL_PROTECT)
{
final Siege siege = SiegeManager.getInstance().getSiege(player);
if ((siege != null) && siege.isInProgress())
{
if ((player.getLevel() > 20) && (((Creature) player.getTarget()).getLevel() < 20))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() > 40) && (((Creature) player.getTarget()).getLevel() < 40))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() > 52) && (((Creature) player.getTarget()).getLevel() < 52))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() > 61) && (((Creature) player.getTarget()).getLevel() < 61))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() > 76) && (((Creature) player.getTarget()).getLevel() < 76))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() < 20) && (((Creature) player.getTarget()).getLevel() > 20))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() < 40) && (((Creature) player.getTarget()).getLevel() > 40))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() < 52) && (((Creature) player.getTarget()).getLevel() > 52))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() < 61) && (((Creature) player.getTarget()).getLevel() > 61))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() < 76) && (((Creature) player.getTarget()).getLevel() > 76))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
}
}
// Player with lvl < 21 can't attack a cursed weapon holder
// And a cursed weapon holder can't attack players with lvl < 21
if ((isCursedWeaponEquiped() && (player.getLevel() < 21)) || (player.isCursedWeaponEquiped() && (getLevel() < 21)))
@ -4621,73 +4560,6 @@ public class PlayerInstance extends Playable
}
else if (isAutoAttackable(player))
{
if (Config.ALLOW_CHAR_KILL_PROTECT)
{
final Siege siege = SiegeManager.getInstance().getSiege(player);
if ((siege != null) && siege.isInProgress())
{
if ((player.getLevel() > 20) && (((Creature) player.getTarget()).getLevel() < 20))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() > 40) && (((Creature) player.getTarget()).getLevel() < 40))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() > 52) && (((Creature) player.getTarget()).getLevel() < 52))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() > 61) && (((Creature) player.getTarget()).getLevel() < 61))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() > 76) && (((Creature) player.getTarget()).getLevel() < 76))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() < 20) && (((Creature) player.getTarget()).getLevel() > 20))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() < 40) && (((Creature) player.getTarget()).getLevel() > 40))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() < 52) && (((Creature) player.getTarget()).getLevel() > 52))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() < 61) && (((Creature) player.getTarget()).getLevel() > 61))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
if ((player.getLevel() < 76) && (((Creature) player.getTarget()).getLevel() > 76))
{
player.sendMessage("Your target is not in your grade!");
player.sendPacket(ActionFailed.STATIC_PACKET);
}
}
}
// Player with lvl < 21 can't attack a cursed weapon holder
// And a cursed weapon holder can't attack players with lvl < 21
if ((isCursedWeaponEquiped() && (player.getLevel() < 21)) || (player.isCursedWeaponEquiped() && (getLevel() < 21)))
@ -5793,7 +5665,7 @@ public class PlayerInstance extends Playable
{
if (answer == 1)
{
CoupleManager.getInstance().createCouple(ptarget, PlayerInstance.this);
CoupleManager.getInstance().createCouple(ptarget, this);
ptarget.sendMessage("Request to Engage has been >ACCEPTED<");
}
else
@ -6289,7 +6161,7 @@ public class PlayerInstance extends Playable
return;
}
// If in duel and you kill (only can kill l2summon), do nothing
// If in duel and you kill (only can kill summon), do nothing
if (isInDuel() && targetPlayer.isInDuel())
{
return;
@ -10130,13 +10002,13 @@ public class PlayerInstance extends Playable
// Like L2OFF you can't heal random purple people without using CTRL
final SkillUseHolder skillUseHolder = getCurrentSkill();
if ((skillUseHolder != null) && (skill.getSkillType() == SkillType.HEAL) && !skillUseHolder.isCtrlPressed() && (target instanceof PlayerInstance) && (((PlayerInstance) target).getPvpFlag() == 1) && (this != target))
if ((skillUseHolder != null) && (skill.getSkillType() == SkillType.HEAL) && !skillUseHolder.isCtrlPressed() && (target instanceof PlayerInstance) && (target.getActingPlayer().getPvpFlag() == 1) && (this != target))
{
if (((getClanId() == 0) || (((PlayerInstance) target).getClanId() == 0)) || (getClanId() != ((PlayerInstance) target).getClanId()))
if (((getClanId() == 0) || (target.getActingPlayer().getClanId() == 0)) || (getClanId() != target.getActingPlayer().getClanId()))
{
if (((getAllyId() == 0) || (((PlayerInstance) target).getAllyId() == 0)) || (getAllyId() != ((PlayerInstance) target).getAllyId()))
if (((getAllyId() == 0) || (target.getActingPlayer().getAllyId() == 0)) || (getAllyId() != target.getActingPlayer().getAllyId()))
{
if (((getParty() == null) || (((PlayerInstance) target).getParty() == null)) || (!getParty().equals(((PlayerInstance) target).getParty())))
if (((getParty() == null) || (target.getActingPlayer().getParty() == null)) || (!getParty().equals(target.getActingPlayer().getParty())))
{
sendPacket(SystemMessageId.INVALID_TARGET);
sendPacket(ActionFailed.STATIC_PACKET);
@ -10147,7 +10019,7 @@ public class PlayerInstance extends Playable
}
// Are the target and the player in the same duel?
if (isInDuel() && (!(target instanceof PlayerInstance) || (((PlayerInstance) target).getDuelId() != getDuelId())) && (!(target instanceof SummonInstance) || (((Summon) target).getOwner().getDuelId() != getDuelId())))
if (isInDuel() && (!(target instanceof PlayerInstance) || (target.getActingPlayer().getDuelId() != getDuelId())) && (!(target instanceof SummonInstance) || (((Summon) target).getOwner().getDuelId() != getDuelId())))
{
sendMessage("You cannot do this while duelling.");
sendPacket(ActionFailed.STATIC_PACKET);
@ -10155,11 +10027,17 @@ public class PlayerInstance extends Playable
}
// Pk protection config
if (skill.isOffensive() && !isGM() && (target instanceof PlayerInstance) && (((PlayerInstance) target).getPvpFlag() == 0) && (((PlayerInstance) target).getKarma() == 0) && ((getLevel() < Config.ALT_PLAYER_PROTECTION_LEVEL) || (((PlayerInstance) target).getLevel() < Config.ALT_PLAYER_PROTECTION_LEVEL)))
if (Config.ALLOW_CHAR_KILL_PROTECT && skill.isOffensive() && !isGM() && (target.isPlayer()) && (target.getActingPlayer().getPvpFlag() == 0) && (target.getActingPlayer().getKarma() == 0))
{
sendMessage("You can't hit a player that is lower level from you. Target's level: " + Config.ALT_PLAYER_PROTECTION_LEVEL + ".");
sendPacket(ActionFailed.STATIC_PACKET);
return;
final int thisLevel = getLevel();
final int targetLevel = target.getActingPlayer().getLevel();
final Siege siege = SiegeManager.getInstance().getSiege(this);
if ((((siege == null) || !siege.isInProgress()) && ((thisLevel >= 20) && (targetLevel < 20))) || ((thisLevel >= 40) && (targetLevel < 40)) || ((thisLevel >= 52) && (targetLevel < 52)) || ((thisLevel >= 61) && (targetLevel < 61)) || ((thisLevel >= 76) && (targetLevel < 76)))
{
sendMessage("You can only engage in PvP if your target is in your level grade.");
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
}
// ************************************* Check skill availability *******************************************
@ -10552,7 +10430,7 @@ public class PlayerInstance extends Playable
// Check if player and target are in events and on the same team.
if (target instanceof PlayerInstance)
{
if ((skill.isOffensive() && (_inEventTvT && ((PlayerInstance) target)._inEventTvT && TvT.isStarted() && !_teamNameTvT.equals(((PlayerInstance) target)._teamNameTvT))) || (_inEventCTF && ((PlayerInstance) target)._inEventCTF && CTF.isStarted() && !_teamNameCTF.equals(((PlayerInstance) target)._teamNameCTF)) || (_inEventDM && ((PlayerInstance) target)._inEventDM && DM.hasStarted()) || (_inEventVIP && ((PlayerInstance) target)._inEventVIP && VIP._started))
if ((skill.isOffensive() && (_inEventTvT && target.getActingPlayer()._inEventTvT && TvT.isStarted() && !_teamNameTvT.equals(target.getActingPlayer()._teamNameTvT))) || (_inEventCTF && target.getActingPlayer()._inEventCTF && CTF.isStarted() && !_teamNameCTF.equals(target.getActingPlayer()._teamNameCTF)) || (_inEventDM && target.getActingPlayer()._inEventDM && DM.hasStarted()) || (_inEventVIP && target.getActingPlayer()._inEventVIP && VIP._started))
{
return true;
}
@ -10571,31 +10449,31 @@ public class PlayerInstance extends Playable
if ((target != null) && // target not null and
(target != this) && // target is not self and
(target instanceof PlayerInstance) && // target is PlayerInstance and
(!isInDuel() || (((PlayerInstance) target).getDuelId() != getDuelId())) && // self is not in a duel and attacking opponent
(!isInDuel() || (target.getActingPlayer().getDuelId() != getDuelId())) && // self is not in a duel and attacking opponent
!isInsideZone(ZoneId.PVP) && // Pc is not in PvP zone
!((PlayerInstance) target).isInsideZone(ZoneId.PVP)) // target is not in PvP zone
!target.getActingPlayer().isInsideZone(ZoneId.PVP)) // target is not in PvP zone
{
final SkillUseHolder skillUseHolder = getCurrentSkill();
if (skill.isPvpSkill()) // pvp skill
{
if ((getClan() != null) && (((PlayerInstance) target).getClan() != null) && getClan().isAtWarWith(((PlayerInstance) target).getClan().getClanId()) && ((PlayerInstance) target).getClan().isAtWarWith(getClan().getClanId()))
if ((getClan() != null) && (target.getActingPlayer().getClan() != null) && getClan().isAtWarWith(target.getActingPlayer().getClan().getClanId()) && target.getActingPlayer().getClan().isAtWarWith(getClan().getClanId()))
{
return true; // in clan war player can attack whites even with sleep etc.
}
if ((((PlayerInstance) target).getPvpFlag() == 0) && // target's pvp flag is not set and
(((PlayerInstance) target).getKarma() == 0)) // target has no karma
if ((target.getActingPlayer().getPvpFlag() == 0) && // target's pvp flag is not set and
(target.getActingPlayer().getKarma() == 0)) // target has no karma
{
return false;
}
}
else if ((skillUseHolder != null) && !skillUseHolder.isCtrlPressed() && skill.isOffensive() && !srcIsSummon)
{
if ((getClan() != null) && (((PlayerInstance) target).getClan() != null) && getClan().isAtWarWith(((PlayerInstance) target).getClan().getClanId()) && ((PlayerInstance) target).getClan().isAtWarWith(getClan().getClanId()))
if ((getClan() != null) && (target.getActingPlayer().getClan() != null) && getClan().isAtWarWith(target.getActingPlayer().getClan().getClanId()) && target.getActingPlayer().getClan().isAtWarWith(getClan().getClanId()))
{
return true; // in clan war player can attack whites even without ctrl
}
if ((((PlayerInstance) target).getPvpFlag() == 0) && // target's pvp flag is not set and
(((PlayerInstance) target).getKarma() == 0)) // target has no karma
if ((target.getActingPlayer().getPvpFlag() == 0) && // target's pvp flag is not set and
(target.getActingPlayer().getKarma() == 0)) // target has no karma
{
return false;
}
@ -11288,7 +11166,7 @@ public class PlayerInstance extends Playable
if (!_observerMode)
{
LOGGER.warning("Player " + getName() + " request leave observer mode when he not use it!");
Util.handleIllegalPlayerAction(PlayerInstance.this, "Warning!! Character " + getName() + " tried to cheat in observer mode.", Config.DEFAULT_PUNISH);
Util.handleIllegalPlayerAction(this, "Warning!! Character " + getName() + " tried to cheat in observer mode.", Config.DEFAULT_PUNISH);
}
setTarget(null);
setXYZ(_obsX, _obsY, _obsZ);
@ -15065,7 +14943,7 @@ public class PlayerInstance extends Playable
}
if (isInOlympiadMode() && (target instanceof PlayerInstance) && ((PlayerInstance) target).isInOlympiadMode() && (((PlayerInstance) target).getOlympiadGameId() == getOlympiadGameId()))
if (isInOlympiadMode() && (target instanceof PlayerInstance) && target.getActingPlayer().isInOlympiadMode() && (target.getActingPlayer().getOlympiadGameId() == getOlympiadGameId()))
{
Olympiad.getInstance().notifyCompetitorDamage(this, damage, getOlympiadGameId());
}