Parcourir la source

BETA: Fixing a issue that was causing Pets unable to use his equipment.

Reported by: leandro007
MELERIX il y a 12 ans
Parent
commit
45972a3e24

+ 28 - 38
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/PetDataTable.java

@@ -188,83 +188,73 @@ public final class PetDataTable extends DocumentParser
 	}
 	
 	/**
-	 * Checks if is wolf.
-	 * @param npcId the NPC Id to verify.
-	 * @return {@code true} if the given Id is from a wolf, {@code false} otherwise.
-	 */
-	public static boolean isWolf(int npcId)
-	{
-		return npcId == 12077;
-	}
-	
-	/**
-	 * Checks if is evolved wolf.
+	 * Checks if is strider.
 	 * @param npcId the NPC Id to verify.
-	 * @return {@code true} if the given Id is from an evolved wolf, {@code false} otherwise.
+	 * @return {@code true} if the given Id is from a strider, {@code false} otherwise.
 	 */
-	public static boolean isEvolvedWolf(int npcId)
+	public static boolean isStrider(int npcId)
 	{
-		return (npcId == 16030) || (npcId == 16037) || (npcId == 16025) || (npcId == 16041) || (npcId == 16042);
+		return ((npcId >= 12526) && (npcId <= 12528)) || ((npcId >= 16038) && (npcId <= 16040)) || (npcId == 16068);
 	}
 	
 	/**
-	 * Checks if is sin eater.
+	 * Checks if is grow up wolf group.
 	 * @param npcId the NPC Id to verify.
-	 * @return {@code true} if the given Id is from a Sin Eater, {@code false} otherwise.
+	 * @return {@code true} if the given Id is from a grow up wolf group, {@code false} otherwise.
 	 */
-	public static boolean isSinEater(int npcId)
+	public static boolean isGrowUpWolfGroup(int npcId)
 	{
-		return npcId == 12564;
+		return (npcId == 16025) || (npcId == 16030) || (npcId == 16037) || (npcId == 16041) || (npcId == 16042);
 	}
 	
 	/**
-	 * Checks if is hatchling.
+	 * Checks if is hatchling group.
 	 * @param npcId the NPC Id to verify.
-	 * @return {@code true} if the given Id is from a hatchling, {@code false} otherwise.
+	 * @return {@code true} if the given Id is from a hatchling group, {@code false} otherwise.
 	 */
-	public static boolean isHatchling(int npcId)
+	public static boolean isHatchlingGroup(int npcId)
 	{
-		return (npcId > 12310) && (npcId < 12314);
+		return (npcId >= 12311) && (npcId <= 12313);
 	}
 	
 	/**
-	 * Checks if is strider.
+	 * Checks if is all wolf group.
 	 * @param npcId the NPC Id to verify.
-	 * @return {@code true} if the given Id is from a strider, {@code false} otherwise.
+	 * @return {@code true} if the given Id is from all wolf group, {@code false} otherwise.
 	 */
-	public static boolean isStrider(int npcId)
+	public static boolean isAllWolfGroup(int npcId)
 	{
-		return ((npcId > 12525) && (npcId < 12529)) || ((npcId > 16037) && (npcId < 16041)) || (npcId == 16068);
+		return (npcId == 12077) || (npcId == 16025) || (npcId == 16030) || (npcId == 16037) || (npcId == 16041) || (npcId == 16042);
 	}
 	
 	/**
-	 * Checks if is wyvern.
+	 * Checks if is baby pet group.
 	 * @param npcId the NPC Id to verify.
-	 * @return {@code true} if the given Id is from a wyvern, {@code false} otherwise.
+	 * @return {@code true} if the given Id is from a baby pet group, {@code false} otherwise.
 	 */
-	public static boolean isWyvern(int npcId)
+	public static boolean isBabyPetGroup(int npcId)
 	{
-		return npcId == 12621;
+		return (npcId >= 12780) && (npcId <= 12782);
 	}
 	
 	/**
-	 * Checks if is baby.
+	 * Checks if is upgrade baby pet group.
 	 * @param npcId the NPC Id to verify.
-	 * @return {@code true} if the given Id is from a baby pet, {@code false} otherwise.
+	 * @return {@code true} if the given Id is from an upgrade baby pet group, {@code false} otherwise.
 	 */
