From 2185cd4bddc34fc68029ebf41d9c2e20372fbcc1 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Tue, 29 Jun 2021 23:23:36 +0000 Subject: [PATCH] Addition of Corroded Fields timed hunting zone. Thanks to manax182. --- .../model/actor/instance/PlayerInstance.java | 1 + .../huntingzones/ExTimedHuntingZoneEnter.java | 2 +- .../model/actor/instance/PlayerInstance.java | 1 + .../huntingzones/ExTimedHuntingZoneEnter.java | 2 +- .../dist/game/data/TimedHuntingZoneData.xml | 11 ++- .../game/data/instances/CorrodedFields.xml | 81 +++++++++++++++++ .../instances/TranscendentZone/34568.html | 12 +++ .../instances/TranscendentZone/34569.html | 4 + .../TranscendentZone/TranscendentZone.java | 90 +++++++++++++++++++ .../teleporters/others/PatrolTeleporter.xml | 13 +++ .../dist/game/data/zones/peace.xml | 18 ++++ .../model/actor/instance/PlayerInstance.java | 1 + .../huntingzones/ExTimedHuntingZoneEnter.java | 2 +- .../model/actor/instance/PlayerInstance.java | 1 + .../huntingzones/ExTimedHuntingZoneEnter.java | 2 +- .../TranscendentZone/TranscendentZone.java | 36 +++++++- .../model/actor/instance/PlayerInstance.java | 1 + .../huntingzones/ExTimedHuntingZoneEnter.java | 2 +- .../TranscendentZone/TranscendentZone.java | 36 +++++++- .../model/actor/instance/PlayerInstance.java | 1 + .../huntingzones/ExTimedHuntingZoneEnter.java | 2 +- .../TranscendentZone/TranscendentZone.java | 36 +++++++- .../model/actor/instance/PlayerInstance.java | 1 + .../huntingzones/ExTimedHuntingZoneEnter.java | 2 +- 24 files changed, 341 insertions(+), 17 deletions(-) create mode 100644 L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/instances/CorrodedFields.xml create mode 100644 L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/instances/TranscendentZone/34568.html create mode 100644 L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/instances/TranscendentZone/34569.html create mode 100644 L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java create mode 100644 L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/teleporters/others/PatrolTeleporter.xml 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 dc96a836f0..dda6df6a0f 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 @@ -14356,6 +14356,7 @@ public class PlayerInstance extends Playable abortCast(); stopMove(null); teleToLocation(MapRegionManager.getInstance().getTeleToLocation(this, TeleportWhereType.TOWN)); + setInstance(null); } } }, 60000, 60000); diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java index a6e789f3af..afa7ec5659 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java @@ -148,7 +148,7 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket } else // Transcendent zones. { - QuestManager.getInstance().getQuest("TranscendentZone").notifyEvent("ENTER " + instanceId, null, player); + QuestManager.getInstance().getQuest("TranscendentZone").notifyEvent("ENTER " + _zoneId, null, player); } } else 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 a80c326f4e..825ae2458a 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 @@ -14427,6 +14427,7 @@ public class PlayerInstance extends Playable abortCast(); stopMove(null); teleToLocation(MapRegionManager.getInstance().getTeleToLocation(this, TeleportWhereType.TOWN)); + setInstance(null); } } }, 60000, 60000); diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java index a6e789f3af..afa7ec5659 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java @@ -148,7 +148,7 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket } else // Transcendent zones. { - QuestManager.getInstance().getQuest("TranscendentZone").notifyEvent("ENTER " + instanceId, null, player); + QuestManager.getInstance().getQuest("TranscendentZone").notifyEvent("ENTER " + _zoneId, null, player); } } else diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/TimedHuntingZoneData.xml b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/TimedHuntingZoneData.xml index 4e472c2bf9..845c68d0a6 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/TimedHuntingZoneData.xml +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/TimedHuntingZoneData.xml @@ -61,16 +61,19 @@ 105 130 - + 36000 + 3600 43200 3600 150000 100 130 - --> + 1013 + false + -49013,15351,-8808 3600 diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/instances/CorrodedFields.xml b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/instances/CorrodedFields.xml new file mode 100644 index 0000000000..f928516947 --- /dev/null +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/instances/CorrodedFields.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/instances/TranscendentZone/34568.html b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/instances/TranscendentZone/34568.html new file mode 100644 index 0000000000..3c29795859 --- /dev/null +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/instances/TranscendentZone/34568.html @@ -0,0 +1,12 @@ +Patrol Teleporter:
+The sudden attack of the Fafurion army has had my head spinning. The first group can be found in the Field of Silence to the noth trying to subjugate +the Krofin. The second one, composed of elite warriors, is setting up camp in the Field of Whispers to the south.
+Our scouts think that the soldiers in the Fields of Whispers are more dangerous, so be extra careful.
+Where would you like to teleport?
+ + + + + + + \ No newline at end of file diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/instances/TranscendentZone/34569.html b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/instances/TranscendentZone/34569.html new file mode 100644 index 0000000000..9b09ce9c8b --- /dev/null +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/instances/TranscendentZone/34569.html @@ -0,0 +1,4 @@ +Patrol Guard:
+Fafurion's Soldiers have occupied the fields. We found out rhat they have divided into two units.
+The soldiers to the north in the Field of Silence are there to capture Krofins, and the elite soldiers are to the south in the Field of Whispers. + \ No newline at end of file diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java new file mode 100644 index 0000000000..be4a62745d --- /dev/null +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java @@ -0,0 +1,90 @@ +/* + * 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 instances.TranscendentZone; + +import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData; +import org.l2jmobius.gameserver.instancemanager.InstanceManager; +import org.l2jmobius.gameserver.model.actor.Npc; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder; +import org.l2jmobius.gameserver.model.instancezone.Instance; + +import instances.AbstractInstance; + +/** + * @author Mobius + */ +public class TranscendentZone extends AbstractInstance +{ + // NPCs + private static final int PATROL_TELEPORTER = 34568; + private static final int PATROL_GUARD = 34569; + // Misc + private static final int TEMPLATE = 1013; // Corroded Fields + + public TranscendentZone() + { + super(TEMPLATE); + addStartNpc(PATROL_TELEPORTER, PATROL_GUARD); + addTalkId(PATROL_TELEPORTER, PATROL_GUARD); + addFirstTalkId(PATROL_TELEPORTER, PATROL_GUARD); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + if (event.startsWith("ENTER")) + { + final int zoneId = Integer.parseInt(event.split(" ")[1]); + final TimedHuntingZoneHolder huntingZone = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId); + if (huntingZone == null) + { + return null; + } + + if (huntingZone.isSoloInstance()) + { + enterInstance(player, npc, huntingZone.getInstanceId()); + } + else + { + Instance world = null; + for (Instance instance : InstanceManager.getInstance().getInstances()) + { + if (instance.getTemplateId() == huntingZone.getInstanceId()) + { + world = instance; + break; + } + } + + if (world == null) + { + world = InstanceManager.getInstance().createInstance(huntingZone.getInstanceId(), player); + } + + player.teleToLocation(huntingZone.getEnterLocation(), world); + } + } + return null; + } + + public static void main(String[] args) + { + new TranscendentZone(); + } +} diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/teleporters/others/PatrolTeleporter.xml b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/teleporters/others/PatrolTeleporter.xml new file mode 100644 index 0000000000..17a15c5120 --- /dev/null +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/teleporters/others/PatrolTeleporter.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/zones/peace.xml b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/zones/peace.xml index 0a9a7189f5..552ae243a7 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/zones/peace.xml +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/zones/peace.xml @@ -1011,4 +1011,22 @@
+ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index d4133341ab..bf241ef95a 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -14465,6 +14465,7 @@ public class PlayerInstance extends Playable abortCast(); stopMove(null); teleToLocation(MapRegionManager.getInstance().getTeleToLocation(this, TeleportWhereType.TOWN)); + setInstance(null); } } }, 60000, 60000); diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java index a6e789f3af..afa7ec5659 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java @@ -148,7 +148,7 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket } else // Transcendent zones. { - QuestManager.getInstance().getQuest("TranscendentZone").notifyEvent("ENTER " + instanceId, null, player); + QuestManager.getInstance().getQuest("TranscendentZone").notifyEvent("ENTER " + _zoneId, null, player); } } else 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 8f77840901..f161aac86d 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 @@ -14336,6 +14336,7 @@ public class PlayerInstance extends Playable abortCast(); stopMove(null); teleToLocation(MapRegionManager.getInstance().getTeleToLocation(this, TeleportWhereType.TOWN)); + setInstance(null); } } }, 60000, 60000); diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java index 2786010f14..6e0239194d 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java @@ -148,7 +148,7 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket } else // Transcendent zones. { - QuestManager.getInstance().getQuest("TranscendentZone").notifyEvent("ENTER " + instanceId, null, player); + QuestManager.getInstance().getQuest("TranscendentZone").notifyEvent("ENTER " + _zoneId, null, player); } } else diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java index fd3dc97ef7..ad78b32276 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java @@ -20,11 +20,14 @@ import java.util.concurrent.ScheduledFuture; import org.l2jmobius.commons.concurrent.ThreadPool; import org.l2jmobius.commons.util.Rnd; +import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData; import org.l2jmobius.gameserver.enums.TeleportWhereType; +import org.l2jmobius.gameserver.instancemanager.InstanceManager; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.holders.SkillHolder; +import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder; import org.l2jmobius.gameserver.model.instancezone.Instance; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.serverpackets.ExSendUIEvent; @@ -33,7 +36,7 @@ import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZ import instances.AbstractInstance; /** - * Written by Berezkin Nikolay, on 21.04.2021 + * @author Berezkin Nikolay, Mobius */ public class TranscendentZone extends AbstractInstance { @@ -69,7 +72,36 @@ public class TranscendentZone extends AbstractInstance { if (event.startsWith("ENTER")) { - enterInstance(player, npc, Integer.parseInt(event.split(" ")[1])); + final int zoneId = Integer.parseInt(event.split(" ")[1]); + final TimedHuntingZoneHolder huntingZone = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId); + if (huntingZone == null) + { + return null; + } + + if (huntingZone.isSoloInstance()) + { + enterInstance(player, npc, huntingZone.getInstanceId()); + } + else + { + Instance world = null; + for (Instance instance : InstanceManager.getInstance().getInstances()) + { + if (instance.getTemplateId() == huntingZone.getInstanceId()) + { + world = instance; + break; + } + } + + if (world == null) + { + world = InstanceManager.getInstance().createInstance(huntingZone.getInstanceId(), player); + } + + player.teleToLocation(huntingZone.getEnterLocation(), world); + } } else if (event.startsWith("FINISH")) { 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 8b25cab262..af3d132cd4 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 @@ -14597,6 +14597,7 @@ public class PlayerInstance extends Playable abortCast(); stopMove(null); teleToLocation(MapRegionManager.getInstance().getTeleToLocation(this, TeleportWhereType.TOWN)); + setInstance(null); } } }, 60000, 60000); diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java index 2786010f14..6e0239194d 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java @@ -148,7 +148,7 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket } else // Transcendent zones. { - QuestManager.getInstance().getQuest("TranscendentZone").notifyEvent("ENTER " + instanceId, null, player); + QuestManager.getInstance().getQuest("TranscendentZone").notifyEvent("ENTER " + _zoneId, null, player); } } else diff --git a/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java b/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java index fd3dc97ef7..ad78b32276 100644 --- a/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java +++ b/L2J_Mobius_Essence_5.0_Sylph/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java @@ -20,11 +20,14 @@ import java.util.concurrent.ScheduledFuture; import org.l2jmobius.commons.concurrent.ThreadPool; import org.l2jmobius.commons.util.Rnd; +import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData; import org.l2jmobius.gameserver.enums.TeleportWhereType; +import org.l2jmobius.gameserver.instancemanager.InstanceManager; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.holders.SkillHolder; +import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder; import org.l2jmobius.gameserver.model.instancezone.Instance; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.serverpackets.ExSendUIEvent; @@ -33,7 +36,7 @@ import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZ import instances.AbstractInstance; /** - * Written by Berezkin Nikolay, on 21.04.2021 + * @author Berezkin Nikolay, Mobius */ public class TranscendentZone extends AbstractInstance { @@ -69,7 +72,36 @@ public class TranscendentZone extends AbstractInstance { if (event.startsWith("ENTER")) { - enterInstance(player, npc, Integer.parseInt(event.split(" ")[1])); + final int zoneId = Integer.parseInt(event.split(" ")[1]); + final TimedHuntingZoneHolder huntingZone = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId); + if (huntingZone == null) + { + return null; + } + + if (huntingZone.isSoloInstance()) + { + enterInstance(player, npc, huntingZone.getInstanceId()); + } + else + { + Instance world = null; + for (Instance instance : InstanceManager.getInstance().getInstances()) + { + if (instance.getTemplateId() == huntingZone.getInstanceId()) + { + world = instance; + break; + } + } + + if (world == null) + { + world = InstanceManager.getInstance().createInstance(huntingZone.getInstanceId(), player); + } + + player.teleToLocation(huntingZone.getEnterLocation(), world); + } } else if (event.startsWith("FINISH")) { diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index cb44f50009..5bc7dd3624 100644 --- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -14675,6 +14675,7 @@ public class PlayerInstance extends Playable abortCast(); stopMove(null); teleToLocation(MapRegionManager.getInstance().getTeleToLocation(this, TeleportWhereType.TOWN)); + setInstance(null); } } }, 60000, 60000); diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java index 2786010f14..6e0239194d 100644 --- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java +++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java @@ -148,7 +148,7 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket } else // Transcendent zones. { - QuestManager.getInstance().getQuest("TranscendentZone").notifyEvent("ENTER " + instanceId, null, player); + QuestManager.getInstance().getQuest("TranscendentZone").notifyEvent("ENTER " + _zoneId, null, player); } } else diff --git a/L2J_Mobius_Essence_5.5_FrostLord/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java b/L2J_Mobius_Essence_5.5_FrostLord/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java index fd3dc97ef7..ad78b32276 100644 --- a/L2J_Mobius_Essence_5.5_FrostLord/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java +++ b/L2J_Mobius_Essence_5.5_FrostLord/dist/game/data/scripts/instances/TranscendentZone/TranscendentZone.java @@ -20,11 +20,14 @@ import java.util.concurrent.ScheduledFuture; import org.l2jmobius.commons.concurrent.ThreadPool; import org.l2jmobius.commons.util.Rnd; +import org.l2jmobius.gameserver.data.xml.TimedHuntingZoneData; import org.l2jmobius.gameserver.enums.TeleportWhereType; +import org.l2jmobius.gameserver.instancemanager.InstanceManager; import org.l2jmobius.gameserver.model.WorldObject; import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.holders.SkillHolder; +import org.l2jmobius.gameserver.model.holders.TimedHuntingZoneHolder; import org.l2jmobius.gameserver.model.instancezone.Instance; import org.l2jmobius.gameserver.network.NpcStringId; import org.l2jmobius.gameserver.network.serverpackets.ExSendUIEvent; @@ -33,7 +36,7 @@ import org.l2jmobius.gameserver.network.serverpackets.huntingzones.TimedHuntingZ import instances.AbstractInstance; /** - * Written by Berezkin Nikolay, on 21.04.2021 + * @author Berezkin Nikolay, Mobius */ public class TranscendentZone extends AbstractInstance { @@ -69,7 +72,36 @@ public class TranscendentZone extends AbstractInstance { if (event.startsWith("ENTER")) { - enterInstance(player, npc, Integer.parseInt(event.split(" ")[1])); + final int zoneId = Integer.parseInt(event.split(" ")[1]); + final TimedHuntingZoneHolder huntingZone = TimedHuntingZoneData.getInstance().getHuntingZone(zoneId); + if (huntingZone == null) + { + return null; + } + + if (huntingZone.isSoloInstance()) + { + enterInstance(player, npc, huntingZone.getInstanceId()); + } + else + { + Instance world = null; + for (Instance instance : InstanceManager.getInstance().getInstances()) + { + if (instance.getTemplateId() == huntingZone.getInstanceId()) + { + world = instance; + break; + } + } + + if (world == null) + { + world = InstanceManager.getInstance().createInstance(huntingZone.getInstanceId(), player); + } + + player.teleToLocation(huntingZone.getEnterLocation(), world); + } } else if (event.startsWith("FINISH")) { diff --git a/L2J_Mobius_Essence_5.5_FrostLord/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java b/L2J_Mobius_Essence_5.5_FrostLord/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java index cb44f50009..5bc7dd3624 100644 --- a/L2J_Mobius_Essence_5.5_FrostLord/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java +++ b/L2J_Mobius_Essence_5.5_FrostLord/java/org/l2jmobius/gameserver/model/actor/instance/PlayerInstance.java @@ -14675,6 +14675,7 @@ public class PlayerInstance extends Playable abortCast(); stopMove(null); teleToLocation(MapRegionManager.getInstance().getTeleToLocation(this, TeleportWhereType.TOWN)); + setInstance(null); } } }, 60000, 60000); diff --git a/L2J_Mobius_Essence_5.5_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java b/L2J_Mobius_Essence_5.5_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java index 2786010f14..6e0239194d 100644 --- a/L2J_Mobius_Essence_5.5_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java +++ b/L2J_Mobius_Essence_5.5_FrostLord/java/org/l2jmobius/gameserver/network/clientpackets/huntingzones/ExTimedHuntingZoneEnter.java @@ -148,7 +148,7 @@ public class ExTimedHuntingZoneEnter implements IClientIncomingPacket } else // Transcendent zones. { - QuestManager.getInstance().getQuest("TranscendentZone").notifyEvent("ENTER " + instanceId, null, player); + QuestManager.getInstance().getQuest("TranscendentZone").notifyEvent("ENTER " + _zoneId, null, player); } } else