Browse Source

Core support for Mana potions. Since this is looked forward by Community, commited as L2JMod. Read l2jmods.properties for further information
Every server admin should fill DataPack side at his/her will.
Typical example for DataPack side can be found here: http://www.l2jserver.com/forum/thread.php?threadid=28542

DrHouse 16 years ago
parent
commit
98e4a16b7c

+ 10 - 1
L2_GameServer/java/config/l2jmods.properties

@@ -161,4 +161,13 @@ BankingAdenaCount = 500000000
 #----------------------------------
 EnableWarehouseSortingClan = False
 EnableWarehouseSortingPrivate = False
-EnableWarehouseSortingFreight = False
+EnableWarehouseSortingFreight = False
+
+#--------------------------
+# Mana Potions            -
+#--------------------------
+# This option will enable core support for:
+# - mana potion (item id 728), using skill id 2005
+# Please, notice this is just core support, server administrator is requested to
+# edit skill 2005 on DataPack to get them working
+EnableManaPotionSupport = False

+ 6 - 0
L2_GameServer/java/net/sf/l2j/Config.java

@@ -560,6 +560,7 @@ public final class Config
     public static boolean	L2JMOD_ENABLE_WAREHOUSESORTING_CLAN;
     public static boolean	L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE;
     public static boolean	L2JMOD_ENABLE_WAREHOUSESORTING_FREIGHT;
+    public static boolean 	L2JMOD_ENABLE_MANA_POTIONS_SUPPORT;
     
     /** ************************************************** **/
 	/** L2JMods Settings -End                              **/
@@ -1892,6 +1893,8 @@ public final class Config
 	                BANKING_SYSTEM_ENABLED	= Boolean.parseBoolean(L2JModSettings.getProperty("BankingEnabled", "false"));
 	                BANKING_SYSTEM_GOLDBARS	= Integer.parseInt(L2JModSettings.getProperty("BankingGoldbarCount", "1"));
 	                BANKING_SYSTEM_ADENA	= Integer.parseInt(L2JModSettings.getProperty("BankingAdenaCount", "500000000"));
+	                
+	                L2JMOD_ENABLE_MANA_POTIONS_SUPPORT = Boolean.parseBoolean(L2JModSettings.getProperty("EnableManaPotionSupport", "false"));
 	            }
 	            catch (Exception e)
 	            {
@@ -2303,6 +2306,9 @@ public final class Config
         else if (pName.equalsIgnoreCase("EnableWarehouseSortingClan")) L2JMOD_ENABLE_WAREHOUSESORTING_CLAN = Boolean.parseBoolean(pValue);
         else if (pName.equalsIgnoreCase("EnableWarehouseSortingPrivate")) L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE = Boolean.parseBoolean(pValue);
         else if (pName.equalsIgnoreCase("EnableWarehouseSortingFreight")) L2JMOD_ENABLE_WAREHOUSESORTING_FREIGHT = Boolean.parseBoolean(pValue);
+        
+        // L2JMod Mana potion
+        else if (pName.equalsIgnoreCase("EnableManaPotionSupport")) L2JMOD_ENABLE_MANA_POTIONS_SUPPORT = Boolean.parseBoolean(pValue);
 
         // PvP settings
         else if (pName.equalsIgnoreCase("MinKarma")) KARMA_MIN_KARMA = Integer.parseInt(pValue);

+ 5 - 0
L2_GameServer/java/net/sf/l2j/gameserver/handler/itemhandlers/Potions.java

@@ -16,6 +16,7 @@ package net.sf.l2j.gameserver.handler.itemhandlers;
 
 import java.util.logging.Logger;
 
+import net.sf.l2j.Config;
 import net.sf.l2j.gameserver.datatables.SkillTable;
 import net.sf.l2j.gameserver.handler.IItemHandler;
 import net.sf.l2j.gameserver.model.L2Effect;
@@ -117,6 +118,10 @@ public class Potions implements IItemHandler
 					return;
 				res = usePotion(activeChar, 2032, 1);
 				break;
+			case 728: // custom mana potion, xml: 2005
+				if (Config.L2JMOD_ENABLE_MANA_POTIONS_SUPPORT)
+					res = usePotion(activeChar, 2005, 1);
+				break;
 			case 733: // Endeavor Potion, xml: 2010
 				res = usePotion(activeChar, 2010, 1);
 				break;