Addition of isTalkable NPC template parameter.

This commit is contained in:
MobiusDev 2018-04-10 21:13:58 +00:00
parent 4ac95b0be1
commit 677d4b027a
17 changed files with 66 additions and 127 deletions

View File

@ -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 <http://www.gnu.org/licenses/>.
*/
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();
}
}

View File

@ -4355,7 +4355,7 @@
<run ground="1" />
</speed>
</stats>
<status attackable="false" flying="true" canMove="false" canBeSown="true" />
<status attackable="false" talkable="false" flying="true" canMove="false" canBeSown="true" />
<skillList>
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
<skill id="4409" level="1" /> <!--MP Increase (1x) -->
@ -4395,7 +4395,7 @@
<run ground="1" />
</speed>
</stats>
<status attackable="false" flying="true" canMove="false" canBeSown="true" />
<status attackable="false" talkable="false" flying="true" canMove="false" canBeSown="true" />
<skillList>
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
<skill id="4409" level="1" /> <!--MP Increase (1x) -->
@ -4435,7 +4435,7 @@
<run ground="1" />
</speed>
</stats>
<status attackable="false" flying="true" canMove="false" canBeSown="true" />
<status attackable="false" talkable="false" flying="true" canMove="false" canBeSown="true" />
<skillList>
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
<skill id="4409" level="1" /> <!--MP Increase (1x) -->
@ -4475,7 +4475,7 @@
<run ground="1" />
</speed>
</stats>
<status attackable="false" flying="true" canMove="false" canBeSown="true" />
<status attackable="false" talkable="false" flying="true" canMove="false" canBeSown="true" />
<skillList>
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
<skill id="4409" level="1" /> <!--MP Increase (1x) -->
@ -4515,7 +4515,7 @@
<run ground="1" />
</speed>
</stats>
<status attackable="false" flying="true" canMove="false" canBeSown="true" />
<status attackable="false" talkable="false" flying="true" canMove="false" canBeSown="true" />
<skillList>
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
<skill id="4409" level="1" /> <!--MP Increase (1x) -->
@ -4555,7 +4555,7 @@
<run ground="1" />
</speed>
</stats>
<status attackable="false" flying="true" canMove="false" canBeSown="true" />
<status attackable="false" talkable="false" flying="true" canMove="false" canBeSown="true" />
<skillList>
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
<skill id="4409" level="1" /> <!--MP Increase (1x) -->
@ -4595,7 +4595,7 @@
<run ground="1" />
</speed>
</stats>
<status attackable="false" flying="true" canMove="false" canBeSown="true" />
<status attackable="false" talkable="false" flying="true" canMove="false" canBeSown="true" />
<skillList>
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
<skill id="4409" level="1" /> <!--MP Increase (1x) -->
@ -4635,7 +4635,7 @@
<run ground="1" />
</speed>
</stats>
<status attackable="false" flying="true" canMove="false" canBeSown="true" />
<status attackable="false" talkable="false" flying="true" canMove="false" canBeSown="true" />
<skillList>
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
<skill id="4409" level="1" /> <!--MP Increase (1x) -->
@ -4675,7 +4675,7 @@
<run ground="1" />
</speed>
</stats>
<status attackable="false" flying="true" canMove="false" canBeSown="true" />
<status attackable="false" talkable="false" flying="true" canMove="false" canBeSown="true" />
<skillList>
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
<skill id="4409" level="1" /> <!--MP Increase (1x) -->

View File

@ -1699,7 +1699,7 @@
<run ground="120" />
</speed>
</stats>
<status attackable="false" canBeSown="true" />
<status attackable="false" talkable="false" canBeSown="true" />
<skillList>
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
<skill id="4409" level="1" /> <!--MP Increase (1x) -->
@ -2044,7 +2044,7 @@
<run ground="160" />
</speed>
</stats>
<status attackable="false" undying="false" canBeSown="true" />
<status attackable="false" talkable="false" undying="false" canBeSown="true" />
<skillList>
<skill id="4032" level="10" /> <!--NPC Strike -->
<skill id="4408" level="10" /> <!--HP Increase (2x) -->

View File

@ -913,6 +913,7 @@
<run ground="1" />
</speed>
</stats>
<status talkable="false" />
<skillList>
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
<skill id="4409" level="1" /> <!--MP Increase (1x) -->
@ -1355,7 +1356,7 @@
<run ground="160" />
</speed>
</stats>
<status attackable="false" undying="false" canBeSown="true" />
<status attackable="false" talkable="false" undying="false" canBeSown="true" />
<skillList>
<skill id="4032" level="9" /> <!--NPC Strike -->
<skill id="4408" level="10" /> <!--HP Increase (2x) -->
@ -1396,7 +1397,7 @@
<run ground="1" />
</speed>
</stats>
<status attackable="false" targetable="false" showName="false" canBeSown="true" />
<status attackable="false" talkable="false" targetable="false" showName="false" canBeSown="true" />
<skillList>
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
<skill id="4409" level="1" /> <!--MP Increase (1x) -->
@ -1615,7 +1616,7 @@
<run ground="1" />
</speed>
</stats>
<status attackable="false" showName="false" canBeSown="true" />
<status attackable="false" talkable="false" showName="false" canBeSown="true" />
<skillList>
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
<skill id="4409" level="1" /> <!--MP Increase (1x) -->

