Guest User

Untitled

a guest
Aug 30th, 2024
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.80 KB | Gaming | 0 0
  1. // Create a new class BuffConfig.java
  2. public class BuffConfig {
  3.     private final List<int[]> mageBuffs = new ArrayList<>();
  4.     private final List<int[]> fighterBuffs = new ArrayList<>();
  5.  
  6.     public BuffConfig(String mageProperty, String fighterProperty) {
  7.         loadBuffs(mageProperty, mageBuffs);
  8.         loadBuffs(fighterProperty, fighterBuffs);
  9.     }
  10.  
  11. private void loadBuffs(String property, List<int[]> buffList) {
  12.     buffList.clear();
  13.     if (property == null || property.trim().isEmpty()) {
  14.         LOGGER.warn("Config property is empty or null.");
  15.         return;
  16.     }
  17.    
  18.     String[] propertySplit = property.split(";");
  19.     for (String buff : propertySplit) {
  20.         String[] buffSplit = buff.split(",");
  21.         if (buffSplit.length != 2) {
  22.             LOGGER.warn("Invalid config property -> Buff: \"" + buff + "\"");
  23.             continue;
  24.         }
  25.         try {
  26.             buffList.add(new int[]{Integer.parseInt(buffSplit[0]), Integer.parseInt(buffSplit[1])});
  27.         } catch (NumberFormatException nfe) {
  28.             if (Config.ENABLE_ALL_EXCEPTIONS) {
  29.                 nfe.printStackTrace();
  30.             }
  31.             LOGGER.warn("Invalid config property -> Buff: \"" + buff + "\"");
  32.         }
  33.     }
  34. }
  35.  
  36.     public List<int[]> getMageBuffs() {
  37.         return mageBuffs;
  38.     }
  39.  
  40.     public List<int[]> getFighterBuffs() {
  41.         return fighterBuffs;
  42.     }
  43. }
  44.  
  45. // Create a new class BuffUtils.java
  46. public class BuffUtils {
  47.  
  48.     public static void applyBuffs(L2PcInstance player, BuffConfig buffConfig) {
  49.         List<int[]> buffs = player.isMageClass() ? buffConfig.getMageBuffs() : buffConfig.getFighterBuffs();
  50.         for (int[] buff : buffs) {
  51.             L2Skill skill = SkillTable.getInstance().getInfo(buff[0], buff[1]);
  52.             if (skill != null) {
  53.                 skill.getEffects(player, player, false, false, false);
  54.                 SystemMessage sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
  55.                 sm.addSkillName(buff[0]);
  56.                 player.sendPacket(sm);
  57.             } else {
  58.                 LOGGER.warn("Skill not found for Buff ID: " + buff[0] + " Level: " + buff[1]);
  59.             }
  60.         }
  61.     }
  62. }
  63.  
  64. // Config.java
  65. public static BuffConfig TVT_BUFF_CONFIG;
  66. public static BuffConfig CTF_BUFF_CONFIG;
  67. public static BuffConfig DM_BUFF_CONFIG;
  68.  
  69.     TVT_BUFF_CONFIG = new BuffConfig(
  70.         p.getProperty("TvTBuffsMage", "1204,2"),
  71.         p.getProperty("TvTBuffsFighter", "1204,2")
  72.     );
  73.     CTF_BUFF_CONFIG = new BuffConfig(
  74.         p.getProperty("CTFBuffsMage", "1204,2"),
  75.         p.getProperty("CTFBuffsFighter", "1204,2")
  76.     );
  77.     DM_BUFF_CONFIG = new BuffConfig(
  78.         p.getProperty("DMBuffsMage", "1204,2"),
  79.         p.getProperty("DMBuffsFighter", "1204,2")
  80.     );
  81.  
  82. // TVT.java, CTF.java, DM.java
  83. if (Config.TVT_ON_START_REMOVE_ALL_EFFECTS) {
  84.     player.stopAllEffects();
  85. }
  86.  
  87. // Calling the common method from BuffUtils to apply the buffs.
  88. BuffUtils.applyBuffs(player, Config.TVT_BUFF_CONFIG);
  89.  
  90. # ----------------------------------------
  91. # Custom TVT buffs
  92. # ----------------------------------------
  93. # Buffs for mage classes:
  94. # Retail: Wind Walk (lvl 2) and Acumen (lvl 1)
  95. 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;
  96.  
  97. # Buffs for fighter classes:
  98. # Retail: Wind Walk (lvl 2) and Haste (lvl 1)
  99. 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;
  100.  
  101. # ----------------------------------------
  102. # Custom CTF buffs
  103. # ----------------------------------------
  104. # Buffs for mage classes:
  105. # Retail: Wind Walk (lvl 2) and Acumen (lvl 1)
  106. 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;
  107.  
  108. # Buffs for fighter classes:
  109. # Retail: Wind Walk (lvl 2) and Haste (lvl 1)
  110. 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;
  111.  
  112. # ----------------------------------------
  113. # Custom DM buffs
  114. # ----------------------------------------
  115. # Buffs for mage classes:
  116. # Retail: Wind Walk (lvl 2) and Acumen (lvl 1)
  117. 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;
  118.  
  119. # Buffs for fighter classes:
  120. # Retail: Wind Walk (lvl 2) and Haste (lvl 1)
  121. 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;
  122.  
Advertisement
Add Comment
Please, Sign In to add comment