From bb06a36ca81d67abea1e509816313a7ccd6ba7f7 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 2 Jul 2021 22:40:11 +0000 Subject: [PATCH] Addition of Spirit Forest instance. Contributed by manax182. --- .../dist/game/data/html/default/34542.htm | 1 + .../dist/game/data/instances/SpiritForest.xml | 56 +++++++++ .../instances/SpiritForest/SpiritForest.java | 109 ++++++++++++++++++ .../dist/game/data/html/default/34542.htm | 1 + .../dist/game/data/instances/SpiritForest.xml | 56 +++++++++ .../instances/SpiritForest/SpiritForest.java | 109 ++++++++++++++++++ 6 files changed, 332 insertions(+) create mode 100644 L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/instances/SpiritForest.xml create mode 100644 L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/instances/SpiritForest/SpiritForest.java create mode 100644 L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/dist/game/data/instances/SpiritForest.xml create mode 100644 L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/dist/game/data/scripts/instances/SpiritForest/SpiritForest.java diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/html/default/34542.htm b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/html/default/34542.htm index 695db51d7e..bf04a2cb79 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/html/default/34542.htm +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/html/default/34542.htm @@ -3,4 +3,5 @@ Welcome! My name is Benusta. I help adventurers to travel to instance zones. I c + \ No newline at end of file diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/instances/SpiritForest.xml b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/instances/SpiritForest.xml new file mode 100644 index 0000000000..05202e9e7c --- /dev/null +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/instances/SpiritForest.xml @@ -0,0 +1,56 @@ + + + + diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/instances/SpiritForest/SpiritForest.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/instances/SpiritForest/SpiritForest.java new file mode 100644 index 0000000000..2752e96a47 --- /dev/null +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/dist/game/data/scripts/instances/SpiritForest/SpiritForest.java @@ -0,0 +1,109 @@ +/* + * 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.SpiritForest; + +import java.util.List; + +import org.l2jmobius.gameserver.model.Party; +import org.l2jmobius.gameserver.model.actor.Npc; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.instancezone.Instance; +import org.l2jmobius.gameserver.network.NpcStringId; +import org.l2jmobius.gameserver.network.SystemMessageId; +import org.l2jmobius.gameserver.network.serverpackets.ExSendUIEvent; +import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; + +import instances.AbstractInstance; + +/** + * @author Manax, Mobius + */ +public class SpiritForest extends AbstractInstance +{ + private static final int TEMPLATE = 310; // Spirit Forest + + public SpiritForest() + { + super(TEMPLATE); + addInstanceLeaveId(TEMPLATE); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + if (event.equals("enterInstance")) + { + if (player.isInParty()) + { + final Party party = player.getParty(); + if (!party.isLeader(player)) + { + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + return null; + } + + if (player.isInCommandChannel()) + { + player.sendPacket(new SystemMessage(SystemMessageId.YOU_CANNOT_ENTER_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS)); + return null; + } + + final List members = party.getMembers(); + for (PlayerInstance member : members) + { + if (!member.isInsideRadius3D(npc, 1000)) + { + player.sendMessage("Player " + member.getName() + " must go closer to Gatekeeper Spirit."); + return null; + } + } + + for (PlayerInstance member : members) + { + enterInstance(member, npc, TEMPLATE); + } + } + else if (player.isGM()) + { + enterInstance(player, npc, TEMPLATE); + } + else + { + player.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_NOT_CURRENTLY_IN_A_PARTY_SO_YOU_CANNOT_ENTER)); + } + } + return null; + } + + @Override + protected void onEnter(PlayerInstance player, Instance instance, boolean firstEnter) + { + super.onEnter(player, instance, firstEnter); + player.sendPacket(new ExSendUIEvent(player, false, false, Math.min(3600000, (int) (instance.getRemainingTime() / 1000)), 0, NpcStringId.TIME_LEFT)); + } + + @Override + public void onInstanceLeave(PlayerInstance player, Instance instance) + { + player.sendPacket(new ExSendUIEvent(player, true, false, 3600, 0, NpcStringId.TIME_LEFT)); + } + + public static void main(String[] args) + { + new SpiritForest(); + } +} diff --git a/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/dist/game/data/html/default/34542.htm b/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/dist/game/data/html/default/34542.htm index 695db51d7e..bf04a2cb79 100644 --- a/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/dist/game/data/html/default/34542.htm +++ b/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/dist/game/data/html/default/34542.htm @@ -3,4 +3,5 @@ Welcome! My name is Benusta. I help adventurers to travel to instance zones. I c + \ No newline at end of file diff --git a/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/dist/game/data/instances/SpiritForest.xml b/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/dist/game/data/instances/SpiritForest.xml new file mode 100644 index 0000000000..05202e9e7c --- /dev/null +++ b/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/dist/game/data/instances/SpiritForest.xml @@ -0,0 +1,56 @@ + + + + diff --git a/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/dist/game/data/scripts/instances/SpiritForest/SpiritForest.java b/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/dist/game/data/scripts/instances/SpiritForest/SpiritForest.java new file mode 100644 index 0000000000..2752e96a47 --- /dev/null +++ b/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/dist/game/data/scripts/instances/SpiritForest/SpiritForest.java @@ -0,0 +1,109 @@ +/* + * 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.SpiritForest; + +import java.util.List; + +import org.l2jmobius.gameserver.model.Party; +import org.l2jmobius.gameserver.model.actor.Npc; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.instancezone.Instance; +import org.l2jmobius.gameserver.network.NpcStringId; +import org.l2jmobius.gameserver.network.SystemMessageId; +import org.l2jmobius.gameserver.network.serverpackets.ExSendUIEvent; +import org.l2jmobius.gameserver.network.serverpackets.SystemMessage; + +import instances.AbstractInstance; + +/** + * @author Manax, Mobius + */ +public class SpiritForest extends AbstractInstance +{ + private static final int TEMPLATE = 310; // Spirit Forest + + public SpiritForest() + { + super(TEMPLATE); + addInstanceLeaveId(TEMPLATE); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + if (event.equals("enterInstance")) + { + if (player.isInParty()) + { + final Party party = player.getParty(); + if (!party.isLeader(player)) + { + player.sendPacket(new SystemMessage(SystemMessageId.ONLY_A_PARTY_LEADER_CAN_MAKE_THE_REQUEST_TO_ENTER)); + return null; + } + + if (player.isInCommandChannel()) + { + player.sendPacket(new SystemMessage(SystemMessageId.YOU_CANNOT_ENTER_BECAUSE_YOU_DO_NOT_MEET_THE_REQUIREMENTS)); + return null; + } + + final List members = party.getMembers(); + for (PlayerInstance member : members) + { + if (!member.isInsideRadius3D(npc, 1000)) + { + player.sendMessage("Player " + member.getName() + " must go closer to Gatekeeper Spirit."); + return null; + } + } + + for (PlayerInstance member : members) + { + enterInstance(member, npc, TEMPLATE); + } + } + else if (player.isGM()) + { + enterInstance(player, npc, TEMPLATE); + } + else + { + player.sendPacket(new SystemMessage(SystemMessageId.YOU_ARE_NOT_CURRENTLY_IN_A_PARTY_SO_YOU_CANNOT_ENTER)); + } + } + return null; + } + + @Override + protected void onEnter(PlayerInstance player, Instance instance, boolean firstEnter) + { + super.onEnter(player, instance, firstEnter); + player.sendPacket(new ExSendUIEvent(player, false, false, Math.min(3600000, (int) (instance.getRemainingTime() / 1000)), 0, NpcStringId.TIME_LEFT)); + } + + @Override + public void onInstanceLeave(PlayerInstance player, Instance instance) + { + player.sendPacket(new ExSendUIEvent(player, true, false, 3600, 0, NpcStringId.TIME_LEFT)); + } + + public static void main(String[] args) + { + new SpiritForest(); + } +}