Browse Source

addName attribute of msgId for using in conditions:
<cond msgId="113" addName="1"> will generate system message
"%Name% cannot be used due to unsuitable terms"

_DS_ 16 năm trước cách đây
mục cha
commit
9dc54c4543

+ 2 - 1
L2_GameServer/java/net/sf/l2j/gameserver/model/L2Skill.java

@@ -1213,7 +1213,8 @@ public abstract class L2Skill implements IChanceSkillTrigger
             if (msgId != 0)
             {
             	SystemMessage sm = new SystemMessage(msgId);
-            	sm.addSkillName(_id);
+            	if (preCondition.isAddName())
+            		sm.addSkillName(_id);
             	activeChar.sendPacket(sm);
             }
             else if (msg != null)

+ 5 - 0
L2_GameServer/java/net/sf/l2j/gameserver/skills/DocumentBase.java

@@ -131,7 +131,12 @@ abstract class DocumentBase
 			if (condition != null && msg != null)
 				condition.setMessage(msg.getNodeValue());
 			else if (condition != null && msgId != null)
+			{
 				condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
+				Node addName = n.getAttributes().getNamedItem("addName");
+				if (addName != null && Integer.decode(getValue(msgId.getNodeValue(), null)) > 0)
+					condition.addName();
+			}
             n = n.getNextSibling();
         }
         for (; n != null; n = n.getNextSibling())

+ 5 - 0
L2_GameServer/java/net/sf/l2j/gameserver/skills/DocumentItem.java

@@ -154,7 +154,12 @@ final class DocumentItem extends DocumentBase
 				if (condition != null && msg != null)
 					condition.setMessage(msg.getNodeValue());
 				else if (condition != null && msgId != null)
+				{
 					condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
+					Node addName = n.getAttributes().getNamedItem("addName");
+					if (addName != null && Integer.decode(getValue(msgId.getNodeValue(), null)) > 0)
+						condition.addName();
+				}
 				_currentItem.item.attach(condition);
 			}
         }

+ 5 - 0
L2_GameServer/java/net/sf/l2j/gameserver/skills/DocumentSkill.java

@@ -320,7 +320,12 @@ class DocumentSkill extends DocumentBase {
 					if (condition != null && msg != null)
 						condition.setMessage(msg.getNodeValue());
 					else if (condition != null && msgId != null)
+					{
 						condition.setMessageId(Integer.decode(getValue(msgId.getNodeValue(), null)));
+						Node addName = n.getAttributes().getNamedItem("addName");
+						if (addName != null && Integer.decode(getValue(msgId.getNodeValue(), null)) > 0)
+							condition.addName();
+					}
                     _currentSkill.currentSkills.get(i).attach(condition, false);
 				}
 				if ("for".equalsIgnoreCase(n.getNodeName()))

+ 21 - 10
L2_GameServer/java/net/sf/l2j/gameserver/skills/conditions/Condition.java

@@ -26,43 +26,54 @@ public abstract class Condition implements ConditionListener
 {
 	
 	//private static final Logger _log = Logger.getLogger(Condition.class.getName());
-	
+
 	private ConditionListener _listener;
 	private String _msg;
 	private int _msgId;
+	private boolean _addName = false;
 	private boolean _result;
-	
+
 	public final void setMessage(String msg)
 	{
 		_msg = msg;
 	}
-	
+
 	public final String getMessage()
 	{
 		return _msg;
 	}
-	
+
 	public final void setMessageId(int msgId)
 	{
 		_msgId = msgId;
 	}
-	
+
 	public final int getMessageId()
 	{
 		return _msgId;
 	}
-	
+
+	public final void addName()
+	{
+		_addName = true;
+	}
+
+	public final boolean isAddName()
+	{
+		return _addName;
+	}
+
 	void setListener(ConditionListener listener)
 	{
 		_listener = listener;
 		notifyChanged();
 	}
-	
+
 	final ConditionListener getListener()
 	{
 		return _listener;
 	}
-	
+
 	public final boolean test(Env env)
 	{
 		boolean res = testImpl(env);
@@ -73,9 +84,9 @@ public abstract class Condition implements ConditionListener
 		}
 		return res;
 	}
-	
+
 	abstract boolean testImpl(Env env);
-	
+
 	public void notifyChanged()
 	{
 		if (_listener != null)

+ 4 - 1
L2_GameServer/java/net/sf/l2j/gameserver/templates/item/L2Item.java

@@ -691,7 +691,10 @@ public abstract class L2Item
 	            }
 	            else if (msgId !=0)
 	            {
-	            	activeChar.sendPacket(new SystemMessage(msgId));
+	            	SystemMessage sm = new SystemMessage(msgId);
+	            	if (preCondition.isAddName())
+	            		sm.addItemName(_itemId);
+	            	activeChar.sendPacket(sm);
 	            }
 	            return false;
 	        }