View File

@ -108,7 +108,7 @@
</speed>
<hitTime>390</hitTime>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
@ -145,7 +145,7 @@
</speed>
<hitTime>390</hitTime>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
@ -182,7 +182,7 @@
</speed>
<hitTime>390</hitTime>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
@ -219,7 +219,7 @@
</speed>
<hitTime>270</hitTime>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
@ -256,7 +256,7 @@
</speed>
<hitTime>270</hitTime>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
@ -293,7 +293,7 @@
</speed>
<hitTime>270</hitTime>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
@ -330,7 +330,7 @@
</speed>
<hitTime>270</hitTime>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
@ -367,7 +367,7 @@
</speed>
<hitTime>390</hitTime>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
@ -2681,7 +2681,7 @@
</speed>
<hitTime>450</hitTime>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->

View File

@ -2392,7 +2392,7 @@
<run ground="120" />
</speed>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
@ -3865,7 +3865,7 @@
</speed>
<hitTime>720</hitTime>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4390" level="1" /> <!--NPC Abnormal Immunity -->

View File

@ -264,7 +264,7 @@
</speed>
<hitTime>480</hitTime>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
@ -2915,7 +2915,7 @@
<run ground="120" />
</speed>
</stats>
<status attackable="false" undying="false" />
<status attackable="false" talkable="false" undying="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
@ -2957,7 +2957,7 @@
<run ground="120" />
</speed>
</stats>
<status attackable="false" undying="false" />
<status attackable="false" talkable="false" undying="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
@ -2999,7 +2999,7 @@
<run ground="120" />
</speed>
</stats>
<status attackable="false" undying="false" />
<status attackable="false" talkable="false" undying="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
@ -3041,7 +3041,7 @@
<run ground="120" />
</speed>
</stats>
<status attackable="false" undying="false" />
<status attackable="false" talkable="false" undying="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->

View File

@ -2219,7 +2219,7 @@
</speed>
<hitTime>270</hitTime>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->

View File

@ -2695,7 +2695,7 @@
</speed>
<hitTime>480</hitTime>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
<skill id="4409" level="1" /> <!--MP Increase (1x) -->

View File

@ -1037,7 +1037,7 @@
<run ground="120" />
</speed>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
@ -1184,7 +1184,7 @@
<run ground="120" />
</speed>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4390" level="1" /> <!--NPC Abnormal Immunity -->
@ -1225,7 +1225,7 @@
<run ground="120" />
</speed>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4390" level="1" /> <!--NPC Abnormal Immunity -->
@ -1266,7 +1266,7 @@
<run ground="120" />
</speed>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4390" level="1" /> <!--NPC Abnormal Immunity -->

View File

@ -252,7 +252,7 @@
</speed>
<hitTime>430</hitTime>
</stats>
<status attackable="false" canMove="false" />
<status attackable="false" talkable="false" canMove="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->

View File

@ -770,7 +770,7 @@
<run ground="160" />
</speed>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
@ -810,7 +810,7 @@
<run ground="160" />
</speed>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
@ -850,7 +850,7 @@
<run ground="160" />
</speed>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->

View File

@ -552,7 +552,7 @@
</speed>
<hitTime>500</hitTime>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
@ -588,7 +588,7 @@
</speed>
<hitTime>500</hitTime>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
@ -625,7 +625,7 @@
</speed>
<hitTime>460</hitTime>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4273" level="3" /> <!--Resist Daggers/Rapier Weapon -->
@ -662,7 +662,7 @@
</speed>
<hitTime>560</hitTime>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
@ -698,7 +698,7 @@
</speed>
<hitTime>480</hitTime>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->
@ -734,7 +734,7 @@
</speed>
<hitTime>630</hitTime>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4273" level="3" /> <!--Resist Daggers/Rapier Weapon -->
@ -771,7 +771,7 @@
</speed>
<hitTime>630</hitTime>
</stats>
<status attackable="false" />
<status attackable="false" talkable="false" />
<skillList>
<skill id="4045" level="1" /> <!--Resist Full Magic Attack -->
<skill id="4408" level="1" /> <!--HP Increase (1x) -->

View File

@ -275,6 +275,7 @@
<xs:complexType name="statusType">
<xs:attribute name="unique" type="xs:boolean" />
<xs:attribute name="attackable" type="xs:boolean" />
<xs:attribute name="talkable" type="xs:boolean" />
<xs:attribute name="targetable" type="xs:boolean" />
<xs:attribute name="undying" type="xs:boolean" />
<xs:attribute name="showName" type="xs:boolean" />

View File

@ -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"));

View File

@ -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;
}
/**

View File

@ -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<AISkillScope, List<Skill>> _aiSkillLists;
private Set<Integer> _clans;
private Set<Integer> _ignoreClanNpcIds;
private List<DropHolder> _dropListDeath;
private List<DropHolder> _dropListSpoil;
private CopyOnWriteArrayList<DropHolder> _dropListDeath;
private CopyOnWriteArrayList<DropHolder> _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;