Quellcode durchsuchen

BETA: Removing custom big sword and big blunt weapon types.
* Adding new condition to manage two-handed sword and blunt.
* Patch by Nos
Reviewed by: Nos

Adry_85 vor 11 Jahren
Ursprung
Commit
aab892b963

+ 22 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/engines/DocumentBase.java

@@ -123,6 +123,7 @@ import com.l2jserver.gameserver.model.conditions.ConditionTargetUsesWeaponKind;
 import com.l2jserver.gameserver.model.conditions.ConditionTargetWeight;
 import com.l2jserver.gameserver.model.conditions.ConditionUsingItemType;
 import com.l2jserver.gameserver.model.conditions.ConditionUsingSkill;
+import com.l2jserver.gameserver.model.conditions.ConditionUsingSlotType;
 import com.l2jserver.gameserver.model.conditions.ConditionWithSkill;
 import com.l2jserver.gameserver.model.effects.AbstractEffect;
 import com.l2jserver.gameserver.model.interfaces.IIdentifiable;
@@ -1195,6 +1196,27 @@ public abstract class DocumentBase
 					cond = joinAnd(cond, new ConditionUsingItemType(mask));
 					break;
 				}
+				case "slot":
+				{
+					int mask = 0;
+					StringTokenizer st = new StringTokenizer(a.getNodeValue(), ",");
+					while (st.hasMoreTokens())
+					{
+						int old = mask;
+						String item = st.nextToken().trim();
+						if (ItemTable._slots.containsKey(item))
+						{
+							mask |= ItemTable._slots.get(item);
+						}
+						
+						if (old == mask)
+						{
+							_log.info("[parseUsingCondition=\"slot\"] Unknown item slot name: " + item);
+						}
+					}
+					cond = joinAnd(cond, new ConditionUsingSlotType(mask));
+					break;
+				}
 				case "skill":
 				{
 					int id = Integer.parseInt(a.getNodeValue());

+ 46 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionUsingSlotType.java

@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2004-2014 L2J Server
+ * 
+ * This file is part of L2J Server.
+ * 
+ * L2J Server 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.
+ * 
+ * L2J Server 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.model.conditions;
+
+import com.l2jserver.gameserver.model.stats.Env;
+
+/**
+ * @author Nos
+ */
+public class ConditionUsingSlotType extends Condition
+{
+	private final int _mask;
+	
+	public ConditionUsingSlotType(int mask)
+	{
+		_mask = mask;
+	}
+	
+	@Override
+	public boolean testImpl(Env env)
+	{
+		if ((env.getCharacter() == null) || !env.getCharacter().isPlayer())
+		{
+			return false;
+		}
+		
+		return (env.getPlayer().getActiveWeaponItem().getBodyPart() & _mask) != 0;
+	}
+	
+}

+ 1 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/model/items/type/WeaponType.java

@@ -45,11 +45,7 @@ public enum WeaponType implements ItemType
 	CROSSBOW("Crossbow", TraitType.CROSSBOW),
 	FLAG("Flag", TraitType.NONE),
 	OWNTHING("Ownthing", TraitType.NONE),
-	DUALDAGGER("Dual Dagger", TraitType.DUALDAGGER),
-	
-	// L2J CUSTOM, BACKWARD COMPATIBILITY
-	BIGBLUNT("Big Blunt", TraitType.BLUNT),
-	BIGSWORD("Big Sword", TraitType.SWORD);
+	DUALDAGGER("Dual Dagger", TraitType.DUALDAGGER);
 	
 	private static final Logger _log = Logger.getLogger(WeaponType.class.getName());
 	private final int _mask;

+ 40 - 48
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/funcs/FuncEnchant.java

@@ -20,6 +20,7 @@ package com.l2jserver.gameserver.model.skills.funcs;
 
 import com.l2jserver.Config;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.items.L2Item;
 import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
 import com.l2jserver.gameserver.model.items.type.WeaponType;
 import com.l2jserver.gameserver.model.stats.Env;
@@ -111,82 +112,73 @@ public class FuncEnchant extends Func
 			switch (item.getItem().getItemGradeSPlus())
 			{
 				case S:
-					switch (type)
+					if (item.getWeaponItem().getBodyPart() == L2Item.SLOT_LR_HAND)
 					{
-						case BOW:
-						case CROSSBOW:
+						if ((type == WeaponType.BOW) || (type == WeaponType.CROSSBOW))
+						{
 							// P. Atk. increases by 10 for bows.
 							// Starting at +4, P. Atk. bonus double.
 							env.addValue((10 * enchant) + (20 * overenchant));
-							break;
-						case BIGSWORD:
-						case BIGBLUNT:
-						case DUAL:
-						case DUALFIST:
-						case ANCIENTSWORD:
-						case DUALDAGGER:
+						}
+						else
+						{
 							// P. Atk. increases by 6 for two-handed swords, two-handed blunts, dualswords, and two-handed combat weapons.
 							// Starting at +4, P. Atk. bonus double.
 							env.addValue((6 * enchant) + (12 * overenchant));
-							break;
-						default:
-							// P. Atk. increases by 5 for one-handed swords, one-handed blunts, daggers, spears, and other weapons.
-							// Starting at +4, P. Atk. bonus double.
-							env.addValue((5 * enchant) + (10 * overenchant));
-							break;
+						}
+					}
+					else
+					{
+						// P. Atk. increases by 5 for one-handed swords, one-handed blunts, daggers, spears, and other weapons.
+						// Starting at +4, P. Atk. bonus double.
+						env.addValue((5 * enchant) + (10 * overenchant));
 					}
 					break;
 				case A:
-					switch (type)
+					if (item.getWeaponItem().getBodyPart() == L2Item.SLOT_LR_HAND)
 					{
-						case BOW:
-						case CROSSBOW:
+						if ((type == WeaponType.BOW) || (type == WeaponType.CROSSBOW))
+						{
 							// P. Atk. increases by 8 for bows.
 							// Starting at +4, P. Atk. bonus double.
 							env.addValue((8 * enchant) + (16 * overenchant));
-							break;
-						case BIGSWORD:
-						case BIGBLUNT:
-						case DUAL:
-						case DUALFIST:
-						case ANCIENTSWORD:
-						case DUALDAGGER:
+						}
+						else
+						{
 							// P. Atk. increases by 5 for two-handed swords, two-handed blunts, dualswords, and two-handed combat weapons.
 							// Starting at +4, P. Atk. bonus double.
 							env.addValue((5 * enchant) + (10 * overenchant));
-							break;
-						default:
-							// P. Atk. increases by 4 for one-handed swords, one-handed blunts, daggers, spears, and other weapons.
-							// Starting at +4, P. Atk. bonus double.
-							env.addValue((4 * enchant) + (8 * overenchant));
-							break;
+						}
+					}
+					else
+					{
+						// P. Atk. increases by 4 for one-handed swords, one-handed blunts, daggers, spears, and other weapons.
+						// Starting at +4, P. Atk. bonus double.
+						env.addValue((4 * enchant) + (8 * overenchant));
 					}
 					break;
 				case B:
 				case C:
-					switch (type)
+					if (item.getWeaponItem().getBodyPart() == L2Item.SLOT_LR_HAND)
 					{
-						case BOW:
-						case CROSSBOW:
+						if ((type == WeaponType.BOW) || (type == WeaponType.CROSSBOW))
+						{
 							// P. Atk. increases by 6 for bows.
 							// Starting at +4, P. Atk. bonus double.
 							env.addValue((6 * enchant) + (12 * overenchant));
-							break;
-						case BIGSWORD:
-						case BIGBLUNT:
-						case DUAL:
-						case DUALFIST:
-						case ANCIENTSWORD:
-						case DUALDAGGER:
+						}
+						else
+						{
 							// P. Atk. increases by 4 for two-handed swords, two-handed blunts, dualswords, and two-handed combat weapons.
 							// Starting at +4, P. Atk. bonus double.
 							env.addValue((4 * enchant) + (8 * overenchant));
-							break;
-						default:
-							// P. Atk. increases by 3 for one-handed swords, one-handed blunts, daggers, spears, and other weapons.
-							// Starting at +4, P. Atk. bonus double.
-							env.addValue((3 * enchant) + (6 * overenchant));
-							break;
+						}
+					}
+					else
+					{
+						// P. Atk. increases by 3 for one-handed swords, one-handed blunts, daggers, spears, and other weapons.
+						// Starting at +4, P. Atk. bonus double.
+						env.addValue((3 * enchant) + (6 * overenchant));
 					}
 					break;
 				case D: