Jump to content

Recommended Posts

Posted

ES: Un Pequeño aporte un mod que cumple la funcion que al entrar en lo eventos de TVT, DM o CTF automaticamente te da buff dependiendo la clase ya sea Mago o Guerrero espero que lo disfruten

 

EN: A small contribution, a mod that fulfills the function that when entering the TVT, DM or CTF events it automatically gives you a buff depending on the class, whether it is a Mage or a Warrior, I hope you enjoy it.

 

### Eclipse Workspace Patch 1.0
Index: head-src/com/l2jfrozen/Config.java
===================================================================
--- head-src/com/l2jfrozen/Config.java   (revision 43)
+++ head-src/com/l2jfrozen/Config.java   (working copy)

		public static boolean TVT_STATS_LOGGER;
		public static boolean TVT_REMOVE_BUFFS_ON_DIE;
		public static boolean TVT_ALLOW_HEALER_CLASSES;
		public static String DISABLE_ID_CLASSES_STRING;
		public static FastList<Integer> DISABLE_ID_CLASSES = new FastList<>();
+		/* TVT BUFF CONFIG */
+       public static List<int[]> CUSTOM_BUFFS_MTVT = new ArrayList<>();     
+       public static List<int[]> CUSTOM_BUFFS_FTVT = new ArrayList<>();
+/* ============================================================================ */	
		public static boolean CTF_AURA;
		public static boolean CTF_STATS_LOGGER;
		public static int CTF_SPAWN_OFFSET;
		public static boolean CTF_REMOVE_BUFFS_ON_DIE;
+		/* CTF BUFF CONFIG */
+       public static List<int[]> CUSTOM_BUFFS_MCTF = new ArrayList<>();     
+       public static List<int[]> CUSTOM_BUFFS_FCTF = new ArrayList<>();
+/* ============================================================================ */	
		public static boolean DM_STATS_LOGGER;
		public static boolean DM_ALLOW_HEALER_CLASSES;
		public static boolean DM_REMOVE_BUFFS_ON_DIE;
+		/* DM BUFF CONFIG */
+       public static List<int[]> CUSTOM_BUFFS_MDM = new ArrayList<>();     
+       public static List<int[]> CUSTOM_BUFFS_FDM = new ArrayList<>();
+/* ============================================================================ */	
		
		TVT_STATS_LOGGER = p.getProperty("TvTStatsLogger", true);
		TVT_REMOVE_BUFFS_ON_DIE = p.getProperty("TvTRemoveBuffsOnPlayerDie", false);
		TVT_ALLOW_HEALER_CLASSES = p.getProperty("TvTAllowedHealerClasses", true);
		DISABLE_ID_CLASSES_STRING = p.getProperty("DisableIdForClasses", "");
+		/*==============================================================================================================================================*/
+		/* TVT BUFF CONFIG */
+			String[] propertySplit = p.getProperty("TvTBuffsMage", "1204,2").split(";");
+			CUSTOM_BUFFS_MTVT.clear();
+			 for (String buff : propertySplit)
+			     {
+			       String[] buffSplit = buff.split(",");
+			        if (buffSplit.length != 2)
+			           LOGGER.warn("TvTBuffsMage[Config.load()]: invalid config property -> TvTBuffsMage \"" + buff + "\"");
+			        else
+			        	{
+			        try
+				            {
+				            	CUSTOM_BUFFS_MTVT.add(new int[]{Integer.parseInt(buffSplit[0]), Integer.parseInt(buffSplit[1])});
+				            }
+			                catch (NumberFormatException nfe)
+				            {
+				               if(Config.ENABLE_ALL_EXCEPTIONS)
+				                 nfe.printStackTrace();
+				               if (!buff.isEmpty())
+				                 LOGGER.warn("TvTBuffsMage[Config.load()]: invalid config property -> TvTBuffsMage \"" + buff + "\"");
+				            }
+			            }
+			         }
+			 
+			        propertySplit = p.getProperty("TvTBuffsFighter", "1204,2").split(";");
+			        CUSTOM_BUFFS_FTVT.clear();
+			          for (String buff : propertySplit)
+			              {
+			               String[] buffSplit = buff.split(",");
+			                if (buffSplit.length != 2)
+			                    LOGGER.warn("TvTBuffsFighter[Config.load()]: invalid config property -> TvTBuffsFighter \"" + buff + "\"");
+			                else
+			                   {
+			                try
+			                    {
+			                      CUSTOM_BUFFS_FTVT.add(new int[]{Integer.parseInt(buffSplit[0]), Integer.parseInt(buffSplit[1])});
+			                    }
+			                      catch (NumberFormatException nfe)
+			                         {
+			                            if(Config.ENABLE_ALL_EXCEPTIONS)
+			                               nfe.printStackTrace();
+			                                                     
+			                            if (!buff.isEmpty())
+			                                LOGGER.warn("TvTBuffsFighter[Config.load()]: invalid config property -> TvTBuffsFighter \"" + buff + "\"");
+			                          }
+			                      }
+			                     }
+			/*==============================================================================================================================================*/
			CTF_STATS_LOGGER = p.getProperty("CTFStatsLogger", true);
			CTF_SPAWN_OFFSET = Integer.parseInt(p.getProperty("CTFSpawnOffset", "100"));
			CTF_REMOVE_BUFFS_ON_DIE = p.getProperty("CTFRemoveBuffsOnPlayerDie", false);
