2
0
Эх сурвалжийг харах

BETA/STABLE: Fix for MP Consume for Clan Hall Managers by Zoey76 (thanks Tryskell for report).

MELERIX 14 жил өмнө
parent
commit
de0918091b

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

@@ -269,7 +269,7 @@ public final class Config
 	public static long CH_FRONT_FEE_RATIO;
 	public static int CH_FRONT1_FEE;
 	public static int CH_FRONT2_FEE;
-	
+	public static boolean CH_BUFF_FREE;
 	
 	//--------------------------------------------------
 	// Castle Settings
@@ -1252,6 +1252,7 @@ public final class Config
 					CH_FRONT_FEE_RATIO = Long.parseLong(Feature.getProperty("ClanHallFrontPlatformFunctionFeeRatio", "259200000"));
 					CH_FRONT1_FEE = Integer.parseInt(Feature.getProperty("ClanHallFrontPlatformFunctionFeeLvl1", "1300"));
 					CH_FRONT2_FEE = Integer.parseInt(Feature.getProperty("ClanHallFrontPlatformFunctionFeeLvl2", "4000"));
+					CH_BUFF_FREE = Boolean.parseBoolean(Feature.getProperty("AltClanHallMpBuffFree", "False"));
 					
 					CL_SET_SIEGE_TIME_LIST = new ArrayList<String>();
 					SIEGE_HOUR_LIST_MORNING = new ArrayList<Integer>();

+ 11 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2ClanHallManagerInstance.java

@@ -1268,27 +1268,33 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
 						if (st.countTokens() >= 1) skill_lvl = Integer.parseInt(st.nextToken());
 						skill = SkillTable.getInstance().getInfo(skill_id,skill_lvl);
 						if (skill.getSkillType() == L2SkillType.SUMMON)
+						{
 							player.doSimultaneousCast(skill);
+						}
 						else
 						{
-							if (!((skill.getMpConsume() + skill.getMpInitialConsume()) > this.getCurrentMp()))
-								this.doCast(skill);
+							final int mpCost = skill.getMpConsume() + skill.getMpInitialConsume();
+							//If Clan Hall Buff are free or current MP is greater than MP cost, the skill should be casted.
+							if ((getCurrentMp() >= mpCost) || Config.CH_BUFF_FREE)
+							{
+								doCast(skill);
+							}
 							else
 							{
 								NpcHtmlMessage html = new NpcHtmlMessage(1);
 								html.setFile(player.getHtmlPrefix(), "data/html/clanHallManager/support-no_mana.htm");
-								html.replace("%mp%", String.valueOf((int)getCurrentMp()));
+								html.replace("%mp%", String.valueOf((int) getCurrentMp()));
 								sendHtmlMessage(player, html);
 								return;
 							}
 						}
-						if (getClanHall().getFunction(ClanHall.FUNC_SUPPORT)== null)
+						if (getClanHall().getFunction(ClanHall.FUNC_SUPPORT) == null)
 							return;
 						NpcHtmlMessage html = new NpcHtmlMessage(1);
 						if(getClanHall().getFunction(ClanHall.FUNC_SUPPORT).getLvl() == 0)
 							return;
 						html.setFile(player.getHtmlPrefix(), "data/html/clanHallManager/support-done.htm");
-						html.replace("%mp%", String.valueOf((int)getCurrentMp()));
+						html.replace("%mp%", String.valueOf((int) getCurrentMp()));
 						sendHtmlMessage(player, html);
 					}
 					catch (Exception e)

+ 9 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/status/FolkStatus.java

@@ -14,8 +14,10 @@
  */
 package com.l2jserver.gameserver.model.actor.status;
 
+import com.l2jserver.Config;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2ClanHallManagerInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance;
 
 public class FolkStatus extends NpcStatus
@@ -39,11 +41,17 @@ public class FolkStatus extends NpcStatus
 	@Override
 	public final void reduceMp(double value)
 	{
+		//If Clan Hall buff are free and it's a Clan Hall Manager MP won't get reduced.
+		if (Config.CH_BUFF_FREE && (getActiveChar() instanceof L2ClanHallManagerInstance))
+		{
+			return;
+		}
+		super.reduceMp(value);
 	}
 	
 	@Override
 	public L2NpcInstance getActiveChar()
 	{
-		return (L2NpcInstance)super.getActiveChar();
+		return (L2NpcInstance) super.getActiveChar();
 	}
 }

+ 3 - 0
L2J_Server_BETA/java/config/Feature.properties

@@ -133,6 +133,9 @@ ClanHallFrontPlatformFunctionFeeRatio = 259200000
 ClanHallFrontPlatformFunctionFeeLvl1 = 1300
 ClanHallFrontPlatformFunctionFeeLvl2 = 4000
 
+# If true Clan Hall buff cost 0 mp.
+# Default: False
+AltClanHallMpBuffFree = False
 
 # ---------------------------------------------------------------------------
 # Fortress