diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/xsd/zones.xsd b/L2J_Mobius_1.0_Ertheia/dist/game/data/xsd/zones.xsd
index 4d485a70fe..1cd9137de0 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/xsd/zones.xsd
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/xsd/zones.xsd
@@ -153,6 +153,7 @@
+
diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/ai/AttackableAI.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/ai/AttackableAI.java
index 6989642791..1104aa3686 100644
--- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/ai/AttackableAI.java
+++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/ai/AttackableAI.java
@@ -170,7 +170,7 @@ public class AttackableAI extends CreatureAI
{
// depending on config, do not allow mobs to attack _new_ players in peacezones,
// unless they are already following those players from outside the peacezone.
- if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE))
+ if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE) && target.isInsideZone(ZoneId.NO_PVP))
{
return false;
}
diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java
index 4c110ea507..e08591eecd 100644
--- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java
+++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Creature.java
@@ -393,7 +393,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
return true;
}
- return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0);
+ return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0) && (_zones[ZoneId.NO_PVP.ordinal()] == 0);
}
case PEACE:
{
@@ -3955,7 +3955,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return false;
}
- return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE));
+ return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE) || target.isInsideZone(ZoneId.NO_PVP) || attacker.isInsideZone(ZoneId.NO_PVP));
}
/**
diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Summon.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Summon.java
index f870277b6e..8d62b00071 100644
--- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Summon.java
+++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Summon.java
@@ -636,7 +636,7 @@ public abstract class Summon extends Playable
final WorldObject currentTarget = _owner.getTarget();
if (currentTarget != null)
{
- target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
+ target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE) || !currentTarget.isInsideZone(ZoneId.NO_PVP)), dontMove, false);
final PlayerInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
index 69ca22ccf1..7107888bf7 100644
--- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
+++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
@@ -1836,6 +1836,15 @@ public class PlayerInstance extends Playable
_lastCompassZone = ExSetCompassZoneCode.PEACEZONE;
sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.PEACEZONE));
}
+ else if (isInsideZone(ZoneId.NO_PVP))
+ {
+ if (_lastCompassZone == ExSetCompassZoneCode.NOPVPZONE)
+ {
+ return;
+ }
+ _lastCompassZone = ExSetCompassZoneCode.NOPVPZONE;
+ sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.NOPVPZONE));
+ }
else
{
if (_lastCompassZone == ExSetCompassZoneCode.GENERALZONE)
@@ -8213,7 +8222,7 @@ public class PlayerInstance extends Playable
// Check if the attacker is a Playable
if (attacker.isPlayable())
{
- if (isInsideZone(ZoneId.PEACE))
+ if (isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.NO_PVP))
{
return false;
}
@@ -9411,7 +9420,7 @@ public class PlayerInstance extends Playable
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_FISHING;
return false;
}
- if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE))
+ if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE) || isInsideZone(ZoneId.NO_PVP))
{
_noDuelReason = SystemMessageId.C1_CANNOT_MAKE_A_CHALLENGE_TO_A_DUEL_BECAUSE_C1_IS_CURRENTLY_IN_A_DUEL_PROHIBITED_AREA_PEACEFUL_ZONE_BATTLE_ZONE_NEAR_WATER_RESTART_PROHIBITED_AREA;
return false;
diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/entity/Duel.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/entity/Duel.java
index 28bf57bf83..751140a285 100644
--- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/entity/Duel.java
+++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/entity/Duel.java
@@ -920,7 +920,7 @@ public class Duel
}
// is one of the players in a Siege, Peace or PvP zone?
- if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
+ if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) ||_playerA.isInsideZone(ZoneId.NO_PVP) || _playerB.isInsideZone(ZoneId.NO_PVP) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
{
return DuelResult.CANCELED;
}
diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/zone/ZoneId.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
index 0ab83f2438..5434025f11 100644
--- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
+++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
@@ -37,6 +37,7 @@ public enum ZoneId
NO_SUMMON_FRIEND,
FORT,
NO_STORE,
+ NO_PVP,
SCRIPT,
HQ,
DANGER_AREA,
diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
new file mode 100644
index 0000000000..52fdb5b0a3
--- /dev/null
+++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.l2jmobius.gameserver.model.zone.type;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Summon;
+import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.model.zone.ZoneType;
+
+/**
+ * No PVP Zone
+ * @author Edoo
+ */
+public class NoPvPZone extends ZoneType
+{
+ public NoPvPZone(int id)
+ {
+ super(id);
+ }
+
+ @Override
+ protected void onEnter(Creature creature)
+ {
+ if (!isEnabled())
+ {
+ return;
+ }
+
+ if (creature.isPlayer())
+ {
+ final PlayerInstance player = creature.getActingPlayer();
+ // PVP possible during siege, now for siege participants only
+ // Could also check if this town is in siege, or if any siege is going on
+ if ((player.getSiegeState() != 0) && (Config.PEACE_ZONE_MODE == 1))
+ {
+ return;
+ }
+ }
+
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, true);
+ }
+
+
+ // Send player info to nearby players.
+ if (creature.isPlayer())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ protected void onExit(Creature creature)
+ {
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, false);
+ }
+
+ // Send player info to nearby players.
+ if (creature.isPlayer() && !creature.isTeleporting())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean value)
+ {
+ super.setEnabled(value);
+ if (value)
+ {
+ for (PlayerInstance player : World.getInstance().getPlayers())
+ {
+ if ((player != null) && isInsideZone(player))
+ {
+ revalidateInZone(player);
+
+ if (player.getPet() != null)
+ {
+ revalidateInZone(player.getPet());
+ }
+
+ for (Summon summon : player.getServitors().values())
+ {
+ revalidateInZone(summon);
+ }
+ }
+ }
+ }
+ else
+ {
+ for (Creature creature : getCharactersInside())
+ {
+ if (creature != null)
+ {
+ removeCharacter(creature);
+ }
+ }
+ }
+ }
+}
diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
index 696f679789..76aff56251 100644
--- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
+++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
@@ -32,6 +32,8 @@ public class ExSetCompassZoneCode implements IClientOutgoingPacket
public static final int SEVENSIGNSZONE = 0x0D;
public static final int PVPZONE = 0x0E;
public static final int GENERALZONE = 0x0F;
+ // TODO: need to find the desired value
+ public static final int NOPVPZONE = 0x0C;
private final int _zoneType;
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/xsd/zones.xsd b/L2J_Mobius_2.5_Underground/dist/game/data/xsd/zones.xsd
index 4d485a70fe..1cd9137de0 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/xsd/zones.xsd
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/xsd/zones.xsd
@@ -153,6 +153,7 @@
+
diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/ai/AttackableAI.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/ai/AttackableAI.java
index 6989642791..1104aa3686 100644
--- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/ai/AttackableAI.java
+++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/ai/AttackableAI.java
@@ -170,7 +170,7 @@ public class AttackableAI extends CreatureAI
{
// depending on config, do not allow mobs to attack _new_ players in peacezones,
// unless they are already following those players from outside the peacezone.
- if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE))
+ if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE) && target.isInsideZone(ZoneId.NO_PVP))
{
return false;
}
diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/Creature.java
index 4c110ea507..e08591eecd 100644
--- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/Creature.java
+++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/Creature.java
@@ -393,7 +393,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
return true;
}
- return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0);
+ return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0) && (_zones[ZoneId.NO_PVP.ordinal()] == 0);
}
case PEACE:
{
@@ -3955,7 +3955,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return false;
}
- return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE));
+ return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE) || target.isInsideZone(ZoneId.NO_PVP) || attacker.isInsideZone(ZoneId.NO_PVP));
}
/**
diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/Summon.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/Summon.java
index f870277b6e..8d62b00071 100644
--- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/Summon.java
+++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/Summon.java
@@ -636,7 +636,7 @@ public abstract class Summon extends Playable
final WorldObject currentTarget = _owner.getTarget();
if (currentTarget != null)
{
- target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
+ target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE) || !currentTarget.isInsideZone(ZoneId.NO_PVP)), dontMove, false);
final PlayerInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
index 38b893a03e..dce05e2e92 100644
--- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
+++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
@@ -1842,6 +1842,15 @@ public class PlayerInstance extends Playable
_lastCompassZone = ExSetCompassZoneCode.PEACEZONE;
sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.PEACEZONE));
}
+ else if (isInsideZone(ZoneId.NO_PVP))
+ {
+ if (_lastCompassZone == ExSetCompassZoneCode.NOPVPZONE)
+ {
+ return;
+ }
+ _lastCompassZone = ExSetCompassZoneCode.NOPVPZONE;
+ sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.NOPVPZONE));
+ }
else
{
if (_lastCompassZone == ExSetCompassZoneCode.GENERALZONE)
@@ -8220,7 +8229,7 @@ public class PlayerInstance extends Playable
// Check if the attacker is a Playable
if (attacker.isPlayable())
{
- if (isInsideZone(ZoneId.PEACE))
+ if (isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.NO_PVP))
{
return false;
}
@@ -9418,7 +9427,7 @@ public class PlayerInstance extends Playable
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_FISHING;
return false;
}
- if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE))
+ if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE) || isInsideZone(ZoneId.NO_PVP))
{
_noDuelReason = SystemMessageId.C1_CANNOT_MAKE_A_CHALLENGE_TO_A_DUEL_BECAUSE_C1_IS_CURRENTLY_IN_A_DUEL_PROHIBITED_AREA_PEACEFUL_ZONE_BATTLE_ZONE_NEAR_WATER_RESTART_PROHIBITED_AREA;
return false;
diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/entity/Duel.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/entity/Duel.java
index 28bf57bf83..751140a285 100644
--- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/entity/Duel.java
+++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/entity/Duel.java
@@ -920,7 +920,7 @@ public class Duel
}
// is one of the players in a Siege, Peace or PvP zone?
- if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
+ if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) ||_playerA.isInsideZone(ZoneId.NO_PVP) || _playerB.isInsideZone(ZoneId.NO_PVP) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
{
return DuelResult.CANCELED;
}
diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/zone/ZoneId.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
index 0ab83f2438..5434025f11 100644
--- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
+++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
@@ -37,6 +37,7 @@ public enum ZoneId
NO_SUMMON_FRIEND,
FORT,
NO_STORE,
+ NO_PVP,
SCRIPT,
HQ,
DANGER_AREA,
diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
new file mode 100644
index 0000000000..52fdb5b0a3
--- /dev/null
+++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.l2jmobius.gameserver.model.zone.type;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Summon;
+import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.model.zone.ZoneType;
+
+/**
+ * No PVP Zone
+ * @author Edoo
+ */
+public class NoPvPZone extends ZoneType
+{
+ public NoPvPZone(int id)
+ {
+ super(id);
+ }
+
+ @Override
+ protected void onEnter(Creature creature)
+ {
+ if (!isEnabled())
+ {
+ return;
+ }
+
+ if (creature.isPlayer())
+ {
+ final PlayerInstance player = creature.getActingPlayer();
+ // PVP possible during siege, now for siege participants only
+ // Could also check if this town is in siege, or if any siege is going on
+ if ((player.getSiegeState() != 0) && (Config.PEACE_ZONE_MODE == 1))
+ {
+ return;
+ }
+ }
+
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, true);
+ }
+
+
+ // Send player info to nearby players.
+ if (creature.isPlayer())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ protected void onExit(Creature creature)
+ {
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, false);
+ }
+
+ // Send player info to nearby players.
+ if (creature.isPlayer() && !creature.isTeleporting())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean value)
+ {
+ super.setEnabled(value);
+ if (value)
+ {
+ for (PlayerInstance player : World.getInstance().getPlayers())
+ {
+ if ((player != null) && isInsideZone(player))
+ {
+ revalidateInZone(player);
+
+ if (player.getPet() != null)
+ {
+ revalidateInZone(player.getPet());
+ }
+
+ for (Summon summon : player.getServitors().values())
+ {
+ revalidateInZone(summon);
+ }
+ }
+ }
+ }
+ else
+ {
+ for (Creature creature : getCharactersInside())
+ {
+ if (creature != null)
+ {
+ removeCharacter(creature);
+ }
+ }
+ }
+ }
+}
diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
index 696f679789..76aff56251 100644
--- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
+++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
@@ -32,6 +32,8 @@ public class ExSetCompassZoneCode implements IClientOutgoingPacket
public static final int SEVENSIGNSZONE = 0x0D;
public static final int PVPZONE = 0x0E;
public static final int GENERALZONE = 0x0F;
+ // TODO: need to find the desired value
+ public static final int NOPVPZONE = 0x0C;
private final int _zoneType;
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/xsd/zones.xsd b/L2J_Mobius_3.0_Helios/dist/game/data/xsd/zones.xsd
index 4d485a70fe..1cd9137de0 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/xsd/zones.xsd
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/xsd/zones.xsd
@@ -153,6 +153,7 @@
+
diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/ai/AttackableAI.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/ai/AttackableAI.java
index 6989642791..1104aa3686 100644
--- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/ai/AttackableAI.java
+++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/ai/AttackableAI.java
@@ -170,7 +170,7 @@ public class AttackableAI extends CreatureAI
{
// depending on config, do not allow mobs to attack _new_ players in peacezones,
// unless they are already following those players from outside the peacezone.
- if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE))
+ if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE) && target.isInsideZone(ZoneId.NO_PVP))
{
return false;
}
diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/Creature.java
index 880e837ae3..5b41b0c085 100644
--- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/Creature.java
+++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/Creature.java
@@ -393,7 +393,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
return true;
}
- return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0);
+ return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0) && (_zones[ZoneId.NO_PVP.ordinal()] == 0);
}
case PEACE:
{
@@ -3955,7 +3955,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return false;
}
- return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE));
+ return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE) || target.isInsideZone(ZoneId.NO_PVP) || attacker.isInsideZone(ZoneId.NO_PVP));
}
/**
diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/Summon.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/Summon.java
index 289079df0b..33499704bc 100644
--- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/Summon.java
+++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/Summon.java
@@ -636,7 +636,7 @@ public abstract class Summon extends Playable
final WorldObject currentTarget = _owner.getTarget();
if (currentTarget != null)
{
- target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
+ target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE) || !currentTarget.isInsideZone(ZoneId.NO_PVP)), dontMove, false);
final PlayerInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
index b8b7ed0868..38350192b1 100644
--- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
+++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
@@ -1844,6 +1844,15 @@ public class PlayerInstance extends Playable
_lastCompassZone = ExSetCompassZoneCode.PEACEZONE;
sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.PEACEZONE));
}
+ else if (isInsideZone(ZoneId.NO_PVP))
+ {
+ if (_lastCompassZone == ExSetCompassZoneCode.NOPVPZONE)
+ {
+ return;
+ }
+ _lastCompassZone = ExSetCompassZoneCode.NOPVPZONE;
+ sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.NOPVPZONE));
+ }
else
{
if (_lastCompassZone == ExSetCompassZoneCode.GENERALZONE)
@@ -8222,7 +8231,7 @@ public class PlayerInstance extends Playable
// Check if the attacker is a Playable
if (attacker.isPlayable())
{
- if (isInsideZone(ZoneId.PEACE))
+ if (isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.NO_PVP))
{
return false;
}
@@ -9420,7 +9429,7 @@ public class PlayerInstance extends Playable
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_FISHING;
return false;
}
- if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE))
+ if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE) || isInsideZone(ZoneId.NO_PVP))
{
_noDuelReason = SystemMessageId.C1_CANNOT_MAKE_A_CHALLENGE_TO_A_DUEL_BECAUSE_C1_IS_CURRENTLY_IN_A_DUEL_PROHIBITED_AREA_PEACEFUL_ZONE_BATTLE_ZONE_NEAR_WATER_RESTART_PROHIBITED_AREA;
return false;
diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/entity/Duel.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/entity/Duel.java
index 28bf57bf83..751140a285 100644
--- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/entity/Duel.java
+++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/entity/Duel.java
@@ -920,7 +920,7 @@ public class Duel
}
// is one of the players in a Siege, Peace or PvP zone?
- if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
+ if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) ||_playerA.isInsideZone(ZoneId.NO_PVP) || _playerB.isInsideZone(ZoneId.NO_PVP) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
{
return DuelResult.CANCELED;
}
diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/zone/ZoneId.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
index 0ab83f2438..5434025f11 100644
--- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
+++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
@@ -37,6 +37,7 @@ public enum ZoneId
NO_SUMMON_FRIEND,
FORT,
NO_STORE,
+ NO_PVP,
SCRIPT,
HQ,
DANGER_AREA,
diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
new file mode 100644
index 0000000000..52fdb5b0a3
--- /dev/null
+++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.l2jmobius.gameserver.model.zone.type;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Summon;
+import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.model.zone.ZoneType;
+
+/**
+ * No PVP Zone
+ * @author Edoo
+ */
+public class NoPvPZone extends ZoneType
+{
+ public NoPvPZone(int id)
+ {
+ super(id);
+ }
+
+ @Override
+ protected void onEnter(Creature creature)
+ {
+ if (!isEnabled())
+ {
+ return;
+ }
+
+ if (creature.isPlayer())
+ {
+ final PlayerInstance player = creature.getActingPlayer();
+ // PVP possible during siege, now for siege participants only
+ // Could also check if this town is in siege, or if any siege is going on
+ if ((player.getSiegeState() != 0) && (Config.PEACE_ZONE_MODE == 1))
+ {
+ return;
+ }
+ }
+
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, true);
+ }
+
+
+ // Send player info to nearby players.
+ if (creature.isPlayer())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ protected void onExit(Creature creature)
+ {
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, false);
+ }
+
+ // Send player info to nearby players.
+ if (creature.isPlayer() && !creature.isTeleporting())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean value)
+ {
+ super.setEnabled(value);
+ if (value)
+ {
+ for (PlayerInstance player : World.getInstance().getPlayers())
+ {
+ if ((player != null) && isInsideZone(player))
+ {
+ revalidateInZone(player);
+
+ if (player.getPet() != null)
+ {
+ revalidateInZone(player.getPet());
+ }
+
+ for (Summon summon : player.getServitors().values())
+ {
+ revalidateInZone(summon);
+ }
+ }
+ }
+ }
+ else
+ {
+ for (Creature creature : getCharactersInside())
+ {
+ if (creature != null)
+ {
+ removeCharacter(creature);
+ }
+ }
+ }
+ }
+}
diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
index 696f679789..76aff56251 100644
--- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
+++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
@@ -32,6 +32,8 @@ public class ExSetCompassZoneCode implements IClientOutgoingPacket
public static final int SEVENSIGNSZONE = 0x0D;
public static final int PVPZONE = 0x0E;
public static final int GENERALZONE = 0x0F;
+ // TODO: need to find the desired value
+ public static final int NOPVPZONE = 0x0C;
private final int _zoneType;
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/xsd/zones.xsd b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/xsd/zones.xsd
index 4d485a70fe..1cd9137de0 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/xsd/zones.xsd
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/xsd/zones.xsd
@@ -153,6 +153,7 @@
+
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/AttackableAI.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/AttackableAI.java
index 6989642791..1104aa3686 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/AttackableAI.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/ai/AttackableAI.java
@@ -170,7 +170,7 @@ public class AttackableAI extends CreatureAI
{
// depending on config, do not allow mobs to attack _new_ players in peacezones,
// unless they are already following those players from outside the peacezone.
- if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE))
+ if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE) && target.isInsideZone(ZoneId.NO_PVP))
{
return false;
}
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Creature.java
index 880e837ae3..5b41b0c085 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Creature.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Creature.java
@@ -393,7 +393,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
return true;
}
- return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0);
+ return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0) && (_zones[ZoneId.NO_PVP.ordinal()] == 0);
}
case PEACE:
{
@@ -3955,7 +3955,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return false;
}
- return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE));
+ return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE) || target.isInsideZone(ZoneId.NO_PVP) || attacker.isInsideZone(ZoneId.NO_PVP));
}
/**
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Summon.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Summon.java
index 289079df0b..33499704bc 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Summon.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Summon.java
@@ -636,7 +636,7 @@ public abstract class Summon extends Playable
final WorldObject currentTarget = _owner.getTarget();
if (currentTarget != null)
{
- target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
+ target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE) || !currentTarget.isInsideZone(ZoneId.NO_PVP)), dontMove, false);
final PlayerInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
index 2dd2369aaa..870d76e72b 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
@@ -1853,6 +1853,15 @@ public class PlayerInstance extends Playable
_lastCompassZone = ExSetCompassZoneCode.PEACEZONE;
sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.PEACEZONE));
}
+ else if (isInsideZone(ZoneId.NO_PVP))
+ {
+ if (_lastCompassZone == ExSetCompassZoneCode.NOPVPZONE)
+ {
+ return;
+ }
+ _lastCompassZone = ExSetCompassZoneCode.NOPVPZONE;
+ sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.NOPVPZONE));
+ }
else
{
if (_lastCompassZone == ExSetCompassZoneCode.GENERALZONE)
@@ -8203,7 +8212,7 @@ public class PlayerInstance extends Playable
// Check if the attacker is a Playable
if (attacker.isPlayable())
{
- if (isInsideZone(ZoneId.PEACE))
+ if (isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.NO_PVP))
{
return false;
}
@@ -9404,7 +9413,7 @@ public class PlayerInstance extends Playable
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_FISHING;
return false;
}
- if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE))
+ if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE) || isInsideZone(ZoneId.NO_PVP))
{
_noDuelReason = SystemMessageId.C1_IS_IN_AN_AREA_WHERE_DUEL_IS_NOT_ALLOWED_AND_YOU_CANNOT_APPLY_FOR_A_DUEL;
return false;
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/entity/Duel.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/entity/Duel.java
index 28bf57bf83..751140a285 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/entity/Duel.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/entity/Duel.java
@@ -920,7 +920,7 @@ public class Duel
}
// is one of the players in a Siege, Peace or PvP zone?
- if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
+ if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) ||_playerA.isInsideZone(ZoneId.NO_PVP) || _playerB.isInsideZone(ZoneId.NO_PVP) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
{
return DuelResult.CANCELED;
}
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/zone/ZoneId.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
index 0ab83f2438..5434025f11 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
@@ -37,6 +37,7 @@ public enum ZoneId
NO_SUMMON_FRIEND,
FORT,
NO_STORE,
+ NO_PVP,
SCRIPT,
HQ,
DANGER_AREA,
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
new file mode 100644
index 0000000000..52fdb5b0a3
--- /dev/null
+++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.l2jmobius.gameserver.model.zone.type;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Summon;
+import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.model.zone.ZoneType;
+
+/**
+ * No PVP Zone
+ * @author Edoo
+ */
+public class NoPvPZone extends ZoneType
+{
+ public NoPvPZone(int id)
+ {
+ super(id);
+ }
+
+ @Override
+ protected void onEnter(Creature creature)
+ {
+ if (!isEnabled())
+ {
+ return;
+ }
+
+ if (creature.isPlayer())
+ {
+ final PlayerInstance player = creature.getActingPlayer();
+ // PVP possible during siege, now for siege participants only
+ // Could also check if this town is in siege, or if any siege is going on
+ if ((player.getSiegeState() != 0) && (Config.PEACE_ZONE_MODE == 1))
+ {
+ return;
+ }
+ }
+
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, true);
+ }
+
+
+ // Send player info to nearby players.
+ if (creature.isPlayer())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ protected void onExit(Creature creature)
+ {
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, false);
+ }
+
+ // Send player info to nearby players.
+ if (creature.isPlayer() && !creature.isTeleporting())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean value)
+ {
+ super.setEnabled(value);
+ if (value)
+ {
+ for (PlayerInstance player : World.getInstance().getPlayers())
+ {
+ if ((player != null) && isInsideZone(player))
+ {
+ revalidateInZone(player);
+
+ if (player.getPet() != null)
+ {
+ revalidateInZone(player.getPet());
+ }
+
+ for (Summon summon : player.getServitors().values())
+ {
+ revalidateInZone(summon);
+ }
+ }
+ }
+ }
+ else
+ {
+ for (Creature creature : getCharactersInside())
+ {
+ if (creature != null)
+ {
+ removeCharacter(creature);
+ }
+ }
+ }
+ }
+}
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
index 696f679789..76aff56251 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
@@ -32,6 +32,8 @@ public class ExSetCompassZoneCode implements IClientOutgoingPacket
public static final int SEVENSIGNSZONE = 0x0D;
public static final int PVPZONE = 0x0E;
public static final int GENERALZONE = 0x0F;
+ // TODO: need to find the desired value
+ public static final int NOPVPZONE = 0x0C;
private final int _zoneType;
diff --git a/L2J_Mobius_5.0_Salvation/dist/game/data/xsd/zones.xsd b/L2J_Mobius_5.0_Salvation/dist/game/data/xsd/zones.xsd
index 4d485a70fe..1cd9137de0 100644
--- a/L2J_Mobius_5.0_Salvation/dist/game/data/xsd/zones.xsd
+++ b/L2J_Mobius_5.0_Salvation/dist/game/data/xsd/zones.xsd
@@ -153,6 +153,7 @@
+
diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/ai/AttackableAI.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/ai/AttackableAI.java
index 6989642791..1104aa3686 100644
--- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/ai/AttackableAI.java
+++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/ai/AttackableAI.java
@@ -170,7 +170,7 @@ public class AttackableAI extends CreatureAI
{
// depending on config, do not allow mobs to attack _new_ players in peacezones,
// unless they are already following those players from outside the peacezone.
- if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE))
+ if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE) && target.isInsideZone(ZoneId.NO_PVP))
{
return false;
}
diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java
index af232b4bab..88b62d2c3d 100644
--- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java
+++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Creature.java
@@ -393,7 +393,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
return true;
}
- return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0);
+ return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0) && (_zones[ZoneId.NO_PVP.ordinal()] == 0);
}
case PEACE:
{
@@ -3955,7 +3955,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return false;
}
- return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE));
+ return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE) || target.isInsideZone(ZoneId.NO_PVP) || attacker.isInsideZone(ZoneId.NO_PVP));
}
/**
diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Summon.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Summon.java
index 289079df0b..33499704bc 100644
--- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Summon.java
+++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Summon.java
@@ -636,7 +636,7 @@ public abstract class Summon extends Playable
final WorldObject currentTarget = _owner.getTarget();
if (currentTarget != null)
{
- target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
+ target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE) || !currentTarget.isInsideZone(ZoneId.NO_PVP)), dontMove, false);
final PlayerInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
index 4c22ba3b8d..720e6f9e47 100644
--- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
+++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
@@ -1846,6 +1846,15 @@ public class PlayerInstance extends Playable
_lastCompassZone = ExSetCompassZoneCode.PEACEZONE;
sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.PEACEZONE));
}
+ else if (isInsideZone(ZoneId.NO_PVP))
+ {
+ if (_lastCompassZone == ExSetCompassZoneCode.NOPVPZONE)
+ {
+ return;
+ }
+ _lastCompassZone = ExSetCompassZoneCode.NOPVPZONE;
+ sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.NOPVPZONE));
+ }
else
{
if (_lastCompassZone == ExSetCompassZoneCode.GENERALZONE)
@@ -8181,7 +8190,7 @@ public class PlayerInstance extends Playable
// Check if the attacker is a Playable
if (attacker.isPlayable())
{
- if (isInsideZone(ZoneId.PEACE))
+ if (isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.NO_PVP))
{
return false;
}
@@ -9390,7 +9399,7 @@ public class PlayerInstance extends Playable
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_FISHING;
return false;
}
- if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE))
+ if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE) || isInsideZone(ZoneId.NO_PVP))
{
_noDuelReason = SystemMessageId.C1_IS_IN_AN_AREA_WHERE_DUEL_IS_NOT_ALLOWED_AND_YOU_CANNOT_APPLY_FOR_A_DUEL;
return false;
diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/entity/Duel.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/entity/Duel.java
index 79f40c05bf..6a5a15fcce 100644
--- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/entity/Duel.java
+++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/entity/Duel.java
@@ -920,7 +920,7 @@ public class Duel
}
// is one of the players in a Siege, Peace or PvP zone?
- if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
+ if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) ||_playerA.isInsideZone(ZoneId.NO_PVP) || _playerB.isInsideZone(ZoneId.NO_PVP) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
{
return DuelResult.CANCELED;
}
diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/zone/ZoneId.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
index 0ab83f2438..5434025f11 100644
--- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
+++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
@@ -37,6 +37,7 @@ public enum ZoneId
NO_SUMMON_FRIEND,
FORT,
NO_STORE,
+ NO_PVP,
SCRIPT,
HQ,
DANGER_AREA,
diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
new file mode 100644
index 0000000000..52fdb5b0a3
--- /dev/null
+++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.l2jmobius.gameserver.model.zone.type;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Summon;
+import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.model.zone.ZoneType;
+
+/**
+ * No PVP Zone
+ * @author Edoo
+ */
+public class NoPvPZone extends ZoneType
+{
+ public NoPvPZone(int id)
+ {
+ super(id);
+ }
+
+ @Override
+ protected void onEnter(Creature creature)
+ {
+ if (!isEnabled())
+ {
+ return;
+ }
+
+ if (creature.isPlayer())
+ {
+ final PlayerInstance player = creature.getActingPlayer();
+ // PVP possible during siege, now for siege participants only
+ // Could also check if this town is in siege, or if any siege is going on
+ if ((player.getSiegeState() != 0) && (Config.PEACE_ZONE_MODE == 1))
+ {
+ return;
+ }
+ }
+
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, true);
+ }
+
+
+ // Send player info to nearby players.
+ if (creature.isPlayer())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ protected void onExit(Creature creature)
+ {
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, false);
+ }
+
+ // Send player info to nearby players.
+ if (creature.isPlayer() && !creature.isTeleporting())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean value)
+ {
+ super.setEnabled(value);
+ if (value)
+ {
+ for (PlayerInstance player : World.getInstance().getPlayers())
+ {
+ if ((player != null) && isInsideZone(player))
+ {
+ revalidateInZone(player);
+
+ if (player.getPet() != null)
+ {
+ revalidateInZone(player.getPet());
+ }
+
+ for (Summon summon : player.getServitors().values())
+ {
+ revalidateInZone(summon);
+ }
+ }
+ }
+ }
+ else
+ {
+ for (Creature creature : getCharactersInside())
+ {
+ if (creature != null)
+ {
+ removeCharacter(creature);
+ }
+ }
+ }
+ }
+}
diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
index 696f679789..76aff56251 100644
--- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
+++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
@@ -32,6 +32,8 @@ public class ExSetCompassZoneCode implements IClientOutgoingPacket
public static final int SEVENSIGNSZONE = 0x0D;
public static final int PVPZONE = 0x0E;
public static final int GENERALZONE = 0x0F;
+ // TODO: need to find the desired value
+ public static final int NOPVPZONE = 0x0C;
private final int _zoneType;
diff --git a/L2J_Mobius_5.5_EtinasFate/dist/game/data/xsd/zones.xsd b/L2J_Mobius_5.5_EtinasFate/dist/game/data/xsd/zones.xsd
index 4d485a70fe..1cd9137de0 100644
--- a/L2J_Mobius_5.5_EtinasFate/dist/game/data/xsd/zones.xsd
+++ b/L2J_Mobius_5.5_EtinasFate/dist/game/data/xsd/zones.xsd
@@ -153,6 +153,7 @@
+
diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/ai/AttackableAI.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/ai/AttackableAI.java
index 6989642791..1104aa3686 100644
--- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/ai/AttackableAI.java
+++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/ai/AttackableAI.java
@@ -170,7 +170,7 @@ public class AttackableAI extends CreatureAI
{
// depending on config, do not allow mobs to attack _new_ players in peacezones,
// unless they are already following those players from outside the peacezone.
- if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE))
+ if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE) && target.isInsideZone(ZoneId.NO_PVP))
{
return false;
}
diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java
index af232b4bab..88b62d2c3d 100644
--- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java
+++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Creature.java
@@ -393,7 +393,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
return true;
}
- return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0);
+ return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0) && (_zones[ZoneId.NO_PVP.ordinal()] == 0);
}
case PEACE:
{
@@ -3955,7 +3955,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return false;
}
- return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE));
+ return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE) || target.isInsideZone(ZoneId.NO_PVP) || attacker.isInsideZone(ZoneId.NO_PVP));
}
/**
diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Summon.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Summon.java
index 289079df0b..33499704bc 100644
--- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Summon.java
+++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Summon.java
@@ -636,7 +636,7 @@ public abstract class Summon extends Playable
final WorldObject currentTarget = _owner.getTarget();
if (currentTarget != null)
{
- target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
+ target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE) || !currentTarget.isInsideZone(ZoneId.NO_PVP)), dontMove, false);
final PlayerInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
index 124b37d3d5..66ca1c1f80 100644
--- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
+++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
@@ -1846,6 +1846,15 @@ public class PlayerInstance extends Playable
_lastCompassZone = ExSetCompassZoneCode.PEACEZONE;
sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.PEACEZONE));
}
+ else if (isInsideZone(ZoneId.NO_PVP))
+ {
+ if (_lastCompassZone == ExSetCompassZoneCode.NOPVPZONE)
+ {
+ return;
+ }
+ _lastCompassZone = ExSetCompassZoneCode.NOPVPZONE;
+ sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.NOPVPZONE));
+ }
else
{
if (_lastCompassZone == ExSetCompassZoneCode.GENERALZONE)
@@ -8181,7 +8190,7 @@ public class PlayerInstance extends Playable
// Check if the attacker is a Playable
if (attacker.isPlayable())
{
- if (isInsideZone(ZoneId.PEACE))
+ if (isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.NO_PVP))
{
return false;
}
@@ -9390,7 +9399,7 @@ public class PlayerInstance extends Playable
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_FISHING;
return false;
}
- if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE))
+ if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE) || isInsideZone(ZoneId.NO_PVP))
{
_noDuelReason = SystemMessageId.C1_IS_IN_AN_AREA_WHERE_DUEL_IS_NOT_ALLOWED_AND_YOU_CANNOT_APPLY_FOR_A_DUEL;
return false;
@@ -12198,16 +12207,16 @@ public class PlayerInstance extends Playable
final int relation1 = getRelation(player);
final RelationChanged rc1 = new RelationChanged();
- rc1.addRelation(this, relation1, !isInsideZone(ZoneId.PEACE));
+ rc1.addRelation(this, relation1, !isInsideZone(ZoneId.PEACE) || !isInsideZone(ZoneId.NO_PVP));
if (hasSummon())
{
if (_pet != null)
{
- rc1.addRelation(_pet, relation1, !isInsideZone(ZoneId.PEACE));
+ rc1.addRelation(_pet, relation1, !isInsideZone(ZoneId.PEACE) || !isInsideZone(ZoneId.NO_PVP));
}
if (hasServitors())
{
- getServitors().values().forEach(s -> rc1.addRelation(s, relation1, !isInsideZone(ZoneId.PEACE)));
+ getServitors().values().forEach(s -> rc1.addRelation(s, relation1, !isInsideZone(ZoneId.PEACE) || !isInsideZone(ZoneId.NO_PVP)));
}
}
player.sendPacket(rc1);
diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/entity/Duel.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/entity/Duel.java
index 28bf57bf83..751140a285 100644
--- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/entity/Duel.java
+++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/entity/Duel.java
@@ -920,7 +920,7 @@ public class Duel
}
// is one of the players in a Siege, Peace or PvP zone?
- if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
+ if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) ||_playerA.isInsideZone(ZoneId.NO_PVP) || _playerB.isInsideZone(ZoneId.NO_PVP) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
{
return DuelResult.CANCELED;
}
diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/zone/ZoneId.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
index 0ab83f2438..5434025f11 100644
--- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
+++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
@@ -37,6 +37,7 @@ public enum ZoneId
NO_SUMMON_FRIEND,
FORT,
NO_STORE,
+ NO_PVP,
SCRIPT,
HQ,
DANGER_AREA,
diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
new file mode 100644
index 0000000000..52fdb5b0a3
--- /dev/null
+++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.l2jmobius.gameserver.model.zone.type;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Summon;
+import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.model.zone.ZoneType;
+
+/**
+ * No PVP Zone
+ * @author Edoo
+ */
+public class NoPvPZone extends ZoneType
+{
+ public NoPvPZone(int id)
+ {
+ super(id);
+ }
+
+ @Override
+ protected void onEnter(Creature creature)
+ {
+ if (!isEnabled())
+ {
+ return;
+ }
+
+ if (creature.isPlayer())
+ {
+ final PlayerInstance player = creature.getActingPlayer();
+ // PVP possible during siege, now for siege participants only
+ // Could also check if this town is in siege, or if any siege is going on
+ if ((player.getSiegeState() != 0) && (Config.PEACE_ZONE_MODE == 1))
+ {
+ return;
+ }
+ }
+
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, true);
+ }
+
+
+ // Send player info to nearby players.
+ if (creature.isPlayer())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ protected void onExit(Creature creature)
+ {
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, false);
+ }
+
+ // Send player info to nearby players.
+ if (creature.isPlayer() && !creature.isTeleporting())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean value)
+ {
+ super.setEnabled(value);
+ if (value)
+ {
+ for (PlayerInstance player : World.getInstance().getPlayers())
+ {
+ if ((player != null) && isInsideZone(player))
+ {
+ revalidateInZone(player);
+
+ if (player.getPet() != null)
+ {
+ revalidateInZone(player.getPet());
+ }
+
+ for (Summon summon : player.getServitors().values())
+ {
+ revalidateInZone(summon);
+ }
+ }
+ }
+ }
+ else
+ {
+ for (Creature creature : getCharactersInside())
+ {
+ if (creature != null)
+ {
+ removeCharacter(creature);
+ }
+ }
+ }
+ }
+}
diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
index 696f679789..76aff56251 100644
--- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
+++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
@@ -32,6 +32,8 @@ public class ExSetCompassZoneCode implements IClientOutgoingPacket
public static final int SEVENSIGNSZONE = 0x0D;
public static final int PVPZONE = 0x0E;
public static final int GENERALZONE = 0x0F;
+ // TODO: need to find the desired value
+ public static final int NOPVPZONE = 0x0C;
private final int _zoneType;
diff --git a/L2J_Mobius_6.0_Fafurion/dist/game/data/xsd/zones.xsd b/L2J_Mobius_6.0_Fafurion/dist/game/data/xsd/zones.xsd
index 4d485a70fe..1cd9137de0 100644
--- a/L2J_Mobius_6.0_Fafurion/dist/game/data/xsd/zones.xsd
+++ b/L2J_Mobius_6.0_Fafurion/dist/game/data/xsd/zones.xsd
@@ -153,6 +153,7 @@
+
diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/ai/AttackableAI.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/ai/AttackableAI.java
index 6989642791..1104aa3686 100644
--- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/ai/AttackableAI.java
+++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/ai/AttackableAI.java
@@ -170,7 +170,7 @@ public class AttackableAI extends CreatureAI
{
// depending on config, do not allow mobs to attack _new_ players in peacezones,
// unless they are already following those players from outside the peacezone.
- if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE))
+ if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE) && target.isInsideZone(ZoneId.NO_PVP))
{
return false;
}
diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java
index af232b4bab..88b62d2c3d 100644
--- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java
+++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Creature.java
@@ -393,7 +393,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
return true;
}
- return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0);
+ return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0) && (_zones[ZoneId.NO_PVP.ordinal()] == 0);
}
case PEACE:
{
@@ -3955,7 +3955,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return false;
}
- return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE));
+ return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE) || target.isInsideZone(ZoneId.NO_PVP) || attacker.isInsideZone(ZoneId.NO_PVP));
}
/**
diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Summon.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Summon.java
index 289079df0b..33499704bc 100644
--- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Summon.java
+++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Summon.java
@@ -636,7 +636,7 @@ public abstract class Summon extends Playable
final WorldObject currentTarget = _owner.getTarget();
if (currentTarget != null)
{
- target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
+ target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE) || !currentTarget.isInsideZone(ZoneId.NO_PVP)), dontMove, false);
final PlayerInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
index 20401ed3dc..7457666b00 100644
--- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
+++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
@@ -1846,6 +1846,15 @@ public class PlayerInstance extends Playable
_lastCompassZone = ExSetCompassZoneCode.PEACEZONE;
sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.PEACEZONE));
}
+ else if (isInsideZone(ZoneId.NO_PVP))
+ {
+ if (_lastCompassZone == ExSetCompassZoneCode.NOPVPZONE)
+ {
+ return;
+ }
+ _lastCompassZone = ExSetCompassZoneCode.NOPVPZONE;
+ sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.NOPVPZONE));
+ }
else
{
if (_lastCompassZone == ExSetCompassZoneCode.GENERALZONE)
@@ -8182,7 +8191,7 @@ public class PlayerInstance extends Playable
// Check if the attacker is a Playable
if (attacker.isPlayable())
{
- if (isInsideZone(ZoneId.PEACE))
+ if (isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.NO_PVP))
{
return false;
}
@@ -9391,7 +9400,7 @@ public class PlayerInstance extends Playable
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_FISHING;
return false;
}
- if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE))
+ if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE) || isInsideZone(ZoneId.NO_PVP))
{
_noDuelReason = SystemMessageId.C1_IS_IN_AN_AREA_WHERE_DUEL_IS_NOT_ALLOWED_AND_YOU_CANNOT_APPLY_FOR_A_DUEL;
return false;
@@ -12204,16 +12213,16 @@ public class PlayerInstance extends Playable
final int relation1 = getRelation(player);
final RelationChanged rc1 = new RelationChanged();
- rc1.addRelation(this, relation1, !isInsideZone(ZoneId.PEACE));
+ rc1.addRelation(this, relation1, !isInsideZone(ZoneId.PEACE) || !isInsideZone(ZoneId.NO_PVP));
if (hasSummon())
{
if (_pet != null)
{
- rc1.addRelation(_pet, relation1, !isInsideZone(ZoneId.PEACE));
+ rc1.addRelation(_pet, relation1, !isInsideZone(ZoneId.PEACE) || !isInsideZone(ZoneId.NO_PVP));
}
if (hasServitors())
{
- getServitors().values().forEach(s -> rc1.addRelation(s, relation1, !isInsideZone(ZoneId.PEACE)));
+ getServitors().values().forEach(s -> rc1.addRelation(s, relation1, !isInsideZone(ZoneId.PEACE) || !isInsideZone(ZoneId.NO_PVP)));
}
}
player.sendPacket(rc1);
diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/entity/Duel.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/entity/Duel.java
index 28bf57bf83..751140a285 100644
--- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/entity/Duel.java
+++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/entity/Duel.java
@@ -920,7 +920,7 @@ public class Duel
}
// is one of the players in a Siege, Peace or PvP zone?
- if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
+ if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) ||_playerA.isInsideZone(ZoneId.NO_PVP) || _playerB.isInsideZone(ZoneId.NO_PVP) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
{
return DuelResult.CANCELED;
}
diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/zone/ZoneId.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
index 0ab83f2438..5434025f11 100644
--- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
+++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
@@ -37,6 +37,7 @@ public enum ZoneId
NO_SUMMON_FRIEND,
FORT,
NO_STORE,
+ NO_PVP,
SCRIPT,
HQ,
DANGER_AREA,
diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
new file mode 100644
index 0000000000..52fdb5b0a3
--- /dev/null
+++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.l2jmobius.gameserver.model.zone.type;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Summon;
+import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.model.zone.ZoneType;
+
+/**
+ * No PVP Zone
+ * @author Edoo
+ */
+public class NoPvPZone extends ZoneType
+{
+ public NoPvPZone(int id)
+ {
+ super(id);
+ }
+
+ @Override
+ protected void onEnter(Creature creature)
+ {
+ if (!isEnabled())
+ {
+ return;
+ }
+
+ if (creature.isPlayer())
+ {
+ final PlayerInstance player = creature.getActingPlayer();
+ // PVP possible during siege, now for siege participants only
+ // Could also check if this town is in siege, or if any siege is going on
+ if ((player.getSiegeState() != 0) && (Config.PEACE_ZONE_MODE == 1))
+ {
+ return;
+ }
+ }
+
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, true);
+ }
+
+
+ // Send player info to nearby players.
+ if (creature.isPlayer())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ protected void onExit(Creature creature)
+ {
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, false);
+ }
+
+ // Send player info to nearby players.
+ if (creature.isPlayer() && !creature.isTeleporting())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean value)
+ {
+ super.setEnabled(value);
+ if (value)
+ {
+ for (PlayerInstance player : World.getInstance().getPlayers())
+ {
+ if ((player != null) && isInsideZone(player))
+ {
+ revalidateInZone(player);
+
+ if (player.getPet() != null)
+ {
+ revalidateInZone(player.getPet());
+ }
+
+ for (Summon summon : player.getServitors().values())
+ {
+ revalidateInZone(summon);
+ }
+ }
+ }
+ }
+ else
+ {
+ for (Creature creature : getCharactersInside())
+ {
+ if (creature != null)
+ {
+ removeCharacter(creature);
+ }
+ }
+ }
+ }
+}
diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
index 696f679789..76aff56251 100644
--- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
+++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
@@ -32,6 +32,8 @@ public class ExSetCompassZoneCode implements IClientOutgoingPacket
public static final int SEVENSIGNSZONE = 0x0D;
public static final int PVPZONE = 0x0E;
public static final int GENERALZONE = 0x0F;
+ // TODO: need to find the desired value
+ public static final int NOPVPZONE = 0x0C;
private final int _zoneType;
diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/xsd/zones.xsd b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/xsd/zones.xsd
index 4d485a70fe..1cd9137de0 100644
--- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/xsd/zones.xsd
+++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/xsd/zones.xsd
@@ -153,6 +153,7 @@
+
diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/zones/no_pvp.xml b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/zones/no_pvp.xml
new file mode 100644
index 0000000000..02be0290cc
--- /dev/null
+++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/zones/no_pvp.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/AttackableAI.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/AttackableAI.java
index 6989642791..1104aa3686 100644
--- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/AttackableAI.java
+++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/ai/AttackableAI.java
@@ -170,7 +170,7 @@ public class AttackableAI extends CreatureAI
{
// depending on config, do not allow mobs to attack _new_ players in peacezones,
// unless they are already following those players from outside the peacezone.
- if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE))
+ if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE) && target.isInsideZone(ZoneId.NO_PVP))
{
return false;
}
diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java
index c4fe3c9658..59c14d567a 100644
--- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java
+++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Creature.java
@@ -393,7 +393,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
return true;
}
- return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0);
+ return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0) && (_zones[ZoneId.NO_PVP.ordinal()] == 0);
}
case PEACE:
{
@@ -3954,7 +3954,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return false;
}
- return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE));
+ return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE) || target.isInsideZone(ZoneId.NO_PVP) || attacker.isInsideZone(ZoneId.NO_PVP));
}
/**
diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Summon.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Summon.java
index 289079df0b..33499704bc 100644
--- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Summon.java
+++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Summon.java
@@ -636,7 +636,7 @@ public abstract class Summon extends Playable
final WorldObject currentTarget = _owner.getTarget();
if (currentTarget != null)
{
- target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
+ target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE) || !currentTarget.isInsideZone(ZoneId.NO_PVP)), dontMove, false);
final PlayerInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
index 5e70861e8e..0146deb339 100644
--- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
+++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
@@ -1855,6 +1855,15 @@ public class PlayerInstance extends Playable
_lastCompassZone = ExSetCompassZoneCode.PEACEZONE;
sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.PEACEZONE));
}
+ else if (isInsideZone(ZoneId.NO_PVP))
+ {
+ if (_lastCompassZone == ExSetCompassZoneCode.NOPVPZONE)
+ {
+ return;
+ }
+ _lastCompassZone = ExSetCompassZoneCode.NOPVPZONE;
+ sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.NOPVPZONE));
+ }
else
{
if (_lastCompassZone == ExSetCompassZoneCode.GENERALZONE)
@@ -8147,7 +8156,7 @@ public class PlayerInstance extends Playable
// Check if the attacker is a Playable
if (attacker.isPlayable())
{
- if (isInsideZone(ZoneId.PEACE))
+ if (isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.NO_PVP))
{
return false;
}
@@ -9356,7 +9365,7 @@ public class PlayerInstance extends Playable
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_HE_OR_SHE_IS_CURRENTLY_FISHING;
return false;
}
- if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE))
+ if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE) || isInsideZone(ZoneId.NO_PVP))
{
_noDuelReason = SystemMessageId.C1_IS_IN_AN_AREA_WHERE_DUEL_IS_NOT_ALLOWED_AND_YOU_CANNOT_APPLY_FOR_A_DUEL;
return false;
@@ -12160,16 +12169,16 @@ public class PlayerInstance extends Playable
final int relation1 = getRelation(player);
final RelationChanged rc1 = new RelationChanged();
- rc1.addRelation(this, relation1, !isInsideZone(ZoneId.PEACE));
+ rc1.addRelation(this, relation1, !isInsideZone(ZoneId.PEACE) || !isInsideZone(ZoneId.NO_PVP));
if (hasSummon())
{
if (_pet != null)
{
- rc1.addRelation(_pet, relation1, !isInsideZone(ZoneId.PEACE));
+ rc1.addRelation(_pet, relation1, !isInsideZone(ZoneId.PEACE) || !isInsideZone(ZoneId.NO_PVP));
}
if (hasServitors())
{
- getServitors().values().forEach(s -> rc1.addRelation(s, relation1, !isInsideZone(ZoneId.PEACE)));
+ getServitors().values().forEach(s -> rc1.addRelation(s, relation1, !isInsideZone(ZoneId.PEACE) || !isInsideZone(ZoneId.NO_PVP)));
}
}
player.sendPacket(rc1);
diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/entity/Duel.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/entity/Duel.java
index 28bf57bf83..751140a285 100644
--- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/entity/Duel.java
+++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/entity/Duel.java
@@ -920,7 +920,7 @@ public class Duel
}
// is one of the players in a Siege, Peace or PvP zone?
- if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
+ if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) ||_playerA.isInsideZone(ZoneId.NO_PVP) || _playerB.isInsideZone(ZoneId.NO_PVP) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
{
return DuelResult.CANCELED;
}
diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/zone/ZoneId.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
index 0ab83f2438..5434025f11 100644
--- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
+++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
@@ -37,6 +37,7 @@ public enum ZoneId
NO_SUMMON_FRIEND,
FORT,
NO_STORE,
+ NO_PVP,
SCRIPT,
HQ,
DANGER_AREA,
diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
new file mode 100644
index 0000000000..52fdb5b0a3
--- /dev/null
+++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.l2jmobius.gameserver.model.zone.type;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Summon;
+import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.model.zone.ZoneType;
+
+/**
+ * No PVP Zone
+ * @author Edoo
+ */
+public class NoPvPZone extends ZoneType
+{
+ public NoPvPZone(int id)
+ {
+ super(id);
+ }
+
+ @Override
+ protected void onEnter(Creature creature)
+ {
+ if (!isEnabled())
+ {
+ return;
+ }
+
+ if (creature.isPlayer())
+ {
+ final PlayerInstance player = creature.getActingPlayer();
+ // PVP possible during siege, now for siege participants only
+ // Could also check if this town is in siege, or if any siege is going on
+ if ((player.getSiegeState() != 0) && (Config.PEACE_ZONE_MODE == 1))
+ {
+ return;
+ }
+ }
+
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, true);
+ }
+
+
+ // Send player info to nearby players.
+ if (creature.isPlayer())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ protected void onExit(Creature creature)
+ {
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, false);
+ }
+
+ // Send player info to nearby players.
+ if (creature.isPlayer() && !creature.isTeleporting())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean value)
+ {
+ super.setEnabled(value);
+ if (value)
+ {
+ for (PlayerInstance player : World.getInstance().getPlayers())
+ {
+ if ((player != null) && isInsideZone(player))
+ {
+ revalidateInZone(player);
+
+ if (player.getPet() != null)
+ {
+ revalidateInZone(player.getPet());
+ }
+
+ for (Summon summon : player.getServitors().values())
+ {
+ revalidateInZone(summon);
+ }
+ }
+ }
+ }
+ else
+ {
+ for (Creature creature : getCharactersInside())
+ {
+ if (creature != null)
+ {
+ removeCharacter(creature);
+ }
+ }
+ }
+ }
+}
diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
index 696f679789..76aff56251 100644
--- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
+++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
@@ -32,6 +32,8 @@ public class ExSetCompassZoneCode implements IClientOutgoingPacket
public static final int SEVENSIGNSZONE = 0x0D;
public static final int PVPZONE = 0x0E;
public static final int GENERALZONE = 0x0F;
+ // TODO: need to find the desired value
+ public static final int NOPVPZONE = 0x0C;
private final int _zoneType;
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/xsd/zones.xsd b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/xsd/zones.xsd
index 4d485a70fe..1cd9137de0 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/xsd/zones.xsd
+++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/xsd/zones.xsd
@@ -153,6 +153,7 @@
+
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/AttackableAI.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/AttackableAI.java
index 6989642791..1104aa3686 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/AttackableAI.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/ai/AttackableAI.java
@@ -170,7 +170,7 @@ public class AttackableAI extends CreatureAI
{
// depending on config, do not allow mobs to attack _new_ players in peacezones,
// unless they are already following those players from outside the peacezone.
- if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE))
+ if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE) && target.isInsideZone(ZoneId.NO_PVP))
{
return false;
}
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java
index 3a7ec53443..74ef0cbe3c 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Creature.java
@@ -392,7 +392,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
return true;
}
- return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0);
+ return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0) && (_zones[ZoneId.NO_PVP.ordinal()] == 0);
}
case PEACE:
{
@@ -3954,7 +3954,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return false;
}
- return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE));
+ return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE) || target.isInsideZone(ZoneId.NO_PVP) || attacker.isInsideZone(ZoneId.NO_PVP));
}
/**
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Summon.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Summon.java
index 339a5ec53e..3b99b69cf3 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Summon.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Summon.java
@@ -636,7 +636,7 @@ public abstract class Summon extends Playable
final WorldObject currentTarget = _owner.getTarget();
if (currentTarget != null)
{
- target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
+ target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE) || !currentTarget.isInsideZone(ZoneId.NO_PVP)), dontMove, false);
final PlayerInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
index efb23dbea5..f6477fc3fd 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
@@ -1817,6 +1817,15 @@ public class PlayerInstance extends Playable
_lastCompassZone = ExSetCompassZoneCode.PEACEZONE;
sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.PEACEZONE));
}
+ else if (isInsideZone(ZoneId.NO_PVP))
+ {
+ if (_lastCompassZone == ExSetCompassZoneCode.NOPVPZONE)
+ {
+ return;
+ }
+ _lastCompassZone = ExSetCompassZoneCode.NOPVPZONE;
+ sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.NOPVPZONE));
+ }
else
{
if (_lastCompassZone == ExSetCompassZoneCode.GENERALZONE)
@@ -8171,7 +8180,7 @@ public class PlayerInstance extends Playable
// Check if the attacker is a Playable
if (attacker.isPlayable())
{
- if (isInsideZone(ZoneId.PEACE))
+ if (isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.NO_PVP))
{
return false;
}
@@ -9356,7 +9365,7 @@ public class PlayerInstance extends Playable
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_FISHING;
return false;
}
- if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE))
+ if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE) || isInsideZone(ZoneId.NO_PVP))
{
_noDuelReason = SystemMessageId.C1_CANNOT_MAKE_A_CHALLENGE_TO_A_DUEL_BECAUSE_C1_IS_CURRENTLY_IN_A_DUEL_PROHIBITED_AREA_PEACEFUL_ZONE_BATTLE_ZONE_NEAR_WATER_RESTART_PROHIBITED_AREA;
return false;
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/entity/Duel.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/entity/Duel.java
index ecf77738ba..f59e01178f 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/entity/Duel.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/entity/Duel.java
@@ -903,7 +903,7 @@ public class Duel
}
// is one of the players in a Siege, Peace or PvP zone?
- if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
+ if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) ||_playerA.isInsideZone(ZoneId.NO_PVP) || _playerB.isInsideZone(ZoneId.NO_PVP) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
{
return DuelResult.CANCELED;
}
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/zone/ZoneId.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
index 0ab83f2438..5434025f11 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
@@ -37,6 +37,7 @@ public enum ZoneId
NO_SUMMON_FRIEND,
FORT,
NO_STORE,
+ NO_PVP,
SCRIPT,
HQ,
DANGER_AREA,
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
new file mode 100644
index 0000000000..52fdb5b0a3
--- /dev/null
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.l2jmobius.gameserver.model.zone.type;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Summon;
+import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.model.zone.ZoneType;
+
+/**
+ * No PVP Zone
+ * @author Edoo
+ */
+public class NoPvPZone extends ZoneType
+{
+ public NoPvPZone(int id)
+ {
+ super(id);
+ }
+
+ @Override
+ protected void onEnter(Creature creature)
+ {
+ if (!isEnabled())
+ {
+ return;
+ }
+
+ if (creature.isPlayer())
+ {
+ final PlayerInstance player = creature.getActingPlayer();
+ // PVP possible during siege, now for siege participants only
+ // Could also check if this town is in siege, or if any siege is going on
+ if ((player.getSiegeState() != 0) && (Config.PEACE_ZONE_MODE == 1))
+ {
+ return;
+ }
+ }
+
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, true);
+ }
+
+
+ // Send player info to nearby players.
+ if (creature.isPlayer())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ protected void onExit(Creature creature)
+ {
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, false);
+ }
+
+ // Send player info to nearby players.
+ if (creature.isPlayer() && !creature.isTeleporting())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean value)
+ {
+ super.setEnabled(value);
+ if (value)
+ {
+ for (PlayerInstance player : World.getInstance().getPlayers())
+ {
+ if ((player != null) && isInsideZone(player))
+ {
+ revalidateInZone(player);
+
+ if (player.getPet() != null)
+ {
+ revalidateInZone(player.getPet());
+ }
+
+ for (Summon summon : player.getServitors().values())
+ {
+ revalidateInZone(summon);
+ }
+ }
+ }
+ }
+ else
+ {
+ for (Creature creature : getCharactersInside())
+ {
+ if (creature != null)
+ {
+ removeCharacter(creature);
+ }
+ }
+ }
+ }
+}
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
index 696f679789..76aff56251 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
@@ -32,6 +32,8 @@ public class ExSetCompassZoneCode implements IClientOutgoingPacket
public static final int SEVENSIGNSZONE = 0x0D;
public static final int PVPZONE = 0x0E;
public static final int GENERALZONE = 0x0F;
+ // TODO: need to find the desired value
+ public static final int NOPVPZONE = 0x0C;
private final int _zoneType;
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/xsd/zones.xsd b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/xsd/zones.xsd
index 4d485a70fe..1cd9137de0 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/xsd/zones.xsd
+++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/xsd/zones.xsd
@@ -153,6 +153,7 @@
+
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/AttackableAI.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/AttackableAI.java
index 6989642791..1104aa3686 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/AttackableAI.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/ai/AttackableAI.java
@@ -170,7 +170,7 @@ public class AttackableAI extends CreatureAI
{
// depending on config, do not allow mobs to attack _new_ players in peacezones,
// unless they are already following those players from outside the peacezone.
- if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE))
+ if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE) && target.isInsideZone(ZoneId.NO_PVP))
{
return false;
}
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java
index 3a7ec53443..74ef0cbe3c 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Creature.java
@@ -392,7 +392,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
return true;
}
- return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0);
+ return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0) && (_zones[ZoneId.NO_PVP.ordinal()] == 0);
}
case PEACE:
{
@@ -3954,7 +3954,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return false;
}
- return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE));
+ return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE) || target.isInsideZone(ZoneId.NO_PVP) || attacker.isInsideZone(ZoneId.NO_PVP));
}
/**
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Summon.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Summon.java
index 339a5ec53e..3b99b69cf3 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Summon.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Summon.java
@@ -636,7 +636,7 @@ public abstract class Summon extends Playable
final WorldObject currentTarget = _owner.getTarget();
if (currentTarget != null)
{
- target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
+ target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE) || !currentTarget.isInsideZone(ZoneId.NO_PVP)), dontMove, false);
final PlayerInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
index feb7a7160e..bbceeebbe7 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
@@ -1818,6 +1818,15 @@ public class PlayerInstance extends Playable
_lastCompassZone = ExSetCompassZoneCode.PEACEZONE;
sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.PEACEZONE));
}
+ else if (isInsideZone(ZoneId.NO_PVP))
+ {
+ if (_lastCompassZone == ExSetCompassZoneCode.NOPVPZONE)
+ {
+ return;
+ }
+ _lastCompassZone = ExSetCompassZoneCode.NOPVPZONE;
+ sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.NOPVPZONE));
+ }
else
{
if (_lastCompassZone == ExSetCompassZoneCode.GENERALZONE)
@@ -8172,7 +8181,7 @@ public class PlayerInstance extends Playable
// Check if the attacker is a Playable
if (attacker.isPlayable())
{
- if (isInsideZone(ZoneId.PEACE))
+ if (isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.NO_PVP))
{
return false;
}
@@ -9363,7 +9372,7 @@ public class PlayerInstance extends Playable
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_FISHING;
return false;
}
- if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE))
+ if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE) || isInsideZone(ZoneId.NO_PVP))
{
_noDuelReason = SystemMessageId.C1_IS_IN_AN_AREA_WHERE_DUEL_IS_NOT_ALLOWED_AND_YOU_CANNOT_APPLY_FOR_A_DUEL;
return false;
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/entity/Duel.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/entity/Duel.java
index 28bf57bf83..751140a285 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/entity/Duel.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/entity/Duel.java
@@ -920,7 +920,7 @@ public class Duel
}
// is one of the players in a Siege, Peace or PvP zone?
- if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
+ if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) ||_playerA.isInsideZone(ZoneId.NO_PVP) || _playerB.isInsideZone(ZoneId.NO_PVP) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
{
return DuelResult.CANCELED;
}
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/zone/ZoneId.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
index 0ab83f2438..5434025f11 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
@@ -37,6 +37,7 @@ public enum ZoneId
NO_SUMMON_FRIEND,
FORT,
NO_STORE,
+ NO_PVP,
SCRIPT,
HQ,
DANGER_AREA,
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
new file mode 100644
index 0000000000..52fdb5b0a3
--- /dev/null
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.l2jmobius.gameserver.model.zone.type;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Summon;
+import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.model.zone.ZoneType;
+
+/**
+ * No PVP Zone
+ * @author Edoo
+ */
+public class NoPvPZone extends ZoneType
+{
+ public NoPvPZone(int id)
+ {
+ super(id);
+ }
+
+ @Override
+ protected void onEnter(Creature creature)
+ {
+ if (!isEnabled())
+ {
+ return;
+ }
+
+ if (creature.isPlayer())
+ {
+ final PlayerInstance player = creature.getActingPlayer();
+ // PVP possible during siege, now for siege participants only
+ // Could also check if this town is in siege, or if any siege is going on
+ if ((player.getSiegeState() != 0) && (Config.PEACE_ZONE_MODE == 1))
+ {
+ return;
+ }
+ }
+
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, true);
+ }
+
+
+ // Send player info to nearby players.
+ if (creature.isPlayer())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ protected void onExit(Creature creature)
+ {
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, false);
+ }
+
+ // Send player info to nearby players.
+ if (creature.isPlayer() && !creature.isTeleporting())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean value)
+ {
+ super.setEnabled(value);
+ if (value)
+ {
+ for (PlayerInstance player : World.getInstance().getPlayers())
+ {
+ if ((player != null) && isInsideZone(player))
+ {
+ revalidateInZone(player);
+
+ if (player.getPet() != null)
+ {
+ revalidateInZone(player.getPet());
+ }
+
+ for (Summon summon : player.getServitors().values())
+ {
+ revalidateInZone(summon);
+ }
+ }
+ }
+ }
+ else
+ {
+ for (Creature creature : getCharactersInside())
+ {
+ if (creature != null)
+ {
+ removeCharacter(creature);
+ }
+ }
+ }
+ }
+}
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
index 696f679789..76aff56251 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
@@ -32,6 +32,8 @@ public class ExSetCompassZoneCode implements IClientOutgoingPacket
public static final int SEVENSIGNSZONE = 0x0D;
public static final int PVPZONE = 0x0E;
public static final int GENERALZONE = 0x0F;
+ // TODO: need to find the desired value
+ public static final int NOPVPZONE = 0x0C;
private final int _zoneType;
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/xsd/zones.xsd b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/xsd/zones.xsd
index 4d485a70fe..1cd9137de0 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/xsd/zones.xsd
+++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/xsd/zones.xsd
@@ -153,6 +153,7 @@
+
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/AttackableAI.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/AttackableAI.java
index 6989642791..1104aa3686 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/AttackableAI.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/ai/AttackableAI.java
@@ -170,7 +170,7 @@ public class AttackableAI extends CreatureAI
{
// depending on config, do not allow mobs to attack _new_ players in peacezones,
// unless they are already following those players from outside the peacezone.
- if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE))
+ if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE) && target.isInsideZone(ZoneId.NO_PVP))
{
return false;
}
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java
index 3de090507b..6841ad17d8 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Creature.java
@@ -392,7 +392,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
return true;
}
- return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0);
+ return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0) && (_zones[ZoneId.NO_PVP.ordinal()] == 0);
}
case PEACE:
{
@@ -3954,7 +3954,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return false;
}
- return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE));
+ return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE) || target.isInsideZone(ZoneId.NO_PVP) || attacker.isInsideZone(ZoneId.NO_PVP));
}
/**
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Summon.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Summon.java
index 339a5ec53e..3b99b69cf3 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Summon.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Summon.java
@@ -636,7 +636,7 @@ public abstract class Summon extends Playable
final WorldObject currentTarget = _owner.getTarget();
if (currentTarget != null)
{
- target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
+ target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE) || !currentTarget.isInsideZone(ZoneId.NO_PVP)), dontMove, false);
final PlayerInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
index 6cc1b65adb..b4ffe8e17b 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
@@ -1816,6 +1816,15 @@ public class PlayerInstance extends Playable
_lastCompassZone = ExSetCompassZoneCode.PEACEZONE;
sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.PEACEZONE));
}
+ else if (isInsideZone(ZoneId.NO_PVP))
+ {
+ if (_lastCompassZone == ExSetCompassZoneCode.NOPVPZONE)
+ {
+ return;
+ }
+ _lastCompassZone = ExSetCompassZoneCode.NOPVPZONE;
+ sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.NOPVPZONE));
+ }
else
{
if (_lastCompassZone == ExSetCompassZoneCode.GENERALZONE)
@@ -8157,7 +8166,7 @@ public class PlayerInstance extends Playable
// Check if the attacker is a Playable
if (attacker.isPlayable())
{
- if (isInsideZone(ZoneId.PEACE))
+ if (isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.NO_PVP))
{
return false;
}
@@ -9348,7 +9357,7 @@ public class PlayerInstance extends Playable
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_FISHING;
return false;
}
- if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE))
+ if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE) || isInsideZone(ZoneId.NO_PVP))
{
_noDuelReason = SystemMessageId.C1_IS_IN_AN_AREA_WHERE_DUEL_IS_NOT_ALLOWED_AND_YOU_CANNOT_APPLY_FOR_A_DUEL;
return false;
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/entity/Duel.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/entity/Duel.java
index 28bf57bf83..751140a285 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/entity/Duel.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/entity/Duel.java
@@ -920,7 +920,7 @@ public class Duel
}
// is one of the players in a Siege, Peace or PvP zone?
- if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
+ if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) ||_playerA.isInsideZone(ZoneId.NO_PVP) || _playerB.isInsideZone(ZoneId.NO_PVP) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
{
return DuelResult.CANCELED;
}
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/zone/ZoneId.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
index 0ab83f2438..5434025f11 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
@@ -37,6 +37,7 @@ public enum ZoneId
NO_SUMMON_FRIEND,
FORT,
NO_STORE,
+ NO_PVP,
SCRIPT,
HQ,
DANGER_AREA,
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
new file mode 100644
index 0000000000..52fdb5b0a3
--- /dev/null
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.l2jmobius.gameserver.model.zone.type;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Summon;
+import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.model.zone.ZoneType;
+
+/**
+ * No PVP Zone
+ * @author Edoo
+ */
+public class NoPvPZone extends ZoneType
+{
+ public NoPvPZone(int id)
+ {
+ super(id);
+ }
+
+ @Override
+ protected void onEnter(Creature creature)
+ {
+ if (!isEnabled())
+ {
+ return;
+ }
+
+ if (creature.isPlayer())
+ {
+ final PlayerInstance player = creature.getActingPlayer();
+ // PVP possible during siege, now for siege participants only
+ // Could also check if this town is in siege, or if any siege is going on
+ if ((player.getSiegeState() != 0) && (Config.PEACE_ZONE_MODE == 1))
+ {
+ return;
+ }
+ }
+
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, true);
+ }
+
+
+ // Send player info to nearby players.
+ if (creature.isPlayer())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ protected void onExit(Creature creature)
+ {
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, false);
+ }
+
+ // Send player info to nearby players.
+ if (creature.isPlayer() && !creature.isTeleporting())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean value)
+ {
+ super.setEnabled(value);
+ if (value)
+ {
+ for (PlayerInstance player : World.getInstance().getPlayers())
+ {
+ if ((player != null) && isInsideZone(player))
+ {
+ revalidateInZone(player);
+
+ if (player.getPet() != null)
+ {
+ revalidateInZone(player.getPet());
+ }
+
+ for (Summon summon : player.getServitors().values())
+ {
+ revalidateInZone(summon);
+ }
+ }
+ }
+ }
+ else
+ {
+ for (Creature creature : getCharactersInside())
+ {
+ if (creature != null)
+ {
+ removeCharacter(creature);
+ }
+ }
+ }
+ }
+}
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
index 696f679789..76aff56251 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
@@ -32,6 +32,8 @@ public class ExSetCompassZoneCode implements IClientOutgoingPacket
public static final int SEVENSIGNSZONE = 0x0D;
public static final int PVPZONE = 0x0E;
public static final int GENERALZONE = 0x0F;
+ // TODO: need to find the desired value
+ public static final int NOPVPZONE = 0x0C;
private final int _zoneType;
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/xsd/zones.xsd b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/xsd/zones.xsd
index 4d485a70fe..1cd9137de0 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/xsd/zones.xsd
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/xsd/zones.xsd
@@ -153,6 +153,7 @@
+
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/AttackableAI.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/AttackableAI.java
index 6989642791..1104aa3686 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/AttackableAI.java
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/ai/AttackableAI.java
@@ -170,7 +170,7 @@ public class AttackableAI extends CreatureAI
{
// depending on config, do not allow mobs to attack _new_ players in peacezones,
// unless they are already following those players from outside the peacezone.
- if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE))
+ if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE) && target.isInsideZone(ZoneId.NO_PVP))
{
return false;
}
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java
index be4e018403..7d7801d0e0 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Creature.java
@@ -393,7 +393,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
return true;
}
- return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0);
+ return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0) && (_zones[ZoneId.NO_PVP.ordinal()] == 0);
}
case PEACE:
{
@@ -3967,7 +3967,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return false;
}
- return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE));
+ return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE) || target.isInsideZone(ZoneId.NO_PVP) || attacker.isInsideZone(ZoneId.NO_PVP));
}
/**
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Summon.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Summon.java
index e24d4a2b0f..8fbb2968a2 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Summon.java
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Summon.java
@@ -636,7 +636,7 @@ public abstract class Summon extends Playable
final WorldObject currentTarget = _owner.getTarget();
if (currentTarget != null)
{
- target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
+ target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE) || !currentTarget.isInsideZone(ZoneId.NO_PVP)), dontMove, false);
final PlayerInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
index 50bafaabb5..13e8b819c0 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
@@ -1826,6 +1826,15 @@ public class PlayerInstance extends Playable
_lastCompassZone = ExSetCompassZoneCode.PEACEZONE;
sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.PEACEZONE));
}
+ else if (isInsideZone(ZoneId.NO_PVP))
+ {
+ if (_lastCompassZone == ExSetCompassZoneCode.NOPVPZONE)
+ {
+ return;
+ }
+ _lastCompassZone = ExSetCompassZoneCode.NOPVPZONE;
+ sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.NOPVPZONE));
+ }
else
{
if (_lastCompassZone == ExSetCompassZoneCode.GENERALZONE)
@@ -8184,7 +8193,7 @@ public class PlayerInstance extends Playable
// Check if the attacker is a Playable
if (attacker.isPlayable())
{
- if (isInsideZone(ZoneId.PEACE))
+ if (isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.NO_PVP))
{
return false;
}
@@ -9375,7 +9384,7 @@ public class PlayerInstance extends Playable
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_FISHING;
return false;
}
- if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE))
+ if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE) || isInsideZone(ZoneId.NO_PVP))
{
_noDuelReason = SystemMessageId.C1_IS_IN_AN_AREA_WHERE_DUEL_IS_NOT_ALLOWED_AND_YOU_CANNOT_APPLY_FOR_A_DUEL;
return false;
@@ -12115,16 +12124,16 @@ public class PlayerInstance extends Playable
final int relation1 = getRelation(player);
final RelationChanged rc1 = new RelationChanged();
- rc1.addRelation(this, relation1, !isInsideZone(ZoneId.PEACE));
+ rc1.addRelation(this, relation1, !isInsideZone(ZoneId.PEACE) || !isInsideZone(ZoneId.NO_PVP));
if (hasSummon())
{
if (_pet != null)
{
- rc1.addRelation(_pet, relation1, !isInsideZone(ZoneId.PEACE));
+ rc1.addRelation(_pet, relation1, !isInsideZone(ZoneId.PEACE) || !isInsideZone(ZoneId.NO_PVP));
}
if (hasServitors())
{
- getServitors().values().forEach(s -> rc1.addRelation(s, relation1, !isInsideZone(ZoneId.PEACE)));
+ getServitors().values().forEach(s -> rc1.addRelation(s, relation1, !isInsideZone(ZoneId.PEACE) || !isInsideZone(ZoneId.NO_PVP)));
}
}
player.sendPacket(rc1);
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/entity/Duel.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/entity/Duel.java
index 28bf57bf83..751140a285 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/entity/Duel.java
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/entity/Duel.java
@@ -920,7 +920,7 @@ public class Duel
}
// is one of the players in a Siege, Peace or PvP zone?
- if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
+ if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) ||_playerA.isInsideZone(ZoneId.NO_PVP) || _playerB.isInsideZone(ZoneId.NO_PVP) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
{
return DuelResult.CANCELED;
}
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/zone/ZoneId.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
index 0ab83f2438..5434025f11 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
@@ -37,6 +37,7 @@ public enum ZoneId
NO_SUMMON_FRIEND,
FORT,
NO_STORE,
+ NO_PVP,
SCRIPT,
HQ,
DANGER_AREA,
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
new file mode 100644
index 0000000000..52fdb5b0a3
--- /dev/null
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.l2jmobius.gameserver.model.zone.type;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Summon;
+import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.model.zone.ZoneType;
+
+/**
+ * No PVP Zone
+ * @author Edoo
+ */
+public class NoPvPZone extends ZoneType
+{
+ public NoPvPZone(int id)
+ {
+ super(id);
+ }
+
+ @Override
+ protected void onEnter(Creature creature)
+ {
+ if (!isEnabled())
+ {
+ return;
+ }
+
+ if (creature.isPlayer())
+ {
+ final PlayerInstance player = creature.getActingPlayer();
+ // PVP possible during siege, now for siege participants only
+ // Could also check if this town is in siege, or if any siege is going on
+ if ((player.getSiegeState() != 0) && (Config.PEACE_ZONE_MODE == 1))
+ {
+ return;
+ }
+ }
+
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, true);
+ }
+
+
+ // Send player info to nearby players.
+ if (creature.isPlayer())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ protected void onExit(Creature creature)
+ {
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, false);
+ }
+
+ // Send player info to nearby players.
+ if (creature.isPlayer() && !creature.isTeleporting())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean value)
+ {
+ super.setEnabled(value);
+ if (value)
+ {
+ for (PlayerInstance player : World.getInstance().getPlayers())
+ {
+ if ((player != null) && isInsideZone(player))
+ {
+ revalidateInZone(player);
+
+ if (player.getPet() != null)
+ {
+ revalidateInZone(player.getPet());
+ }
+
+ for (Summon summon : player.getServitors().values())
+ {
+ revalidateInZone(summon);
+ }
+ }
+ }
+ }
+ else
+ {
+ for (Creature creature : getCharactersInside())
+ {
+ if (creature != null)
+ {
+ removeCharacter(creature);
+ }
+ }
+ }
+ }
+}
diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
index 696f679789..76aff56251 100644
--- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
+++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
@@ -32,6 +32,8 @@ public class ExSetCompassZoneCode implements IClientOutgoingPacket
public static final int SEVENSIGNSZONE = 0x0D;
public static final int PVPZONE = 0x0E;
public static final int GENERALZONE = 0x0F;
+ // TODO: need to find the desired value
+ public static final int NOPVPZONE = 0x0C;
private final int _zoneType;
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/xsd/zones.xsd b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/xsd/zones.xsd
index 4d485a70fe..1cd9137de0 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/xsd/zones.xsd
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/xsd/zones.xsd
@@ -153,6 +153,7 @@
+
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/AttackableAI.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/AttackableAI.java
index 6989642791..1104aa3686 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/AttackableAI.java
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/ai/AttackableAI.java
@@ -170,7 +170,7 @@ public class AttackableAI extends CreatureAI
{
// depending on config, do not allow mobs to attack _new_ players in peacezones,
// unless they are already following those players from outside the peacezone.
- if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE))
+ if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE) && target.isInsideZone(ZoneId.NO_PVP))
{
return false;
}
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java
index be4e018403..7d7801d0e0 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Creature.java
@@ -393,7 +393,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
return true;
}
- return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0);
+ return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0) && (_zones[ZoneId.NO_PVP.ordinal()] == 0);
}
case PEACE:
{
@@ -3967,7 +3967,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return false;
}
- return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE));
+ return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE) || target.isInsideZone(ZoneId.NO_PVP) || attacker.isInsideZone(ZoneId.NO_PVP));
}
/**
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Summon.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Summon.java
index e24d4a2b0f..8fbb2968a2 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Summon.java
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Summon.java
@@ -636,7 +636,7 @@ public abstract class Summon extends Playable
final WorldObject currentTarget = _owner.getTarget();
if (currentTarget != null)
{
- target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
+ target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE) || !currentTarget.isInsideZone(ZoneId.NO_PVP)), dontMove, false);
final PlayerInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
index e2b4fb1c79..65f393c6a9 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
@@ -1826,6 +1826,15 @@ public class PlayerInstance extends Playable
_lastCompassZone = ExSetCompassZoneCode.PEACEZONE;
sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.PEACEZONE));
}
+ else if (isInsideZone(ZoneId.NO_PVP))
+ {
+ if (_lastCompassZone == ExSetCompassZoneCode.NOPVPZONE)
+ {
+ return;
+ }
+ _lastCompassZone = ExSetCompassZoneCode.NOPVPZONE;
+ sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.NOPVPZONE));
+ }
else
{
if (_lastCompassZone == ExSetCompassZoneCode.GENERALZONE)
@@ -8184,7 +8193,7 @@ public class PlayerInstance extends Playable
// Check if the attacker is a Playable
if (attacker.isPlayable())
{
- if (isInsideZone(ZoneId.PEACE))
+ if (isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.NO_PVP))
{
return false;
}
@@ -9375,7 +9384,7 @@ public class PlayerInstance extends Playable
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_FISHING;
return false;
}
- if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE))
+ if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE) || isInsideZone(ZoneId.NO_PVP))
{
_noDuelReason = SystemMessageId.C1_IS_IN_AN_AREA_WHERE_DUEL_IS_NOT_ALLOWED_AND_YOU_CANNOT_APPLY_FOR_A_DUEL;
return false;
@@ -12115,16 +12124,16 @@ public class PlayerInstance extends Playable
final int relation1 = getRelation(player);
final RelationChanged rc1 = new RelationChanged();
- rc1.addRelation(this, relation1, !isInsideZone(ZoneId.PEACE));
+ rc1.addRelation(this, relation1, !isInsideZone(ZoneId.PEACE) || !isInsideZone(ZoneId.NO_PVP));
if (hasSummon())
{
if (_pet != null)
{
- rc1.addRelation(_pet, relation1, !isInsideZone(ZoneId.PEACE));
+ rc1.addRelation(_pet, relation1, !isInsideZone(ZoneId.PEACE) || !isInsideZone(ZoneId.NO_PVP));
}
if (hasServitors())
{
- getServitors().values().forEach(s -> rc1.addRelation(s, relation1, !isInsideZone(ZoneId.PEACE)));
+ getServitors().values().forEach(s -> rc1.addRelation(s, relation1, !isInsideZone(ZoneId.PEACE) || !isInsideZone(ZoneId.NO_PVP)));
}
}
player.sendPacket(rc1);
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/entity/Duel.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/entity/Duel.java
index 28bf57bf83..751140a285 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/entity/Duel.java
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/entity/Duel.java
@@ -920,7 +920,7 @@ public class Duel
}
// is one of the players in a Siege, Peace or PvP zone?
- if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
+ if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) ||_playerA.isInsideZone(ZoneId.NO_PVP) || _playerB.isInsideZone(ZoneId.NO_PVP) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
{
return DuelResult.CANCELED;
}
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/zone/ZoneId.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
index 0ab83f2438..5434025f11 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
@@ -37,6 +37,7 @@ public enum ZoneId
NO_SUMMON_FRIEND,
FORT,
NO_STORE,
+ NO_PVP,
SCRIPT,
HQ,
DANGER_AREA,
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
new file mode 100644
index 0000000000..52fdb5b0a3
--- /dev/null
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.l2jmobius.gameserver.model.zone.type;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Summon;
+import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.model.zone.ZoneType;
+
+/**
+ * No PVP Zone
+ * @author Edoo
+ */
+public class NoPvPZone extends ZoneType
+{
+ public NoPvPZone(int id)
+ {
+ super(id);
+ }
+
+ @Override
+ protected void onEnter(Creature creature)
+ {
+ if (!isEnabled())
+ {
+ return;
+ }
+
+ if (creature.isPlayer())
+ {
+ final PlayerInstance player = creature.getActingPlayer();
+ // PVP possible during siege, now for siege participants only
+ // Could also check if this town is in siege, or if any siege is going on
+ if ((player.getSiegeState() != 0) && (Config.PEACE_ZONE_MODE == 1))
+ {
+ return;
+ }
+ }
+
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, true);
+ }
+
+
+ // Send player info to nearby players.
+ if (creature.isPlayer())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ protected void onExit(Creature creature)
+ {
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, false);
+ }
+
+ // Send player info to nearby players.
+ if (creature.isPlayer() && !creature.isTeleporting())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean value)
+ {
+ super.setEnabled(value);
+ if (value)
+ {
+ for (PlayerInstance player : World.getInstance().getPlayers())
+ {
+ if ((player != null) && isInsideZone(player))
+ {
+ revalidateInZone(player);
+
+ if (player.getPet() != null)
+ {
+ revalidateInZone(player.getPet());
+ }
+
+ for (Summon summon : player.getServitors().values())
+ {
+ revalidateInZone(summon);
+ }
+ }
+ }
+ }
+ else
+ {
+ for (Creature creature : getCharactersInside())
+ {
+ if (creature != null)
+ {
+ removeCharacter(creature);
+ }
+ }
+ }
+ }
+}
diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
index 696f679789..76aff56251 100644
--- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
+++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
@@ -32,6 +32,8 @@ public class ExSetCompassZoneCode implements IClientOutgoingPacket
public static final int SEVENSIGNSZONE = 0x0D;
public static final int PVPZONE = 0x0E;
public static final int GENERALZONE = 0x0F;
+ // TODO: need to find the desired value
+ public static final int NOPVPZONE = 0x0C;
private final int _zoneType;
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/xsd/zones.xsd b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/xsd/zones.xsd
index 4d485a70fe..1cd9137de0 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/xsd/zones.xsd
+++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/xsd/zones.xsd
@@ -153,6 +153,7 @@
+
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/AttackableAI.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/AttackableAI.java
index 6989642791..1104aa3686 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/AttackableAI.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/ai/AttackableAI.java
@@ -170,7 +170,7 @@ public class AttackableAI extends CreatureAI
{
// depending on config, do not allow mobs to attack _new_ players in peacezones,
// unless they are already following those players from outside the peacezone.
- if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE))
+ if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE) && target.isInsideZone(ZoneId.NO_PVP))
{
return false;
}
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java
index d0ac062591..2f0bfe7591 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Creature.java
@@ -393,7 +393,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
return true;
}
- return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0);
+ return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0) && (_zones[ZoneId.NO_PVP.ordinal()] == 0);
}
case PEACE:
{
@@ -3966,7 +3966,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return false;
}
- return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE));
+ return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE) || target.isInsideZone(ZoneId.NO_PVP) || attacker.isInsideZone(ZoneId.NO_PVP));
}
/**
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Summon.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Summon.java
index e24d4a2b0f..8fbb2968a2 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Summon.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Summon.java
@@ -636,7 +636,7 @@ public abstract class Summon extends Playable
final WorldObject currentTarget = _owner.getTarget();
if (currentTarget != null)
{
- target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
+ target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE) || !currentTarget.isInsideZone(ZoneId.NO_PVP)), dontMove, false);
final PlayerInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
index 24cda65305..d0fb5372fe 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
@@ -1832,6 +1832,15 @@ public class PlayerInstance extends Playable
_lastCompassZone = ExSetCompassZoneCode.PEACEZONE;
sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.PEACEZONE));
}
+ else if (isInsideZone(ZoneId.NO_PVP))
+ {
+ if (_lastCompassZone == ExSetCompassZoneCode.NOPVPZONE)
+ {
+ return;
+ }
+ _lastCompassZone = ExSetCompassZoneCode.NOPVPZONE;
+ sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.NOPVPZONE));
+ }
else
{
if (_lastCompassZone == ExSetCompassZoneCode.GENERALZONE)
@@ -8088,7 +8097,7 @@ public class PlayerInstance extends Playable
// Check if the attacker is a Playable
if (attacker.isPlayable())
{
- if (isInsideZone(ZoneId.PEACE))
+ if (isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.NO_PVP))
{
return false;
}
@@ -9279,7 +9288,7 @@ public class PlayerInstance extends Playable
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_FISHING;
return false;
}
- if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE))
+ if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE) || isInsideZone(ZoneId.NO_PVP))
{
_noDuelReason = SystemMessageId.C1_IS_IN_AN_AREA_WHERE_DUEL_IS_NOT_ALLOWED_AND_YOU_CANNOT_APPLY_FOR_A_DUEL;
return false;
@@ -12005,16 +12014,16 @@ public class PlayerInstance extends Playable
final int relation1 = getRelation(player);
final RelationChanged rc1 = new RelationChanged();
- rc1.addRelation(this, relation1, !isInsideZone(ZoneId.PEACE));
+ rc1.addRelation(this, relation1, !isInsideZone(ZoneId.PEACE) || !isInsideZone(ZoneId.NO_PVP));
if (hasSummon())
{
if (_pet != null)
{
- rc1.addRelation(_pet, relation1, !isInsideZone(ZoneId.PEACE));
+ rc1.addRelation(_pet, relation1, !isInsideZone(ZoneId.PEACE) || !isInsideZone(ZoneId.NO_PVP));
}
if (hasServitors())
{
- getServitors().values().forEach(s -> rc1.addRelation(s, relation1, !isInsideZone(ZoneId.PEACE)));
+ getServitors().values().forEach(s -> rc1.addRelation(s, relation1, !isInsideZone(ZoneId.PEACE) || !isInsideZone(ZoneId.NO_PVP)));
}
}
player.sendPacket(rc1);
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/entity/Duel.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/entity/Duel.java
index 28bf57bf83..751140a285 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/entity/Duel.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/entity/Duel.java
@@ -920,7 +920,7 @@ public class Duel
}
// is one of the players in a Siege, Peace or PvP zone?
- if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
+ if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) ||_playerA.isInsideZone(ZoneId.NO_PVP) || _playerB.isInsideZone(ZoneId.NO_PVP) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
{
return DuelResult.CANCELED;
}
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/zone/ZoneId.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
index 0ab83f2438..5434025f11 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
@@ -37,6 +37,7 @@ public enum ZoneId
NO_SUMMON_FRIEND,
FORT,
NO_STORE,
+ NO_PVP,
SCRIPT,
HQ,
DANGER_AREA,
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
new file mode 100644
index 0000000000..52fdb5b0a3
--- /dev/null
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.l2jmobius.gameserver.model.zone.type;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Summon;
+import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.model.zone.ZoneType;
+
+/**
+ * No PVP Zone
+ * @author Edoo
+ */
+public class NoPvPZone extends ZoneType
+{
+ public NoPvPZone(int id)
+ {
+ super(id);
+ }
+
+ @Override
+ protected void onEnter(Creature creature)
+ {
+ if (!isEnabled())
+ {
+ return;
+ }
+
+ if (creature.isPlayer())
+ {
+ final PlayerInstance player = creature.getActingPlayer();
+ // PVP possible during siege, now for siege participants only
+ // Could also check if this town is in siege, or if any siege is going on
+ if ((player.getSiegeState() != 0) && (Config.PEACE_ZONE_MODE == 1))
+ {
+ return;
+ }
+ }
+
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, true);
+ }
+
+
+ // Send player info to nearby players.
+ if (creature.isPlayer())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ protected void onExit(Creature creature)
+ {
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, false);
+ }
+
+ // Send player info to nearby players.
+ if (creature.isPlayer() && !creature.isTeleporting())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean value)
+ {
+ super.setEnabled(value);
+ if (value)
+ {
+ for (PlayerInstance player : World.getInstance().getPlayers())
+ {
+ if ((player != null) && isInsideZone(player))
+ {
+ revalidateInZone(player);
+
+ if (player.getPet() != null)
+ {
+ revalidateInZone(player.getPet());
+ }
+
+ for (Summon summon : player.getServitors().values())
+ {
+ revalidateInZone(summon);
+ }
+ }
+ }
+ }
+ else
+ {
+ for (Creature creature : getCharactersInside())
+ {
+ if (creature != null)
+ {
+ removeCharacter(creature);
+ }
+ }
+ }
+ }
+}
diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
index 696f679789..76aff56251 100644
--- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
+++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
@@ -32,6 +32,8 @@ public class ExSetCompassZoneCode implements IClientOutgoingPacket
public static final int SEVENSIGNSZONE = 0x0D;
public static final int PVPZONE = 0x0E;
public static final int GENERALZONE = 0x0F;
+ // TODO: need to find the desired value
+ public static final int NOPVPZONE = 0x0C;
private final int _zoneType;
diff --git a/L2J_Mobius_Classic_Interlude/dist/game/data/xsd/zones.xsd b/L2J_Mobius_Classic_Interlude/dist/game/data/xsd/zones.xsd
index 4d485a70fe..1cd9137de0 100644
--- a/L2J_Mobius_Classic_Interlude/dist/game/data/xsd/zones.xsd
+++ b/L2J_Mobius_Classic_Interlude/dist/game/data/xsd/zones.xsd
@@ -153,6 +153,7 @@
+
diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/AttackableAI.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/AttackableAI.java
index d6c57fc28c..d57d3d45ba 100644
--- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/AttackableAI.java
+++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/ai/AttackableAI.java
@@ -170,7 +170,7 @@ public class AttackableAI extends CreatureAI
{
// depending on config, do not allow mobs to attack _new_ players in peacezones,
// unless they are already following those players from outside the peacezone.
- if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE))
+ if (!Config.ALT_MOB_AGRO_IN_PEACEZONE && target.isInsideZone(ZoneId.PEACE) && target.isInsideZone(ZoneId.NO_PVP))
{
return false;
}
diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java
index 3a7ec53443..74ef0cbe3c 100644
--- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java
+++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Creature.java
@@ -392,7 +392,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
return true;
}
- return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0);
+ return (_zones[ZoneId.PVP.ordinal()] > 0) && (_zones[ZoneId.PEACE.ordinal()] == 0) && (_zones[ZoneId.NO_PVP.ordinal()] == 0);
}
case PEACE:
{
@@ -3954,7 +3954,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
return false;
}
- return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE));
+ return (target.isInsideZone(ZoneId.PEACE) || attacker.isInsideZone(ZoneId.PEACE) || target.isInsideZone(ZoneId.NO_PVP) || attacker.isInsideZone(ZoneId.NO_PVP));
}
/**
diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Summon.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Summon.java
index 339a5ec53e..3b99b69cf3 100644
--- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Summon.java
+++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Summon.java
@@ -636,7 +636,7 @@ public abstract class Summon extends Playable
final WorldObject currentTarget = _owner.getTarget();
if (currentTarget != null)
{
- target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE)), dontMove, false);
+ target = skill.getTarget(this, forceUse && (!currentTarget.isPlayable() || !currentTarget.isInsideZone(ZoneId.PEACE) || !currentTarget.isInsideZone(ZoneId.NO_PVP)), dontMove, false);
final PlayerInstance currentTargetPlayer = currentTarget.getActingPlayer();
if (!forceUse && (currentTargetPlayer != null) && !currentTargetPlayer.isAutoAttackable(_owner))
{
diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
index 98780ac7b8..401ac5afe2 100644
--- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
+++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java
@@ -1820,6 +1820,15 @@ public class PlayerInstance extends Playable
_lastCompassZone = ExSetCompassZoneCode.PEACEZONE;
sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.PEACEZONE));
}
+ else if (isInsideZone(ZoneId.NO_PVP))
+ {
+ if (_lastCompassZone == ExSetCompassZoneCode.NOPVPZONE)
+ {
+ return;
+ }
+ _lastCompassZone = ExSetCompassZoneCode.NOPVPZONE;
+ sendPacket(new ExSetCompassZoneCode(ExSetCompassZoneCode.NOPVPZONE));
+ }
else
{
if (_lastCompassZone == ExSetCompassZoneCode.GENERALZONE)
@@ -8174,7 +8183,7 @@ public class PlayerInstance extends Playable
// Check if the attacker is a Playable
if (attacker.isPlayable())
{
- if (isInsideZone(ZoneId.PEACE))
+ if (isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.NO_PVP))
{
return false;
}
@@ -9375,7 +9384,7 @@ public class PlayerInstance extends Playable
_noDuelReason = SystemMessageId.C1_CANNOT_DUEL_BECAUSE_C1_IS_CURRENTLY_FISHING;
return false;
}
- if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE))
+ if (isInsideZone(ZoneId.PVP) || isInsideZone(ZoneId.PEACE) || isInsideZone(ZoneId.SIEGE) || isInsideZone(ZoneId.NO_PVP))
{
_noDuelReason = SystemMessageId.C1_IS_IN_AN_AREA_WHERE_DUEL_IS_NOT_ALLOWED_AND_YOU_CANNOT_APPLY_FOR_A_DUEL;
return false;
diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/entity/Duel.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/entity/Duel.java
index 28bf57bf83..751140a285 100644
--- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/entity/Duel.java
+++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/entity/Duel.java
@@ -920,7 +920,7 @@ public class Duel
}
// is one of the players in a Siege, Peace or PvP zone?
- if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
+ if (_playerA.isInsideZone(ZoneId.PEACE) || _playerB.isInsideZone(ZoneId.PEACE) ||_playerA.isInsideZone(ZoneId.NO_PVP) || _playerB.isInsideZone(ZoneId.NO_PVP) || _playerA.isInsideZone(ZoneId.SIEGE) || _playerB.isInsideZone(ZoneId.SIEGE) || _playerA.isInsideZone(ZoneId.PVP) || _playerB.isInsideZone(ZoneId.PVP))
{
return DuelResult.CANCELED;
}
diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/zone/ZoneId.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
index 0ab83f2438..5434025f11 100644
--- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
+++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/zone/ZoneId.java
@@ -37,6 +37,7 @@ public enum ZoneId
NO_SUMMON_FRIEND,
FORT,
NO_STORE,
+ NO_PVP,
SCRIPT,
HQ,
DANGER_AREA,
diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
new file mode 100644
index 0000000000..52fdb5b0a3
--- /dev/null
+++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/zone/type/NoPvPZone.java
@@ -0,0 +1,120 @@
+/*
+ * This file is part of the L2J Mobius project.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.l2jmobius.gameserver.model.zone.type;
+
+import org.l2jmobius.Config;
+import org.l2jmobius.gameserver.model.World;
+import org.l2jmobius.gameserver.model.actor.Creature;
+import org.l2jmobius.gameserver.model.actor.Summon;
+import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
+import org.l2jmobius.gameserver.model.zone.ZoneId;
+import org.l2jmobius.gameserver.model.zone.ZoneType;
+
+/**
+ * No PVP Zone
+ * @author Edoo
+ */
+public class NoPvPZone extends ZoneType
+{
+ public NoPvPZone(int id)
+ {
+ super(id);
+ }
+
+ @Override
+ protected void onEnter(Creature creature)
+ {
+ if (!isEnabled())
+ {
+ return;
+ }
+
+ if (creature.isPlayer())
+ {
+ final PlayerInstance player = creature.getActingPlayer();
+ // PVP possible during siege, now for siege participants only
+ // Could also check if this town is in siege, or if any siege is going on
+ if ((player.getSiegeState() != 0) && (Config.PEACE_ZONE_MODE == 1))
+ {
+ return;
+ }
+ }
+
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, true);
+ }
+
+
+ // Send player info to nearby players.
+ if (creature.isPlayer())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ protected void onExit(Creature creature)
+ {
+ if (Config.PEACE_ZONE_MODE != 2)
+ {
+ creature.setInsideZone(ZoneId.NO_PVP, false);
+ }
+
+ // Send player info to nearby players.
+ if (creature.isPlayer() && !creature.isTeleporting())
+ {
+ creature.broadcastInfo();
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean value)
+ {
+ super.setEnabled(value);
+ if (value)
+ {
+ for (PlayerInstance player : World.getInstance().getPlayers())
+ {
+ if ((player != null) && isInsideZone(player))
+ {
+ revalidateInZone(player);
+
+ if (player.getPet() != null)
+ {
+ revalidateInZone(player.getPet());
+ }
+
+ for (Summon summon : player.getServitors().values())
+ {
+ revalidateInZone(summon);
+ }
+ }
+ }
+ }
+ else
+ {
+ for (Creature creature : getCharactersInside())
+ {
+ if (creature != null)
+ {
+ removeCharacter(creature);
+ }
+ }
+ }
+ }
+}
diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
index 696f679789..76aff56251 100644
--- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
+++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/network/serverpackets/ExSetCompassZoneCode.java
@@ -32,6 +32,8 @@ public class ExSetCompassZoneCode implements IClientOutgoingPacket
public static final int SEVENSIGNSZONE = 0x0D;
public static final int PVPZONE = 0x0E;
public static final int GENERALZONE = 0x0F;
+ // TODO: need to find the desired value
+ public static final int NOPVPZONE = 0x0C;
private final int _zoneType;