浏览代码

BETA: Core part for ​[DP10315].
* Reviewed by: Zoey76, Adry_85, !UnAfraid, Nos

St3eT 11 年之前
父节点
当前提交
71667a6aa0

+ 1 - 5
L2J_Server_BETA/dist/game/config/NPC.properties

@@ -206,8 +206,4 @@ DropItemMaxLevelDifference=10
 # to allow dropping the item if level difference is bigger than DropAdenaMaxLevelDifference
 # Note: This value is scalling from 100 to the specified value for DropAdenaMinLevelDifference to DropAdenaMaxLevelDifference limits
 # Default: 10
-DropItemMinLevelGapChance=10
-
-# A comma separated list of all NPCs who have no dialog, i.e. double-clicking on them doesn't open a chat window
-# Default: 18684,18685,18686,18687,18688,18689,18690,19691,18692,31202,31203,31204,31205,31206,31207,31208,31209,31266,31557,31593,31606,31671,31672,31673,31674,31758,31955,32026,32030,32031,32032,32306,32619,32620,32621
-NonTalkingNpcs = 18684,18685,18686,18687,18688,18689,18690,19691,18692,18848,18849,18926,18927,18933,31202,31203,31204,31205,31206,31207,31208,31209,31266,31557,31593,31606,31671,31672,31673,31674,31758,31955,32026,32030,32031,32032,32306,32619,32620,32621,32715,32716,32717,32718,32719,32720,32721,18839
+DropItemMinLevelGapChance=10

+ 0 - 18
L2J_Server_BETA/java/com/l2jserver/Config.java

@@ -831,7 +831,6 @@ public final class Config
 	public static int DROP_ITEM_MIN_LEVEL_DIFFERENCE;
 	public static int DROP_ITEM_MAX_LEVEL_DIFFERENCE;
 	public static double DROP_ITEM_MIN_LEVEL_GAP_CHANCE;
-	public static List<Integer> NON_TALKING_NPCS;
 	
 	// --------------------------------------------------
 	// PvP Settings
@@ -2096,23 +2095,6 @@ public final class Config
 			DROP_ITEM_MAX_LEVEL_DIFFERENCE = NPC.getInt("DropItemMaxLevelDifference", 10);
 			DROP_ITEM_MIN_LEVEL_GAP_CHANCE = NPC.getDouble("DropItemMinLevelGapChance", 10);
 			
-			split = NPC.getString("NonTalkingNpcs", "18684,18685,18686,18687,18688,18689,18690,19691,18692,31202,31203,31204,31205,31206,31207,31208,31209,31266,31557,31593,31606,31671,31672,31673,31674,31758,31955,32026,32030,32031,32032,32306,32619,32620,32621").split(",");
-			NON_TALKING_NPCS = new ArrayList<>(split.length);
-			for (String npcId : split)
-			{
-				try
-				{
-					NON_TALKING_NPCS.add(Integer.parseInt(npcId));
-				}
-				catch (NumberFormatException nfe)
-				{
-					if (!npcId.isEmpty())
-					{
-						_log.warning("Could not parse " + npcId + " id for NonTalkingNpcs. Please check that all values are digits and coma separated.");
-					}
-				}
-			}
-			
 			// Load Rates L2Properties file (if exists)
 			final PropertiesParser RatesSettings = new PropertiesParser(RATES_CONFIG_FILE);
 			

+ 20 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Npc.java

@@ -125,6 +125,7 @@ public class L2Npc extends L2Character
 	private final int _minimalSocialInterval = 6000;
 	/** Support for random animation switching */
 	private boolean _isRandomAnimationEnabled = true;
+	private boolean _isTalking = true;
 	
 	protected RandomAnimationTask _rAniTask = null;
 	private int _currentLHandId; // normally this shouldn't change from the template, but there exist exceptions
@@ -1073,7 +1074,7 @@ public class L2Npc extends L2Character
 	 */
 	public void showChatWindow(L2PcInstance player, int val)
 	{
-		if (Config.NON_TALKING_NPCS.contains(getId()))
+		if (!isTalking())
 		{
 			player.sendPacket(ActionFailed.STATIC_PACKET);
 			return;
@@ -1985,4 +1986,22 @@ public class L2Npc extends L2Character
 		}
 		return super.isVisibleFor(player);
 	}
+	
+	/**
+	 * 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)
+	{
+		_isTalking = val;
+	}
+	
+	/**
+	 * Checks if the players can talk to this npc.
+	 * @return {@code true} if the players can talk, {@code false} otherwise.
+	 */
+	public boolean isTalking()
+	{
+		return _isTalking;
+	}
 }