From 5fa60b02dc1fb0b408ed801d8d50e0a24bd623f5 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 12 Jul 2019 17:15:32 +0000 Subject: [PATCH] Addition of Plains of Dion AI. --- .../ai/areas/PlainsOfDion/PlainsOfDion.java | 96 +++++++++++++++++++ .../ai/areas/PlainsOfDion/PlainsOfDion.java | 96 +++++++++++++++++++ .../ai/areas/PlainsOfDion/PlainsOfDion.java | 96 +++++++++++++++++++ .../ai/areas/PlainsOfDion/PlainsOfDion.java | 96 +++++++++++++++++++ .../ai/areas/PlainsOfDion/PlainsOfDion.java | 96 +++++++++++++++++++ 5 files changed, 480 insertions(+) create mode 100644 L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/ai/areas/PlainsOfDion/PlainsOfDion.java create mode 100644 L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/ai/areas/PlainsOfDion/PlainsOfDion.java create mode 100644 L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/ai/areas/PlainsOfDion/PlainsOfDion.java create mode 100644 L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/ai/areas/PlainsOfDion/PlainsOfDion.java create mode 100644 L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/ai/areas/PlainsOfDion/PlainsOfDion.java diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/ai/areas/PlainsOfDion/PlainsOfDion.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/ai/areas/PlainsOfDion/PlainsOfDion.java new file mode 100644 index 0000000000..73c02e1ad4 --- /dev/null +++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/ai/areas/PlainsOfDion/PlainsOfDion.java @@ -0,0 +1,96 @@ +/* + * 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.PlainsOfDion; + +import org.l2jmobius.commons.util.CommonUtil; +import org.l2jmobius.gameserver.enums.ChatType; +import org.l2jmobius.gameserver.geoengine.GeoEngine; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Npc; +import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * AI for mobs in Plains of Dion (near Floran Village). + * @author Gladicek + */ +public final class PlainsOfDion extends AbstractNpcAI +{ + private static final int DELU_LIZARDMEN[] = + { + 21104, // Delu Lizardman Supplier + 21105, // Delu Lizardman Special Agent + 21107, // Delu Lizardman Commander + }; + + private static final NpcStringId[] MONSTERS_MSG = + { + NpcStringId.S1_HOW_DARE_YOU_INTERRUPT_OUR_FIGHT_HEY_GUYS_HELP, + NpcStringId.S1_HEY_WE_RE_HAVING_A_DUEL_HERE, + NpcStringId.THE_DUEL_IS_OVER_ATTACK, + NpcStringId.FOUL_KILL_THE_COWARD, + NpcStringId.HOW_DARE_YOU_INTERRUPT_A_SACRED_DUEL_YOU_MUST_BE_TAUGHT_A_LESSON + }; + + private static final NpcStringId[] MONSTERS_ASSIST_MSG = + { + NpcStringId.DIE_YOU_COWARD, + NpcStringId.KILL_THE_COWARD, + NpcStringId.WHAT_ARE_YOU_LOOKING_AT + }; + + private PlainsOfDion() + { + addAttackId(DELU_LIZARDMEN); + } + + @Override + public String onAttack(Npc npc, PlayerInstance player, int damage, boolean isSummon) + { + if (npc.isScriptValue(0)) + { + final int i = getRandom(5); + if (i < 2) + { + npc.broadcastSay(ChatType.NPC_GENERAL, MONSTERS_MSG[i], player.getName()); + } + else + { + npc.broadcastSay(ChatType.NPC_GENERAL, MONSTERS_MSG[i]); + } + + World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, npc.getTemplate().getClanHelpRange(), obj -> + { + if (CommonUtil.contains(DELU_LIZARDMEN, obj.getId()) && !obj.isAttackingNow() && !obj.isDead() && GeoEngine.getInstance().canSeeTarget(npc, obj)) + { + addAttackPlayerDesire(obj, player); + obj.broadcastSay(ChatType.NPC_GENERAL, MONSTERS_ASSIST_MSG[getRandom(3)]); + } + }); + npc.setScriptValue(1); + } + return super.onAttack(npc, player, damage, isSummon); + } + + public static void main(String[] args) + { + new PlainsOfDion(); + } +} diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/ai/areas/PlainsOfDion/PlainsOfDion.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/ai/areas/PlainsOfDion/PlainsOfDion.java new file mode 100644 index 0000000000..73c02e1ad4 --- /dev/null +++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/ai/areas/PlainsOfDion/PlainsOfDion.java @@ -0,0 +1,96 @@ +/* + * 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.PlainsOfDion; + +import org.l2jmobius.commons.util.CommonUtil; +import org.l2jmobius.gameserver.enums.ChatType; +import org.l2jmobius.gameserver.geoengine.GeoEngine; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Npc; +import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * AI for mobs in Plains of Dion (near Floran Village). + * @author Gladicek + */ +public final class PlainsOfDion extends AbstractNpcAI +{ + private static final int DELU_LIZARDMEN[] = + { + 21104, // Delu Lizardman Supplier + 21105, // Delu Lizardman Special Agent + 21107, // Delu Lizardman Commander + }; + + private static final NpcStringId[] MONSTERS_MSG = + { + NpcStringId.S1_HOW_DARE_YOU_INTERRUPT_OUR_FIGHT_HEY_GUYS_HELP, + NpcStringId.S1_HEY_WE_RE_HAVING_A_DUEL_HERE, + NpcStringId.THE_DUEL_IS_OVER_ATTACK, + NpcStringId.FOUL_KILL_THE_COWARD, + NpcStringId.HOW_DARE_YOU_INTERRUPT_A_SACRED_DUEL_YOU_MUST_BE_TAUGHT_A_LESSON + }; + + private static final NpcStringId[] MONSTERS_ASSIST_MSG = + { + NpcStringId.DIE_YOU_COWARD, + NpcStringId.KILL_THE_COWARD, + NpcStringId.WHAT_ARE_YOU_LOOKING_AT + }; + + private PlainsOfDion() + { + addAttackId(DELU_LIZARDMEN); + } + + @Override + public String onAttack(Npc npc, PlayerInstance player, int damage, boolean isSummon) + { + if (npc.isScriptValue(0)) + { + final int i = getRandom(5); + if (i < 2) + { + npc.broadcastSay(ChatType.NPC_GENERAL, MONSTERS_MSG[i], player.getName()); + } + else + { + npc.broadcastSay(ChatType.NPC_GENERAL, MONSTERS_MSG[i]); + } + + World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, npc.getTemplate().getClanHelpRange(), obj -> + { + if (CommonUtil.contains(DELU_LIZARDMEN, obj.getId()) && !obj.isAttackingNow() && !obj.isDead() && GeoEngine.getInstance().canSeeTarget(npc, obj)) + { + addAttackPlayerDesire(obj, player); + obj.broadcastSay(ChatType.NPC_GENERAL, MONSTERS_ASSIST_MSG[getRandom(3)]); + } + }); + npc.setScriptValue(1); + } + return super.onAttack(npc, player, damage, isSummon); + } + + public static void main(String[] args) + { + new PlainsOfDion(); + } +} diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/ai/areas/PlainsOfDion/PlainsOfDion.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/ai/areas/PlainsOfDion/PlainsOfDion.java new file mode 100644 index 0000000000..73c02e1ad4 --- /dev/null +++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/ai/areas/PlainsOfDion/PlainsOfDion.java @@ -0,0 +1,96 @@ +/* + * 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.PlainsOfDion; + +import org.l2jmobius.commons.util.CommonUtil; +import org.l2jmobius.gameserver.enums.ChatType; +import org.l2jmobius.gameserver.geoengine.GeoEngine; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Npc; +import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * AI for mobs in Plains of Dion (near Floran Village). + * @author Gladicek + */ +public final class PlainsOfDion extends AbstractNpcAI +{ + private static final int DELU_LIZARDMEN[] = + { + 21104, // Delu Lizardman Supplier + 21105, // Delu Lizardman Special Agent + 21107, // Delu Lizardman Commander + }; + + private static final NpcStringId[] MONSTERS_MSG = + { + NpcStringId.S1_HOW_DARE_YOU_INTERRUPT_OUR_FIGHT_HEY_GUYS_HELP, + NpcStringId.S1_HEY_WE_RE_HAVING_A_DUEL_HERE, + NpcStringId.THE_DUEL_IS_OVER_ATTACK, + NpcStringId.FOUL_KILL_THE_COWARD, + NpcStringId.HOW_DARE_YOU_INTERRUPT_A_SACRED_DUEL_YOU_MUST_BE_TAUGHT_A_LESSON + }; + + private static final NpcStringId[] MONSTERS_ASSIST_MSG = + { + NpcStringId.DIE_YOU_COWARD, + NpcStringId.KILL_THE_COWARD, + NpcStringId.WHAT_ARE_YOU_LOOKING_AT + }; + + private PlainsOfDion() + { + addAttackId(DELU_LIZARDMEN); + } + + @Override + public String onAttack(Npc npc, PlayerInstance player, int damage, boolean isSummon) + { + if (npc.isScriptValue(0)) + { + final int i = getRandom(5); + if (i < 2) + { + npc.broadcastSay(ChatType.NPC_GENERAL, MONSTERS_MSG[i], player.getName()); + } + else + { + npc.broadcastSay(ChatType.NPC_GENERAL, MONSTERS_MSG[i]); + } + + World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, npc.getTemplate().getClanHelpRange(), obj -> + { + if (CommonUtil.contains(DELU_LIZARDMEN, obj.getId()) && !obj.isAttackingNow() && !obj.isDead() && GeoEngine.getInstance().canSeeTarget(npc, obj)) + { + addAttackPlayerDesire(obj, player); + obj.broadcastSay(ChatType.NPC_GENERAL, MONSTERS_ASSIST_MSG[getRandom(3)]); + } + }); + npc.setScriptValue(1); + } + return super.onAttack(npc, player, damage, isSummon); + } + + public static void main(String[] args) + { + new PlainsOfDion(); + } +} diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/ai/areas/PlainsOfDion/PlainsOfDion.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/ai/areas/PlainsOfDion/PlainsOfDion.java new file mode 100644 index 0000000000..73c02e1ad4 --- /dev/null +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/ai/areas/PlainsOfDion/PlainsOfDion.java @@ -0,0 +1,96 @@ +/* + * 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.PlainsOfDion; + +import org.l2jmobius.commons.util.CommonUtil; +import org.l2jmobius.gameserver.enums.ChatType; +import org.l2jmobius.gameserver.geoengine.GeoEngine; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Npc; +import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * AI for mobs in Plains of Dion (near Floran Village). + * @author Gladicek + */ +public final class PlainsOfDion extends AbstractNpcAI +{ + private static final int DELU_LIZARDMEN[] = + { + 21104, // Delu Lizardman Supplier + 21105, // Delu Lizardman Special Agent + 21107, // Delu Lizardman Commander + }; + + private static final NpcStringId[] MONSTERS_MSG = + { + NpcStringId.S1_HOW_DARE_YOU_INTERRUPT_OUR_FIGHT_HEY_GUYS_HELP, + NpcStringId.S1_HEY_WE_RE_HAVING_A_DUEL_HERE, + NpcStringId.THE_DUEL_IS_OVER_ATTACK, + NpcStringId.FOUL_KILL_THE_COWARD, + NpcStringId.HOW_DARE_YOU_INTERRUPT_A_SACRED_DUEL_YOU_MUST_BE_TAUGHT_A_LESSON + }; + + private static final NpcStringId[] MONSTERS_ASSIST_MSG = + { + NpcStringId.DIE_YOU_COWARD, + NpcStringId.KILL_THE_COWARD, + NpcStringId.WHAT_ARE_YOU_LOOKING_AT + }; + + private PlainsOfDion() + { + addAttackId(DELU_LIZARDMEN); + } + + @Override + public String onAttack(Npc npc, PlayerInstance player, int damage, boolean isSummon) + { + if (npc.isScriptValue(0)) + { + final int i = getRandom(5); + if (i < 2) + { + npc.broadcastSay(ChatType.NPC_GENERAL, MONSTERS_MSG[i], player.getName()); + } + else + { + npc.broadcastSay(ChatType.NPC_GENERAL, MONSTERS_MSG[i]); + } + + World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, npc.getTemplate().getClanHelpRange(), obj -> + { + if (CommonUtil.contains(DELU_LIZARDMEN, obj.getId()) && !obj.isAttackingNow() && !obj.isDead() && GeoEngine.getInstance().canSeeTarget(npc, obj)) + { + addAttackPlayerDesire(obj, player); + obj.broadcastSay(ChatType.NPC_GENERAL, MONSTERS_ASSIST_MSG[getRandom(3)]); + } + }); + npc.setScriptValue(1); + } + return super.onAttack(npc, player, damage, isSummon); + } + + public static void main(String[] args) + { + new PlainsOfDion(); + } +} diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/ai/areas/PlainsOfDion/PlainsOfDion.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/ai/areas/PlainsOfDion/PlainsOfDion.java new file mode 100644 index 0000000000..ff8b8e442e --- /dev/null +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/ai/areas/PlainsOfDion/PlainsOfDion.java @@ -0,0 +1,96 @@ +/* + * 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.PlainsOfDion; + +import org.l2jmobius.commons.util.CommonUtil; +import org.l2jmobius.gameserver.enums.ChatType; +import org.l2jmobius.gameserver.geoengine.GeoEngine; +import org.l2jmobius.gameserver.model.World; +import org.l2jmobius.gameserver.model.actor.Npc; +import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.network.NpcStringId; + +import ai.AbstractNpcAI; + +/** + * AI for mobs in Plains of Dion (near Floran Village). + * @author Gladicek + */ +public final class PlainsOfDion extends AbstractNpcAI +{ + private static final int DELU_LIZARDMEN[] = + { + 21104, // Delu Lizardman Supplier + 21105, // Delu Lizardman Special Agent + 21107, // Delu Lizardman Commander + }; + + private static final NpcStringId[] MONSTERS_MSG = + { + NpcStringId.S1_HOW_DARE_YOU_INTERRUPT_OUR_FIGHT_HEY_GUYS_HELP, + NpcStringId.S1_HEY_WE_RE_HAVING_A_DUEL_HERE, + NpcStringId.THE_DUEL_IS_OVER_ATTACK, + NpcStringId.FOUL_KILL_THE_COWARD, + NpcStringId.HOW_DARE_YOU_INTERRUPT_A_SACRED_DUEL_YOU_MUST_BE_TAUGHT_A_LESSON + }; + + private static final NpcStringId[] MONSTERS_ASSIST_MSG = + { + NpcStringId.DIE_YOU_COWARD, + NpcStringId.KILL_THE_COWARD, + NpcStringId.WHAT_ARE_YOU_LOOKING_AT + }; + + private PlainsOfDion() + { + addAttackId(DELU_LIZARDMEN); + } + + @Override + public String onAttack(Npc npc, PlayerInstance player, int damage, boolean isSummon) + { + if (npc.isScriptValue(0)) + { + final int i = getRandom(5); + if (i < 2) + { + npc.broadcastSay(ChatType.NPC_GENERAL, MONSTERS_MSG[i], player.getName()); + } + else + { + npc.broadcastSay(ChatType.NPC_GENERAL, MONSTERS_MSG[i]); + } + + World.getInstance().forEachVisibleObjectInRange(npc, MonsterInstance.class, npc.getTemplate().getClanHelpRange(), obj -> + { + if (CommonUtil.contains(DELU_LIZARDMEN, obj.getId()) && !obj.isAttackingNow() && !obj.isDead() && GeoEngine.getInstance().canSeeTarget(npc, obj)) + { + addAttackPlayerDesire(obj, player); + obj.broadcastSay(ChatType.NPC_GENERAL, MONSTERS_ASSIST_MSG[getRandom(3)]); + } + }); + npc.setScriptValue(1); + } + return super.onAttack(npc, player, damage, isSummon); + } + + public static void main(String[] args) + { + new PlainsOfDion(); + } +}