+			/*==============================================================================================================================================*/
+			/* CTF BUFF CONFIG */
+			String[] propertySplit2 = p.getProperty("CTFBuffsMage", "1204,2").split(";");
+			CUSTOM_BUFFS_MCTF.clear();
+			 for (String buff : propertySplit2)
+			     {
+			       String[] buffSplit = buff.split(",");
+			        if (buffSplit.length != 2)
+			           LOGGER.warn("CTFBuffsMage[Config.load()]: invalid config property -> CTFBuffsMage \"" + buff + "\"");
+			        else
+			        	{
+			        try
+				            {
+				            	CUSTOM_BUFFS_MCTF.add(new int[]{Integer.parseInt(buffSplit[0]), Integer.parseInt(buffSplit[1])});
+				            }
+			                catch (NumberFormatException nfe)
+				            {
+				               if(Config.ENABLE_ALL_EXCEPTIONS)
+				                 nfe.printStackTrace();
+				               if (!buff.isEmpty())
+				                 LOGGER.warn("CTFBuffsMage[Config.load()]: invalid config property -> CTFBuffsMage \"" + buff + "\"");
+				            }
+			            }
+			         }
+			 
+			        propertySplit2 = p.getProperty("CTFBuffsFighter", "1204,2").split(";");
+			        CUSTOM_BUFFS_FCTF.clear();
+			          for (String buff : propertySplit2)
+			              {
+			               String[] buffSplit = buff.split(",");
+			                if (buffSplit.length != 2)
+			                    LOGGER.warn("CTFBuffsFighter[Config.load()]: invalid config property -> CTFBuffsFighter \"" + buff + "\"");
+			                else
+			                   {
+			                try
+			                    {
+			                      CUSTOM_BUFFS_FCTF.add(new int[]{Integer.parseInt(buffSplit[0]), Integer.parseInt(buffSplit[1])});
+			                    }
+			                      catch (NumberFormatException nfe)
+			                         {
+			                            if(Config.ENABLE_ALL_EXCEPTIONS)
+			                               nfe.printStackTrace();
+			                                                     
+			                            if (!buff.isEmpty())
+			                                LOGGER.warn("CTFBuffsFighter[Config.load()]: invalid config property -> CTFBuffsFighter \"" + buff + "\"");
+			                          }
+			                      }
+			                     }
+			/*==============================================================================================================================================*/
			DM_SPAWN_OFFSET = Integer.parseInt(p.getProperty("DMSpawnOffset", "100"));
			DM_STATS_LOGGER = p.getProperty("DMStatsLogger", true);
			DM_ALLOW_HEALER_CLASSES = p.getProperty("DMAllowedHealerClasses", true);
			DM_REMOVE_BUFFS_ON_DIE = p.getProperty("DMRemoveBuffsOnPlayerDie", false);
