Ver Fonte

BETA: Olympiad buff changes:
* Unhardcoded maximum olympiad buff count to config.
* Using getters and setters for player's olympiad buff count instead of public variable.

Zoey76 há 10 anos atrás
pai
commit
8cf82d3b37

+ 4 - 0
L2J_Server_BETA/dist/game/config/Olympiad.properties

@@ -17,6 +17,10 @@ AltOlyStartTime = 18
 # Default: 00
 AltOlyMin = 00
 
+# Maximum number of buffs.
+# Default: 5
+AltOlyMaxBuffs = 5
+
 # Olympiad Competition Period, Default 6 hours.
 # (If set different, should be increment by 10mins)
 # Default: 21600000

+ 2 - 0
L2J_Server_BETA/java/com/l2jserver/Config.java

@@ -562,6 +562,7 @@ public final class Config
 	public static int[] BAN_CHAT_CHANNELS;
 	public static int ALT_OLY_START_TIME;
 	public static int ALT_OLY_MIN;
+	public static int ALT_OLY_MAX_BUFFS;
 	public static long ALT_OLY_CPERIOD;
 	public static long ALT_OLY_BATTLE;
 	public static long ALT_OLY_WPERIOD;
@@ -2629,6 +2630,7 @@ public final class Config
 			
 			ALT_OLY_START_TIME = Olympiad.getInt("AltOlyStartTime", 18);
 			ALT_OLY_MIN = Olympiad.getInt("AltOlyMin", 0);
+			ALT_OLY_MAX_BUFFS = Olympiad.getInt("AltOlyMaxBuffs", 5);
 			ALT_OLY_CPERIOD = Olympiad.getLong("AltOlyCPeriod", 21600000);
 			ALT_OLY_BATTLE = Olympiad.getLong("AltOlyBattle", 300000);
 			ALT_OLY_WPERIOD = Olympiad.getLong("AltOlyWPeriod", 604800000);

+ 3 - 6
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/NpcBufferTable.java

@@ -185,13 +185,10 @@ public class NpcBufferTable
 	
 	public NpcBufferData getSkillInfo(int npcId, int buffGroup)
 	{
-		if (_buffers.containsKey(npcId))
+		final NpcBufferSkills skills = _buffers.get(npcId);
+		if (skills != null)
 		{
-			final NpcBufferSkills skills = _buffers.get(npcId);
-			if (skills != null)
-			{
-				return skills.getSkillGroupInfo(buffGroup);
-			}
+			return skills.getSkillGroupInfo(buffGroup);
 		}
 		return null;
 	}

+ 2 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/L2Npc.java

@@ -1242,9 +1242,9 @@ public class L2Npc extends L2Character
 				}
 				break;
 			case 36402:
-				if (player.olyBuff > 0)
+				if (player.getOlympiadBuffCount() > 0)
 				{
-					filename = (player.olyBuff == 5 ? Olympiad.OLYMPIAD_HTML_PATH + "olympiad_buffs.htm" : Olympiad.OLYMPIAD_HTML_PATH + "olympiad_5buffs.htm");
+					filename = (player.getOlympiadBuffCount() == Config.ALT_OLY_MAX_BUFFS ? Olympiad.OLYMPIAD_HTML_PATH + "olympiad_buffs.htm" : Olympiad.OLYMPIAD_HTML_PATH + "olympiad_5buffs.htm");
 				}
 				else
 				{

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

@@ -523,7 +523,8 @@ public final class L2PcInstance extends L2Playable
 	private boolean _OlympiadStart = false;
 	private int _olympiadGameId = -1;
 	private int _olympiadSide = -1;
-	public int olyBuff = 0;
+	/** Olympiad buff count. */
+	private int _olyBuffsCount = 0;
 	
 	/** Duel */
 	private boolean _isInDuel = false;
@@ -9793,6 +9794,24 @@ public final class L2PcInstance extends L2Playable
 		return _olympiadGameId;
 	}
 	
+	/**
+	 * Gets the player's olympiad buff count.
+	 * @return the olympiad's buff count
+	 */
+	public int getOlympiadBuffCount()
+	{
+		return _olyBuffsCount;
+	}
+	
+	/**
+	 * Sets the player's olympiad buff count.
+	 * @param buffs the olympiad's buff count
+	 */
+	public void setOlympiadBuffCount(int buffs)
+	{
+		_olyBuffsCount = buffs;
+	}
+	
 	public Location getLastLocation()
 	{
 		return _lastLoc;

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/olympiad/AbstractOlympiadGame.java

@@ -184,7 +184,7 @@ public abstract class AbstractOlympiadGame
 			player.setIsInOlympiadMode(true);
 			player.setIsOlympiadStart(false);
 			player.setOlympiadSide(par.getSide());
-			player.olyBuff = 5;
+			player.setOlympiadBuffCount(Config.ALT_OLY_MAX_BUFFS);
 			loc.setInstanceId(OlympiadGameManager.getInstance().getOlympiadTask(id).getZone().getInstanceId());
 			player.teleToLocation(loc, false);
 			player.sendPacket(new ExOlympiadMode(2));