EffectMasterHandler.java 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  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. Backstab.class,
  37. Betray.class,
  38. BigHead.class,
  39. BlockBuffSlot.class,
  40. BlockResurrection.class,
  41. Bluff.class,
  42. Buff.class,
  43. CallParty.class,
  44. CallPc.class,
  45. ChameleonRest.class,
  46. ChanceSkillTrigger.class,
  47. ChangeFace.class,
  48. ChangeFishingMastery.class,
  49. ChangeHairColor.class,
  50. ChangeHairStyle.class,
  51. CharmOfCourage.class,
  52. CharmOfLuck.class,
  53. ClanGate.class,
  54. Confusion.class,
  55. ConsumeBody.class,
  56. ConvertItem.class,
  57. CpDamPercent.class,
  58. CpHeal.class,
  59. CpHealOverTime.class,
  60. CpHealPercent.class,
  61. CrystalGradeModify.class,
  62. CpDamPercent.class,
  63. CubicMastery.class,
  64. DamOverTime.class,
  65. DamOverTimePercent.class,
  66. DeathLink.class,
  67. Debuff.class,
  68. Disarm.class,
  69. DispelAll.class,
  70. DispelByCategory.class,
  71. DispelBySlot.class,
  72. DispelBySlotProbability.class,
  73. EnemyCharge.class,
  74. EnergyAttack.class,
  75. EnlargeAbnormalSlot.class,
  76. Escape.class,
  77. FakeDeath.class,
  78. FatalBlow.class,
  79. Fear.class,
  80. FocusEnergy.class,
  81. FocusMaxEnergy.class,
  82. FocusSouls.class,
  83. Fusion.class,
  84. GiveSp.class,
  85. Grow.class,
  86. Harvesting.class,
  87. HealOverTime.class,
  88. HealPercent.class,
  89. Heal.class,
  90. Hide.class,
  91. HpByLevel.class,
  92. HpDrain.class,
  93. ImmobileBuff.class,
  94. ImmobilePetBuff.class,
  95. Invincible.class,
  96. Lethal.class,
  97. Lucky.class,
  98. MagicalAttack.class,
  99. MagicalAttackMp.class,
  100. MagicalSoulAttack.class,
  101. ManaDamOverTime.class,
  102. ManaHeal.class,
  103. ManaHealByLevel.class,
  104. ManaHealOverTime.class,
  105. ManaHealPercent.class,
  106. MpByLevel.class,
  107. MpConsumePerLevel.class,
  108. Mute.class,
  109. NoblesseBless.class,
  110. NpcKill.class,
  111. OpenCommonRecipeBook.class,
  112. OpenDwarfRecipeBook.class,
  113. Paralyze.class,
  114. Petrification.class,
  115. PhoenixBless.class,
  116. PhysicalAttack.class,
  117. PhysicalAttackHpLink.class,
  118. PhysicalAttackMute.class,
  119. PhysicalMute.class,
  120. PhysicalSoulAttack.class,
  121. ProtectionBlessing.class,
  122. RandomizeHate.class,
  123. RebalanceHP.class,
  124. Recovery.class,
  125. Relax.class,
  126. RemoveTarget.class,
  127. Restoration.class,
  128. RestorationRandom.class,
  129. Root.class,
  130. ServitorShare.class,
  131. SetSkill.class,
  132. Signet.class,
  133. SignetAntiSummon.class,
  134. SignetMDam.class,
  135. SignetNoise.class,
  136. SilentMove.class,
  137. Sleep.class,
  138. SoulBlow.class,
  139. Spoil.class,
  140. StaticDamage.class,
  141. StealAbnormal.class,
  142. Stun.class,
  143. SummonAgathion.class,
  144. SummonCubic.class,
  145. SummonNpc.class,
  146. SummonPet.class,
  147. SummonTrap.class,
  148. Sweeper.class,
  149. TargetMe.class,
  150. Teleport.class,
  151. TeleportToTarget.class,
  152. ThrowUp.class,
  153. TransferDamage.class,
  154. Transformation.class,
  155. UnsummonAgathion.class,
  156. VitalityPointUp.class,
  157. Warp.class,
  158. };
  159. public static void main(String[] args)
  160. {
  161. Object loadInstance = null;
  162. Method method = null;
  163. try
  164. {
  165. method = LOAD_INSTANCES.getMethod("getInstance");
  166. loadInstance = method.invoke(LOAD_INSTANCES);
  167. }
  168. catch (Exception e)
  169. {
  170. _log.log(Level.WARNING, "Failed invoking getInstance method for handler: " + LOAD_INSTANCES.getSimpleName(), e);
  171. return;
  172. }
  173. method = null; // Releasing variable for next method
  174. for (Class<?> c : EFFECTS)
  175. {
  176. if (c == null)
  177. {
  178. continue; // Disabled handler
  179. }
  180. try
  181. {
  182. if (method == null)
  183. {
  184. method = loadInstance.getClass().getMethod("registerHandler", Class.class);
  185. }
  186. method.invoke(loadInstance, c);
  187. }
  188. catch (Exception e)
  189. {
  190. _log.log(Level.WARNING, "Failed loading effect handler: " + c.getSimpleName(), e);
  191. continue;
  192. }
  193. }
  194. // And lets try get size
  195. try
  196. {
  197. method = loadInstance.getClass().getMethod("size");
  198. Object returnVal = method.invoke(loadInstance);
  199. _log.log(Level.INFO, loadInstance.getClass().getSimpleName() + ": Loaded " + returnVal + " Handlers");
  200. }
  201. catch (Exception e)
  202. {
  203. _log.log(Level.WARNING, "Failed invoking size method for handler: " + loadInstance.getClass().getSimpleName(), e);
  204. }
  205. }
  206. }