From 677d4b027a33c967447246a721fd12210803508a Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Tue, 10 Apr 2018 21:13:58 +0000 Subject: [PATCH] Addition of isTalkable NPC template parameter. --- .../scripts/ai/others/NonTalkingNpcs.java | 71 ------------------- .../dist/game/data/stats/npcs/18600-18699.xml | 18 ++--- .../dist/game/data/stats/npcs/18800-18899.xml | 4 +- .../dist/game/data/stats/npcs/18900-18999.xml | 7 +- .../dist/game/data/stats/npcs/31200-31299.xml | 18 ++--- .../dist/game/data/stats/npcs/31500-31599.xml | 4 +- .../dist/game/data/stats/npcs/31600-31699.xml | 10 +-- .../dist/game/data/stats/npcs/31700-31799.xml | 2 +- .../dist/game/data/stats/npcs/31900-31999.xml | 2 +- .../dist/game/data/stats/npcs/32000-32099.xml | 8 +-- .../dist/game/data/stats/npcs/32300-32399.xml | 2 +- .../dist/game/data/stats/npcs/32600-32699.xml | 6 +- .../dist/game/data/stats/npcs/32700-32799.xml | 14 ++-- .../dist/game/data/xsd/npcs.xsd | 1 + .../gameserver/data/xml/impl/NpcData.java | 1 + .../gameserver/model/actor/L2Npc.java | 14 ++-- .../model/actor/templates/L2NpcTemplate.java | 11 ++- 17 files changed, 66 insertions(+), 127 deletions(-) delete mode 100644 L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/NonTalkingNpcs.java diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/NonTalkingNpcs.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/NonTalkingNpcs.java deleted file mode 100644 index 98ff2a2112..0000000000 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/ai/others/NonTalkingNpcs.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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.others; - -import com.l2jmobius.gameserver.model.actor.L2Npc; - -import ai.AbstractNpcAI; - -/** - * AI for handle Non-Talking NPCs. - * @author St3eT - */ -public final class NonTalkingNpcs extends AbstractNpcAI -{ - // @formatter:off - private static final int[] NONTALKINGNPCS = - { - 18684, 18685, 18686, // Red Star Stone - 18687, 18688, 18689, // Blue Star Stone - 18690, 18691, 18692, // Green Star Stone - 18848, 18849, 18926, // Jinia Guild - 18927, // Fire - 18933, // Fire Feed - 31202, 31203, 31204, 31205, 31206, 31207, 31208, 31209, 31266, 31593, 31758, 31955, // Town pets - 31557, // Mercenary Sentry - 31606, // Alice de Catrina - 31671, 31672, 31673, 31674, // Patrol - 32026, // Hestui Guard - 32030, // Garden Sculpture - 32031, // Ice Fairy Sculpture - 32032, // Strange Machine - 32306, // Native's Corpse - 32619, 32620, 32621, // NPCs without name - 32715, 32716, 32717, // Lilith's group - 32718, 32719, 32720, 32721, // Anakim's group - 18839, // Wild Maguen - 18915, // Divine Furnace - }; - // @formatter:on - - public NonTalkingNpcs() - { - addSpawnId(NONTALKINGNPCS); - } - - @Override - public String onSpawn(L2Npc npc) - { - npc.setTalking(false); - return super.onSpawn(npc); - } - - public static void main(String[] args) - { - new NonTalkingNpcs(); - } -} \ No newline at end of file diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/18600-18699.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/18600-18699.xml index 404abcda71..d928fffb33 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/18600-18699.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/18600-18699.xml @@ -4355,7 +4355,7 @@ - + @@ -4395,7 +4395,7 @@ - + @@ -4435,7 +4435,7 @@ - + @@ -4475,7 +4475,7 @@ - + @@ -4515,7 +4515,7 @@ - + @@ -4555,7 +4555,7 @@ - + @@ -4595,7 +4595,7 @@ - + @@ -4635,7 +4635,7 @@ - + @@ -4675,7 +4675,7 @@ - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/18800-18899.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/18800-18899.xml index 271b3c5f4b..43b29756f4 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/18800-18899.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/18800-18899.xml @@ -1699,7 +1699,7 @@ - + @@ -2044,7 +2044,7 @@ - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/18900-18999.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/18900-18999.xml index f777f8601f..3fc848ad4b 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/18900-18999.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/18900-18999.xml @@ -913,6 +913,7 @@ + @@ -1355,7 +1356,7 @@ - + @@ -1396,7 +1397,7 @@ - + @@ -1615,7 +1616,7 @@ - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/31200-31299.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/31200-31299.xml index 05feacecfd..666524cadf 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/31200-31299.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/31200-31299.xml @@ -108,7 +108,7 @@ 390 - + @@ -145,7 +145,7 @@ 390 - + @@ -182,7 +182,7 @@ 390 - + @@ -219,7 +219,7 @@ 270 - + @@ -256,7 +256,7 @@ 270 - + @@ -293,7 +293,7 @@ 270 - + @@ -330,7 +330,7 @@ 270 - + @@ -367,7 +367,7 @@ 390 - + @@ -2681,7 +2681,7 @@ 450 - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/31500-31599.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/31500-31599.xml index 87f7aeabd1..ba2d17c0ad 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/31500-31599.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/31500-31599.xml @@ -2392,7 +2392,7 @@ - + @@ -3865,7 +3865,7 @@ 720 - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/31600-31699.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/31600-31699.xml index 1244d6712d..cff81a47d5 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/31600-31699.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/31600-31699.xml @@ -264,7 +264,7 @@ 480 - + @@ -2915,7 +2915,7 @@ - + @@ -2957,7 +2957,7 @@ - + @@ -2999,7 +2999,7 @@ - + @@ -3041,7 +3041,7 @@ - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/31700-31799.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/31700-31799.xml index 1f409b909b..e8a2e53b9c 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/31700-31799.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/31700-31799.xml @@ -2219,7 +2219,7 @@ 270 - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/31900-31999.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/31900-31999.xml index 4ae8407edb..4b58be1f1a 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/31900-31999.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/31900-31999.xml @@ -2695,7 +2695,7 @@ 480 - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/32000-32099.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/32000-32099.xml index 4d5c4b4e9b..c734e2f160 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/32000-32099.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/32000-32099.xml @@ -1037,7 +1037,7 @@ - + @@ -1184,7 +1184,7 @@ - + @@ -1225,7 +1225,7 @@ - + @@ -1266,7 +1266,7 @@ - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/32300-32399.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/32300-32399.xml index ecbfa796fc..82f9f8d85c 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/32300-32399.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/32300-32399.xml @@ -252,7 +252,7 @@ 430 - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/32600-32699.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/32600-32699.xml index 0dd7e03d48..4067016f67 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/32600-32699.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/32600-32699.xml @@ -770,7 +770,7 @@ - + @@ -810,7 +810,7 @@ - + @@ -850,7 +850,7 @@ - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/32700-32799.xml b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/32700-32799.xml index 6859ba6288..602df9af68 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/32700-32799.xml +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/stats/npcs/32700-32799.xml @@ -552,7 +552,7 @@ 500 - + @@ -588,7 +588,7 @@ 500 - + @@ -625,7 +625,7 @@ 460 - + @@ -662,7 +662,7 @@ 560 - + @@ -698,7 +698,7 @@ 480 - + @@ -734,7 +734,7 @@ 630 - + @@ -771,7 +771,7 @@ 630 - + diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/xsd/npcs.xsd b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/xsd/npcs.xsd index 91cebcf98c..76b02ee70f 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/xsd/npcs.xsd +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/xsd/npcs.xsd @@ -275,6 +275,7 @@ + diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/NpcData.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/NpcData.java index 9bc44dd28f..f328080f8e 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/NpcData.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/NpcData.java @@ -327,6 +327,7 @@ public class NpcData implements IGameXmlReader set.set("unique", parseBoolean(attrs, "unique")); set.set("attackable", parseBoolean(attrs, "attackable")); set.set("targetable", parseBoolean(attrs, "targetable")); + set.set("talkable", parseBoolean(attrs, "talkable")); set.set("undying", parseBoolean(attrs, "undying")); set.set("showName", parseBoolean(attrs, "showName")); set.set("flying", parseBoolean(attrs, "flying")); diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Npc.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Npc.java index 1cbd744d11..0c96731d2e 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Npc.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/L2Npc.java @@ -106,7 +106,7 @@ import com.l2jmobius.gameserver.util.Broadcast; public class L2Npc extends L2Character { /** The interaction distance of the L2NpcInstance(is used as offset in MovetoLocation method) */ - public static final int INTERACTION_DISTANCE = 150; + public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; /** The L2Spawn object that manage this L2NpcInstance */ @@ -131,7 +131,7 @@ public class L2Npc extends L2Character private static final int MINIMUM_SOCIAL_INTERVAL = 6000; /** Support for random animation switching */ private boolean _isRandomAnimationEnabled = true; - private boolean _isTalking = true; + private boolean _isTalkable = getTemplate().isTalkable(); protected RandomAnimationTask _rAniTask = null; private int _currentLHandId; // normally this shouldn't change from the template, but there exist exceptions @@ -910,7 +910,7 @@ public class L2Npc extends L2Character */ public void showChatWindow(L2PcInstance player, int val) { - if (!isTalking()) + if (!isTalkable()) { player.sendPacket(ActionFailed.STATIC_PACKET); return; @@ -1848,18 +1848,18 @@ public class L2Npc extends L2Character * Sets if the players can talk with this npc or not * @param val {@code true} if the players can talk, {@code false} otherwise */ - public void setTalking(boolean val) + public void setIsTalkable(boolean val) { - _isTalking = val; + _isTalkable = val; } /** * Checks if the players can talk to this npc. * @return {@code true} if the players can talk, {@code false} otherwise. */ - public boolean isTalking() + public boolean isTalkable() { - return _isTalking; + return _isTalkable; } /** diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/templates/L2NpcTemplate.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/templates/L2NpcTemplate.java index 9c3f166ae0..f9f34163b0 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/templates/L2NpcTemplate.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/templates/L2NpcTemplate.java @@ -70,6 +70,7 @@ public final class L2NpcTemplate extends L2CharTemplate implements IIdentifiable private boolean _unique; private boolean _attackable; private boolean _targetable; + private boolean _talkable; private boolean _undying; private boolean _showName; private boolean _flying; @@ -95,8 +96,8 @@ public final class L2NpcTemplate extends L2CharTemplate implements IIdentifiable private Map> _aiSkillLists; private Set _clans; private Set _ignoreClanNpcIds; - private List _dropListDeath; - private List _dropListSpoil; + private CopyOnWriteArrayList _dropListDeath; + private CopyOnWriteArrayList _dropListSpoil; private double _collisionRadiusGrown; private double _collisionHeightGrown; @@ -138,6 +139,7 @@ public final class L2NpcTemplate extends L2CharTemplate implements IIdentifiable _unique = set.getBoolean("unique", false); _attackable = set.getBoolean("attackable", true); _targetable = set.getBoolean("targetable", true); + _talkable = set.getBoolean("talkable", true); _undying = set.getBoolean("undying", true); _showName = set.getBoolean("showName", true); _flying = set.getBoolean("flying", false); @@ -290,6 +292,11 @@ public final class L2NpcTemplate extends L2CharTemplate implements IIdentifiable return _targetable; } + public boolean isTalkable() + { + return _talkable; + } + public boolean isUndying() { return _undying;