Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/config/CustomMods/ProtectionMods.ini b/config/CustomMods/ProtectionMods.ini
- index a877b86..e0a8097 100644
- --- a/config/CustomMods/ProtectionMods.ini
- +++ b/config/CustomMods/ProtectionMods.ini
- @@ -66,3 +66,12 @@
- # Show screen AntiHervy message for x seconds when character
- ScreenAntiHervyMessageTime = 4
- +#=============================================================
- +# Remover itens SubClasse
- +#=============================================================
- +# When you change/add subclass the item is unequipped
- +# Default: False
- +RemoveWeapon = True
- +RemoveChest = True
- +RemoveLeg = True
- +
- diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java
- index 055f23e..99cc0ee 100644
- --- a/java/net/sf/l2j/Config.java
- +++ b/java/net/sf/l2j/Config.java
- @@ -88,6 +88,9 @@
- public static boolean ENABLE_ANTI_HEAVY;
- public static String WELCOME_MESSAGE_ANTIHERVY;
- public static int WELCOME_MESSAGE_TIME_ANTIHERVY;
- + public static boolean REMOVE_WEAPON;
- + public static boolean REMOVE_CHEST;
- + public static boolean REMOVE_LEG;
- public static long CH_TELE_FEE_RATIO;
- public static int CH_TELE1_FEE;
- public static int CH_TELE2_FEE;
- @@ -1129,6 +1132,9 @@
- ENABLE_ANTI_HEAVY = Boolean.parseBoolean(Protection.getProperty("EnableAntiHeavySystem", "True"));
- WELCOME_MESSAGE_ANTIHERVY = Protection.getProperty("ScreenAntiHervyMessageText", "Your Class Can't Equip Heavy Type Armors!");
- WELCOME_MESSAGE_TIME_ANTIHERVY = Integer.parseInt(Protection.getProperty("ScreenAntiHervyMessageTime", "6")) * 1000;
- + REMOVE_WEAPON = Boolean.parseBoolean(Protection.getProperty("RemoveWeapon", "False"));
- + REMOVE_CHEST = Boolean.parseBoolean(Protection.getProperty("RemoveChest", "False"));
- + REMOVE_LEG = Boolean.parseBoolean(Protection.getProperty("RemoveLeg", "False"));
- }
- private static final void loadOff()
- diff --git a/java/net/sf/l2j/gameserver/model/actor/Player.java b/java/net/sf/l2j/gameserver/model/actor/Player.java
- index 418fd3f..2b2e9e2 100644
- --- a/java/net/sf/l2j/gameserver/model/actor/Player.java
- +++ b/java/net/sf/l2j/gameserver/model/actor/Player.java
- @@ -5835,6 +5835,47 @@
- */
- public boolean addSubClass(int classId, int classIndex)
- {
- + // Remove Item RHAND
- + if (Config.REMOVE_WEAPON)
- + {
- + ItemInstance rhand = getInventory().getItemFrom(Paperdoll.RHAND);
- + if (rhand != null)
- + {
- + ItemInstance[] unequipped = getInventory().unequipItemInBodySlotAndRecord(rhand.getItem().getBodyPart());
- + InventoryUpdate iu = new InventoryUpdate();
- + for (ItemInstance element : unequipped)
- + iu.addModifiedItem(element);
- + sendPacket(iu);
- + }
- + }
- + // Remove Item CHEST
- + if (Config.REMOVE_CHEST)
- + {
- + ItemInstance chest = getInventory().getItemFrom(Paperdoll.CHEST);
- + if (chest != null)
- + {
- + ItemInstance[] unequipped = getInventory().unequipItemInBodySlotAndRecord(chest.getItem().getBodyPart());
- + InventoryUpdate iu = new InventoryUpdate();
- + for (ItemInstance element : unequipped)
- + iu.addModifiedItem(element);
- + sendPacket(iu);
- + }
- + }
- +
- + // Remove Item LEG
- + if (Config.REMOVE_LEG)
- + {
- + ItemInstance legs = getInventory().getItemFrom(Paperdoll.LEGS);
- + if (legs != null)
- + {
- + ItemInstance[] unequipped = getInventory().unequipItemInBodySlotAndRecord(legs.getItem().getBodyPart());
- + InventoryUpdate iu = new InventoryUpdate();
- + for (ItemInstance element : unequipped)
- + iu.addModifiedItem(element);
- + sendPacket(iu);
- + }
- + }
- +
- if (!_subclassLock.tryLock())
- return false;
- @@ -5992,6 +6033,48 @@
- */
- public boolean setActiveClass(int classIndex)
- {
- +
- + // Remove Item RHAND
- + if (Config.REMOVE_WEAPON)
- + {
- + ItemInstance rhand = getInventory().getItemFrom(Paperdoll.RHAND);
- + if (rhand != null)
- + {
- + ItemInstance[] unequipped = getInventory().unequipItemInBodySlotAndRecord(rhand.getItem().getBodyPart());
- + InventoryUpdate iu = new InventoryUpdate();
- + for (ItemInstance element : unequipped)
- + iu.addModifiedItem(element);
- + sendPacket(iu);
- + }
- + }
- + // Remove Item CHEST
- + if (Config.REMOVE_CHEST)
- + {
- + ItemInstance chest = getInventory().getItemFrom(Paperdoll.CHEST);
- + if (chest != null)
- + {
- + ItemInstance[] unequipped = getInventory().unequipItemInBodySlotAndRecord(chest.getItem().getBodyPart());
- + InventoryUpdate iu = new InventoryUpdate();
- + for (ItemInstance element : unequipped)
- + iu.addModifiedItem(element);
- + sendPacket(iu);
- + }
- + }
- +
- + // Remove Item LEG
- + if (Config.REMOVE_LEG)
- + {
- + ItemInstance legs = getInventory().getItemFrom(Paperdoll.LEGS);
- + if (legs != null)
- + {
- + ItemInstance[] unequipped = getInventory().unequipItemInBodySlotAndRecord(legs.getItem().getBodyPart());
- + InventoryUpdate iu = new InventoryUpdate();
- + for (ItemInstance element : unequipped)
- + iu.addModifiedItem(element);
- + sendPacket(iu);
- + }
- + }
- +
- if (!_subclassLock.tryLock())
- return false;
Add Comment
Please, Sign In to add comment