浏览代码

- ConditionPlayerHpPercentage (hprate) not used, ConditionPlayerHp (hp) is used with same functionality
- castle and clanhall functions saving fix
- fixing non-attached default "cond" and "for" tags in enchanted skills

janiii 15 年之前
父节点
当前提交
9de9254807

+ 1 - 1
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2CastleChamberlainInstance.java

@@ -713,7 +713,7 @@ public class L2CastleChamberlainInstance extends L2MerchantInstance
 								{
 									int fee;
 									if (Config.DEBUG)
-										_log.warning("Mp editing invoked");
+										_log.warning("Hp editing invoked");
 									val = st.nextToken();
 									NpcHtmlMessage html = new NpcHtmlMessage(1);
 									html.setFile("data/html/chamberlain/functions-apply_confirmed.htm");

+ 13 - 33
L2_GameServer/java/com/l2jserver/gameserver/model/entity/Castle.java

@@ -194,19 +194,11 @@ public class Castle
 					if (ClanTable.getInstance().getClan(getOwnerId()).getWarehouse().getAdena() >= _fee || !_cwh)
 					{
 						int fee = _fee;
-						boolean newfc = true;
-						if (getEndTime() == 0 || getEndTime() == -1)
-						{
-							if (getEndTime() == -1)
-							{
-								newfc = false;
-								fee = _tempFee;
-							}
-						}
-						else
-							newfc = false;
+						if (getEndTime() == -1)
+							fee = _tempFee;
+						
 						setEndTime(System.currentTimeMillis() + getRate());
-						dbSave(newfc);
+						dbSave();
 						if (_cwh)
 						{
 							ClanTable.getInstance().getClan(getOwnerId()).getWarehouse().destroyItemByItemId("CS_function_fee", 57, fee, null, null);
@@ -225,7 +217,7 @@ public class Castle
 			}
 		}
 		
-		public void dbSave(boolean newFunction)
+		public void dbSave()
 		{
 			Connection con = null;
 			try
@@ -233,25 +225,13 @@ public class Castle
 				PreparedStatement statement;
 				
 				con = L2DatabaseFactory.getInstance().getConnection();
-				if (newFunction)
-				{
-					statement = con.prepareStatement("INSERT INTO castle_functions (castle_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)");
-					statement.setInt(1, getCastleId());
-					statement.setInt(2, getType());
-					statement.setInt(3, getLvl());
-					statement.setInt(4, getLease());
-					statement.setLong(5, getRate());
-					statement.setLong(6, getEndTime());
-				}
-				else
-				{
-					statement = con.prepareStatement("UPDATE castle_functions SET lvl=?, lease=?, endTime=? WHERE castle_id=? AND type=?");
-					statement.setInt(1, getLvl());
-					statement.setInt(2, getLease());
-					statement.setLong(3, getEndTime());
-					statement.setInt(4, getCastleId());
-					statement.setInt(5, getType());
-				}
+				statement = con.prepareStatement("REPLACE INTO castle_functions (castle_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)");
+				statement.setInt(1, getCastleId());
+				statement.setInt(2, getType());
+				statement.setInt(3, getLvl());
+				statement.setInt(4, getLease());
+				statement.setLong(5, getRate());
+				statement.setLong(6, getEndTime());
 				statement.execute();
 				statement.close();
 			}
@@ -850,7 +830,7 @@ public class Castle
 				{
 					_function.get(type).setLease(lease);
 					_function.get(type).setLvl(lvl);
-					_function.get(type).dbSave(false);
+					_function.get(type).dbSave();
 				}
 			}
 		}

+ 13 - 33
L2_GameServer/java/com/l2jserver/gameserver/model/entity/ClanHall.java

@@ -159,19 +159,11 @@ public class ClanHall
 					if (ClanTable.getInstance().getClan(getOwnerId()).getWarehouse().getAdena() >= _fee || !_cwh)
 					{
 						int fee = _fee;
-						boolean newfc = true;
-						if (getEndTime() == 0 || getEndTime() == -1)
-						{
-							if (getEndTime() == -1)
-							{
-								newfc = false;
-								fee = _tempFee;
-							}
-						}
-						else
-							newfc = false;
+						if (getEndTime() == -1)
+							fee = _tempFee;
+						
 						setEndTime(System.currentTimeMillis() + getRate());
-						dbSave(newfc);
+						dbSave();
 						if (_cwh)
 						{
 							ClanTable.getInstance().getClan(getOwnerId()).getWarehouse().destroyItemByItemId("CH_function_fee", 57, fee, null, null);
@@ -190,7 +182,7 @@ public class ClanHall
 			}
 		}
 		
