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

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