From 14c5c79053239082881df6122f9ca16f67942f64 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Wed, 28 Oct 2020 21:23:18 +0000 Subject: [PATCH] Addition of timed hunting zones. --- .../handlers/effecthandlers/CallPc.java | 4 +- .../effecthandlers/TeleportToPlayer.java | 2 +- .../dist/game/data/xsd/zones.xsd | 1 + .../dist/game/data/zones/timed_hunting.xml | 12 +++ .../instancemanager/ZoneManager.java | 2 + .../model/actor/instance/PlayerInstance.java | 7 +- .../gameserver/model/zone/ZoneId.java | 3 +- .../model/zone/type/TimedHuntingZone.java | 72 +++++++++++++++ .../network/clientpackets/EnterWorld.java | 21 ----- .../clientpackets/ExRequestTeleport.java | 3 +- .../RequestSaveBookMarkSlot.java | 3 +- .../sessionzones/ExTimedHuntingZoneEnter.java | 5 +- .../sessionzones/TimedHuntingZoneList.java | 3 +- .../handlers/effecthandlers/CallPc.java | 4 +- .../effecthandlers/TeleportToPlayer.java | 2 +- .../dist/game/data/xsd/zones.xsd | 1 + .../dist/game/data/zones/timed_hunting.xml | 28 ++++++ .../instancemanager/ZoneManager.java | 2 + .../model/actor/instance/PlayerInstance.java | 7 +- .../gameserver/model/zone/ZoneId.java | 3 +- .../model/zone/type/TimedHuntingZone.java | 92 +++++++++++++++++++ .../network/clientpackets/EnterWorld.java | 41 --------- .../RequestSaveBookMarkSlot.java | 3 +- .../sessionzones/ExTimedHuntingZoneEnter.java | 5 +- .../teleports/ExRequestTeleport.java | 3 +- .../sessionzones/TimedHuntingZoneList.java | 3 +- .../handlers/effecthandlers/CallPc.java | 2 +- .../effecthandlers/TeleportToPlayer.java | 2 +- .../dist/game/data/xsd/zones.xsd | 1 + .../dist/game/data/zones/timed_hunting.xml | 8 ++ .../instancemanager/ZoneManager.java | 2 + .../model/actor/instance/PlayerInstance.java | 7 +- .../gameserver/model/zone/ZoneId.java | 3 +- .../model/zone/type/TimedHuntingZone.java | 67 ++++++++++++++ .../network/clientpackets/EnterWorld.java | 16 ---- .../clientpackets/ExRequestTeleport.java | 3 +- .../RequestSaveBookMarkSlot.java | 3 +- .../sessionzones/ExTimedHuntingZoneEnter.java | 5 +- .../sessionzones/TimedHuntingZoneList.java | 3 +- .../handlers/effecthandlers/CallPc.java | 2 +- .../effecthandlers/TeleportToPlayer.java | 2 +- .../dist/game/data/xsd/zones.xsd | 1 + .../dist/game/data/zones/timed_hunting.xml | 8 ++ .../instancemanager/ZoneManager.java | 2 + .../model/actor/instance/PlayerInstance.java | 7 +- .../gameserver/model/zone/ZoneId.java | 3 +- .../model/zone/type/TimedHuntingZone.java | 67 ++++++++++++++ .../network/clientpackets/EnterWorld.java | 16 ---- .../RequestSaveBookMarkSlot.java | 3 +- .../sessionzones/ExTimedHuntingZoneEnter.java | 5 +- .../teleports/ExRequestTeleport.java | 3 +- .../sessionzones/TimedHuntingZoneList.java | 3 +- 52 files changed, 420 insertions(+), 156 deletions(-) create mode 100644 L2J_Mobius_7.0_PreludeOfWar/dist/game/data/zones/timed_hunting.xml create mode 100644 L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/zone/type/TimedHuntingZone.java create mode 100644 L2J_Mobius_8.0_Homunculus/dist/game/data/zones/timed_hunting.xml create mode 100644 L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/zone/type/TimedHuntingZone.java create mode 100644 L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/zones/timed_hunting.xml create mode 100644 L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/zone/type/TimedHuntingZone.java create mode 100644 L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/zones/timed_hunting.xml create mode 100644 L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/zone/type/TimedHuntingZone.java diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/CallPc.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/CallPc.java index 0d066a5319..8ed45498e4 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/CallPc.java +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/CallPc.java @@ -135,7 +135,7 @@ public class CallPc extends AbstractEffect return false; } - if (target.isFlyingMounted() || target.isCombatFlagEquipped() || target.isInTraingCamp() || target.isInTimedHuntingZone() || effector.isInTimedHuntingZone()) + if (target.isFlyingMounted() || target.isCombatFlagEquipped() || target.isInTraingCamp() || target.isInsideZone(ZoneId.TIMED_HUNTING) || effector.isInsideZone(ZoneId.TIMED_HUNTING)) { effector.sendPacket(SystemMessageId.YOU_CANNOT_USE_SUMMONING_OR_TELEPORTING_IN_THIS_AREA); return false; @@ -158,7 +158,7 @@ public class CallPc extends AbstractEffect } final Instance instance = effector.getInstanceWorld(); - if (((instance != null) && !instance.isPlayerSummonAllowed()) || effector.isInTimedHuntingZone()) + if ((instance != null) && !instance.isPlayerSummonAllowed()) { effector.sendPacket(SystemMessageId.YOU_MAY_NOT_SUMMON_FROM_YOUR_CURRENT_LOCATION); return false; diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java index ce3f0f2fac..e42736523e 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java @@ -109,7 +109,7 @@ public class TeleportToPlayer extends AbstractEffect } final Instance instance = target.getInstanceWorld(); - if (((instance != null) && !instance.isPlayerSummonAllowed()) || target.isInTimedHuntingZone()) + if (((instance != null) && !instance.isPlayerSummonAllowed()) || target.isInsideZone(ZoneId.TIMED_HUNTING)) { final SystemMessage sm = new SystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING); sm.addString(target.getName()); diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/xsd/zones.xsd b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/xsd/zones.xsd index 1cd9137de0..1b272eabd5 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/xsd/zones.xsd +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/xsd/zones.xsd @@ -173,6 +173,7 @@ + diff --git a/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/zones/timed_hunting.xml b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/zones/timed_hunting.xml new file mode 100644 index 0000000000..6548b73306 --- /dev/null +++ b/L2J_Mobius_7.0_PreludeOfWar/dist/game/data/zones/timed_hunting.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/instancemanager/ZoneManager.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/instancemanager/ZoneManager.java index 1faf1ae423..fec7e24f5e 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/instancemanager/ZoneManager.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/instancemanager/ZoneManager.java @@ -79,6 +79,7 @@ import org.l2jmobius.gameserver.model.zone.type.SpawnTerritory; import org.l2jmobius.gameserver.model.zone.type.SwampZone; import org.l2jmobius.gameserver.model.zone.type.TaxZone; import org.l2jmobius.gameserver.model.zone.type.TeleportZone; +import org.l2jmobius.gameserver.model.zone.type.TimedHuntingZone; import org.l2jmobius.gameserver.model.zone.type.UndyingZone; import org.l2jmobius.gameserver.model.zone.type.WaterZone; @@ -457,6 +458,7 @@ public class ZoneManager implements IXmlReader _classZones.put(SwampZone.class, new ConcurrentHashMap<>()); _classZones.put(TaxZone.class, new ConcurrentHashMap<>()); _classZones.put(TeleportZone.class, new ConcurrentHashMap<>()); + _classZones.put(TimedHuntingZone.class, new ConcurrentHashMap<>()); _classZones.put(UndyingZone.class, new ConcurrentHashMap<>()); _classZones.put(WaterZone.class, new ConcurrentHashMap<>()); _spawnTerritories.clear(); diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index baf025a46f..598c05b879 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -10332,7 +10332,7 @@ public class PlayerInstance extends Playable } // Close time limited zone window. - if (!isInTimedHuntingZone()) + if (!isInsideZone(ZoneId.TIMED_HUNTING)) { stopTimedHuntingZoneTask(); } @@ -14168,11 +14168,6 @@ public class PlayerInstance extends Playable return _autoUseSettings; } - public boolean isInTimedHuntingZone() - { - return isInTimedHuntingZone(getX(), getY()); - } - public boolean isInTimedHuntingZone(int x, int y) { return isInTimedHuntingZone(1, x, y) // Storm Isle diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/zone/ZoneId.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/zone/ZoneId.java index 7212b16f9a..cd3139dfdd 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/zone/ZoneId.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/zone/ZoneId.java @@ -48,7 +48,8 @@ public enum ZoneId SAYUNE, FISHING, UNDYING, - TAX; + TAX, + TIMED_HUNTING; public static int getZoneCount() { diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/zone/type/TimedHuntingZone.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/zone/type/TimedHuntingZone.java new file mode 100644 index 0000000000..ec0b9b36e8 --- /dev/null +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/zone/type/TimedHuntingZone.java @@ -0,0 +1,72 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.zone.type; + +import org.l2jmobius.gameserver.enums.TeleportWhereType; +import org.l2jmobius.gameserver.instancemanager.MapRegionManager; +import org.l2jmobius.gameserver.model.actor.Creature; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.variables.PlayerVariables; +import org.l2jmobius.gameserver.model.zone.ZoneId; +import org.l2jmobius.gameserver.model.zone.ZoneType; + +/** + * @author Mobius + */ +public class TimedHuntingZone extends ZoneType +{ + public TimedHuntingZone(int id) + { + super(id); + } + + @Override + protected void onEnter(Creature creature) + { + final PlayerInstance player = creature.getActingPlayer(); + if (player != null) + { + player.setInsideZone(ZoneId.TIMED_HUNTING, true); + + final long currentTime = System.currentTimeMillis(); + final long stormIsleExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 1, 0); + final long primevalIsleExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 6, 0); + if ((stormIsleExitTime > currentTime) && player.isInTimedHuntingZone(1)) + { + player.startTimedHuntingZone(1, stormIsleExitTime - currentTime); + } + else if ((primevalIsleExitTime > currentTime) && player.isInTimedHuntingZone(6)) + { + player.startTimedHuntingZone(6, primevalIsleExitTime - currentTime); + } + else + { + player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN)); + } + } + } + + @Override + protected void onExit(Creature creature) + { + final PlayerInstance player = creature.getActingPlayer(); + if (player != null) + { + player.setInsideZone(ZoneId.TIMED_HUNTING, false); + } + } +} diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 28ddc59c72..f55181f7f4 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -40,7 +40,6 @@ import org.l2jmobius.gameserver.instancemanager.FortManager; import org.l2jmobius.gameserver.instancemanager.FortSiegeManager; import org.l2jmobius.gameserver.instancemanager.InstanceManager; import org.l2jmobius.gameserver.instancemanager.MailManager; -import org.l2jmobius.gameserver.instancemanager.MapRegionManager; import org.l2jmobius.gameserver.instancemanager.PetitionManager; import org.l2jmobius.gameserver.instancemanager.ServerRestartManager; import org.l2jmobius.gameserver.instancemanager.SiegeManager; @@ -652,26 +651,6 @@ public class EnterWorld implements IClientIncomingPacket player.updateAbnormalVisualEffects(); } - // Check if in time limited hunting zone. - if (player.isInTimedHuntingZone()) - { - final long currentTime = System.currentTimeMillis(); - final long stormIsleExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 1, 0); - final long primevalIsleExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 6, 0); - if ((stormIsleExitTime > currentTime) && player.isInTimedHuntingZone(1)) - { - player.startTimedHuntingZone(1, stormIsleExitTime - currentTime); - } - else if ((primevalIsleExitTime > currentTime) && player.isInTimedHuntingZone(6)) - { - player.startTimedHuntingZone(6, primevalIsleExitTime - currentTime); - } - else - { - player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN)); - } - } - if (Config.ENABLE_ATTENDANCE_REWARDS) { ThreadPool.schedule(() -> diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/ExRequestTeleport.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/ExRequestTeleport.java index 8b32ea9e7c..30afa901a0 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/ExRequestTeleport.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/ExRequestTeleport.java @@ -23,6 +23,7 @@ import org.l2jmobius.gameserver.instancemanager.CastleManager; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.entity.Castle; import org.l2jmobius.gameserver.model.holders.TeleportListHolder; +import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -57,7 +58,7 @@ public class ExRequestTeleport implements IClientIncomingPacket } // Players should not be able to teleport if in combat, or in a special location. - if (player.isCastingNow() || player.isInCombat() || player.isInInstance() || player.isOnEvent() || player.isInOlympiadMode() || player.inObserverMode() || player.isInTraingCamp() || player.isInTimedHuntingZone()) + if (player.isCastingNow() || player.isInCombat() || player.isInInstance() || player.isOnEvent() || player.isInOlympiadMode() || player.inObserverMode() || player.isInTraingCamp() || player.isInsideZone(ZoneId.TIMED_HUNTING)) { player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_RIGHT_NOW); return; diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/RequestSaveBookMarkSlot.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/RequestSaveBookMarkSlot.java index 5912a70026..0183367cea 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/RequestSaveBookMarkSlot.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/RequestSaveBookMarkSlot.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.clientpackets; import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.network.GameClient; /** @@ -48,7 +49,7 @@ public class RequestSaveBookMarkSlot implements IClientIncomingPacket return; } - if (player.isInTimedHuntingZone()) + if (player.isInsideZone(ZoneId.TIMED_HUNTING)) { player.sendMessage("You cannot bookmark this location."); return; diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/sessionzones/ExTimedHuntingZoneEnter.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/sessionzones/ExTimedHuntingZoneEnter.java index 6cc33e5574..047287ab39 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/sessionzones/ExTimedHuntingZoneEnter.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/sessionzones/ExTimedHuntingZoneEnter.java @@ -110,6 +110,8 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket return; } + player.getVariables().set(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, endTime); + switch (_zoneId) { case 1: // Storm Isle @@ -123,9 +125,6 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket break; } } - - player.getVariables().set(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, endTime); - player.startTimedHuntingZone(_zoneId, endTime - currentTime); } else { diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java index 1755702ad8..0b42fc84af 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java @@ -20,6 +20,7 @@ import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.variables.PlayerVariables; +import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.network.OutgoingPackets; import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; @@ -34,7 +35,7 @@ public class TimedHuntingZoneList implements IClientOutgoingPacket public TimedHuntingZoneList(PlayerInstance player) { _player = player; - _isInTimedHuntingZone = player.isInTimedHuntingZone(); + _isInTimedHuntingZone = player.isInsideZone(ZoneId.TIMED_HUNTING); } @Override diff --git a/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/effecthandlers/CallPc.java b/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/effecthandlers/CallPc.java index 0d066a5319..8ed45498e4 100644 --- a/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/effecthandlers/CallPc.java +++ b/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/effecthandlers/CallPc.java @@ -135,7 +135,7 @@ public class CallPc extends AbstractEffect return false; } - if (target.isFlyingMounted() || target.isCombatFlagEquipped() || target.isInTraingCamp() || target.isInTimedHuntingZone() || effector.isInTimedHuntingZone()) + if (target.isFlyingMounted() || target.isCombatFlagEquipped() || target.isInTraingCamp() || target.isInsideZone(ZoneId.TIMED_HUNTING) || effector.isInsideZone(ZoneId.TIMED_HUNTING)) { effector.sendPacket(SystemMessageId.YOU_CANNOT_USE_SUMMONING_OR_TELEPORTING_IN_THIS_AREA); return false; @@ -158,7 +158,7 @@ public class CallPc extends AbstractEffect } final Instance instance = effector.getInstanceWorld(); - if (((instance != null) && !instance.isPlayerSummonAllowed()) || effector.isInTimedHuntingZone()) + if ((instance != null) && !instance.isPlayerSummonAllowed()) { effector.sendPacket(SystemMessageId.YOU_MAY_NOT_SUMMON_FROM_YOUR_CURRENT_LOCATION); return false; diff --git a/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java b/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java index ce3f0f2fac..e42736523e 100644 --- a/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java +++ b/L2J_Mobius_8.0_Homunculus/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java @@ -109,7 +109,7 @@ public class TeleportToPlayer extends AbstractEffect } final Instance instance = target.getInstanceWorld(); - if (((instance != null) && !instance.isPlayerSummonAllowed()) || target.isInTimedHuntingZone()) + if (((instance != null) && !instance.isPlayerSummonAllowed()) || target.isInsideZone(ZoneId.TIMED_HUNTING)) { final SystemMessage sm = new SystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING); sm.addString(target.getName()); diff --git a/L2J_Mobius_8.0_Homunculus/dist/game/data/xsd/zones.xsd b/L2J_Mobius_8.0_Homunculus/dist/game/data/xsd/zones.xsd index 1cd9137de0..1b272eabd5 100644 --- a/L2J_Mobius_8.0_Homunculus/dist/game/data/xsd/zones.xsd +++ b/L2J_Mobius_8.0_Homunculus/dist/game/data/xsd/zones.xsd @@ -173,6 +173,7 @@ + diff --git a/L2J_Mobius_8.0_Homunculus/dist/game/data/zones/timed_hunting.xml b/L2J_Mobius_8.0_Homunculus/dist/game/data/zones/timed_hunting.xml new file mode 100644 index 0000000000..2d93a62026 --- /dev/null +++ b/L2J_Mobius_8.0_Homunculus/dist/game/data/zones/timed_hunting.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/instancemanager/ZoneManager.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/instancemanager/ZoneManager.java index 1faf1ae423..fec7e24f5e 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/instancemanager/ZoneManager.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/instancemanager/ZoneManager.java @@ -79,6 +79,7 @@ import org.l2jmobius.gameserver.model.zone.type.SpawnTerritory; import org.l2jmobius.gameserver.model.zone.type.SwampZone; import org.l2jmobius.gameserver.model.zone.type.TaxZone; import org.l2jmobius.gameserver.model.zone.type.TeleportZone; +import org.l2jmobius.gameserver.model.zone.type.TimedHuntingZone; import org.l2jmobius.gameserver.model.zone.type.UndyingZone; import org.l2jmobius.gameserver.model.zone.type.WaterZone; @@ -457,6 +458,7 @@ public class ZoneManager implements IXmlReader _classZones.put(SwampZone.class, new ConcurrentHashMap<>()); _classZones.put(TaxZone.class, new ConcurrentHashMap<>()); _classZones.put(TeleportZone.class, new ConcurrentHashMap<>()); + _classZones.put(TimedHuntingZone.class, new ConcurrentHashMap<>()); _classZones.put(UndyingZone.class, new ConcurrentHashMap<>()); _classZones.put(WaterZone.class, new ConcurrentHashMap<>()); _spawnTerritories.clear(); diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index dbfdf7e250..ccaf6f7c94 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -10335,7 +10335,7 @@ public class PlayerInstance extends Playable } // Close time limited zone window. - if (!isInTimedHuntingZone()) + if (!isInsideZone(ZoneId.TIMED_HUNTING)) { stopTimedHuntingZoneTask(); } @@ -14126,11 +14126,6 @@ public class PlayerInstance extends Playable return _autoUseSettings; } - public boolean isInTimedHuntingZone() - { - return isInTimedHuntingZone(getX(), getY()); - } - public boolean isInTimedHuntingZone(int x, int y) { return isInTimedHuntingZone(1, x, y) // Storm Isle diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/zone/ZoneId.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/zone/ZoneId.java index 7212b16f9a..cd3139dfdd 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/zone/ZoneId.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/zone/ZoneId.java @@ -48,7 +48,8 @@ public enum ZoneId SAYUNE, FISHING, UNDYING, - TAX; + TAX, + TIMED_HUNTING; public static int getZoneCount() { diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/zone/type/TimedHuntingZone.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/zone/type/TimedHuntingZone.java new file mode 100644 index 0000000000..2c4c7b677f --- /dev/null +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/zone/type/TimedHuntingZone.java @@ -0,0 +1,92 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.zone.type; + +import org.l2jmobius.gameserver.enums.TeleportWhereType; +import org.l2jmobius.gameserver.instancemanager.MapRegionManager; +import org.l2jmobius.gameserver.model.actor.Creature; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.variables.PlayerVariables; +import org.l2jmobius.gameserver.model.zone.ZoneId; +import org.l2jmobius.gameserver.model.zone.ZoneType; + +/** + * @author Mobius + */ +public class TimedHuntingZone extends ZoneType +{ + public TimedHuntingZone(int id) + { + super(id); + } + + @Override + protected void onEnter(Creature creature) + { + final PlayerInstance player = creature.getActingPlayer(); + if (player != null) + { + player.setInsideZone(ZoneId.TIMED_HUNTING, true); + + final long currentTime = System.currentTimeMillis(); + final long stormIsleExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 1, 0); + final long primevalIsleExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 6, 0); + final long goldenAltarExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 7, 0); + final long coalMinesExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 11, 0); + final long toiExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 8, 0); + final long imperialTombExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 12, 0); + if ((stormIsleExitTime > currentTime) && player.isInTimedHuntingZone(1)) + { + player.startTimedHuntingZone(1, stormIsleExitTime - currentTime); + } + else if ((primevalIsleExitTime > currentTime) && player.isInTimedHuntingZone(6)) + { + player.startTimedHuntingZone(6, primevalIsleExitTime - currentTime); + } + else if ((goldenAltarExitTime > currentTime) && player.isInTimedHuntingZone(7)) + { + player.startTimedHuntingZone(7, goldenAltarExitTime - currentTime); + } + else if ((coalMinesExitTime > currentTime) && player.isInTimedHuntingZone(11)) + { + player.startTimedHuntingZone(11, coalMinesExitTime - currentTime); + } + else if ((toiExitTime > currentTime) && player.isInTimedHuntingZone(8)) + { + player.startTimedHuntingZone(8, toiExitTime - currentTime); + } + else if ((imperialTombExitTime > currentTime) && player.isInTimedHuntingZone(12)) + { + player.startTimedHuntingZone(12, imperialTombExitTime - currentTime); + } + else + { + player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN)); + } + } + } + + @Override + protected void onExit(Creature creature) + { + final PlayerInstance player = creature.getActingPlayer(); + if (player != null) + { + player.setInsideZone(ZoneId.TIMED_HUNTING, false); + } + } +} diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index edffb48df4..c714bc0f45 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -40,7 +40,6 @@ import org.l2jmobius.gameserver.instancemanager.FortManager; import org.l2jmobius.gameserver.instancemanager.FortSiegeManager; import org.l2jmobius.gameserver.instancemanager.InstanceManager; import org.l2jmobius.gameserver.instancemanager.MailManager; -import org.l2jmobius.gameserver.instancemanager.MapRegionManager; import org.l2jmobius.gameserver.instancemanager.PetitionManager; import org.l2jmobius.gameserver.instancemanager.ServerRestartManager; import org.l2jmobius.gameserver.instancemanager.SiegeManager; @@ -660,46 +659,6 @@ public class EnterWorld implements IClientIncomingPacket player.updateAbnormalVisualEffects(); } - // Check if in time limited hunting zone. - if (player.isInTimedHuntingZone()) - { - final long currentTime = System.currentTimeMillis(); - final long stormIsleExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 1, 0); - final long primevalIsleExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 6, 0); - final long goldenAltarExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 7, 0); - final long coalMinesExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 11, 0); - final long toiExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 8, 0); - final long imperialTombExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 12, 0); - if ((stormIsleExitTime > currentTime) && player.isInTimedHuntingZone(1)) - { - player.startTimedHuntingZone(1, stormIsleExitTime - currentTime); - } - else if ((primevalIsleExitTime > currentTime) && player.isInTimedHuntingZone(6)) - { - player.startTimedHuntingZone(6, primevalIsleExitTime - currentTime); - } - else if ((goldenAltarExitTime > currentTime) && player.isInTimedHuntingZone(7)) - { - player.startTimedHuntingZone(7, goldenAltarExitTime - currentTime); - } - else if ((coalMinesExitTime > currentTime) && player.isInTimedHuntingZone(11)) - { - player.startTimedHuntingZone(11, coalMinesExitTime - currentTime); - } - else if ((toiExitTime > currentTime) && player.isInTimedHuntingZone(11)) - { - player.startTimedHuntingZone(8, toiExitTime - currentTime); - } - else if ((imperialTombExitTime > currentTime) && player.isInTimedHuntingZone(11)) - { - player.startTimedHuntingZone(12, imperialTombExitTime - currentTime); - } - else - { - player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN)); - } - } - if (Config.ENABLE_ATTENDANCE_REWARDS) { ThreadPool.schedule(() -> diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/RequestSaveBookMarkSlot.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/RequestSaveBookMarkSlot.java index 5912a70026..0183367cea 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/RequestSaveBookMarkSlot.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/RequestSaveBookMarkSlot.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.clientpackets; import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.network.GameClient; /** @@ -48,7 +49,7 @@ public class RequestSaveBookMarkSlot implements IClientIncomingPacket return; } - if (player.isInTimedHuntingZone()) + if (player.isInsideZone(ZoneId.TIMED_HUNTING)) { player.sendMessage("You cannot bookmark this location."); return; diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/sessionzones/ExTimedHuntingZoneEnter.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/sessionzones/ExTimedHuntingZoneEnter.java index 7f18789b77..a7db2bae30 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/sessionzones/ExTimedHuntingZoneEnter.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/sessionzones/ExTimedHuntingZoneEnter.java @@ -114,6 +114,8 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket return; } + player.getVariables().set(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, endTime); + switch (_zoneId) { case 1: // Storm Isle @@ -147,9 +149,6 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket break; } } - - player.getVariables().set(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, endTime); - player.startTimedHuntingZone(_zoneId, endTime - currentTime); } else { diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/teleports/ExRequestTeleport.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/teleports/ExRequestTeleport.java index b87c09deb5..04bc1caff4 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/teleports/ExRequestTeleport.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/teleports/ExRequestTeleport.java @@ -23,6 +23,7 @@ import org.l2jmobius.gameserver.instancemanager.CastleManager; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.entity.Castle; import org.l2jmobius.gameserver.model.holders.TeleportListHolder; +import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; @@ -58,7 +59,7 @@ public class ExRequestTeleport implements IClientIncomingPacket } // Players should not be able to teleport if in combat, or in a special location. - if (player.isCastingNow() || player.isInCombat() || player.isInInstance() || player.isOnEvent() || player.isInOlympiadMode() || player.inObserverMode() || player.isInTraingCamp() || player.isInTimedHuntingZone()) + if (player.isCastingNow() || player.isInCombat() || player.isInInstance() || player.isOnEvent() || player.isInOlympiadMode() || player.inObserverMode() || player.isInTraingCamp() || player.isInsideZone(ZoneId.TIMED_HUNTING)) { player.sendPacket(SystemMessageId.YOU_CANNOT_TELEPORT_RIGHT_NOW); return; diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java index b943898c56..cc67b3a30c 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java @@ -20,6 +20,7 @@ import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.variables.PlayerVariables; +import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.network.OutgoingPackets; import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; @@ -34,7 +35,7 @@ public class TimedHuntingZoneList implements IClientOutgoingPacket public TimedHuntingZoneList(PlayerInstance player) { _player = player; - _isInTimedHuntingZone = player.isInTimedHuntingZone(); + _isInTimedHuntingZone = player.isInsideZone(ZoneId.TIMED_HUNTING); } @Override diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/CallPc.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/CallPc.java index ceeb43cdb2..8ed45498e4 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/CallPc.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/CallPc.java @@ -135,7 +135,7 @@ public class CallPc extends AbstractEffect return false; } - if (target.isFlyingMounted() || target.isCombatFlagEquipped() || target.isInTraingCamp() || target.isInTimedHuntingZone() || effector.isInTimedHuntingZone()) + if (target.isFlyingMounted() || target.isCombatFlagEquipped() || target.isInTraingCamp() || target.isInsideZone(ZoneId.TIMED_HUNTING) || effector.isInsideZone(ZoneId.TIMED_HUNTING)) { effector.sendPacket(SystemMessageId.YOU_CANNOT_USE_SUMMONING_OR_TELEPORTING_IN_THIS_AREA); return false; diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java index ce3f0f2fac..e42736523e 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java @@ -109,7 +109,7 @@ public class TeleportToPlayer extends AbstractEffect } final Instance instance = target.getInstanceWorld(); - if (((instance != null) && !instance.isPlayerSummonAllowed()) || target.isInTimedHuntingZone()) + if (((instance != null) && !instance.isPlayerSummonAllowed()) || target.isInsideZone(ZoneId.TIMED_HUNTING)) { final SystemMessage sm = new SystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING); sm.addString(target.getName()); diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/xsd/zones.xsd b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/xsd/zones.xsd index 1cd9137de0..1b272eabd5 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/xsd/zones.xsd +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/xsd/zones.xsd @@ -173,6 +173,7 @@ + diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/zones/timed_hunting.xml b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/zones/timed_hunting.xml new file mode 100644 index 0000000000..a576519832 --- /dev/null +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/zones/timed_hunting.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/instancemanager/ZoneManager.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/instancemanager/ZoneManager.java index 1faf1ae423..fec7e24f5e 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/instancemanager/ZoneManager.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/instancemanager/ZoneManager.java @@ -79,6 +79,7 @@ import org.l2jmobius.gameserver.model.zone.type.SpawnTerritory; import org.l2jmobius.gameserver.model.zone.type.SwampZone; import org.l2jmobius.gameserver.model.zone.type.TaxZone; import org.l2jmobius.gameserver.model.zone.type.TeleportZone; +import org.l2jmobius.gameserver.model.zone.type.TimedHuntingZone; import org.l2jmobius.gameserver.model.zone.type.UndyingZone; import org.l2jmobius.gameserver.model.zone.type.WaterZone; @@ -457,6 +458,7 @@ public class ZoneManager implements IXmlReader _classZones.put(SwampZone.class, new ConcurrentHashMap<>()); _classZones.put(TaxZone.class, new ConcurrentHashMap<>()); _classZones.put(TeleportZone.class, new ConcurrentHashMap<>()); + _classZones.put(TimedHuntingZone.class, new ConcurrentHashMap<>()); _classZones.put(UndyingZone.class, new ConcurrentHashMap<>()); _classZones.put(WaterZone.class, new ConcurrentHashMap<>()); _spawnTerritories.clear(); diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index 10d49986fd..854990717d 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -10224,7 +10224,7 @@ public class PlayerInstance extends Playable } // Close time limited zone window. - if (!isInTimedHuntingZone()) + if (!isInsideZone(ZoneId.TIMED_HUNTING)) { stopTimedHuntingZoneTask(); } @@ -14115,11 +14115,6 @@ public class PlayerInstance extends Playable return _autoUseSettings; } - public boolean isInTimedHuntingZone() - { - return isInTimedHuntingZone(getX(), getY()); - } - public boolean isInTimedHuntingZone(int x, int y) { return isInTimedHuntingZone(2, x, y); // Ancient Pirates' Tomb diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/zone/ZoneId.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/zone/ZoneId.java index 7212b16f9a..cd3139dfdd 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/zone/ZoneId.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/zone/ZoneId.java @@ -48,7 +48,8 @@ public enum ZoneId SAYUNE, FISHING, UNDYING, - TAX; + TAX, + TIMED_HUNTING; public static int getZoneCount() { diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/zone/type/TimedHuntingZone.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/zone/type/TimedHuntingZone.java new file mode 100644 index 0000000000..35582cb3fe --- /dev/null +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/zone/type/TimedHuntingZone.java @@ -0,0 +1,67 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.zone.type; + +import org.l2jmobius.gameserver.enums.TeleportWhereType; +import org.l2jmobius.gameserver.instancemanager.MapRegionManager; +import org.l2jmobius.gameserver.model.actor.Creature; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.variables.PlayerVariables; +import org.l2jmobius.gameserver.model.zone.ZoneId; +import org.l2jmobius.gameserver.model.zone.ZoneType; + +/** + * @author Mobius + */ +public class TimedHuntingZone extends ZoneType +{ + public TimedHuntingZone(int id) + { + super(id); + } + + @Override + protected void onEnter(Creature creature) + { + final PlayerInstance player = creature.getActingPlayer(); + if (player != null) + { + player.setInsideZone(ZoneId.TIMED_HUNTING, true); + + final long currentTime = System.currentTimeMillis(); + final long pirateTombExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 2, 0); + if ((pirateTombExitTime > currentTime) && player.isInTimedHuntingZone(2)) + { + player.startTimedHuntingZone(2, pirateTombExitTime - currentTime); + } + else + { + player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN)); + } + } + } + + @Override + protected void onExit(Creature creature) + { + final PlayerInstance player = creature.getActingPlayer(); + if (player != null) + { + player.setInsideZone(ZoneId.TIMED_HUNTING, false); + } + } +} diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 24a68760df..b9ee88924c 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -39,7 +39,6 @@ import org.l2jmobius.gameserver.instancemanager.FortManager; import org.l2jmobius.gameserver.instancemanager.FortSiegeManager; import org.l2jmobius.gameserver.instancemanager.InstanceManager; import org.l2jmobius.gameserver.instancemanager.MailManager; -import org.l2jmobius.gameserver.instancemanager.MapRegionManager; import org.l2jmobius.gameserver.instancemanager.PetitionManager; import org.l2jmobius.gameserver.instancemanager.ServerRestartManager; import org.l2jmobius.gameserver.instancemanager.SiegeManager; @@ -637,21 +636,6 @@ public class EnterWorld implements IClientIncomingPacket player.updateAbnormalVisualEffects(); } - // Check if in time limited hunting zone. - if (player.isInTimedHuntingZone()) - { - final long currentTime = System.currentTimeMillis(); - final long pirateTombExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 2, 0); - if ((pirateTombExitTime > currentTime) && player.isInTimedHuntingZone(2)) - { - player.startTimedHuntingZone(1, pirateTombExitTime - currentTime); - } - else - { - player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN)); - } - } - if (Config.ENABLE_ATTENDANCE_REWARDS) { ThreadPool.schedule(() -> diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/ExRequestTeleport.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/ExRequestTeleport.java index 02a6c2afc1..68f5a26c0e 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/ExRequestTeleport.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/ExRequestTeleport.java @@ -23,6 +23,7 @@ import org.l2jmobius.gameserver.instancemanager.CastleManager; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.entity.Castle; import org.l2jmobius.gameserver.model.holders.TeleportListHolder; +import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -57,7 +58,7 @@ public class ExRequestTeleport implements IClientIncomingPacket } // Players should not be able to teleport if in combat, or in a special location. - if (player.isCastingNow() || player.isInCombat() || player.isInInstance() || player.isOnEvent() || player.isInOlympiadMode() || player.inObserverMode() || player.isInTraingCamp() || player.isInTimedHuntingZone()) + if (player.isCastingNow() || player.isInCombat() || player.isInInstance() || player.isOnEvent() || player.isInOlympiadMode() || player.inObserverMode() || player.isInTraingCamp() || player.isInsideZone(ZoneId.TIMED_HUNTING)) { player.sendMessage("You cannot teleport right now."); return; diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestSaveBookMarkSlot.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestSaveBookMarkSlot.java index 5912a70026..0183367cea 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestSaveBookMarkSlot.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/RequestSaveBookMarkSlot.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.clientpackets; import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.network.GameClient; /** @@ -48,7 +49,7 @@ public class RequestSaveBookMarkSlot implements IClientIncomingPacket return; } - if (player.isInTimedHuntingZone()) + if (player.isInsideZone(ZoneId.TIMED_HUNTING)) { player.sendMessage("You cannot bookmark this location."); return; diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/sessionzones/ExTimedHuntingZoneEnter.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/sessionzones/ExTimedHuntingZoneEnter.java index 83d71e8132..62b208a7d1 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/sessionzones/ExTimedHuntingZoneEnter.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/sessionzones/ExTimedHuntingZoneEnter.java @@ -107,6 +107,8 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket return; } + player.getVariables().set(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, endTime); + switch (_zoneId) { case 2: // Ancient Pirates' Tomb @@ -115,9 +117,6 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket break; } } - - player.getVariables().set(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, endTime); - player.startTimedHuntingZone(_zoneId, endTime - currentTime); } else { diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java index a19ac7932e..7d3c5ddb82 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java @@ -20,6 +20,7 @@ import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.variables.PlayerVariables; +import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.network.OutgoingPackets; import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; @@ -34,7 +35,7 @@ public class TimedHuntingZoneList implements IClientOutgoingPacket public TimedHuntingZoneList(PlayerInstance player) { _player = player; - _isInTimedHuntingZone = player.isInTimedHuntingZone(); + _isInTimedHuntingZone = player.isInsideZone(ZoneId.TIMED_HUNTING); } @Override diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/CallPc.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/CallPc.java index ceeb43cdb2..8ed45498e4 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/CallPc.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/CallPc.java @@ -135,7 +135,7 @@ public class CallPc extends AbstractEffect return false; } - if (target.isFlyingMounted() || target.isCombatFlagEquipped() || target.isInTraingCamp() || target.isInTimedHuntingZone() || effector.isInTimedHuntingZone()) + if (target.isFlyingMounted() || target.isCombatFlagEquipped() || target.isInTraingCamp() || target.isInsideZone(ZoneId.TIMED_HUNTING) || effector.isInsideZone(ZoneId.TIMED_HUNTING)) { effector.sendPacket(SystemMessageId.YOU_CANNOT_USE_SUMMONING_OR_TELEPORTING_IN_THIS_AREA); return false; diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java index ce3f0f2fac..e42736523e 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/TeleportToPlayer.java @@ -109,7 +109,7 @@ public class TeleportToPlayer extends AbstractEffect } final Instance instance = target.getInstanceWorld(); - if (((instance != null) && !instance.isPlayerSummonAllowed()) || target.isInTimedHuntingZone()) + if (((instance != null) && !instance.isPlayerSummonAllowed()) || target.isInsideZone(ZoneId.TIMED_HUNTING)) { final SystemMessage sm = new SystemMessage(SystemMessageId.C1_IS_IN_AN_AREA_WHICH_BLOCKS_SUMMONING_OR_TELEPORTING); sm.addString(target.getName()); diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/zones.xsd b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/zones.xsd index 1cd9137de0..1b272eabd5 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/zones.xsd +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/xsd/zones.xsd @@ -173,6 +173,7 @@ + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/zones/timed_hunting.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/zones/timed_hunting.xml new file mode 100644 index 0000000000..7a87e57440 --- /dev/null +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/zones/timed_hunting.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/ZoneManager.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/ZoneManager.java index 1faf1ae423..fec7e24f5e 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/ZoneManager.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/instancemanager/ZoneManager.java @@ -79,6 +79,7 @@ import org.l2jmobius.gameserver.model.zone.type.SpawnTerritory; import org.l2jmobius.gameserver.model.zone.type.SwampZone; import org.l2jmobius.gameserver.model.zone.type.TaxZone; import org.l2jmobius.gameserver.model.zone.type.TeleportZone; +import org.l2jmobius.gameserver.model.zone.type.TimedHuntingZone; import org.l2jmobius.gameserver.model.zone.type.UndyingZone; import org.l2jmobius.gameserver.model.zone.type.WaterZone; @@ -457,6 +458,7 @@ public class ZoneManager implements IXmlReader _classZones.put(SwampZone.class, new ConcurrentHashMap<>()); _classZones.put(TaxZone.class, new ConcurrentHashMap<>()); _classZones.put(TeleportZone.class, new ConcurrentHashMap<>()); + _classZones.put(TimedHuntingZone.class, new ConcurrentHashMap<>()); _classZones.put(UndyingZone.class, new ConcurrentHashMap<>()); _classZones.put(WaterZone.class, new ConcurrentHashMap<>()); _spawnTerritories.clear(); diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index fca827cf27..6f8b71b833 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -10262,7 +10262,7 @@ public class PlayerInstance extends Playable } // Close time limited zone window. - if (!isInTimedHuntingZone()) + if (!isInsideZone(ZoneId.TIMED_HUNTING)) { stopTimedHuntingZoneTask(); } @@ -14198,11 +14198,6 @@ public class PlayerInstance extends Playable return _autoUseSettings; } - public boolean isInTimedHuntingZone() - { - return isInTimedHuntingZone(getX(), getY()); - } - public boolean isInTimedHuntingZone(int x, int y) { return isInTimedHuntingZone(1, x, y); // Primeval Isle diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/zone/ZoneId.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/zone/ZoneId.java index 7212b16f9a..cd3139dfdd 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/zone/ZoneId.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/zone/ZoneId.java @@ -48,7 +48,8 @@ public enum ZoneId SAYUNE, FISHING, UNDYING, - TAX; + TAX, + TIMED_HUNTING; public static int getZoneCount() { diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/zone/type/TimedHuntingZone.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/zone/type/TimedHuntingZone.java new file mode 100644 index 0000000000..a1459639d2 --- /dev/null +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/zone/type/TimedHuntingZone.java @@ -0,0 +1,67 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.l2jmobius.gameserver.model.zone.type; + +import org.l2jmobius.gameserver.enums.TeleportWhereType; +import org.l2jmobius.gameserver.instancemanager.MapRegionManager; +import org.l2jmobius.gameserver.model.actor.Creature; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.variables.PlayerVariables; +import org.l2jmobius.gameserver.model.zone.ZoneId; +import org.l2jmobius.gameserver.model.zone.ZoneType; + +/** + * @author Mobius + */ +public class TimedHuntingZone extends ZoneType +{ + public TimedHuntingZone(int id) + { + super(id); + } + + @Override + protected void onEnter(Creature creature) + { + final PlayerInstance player = creature.getActingPlayer(); + if (player != null) + { + player.setInsideZone(ZoneId.TIMED_HUNTING, true); + + final long currentTime = System.currentTimeMillis(); + final long primevalIsleExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 1, 0); + if ((primevalIsleExitTime > currentTime) && player.isInTimedHuntingZone(1)) + { + player.startTimedHuntingZone(1, primevalIsleExitTime - currentTime); + } + else + { + player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN)); + } + } + } + + @Override + protected void onExit(Creature creature) + { + final PlayerInstance player = creature.getActingPlayer(); + if (player != null) + { + player.setInsideZone(ZoneId.TIMED_HUNTING, false); + } + } +} diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 8973456347..201755c15b 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -39,7 +39,6 @@ import org.l2jmobius.gameserver.instancemanager.FortManager; import org.l2jmobius.gameserver.instancemanager.FortSiegeManager; import org.l2jmobius.gameserver.instancemanager.InstanceManager; import org.l2jmobius.gameserver.instancemanager.MailManager; -import org.l2jmobius.gameserver.instancemanager.MapRegionManager; import org.l2jmobius.gameserver.instancemanager.PetitionManager; import org.l2jmobius.gameserver.instancemanager.ServerRestartManager; import org.l2jmobius.gameserver.instancemanager.SiegeManager; @@ -649,21 +648,6 @@ public class EnterWorld implements IClientIncomingPacket player.updateAbnormalVisualEffects(); } - // Check if in time limited hunting zone. - if (player.isInTimedHuntingZone()) - { - final long currentTime = System.currentTimeMillis(); - final long primevalIsleExitTime = player.getVariables().getLong(PlayerVariables.HUNTING_ZONE_RESET_TIME + 1, 0); - if ((primevalIsleExitTime > currentTime) && player.isInTimedHuntingZone(1)) - { - player.startTimedHuntingZone(1, primevalIsleExitTime - currentTime); - } - else - { - player.teleToLocation(MapRegionManager.getInstance().getTeleToLocation(player, TeleportWhereType.TOWN)); - } - } - if (Config.ENABLE_ATTENDANCE_REWARDS) { ThreadPool.schedule(() -> diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/RequestSaveBookMarkSlot.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/RequestSaveBookMarkSlot.java index 5912a70026..0183367cea 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/RequestSaveBookMarkSlot.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/RequestSaveBookMarkSlot.java @@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.network.clientpackets; import org.l2jmobius.commons.network.PacketReader; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.network.GameClient; /** @@ -48,7 +49,7 @@ public class RequestSaveBookMarkSlot implements IClientIncomingPacket return; } - if (player.isInTimedHuntingZone()) + if (player.isInsideZone(ZoneId.TIMED_HUNTING)) { player.sendMessage("You cannot bookmark this location."); return; diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/sessionzones/ExTimedHuntingZoneEnter.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/sessionzones/ExTimedHuntingZoneEnter.java index 19e7937cd0..9ff760bc0c 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/sessionzones/ExTimedHuntingZoneEnter.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/sessionzones/ExTimedHuntingZoneEnter.java @@ -107,6 +107,8 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket return; } + player.getVariables().set(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, endTime); + switch (_zoneId) { case 1: // Primeval Isle @@ -115,9 +117,6 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket break; } } - - player.getVariables().set(PlayerVariables.HUNTING_ZONE_RESET_TIME + _zoneId, endTime); - player.startTimedHuntingZone(_zoneId, endTime - currentTime); } else { diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/teleports/ExRequestTeleport.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/teleports/ExRequestTeleport.java index 52a4663df2..ef611e4123 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/teleports/ExRequestTeleport.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/teleports/ExRequestTeleport.java @@ -23,6 +23,7 @@ import org.l2jmobius.gameserver.instancemanager.CastleManager; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.entity.Castle; import org.l2jmobius.gameserver.model.holders.TeleportListHolder; +import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.network.GameClient; import org.l2jmobius.gameserver.network.SystemMessageId; import org.l2jmobius.gameserver.network.clientpackets.IClientIncomingPacket; @@ -58,7 +59,7 @@ public class ExRequestTeleport implements IClientIncomingPacket } // Players should not be able to teleport if in combat, or in a special location. - if (player.isCastingNow() || player.isInCombat() || player.isInInstance() || player.isOnEvent() || player.isInOlympiadMode() || player.inObserverMode() || player.isInTraingCamp() || player.isInTimedHuntingZone()) + if (player.isCastingNow() || player.isInCombat() || player.isInInstance() || player.isOnEvent() || player.isInOlympiadMode() || player.inObserverMode() || player.isInTraingCamp() || player.isInsideZone(ZoneId.TIMED_HUNTING)) { player.sendMessage("You cannot teleport right now."); return; diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java index c8be94d747..6c189ba05d 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/serverpackets/sessionzones/TimedHuntingZoneList.java @@ -20,6 +20,7 @@ import org.l2jmobius.Config; import org.l2jmobius.commons.network.PacketWriter; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.variables.PlayerVariables; +import org.l2jmobius.gameserver.model.zone.ZoneId; import org.l2jmobius.gameserver.network.OutgoingPackets; import org.l2jmobius.gameserver.network.serverpackets.IClientOutgoingPacket; @@ -34,7 +35,7 @@ public class TimedHuntingZoneList implements IClientOutgoingPacket public TimedHuntingZoneList(PlayerInstance player) { _player = player; - _isInTimedHuntingZone = player.isInTimedHuntingZone(); + _isInTimedHuntingZone = player.isInsideZone(ZoneId.TIMED_HUNTING); } @Override