Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Create a new class BuffConfig.java
- public class BuffConfig {
- private final List<int[]> mageBuffs = new ArrayList<>();
- private final List<int[]> fighterBuffs = new ArrayList<>();
- public BuffConfig(String mageProperty, String fighterProperty) {
- loadBuffs(mageProperty, mageBuffs);
- loadBuffs(fighterProperty, fighterBuffs);
- }
- private void loadBuffs(String property, List<int[]> buffList) {
- buffList.clear();
- if (property == null || property.trim().isEmpty()) {
- LOGGER.warn("Config property is empty or null.");
- return;
- }
- String[] propertySplit = property.split(";");
- for (String buff : propertySplit) {
- String[] buffSplit = buff.split(",");
- if (buffSplit.length != 2) {
- LOGGER.warn("Invalid config property -> Buff: \"" + buff + "\"");
- continue;
- }
- try {
- buffList.add(new int[]{Integer.parseInt(buffSplit[0]), Integer.parseInt(buffSplit[1])});
- } catch (NumberFormatException nfe) {
- if (Config.ENABLE_ALL_EXCEPTIONS) {
- nfe.printStackTrace();
- }
- LOGGER.warn("Invalid config property -> Buff: \"" + buff + "\"");
- }
- }
- }
- public List<int[]> getMageBuffs() {
- return mageBuffs;
- }
- public List<int[]> getFighterBuffs() {
- return fighterBuffs;
- }
- }
- // Create a new class BuffUtils.java
- public class BuffUtils {
- public static void applyBuffs(L2PcInstance player, BuffConfig buffConfig) {
- List<int[]> buffs = player.isMageClass() ? buffConfig.getMageBuffs() : buffConfig.getFighterBuffs();
- for (int[] buff : buffs) {
- L2Skill skill = SkillTable.getInstance().getInfo(buff[0], buff[1]);
- if (skill != null) {
- skill.getEffects(player, player, false, false, false);
- SystemMessage sm = new SystemMessage(SystemMessageId.YOU_FEEL_S1_EFFECT);
- sm.addSkillName(buff[0]);
- player.sendPacket(sm);
- } else {
- LOGGER.warn("Skill not found for Buff ID: " + buff[0] + " Level: " + buff[1]);
- }
- }
- }
- }
- // Config.java
- public static BuffConfig TVT_BUFF_CONFIG;
- public static BuffConfig CTF_BUFF_CONFIG;
- public static BuffConfig DM_BUFF_CONFIG;
- TVT_BUFF_CONFIG = new BuffConfig(
- p.getProperty("TvTBuffsMage", "1204,2"),
- p.getProperty("TvTBuffsFighter", "1204,2")
- );
- CTF_BUFF_CONFIG = new BuffConfig(
- p.getProperty("CTFBuffsMage", "1204,2"),
- p.getProperty("CTFBuffsFighter", "1204,2")
- );
- DM_BUFF_CONFIG = new BuffConfig(
- p.getProperty("DMBuffsMage", "1204,2"),
- p.getProperty("DMBuffsFighter", "1204,2")
- );
- // TVT.java, CTF.java, DM.java
- if (Config.TVT_ON_START_REMOVE_ALL_EFFECTS) {
- player.stopAllEffects();
- }
- // Calling the common method from BuffUtils to apply the buffs.
- BuffUtils.applyBuffs(player, Config.TVT_BUFF_CONFIG);
- # ----------------------------------------
- # 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;
Advertisement
Add Comment
Please, Sign In to add comment