EffectMasterHandler.java 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. /*
  2. * Copyright (C) 2004-2013 L2J DataPack
  3. *
  4. * This file is part of L2J DataPack.
  5. *
  6. * L2J DataPack is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J DataPack is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package handlers;
  20. import java.lang.reflect.Method;
  21. import java.util.logging.Level;
  22. import java.util.logging.Logger;
  23. import com.l2jserver.gameserver.handler.EffectHandler;
  24. import handlers.effecthandlers.*;
  25. /**
  26. * Effect Master handler.
  27. * @author BiggBoss
  28. */
  29. public final class EffectMasterHandler
  30. {
  31. private static final Logger _log = Logger.getLogger(EffectMasterHandler.class.getName());
  32. private static final Class<?> LOAD_INSTANCES = EffectHandler.class;
  33. private static final Class<?>[] EFFECTS =
  34. {
  35. AbortCast.class,
  36. RebalanceHP.class,
  37. Betray.class,
  38. BigHead.class,
  39. BlockBuffSlot.class,
  40. BlockResurrection.class,
  41. Bluff.class,
  42. Buff.class,
  43. Cancel.class,
  44. CancelAll.class,
  45. CancelDebuff.class,
  46. ChameleonRest.class,
  47. ChanceSkillTrigger.class,
  48. ChangeFace.class,
  49. ChangeFishingMastery.class,
  50. ChangeHairColor.class,
  51. ChangeHairStyle.class,
  52. CharmOfCourage.class,
  53. CharmOfLuck.class,
  54. ClanGate.class,
  55. Confusion.class,
  56. ConsumeBody.class,
  57. ConvertItem.class,
  58. CpDamPercent.class,
  59. CpHeal.class,
  60. CpHealOverTime.class,
  61. CpHealPercent.class,
  62. CrystalGradeModify.class,
  63. CpDamPercent.class,
  64. DamOverTime.class,
  65. DamOverTimePercent.class,
  66. DeathLink.class,
  67. Debuff.class,
  68. DispelBySlot.class,
  69. Disarm.class,
  70. EnemyCharge.class,
  71. EnergyAttack.class,
  72. EnlargeAbnormalSlot.class,
  73. Escape.class,
  74. FakeDeath.class,
  75. FatalBlow.class,
  76. Fear.class,
  77. FocusEnergy.class,
  78. FocusMaxEnergy.class,
  79. FocusSouls.class,
  80. Fusion.class,
  81. GiveSp.class,
  82. Grow.class,
  83. Harvesting.class,
  84. HealOverTime.class,
  85. HealPercent.class,
  86. Heal.class,
  87. Hide.class,
  88. HpByLevel.class,
  89. HpDrain.class,
  90. ImmobileBuff.class,
  91. ImmobilePetBuff.class,
  92. Invincible.class,
  93. Lethal.class,
  94. Lucky.class,
  95. MagicalAttack.class,
  96. MagicalAttackMp.class,
  97. MagicalSoulAttack.class,
  98. ManaDamOverTime.class,
  99. ManaHeal.class,
  100. ManaHealByLevel.class,
  101. ManaHealOverTime.class,
  102. ManaHealPercent.class,
  103. MpByLevel.class,
  104. MpConsumePerLevel.class,
  105. Mute.class,
  106. NoblesseBless.class,
  107. NpcKill.class,
  108. OpenCommonRecipeBook.class,
  109. OpenDwarfRecipeBook.class,
  110. Paralyze.class,
  111. Petrification.class,
  112. PhoenixBless.class,
  113. PhysicalAttack.class,
  114. PhysicalAttackHpLink.class,
  115. PhysicalAttackMute.class,
  116. PhysicalMute.class,
  117. PhysicalSoulAttack.class,
  118. ProtectionBlessing.class,
  119. RandomizeHate.class,
  120. Recovery.class,
  121. Relax.class,
  122. RemoveTarget.class,
  123. Restoration.class,
  124. RestorationRandom.class,
  125. Root.class,
  126. ServitorShare.class,
  127. SetSkill.class,
  128. Signet.class,
  129. SignetAntiSummon.class,
  130. SignetMDam.class,
  131. SignetNoise.class,
  132. SilentMove.class,
  133. Sleep.class,
  134. SoulBlow.class,
  135. Spoil.class,
  136. StaticDamage.class,
  137. StealAbnormal.class,
  138. Stun.class,
  139. SummonAgathion.class,
  140. SummonNpc.class,
  141. SummonPet.class,
  142. SummonTrap.class,
  143. Sweeper.class,
  144. TargetMe.class,
  145. Teleport.class,
  146. ThrowUp.class,
  147. TransferDamage.class,
  148. Transformation.class,
  149. UnsummonAgathion.class,
  150. VitalityPointUp.class,
  151. Warp.class,
  152. };
  153. public static void main(String[] args)
  154. {
  155. Object loadInstance = null;
  156. Method method = null;
  157. try
  158. {
  159. method = LOAD_INSTANCES.getMethod("getInstance");
  160. loadInstance = method.invoke(LOAD_INSTANCES);
  161. }
  162. catch (Exception e)
  163. {
  164. _log.log(Level.WARNING, "Failed invoking getInstance method for handler: " + LOAD_INSTANCES.getSimpleName(), e);
  165. return;
  166. }
  167. method = null; // Releasing variable for next method
  168. for (Class<?> c : EFFECTS)
  169. {
  170. if (c == null)
  171. {
  172. continue; // Disabled handler
  173. }
  174. try
  175. {
  176. if (method == null)
  177. {
  178. method = loadInstance.getClass().getMethod("registerHandler", Class.class);
  179. }
  180. method.invoke(loadInstance, c);
  181. }
  182. catch (Exception e)
  183. {
  184. _log.log(Level.WARNING, "Failed loading effect handler: " + c.getSimpleName(), e);
  185. continue;
  186. }
  187. }
  188. // And lets try get size
  189. try
  190. {
  191. method = loadInstance.getClass().getMethod("size");
  192. Object returnVal = method.invoke(loadInstance);
  193. _log.log(Level.INFO, loadInstance.getClass().getSimpleName() + ": Loaded " + returnVal + " Handlers");
  194. }
  195. catch (Exception e)
  196. {
  197. _log.log(Level.WARNING, "Failed invoking size method for handler: " + loadInstance.getClass().getSimpleName(), e);
  198. }
  199. }
  200. }