No PvP triggers from or into peace zones

This commit is contained in:
2026-09-03 21:10:56 +02:00
parent fc58fbd1ce
commit 5dbc994618
@@ -38,6 +38,7 @@ import org.l2jmobius.gameserver.entity.actor.instance.Monster;
import org.l2jmobius.gameserver.entity.clan.Clan;
import org.l2jmobius.gameserver.entity.groups.Party;
import org.l2jmobius.gameserver.entity.groups.PartyDistributionType;
import org.l2jmobius.gameserver.entity.zone.ZoneId;
import org.l2jmobius.gameserver.managers.FakePlayerChatManager.Understanding;
import org.l2jmobius.gameserver.network.enums.ChatType;
import org.l2jmobius.gameserver.network.serverpackets.AskJoinParty;
@@ -130,8 +131,8 @@ public class FakePlayerSocial
}
}
// Personality actions against real players (not while escorting a human party).
if ((human == null) && (state.forcedTargetId == 0) && !FakePlayerSiegeManager.getInstance().isBusy(state))
// Personality actions against real players (not while escorting a human party, never from a town).
if ((human == null) && (state.forcedTargetId == 0) && !FakePlayerSiegeManager.getInstance().isBusy(state) && !bot.isInsideZone(ZoneId.PEACE))
{
if (FakePlayersConfig.FAKE_PLAYER_AGGRO_PLAYERS)
{
@@ -140,13 +141,13 @@ public class FakePlayerSocial
String instruction = null;
if ("ganker".equals(state.personality))
{
victim = World.getNearestVisibleObjectInRange(bot, Player.class, NOTICE_RANGE, other -> !other.isDead() && !other.isHeadlessBot() && !other.isInvisible() && !other.isGM() && (Math.abs(other.getLevel() - bot.getLevel()) <= 12));
victim = World.getNearestVisibleObjectInRange(bot, Player.class, NOTICE_RANGE, other -> !other.isDead() && !other.isHeadlessBot() && !other.isInvisible() && !other.isGM() && !other.isInsideZone(ZoneId.PEACE) && (Math.abs(other.getLevel() - bot.getLevel()) <= 12));
seam = "gank_start";
instruction = "Ты нападаешь на игрока. Крикни что-нибудь дерзкое.";
}
else if ("pkk".equals(state.personality))
{
victim = World.getNearestVisibleObjectInRange(bot, Player.class, NOTICE_RANGE, other -> !other.isDead() && !other.isInvisible() && (other != bot) && ((other.getKarma() > 0) || ((other.getPvpFlag() != 0) && !other.isHeadlessBot())));
victim = World.getNearestVisibleObjectInRange(bot, Player.class, NOTICE_RANGE, other -> !other.isDead() && !other.isInvisible() && (other != bot) && !other.isInsideZone(ZoneId.PEACE) && ((other.getKarma() > 0) || ((other.getPvpFlag() != 0) && !other.isHeadlessBot())));
seam = "pkk_start";
instruction = "Ты охотник на ПК и нападаешь на нарушителя. Крикни про правосудие.";
}
@@ -168,7 +169,7 @@ public class FakePlayerSocial
final Clan clan = bot.getClan();
if ((clan != null) && !bot.isInCombat() && (Rnd.get(100) < 40))
{
final Player enemy = World.getNearestVisibleObjectInRange(bot, Player.class, 1200, other -> !other.isDead() && (other != bot) && !other.isInvisible() && (other.getClan() != null) && (clan.isAtWarWith(other.getClanId()) || other.getClan().isAtWarWith(clan.getId())));
final Player enemy = World.getNearestVisibleObjectInRange(bot, Player.class, 1200, other -> !other.isDead() && (other != bot) && !other.isInvisible() && !other.isInsideZone(ZoneId.PEACE) && (other.getClan() != null) && (clan.isAtWarWith(other.getClanId()) || other.getClan().isAtWarWith(clan.getId())));
if (enemy != null)
{
state.action("clanwar:" + enemy.getName());