-		public void dbSave(boolean newFunction)
+		public void dbSave()
 		{
 			Connection con = null;
 			try
@@ -198,25 +190,13 @@ public class ClanHall
 				PreparedStatement statement;
 				
 				con = L2DatabaseFactory.getInstance().getConnection();
-				if (newFunction)
-				{
-					statement = con.prepareStatement("INSERT INTO clanhall_functions (hall_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)");
-					statement.setInt(1, getId());
-					statement.setInt(2, getType());
-					statement.setInt(3, getLvl());
-					statement.setInt(4, getLease());
-					statement.setLong(5, getRate());
-					statement.setLong(6, getEndTime());
-				}
-				else
-				{
-					statement = con.prepareStatement("UPDATE clanhall_functions SET lvl=?, lease=?, endTime=? WHERE hall_id=? AND type=?");
-					statement.setInt(1, getLvl());
-					statement.setInt(2, getLease());
-					statement.setLong(3, getEndTime());
-					statement.setInt(4, getId());
-					statement.setInt(5, getType());
-				}
+				statement = con.prepareStatement("REPLACE INTO clanhall_functions (hall_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)");
+				statement.setInt(1, getId());
+				statement.setInt(2, getType());
+				statement.setInt(3, getLvl());
+				statement.setInt(4, getLease());
+				statement.setLong(5, getRate());
+				statement.setLong(6, getEndTime());
 				statement.execute();
 				statement.close();
 			}
@@ -561,7 +541,7 @@ public class ClanHall
 				{
 					_functions.get(type).setLease(lease);
 					_functions.get(type).setLvl(lvl);
-					_functions.get(type).dbSave(false);
+					_functions.get(type).dbSave();
 				}
 			}
 		}

+ 0 - 5
L2_GameServer/java/com/l2jserver/gameserver/skills/DocumentBase.java

@@ -481,11 +481,6 @@ abstract class DocumentBase
                 int hp = Integer.decode(getValue(a.getNodeValue(), null));
                 cond = joinAnd(cond, new ConditionPlayerHp(hp));
             }
-            else if ("hprate".equalsIgnoreCase(a.getNodeName()))
-            {
-                double rate = Double.parseDouble(getValue(a.getNodeValue(), null));
-                cond = joinAnd(cond, new ConditionPlayerHpPercentage(rate));
-            }
             else if ("mp".equalsIgnoreCase(a.getNodeName()))
             {
                 int hp = Integer.decode(getValue(a.getNodeValue(), null));

+ 57 - 57
L2_GameServer/java/com/l2jserver/gameserver/skills/DocumentSkill.java

@@ -413,7 +413,7 @@ class DocumentSkill extends DocumentBase {
 					}
                     _currentSkill.currentSkills.get(i).attach(condition, false);
 				}
-				if ("for".equalsIgnoreCase(n.getNodeName()))
+				else if ("for".equalsIgnoreCase(n.getNodeName()))
 				{
 					parseTemplate(n, _currentSkill.currentSkills.get(i));
 				}
