Quellcode durchsuchen

Final (hopefully) patch for new Gracia dance and song stacking mechanics. It is configurable, check Characters.properties. Thanks again GodKratos (code) and _DS_ (testing)

DrHouse vor 16 Jahren
Ursprung
Commit
9309888532

+ 4 - 2
L2_GameServer/java/config/Character.properties

@@ -119,9 +119,11 @@ AutoLearnSkills = False
 # Retail: false
 AutoLootHerbs = False
 
-# Maximum number of buffs (default = 20 + 4 with divine inspiration skill)
-# Retail: 20
+# Maximum number of buffs and songs/dances
+# (default buffs = 20 + 4 with divine inspiration skill)
+# Retail: 20, 12
 maxbuffamount = 20
+maxdanceamount = 12
 
 # This option allows a player to automatically learn Divine Inspiration.
 # this is not included in AutoLearnSkills above.

+ 3 - 1
L2_GameServer/java/net/sf/l2j/Config.java

@@ -110,6 +110,7 @@ public final class Config
     public static boolean	AUTO_LEARN_SKILLS;
     public static boolean	AUTO_LOOT_HERBS;
     public static byte		BUFFS_MAX_AMOUNT;
+    public static byte		DANCES_MAX_AMOUNT;
     public static boolean	AUTO_LEARN_DIVINE_INSPIRATION;
     public static boolean	ALT_GAME_CANCEL_BOW;
     public static boolean	ALT_GAME_CANCEL_CAST;
@@ -1129,7 +1130,8 @@ public final class Config
                 
                 AUTO_LEARN_SKILLS					= Boolean.parseBoolean(Character.getProperty("AutoLearnSkills", "false"));
                 AUTO_LOOT_HERBS						= Boolean.parseBoolean(Character.getProperty("AutoLootHerbs", "true"));
-                BUFFS_MAX_AMOUNT					= Byte.parseByte(Character.getProperty("maxbuffamount","24"));
+                BUFFS_MAX_AMOUNT					= Byte.parseByte(Character.getProperty("maxbuffamount","20"));
+                DANCES_MAX_AMOUNT					= Byte.parseByte(Character.getProperty("maxdanceamount","12"));
                 AUTO_LEARN_DIVINE_INSPIRATION		= Boolean.parseBoolean(Character.getProperty("AutoLearnDivineInspiration", "false"));
                 ALT_GAME_CANCEL_BOW					= Character.getProperty("AltGameCancelByHit", "Cast").equalsIgnoreCase("bow") || Character.getProperty("AltGameCancelByHit", "Cast").equalsIgnoreCase("all");
                 ALT_GAME_CANCEL_CAST				= Character.getProperty("AltGameCancelByHit", "Cast").equalsIgnoreCase("cast") || Character.getProperty("AltGameCancelByHit", "Cast").equalsIgnoreCase("all");

+ 48 - 31
L2_GameServer/java/net/sf/l2j/gameserver/model/CharEffectList.java

@@ -198,7 +198,7 @@ public class CharEffectList
 	}
 
 	/**
-	 * Return the number of buffs in this CharEffectList
+	 * Return the number of buffs in this CharEffectList not counting Songs/Dances
 	 * @return
 	 */
 	public int getBuffCount()
