Advertisement
Sarada-L2

Remove itens ao trocar Subclass Acis 394+

Feb 28th, 2021
547
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.04 KB | None | 0 0
  1. diff --git a/config/CustomMods/ProtectionMods.ini b/config/CustomMods/ProtectionMods.ini
  2. index a877b86..e0a8097 100644
  3. --- a/config/CustomMods/ProtectionMods.ini
  4. +++ b/config/CustomMods/ProtectionMods.ini
  5. @@ -66,3 +66,12 @@
  6. # Show screen AntiHervy message for x seconds when character
  7. ScreenAntiHervyMessageTime = 4
  8.  
  9. +#=============================================================
  10. +# Remover itens SubClasse
  11. +#=============================================================
  12. +# When you change/add subclass the item is unequipped
  13. +# Default: False
  14. +RemoveWeapon = True
  15. +RemoveChest = True
  16. +RemoveLeg = True
  17. +
  18. diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java
  19. index 055f23e..99cc0ee 100644
  20. --- a/java/net/sf/l2j/Config.java
  21. +++ b/java/net/sf/l2j/Config.java
  22. @@ -88,6 +88,9 @@
  23. public static boolean ENABLE_ANTI_HEAVY;
  24. public static String WELCOME_MESSAGE_ANTIHERVY;
  25. public static int WELCOME_MESSAGE_TIME_ANTIHERVY;
  26. + public static boolean REMOVE_WEAPON;
  27. + public static boolean REMOVE_CHEST;
  28. + public static boolean REMOVE_LEG;
  29. public static long CH_TELE_FEE_RATIO;
  30. public static int CH_TELE1_FEE;
  31. public static int CH_TELE2_FEE;
  32. @@ -1129,6 +1132,9 @@
  33. ENABLE_ANTI_HEAVY = Boolean.parseBoolean(Protection.getProperty("EnableAntiHeavySystem", "True"));
  34. WELCOME_MESSAGE_ANTIHERVY = Protection.getProperty("ScreenAntiHervyMessageText", "Your Class Can't Equip Heavy Type Armors!");
  35. WELCOME_MESSAGE_TIME_ANTIHERVY = Integer.parseInt(Protection.getProperty("ScreenAntiHervyMessageTime", "6")) * 1000;
  36. + REMOVE_WEAPON = Boolean.parseBoolean(Protection.getProperty("RemoveWeapon", "False"));
  37. + REMOVE_CHEST = Boolean.parseBoolean(Protection.getProperty("RemoveChest", "False"));
  38. + REMOVE_LEG = Boolean.parseBoolean(Protection.getProperty("RemoveLeg", "False"));
  39. }
  40.  
  41. private static final void loadOff()
  42. diff --git a/java/net/sf/l2j/gameserver/model/actor/Player.java b/java/net/sf/l2j/gameserver/model/actor/Player.java
  43. index 418fd3f..2b2e9e2 100644
  44. --- a/java/net/sf/l2j/gameserver/model/actor/Player.java
  45. +++ b/java/net/sf/l2j/gameserver/model/actor/Player.java
  46. @@ -5835,6 +5835,47 @@
  47. */
  48. public boolean addSubClass(int classId, int classIndex)
  49. {
  50. + // Remove Item RHAND
  51. + if (Config.REMOVE_WEAPON)
  52. + {
  53. + ItemInstance rhand = getInventory().getItemFrom(Paperdoll.RHAND);
  54. + if (rhand != null)
  55. + {
  56. + ItemInstance[] unequipped = getInventory().unequipItemInBodySlotAndRecord(rhand.getItem().getBodyPart());
  57. + InventoryUpdate iu = new InventoryUpdate();
  58. + for (ItemInstance element : unequipped)
  59. + iu.addModifiedItem(element);
  60. + sendPacket(iu);
  61. + }
  62. + }
  63. + // Remove Item CHEST
  64. + if (Config.REMOVE_CHEST)
  65. + {
  66. + ItemInstance chest = getInventory().getItemFrom(Paperdoll.CHEST);
  67. + if (chest != null)
  68. + {
  69. + ItemInstance[] unequipped = getInventory().unequipItemInBodySlotAndRecord(chest.getItem().getBodyPart());
  70. + InventoryUpdate iu = new InventoryUpdate();
  71. + for (ItemInstance element : unequipped)
  72. + iu.addModifiedItem(element);
  73. + sendPacket(iu);
  74. + }
  75. + }
  76. +
  77. + // Remove Item LEG
  78. + if (Config.REMOVE_LEG)
  79. + {
  80. + ItemInstance legs = getInventory().getItemFrom(Paperdoll.LEGS);
  81. + if (legs != null)
  82. + {
  83. + ItemInstance[] unequipped = getInventory().unequipItemInBodySlotAndRecord(legs.getItem().getBodyPart());
  84. + InventoryUpdate iu = new InventoryUpdate();
  85. + for (ItemInstance element : unequipped)
  86. + iu.addModifiedItem(element);
  87. + sendPacket(iu);
  88. + }
  89. + }
  90. +
  91. if (!_subclassLock.tryLock())
  92. return false;
  93.  
  94. @@ -5992,6 +6033,48 @@
  95. */
  96. public boolean setActiveClass(int classIndex)
  97. {
  98. +
  99. + // Remove Item RHAND
  100. + if (Config.REMOVE_WEAPON)
  101. + {
  102. + ItemInstance rhand = getInventory().getItemFrom(Paperdoll.RHAND);
  103. + if (rhand != null)
  104. + {
  105. + ItemInstance[] unequipped = getInventory().unequipItemInBodySlotAndRecord(rhand.getItem().getBodyPart());
  106. + InventoryUpdate iu = new InventoryUpdate();
  107. + for (ItemInstance element : unequipped)
  108. + iu.addModifiedItem(element);
  109. + sendPacket(iu);
  110. + }
  111. + }
  112. + // Remove Item CHEST
  113. + if (Config.REMOVE_CHEST)
  114. + {
  115. + ItemInstance chest = getInventory().getItemFrom(Paperdoll.CHEST);
  116. + if (chest != null)
  117. + {
  118. + ItemInstance[] unequipped = getInventory().unequipItemInBodySlotAndRecord(chest.getItem().getBodyPart());
  119. + InventoryUpdate iu = new InventoryUpdate();
  120. + for (ItemInstance element : unequipped)
  121. + iu.addModifiedItem(element);
  122. + sendPacket(iu);
  123. + }
  124. + }
  125. +
  126. + // Remove Item LEG
  127. + if (Config.REMOVE_LEG)
  128. + {
  129. + ItemInstance legs = getInventory().getItemFrom(Paperdoll.LEGS);
  130. + if (legs != null)
  131. + {
  132. + ItemInstance[] unequipped = getInventory().unequipItemInBodySlotAndRecord(legs.getItem().getBodyPart());
  133. + InventoryUpdate iu = new InventoryUpdate();
  134. + for (ItemInstance element : unequipped)
  135. + iu.addModifiedItem(element);
  136. + sendPacket(iu);
  137. + }
  138. + }
  139. +
  140. if (!_subclassLock.tryLock())
  141. return false;
  142.  
  143.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement