Prechádzať zdrojové kódy

BETA: High 5 party distribution:
* The experience point penalties for excessive differences in the level of party members has been changed. If the lowest and highest level party members are causing a level gap, the lowest-level member will receive a penalty according to how many levels of difference there are:

* If the level gap between the highest and lowest party members is 9 levels or less, they will gain 100% of the XP as they will have no penalty.
* If the level gap between the highest and lowest party members is 10 to 14 levels, the lowest party member will gain only 30% of the XP that others receive.
* If the level gap between the highest and lowest party members is 15 levels or more, the lowest party member will not receive any XP.

'''Note:''' Default system has changed.

Zoey76 12 rokov pred
rodič
commit
f18575470f

+ 19 - 3
L2J_Server_BETA/dist/game/config/Character.properties

@@ -742,9 +742,9 @@ AltGameExponentSp = 0
 # With "auto method" member is cut from Exp/SP distribution when his share is lower than party bonus acquired for him (30% for 2 member party).
 # In that case he will not receive any Exp/SP from party and is not counted for party bonus.
 # If you don't want to have a cutoff point for party members' XP distribution, set the first option to "none".
-# Available Options: auto, level, percentage, none
-# Default: level
-PartyXpCutoffMethod = level
+# Available Options: highfive, auto, level, percentage, none
+# Default: highfive
+PartyXpCutoffMethod = highfive
 
 # This option takes effect when "percentage" method is chosen. Don't use high values for this!
 # Default: 3.0
@@ -754,6 +754,22 @@ PartyXpCutoffPercent = 3.0
 # Default: 20
 PartyXpCutoffLevel = 20
 
+# This option takes effect when "highfive" method is chosen.
+# Each pair of numbers represent a level range.
+# If the gap is between the first pair, there is no penalty.
+# If the gap is between the second pair, the lowest party member will gain only 30% of the XP that others receive.
+# If the gap is between the last pair, the lowest party member will not receive any XP.
+# Default: 0,9;10,14;15,99
+PartyXpCutoffGaps = 0,9;10,14;15,99
+
+# This option takes effect when "highfive" method is chosen.
+# Each number represent the XP percent gain at that level gap.
+# For the first gap, the lowest party member will gain 100% XP as there is no penalty.
+# For the second gap, the lowest party member will gain only 30% of the XP that others receive.
+# For the last gap, the lowest party member will not receive any XP.
+# Default: 100;30;0
+PartyXpCutoffGapPercent = 100;30;0
+
 # Disable tutorial on new player enter into Game
 # Please remember its sometimes important to novice players
 # Default: False

+ 19 - 1
L2J_Server_BETA/java/com/l2jserver/Config.java

@@ -247,6 +247,8 @@ public final class Config
 	public static String PARTY_XP_CUTOFF_METHOD;
 	public static double PARTY_XP_CUTOFF_PERCENT;
 	public static int PARTY_XP_CUTOFF_LEVEL;
+	public static int[][] PARTY_XP_CUTOFF_GAPS;
+	public static int[] PARTY_XP_CUTOFF_GAP_PERCENTS;
 	public static boolean DISABLE_TUTORIAL;
 	public static boolean EXPERTISE_PENALTY;
 	public static boolean STORE_RECIPE_SHOPLIST;
@@ -1712,9 +1714,25 @@ public final class Config
 			DELETE_DAYS = Integer.parseInt(Character.getProperty("DeleteCharAfterDays", "7"));
 			ALT_GAME_EXPONENT_XP = Float.parseFloat(Character.getProperty("AltGameExponentXp", "0."));
 			ALT_GAME_EXPONENT_SP = Float.parseFloat(Character.getProperty("AltGameExponentSp", "0."));