+			/*==============================================================================================================================================*/
+			/* DM BUFF CONFIG */
+			String[] propertySplit3 = p.getProperty("DMBuffsMage", "1204,2").split(";");
+			CUSTOM_BUFFS_MDM.clear();
+			 for (String buff : propertySplit33)
+			     {
+			       String[] buffSplit = buff.split(",");
+			        if (buffSplit.length != 2)
+			           LOGGER.warn("DMBuffsMage[Config.load()]: invalid config property -> DMBuffsMage \"" + buff + "\"");
+			        else
+			        	{
+			        try
+				            {
+				            	CUSTOM_BUFFS_MDM.add(new int[]{Integer.parseInt(buffSplit[0]), Integer.parseInt(buffSplit[1])});
+				            }
+			                catch (NumberFormatException nfe)
+				            {
+				               if(Config.ENABLE_ALL_EXCEPTIONS)
+				                 nfe.printStackTrace();
+				               if (!buff.isEmpty())
+				                 LOGGER.warn("DMBuffsMage[Config.load()]: invalid config property -> DMBuffsMage \"" + buff + "\"");
+				            }
+			            }
+			         }
+			 
+			        propertySplit3 = p.getProperty("DMBuffsFighter", "1204,2").split(";");
+			        CUSTOM_BUFFS_FDM.clear();
+			          for (String buff : propertySplit3)
+			              {
+			               String[] buffSplit = buff.split(",");
+			                if (buffSplit.length != 2)
+			                    LOGGER.warn("DMBuffsFighter[Config.load()]: invalid config property -> DMBuffsFighter \"" + buff + "\"");
+			                else
+			                   {
+			                try
+			                    {
+			                      CUSTOM_BUFFS_FDM.add(new int[]{Integer.parseInt(buffSplit[0]), Integer.parseInt(buffSplit[1])});
+			                    }
+			                      catch (NumberFormatException nfe)
+			                         {
+			                            if(Config.ENABLE_ALL_EXCEPTIONS)
+			                               nfe.printStackTrace();
+			                                                     
+			                            if (!buff.isEmpty())
+			                                LOGGER.warn("DMBuffsFighter[Config.load()]: invalid config property -> DMBuffsFighter \"" + buff + "\"");
+			                          }
+			                      }
+			                     }
+			/*==============================================================================================================================================*/









Index: head-src/com/l2jfrozen/gameserver/model/entity/event/TVT.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/model/entity/event/TVT.java   (revision 43)
+++ head-src/com/l2jfrozen/gameserver/model/entity/event/TVT.java   (working copy)

+import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
+import com.l2jfrozen.gameserver.network.SystemMessageId;
+import com.l2jfrozen.gameserver.model.L2Skill;

	if (Config.TVT_ON_START_REMOVE_ALL_EFFECTS)
		{
			player.stopAllEffects();				
		}

+		//TVTBuff
+		L2Skill skill;
+       SystemMessage sm;
+		if(!player.isMageClass())
+           {
+                for (int[] buff : Config.CUSTOM_BUFFS_FTVT) //Custom buffs for fighters
+                    {
+                        skill = SkillTable.getInstance().getInfo(buff[0], buff[1]);
+                        skill.getEffects(player, player,false,false,false);
+                       sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
+                        sm.addSkillName(buff[0]);
+                        player.sendPacket(sm);
+                    }
+            }
+			else
+			{
+				for (int[] buff : Config.CUSTOM_BUFFS_MTVT) //Custom buffs for mystics
+					{
+						skill = SkillTable.getInstance().getInfo(buff[0], buff[1]);
+						skill.getEffects(player, player,false,false,false);
+						sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
+						sm.addSkillName(buff[0]);
+						player.sendPacket(sm);
+					}
+			}
+			//-------------------------

Index: head-src/com/l2jfrozen/gameserver/model/entity/event/CTF.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/model/entity/event/CTF.java   (revision 43)
+++ head-src/com/l2jfrozen/gameserver/model/entity/event/CTF.java   (working copy)

+import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
+import com.l2jfrozen.gameserver.network.SystemMessageId;
+import com.l2jfrozen.gameserver.model.L2Skill;

	if (Config.CTF_ON_START_REMOVE_ALL_EFFECTS)
		{
			for (final L2Effect e : player.getAllEffects())
				{
					if (e != null)
					e.exit(true);
				}
		}

+		//CTFBuff
+		L2Skill skill;
+        SystemMessage sm;
+		if(!player.isMageClass())
+            {
+                for (int[] buff : Config.CUSTOM_BUFFS_FCTF) //Custom buffs for fighters
+                    {
+                        skill = SkillTable.getInstance().getInfo(buff[0], buff[1]);
+                        skill.getEffects(player, player,false,false,false);
+                        sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
+                        sm.addSkillName(buff[0]);
+                        player.sendPacket(sm);
+                    }
+            }
+			else
+			{
+				for (int[] buff : Config.CUSTOM_BUFFS_MCTF) //Custom buffs for mystics
+					{
+						skill = SkillTable.getInstance().getInfo(buff[0], buff[1]);
+						skill.getEffects(player, player,false,false,false);
+						sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
+						sm.addSkillName(buff[0]);
+						player.sendPacket(sm);
+					}
+			}
+			//-------------------------



Index: head-src/com/l2jfrozen/gameserver/model/entity/event/DM.java
===================================================================
--- head-src/com/l2jfrozen/gameserver/model/entity/event/DM.java   (revision 43)
+++ head-src/com/l2jfrozen/gameserver/model/entity/event/DM.java   (working copy)

