Support for no PvP zones.
Contributed by Edoo.
This commit is contained in:
parent
298641d570
commit
c28ca9fbc1
@ -153,6 +153,7 @@
|
||||
<xs:enumeration value="NoDropItemZone" />
|
||||
<xs:enumeration value="NoLandingZone" />
|
||||
<xs:enumeration value="NoRestartZone" />
|
||||
<xs:enumeration value="NoPvPZone" />
|
||||
<xs:enumeration value="NoStoreZone" />
|
||||
<xs:enumeration value="NoSummonFriendZone" />
|
||||
<xs:enumeration value="NpcSpawnTerritory" />
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ public enum ZoneId
|
||||
NO_SUMMON_FRIEND,
|
||||
FORT,
|
||||
NO_STORE,
|
||||
NO_PVP,
|
||||
SCRIPT,
|
||||
HQ,
|
||||
DANGER_AREA,
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
|
@ -153,6 +153,7 @@
|
||||
<xs:enumeration value="NoDropItemZone" />
|
||||
<xs:enumeration value="NoLandingZone" />
|
||||
<xs:enumeration value="NoRestartZone" />
|
||||
<xs:enumeration value="NoPvPZone" />
|
||||
<xs:enumeration value="NoStoreZone" />
|
||||
<xs:enumeration value="NoSummonFriendZone" />
|
||||
<xs:enumeration value="NpcSpawnTerritory" />
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ public enum ZoneId
|
||||
NO_SUMMON_FRIEND,
|
||||
FORT,
|
||||
NO_STORE,
|
||||
NO_PVP,
|
||||
SCRIPT,
|
||||
HQ,
|
||||
DANGER_AREA,
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
|
@ -153,6 +153,7 @@
|
||||
<xs:enumeration value="NoDropItemZone" />
|
||||
<xs:enumeration value="NoLandingZone" />
|
||||
<xs:enumeration value="NoRestartZone" />
|
||||
<xs:enumeration value="NoPvPZone" />
|
||||
<xs:enumeration value="NoStoreZone" />
|
||||
<xs:enumeration value="NoSummonFriendZone" />
|
||||
<xs:enumeration value="NpcSpawnTerritory" />
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ public enum ZoneId
|
||||
NO_SUMMON_FRIEND,
|
||||
FORT,
|
||||
NO_STORE,
|
||||
NO_PVP,
|
||||
SCRIPT,
|
||||
HQ,
|
||||
DANGER_AREA,
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
|
@ -153,6 +153,7 @@
|
||||
<xs:enumeration value="NoDropItemZone" />
|
||||
<xs:enumeration value="NoLandingZone" />
|
||||
<xs:enumeration value="NoRestartZone" />
|
||||
<xs:enumeration value="NoPvPZone" />
|
||||
<xs:enumeration value="NoStoreZone" />
|
||||
<xs:enumeration value="NoSummonFriendZone" />
|
||||
<xs:enumeration value="NpcSpawnTerritory" />
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ public enum ZoneId
|
||||
NO_SUMMON_FRIEND,
|
||||
FORT,
|
||||
NO_STORE,
|
||||
NO_PVP,
|
||||
SCRIPT,
|
||||
HQ,
|
||||
DANGER_AREA,
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
|
@ -153,6 +153,7 @@
|
||||
<xs:enumeration value="NoDropItemZone" />
|
||||
<xs:enumeration value="NoLandingZone" />
|
||||
<xs:enumeration value="NoRestartZone" />
|
||||
<xs:enumeration value="NoPvPZone" />
|
||||
<xs:enumeration value="NoStoreZone" />
|
||||
<xs:enumeration value="NoSummonFriendZone" />
|
||||
<xs:enumeration value="NpcSpawnTerritory" />
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ public enum ZoneId
|
||||
NO_SUMMON_FRIEND,
|
||||
FORT,
|
||||
NO_STORE,
|
||||
NO_PVP,
|
||||
SCRIPT,
|
||||
HQ,
|
||||
DANGER_AREA,
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
|
@ -153,6 +153,7 @@
|
||||
<xs:enumeration value="NoDropItemZone" />
|
||||
<xs:enumeration value="NoLandingZone" />
|
||||
<xs:enumeration value="NoRestartZone" />
|
||||
<xs:enumeration value="NoPvPZone" />
|
||||
<xs:enumeration value="NoStoreZone" />
|
||||
<xs:enumeration value="NoSummonFriendZone" />
|
||||
<xs:enumeration value="NpcSpawnTerritory" />
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ public enum ZoneId
|
||||
NO_SUMMON_FRIEND,
|
||||
FORT,
|
||||
NO_STORE,
|
||||
NO_PVP,
|
||||
SCRIPT,
|
||||
HQ,
|
||||
DANGER_AREA,
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
|
@ -153,6 +153,7 @@
|
||||
<xs:enumeration value="NoDropItemZone" />
|
||||
<xs:enumeration value="NoLandingZone" />
|
||||
<xs:enumeration value="NoRestartZone" />
|
||||
<xs:enumeration value="NoPvPZone" />
|
||||
<xs:enumeration value="NoStoreZone" />
|
||||
<xs:enumeration value="NoSummonFriendZone" />
|
||||
<xs:enumeration value="NpcSpawnTerritory" />
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ public enum ZoneId
|
||||
NO_SUMMON_FRIEND,
|
||||
FORT,
|
||||
NO_STORE,
|
||||
NO_PVP,
|
||||
SCRIPT,
|
||||
HQ,
|
||||
DANGER_AREA,
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
|
@ -153,6 +153,7 @@
|
||||
<xs:enumeration value="NoDropItemZone" />
|
||||
<xs:enumeration value="NoLandingZone" />
|
||||
<xs:enumeration value="NoRestartZone" />
|
||||
<xs:enumeration value="NoPvPZone" />
|
||||
<xs:enumeration value="NoStoreZone" />
|
||||
<xs:enumeration value="NoSummonFriendZone" />
|
||||
<xs:enumeration value="NpcSpawnTerritory" />
|
||||
|
10
L2J_Mobius_7.0_PreludeOfWar/dist/game/data/zones/no_pvp.xml
vendored
Normal file
10
L2J_Mobius_7.0_PreludeOfWar/dist/game/data/zones/no_pvp.xml
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<list enabled="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/zones.xsd">
|
||||
<!-- No PvP Zones -->
|
||||
<zone name="storm_island" type="NoPvPZone" shape="NPoly" minZ="-4620" maxZ="50"> <!-- [25_23] -->
|
||||
<node X="166552" Y="161325" />
|
||||
<node X="196546" Y="161974" />
|
||||
<node X="198036" Y="195723" />
|
||||
<node X="164904" Y="195931" />
|
||||
</zone>
|
||||
</list>
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ public enum ZoneId
|
||||
NO_SUMMON_FRIEND,
|
||||
FORT,
|
||||
NO_STORE,
|
||||
NO_PVP,
|
||||
SCRIPT,
|
||||
HQ,
|
||||
DANGER_AREA,
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
|
@ -153,6 +153,7 @@
|
||||
<xs:enumeration value="NoDropItemZone" />
|
||||
<xs:enumeration value="NoLandingZone" />
|
||||
<xs:enumeration value="NoRestartZone" />
|
||||
<xs:enumeration value="NoPvPZone" />
|
||||
<xs:enumeration value="NoStoreZone" />
|
||||
<xs:enumeration value="NoSummonFriendZone" />
|
||||
<xs:enumeration value="NpcSpawnTerritory" />
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ public enum ZoneId
|
||||
NO_SUMMON_FRIEND,
|
||||
FORT,
|
||||
NO_STORE,
|
||||
NO_PVP,
|
||||
SCRIPT,
|
||||
HQ,
|
||||
DANGER_AREA,
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
|
@ -153,6 +153,7 @@
|
||||
<xs:enumeration value="NoDropItemZone" />
|
||||
<xs:enumeration value="NoLandingZone" />
|
||||
<xs:enumeration value="NoRestartZone" />
|
||||
<xs:enumeration value="NoPvPZone" />
|
||||
<xs:enumeration value="NoStoreZone" />
|
||||
<xs:enumeration value="NoSummonFriendZone" />
|
||||
<xs:enumeration value="NpcSpawnTerritory" />
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ public enum ZoneId
|
||||
NO_SUMMON_FRIEND,
|
||||
FORT,
|
||||
NO_STORE,
|
||||
NO_PVP,
|
||||
SCRIPT,
|
||||
HQ,
|
||||
DANGER_AREA,
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
|
@ -153,6 +153,7 @@
|
||||
<xs:enumeration value="NoDropItemZone" />
|
||||
<xs:enumeration value="NoLandingZone" />
|
||||
<xs:enumeration value="NoRestartZone" />
|
||||
<xs:enumeration value="NoPvPZone" />
|
||||
<xs:enumeration value="NoStoreZone" />
|
||||
<xs:enumeration value="NoSummonFriendZone" />
|
||||
<xs:enumeration value="NpcSpawnTerritory" />
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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))
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ public enum ZoneId
|
||||
NO_SUMMON_FRIEND,
|
||||
FORT,
|
||||
NO_STORE,
|
||||
NO_PVP,
|
||||
SCRIPT,
|
||||
HQ,
|
||||
DANGER_AREA,
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user