Force use for summon skills.
This commit is contained in:
@@ -45,92 +45,89 @@ public class NotFriend implements IAffectObjectHandler
|
|||||||
final L2PcInstance player = activeChar.getActingPlayer();
|
final L2PcInstance player = activeChar.getActingPlayer();
|
||||||
final L2PcInstance targetPlayer = target.getActingPlayer();
|
final L2PcInstance targetPlayer = target.getActingPlayer();
|
||||||
|
|
||||||
if (player != null)
|
if ((player != null) && (targetPlayer != null))
|
||||||
{
|
{
|
||||||
if (targetPlayer != null)
|
// Same player.
|
||||||
|
if (player == targetPlayer)
|
||||||
{
|
{
|
||||||
// Same player.
|
return false;
|
||||||
if (player == targetPlayer)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Peace Zone.
|
|
||||||
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Party (command channel doesn't make you friends).
|
|
||||||
final L2Party party = player.getParty();
|
|
||||||
final L2Party targetParty = targetPlayer.getParty();
|
|
||||||
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Arena.
|
|
||||||
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Duel.
|
|
||||||
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Olympiad.
|
|
||||||
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clan.
|
|
||||||
final L2Clan clan = player.getClan();
|
|
||||||
final L2Clan targetClan = targetPlayer.getClan();
|
|
||||||
if (clan != null)
|
|
||||||
{
|
|
||||||
if (clan == targetClan)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// War
|
|
||||||
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alliance.
|
|
||||||
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Siege.
|
|
||||||
if (target.isInsideZone(ZoneId.SIEGE))
|
|
||||||
{
|
|
||||||
// Players in the same siege side at the same castle are considered friends.
|
|
||||||
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point summon should be prevented from attacking friendly targets.
|
|
||||||
if (activeChar.isSummon() && (target == activeChar.getTarget()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// By default any flagged/PK player is considered enemy.
|
|
||||||
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Peace Zone.
|
||||||
|
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Party (command channel doesn't make you friends).
|
||||||
|
final L2Party party = player.getParty();
|
||||||
|
final L2Party targetParty = targetPlayer.getParty();
|
||||||
|
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arena.
|
||||||
|
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Duel.
|
||||||
|
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Olympiad.
|
||||||
|
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clan.
|
||||||
|
final L2Clan clan = player.getClan();
|
||||||
|
final L2Clan targetClan = targetPlayer.getClan();
|
||||||
|
if (clan != null)
|
||||||
|
{
|
||||||
|
if (clan == targetClan)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// War
|
||||||
|
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alliance.
|
||||||
|
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Siege.
|
||||||
|
if (target.isInsideZone(ZoneId.SIEGE))
|
||||||
|
{
|
||||||
|
// Players in the same siege side at the same castle are considered friends.
|
||||||
|
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// At this point summon should be prevented from attacking friendly targets.
|
||||||
|
if (activeChar.isSummon() && (target == activeChar.getTarget()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// By default any flagged/PK player is considered enemy.
|
||||||
|
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return target.isAutoAttackable(activeChar);
|
return target.isAutoAttackable(activeChar);
|
||||||
|
|||||||
@@ -631,7 +631,20 @@ public abstract class L2Summon extends L2Playable
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
final L2Object currentTarget = _owner.getTarget();
|
final L2Object currentTarget = _owner.getTarget();
|
||||||
target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
|
if (currentTarget != null)
|
||||||
|
{
|
||||||
|
target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
|
||||||
|
final L2PcInstance currentTargetPlayer = currentTarget.getActingPlayer();
|
||||||
|
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
|
||||||
|
{
|
||||||
|
sendPacket(SystemMessageId.INVALID_TARGET);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target = skill.getTarget(this, forceUse, dontMove, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the validity of the target
|
// Check the validity of the target
|
||||||
@@ -780,7 +793,7 @@ public abstract class L2Summon extends L2Playable
|
|||||||
@Override
|
@Override
|
||||||
public void doCast(Skill skill)
|
public void doCast(Skill skill)
|
||||||
{
|
{
|
||||||
if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack())
|
if ((skill.getTarget(this, false, false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack())
|
||||||
{
|
{
|
||||||
// Send a System Message to the L2PcInstance
|
// Send a System Message to the L2PcInstance
|
||||||
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
||||||
@@ -790,7 +803,7 @@ public abstract class L2Summon extends L2Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
doCast(skill, null, skill.isBad(), false);
|
super.doCast(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -45,92 +45,89 @@ public class NotFriend implements IAffectObjectHandler
|
|||||||
final L2PcInstance player = activeChar.getActingPlayer();
|
final L2PcInstance player = activeChar.getActingPlayer();
|
||||||
final L2PcInstance targetPlayer = target.getActingPlayer();
|
final L2PcInstance targetPlayer = target.getActingPlayer();
|
||||||
|
|
||||||
if (player != null)
|
if ((player != null) && (targetPlayer != null))
|
||||||
{
|
{
|
||||||
if (targetPlayer != null)
|
// Same player.
|
||||||
|
if (player == targetPlayer)
|
||||||
{
|
{
|
||||||
// Same player.
|
return false;
|
||||||
if (player == targetPlayer)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Peace Zone.
|
|
||||||
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Party (command channel doesn't make you friends).
|
|
||||||
final L2Party party = player.getParty();
|
|
||||||
final L2Party targetParty = targetPlayer.getParty();
|
|
||||||
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Arena.
|
|
||||||
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Duel.
|
|
||||||
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Olympiad.
|
|
||||||
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clan.
|
|
||||||
final L2Clan clan = player.getClan();
|
|
||||||
final L2Clan targetClan = targetPlayer.getClan();
|
|
||||||
if (clan != null)
|
|
||||||
{
|
|
||||||
if (clan == targetClan)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// War
|
|
||||||
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alliance.
|
|
||||||
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Siege.
|
|
||||||
if (target.isInsideZone(ZoneId.SIEGE))
|
|
||||||
{
|
|
||||||
// Players in the same siege side at the same castle are considered friends.
|
|
||||||
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point summon should be prevented from attacking friendly targets.
|
|
||||||
if (activeChar.isSummon() && (target == activeChar.getTarget()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// By default any flagged/PK player is considered enemy.
|
|
||||||
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Peace Zone.
|
||||||
|
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Party (command channel doesn't make you friends).
|
||||||
|
final L2Party party = player.getParty();
|
||||||
|
final L2Party targetParty = targetPlayer.getParty();
|
||||||
|
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arena.
|
||||||
|
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Duel.
|
||||||
|
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Olympiad.
|
||||||
|
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clan.
|
||||||
|
final L2Clan clan = player.getClan();
|
||||||
|
final L2Clan targetClan = targetPlayer.getClan();
|
||||||
|
if (clan != null)
|
||||||
|
{
|
||||||
|
if (clan == targetClan)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// War
|
||||||
|
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alliance.
|
||||||
|
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Siege.
|
||||||
|
if (target.isInsideZone(ZoneId.SIEGE))
|
||||||
|
{
|
||||||
|
// Players in the same siege side at the same castle are considered friends.
|
||||||
|
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// At this point summon should be prevented from attacking friendly targets.
|
||||||
|
if (activeChar.isSummon() && (target == activeChar.getTarget()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// By default any flagged/PK player is considered enemy.
|
||||||
|
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return target.isAutoAttackable(activeChar);
|
return target.isAutoAttackable(activeChar);
|
||||||
|
|||||||
@@ -631,7 +631,20 @@ public abstract class L2Summon extends L2Playable
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
final L2Object currentTarget = _owner.getTarget();
|
final L2Object currentTarget = _owner.getTarget();
|
||||||
target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
|
if (currentTarget != null)
|
||||||
|
{
|
||||||
|
target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
|
||||||
|
final L2PcInstance currentTargetPlayer = currentTarget.getActingPlayer();
|
||||||
|
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
|
||||||
|
{
|
||||||
|
sendPacket(SystemMessageId.INVALID_TARGET);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target = skill.getTarget(this, forceUse, dontMove, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the validity of the target
|
// Check the validity of the target
|
||||||
@@ -780,7 +793,7 @@ public abstract class L2Summon extends L2Playable
|
|||||||
@Override
|
@Override
|
||||||
public void doCast(Skill skill)
|
public void doCast(Skill skill)
|
||||||
{
|
{
|
||||||
if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack())
|
if ((skill.getTarget(this, false, false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack())
|
||||||
{
|
{
|
||||||
// Send a System Message to the L2PcInstance
|
// Send a System Message to the L2PcInstance
|
||||||
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
||||||
@@ -790,7 +803,7 @@ public abstract class L2Summon extends L2Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
doCast(skill, null, skill.isBad(), false);
|
super.doCast(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -45,92 +45,89 @@ public class NotFriend implements IAffectObjectHandler
|
|||||||
final L2PcInstance player = activeChar.getActingPlayer();
|
final L2PcInstance player = activeChar.getActingPlayer();
|
||||||
final L2PcInstance targetPlayer = target.getActingPlayer();
|
final L2PcInstance targetPlayer = target.getActingPlayer();
|
||||||
|
|
||||||
if (player != null)
|
if ((player != null) && (targetPlayer != null))
|
||||||
{
|
{
|
||||||
if (targetPlayer != null)
|
// Same player.
|
||||||
|
if (player == targetPlayer)
|
||||||
{
|
{
|
||||||
// Same player.
|
return false;
|
||||||
if (player == targetPlayer)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Peace Zone.
|
|
||||||
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Party (command channel doesn't make you friends).
|
|
||||||
final L2Party party = player.getParty();
|
|
||||||
final L2Party targetParty = targetPlayer.getParty();
|
|
||||||
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Arena.
|
|
||||||
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Duel.
|
|
||||||
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Olympiad.
|
|
||||||
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clan.
|
|
||||||
final L2Clan clan = player.getClan();
|
|
||||||
final L2Clan targetClan = targetPlayer.getClan();
|
|
||||||
if (clan != null)
|
|
||||||
{
|
|
||||||
if (clan == targetClan)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// War
|
|
||||||
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alliance.
|
|
||||||
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Siege.
|
|
||||||
if (target.isInsideZone(ZoneId.SIEGE))
|
|
||||||
{
|
|
||||||
// Players in the same siege side at the same castle are considered friends.
|
|
||||||
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point summon should be prevented from attacking friendly targets.
|
|
||||||
if (activeChar.isSummon() && (target == activeChar.getTarget()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// By default any flagged/PK player is considered enemy.
|
|
||||||
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Peace Zone.
|
||||||
|
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Party (command channel doesn't make you friends).
|
||||||
|
final L2Party party = player.getParty();
|
||||||
|
final L2Party targetParty = targetPlayer.getParty();
|
||||||
|
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arena.
|
||||||
|
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Duel.
|
||||||
|
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Olympiad.
|
||||||
|
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clan.
|
||||||
|
final L2Clan clan = player.getClan();
|
||||||
|
final L2Clan targetClan = targetPlayer.getClan();
|
||||||
|
if (clan != null)
|
||||||
|
{
|
||||||
|
if (clan == targetClan)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// War
|
||||||
|
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alliance.
|
||||||
|
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Siege.
|
||||||
|
if (target.isInsideZone(ZoneId.SIEGE))
|
||||||
|
{
|
||||||
|
// Players in the same siege side at the same castle are considered friends.
|
||||||
|
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// At this point summon should be prevented from attacking friendly targets.
|
||||||
|
if (activeChar.isSummon() && (target == activeChar.getTarget()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// By default any flagged/PK player is considered enemy.
|
||||||
|
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return target.isAutoAttackable(activeChar);
|
return target.isAutoAttackable(activeChar);
|
||||||
|
|||||||
@@ -631,7 +631,20 @@ public abstract class L2Summon extends L2Playable
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
final L2Object currentTarget = _owner.getTarget();
|
final L2Object currentTarget = _owner.getTarget();
|
||||||
target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
|
if (currentTarget != null)
|
||||||
|
{
|
||||||
|
target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
|
||||||
|
final L2PcInstance currentTargetPlayer = currentTarget.getActingPlayer();
|
||||||
|
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
|
||||||
|
{
|
||||||
|
sendPacket(SystemMessageId.INVALID_TARGET);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target = skill.getTarget(this, forceUse, dontMove, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the validity of the target
|
// Check the validity of the target
|
||||||
@@ -780,7 +793,7 @@ public abstract class L2Summon extends L2Playable
|
|||||||
@Override
|
@Override
|
||||||
public void doCast(Skill skill)
|
public void doCast(Skill skill)
|
||||||
{
|
{
|
||||||
if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack())
|
if ((skill.getTarget(this, false, false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack())
|
||||||
{
|
{
|
||||||
// Send a System Message to the L2PcInstance
|
// Send a System Message to the L2PcInstance
|
||||||
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
||||||
@@ -790,7 +803,7 @@ public abstract class L2Summon extends L2Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
doCast(skill, null, skill.isBad(), false);
|
super.doCast(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -45,92 +45,89 @@ public class NotFriend implements IAffectObjectHandler
|
|||||||
final L2PcInstance player = activeChar.getActingPlayer();
|
final L2PcInstance player = activeChar.getActingPlayer();
|
||||||
final L2PcInstance targetPlayer = target.getActingPlayer();
|
final L2PcInstance targetPlayer = target.getActingPlayer();
|
||||||
|
|
||||||
if (player != null)
|
if ((player != null) && (targetPlayer != null))
|
||||||
{
|
{
|
||||||
if (targetPlayer != null)
|
// Same player.
|
||||||
|
if (player == targetPlayer)
|
||||||
{
|
{
|
||||||
// Same player.
|
return false;
|
||||||
if (player == targetPlayer)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Peace Zone.
|
|
||||||
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Party (command channel doesn't make you friends).
|
|
||||||
final L2Party party = player.getParty();
|
|
||||||
final L2Party targetParty = targetPlayer.getParty();
|
|
||||||
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Arena.
|
|
||||||
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Duel.
|
|
||||||
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Olympiad.
|
|
||||||
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clan.
|
|
||||||
final L2Clan clan = player.getClan();
|
|
||||||
final L2Clan targetClan = targetPlayer.getClan();
|
|
||||||
if (clan != null)
|
|
||||||
{
|
|
||||||
if (clan == targetClan)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// War
|
|
||||||
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alliance.
|
|
||||||
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Siege.
|
|
||||||
if (target.isInsideZone(ZoneId.SIEGE))
|
|
||||||
{
|
|
||||||
// Players in the same siege side at the same castle are considered friends.
|
|
||||||
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point summon should be prevented from attacking friendly targets.
|
|
||||||
if (activeChar.isSummon() && (target == activeChar.getTarget()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// By default any flagged/PK player is considered enemy.
|
|
||||||
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Peace Zone.
|
||||||
|
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Party (command channel doesn't make you friends).
|
||||||
|
final L2Party party = player.getParty();
|
||||||
|
final L2Party targetParty = targetPlayer.getParty();
|
||||||
|
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arena.
|
||||||
|
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Duel.
|
||||||
|
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Olympiad.
|
||||||
|
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clan.
|
||||||
|
final L2Clan clan = player.getClan();
|
||||||
|
final L2Clan targetClan = targetPlayer.getClan();
|
||||||
|
if (clan != null)
|
||||||
|
{
|
||||||
|
if (clan == targetClan)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// War
|
||||||
|
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alliance.
|
||||||
|
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Siege.
|
||||||
|
if (target.isInsideZone(ZoneId.SIEGE))
|
||||||
|
{
|
||||||
|
// Players in the same siege side at the same castle are considered friends.
|
||||||
|
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// At this point summon should be prevented from attacking friendly targets.
|
||||||
|
if (activeChar.isSummon() && (target == activeChar.getTarget()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// By default any flagged/PK player is considered enemy.
|
||||||
|
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return target.isAutoAttackable(activeChar);
|
return target.isAutoAttackable(activeChar);
|
||||||
|
|||||||
@@ -631,7 +631,20 @@ public abstract class L2Summon extends L2Playable
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
final L2Object currentTarget = _owner.getTarget();
|
final L2Object currentTarget = _owner.getTarget();
|
||||||
target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
|
if (currentTarget != null)
|
||||||
|
{
|
||||||
|
target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
|
||||||
|
final L2PcInstance currentTargetPlayer = currentTarget.getActingPlayer();
|
||||||
|
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
|
||||||
|
{
|
||||||
|
sendPacket(SystemMessageId.INVALID_TARGET);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target = skill.getTarget(this, forceUse, dontMove, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the validity of the target
|
// Check the validity of the target
|
||||||
@@ -780,7 +793,7 @@ public abstract class L2Summon extends L2Playable
|
|||||||
@Override
|
@Override
|
||||||
public void doCast(Skill skill)
|
public void doCast(Skill skill)
|
||||||
{
|
{
|
||||||
if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack())
|
if ((skill.getTarget(this, false, false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack())
|
||||||
{
|
{
|
||||||
// Send a System Message to the L2PcInstance
|
// Send a System Message to the L2PcInstance
|
||||||
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
||||||
@@ -790,7 +803,7 @@ public abstract class L2Summon extends L2Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
doCast(skill, null, skill.isBad(), false);
|
super.doCast(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -45,92 +45,89 @@ public class NotFriend implements IAffectObjectHandler
|
|||||||
final L2PcInstance player = activeChar.getActingPlayer();
|
final L2PcInstance player = activeChar.getActingPlayer();
|
||||||
final L2PcInstance targetPlayer = target.getActingPlayer();
|
final L2PcInstance targetPlayer = target.getActingPlayer();
|
||||||
|
|
||||||
if (player != null)
|
if ((player != null) && (targetPlayer != null))
|
||||||
{
|
{
|
||||||
if (targetPlayer != null)
|
// Same player.
|
||||||
|
if (player == targetPlayer)
|
||||||
{
|
{
|
||||||
// Same player.
|
return false;
|
||||||
if (player == targetPlayer)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Peace Zone.
|
|
||||||
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Party (command channel doesn't make you friends).
|
|
||||||
final L2Party party = player.getParty();
|
|
||||||
final L2Party targetParty = targetPlayer.getParty();
|
|
||||||
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Arena.
|
|
||||||
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Duel.
|
|
||||||
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Olympiad.
|
|
||||||
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clan.
|
|
||||||
final L2Clan clan = player.getClan();
|
|
||||||
final L2Clan targetClan = targetPlayer.getClan();
|
|
||||||
if (clan != null)
|
|
||||||
{
|
|
||||||
if (clan == targetClan)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// War
|
|
||||||
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alliance.
|
|
||||||
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Siege.
|
|
||||||
if (target.isInsideZone(ZoneId.SIEGE))
|
|
||||||
{
|
|
||||||
// Players in the same siege side at the same castle are considered friends.
|
|
||||||
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point summon should be prevented from attacking friendly targets.
|
|
||||||
if (activeChar.isSummon() && (target == activeChar.getTarget()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// By default any flagged/PK player is considered enemy.
|
|
||||||
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Peace Zone.
|
||||||
|
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Party (command channel doesn't make you friends).
|
||||||
|
final L2Party party = player.getParty();
|
||||||
|
final L2Party targetParty = targetPlayer.getParty();
|
||||||
|
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arena.
|
||||||
|
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Duel.
|
||||||
|
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Olympiad.
|
||||||
|
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clan.
|
||||||
|
final L2Clan clan = player.getClan();
|
||||||
|
final L2Clan targetClan = targetPlayer.getClan();
|
||||||
|
if (clan != null)
|
||||||
|
{
|
||||||
|
if (clan == targetClan)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// War
|
||||||
|
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alliance.
|
||||||
|
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Siege.
|
||||||
|
if (target.isInsideZone(ZoneId.SIEGE))
|
||||||
|
{
|
||||||
|
// Players in the same siege side at the same castle are considered friends.
|
||||||
|
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// At this point summon should be prevented from attacking friendly targets.
|
||||||
|
if (activeChar.isSummon() && (target == activeChar.getTarget()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// By default any flagged/PK player is considered enemy.
|
||||||
|
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return target.isAutoAttackable(activeChar);
|
return target.isAutoAttackable(activeChar);
|
||||||
|
|||||||
@@ -631,7 +631,20 @@ public abstract class L2Summon extends L2Playable
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
final L2Object currentTarget = _owner.getTarget();
|
final L2Object currentTarget = _owner.getTarget();
|
||||||
target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
|
if (currentTarget != null)
|
||||||
|
{
|
||||||
|
target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
|
||||||
|
final L2PcInstance currentTargetPlayer = currentTarget.getActingPlayer();
|
||||||
|
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
|
||||||
|
{
|
||||||
|
sendPacket(SystemMessageId.INVALID_TARGET);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target = skill.getTarget(this, forceUse, dontMove, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the validity of the target
|
// Check the validity of the target
|
||||||
@@ -780,7 +793,7 @@ public abstract class L2Summon extends L2Playable
|
|||||||
@Override
|
@Override
|
||||||
public void doCast(Skill skill)
|
public void doCast(Skill skill)
|
||||||
{
|
{
|
||||||
if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack())
|
if ((skill.getTarget(this, false, false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack())
|
||||||
{
|
{
|
||||||
// Send a System Message to the L2PcInstance
|
// Send a System Message to the L2PcInstance
|
||||||
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
||||||
@@ -790,7 +803,7 @@ public abstract class L2Summon extends L2Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
doCast(skill, null, skill.isBad(), false);
|
super.doCast(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -45,92 +45,89 @@ public class NotFriend implements IAffectObjectHandler
|
|||||||
final L2PcInstance player = activeChar.getActingPlayer();
|
final L2PcInstance player = activeChar.getActingPlayer();
|
||||||
final L2PcInstance targetPlayer = target.getActingPlayer();
|
final L2PcInstance targetPlayer = target.getActingPlayer();
|
||||||
|
|
||||||
if (player != null)
|
if ((player != null) && (targetPlayer != null))
|
||||||
{
|
{
|
||||||
if (targetPlayer != null)
|
// Same player.
|
||||||
|
if (player == targetPlayer)
|
||||||
{
|
{
|
||||||
// Same player.
|
return false;
|
||||||
if (player == targetPlayer)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Peace Zone.
|
|
||||||
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Party (command channel doesn't make you friends).
|
|
||||||
final L2Party party = player.getParty();
|
|
||||||
final L2Party targetParty = targetPlayer.getParty();
|
|
||||||
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Arena.
|
|
||||||
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Duel.
|
|
||||||
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Olympiad.
|
|
||||||
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clan.
|
|
||||||
final L2Clan clan = player.getClan();
|
|
||||||
final L2Clan targetClan = targetPlayer.getClan();
|
|
||||||
if (clan != null)
|
|
||||||
{
|
|
||||||
if (clan == targetClan)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// War
|
|
||||||
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alliance.
|
|
||||||
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Siege.
|
|
||||||
if (target.isInsideZone(ZoneId.SIEGE))
|
|
||||||
{
|
|
||||||
// Players in the same siege side at the same castle are considered friends.
|
|
||||||
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point summon should be prevented from attacking friendly targets.
|
|
||||||
if (activeChar.isSummon() && (target == activeChar.getTarget()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// By default any flagged/PK player is considered enemy.
|
|
||||||
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Peace Zone.
|
||||||
|
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Party (command channel doesn't make you friends).
|
||||||
|
final L2Party party = player.getParty();
|
||||||
|
final L2Party targetParty = targetPlayer.getParty();
|
||||||
|
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arena.
|
||||||
|
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Duel.
|
||||||
|
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Olympiad.
|
||||||
|
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clan.
|
||||||
|
final L2Clan clan = player.getClan();
|
||||||
|
final L2Clan targetClan = targetPlayer.getClan();
|
||||||
|
if (clan != null)
|
||||||
|
{
|
||||||
|
if (clan == targetClan)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// War
|
||||||
|
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alliance.
|
||||||
|
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Siege.
|
||||||
|
if (target.isInsideZone(ZoneId.SIEGE))
|
||||||
|
{
|
||||||
|
// Players in the same siege side at the same castle are considered friends.
|
||||||
|
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// At this point summon should be prevented from attacking friendly targets.
|
||||||
|
if (activeChar.isSummon() && (target == activeChar.getTarget()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// By default any flagged/PK player is considered enemy.
|
||||||
|
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return target.isAutoAttackable(activeChar);
|
return target.isAutoAttackable(activeChar);
|
||||||
|
|||||||
@@ -631,7 +631,20 @@ public abstract class L2Summon extends L2Playable
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
final L2Object currentTarget = _owner.getTarget();
|
final L2Object currentTarget = _owner.getTarget();
|
||||||
target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
|
if (currentTarget != null)
|
||||||
|
{
|
||||||
|
target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
|
||||||
|
final L2PcInstance currentTargetPlayer = currentTarget.getActingPlayer();
|
||||||
|
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
|
||||||
|
{
|
||||||
|
sendPacket(SystemMessageId.INVALID_TARGET);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target = skill.getTarget(this, forceUse, dontMove, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the validity of the target
|
// Check the validity of the target
|
||||||
@@ -780,7 +793,7 @@ public abstract class L2Summon extends L2Playable
|
|||||||
@Override
|
@Override
|
||||||
public void doCast(Skill skill)
|
public void doCast(Skill skill)
|
||||||
{
|
{
|
||||||
if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack())
|
if ((skill.getTarget(this, false, false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack())
|
||||||
{
|
{
|
||||||
// Send a System Message to the L2PcInstance
|
// Send a System Message to the L2PcInstance
|
||||||
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
||||||
@@ -790,7 +803,7 @@ public abstract class L2Summon extends L2Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
doCast(skill, null, skill.isBad(), false);
|
super.doCast(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -45,92 +45,89 @@ public class NotFriend implements IAffectObjectHandler
|
|||||||
final L2PcInstance player = activeChar.getActingPlayer();
|
final L2PcInstance player = activeChar.getActingPlayer();
|
||||||
final L2PcInstance targetPlayer = target.getActingPlayer();
|
final L2PcInstance targetPlayer = target.getActingPlayer();
|
||||||
|
|
||||||
if (player != null)
|
if ((player != null) && (targetPlayer != null))
|
||||||
{
|
{
|
||||||
if (targetPlayer != null)
|
// Same player.
|
||||||
|
if (player == targetPlayer)
|
||||||
{
|
{
|
||||||
// Same player.
|
return false;
|
||||||
if (player == targetPlayer)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Peace Zone.
|
|
||||||
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Party (command channel doesn't make you friends).
|
|
||||||
final L2Party party = player.getParty();
|
|
||||||
final L2Party targetParty = targetPlayer.getParty();
|
|
||||||
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Arena.
|
|
||||||
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Duel.
|
|
||||||
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Olympiad.
|
|
||||||
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clan.
|
|
||||||
final L2Clan clan = player.getClan();
|
|
||||||
final L2Clan targetClan = targetPlayer.getClan();
|
|
||||||
if (clan != null)
|
|
||||||
{
|
|
||||||
if (clan == targetClan)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// War
|
|
||||||
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alliance.
|
|
||||||
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Siege.
|
|
||||||
if (target.isInsideZone(ZoneId.SIEGE))
|
|
||||||
{
|
|
||||||
// Players in the same siege side at the same castle are considered friends.
|
|
||||||
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point summon should be prevented from attacking friendly targets.
|
|
||||||
if (activeChar.isSummon() && (target == activeChar.getTarget()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// By default any flagged/PK player is considered enemy.
|
|
||||||
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Peace Zone.
|
||||||
|
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Party (command channel doesn't make you friends).
|
||||||
|
final L2Party party = player.getParty();
|
||||||
|
final L2Party targetParty = targetPlayer.getParty();
|
||||||
|
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arena.
|
||||||
|
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Duel.
|
||||||
|
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Olympiad.
|
||||||
|
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clan.
|
||||||
|
final L2Clan clan = player.getClan();
|
||||||
|
final L2Clan targetClan = targetPlayer.getClan();
|
||||||
|
if (clan != null)
|
||||||
|
{
|
||||||
|
if (clan == targetClan)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// War
|
||||||
|
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alliance.
|
||||||
|
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Siege.
|
||||||
|
if (target.isInsideZone(ZoneId.SIEGE))
|
||||||
|
{
|
||||||
|
// Players in the same siege side at the same castle are considered friends.
|
||||||
|
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// At this point summon should be prevented from attacking friendly targets.
|
||||||
|
if (activeChar.isSummon() && (target == activeChar.getTarget()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// By default any flagged/PK player is considered enemy.
|
||||||
|
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return target.isAutoAttackable(activeChar);
|
return target.isAutoAttackable(activeChar);
|
||||||
|
|||||||
@@ -631,7 +631,20 @@ public abstract class L2Summon extends L2Playable
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
final L2Object currentTarget = _owner.getTarget();
|
final L2Object currentTarget = _owner.getTarget();
|
||||||
target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
|
if (currentTarget != null)
|
||||||
|
{
|
||||||
|
target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
|
||||||
|
final L2PcInstance currentTargetPlayer = currentTarget.getActingPlayer();
|
||||||
|
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
|
||||||
|
{
|
||||||
|
sendPacket(SystemMessageId.INVALID_TARGET);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target = skill.getTarget(this, forceUse, dontMove, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the validity of the target
|
// Check the validity of the target
|
||||||
@@ -780,7 +793,7 @@ public abstract class L2Summon extends L2Playable
|
|||||||
@Override
|
@Override
|
||||||
public void doCast(Skill skill)
|
public void doCast(Skill skill)
|
||||||
{
|
{
|
||||||
if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack())
|
if ((skill.getTarget(this, false, false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack())
|
||||||
{
|
{
|
||||||
// Send a System Message to the L2PcInstance
|
// Send a System Message to the L2PcInstance
|
||||||
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
||||||
@@ -790,7 +803,7 @@ public abstract class L2Summon extends L2Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
doCast(skill, null, skill.isBad(), false);
|
super.doCast(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -45,92 +45,89 @@ public class NotFriend implements IAffectObjectHandler
|
|||||||
final L2PcInstance player = activeChar.getActingPlayer();
|
final L2PcInstance player = activeChar.getActingPlayer();
|
||||||
final L2PcInstance targetPlayer = target.getActingPlayer();
|
final L2PcInstance targetPlayer = target.getActingPlayer();
|
||||||
|
|
||||||
if (player != null)
|
if ((player != null) && (targetPlayer != null))
|
||||||
{
|
{
|
||||||
if (targetPlayer != null)
|
// Same player.
|
||||||
|
if (player == targetPlayer)
|
||||||
{
|
{
|
||||||
// Same player.
|
return false;
|
||||||
if (player == targetPlayer)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Peace Zone.
|
|
||||||
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Party (command channel doesn't make you friends).
|
|
||||||
final L2Party party = player.getParty();
|
|
||||||
final L2Party targetParty = targetPlayer.getParty();
|
|
||||||
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Arena.
|
|
||||||
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Duel.
|
|
||||||
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Olympiad.
|
|
||||||
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clan.
|
|
||||||
final L2Clan clan = player.getClan();
|
|
||||||
final L2Clan targetClan = targetPlayer.getClan();
|
|
||||||
if (clan != null)
|
|
||||||
{
|
|
||||||
if (clan == targetClan)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// War
|
|
||||||
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alliance.
|
|
||||||
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Siege.
|
|
||||||
if (target.isInsideZone(ZoneId.SIEGE))
|
|
||||||
{
|
|
||||||
// Players in the same siege side at the same castle are considered friends.
|
|
||||||
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point summon should be prevented from attacking friendly targets.
|
|
||||||
if (activeChar.isSummon() && (target == activeChar.getTarget()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// By default any flagged/PK player is considered enemy.
|
|
||||||
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Peace Zone.
|
||||||
|
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Party (command channel doesn't make you friends).
|
||||||
|
final L2Party party = player.getParty();
|
||||||
|
final L2Party targetParty = targetPlayer.getParty();
|
||||||
|
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arena.
|
||||||
|
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Duel.
|
||||||
|
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Olympiad.
|
||||||
|
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clan.
|
||||||
|
final L2Clan clan = player.getClan();
|
||||||
|
final L2Clan targetClan = targetPlayer.getClan();
|
||||||
|
if (clan != null)
|
||||||
|
{
|
||||||
|
if (clan == targetClan)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// War
|
||||||
|
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alliance.
|
||||||
|
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Siege.
|
||||||
|
if (target.isInsideZone(ZoneId.SIEGE))
|
||||||
|
{
|
||||||
|
// Players in the same siege side at the same castle are considered friends.
|
||||||
|
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// At this point summon should be prevented from attacking friendly targets.
|
||||||
|
if (activeChar.isSummon() && (target == activeChar.getTarget()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// By default any flagged/PK player is considered enemy.
|
||||||
|
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return target.isAutoAttackable(activeChar);
|
return target.isAutoAttackable(activeChar);
|
||||||
|
|||||||
@@ -631,7 +631,20 @@ public abstract class L2Summon extends L2Playable
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
final L2Object currentTarget = _owner.getTarget();
|
final L2Object currentTarget = _owner.getTarget();
|
||||||
target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
|
if (currentTarget != null)
|
||||||
|
{
|
||||||
|
target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
|
||||||
|
final L2PcInstance currentTargetPlayer = currentTarget.getActingPlayer();
|
||||||
|
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
|
||||||
|
{
|
||||||
|
sendPacket(SystemMessageId.INVALID_TARGET);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target = skill.getTarget(this, forceUse, dontMove, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the validity of the target
|
// Check the validity of the target
|
||||||
@@ -780,7 +793,7 @@ public abstract class L2Summon extends L2Playable
|
|||||||
@Override
|
@Override
|
||||||
public void doCast(Skill skill)
|
public void doCast(Skill skill)
|
||||||
{
|
{
|
||||||
if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack())
|
if ((skill.getTarget(this, false, false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack())
|
||||||
{
|
{
|
||||||
// Send a System Message to the L2PcInstance
|
// Send a System Message to the L2PcInstance
|
||||||
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
||||||
@@ -790,7 +803,7 @@ public abstract class L2Summon extends L2Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
doCast(skill, null, skill.isBad(), false);
|
super.doCast(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -45,92 +45,89 @@ public class NotFriend implements IAffectObjectHandler
|
|||||||
final L2PcInstance player = activeChar.getActingPlayer();
|
final L2PcInstance player = activeChar.getActingPlayer();
|
||||||
final L2PcInstance targetPlayer = target.getActingPlayer();
|
final L2PcInstance targetPlayer = target.getActingPlayer();
|
||||||
|
|
||||||
if (player != null)
|
if ((player != null) && (targetPlayer != null))
|
||||||
{
|
{
|
||||||
if (targetPlayer != null)
|
// Same player.
|
||||||
|
if (player == targetPlayer)
|
||||||
{
|
{
|
||||||
// Same player.
|
return false;
|
||||||
if (player == targetPlayer)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Peace Zone.
|
|
||||||
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Party (command channel doesn't make you friends).
|
|
||||||
final L2Party party = player.getParty();
|
|
||||||
final L2Party targetParty = targetPlayer.getParty();
|
|
||||||
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Arena.
|
|
||||||
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Duel.
|
|
||||||
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Olympiad.
|
|
||||||
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clan.
|
|
||||||
final L2Clan clan = player.getClan();
|
|
||||||
final L2Clan targetClan = targetPlayer.getClan();
|
|
||||||
if (clan != null)
|
|
||||||
{
|
|
||||||
if (clan == targetClan)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// War
|
|
||||||
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alliance.
|
|
||||||
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Siege.
|
|
||||||
if (target.isInsideZone(ZoneId.SIEGE))
|
|
||||||
{
|
|
||||||
// Players in the same siege side at the same castle are considered friends.
|
|
||||||
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point summon should be prevented from attacking friendly targets.
|
|
||||||
if (activeChar.isSummon() && (target == activeChar.getTarget()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// By default any flagged/PK player is considered enemy.
|
|
||||||
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Peace Zone.
|
||||||
|
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Party (command channel doesn't make you friends).
|
||||||
|
final L2Party party = player.getParty();
|
||||||
|
final L2Party targetParty = targetPlayer.getParty();
|
||||||
|
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arena.
|
||||||
|
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Duel.
|
||||||
|
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Olympiad.
|
||||||
|
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clan.
|
||||||
|
final L2Clan clan = player.getClan();
|
||||||
|
final L2Clan targetClan = targetPlayer.getClan();
|
||||||
|
if (clan != null)
|
||||||
|
{
|
||||||
|
if (clan == targetClan)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// War
|
||||||
|
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alliance.
|
||||||
|
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Siege.
|
||||||
|
if (target.isInsideZone(ZoneId.SIEGE))
|
||||||
|
{
|
||||||
|
// Players in the same siege side at the same castle are considered friends.
|
||||||
|
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// At this point summon should be prevented from attacking friendly targets.
|
||||||
|
if (activeChar.isSummon() && (target == activeChar.getTarget()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// By default any flagged/PK player is considered enemy.
|
||||||
|
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return target.isAutoAttackable(activeChar);
|
return target.isAutoAttackable(activeChar);
|
||||||
|
|||||||
@@ -631,7 +631,20 @@ public abstract class L2Summon extends L2Playable
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
final L2Object currentTarget = _owner.getTarget();
|
final L2Object currentTarget = _owner.getTarget();
|
||||||
target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
|
if (currentTarget != null)
|
||||||
|
{
|
||||||
|
target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
|
||||||
|
final L2PcInstance currentTargetPlayer = currentTarget.getActingPlayer();
|
||||||
|
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
|
||||||
|
{
|
||||||
|
sendPacket(SystemMessageId.INVALID_TARGET);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target = skill.getTarget(this, forceUse, dontMove, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the validity of the target
|
// Check the validity of the target
|
||||||
@@ -780,7 +793,7 @@ public abstract class L2Summon extends L2Playable
|
|||||||
@Override
|
@Override
|
||||||
public void doCast(Skill skill)
|
public void doCast(Skill skill)
|
||||||
{
|
{
|
||||||
if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack())
|
if ((skill.getTarget(this, false, false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack())
|
||||||
{
|
{
|
||||||
// Send a System Message to the L2PcInstance
|
// Send a System Message to the L2PcInstance
|
||||||
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
||||||
@@ -790,7 +803,7 @@ public abstract class L2Summon extends L2Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
doCast(skill, null, skill.isBad(), false);
|
super.doCast(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -45,92 +45,89 @@ public class NotFriend implements IAffectObjectHandler
|
|||||||
final L2PcInstance player = activeChar.getActingPlayer();
|
final L2PcInstance player = activeChar.getActingPlayer();
|
||||||
final L2PcInstance targetPlayer = target.getActingPlayer();
|
final L2PcInstance targetPlayer = target.getActingPlayer();
|
||||||
|
|
||||||
if (player != null)
|
if ((player != null) && (targetPlayer != null))
|
||||||
{
|
{
|
||||||
if (targetPlayer != null)
|
// Same player.
|
||||||
|
if (player == targetPlayer)
|
||||||
{
|
{
|
||||||
// Same player.
|
return false;
|
||||||
if (player == targetPlayer)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Peace Zone.
|
|
||||||
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Party (command channel doesn't make you friends).
|
|
||||||
final L2Party party = player.getParty();
|
|
||||||
final L2Party targetParty = targetPlayer.getParty();
|
|
||||||
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Arena.
|
|
||||||
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Duel.
|
|
||||||
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Olympiad.
|
|
||||||
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clan.
|
|
||||||
final L2Clan clan = player.getClan();
|
|
||||||
final L2Clan targetClan = targetPlayer.getClan();
|
|
||||||
if (clan != null)
|
|
||||||
{
|
|
||||||
if (clan == targetClan)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// War
|
|
||||||
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Alliance.
|
|
||||||
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Siege.
|
|
||||||
if (target.isInsideZone(ZoneId.SIEGE))
|
|
||||||
{
|
|
||||||
// Players in the same siege side at the same castle are considered friends.
|
|
||||||
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// At this point summon should be prevented from attacking friendly targets.
|
|
||||||
if (activeChar.isSummon() && (target == activeChar.getTarget()))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// By default any flagged/PK player is considered enemy.
|
|
||||||
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Peace Zone.
|
||||||
|
if (target.isInsidePeaceZone(player) && !player.getAccessLevel().allowPeaceAttack())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Party (command channel doesn't make you friends).
|
||||||
|
final L2Party party = player.getParty();
|
||||||
|
final L2Party targetParty = targetPlayer.getParty();
|
||||||
|
if ((party != null) && (targetParty != null) && (party.getLeaderObjectId() == targetParty.getLeaderObjectId()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Arena.
|
||||||
|
if (activeChar.isInsideZone(ZoneId.PVP) && target.isInsideZone(ZoneId.PVP))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Duel.
|
||||||
|
if (player.isInDuel() && targetPlayer.isInDuel() && (player.getDuelId() == targetPlayer.getDuelId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Olympiad.
|
||||||
|
if (player.isInOlympiadMode() && targetPlayer.isInOlympiadMode() && (player.getOlympiadGameId() == targetPlayer.getOlympiadGameId()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clan.
|
||||||
|
final L2Clan clan = player.getClan();
|
||||||
|
final L2Clan targetClan = targetPlayer.getClan();
|
||||||
|
if (clan != null)
|
||||||
|
{
|
||||||
|
if (clan == targetClan)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// War
|
||||||
|
if ((targetClan != null) && clan.isAtWarWith(targetClan) && targetClan.isAtWarWith(clan))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Alliance.
|
||||||
|
if ((player.getAllyId() != 0) && (player.getAllyId() == targetPlayer.getAllyId()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Siege.
|
||||||
|
if (target.isInsideZone(ZoneId.SIEGE))
|
||||||
|
{
|
||||||
|
// Players in the same siege side at the same castle are considered friends.
|
||||||
|
if ((player.getSiegeState() > 0) && (player.getSiegeState() == targetPlayer.getSiegeState()) && (player.getSiegeSide() == targetPlayer.getSiegeSide()))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// At this point summon should be prevented from attacking friendly targets.
|
||||||
|
if (activeChar.isSummon() && (target == activeChar.getTarget()))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// By default any flagged/PK player is considered enemy.
|
||||||
|
return (target.getActingPlayer().getPvpFlag() > 0) || (target.getActingPlayer().getReputation() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return target.isAutoAttackable(activeChar);
|
return target.isAutoAttackable(activeChar);
|
||||||
|
|||||||
@@ -631,7 +631,20 @@ public abstract class L2Summon extends L2Playable
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
final L2Object currentTarget = _owner.getTarget();
|
final L2Object currentTarget = _owner.getTarget();
|
||||||
target = skill.getTarget(this, skill.isBad() && (currentTarget != null) && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
|
if (currentTarget != null)
|
||||||
|
{
|
||||||
|
target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
|
||||||
|
final L2PcInstance currentTargetPlayer = currentTarget.getActingPlayer();
|
||||||
|
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
|
||||||
|
{
|
||||||
|
sendPacket(SystemMessageId.INVALID_TARGET);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
target = skill.getTarget(this, forceUse, dontMove, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check the validity of the target
|
// Check the validity of the target
|
||||||
@@ -780,7 +793,7 @@ public abstract class L2Summon extends L2Playable
|
|||||||
@Override
|
@Override
|
||||||
public void doCast(Skill skill)
|
public void doCast(Skill skill)
|
||||||
{
|
{
|
||||||
if ((skill.getTarget(this, skill.isBad(), false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack())
|
if ((skill.getTarget(this, false, false, false) == null) && !_owner.getAccessLevel().allowPeaceAttack())
|
||||||
{
|
{
|
||||||
// Send a System Message to the L2PcInstance
|
// Send a System Message to the L2PcInstance
|
||||||
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
_owner.sendPacket(SystemMessageId.THAT_IS_AN_INCORRECT_TARGET);
|
||||||
@@ -790,7 +803,7 @@ public abstract class L2Summon extends L2Playable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
doCast(skill, null, skill.isBad(), false);
|
super.doCast(skill);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user