+import com.l2jfrozen.gameserver.network.serverpackets.SystemMessage;
+import com.l2jfrozen.gameserver.network.SystemMessageId;
+import com.l2jfrozen.gameserver.model.L2Skill;

	if (Config.DM_ON_START_REMOVE_ALL_EFFECTS)
		{
			player.stopAllEffects();						
		}

+		//DMBuff
+		L2Skill skill;
+        SystemMessage sm;
+		if(!player.isMageClass())
+            {
+                for (int[] buff : Config.CUSTOM_BUFFS_FDM) //Custom buffs for fighters
+                    {
+                        skill = SkillTable.getInstance().getInfo(buff[0], buff[1]);
+                        skill.getEffects(player, player,false,false,false);
+                        sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
+                        sm.addSkillName(buff[0]);
+                        player.sendPacket(sm);
+                    }
+            }
+			else
+			{
+				for (int[] buff : Config.CUSTOM_BUFFS_MDM) //Custom buffs for mystics
+					{
+						skill = SkillTable.getInstance().getInfo(buff[0], buff[1]);
+						skill.getEffects(player, player,false,false,false);
+						sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
+						sm.addSkillName(buff[0]);
+						player.sendPacket(sm);
+					}
+			}
+			//-------------------------
+











GameServer/Config/Function/eventmanager.ini

+# ----------------------------------------
+# Custom TVT buffs
+#------------------------------------------
+#Buffs for mage classes:
+#Retail: Wind Walk(lvl 2) and Acumen(lvl 1)
+TvTBuffsMage = 1204,2;1040,3;1035,4;1045,6;1048,6;1036,2;1303,2;1085,3;1059,3;1078,6;1062,2;1397,3;264,1;267,1;268,1;304,1;349,1;364,1;273,1;276,1;365,1;1413,1;1391,3;4703,1;
+
+#Buffs for fighter classes:
+#Retail: Wind Walk(lvl 2) and Haste(lvl 1)
+TvTBuffsFighter = 1204,2;1068,3;1040,3;1035,4;1036,2;1045,6;1086,2;1077,3;1240,3;1242,3;264,1;267,1;268,1;269,1;304,1;349,1;364,1;271,1;274,1;275,1;1363,1;1391,3;4699,1;4703,1;
+
+# ----------------------------------------
+# Custom CTF buffs
+#------------------------------------------
+#Buffs for mage classes:
+#Retail: Wind Walk(lvl 2) and Acumen(lvl 1)
+CTFBuffsMage = 1204,2;1040,3;1035,4;1045,6;1048,6;1036,2;1303,2;1085,3;1059,3;1078,6;1062,2;1397,3;264,1;267,1;268,1;304,1;349,1;364,1;273,1;276,1;365,1;1413,1;1391,3;4703,1;
+
+#Buffs for fighter classes:
+#Retail: Wind Walk(lvl 2) and Haste(lvl 1)
+CTFBuffsFighter = 1204,2;1068,3;1040,3;1035,4;1036,2;1045,6;1086,2;1077,3;1240,3;1242,3;264,1;267,1;268,1;269,1;304,1;349,1;364,1;271,1;274,1;275,1;1363,1;1391,3;4699,1;4703,1;
+
+
+# ----------------------------------------
+# Custom DM buffs
+#------------------------------------------
+#Buffs for mage classes:
+#Retail: Wind Walk(lvl 2) and Acumen(lvl 1)
+DMBuffsMage = 1204,2;1040,3;1035,4;1045,6;1048,6;1036,2;1303,2;1085,3;1059,3;1078,6;1062,2;1397,3;264,1;267,1;268,1;304,1;349,1;364,1;273,1;276,1;365,1;1413,1;1391,3;4703,1;
+
+#Buffs for fighter classes:
+#Retail: Wind Walk(lvl 2) and Haste(lvl 1)
+DMBuffsFighter = 1204,2;1068,3;1040,3;1035,4;1036,2;1045,6;1086,2;1077,3;1240,3;1242,3;264,1;267,1;268,1;269,1;304,1;349,1;364,1;271,1;274,1;275,1;1363,1;1391,3;4699,1;4703,1;

 

Posted

Hey,

 

The code you provided contains a lot of repetitive code and can be improved to be cleaner. It's just a opinion, nothing else..

This way, you don't need to go into each file individually when you want to make a change; instead, it can be done through the new classes.

https://pastebin.com/vAgkygfN

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...