Jelajahi Sumber

BETA: Fixed minor issue causing `HtmlCache` to not use datapack root config.
* Also minor cleanup of `L2Npc`.

Rumen Nikiforov 11 tahun lalu
induk
melakukan
8b8a7fc511

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/cache/HtmCache.java

@@ -201,7 +201,7 @@ public class HtmCache
 	 */
 	public boolean isLoadable(String path)
 	{
-		return htmlFilter.accept(new File(path));
+		return htmlFilter.accept(new File(Config.DATAPACK_ROOT, path));
 	}
 	
 	public static HtmCache getInstance()

+ 6 - 24
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Npc.java

@@ -196,20 +196,12 @@ public class L2Npc extends L2Character
 	
 	public boolean hasLSkill()
 	{
-		if (getTemplate().getLongRangeSkillId() == 0)
-		{
-			return false;
-		}
-		return true;
+		return getTemplate().getLongRangeSkillId() > 0;
 	}
 	
 	public boolean hasSSkill()
 	{
-		if (getTemplate().getShortRangeSkillId() == 0)
-		{
-			return false;
-		}
-		return true;
+		return getTemplate().getShortRangeSkillId() > 0;
 	}
 	
 	public List<L2Skill> getLongRangeSkill()
@@ -224,7 +216,7 @@ public class L2Npc extends L2Character
 		{
 			case -1:
 			{
-				Collection<L2Skill> skills = getAllSkills();
+				final Collection<L2Skill> skills = getAllSkills();
 				if (skills != null)
 				{
 					for (L2Skill sk : skills)
@@ -329,10 +321,6 @@ public class L2Npc extends L2Character
 		{
 			try
 			{
-				if (this != _rAniTask)
-				{
-					return; // Shouldn't happen, but who knows... just to make sure every active npc has only one timer.
-				}
 				if (isMob())
 				{
 					// Cancel further animation timers until intention is changed to ACTIVE again.
@@ -1002,9 +990,7 @@ public class L2Npc extends L2Character
 	{
 		// Send a Server->Client packet NpcHtmlMessage to the L2PcInstance in order to display the message of the L2NpcInstance
 		content = content.replaceAll("%objectId%", String.valueOf(getObjectId()));
-		final NpcHtmlMessage npcReply = new NpcHtmlMessage(getObjectId());
-		npcReply.setHtml(content);
-		player.sendPacket(npcReply);
+		player.sendPacket(new NpcHtmlMessage(getObjectId(), content));
 	}
 	
 	/**
@@ -1066,17 +1052,13 @@ public class L2Npc extends L2Character
 	 */
 	private boolean showPkDenyChatWindow(L2PcInstance player, String type)
 	{
-		String html = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), "data/html/" + type + "/" + getId() + "-pk.htm");
-		
+		final String html = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), "data/html/" + type + "/" + getId() + "-pk.htm");
 		if (html != null)
 		{
-			final NpcHtmlMessage pkDenyMsg = new NpcHtmlMessage(getObjectId());
-			pkDenyMsg.setHtml(html);
-			player.sendPacket(pkDenyMsg);
+			insertObjectIdAndShowChatWindow(player, html);
 			player.sendPacket(ActionFailed.STATIC_PACKET);
 			return true;
 		}
-		
 		return false;
 	}