@@ -422,31 +422,31 @@ class DocumentSkill extends DocumentBase {
         for (int i=lastLvl; i < lastLvl+enchantLevels1; i++)
         {
             _currentSkill.currentLevel = i-lastLvl;
-            boolean found = false;
+            boolean foundCond = false, foundFor = false;
             for (n=first; n != null; n = n.getNextSibling())
             {
                 if ("enchant1cond".equalsIgnoreCase(n.getNodeName()))
                 {
-                    found = true;
+                    foundCond = true;
                 	Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
                     Node msg = n.getAttributes().getNamedItem("msg");
                     if (condition != null && msg != null)
                         condition.setMessage(msg.getNodeValue());
                     _currentSkill.currentSkills.get(i).attach(condition,false);
                 }
-                if ("enchant1for".equalsIgnoreCase(n.getNodeName()))
+                else if ("enchant1for".equalsIgnoreCase(n.getNodeName()))
                 {
-                    found = true;
+                    foundFor = true;
                 	parseTemplate(n, _currentSkill.currentSkills.get(i));
                 }
             }
            	// If none found, the enchanted skill will take effects from maxLvL of norm skill
-        	if (!found)
+        	if (!foundCond || !foundFor)
         	{
         		_currentSkill.currentLevel = lastLvl-1;
         		for (n=first; n != null; n = n.getNextSibling())
         		{
-        			if ("cond".equalsIgnoreCase(n.getNodeName()))
+        			if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
         			{
         				Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
         				Node msg = n.getAttributes().getNamedItem("msg");
@@ -454,7 +454,7 @@ class DocumentSkill extends DocumentBase {
         					condition.setMessage(msg.getNodeValue());
         				_currentSkill.currentSkills.get(i).attach(condition,false);
         			}
-        			if ("for".equalsIgnoreCase(n.getNodeName()))
+        			else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
         			{
         				parseTemplate(n, _currentSkill.currentSkills.get(i));
         			}
@@ -463,32 +463,32 @@ class DocumentSkill extends DocumentBase {
         }
         for (int i=lastLvl+enchantLevels1; i < lastLvl+enchantLevels1+enchantLevels2; i++)
         {
-        	boolean found = false;
+        	boolean foundCond = false, foundFor = false;
         	_currentSkill.currentLevel = i-lastLvl-enchantLevels1;
             for (n=first; n != null; n = n.getNextSibling())
             {
                 if ("enchant2cond".equalsIgnoreCase(n.getNodeName()))
                 {
-                    found = true;
+                    foundCond = true;
                 	Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
                     Node msg = n.getAttributes().getNamedItem("msg");
                     if (condition != null && msg != null)
                         condition.setMessage(msg.getNodeValue());
                     _currentSkill.currentSkills.get(i).attach(condition,false);
                 }
-                if ("enchant2for".equalsIgnoreCase(n.getNodeName()))
+                else if ("enchant2for".equalsIgnoreCase(n.getNodeName()))
                 {
-                    found = true;
+                    foundFor = true;
                 	parseTemplate(n, _currentSkill.currentSkills.get(i));
                 }
             }
             // If none found, the enchanted skill will take effects from maxLvL of norm skill
-            if(!found)
+            if(!foundCond || !foundFor)
             {
             	_currentSkill.currentLevel = lastLvl-1;
             	for (n=first; n != null; n = n.getNextSibling())
             	{
-            		if ("cond".equalsIgnoreCase(n.getNodeName()))
+            		if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
             		{
             			Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
             			Node msg = n.getAttributes().getNamedItem("msg");
@@ -496,7 +496,7 @@ class DocumentSkill extends DocumentBase {
             				condition.setMessage(msg.getNodeValue());
             			_currentSkill.currentSkills.get(i).attach(condition,false);
             		}
-            		if ("for".equalsIgnoreCase(n.getNodeName()))
+            		else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
             		{
             			parseTemplate(n, _currentSkill.currentSkills.get(i));
             		}
@@ -505,32 +505,32 @@ class DocumentSkill extends DocumentBase {
         }
         for (int i=lastLvl+enchantLevels1+enchantLevels2; i < lastLvl+enchantLevels1+enchantLevels2+enchantLevels3; i++)
         {
-            boolean found = false;
+            boolean foundCond = false, foundFor = false;
             _currentSkill.currentLevel = i-lastLvl-enchantLevels1-enchantLevels2;
             for (n=first; n != null; n = n.getNextSibling())
             {
                 if ("enchant3cond".equalsIgnoreCase(n.getNodeName()))
                 {
-                    found = true;
+                    foundCond = true;
                     Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
                     Node msg = n.getAttributes().getNamedItem("msg");
                     if (condition != null && msg != null)
                         condition.setMessage(msg.getNodeValue());
                     _currentSkill.currentSkills.get(i).attach(condition,false);
                 }
-                if ("enchant3for".equalsIgnoreCase(n.getNodeName()))
+                else if ("enchant3for".equalsIgnoreCase(n.getNodeName()))
                 {
-                    found = true;
+                    foundFor = true;
                     parseTemplate(n, _currentSkill.currentSkills.get(i));
                 }
             }
             // If none found, the enchanted skill will take effects from maxLvL of norm skill
-            if(!found)
+            if(!foundCond || !foundFor)
             {
                 _currentSkill.currentLevel = lastLvl-1;
                 for (n=first; n != null; n = n.getNextSibling())
                 {
-                    if ("cond".equalsIgnoreCase(n.getNodeName()))
+                    if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
                     {
                         Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
                         Node msg = n.getAttributes().getNamedItem("msg");
@@ -538,7 +538,7 @@ class DocumentSkill extends DocumentBase {
                             condition.setMessage(msg.getNodeValue());
                         _currentSkill.currentSkills.get(i).attach(condition,false);
                     }
-                    if ("for".equalsIgnoreCase(n.getNodeName()))
+                    else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
                     {
                         parseTemplate(n, _currentSkill.currentSkills.get(i));
                     }
@@ -547,32 +547,32 @@ class DocumentSkill extends DocumentBase {
         }
         for (int i=lastLvl+enchantLevels1+enchantLevels2+enchantLevels3; i < lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4; i++)
         {
-            boolean found = false;
+            boolean foundCond = false, foundFor = false;
             _currentSkill.currentLevel = i-lastLvl-enchantLevels1-enchantLevels2-enchantLevels3;
             for (n=first; n != null; n = n.getNextSibling())
             {
                 if ("enchant4cond".equalsIgnoreCase(n.getNodeName()))
                 {
-                    found = true;
+                    foundCond = true;
                     Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
                     Node msg = n.getAttributes().getNamedItem("msg");
                     if (condition != null && msg != null)
                         condition.setMessage(msg.getNodeValue());
                     _currentSkill.currentSkills.get(i).attach(condition,false);
                 }
-                if ("enchant4for".equalsIgnoreCase(n.getNodeName()))
+                else if ("enchant4for".equalsIgnoreCase(n.getNodeName()))
                 {
-                    found = true;
+                    foundFor = true;
                     parseTemplate(n, _currentSkill.currentSkills.get(i));
                 }
             }
             // If none found, the enchanted skill will take effects from maxLvL of norm skill
-            if(!found)
+            if(!foundCond || !foundFor)
             {
                 _currentSkill.currentLevel = lastLvl-1;
                 for (n=first; n != null; n = n.getNextSibling())
                 {
-                    if ("cond".equalsIgnoreCase(n.getNodeName()))
+                    if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
                     {
                         Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
                         Node msg = n.getAttributes().getNamedItem("msg");
@@ -580,7 +580,7 @@ class DocumentSkill extends DocumentBase {
                             condition.setMessage(msg.getNodeValue());
                         _currentSkill.currentSkills.get(i).attach(condition,false);
                     }
-                    if ("for".equalsIgnoreCase(n.getNodeName()))
+                    else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
                     {
                         parseTemplate(n, _currentSkill.currentSkills.get(i));
                     }
@@ -589,32 +589,32 @@ class DocumentSkill extends DocumentBase {
         }
         for (int i=lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4; i < lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4+enchantLevels5; i++)
         {
-            boolean found = false;
+            boolean foundCond = false, foundFor = false;
             _currentSkill.currentLevel = i-lastLvl-enchantLevels1-enchantLevels2-enchantLevels3-enchantLevels4;
             for (n=first; n != null; n = n.getNextSibling())
             {
                 if ("enchant5cond".equalsIgnoreCase(n.getNodeName()))
                 {
-                    found = true;
+                    foundCond = true;
                     Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
                     Node msg = n.getAttributes().getNamedItem("msg");
                     if (condition != null && msg != null)
                         condition.setMessage(msg.getNodeValue());
                     _currentSkill.currentSkills.get(i).attach(condition,false);
                 }
-                if ("enchant5for".equalsIgnoreCase(n.getNodeName()))
+                else if ("enchant5for".equalsIgnoreCase(n.getNodeName()))
                 {
-                    found = true;
+                    foundFor = true;
                     parseTemplate(n, _currentSkill.currentSkills.get(i));
                 }
             }
             // If none found, the enchanted skill will take effects from maxLvL of norm skill
-            if(!found)
+            if(!foundCond || !foundFor)
             {
                 _currentSkill.currentLevel = lastLvl-1;
                 for (n=first; n != null; n = n.getNextSibling())
                 {
-                    if ("cond".equalsIgnoreCase(n.getNodeName()))
+                    if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
                     {
                         Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
                         Node msg = n.getAttributes().getNamedItem("msg");
@@ -622,7 +622,7 @@ class DocumentSkill extends DocumentBase {
                             condition.setMessage(msg.getNodeValue());
                         _currentSkill.currentSkills.get(i).attach(condition,false);
                     }
-                    if ("for".equalsIgnoreCase(n.getNodeName()))
+                    else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
                     {
                         parseTemplate(n, _currentSkill.currentSkills.get(i));
                     }
@@ -631,32 +631,32 @@ class DocumentSkill extends DocumentBase {
         }
         for (int i=lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4+enchantLevels5; i < lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4+enchantLevels5+enchantLevels6; i++)
         {
-            boolean found = false;
+            boolean foundCond = false, foundFor = false;
             _currentSkill.currentLevel = i-lastLvl-enchantLevels1-enchantLevels2-enchantLevels3-enchantLevels4-enchantLevels5;
             for (n=first; n != null; n = n.getNextSibling())
             {
                 if ("enchant6cond".equalsIgnoreCase(n.getNodeName()))
                 {
-                    found = true;
+                    foundCond = true;
                     Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
                     Node msg = n.getAttributes().getNamedItem("msg");
                     if (condition != null && msg != null)
                         condition.setMessage(msg.getNodeValue());
                     _currentSkill.currentSkills.get(i).attach(condition,false);
                 }
-                if ("enchant6for".equalsIgnoreCase(n.getNodeName()))
+                else if ("enchant6for".equalsIgnoreCase(n.getNodeName()))
                 {
-                    found = true;
+                    foundFor = true;
                     parseTemplate(n, _currentSkill.currentSkills.get(i));
                 }
             }
             // If none found, the enchanted skill will take effects from maxLvL of norm skill
-            if(!found)
+            if(!foundCond || !foundFor)
             {
                 _currentSkill.currentLevel = lastLvl-1;
                 for (n=first; n != null; n = n.getNextSibling())
                 {
-                    if ("cond".equalsIgnoreCase(n.getNodeName()))
+                    if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
                     {
                         Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
                         Node msg = n.getAttributes().getNamedItem("msg");
@@ -664,7 +664,7 @@ class DocumentSkill extends DocumentBase {
                             condition.setMessage(msg.getNodeValue());
                         _currentSkill.currentSkills.get(i).attach(condition,false);
                     }
-                    if ("for".equalsIgnoreCase(n.getNodeName()))
+                    else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
                     {
                         parseTemplate(n, _currentSkill.currentSkills.get(i));
                     }
@@ -673,32 +673,32 @@ class DocumentSkill extends DocumentBase {
         }
         for (int i=lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4+enchantLevels5+enchantLevels6; i < lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4+enchantLevels5+enchantLevels6+enchantLevels7; i++)
         {
-            boolean found = false;
+            boolean foundCond = false, foundFor = false;
             _currentSkill.currentLevel = i-lastLvl-enchantLevels1-enchantLevels2-enchantLevels3-enchantLevels4-enchantLevels5-enchantLevels6;
             for (n=first; n != null; n = n.getNextSibling())
             {
                 if ("enchant7cond".equalsIgnoreCase(n.getNodeName()))
                 {
-                    found = true;
+                    foundCond = true;
                     Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
                     Node msg = n.getAttributes().getNamedItem("msg");
                     if (condition != null && msg != null)
                         condition.setMessage(msg.getNodeValue());
                     _currentSkill.currentSkills.get(i).attach(condition,false);
                 }
-                if ("enchant7for".equalsIgnoreCase(n.getNodeName()))
+                else if ("enchant7for".equalsIgnoreCase(n.getNodeName()))
                 {
-                    found = true;
+                    foundFor = true;
                     parseTemplate(n, _currentSkill.currentSkills.get(i));
                 }
             }
             // If none found, the enchanted skill will take effects from maxLvL of norm skill
-            if(!found)
+            if(!foundCond || !foundFor)
             {
                 _currentSkill.currentLevel = lastLvl-1;
                 for (n=first; n != null; n = n.getNextSibling())
                 {
-                    if ("cond".equalsIgnoreCase(n.getNodeName()))
+                    if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
                     {
                         Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
                         Node msg = n.getAttributes().getNamedItem("msg");
@@ -706,7 +706,7 @@ class DocumentSkill extends DocumentBase {
                             condition.setMessage(msg.getNodeValue());
                         _currentSkill.currentSkills.get(i).attach(condition,false);
                     }
-                    if ("for".equalsIgnoreCase(n.getNodeName()))
+                    else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
                     {
                         parseTemplate(n, _currentSkill.currentSkills.get(i));
                     }
@@ -715,32 +715,32 @@ class DocumentSkill extends DocumentBase {
         }
         for (int i=lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4+enchantLevels5+enchantLevels6+enchantLevels7; i < lastLvl+enchantLevels1+enchantLevels2+enchantLevels3+enchantLevels4+enchantLevels5+enchantLevels6+enchantLevels7+enchantLevels8; i++)
         {
-            boolean found = false;
+            boolean foundCond = false, foundFor = false;
             _currentSkill.currentLevel = i-lastLvl-enchantLevels1-enchantLevels2-enchantLevels3-enchantLevels4-enchantLevels5-enchantLevels6-enchantLevels7;
             for (n=first; n != null; n = n.getNextSibling())
             {
                 if ("enchant8cond".equalsIgnoreCase(n.getNodeName()))
                 {
-                    found = true;
+                    foundCond = true;
                     Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
                     Node msg = n.getAttributes().getNamedItem("msg");
                     if (condition != null && msg != null)
                         condition.setMessage(msg.getNodeValue());
                     _currentSkill.currentSkills.get(i).attach(condition,false);
                 }
-                if ("enchant8for".equalsIgnoreCase(n.getNodeName()))
+                else if ("enchant8for".equalsIgnoreCase(n.getNodeName()))
                 {
-                    found = true;
+                    foundFor = true;
                     parseTemplate(n, _currentSkill.currentSkills.get(i));
                 }
             }
             // If none found, the enchanted skill will take effects from maxLvL of norm skill
-            if(!found)
+            if(!foundCond || !foundFor)
             {
                 _currentSkill.currentLevel = lastLvl-1;
                 for (n=first; n != null; n = n.getNextSibling())
                 {
-                    if ("cond".equalsIgnoreCase(n.getNodeName()))
+                    if (!foundCond && "cond".equalsIgnoreCase(n.getNodeName()))
                     {
                         Condition condition = parseCondition(n.getFirstChild(), _currentSkill.currentSkills.get(i));
                         Node msg = n.getAttributes().getNamedItem("msg");
@@ -748,7 +748,7 @@ class DocumentSkill extends DocumentBase {
                             condition.setMessage(msg.getNodeValue());
                         _currentSkill.currentSkills.get(i).attach(condition,false);
                     }
-                    if ("for".equalsIgnoreCase(n.getNodeName()))
+                    else if (!foundFor && "for".equalsIgnoreCase(n.getNodeName()))
                     {
                         parseTemplate(n, _currentSkill.currentSkills.get(i));
                     }

+ 0 - 31
L2_GameServer/java/com/l2jserver/gameserver/skills/conditions/ConditionPlayerHpPercentage.java

@@ -1,31 +0,0 @@
-/*
- * 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 com.l2jserver.gameserver.skills.conditions;
-
-import com.l2jserver.gameserver.skills.Env;
-
-public class ConditionPlayerHpPercentage extends Condition
-{
-    private double _p;
-
-    public ConditionPlayerHpPercentage(double p)
-    {
-        _p = p;
-    }
-
-    @Override
-	public boolean testImpl(Env env) {
-        return env.player.getCurrentHp() <= env.player.getMaxHp()*_p;    }
-}