-			PARTY_XP_CUTOFF_METHOD = Character.getProperty("PartyXpCutoffMethod", "level");
+			PARTY_XP_CUTOFF_METHOD = Character.getProperty("PartyXpCutoffMethod", "highfive");
 			PARTY_XP_CUTOFF_PERCENT = Double.parseDouble(Character.getProperty("PartyXpCutoffPercent", "3."));
 			PARTY_XP_CUTOFF_LEVEL = Integer.parseInt(Character.getProperty("PartyXpCutoffLevel", "20"));
+			final String[] gaps = Character.getProperty("PartyXpCutoffGaps", "0,9;10,14;15,99").split(";");
+			PARTY_XP_CUTOFF_GAPS = new int[gaps.length][2];
+			for (int i = 0; i < gaps.length; i++)
+			{
+				PARTY_XP_CUTOFF_GAPS[i] = new int[]
+				{
+					Integer.parseInt(gaps[i].split(",")[0]),
+					Integer.parseInt(gaps[i].split(",")[0])
+				};
+			}
+			final String[] percents = Character.getProperty("PartyXpCutoffGapPercent", "100;30;0").split(",");
+			PARTY_XP_CUTOFF_GAP_PERCENTS = new int[percents.length];
+			for (int i = 0; i < percents.length; i++)
+			{
+				PARTY_XP_CUTOFF_GAP_PERCENTS[i] = Integer.parseInt(percents[i]);
+			}
 			DISABLE_TUTORIAL = Boolean.parseBoolean(Character.getProperty("DisableTutorial", "False"));
 			EXPERTISE_PENALTY = Boolean.parseBoolean(Character.getProperty("ExpertisePenalty", "True"));
 			STORE_RECIPE_SHOPLIST = Boolean.parseBoolean(Character.getProperty("StoreRecipeShopList", "False"));

+ 35 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/L2Party.java

@@ -864,7 +864,7 @@ public class L2Party extends AbstractPlayerGroup
 									((L2PcInstance) member).absorbSoul(skill, target);
 								}
 							}
-							((L2PcInstance) member).addExpAndSp(addexp, addsp, useVitalityRate);
+							calcualteExpSpPartyCutoff(member.getActingPlayer(), addexp, addsp, useVitalityRate);
 							if (addexp > 0)
 							{
 								((L2PcInstance) member).updateVitalityPoints(vitalityPoints, true, false);
@@ -884,6 +884,27 @@ public class L2Party extends AbstractPlayerGroup
 		}
 	}
 	
+	private final void calcualteExpSpPartyCutoff(L2PcInstance player, long addexp, int sp, boolean vit)
+	{
+		if (Config.PARTY_XP_CUTOFF_METHOD.equalsIgnoreCase("highfive"))
+		{
+			int i = 0;
+			for (int[] gap : Config.PARTY_XP_CUTOFF_GAPS)
+			{
+				if ((player.getLevel() >= gap[0]) && (player.getLevel() <= gap[0]))
+				{
+					player.addExpAndSp((addexp * Config.PARTY_XP_CUTOFF_GAP_PERCENTS[i]) / 100, sp, vit);
+					break;
+				}
+				i++;
+			}
+		}
+		else
+		{
+			player.addExpAndSp(addexp, sp, vit);
+		}
+	}
+	
 	/**
 	 * refresh party level
 	 */
@@ -967,6 +988,19 @@ public class L2Party extends AbstractPlayerGroup
 				}
 			}
 		}
+		// High Five cutogg method
+		else if (Config.PARTY_XP_CUTOFF_METHOD.equalsIgnoreCase("highfive"))
+		{
+			int levelDiff;
+			for (L2Playable member : members)
+			{
+				levelDiff = topLvl - member.getLevel();
+				if (levelDiff < Config.PARTY_XP_CUTOFF_GAPS[Config.PARTY_XP_CUTOFF_GAPS.length][0])
+				{
+					validMembers.add(member);
+				}
+			}
+		}
 		else if (Config.PARTY_XP_CUTOFF_METHOD.equalsIgnoreCase("none"))
 		{
 			validMembers.addAll(members);