@@ -208,7 +208,7 @@ public class CharEffectList
 		
 		for (L2Effect e : _buffs)
 		{
-			if (e != null && e.getShowIcon() &&
+			if (e != null && e.getShowIcon() && !e.getSkill().isDance() && !e.getSkill().isDebuff() &&
 					(e.getSkill().getSkillType() == L2SkillType.BUFF ||
 					e.getSkill().getSkillType() == L2SkillType.REFLECT ||
 					e.getSkill().getSkillType() == L2SkillType.HEAL_PERCENT ||
@@ -222,7 +222,7 @@ public class CharEffectList
 	}
 
 	/**
-	 * Return the number of dances in this CharEffectList
+	 * Return the number of Songs/Dances in this CharEffectList
 	 * @return
 	 */
 	public int getDanceCount()
@@ -293,33 +293,55 @@ public class CharEffectList
 	/**
 	 * Removes the first buff of this list.
 	 *
-	 * @param preferSkill If != 0 the given skill Id will be removed instead of the first
+	 * @param s Is the skill that is being applied.
 	 */
-	private void removeFirstBuff(int preferSkill)
+	private void removeFirstBuff(L2Skill checkSkill)
 	{
+		boolean danceBuff = false;
+		if (!checkSkill.isDance() && getBuffCount() >= _owner.getMaxBuffCount())
+		{
+			if (checkSkill.getSkillType() != L2SkillType.BUFF &&
+				checkSkill.getSkillType() != L2SkillType.REFLECT &&
+				checkSkill.getSkillType() != L2SkillType.HEAL_PERCENT &&
+				checkSkill.getSkillType() != L2SkillType.MANAHEAL_PERCENT)
+			{
+				return;
+			}
+		}
+		else if (checkSkill.isDance() && getDanceCount() >= Config.DANCES_MAX_AMOUNT)
+		{
+			danceBuff = true;
+		}
+		else return;
+		
 		L2Effect[] effects = getAllEffects();
 		L2Effect removeMe = null;
 
 		for (L2Effect e : effects)
 		{
-			if ( e != null &&
-					(e.getSkill().getSkillType() == L2SkillType.BUFF ||
+			if (e == null || 
+					!(e.getSkill().getSkillType() == L2SkillType.BUFF ||
 					 e.getSkill().getSkillType() == L2SkillType.DEBUFF ||
 					 e.getSkill().getSkillType() == L2SkillType.REFLECT ||
 					 e.getSkill().getSkillType() == L2SkillType.HEAL_PERCENT ||
-					 e.getSkill().getSkillType() == L2SkillType.MANAHEAL_PERCENT) &&
-					!(e.getSkill().getId() > 4360  && e.getSkill().getId() < 4367)) // Seven Signs buff
+					 e.getSkill().getSkillType() == L2SkillType.MANAHEAL_PERCENT))
 			{
-				if (preferSkill == 0) { removeMe = e; break; }
-				else if (e.getSkill().getId() == preferSkill) { removeMe = e; break; }
-				else if (removeMe == null) removeMe = e;
+				continue;
+			}
+			if ((danceBuff && e.getSkill().isDance()) || (!danceBuff && !e.getSkill().isDance()))
+			{
+				if (e.getSkill() == checkSkill)
+				{
+					removeMe = e;
+					break;
+				}
+				else if (removeMe == null)
+					removeMe = e;
 			}
 		}
 		if (removeMe != null) removeMe.exit();
 	}
 
-
-
 	public final void removeEffect(L2Effect effect)
 	{
 		if (effect == null || (_buffs == null && _debuffs == null) ) return;
@@ -382,7 +404,6 @@ public class CharEffectList
 				}
 			}
 
-
 			// Remove the active skill L2effect from _effects of the L2Character
 			// The Integer key of _effects is the L2Skill Identifier that has created the effect
 			for (L2Effect e : effectList)
@@ -438,25 +459,21 @@ public class CharEffectList
 				}
 			}
 
-			// Remove first Buff if number of buffs > getMaxBuffCount()
+			// if max buffs, no herb effects are used, even if they would replace one old
+			if (getBuffCount() >= _owner.getMaxBuffCount() && newEffect.isHerbEffect())
+			{ 
+				newEffect.stopEffectTask(); 
+				return; 
+			}
+			
+			// Remove first buff when buff list is full
 			L2Skill tempSkill = newEffect.getSkill();
-			if (getBuffCount() >= _owner.getMaxBuffCount() && !doesStack(tempSkill) && ((
-				tempSkill.getSkillType() == L2SkillType.BUFF ||
-                tempSkill.getSkillType() == L2SkillType.REFLECT ||
-                tempSkill.getSkillType() == L2SkillType.HEAL_PERCENT ||
-                tempSkill.getSkillType() == L2SkillType.MANAHEAL_PERCENT) &&
-                !tempSkill.isDebuff() &&  !(tempSkill.getId() > 4360 && tempSkill.getId() < 4367))
-        	)
+			if (!doesStack(tempSkill) && !tempSkill.isDebuff() &&
+					!(tempSkill.getId() > 4360 && tempSkill.getId() < 4367))
 			{
-				// if max buffs, no herb effects are used, even if they would replace one old
-				if (newEffect.isHerbEffect()) 
-				{ 
-					newEffect.stopEffectTask(); 
-					return; 
-				}
-				removeFirstBuff(tempSkill.getId());
+				removeFirstBuff(tempSkill);
 			}
-
+			
 			// Add the L2Effect to all effect in progress on the L2Character
 			if (!newEffect.getSkill().isToggle() && !newEffect.getSkill().isDebuff())
 			{