-	public static boolean isBaby(int npcId)
+	public static boolean isUpgradeBabyPetGroup(int npcId)
 	{
-		return (npcId > 12779) && (npcId < 12783);
+		return (npcId >= 16034) && (npcId <= 16036);
 	}
 	
 	/**
-	 * Checks if is improved baby.
+	 * Checks if is item equip pet group.
 	 * @param npcId the NPC Id to verify.
-	 * @return {@code true} if the given Id is from an improved baby pet, {@code false} otherwise.
+	 * @return {@code true} if the given Id is from an item equip pet group, {@code false} otherwise.
 	 */
-	public static boolean isImprovedBaby(int npcId)
+	public static boolean isItemEquipPetGroup(int npcId)
 	{
-		return (npcId > 16033) && (npcId < 16037);
+		return (npcId == 12077) || ((npcId >= 12311) && (npcId <= 12313)) || ((npcId >= 12526) && (npcId <= 12528)) || ((npcId >= 12780) && (npcId <= 12782)) || (npcId == 16025) || (npcId == 16030) || ((npcId >= 16034) && (npcId <= 16036)) || (npcId == 16037) || ((npcId >= 16038) && (npcId <= 16042)) || (npcId == 16068) || (npcId == 16067) || (npcId == 16071) || (npcId == 16072) || (npcId == 1561);
 	}
 	
 	/**

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2BabyPetInstance.java

@@ -256,7 +256,7 @@ public final class L2BabyPetInstance extends L2PetInstance
 					 * If the owner's HP is more than 80% for Baby Pets and 70% for Improved Baby pets, do nothing. If the owner's HP is very low, under 15% for Baby pets and under 30% for Improved Baby Pets, have 75% chances of using a strong heal. Otherwise, have 25% chances for weak heal.
 					 */
 					final double hpPercent = owner.getCurrentHp() / owner.getMaxHp();
-					final boolean isImprovedBaby = PetDataTable.isImprovedBaby(getNpcId());
+					final boolean isImprovedBaby = PetDataTable.isUpgradeBabyPetGroup(getNpcId());
 					if ((isImprovedBaby && (hpPercent < 0.3)) || (!isImprovedBaby && (hpPercent < 0.15)))
 					{
 						skill = _majorHeal.getSkill();

+ 10 - 10
L2J_Server_BETA/java/com/l2jserver/gameserver/model/conditions/ConditionPetType.java

@@ -44,33 +44,33 @@ public class ConditionPetType extends Condition
 			return false;
 		}
 		
-		/*
-		 * if ((petType & L2Item.ANY_PET) == L2Item.ANY_PET) return true;
-		 */
-		
 		int npcid = ((L2Summon) env.getCharacter()).getNpcId();
 		
-		if (PetDataTable.isHatchling(npcid) && (petType == L2Item.HATCHLING))
+		if (PetDataTable.isStrider(npcid) && (petType == L2Item.STRIDER))
+		{
+			return true;
+		}
+		else if (PetDataTable.isGrowUpWolfGroup(npcid) && (petType == L2Item.GROWN_UP_WOLF_GROUP))
 		{
 			return true;
 		}
-		else if (PetDataTable.isWolf(npcid) && (petType == L2Item.WOLF))
+		else if (PetDataTable.isHatchlingGroup(npcid) && (petType == L2Item.HATCHLING_GROUP))
 		{
 			return true;
 		}
-		else if (PetDataTable.isEvolvedWolf(npcid) && (petType == L2Item.GROWN_WOLF))
+		else if (PetDataTable.isAllWolfGroup(npcid) && (petType == L2Item.ALL_WOLF_GROUP))
 		{
 			return true;
 		}
-		else if (PetDataTable.isStrider(npcid) && (petType == L2Item.STRIDER))
+		else if (PetDataTable.isBabyPetGroup(npcid) && (petType == L2Item.BABY_PET_GROUP))
 		{
 			return true;
 		}
