From 1ac94c03c9c123cbf087009e03cf7b1c96c1a4b0 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sun, 5 Nov 2017 20:42:54 +0000 Subject: [PATCH] Talking Island double walkers. Contributed by Liamxroy. --- .../dist/game/data/Routes.xml | 42 +++++++++ .../game/data/scripts/ai/AbstractNpcAI.java | 35 ++++++++ .../areas/TalkingIsland/Walkers/Allada.java | 80 +++++++++++++++++ .../ai/areas/TalkingIsland/Walkers/Mei.java | 68 ++++++++++++++ .../areas/TalkingIsland/Walkers/Remons.java | 77 ++++++++++++++++ .../ai/areas/TalkingIsland/Walkers/Rinne.java | 88 +++++++++++++++++++ .../areas/TalkingIsland/Walkers/Rotina.java | 80 +++++++++++++++++ .../ai/areas/TalkingIsland/Walkers/Soros.java | 73 +++++++++++++++ .../TalkingIsland/TalkingIslandTerritory.xml | 1 + .../TalkingIsland/TalkingIslandVillage.xml | 1 + .../dist/game/data/Routes.xml | 42 +++++++++ .../game/data/scripts/ai/AbstractNpcAI.java | 35 ++++++++ .../areas/TalkingIsland/Walkers/Allada.java | 80 +++++++++++++++++ .../ai/areas/TalkingIsland/Walkers/Mei.java | 68 ++++++++++++++ .../areas/TalkingIsland/Walkers/Remons.java | 77 ++++++++++++++++ .../ai/areas/TalkingIsland/Walkers/Rinne.java | 88 +++++++++++++++++++ .../areas/TalkingIsland/Walkers/Rotina.java | 80 +++++++++++++++++ .../ai/areas/TalkingIsland/Walkers/Soros.java | 73 +++++++++++++++ .../TalkingIsland/TalkingIslandTerritory.xml | 1 + .../TalkingIsland/TalkingIslandVillage.xml | 1 + .../dist/game/data/Routes.xml | 42 +++++++++ .../game/data/scripts/ai/AbstractNpcAI.java | 35 ++++++++ .../areas/TalkingIsland/Walkers/Allada.java | 80 +++++++++++++++++ .../ai/areas/TalkingIsland/Walkers/Mei.java | 68 ++++++++++++++ .../areas/TalkingIsland/Walkers/Remons.java | 77 ++++++++++++++++ .../ai/areas/TalkingIsland/Walkers/Rinne.java | 88 +++++++++++++++++++ .../areas/TalkingIsland/Walkers/Rotina.java | 80 +++++++++++++++++ .../ai/areas/TalkingIsland/Walkers/Soros.java | 73 +++++++++++++++ .../TalkingIsland/TalkingIslandTerritory.xml | 1 + .../TalkingIsland/TalkingIslandVillage.xml | 1 + 30 files changed, 1635 insertions(+) create mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Allada.java create mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Mei.java create mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Remons.java create mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rinne.java create mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rotina.java create mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Soros.java create mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Allada.java create mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Mei.java create mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Remons.java create mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rinne.java create mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rotina.java create mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Soros.java create mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Allada.java create mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Mei.java create mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Remons.java create mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rinne.java create mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rotina.java create mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Soros.java diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/Routes.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/Routes.xml index 73cf439e1b..98e0d38815 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/Routes.xml +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/Routes.xml @@ -1396,6 +1396,16 @@ + + + + + + + + + + @@ -1416,6 +1426,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/AbstractNpcAI.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/AbstractNpcAI.java index df220882f6..12e345f842 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/AbstractNpcAI.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/AbstractNpcAI.java @@ -18,6 +18,8 @@ package ai; import java.util.logging.Logger; +import com.l2jmobius.gameserver.model.L2World; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance; @@ -26,6 +28,7 @@ import com.l2jmobius.gameserver.model.holders.MinionHolder; import com.l2jmobius.gameserver.model.quest.Quest; import com.l2jmobius.gameserver.network.serverpackets.SocialAction; import com.l2jmobius.gameserver.util.Broadcast; +import com.l2jmobius.gameserver.util.Util; /** * Abstract NPC AI class for datapack based AIs. @@ -101,4 +104,36 @@ public abstract class AbstractNpcAI extends Quest addMinion((L2MonsterInstance) npc, is.getId()); } } + + protected void followNpc(final L2Npc npc, int followedNpcId, int followingAngle, int minDistance, int maxDistance) + { + L2World.getInstance().forEachVisibleObject(npc, L2Npc.class, npcAround -> + { + if (npcAround.getId() != followedNpcId) + { + return; + } + + final double distance = npc.calculateDistance(npcAround, true, false); + if ((distance >= maxDistance) && npc.isScriptValue(0)) + { + npc.setRunning(); + npc.setScriptValue(1); + } + else if ((distance <= (minDistance * 1.5)) && npc.isScriptValue(1)) + { + npc.setWalking(); + npc.setScriptValue(0); + } + + final double course = Math.toRadians(followingAngle); + final double radian = Math.toRadians(Util.convertHeadingToDegree(npcAround.getHeading())); + final double nRadius = npc.getCollisionRadius() + npcAround.getCollisionRadius() + minDistance; + final int x = npcAround.getLocation().getX() + (int) (Math.cos(Math.PI + radian + course) * nRadius); + final int y = npcAround.getLocation().getY() + (int) (Math.sin(Math.PI + radian + course) * nRadius); + final int z = npcAround.getLocation().getZ(); + + npc.getAI().moveTo(new Location(x, y, z)); + }); + } } \ No newline at end of file diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Allada.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Allada.java new file mode 100644 index 0000000000..1ff1758fe2 --- /dev/null +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Allada.java @@ -0,0 +1,80 @@ +/* + * 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 ai.areas.TalkingIsland.Walkers; + +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * Allada AI. + * @author Gladicek + */ +public final class Allada extends AbstractNpcAI +{ + // NPC + private static final int RINNE = 33234; + private static final int ALLADA = 33220; + // Items + private static final int WEAPON = 15304; + // Distances + private static final int MIN_DISTANCE = 70; + private static final int MAX_DISTANCE = 200; + + private Allada() + { + addSpawnId(ALLADA); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + switch (event) + { + case "NPC_SHOUT": + { + npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IT_S_A_MIRACLE_THAT_THE_TALKING_ISLAND_HAS_RESTORED); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + break; + } + case "WALK_AROUND_RINNE": + { + followNpc(npc, RINNE, 115, MIN_DISTANCE, MAX_DISTANCE); + break; + } + } + } + + @Override + public String onSpawn(L2Npc npc) + { + npc.setRHandId(WEAPON); + followNpc(npc, RINNE, 115, MIN_DISTANCE, MAX_DISTANCE); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + getTimers().addRepeatingTimer("WALK_AROUND_RINNE", 1000, npc, null); + return super.onSpawn(npc); + } + + public static void main(String[] args) + { + new Allada(); + } +} \ No newline at end of file diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Mei.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Mei.java new file mode 100644 index 0000000000..6a765e6ce9 --- /dev/null +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Mei.java @@ -0,0 +1,68 @@ +/* + * 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 ai.areas.TalkingIsland.Walkers; + +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * Mei AI. + * @author Gladicek + */ +public final class Mei extends AbstractNpcAI +{ + // NPC + private static final int MEI = 33280; + private static final int ROTINA = 33027; + + private Mei() + { + addSpawnId(MEI); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + if (event.equals("NPC_SHOUT")) + { + npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IF_YOU_IGNORE_THE_TRAINING_GROUNDS_YOU_LL_REGRET_IT); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + } + else if (event.equals("NPC_FOLLOW")) + { + addSpawn(ROTINA, npc.getX() + 10, npc.getY() + 10, npc.getZ() + 10, 0, false, 0); + } + } + + @Override + public String onSpawn(L2Npc npc) + { + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + getTimers().addTimer("NPC_FOLLOW", 100, npc, null); + return super.onSpawn(npc); + } + + public static void main(String[] args) + { + new Mei(); + } +} \ No newline at end of file diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Remons.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Remons.java new file mode 100644 index 0000000000..9d87412489 --- /dev/null +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Remons.java @@ -0,0 +1,77 @@ +/* + * 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 ai.areas.TalkingIsland.Walkers; + +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * Remons AI. + * @author Gladicek + */ +public final class Remons extends AbstractNpcAI +{ + // NPC + private static final int REMONS = 33570; + private static final int SOROS = 33218; + // Distances + private static final int MIN_DISTANCE = 70; + private static final int MAX_DISTANCE = 200; + + private Remons() + { + addSpawnId(REMONS); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + switch (event) + { + case "NPC_SHOUT": + { + npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.PERHAPS_EVEN_THE_VILLAGE_BECOMES_DANGEROUS); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + break; + } + case "WALK_AROUND_SOROS": + { + followNpc(npc, SOROS, 240, MIN_DISTANCE, MAX_DISTANCE); + break; + } + } + } + + @Override + public String onSpawn(L2Npc npc) + { + followNpc(npc, SOROS, 240, MIN_DISTANCE, MAX_DISTANCE); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + getTimers().addRepeatingTimer("WALK_AROUND_SOROS", 1000, npc, null); + return super.onSpawn(npc); + } + + public static void main(String[] args) + { + new Remons(); + } +} \ No newline at end of file diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rinne.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rinne.java new file mode 100644 index 0000000000..2e8cd38cc5 --- /dev/null +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rinne.java @@ -0,0 +1,88 @@ +/* + * 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 ai.areas.TalkingIsland.Walkers; + +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * Rinne AI. + * @author Gladicek + */ +public final class Rinne extends AbstractNpcAI +{ + // NPC + private static final int RINNE = 33234; + private static final int ALLADA = 33220; + // Items + private static final int WEAPON = 15302; + + private Rinne() + { + addSpawnId(RINNE); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + switch (event) + { + case "TID_LEFTWALK": + { + npc.setRHandId(WEAPON); + getTimers().addTimer("TID_STRAIGHTWALK", (5000 + getRandom(5)) * 1000, npc, null); + break; + } + case "TID_STRAIGHTWALK": + { + npc.setRHandId(0); + getTimers().addTimer("TID_LEFTWALK", (5000 + getRandom(5)) * 1000, npc, null); + break; + } + case "NPC_SHOUT": + { + npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ALL_RACES_CAME_TOGETHER_TO_REBUILD_TALKING_ISLAND_VILLAGE); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + break; + } + case "NPC_FOLLOW": + { + addSpawn(ALLADA, npc.getX() + 10, npc.getY() + 10, npc.getZ(), 0, false, 0); + break; + } + } + } + + @Override + public String onSpawn(L2Npc npc) + { + getTimers().addTimer("TID_LEFTWALK", (5000 + getRandom(5)) * 1000, npc, null); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + getTimers().addTimer("NPC_FOLLOW", 100, npc, null); + return super.onSpawn(npc); + } + + public static void main(String[] args) + { + new Rinne(); + } +} \ No newline at end of file diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rotina.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rotina.java new file mode 100644 index 0000000000..1b7de7b878 --- /dev/null +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rotina.java @@ -0,0 +1,80 @@ +/* + * 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 ai.areas.TalkingIsland.Walkers; + +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * Rotina AI. + * @author Gladicek + */ +public final class Rotina extends AbstractNpcAI +{ + // NPC + private static final int ROTINA = 33027; + private static final int MEI = 33280; + // Items + private static final int WEAPON = 15304; + // Distances + private static final int MIN_DISTANCE = 70; + private static final int MAX_DISTANCE = 200; + + private Rotina() + { + addSpawnId(ROTINA); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + switch (event) + { + case "NPC_SHOUT": + { + npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_LL_EARN_TONS_OF_ITEMS_USING_THE_TRAINING_GROUNDS); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + break; + } + case "WALK_AROUND_MEI": + { + followNpc(npc, MEI, 115, MIN_DISTANCE, MAX_DISTANCE); + break; + } + } + } + + @Override + public String onSpawn(L2Npc npc) + { + npc.setRHandId(WEAPON); + followNpc(npc, MEI, 115, MIN_DISTANCE, MAX_DISTANCE); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + getTimers().addRepeatingTimer("WALK_AROUND_MEI", 1000, npc, null); + return super.onSpawn(npc); + } + + public static void main(String[] args) + { + new Rotina(); + } +} \ No newline at end of file diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Soros.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Soros.java new file mode 100644 index 0000000000..1300c305f3 --- /dev/null +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Soros.java @@ -0,0 +1,73 @@ +/* + * 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 ai.areas.TalkingIsland.Walkers; + +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * Soros AI. + * @author Gladicek + */ +public final class Soros extends AbstractNpcAI +{ + // NPC + private static final int SOROS = 33218; + private static final int REMONS = 33570; + + private Soros() + { + addSpawnId(SOROS); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + switch (event) + { + case "NPC_SHOUT": + { + npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.SOMETHING_LIKE_THAT_COMES_OUT_OF_THE_RUINS); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + break; + } + case "NPC_FOLLOW": + { + addSpawn(REMONS, npc.getX() + 10, npc.getY() + 10, npc.getZ() + 10, 0, false, 0); + break; + } + } + } + + @Override + public String onSpawn(L2Npc npc) + { + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + getTimers().addTimer("NPC_FOLLOW", 100, npc, null); + return super.onSpawn(npc); + } + + public static void main(String[] args) + { + new Soros(); + } +} \ No newline at end of file diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/spawns/TalkingIsland/TalkingIslandTerritory.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/spawns/TalkingIsland/TalkingIslandTerritory.xml index 78ebbaf966..353caac67c 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/spawns/TalkingIsland/TalkingIslandTerritory.xml +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/spawns/TalkingIsland/TalkingIslandTerritory.xml @@ -385,6 +385,7 @@ + diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/spawns/TalkingIsland/TalkingIslandVillage.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/spawns/TalkingIsland/TalkingIslandVillage.xml index 650a33547b..daf14a748f 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/spawns/TalkingIsland/TalkingIslandVillage.xml +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/spawns/TalkingIsland/TalkingIslandVillage.xml @@ -188,6 +188,7 @@ + diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/Routes.xml b/L2J_Mobius_2.5_Underground/dist/game/data/Routes.xml index 73cf439e1b..98e0d38815 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/Routes.xml +++ b/L2J_Mobius_2.5_Underground/dist/game/data/Routes.xml @@ -1396,6 +1396,16 @@ + + + + + + + + + + @@ -1416,6 +1426,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/AbstractNpcAI.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/AbstractNpcAI.java index df220882f6..12e345f842 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/AbstractNpcAI.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/AbstractNpcAI.java @@ -18,6 +18,8 @@ package ai; import java.util.logging.Logger; +import com.l2jmobius.gameserver.model.L2World; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance; @@ -26,6 +28,7 @@ import com.l2jmobius.gameserver.model.holders.MinionHolder; import com.l2jmobius.gameserver.model.quest.Quest; import com.l2jmobius.gameserver.network.serverpackets.SocialAction; import com.l2jmobius.gameserver.util.Broadcast; +import com.l2jmobius.gameserver.util.Util; /** * Abstract NPC AI class for datapack based AIs. @@ -101,4 +104,36 @@ public abstract class AbstractNpcAI extends Quest addMinion((L2MonsterInstance) npc, is.getId()); } } + + protected void followNpc(final L2Npc npc, int followedNpcId, int followingAngle, int minDistance, int maxDistance) + { + L2World.getInstance().forEachVisibleObject(npc, L2Npc.class, npcAround -> + { + if (npcAround.getId() != followedNpcId) + { + return; + } + + final double distance = npc.calculateDistance(npcAround, true, false); + if ((distance >= maxDistance) && npc.isScriptValue(0)) + { + npc.setRunning(); + npc.setScriptValue(1); + } + else if ((distance <= (minDistance * 1.5)) && npc.isScriptValue(1)) + { + npc.setWalking(); + npc.setScriptValue(0); + } + + final double course = Math.toRadians(followingAngle); + final double radian = Math.toRadians(Util.convertHeadingToDegree(npcAround.getHeading())); + final double nRadius = npc.getCollisionRadius() + npcAround.getCollisionRadius() + minDistance; + final int x = npcAround.getLocation().getX() + (int) (Math.cos(Math.PI + radian + course) * nRadius); + final int y = npcAround.getLocation().getY() + (int) (Math.sin(Math.PI + radian + course) * nRadius); + final int z = npcAround.getLocation().getZ(); + + npc.getAI().moveTo(new Location(x, y, z)); + }); + } } \ No newline at end of file diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Allada.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Allada.java new file mode 100644 index 0000000000..1ff1758fe2 --- /dev/null +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Allada.java @@ -0,0 +1,80 @@ +/* + * 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 ai.areas.TalkingIsland.Walkers; + +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * Allada AI. + * @author Gladicek + */ +public final class Allada extends AbstractNpcAI +{ + // NPC + private static final int RINNE = 33234; + private static final int ALLADA = 33220; + // Items + private static final int WEAPON = 15304; + // Distances + private static final int MIN_DISTANCE = 70; + private static final int MAX_DISTANCE = 200; + + private Allada() + { + addSpawnId(ALLADA); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + switch (event) + { + case "NPC_SHOUT": + { + npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IT_S_A_MIRACLE_THAT_THE_TALKING_ISLAND_HAS_RESTORED); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + break; + } + case "WALK_AROUND_RINNE": + { + followNpc(npc, RINNE, 115, MIN_DISTANCE, MAX_DISTANCE); + break; + } + } + } + + @Override + public String onSpawn(L2Npc npc) + { + npc.setRHandId(WEAPON); + followNpc(npc, RINNE, 115, MIN_DISTANCE, MAX_DISTANCE); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + getTimers().addRepeatingTimer("WALK_AROUND_RINNE", 1000, npc, null); + return super.onSpawn(npc); + } + + public static void main(String[] args) + { + new Allada(); + } +} \ No newline at end of file diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Mei.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Mei.java new file mode 100644 index 0000000000..6a765e6ce9 --- /dev/null +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Mei.java @@ -0,0 +1,68 @@ +/* + * 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 ai.areas.TalkingIsland.Walkers; + +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * Mei AI. + * @author Gladicek + */ +public final class Mei extends AbstractNpcAI +{ + // NPC + private static final int MEI = 33280; + private static final int ROTINA = 33027; + + private Mei() + { + addSpawnId(MEI); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + if (event.equals("NPC_SHOUT")) + { + npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IF_YOU_IGNORE_THE_TRAINING_GROUNDS_YOU_LL_REGRET_IT); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + } + else if (event.equals("NPC_FOLLOW")) + { + addSpawn(ROTINA, npc.getX() + 10, npc.getY() + 10, npc.getZ() + 10, 0, false, 0); + } + } + + @Override + public String onSpawn(L2Npc npc) + { + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + getTimers().addTimer("NPC_FOLLOW", 100, npc, null); + return super.onSpawn(npc); + } + + public static void main(String[] args) + { + new Mei(); + } +} \ No newline at end of file diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Remons.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Remons.java new file mode 100644 index 0000000000..9d87412489 --- /dev/null +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Remons.java @@ -0,0 +1,77 @@ +/* + * 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 ai.areas.TalkingIsland.Walkers; + +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * Remons AI. + * @author Gladicek + */ +public final class Remons extends AbstractNpcAI +{ + // NPC + private static final int REMONS = 33570; + private static final int SOROS = 33218; + // Distances + private static final int MIN_DISTANCE = 70; + private static final int MAX_DISTANCE = 200; + + private Remons() + { + addSpawnId(REMONS); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + switch (event) + { + case "NPC_SHOUT": + { + npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.PERHAPS_EVEN_THE_VILLAGE_BECOMES_DANGEROUS); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + break; + } + case "WALK_AROUND_SOROS": + { + followNpc(npc, SOROS, 240, MIN_DISTANCE, MAX_DISTANCE); + break; + } + } + } + + @Override + public String onSpawn(L2Npc npc) + { + followNpc(npc, SOROS, 240, MIN_DISTANCE, MAX_DISTANCE); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + getTimers().addRepeatingTimer("WALK_AROUND_SOROS", 1000, npc, null); + return super.onSpawn(npc); + } + + public static void main(String[] args) + { + new Remons(); + } +} \ No newline at end of file diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rinne.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rinne.java new file mode 100644 index 0000000000..2e8cd38cc5 --- /dev/null +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rinne.java @@ -0,0 +1,88 @@ +/* + * 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 ai.areas.TalkingIsland.Walkers; + +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * Rinne AI. + * @author Gladicek + */ +public final class Rinne extends AbstractNpcAI +{ + // NPC + private static final int RINNE = 33234; + private static final int ALLADA = 33220; + // Items + private static final int WEAPON = 15302; + + private Rinne() + { + addSpawnId(RINNE); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + switch (event) + { + case "TID_LEFTWALK": + { + npc.setRHandId(WEAPON); + getTimers().addTimer("TID_STRAIGHTWALK", (5000 + getRandom(5)) * 1000, npc, null); + break; + } + case "TID_STRAIGHTWALK": + { + npc.setRHandId(0); + getTimers().addTimer("TID_LEFTWALK", (5000 + getRandom(5)) * 1000, npc, null); + break; + } + case "NPC_SHOUT": + { + npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ALL_RACES_CAME_TOGETHER_TO_REBUILD_TALKING_ISLAND_VILLAGE); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + break; + } + case "NPC_FOLLOW": + { + addSpawn(ALLADA, npc.getX() + 10, npc.getY() + 10, npc.getZ(), 0, false, 0); + break; + } + } + } + + @Override + public String onSpawn(L2Npc npc) + { + getTimers().addTimer("TID_LEFTWALK", (5000 + getRandom(5)) * 1000, npc, null); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + getTimers().addTimer("NPC_FOLLOW", 100, npc, null); + return super.onSpawn(npc); + } + + public static void main(String[] args) + { + new Rinne(); + } +} \ No newline at end of file diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rotina.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rotina.java new file mode 100644 index 0000000000..1b7de7b878 --- /dev/null +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rotina.java @@ -0,0 +1,80 @@ +/* + * 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 ai.areas.TalkingIsland.Walkers; + +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * Rotina AI. + * @author Gladicek + */ +public final class Rotina extends AbstractNpcAI +{ + // NPC + private static final int ROTINA = 33027; + private static final int MEI = 33280; + // Items + private static final int WEAPON = 15304; + // Distances + private static final int MIN_DISTANCE = 70; + private static final int MAX_DISTANCE = 200; + + private Rotina() + { + addSpawnId(ROTINA); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + switch (event) + { + case "NPC_SHOUT": + { + npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_LL_EARN_TONS_OF_ITEMS_USING_THE_TRAINING_GROUNDS); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + break; + } + case "WALK_AROUND_MEI": + { + followNpc(npc, MEI, 115, MIN_DISTANCE, MAX_DISTANCE); + break; + } + } + } + + @Override + public String onSpawn(L2Npc npc) + { + npc.setRHandId(WEAPON); + followNpc(npc, MEI, 115, MIN_DISTANCE, MAX_DISTANCE); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + getTimers().addRepeatingTimer("WALK_AROUND_MEI", 1000, npc, null); + return super.onSpawn(npc); + } + + public static void main(String[] args) + { + new Rotina(); + } +} \ No newline at end of file diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Soros.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Soros.java new file mode 100644 index 0000000000..1300c305f3 --- /dev/null +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Soros.java @@ -0,0 +1,73 @@ +/* + * 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 ai.areas.TalkingIsland.Walkers; + +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * Soros AI. + * @author Gladicek + */ +public final class Soros extends AbstractNpcAI +{ + // NPC + private static final int SOROS = 33218; + private static final int REMONS = 33570; + + private Soros() + { + addSpawnId(SOROS); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + switch (event) + { + case "NPC_SHOUT": + { + npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.SOMETHING_LIKE_THAT_COMES_OUT_OF_THE_RUINS); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + break; + } + case "NPC_FOLLOW": + { + addSpawn(REMONS, npc.getX() + 10, npc.getY() + 10, npc.getZ() + 10, 0, false, 0); + break; + } + } + } + + @Override + public String onSpawn(L2Npc npc) + { + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + getTimers().addTimer("NPC_FOLLOW", 100, npc, null); + return super.onSpawn(npc); + } + + public static void main(String[] args) + { + new Soros(); + } +} \ No newline at end of file diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/spawns/TalkingIsland/TalkingIslandTerritory.xml b/L2J_Mobius_2.5_Underground/dist/game/data/spawns/TalkingIsland/TalkingIslandTerritory.xml index 78ebbaf966..353caac67c 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/spawns/TalkingIsland/TalkingIslandTerritory.xml +++ b/L2J_Mobius_2.5_Underground/dist/game/data/spawns/TalkingIsland/TalkingIslandTerritory.xml @@ -385,6 +385,7 @@ + diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/spawns/TalkingIsland/TalkingIslandVillage.xml b/L2J_Mobius_2.5_Underground/dist/game/data/spawns/TalkingIsland/TalkingIslandVillage.xml index 650a33547b..daf14a748f 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/spawns/TalkingIsland/TalkingIslandVillage.xml +++ b/L2J_Mobius_2.5_Underground/dist/game/data/spawns/TalkingIsland/TalkingIslandVillage.xml @@ -188,6 +188,7 @@ + diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/Routes.xml b/L2J_Mobius_3.0_Helios/dist/game/data/Routes.xml index 73cf439e1b..98e0d38815 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/Routes.xml +++ b/L2J_Mobius_3.0_Helios/dist/game/data/Routes.xml @@ -1396,6 +1396,16 @@ + + + + + + + + + + @@ -1416,6 +1426,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/AbstractNpcAI.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/AbstractNpcAI.java index df220882f6..12e345f842 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/AbstractNpcAI.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/AbstractNpcAI.java @@ -18,6 +18,8 @@ package ai; import java.util.logging.Logger; +import com.l2jmobius.gameserver.model.L2World; +import com.l2jmobius.gameserver.model.Location; import com.l2jmobius.gameserver.model.actor.L2Character; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance; @@ -26,6 +28,7 @@ import com.l2jmobius.gameserver.model.holders.MinionHolder; import com.l2jmobius.gameserver.model.quest.Quest; import com.l2jmobius.gameserver.network.serverpackets.SocialAction; import com.l2jmobius.gameserver.util.Broadcast; +import com.l2jmobius.gameserver.util.Util; /** * Abstract NPC AI class for datapack based AIs. @@ -101,4 +104,36 @@ public abstract class AbstractNpcAI extends Quest addMinion((L2MonsterInstance) npc, is.getId()); } } + + protected void followNpc(final L2Npc npc, int followedNpcId, int followingAngle, int minDistance, int maxDistance) + { + L2World.getInstance().forEachVisibleObject(npc, L2Npc.class, npcAround -> + { + if (npcAround.getId() != followedNpcId) + { + return; + } + + final double distance = npc.calculateDistance(npcAround, true, false); + if ((distance >= maxDistance) && npc.isScriptValue(0)) + { + npc.setRunning(); + npc.setScriptValue(1); + } + else if ((distance <= (minDistance * 1.5)) && npc.isScriptValue(1)) + { + npc.setWalking(); + npc.setScriptValue(0); + } + + final double course = Math.toRadians(followingAngle); + final double radian = Math.toRadians(Util.convertHeadingToDegree(npcAround.getHeading())); + final double nRadius = npc.getCollisionRadius() + npcAround.getCollisionRadius() + minDistance; + final int x = npcAround.getLocation().getX() + (int) (Math.cos(Math.PI + radian + course) * nRadius); + final int y = npcAround.getLocation().getY() + (int) (Math.sin(Math.PI + radian + course) * nRadius); + final int z = npcAround.getLocation().getZ(); + + npc.getAI().moveTo(new Location(x, y, z)); + }); + } } \ No newline at end of file diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Allada.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Allada.java new file mode 100644 index 0000000000..1ff1758fe2 --- /dev/null +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Allada.java @@ -0,0 +1,80 @@ +/* + * 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 ai.areas.TalkingIsland.Walkers; + +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * Allada AI. + * @author Gladicek + */ +public final class Allada extends AbstractNpcAI +{ + // NPC + private static final int RINNE = 33234; + private static final int ALLADA = 33220; + // Items + private static final int WEAPON = 15304; + // Distances + private static final int MIN_DISTANCE = 70; + private static final int MAX_DISTANCE = 200; + + private Allada() + { + addSpawnId(ALLADA); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + switch (event) + { + case "NPC_SHOUT": + { + npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IT_S_A_MIRACLE_THAT_THE_TALKING_ISLAND_HAS_RESTORED); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + break; + } + case "WALK_AROUND_RINNE": + { + followNpc(npc, RINNE, 115, MIN_DISTANCE, MAX_DISTANCE); + break; + } + } + } + + @Override + public String onSpawn(L2Npc npc) + { + npc.setRHandId(WEAPON); + followNpc(npc, RINNE, 115, MIN_DISTANCE, MAX_DISTANCE); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + getTimers().addRepeatingTimer("WALK_AROUND_RINNE", 1000, npc, null); + return super.onSpawn(npc); + } + + public static void main(String[] args) + { + new Allada(); + } +} \ No newline at end of file diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Mei.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Mei.java new file mode 100644 index 0000000000..6a765e6ce9 --- /dev/null +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Mei.java @@ -0,0 +1,68 @@ +/* + * 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 ai.areas.TalkingIsland.Walkers; + +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * Mei AI. + * @author Gladicek + */ +public final class Mei extends AbstractNpcAI +{ + // NPC + private static final int MEI = 33280; + private static final int ROTINA = 33027; + + private Mei() + { + addSpawnId(MEI); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + if (event.equals("NPC_SHOUT")) + { + npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.IF_YOU_IGNORE_THE_TRAINING_GROUNDS_YOU_LL_REGRET_IT); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + } + else if (event.equals("NPC_FOLLOW")) + { + addSpawn(ROTINA, npc.getX() + 10, npc.getY() + 10, npc.getZ() + 10, 0, false, 0); + } + } + + @Override + public String onSpawn(L2Npc npc) + { + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + getTimers().addTimer("NPC_FOLLOW", 100, npc, null); + return super.onSpawn(npc); + } + + public static void main(String[] args) + { + new Mei(); + } +} \ No newline at end of file diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Remons.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Remons.java new file mode 100644 index 0000000000..9d87412489 --- /dev/null +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Remons.java @@ -0,0 +1,77 @@ +/* + * 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 ai.areas.TalkingIsland.Walkers; + +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * Remons AI. + * @author Gladicek + */ +public final class Remons extends AbstractNpcAI +{ + // NPC + private static final int REMONS = 33570; + private static final int SOROS = 33218; + // Distances + private static final int MIN_DISTANCE = 70; + private static final int MAX_DISTANCE = 200; + + private Remons() + { + addSpawnId(REMONS); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + switch (event) + { + case "NPC_SHOUT": + { + npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.PERHAPS_EVEN_THE_VILLAGE_BECOMES_DANGEROUS); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + break; + } + case "WALK_AROUND_SOROS": + { + followNpc(npc, SOROS, 240, MIN_DISTANCE, MAX_DISTANCE); + break; + } + } + } + + @Override + public String onSpawn(L2Npc npc) + { + followNpc(npc, SOROS, 240, MIN_DISTANCE, MAX_DISTANCE); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + getTimers().addRepeatingTimer("WALK_AROUND_SOROS", 1000, npc, null); + return super.onSpawn(npc); + } + + public static void main(String[] args) + { + new Remons(); + } +} \ No newline at end of file diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rinne.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rinne.java new file mode 100644 index 0000000000..2e8cd38cc5 --- /dev/null +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rinne.java @@ -0,0 +1,88 @@ +/* + * 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 ai.areas.TalkingIsland.Walkers; + +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * Rinne AI. + * @author Gladicek + */ +public final class Rinne extends AbstractNpcAI +{ + // NPC + private static final int RINNE = 33234; + private static final int ALLADA = 33220; + // Items + private static final int WEAPON = 15302; + + private Rinne() + { + addSpawnId(RINNE); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + switch (event) + { + case "TID_LEFTWALK": + { + npc.setRHandId(WEAPON); + getTimers().addTimer("TID_STRAIGHTWALK", (5000 + getRandom(5)) * 1000, npc, null); + break; + } + case "TID_STRAIGHTWALK": + { + npc.setRHandId(0); + getTimers().addTimer("TID_LEFTWALK", (5000 + getRandom(5)) * 1000, npc, null); + break; + } + case "NPC_SHOUT": + { + npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.ALL_RACES_CAME_TOGETHER_TO_REBUILD_TALKING_ISLAND_VILLAGE); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + break; + } + case "NPC_FOLLOW": + { + addSpawn(ALLADA, npc.getX() + 10, npc.getY() + 10, npc.getZ(), 0, false, 0); + break; + } + } + } + + @Override + public String onSpawn(L2Npc npc) + { + getTimers().addTimer("TID_LEFTWALK", (5000 + getRandom(5)) * 1000, npc, null); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + getTimers().addTimer("NPC_FOLLOW", 100, npc, null); + return super.onSpawn(npc); + } + + public static void main(String[] args) + { + new Rinne(); + } +} \ No newline at end of file diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rotina.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rotina.java new file mode 100644 index 0000000000..1b7de7b878 --- /dev/null +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Rotina.java @@ -0,0 +1,80 @@ +/* + * 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 ai.areas.TalkingIsland.Walkers; + +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * Rotina AI. + * @author Gladicek + */ +public final class Rotina extends AbstractNpcAI +{ + // NPC + private static final int ROTINA = 33027; + private static final int MEI = 33280; + // Items + private static final int WEAPON = 15304; + // Distances + private static final int MIN_DISTANCE = 70; + private static final int MAX_DISTANCE = 200; + + private Rotina() + { + addSpawnId(ROTINA); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + switch (event) + { + case "NPC_SHOUT": + { + npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.YOU_LL_EARN_TONS_OF_ITEMS_USING_THE_TRAINING_GROUNDS); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + break; + } + case "WALK_AROUND_MEI": + { + followNpc(npc, MEI, 115, MIN_DISTANCE, MAX_DISTANCE); + break; + } + } + } + + @Override + public String onSpawn(L2Npc npc) + { + npc.setRHandId(WEAPON); + followNpc(npc, MEI, 115, MIN_DISTANCE, MAX_DISTANCE); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + getTimers().addRepeatingTimer("WALK_AROUND_MEI", 1000, npc, null); + return super.onSpawn(npc); + } + + public static void main(String[] args) + { + new Rotina(); + } +} \ No newline at end of file diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Soros.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Soros.java new file mode 100644 index 0000000000..1300c305f3 --- /dev/null +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/Walkers/Soros.java @@ -0,0 +1,73 @@ +/* + * 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 ai.areas.TalkingIsland.Walkers; + +import com.l2jmobius.gameserver.enums.ChatType; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * Soros AI. + * @author Gladicek + */ +public final class Soros extends AbstractNpcAI +{ + // NPC + private static final int SOROS = 33218; + private static final int REMONS = 33570; + + private Soros() + { + addSpawnId(SOROS); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + switch (event) + { + case "NPC_SHOUT": + { + npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.SOMETHING_LIKE_THAT_COMES_OUT_OF_THE_RUINS); + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + break; + } + case "NPC_FOLLOW": + { + addSpawn(REMONS, npc.getX() + 10, npc.getY() + 10, npc.getZ() + 10, 0, false, 0); + break; + } + } + } + + @Override + public String onSpawn(L2Npc npc) + { + getTimers().addTimer("NPC_SHOUT", (10 + getRandom(5)) * 1000, npc, null); + getTimers().addTimer("NPC_FOLLOW", 100, npc, null); + return super.onSpawn(npc); + } + + public static void main(String[] args) + { + new Soros(); + } +} \ No newline at end of file diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/spawns/TalkingIsland/TalkingIslandTerritory.xml b/L2J_Mobius_3.0_Helios/dist/game/data/spawns/TalkingIsland/TalkingIslandTerritory.xml index 3d3371d8eb..bdeebf9b95 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/spawns/TalkingIsland/TalkingIslandTerritory.xml +++ b/L2J_Mobius_3.0_Helios/dist/game/data/spawns/TalkingIsland/TalkingIslandTerritory.xml @@ -376,6 +376,7 @@ + diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/spawns/TalkingIsland/TalkingIslandVillage.xml b/L2J_Mobius_3.0_Helios/dist/game/data/spawns/TalkingIsland/TalkingIslandVillage.xml index 550118e75f..3c5c54c00c 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/spawns/TalkingIsland/TalkingIslandVillage.xml +++ b/L2J_Mobius_3.0_Helios/dist/game/data/spawns/TalkingIsland/TalkingIslandVillage.xml @@ -188,6 +188,7 @@ +