-		else if (PetDataTable.isBaby(npcid) && (petType == L2Item.BABY))
+		else if (PetDataTable.isUpgradeBabyPetGroup(npcid) && (petType == L2Item.UPGRADE_BABY_PET_GROUP))
 		{
 			return true;
 		}
-		else if (PetDataTable.isImprovedBaby(npcid) && (petType == L2Item.IMPROVED_BABY))
+		else if (PetDataTable.isItemEquipPetGroup(npcid) && (petType == L2Item.ITEM_EQUIP_PET_GROUP))
 		{
 			return true;
 		}

+ 20 - 21
L2J_Server_BETA/java/com/l2jserver/gameserver/model/items/L2Item.java

@@ -78,14 +78,13 @@ public abstract class L2Item
 	public static final int TYPE2_MONEY = 4;
 	public static final int TYPE2_OTHER = 5;
 	
-	public static final int WOLF = 0x1;
-	public static final int HATCHLING = 0x2;
-	public static final int STRIDER = 0x4;
-	public static final int BABY = 0x8;
-	public static final int IMPROVED_BABY = 0x10;
-	public static final int GROWN_WOLF = 0x20;
-	public static final int ALL_WOLF = 0x21;
-	public static final int ALL_PET = 0x3F;
+	public static final int STRIDER = 0x1;
+	public static final int GROWN_UP_WOLF_GROUP = 0x2;
+	public static final int HATCHLING_GROUP = 0x4;
+	public static final int ALL_WOLF_GROUP = 0x8;
+	public static final int BABY_PET_GROUP = 0x16;
+	public static final int UPGRADE_BABY_PET_GROUP = 0x32;
+	public static final int ITEM_EQUIP_PET_GROUP = 0x64;
 	
 	public static final int SLOT_NONE = 0x0000;
 	public static final int SLOT_UNDERWEAR = 0x0001;
@@ -288,39 +287,39 @@ public abstract class L2Item
 		_reuseDelay = set.getInteger("reuse_delay", 0);
 		_sharedReuseGroup = set.getInteger("shared_reuse_group", 0);
 		
-		// TODO cleanup + finish
+		// TODO: This should be done with proper conditions and a categoryData.xml file.
 		String equip_condition = set.getString("equip_condition", null);
 		if (equip_condition != null)
 		{
 			// pet conditions
 			ConditionLogicOr cond = new ConditionLogicOr();
-			if (equip_condition.contains("all_wolf_group"))
+			if (equip_condition.contains("strider"))
+			{
+				cond.add(new ConditionPetType(STRIDER));
+			}
+			if (equip_condition.contains("grown_up_wolf_group"))
 			{
-				cond.add(new ConditionPetType(ALL_WOLF));
+				cond.add(new ConditionPetType(GROWN_UP_WOLF_GROUP));
 			}
 			if (equip_condition.contains("hatchling_group"))
 			{
-				cond.add(new ConditionPetType(HATCHLING));
+				cond.add(new ConditionPetType(HATCHLING_GROUP));
 			}
-			if (equip_condition.contains("strider"))
+			if (equip_condition.contains("all_wolf_group"))
 			{
-				cond.add(new ConditionPetType(STRIDER));
+				cond.add(new ConditionPetType(ALL_WOLF_GROUP));
 			}
 			if (equip_condition.contains("baby_pet_group"))
 			{
-				cond.add(new ConditionPetType(BABY));
+				cond.add(new ConditionPetType(BABY_PET_GROUP));
 			}
 			if (equip_condition.contains("upgrade_baby_pet_group"))
 			{
-				cond.add(new ConditionPetType(IMPROVED_BABY));
-			}
-			if (equip_condition.contains("grown_up_wolf_group"))
-			{
-				cond.add(new ConditionPetType(GROWN_WOLF));
+				cond.add(new ConditionPetType(UPGRADE_BABY_PET_GROUP));
 			}
 			if (equip_condition.contains("item_equip_pet_group"))
 			{
-				cond.add(new ConditionPetType(ALL_PET));
+				cond.add(new ConditionPetType(ITEM_EQUIP_PET_GROUP));
 			}
 			
 			if (cond.conditions.length > 0)