EffectMasterHandler.java 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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.AbortCast;
  25. import handlers.effecthandlers.Betray;
  26. import handlers.effecthandlers.BigHead;
  27. import handlers.effecthandlers.BlockResurrection;
  28. import handlers.effecthandlers.Bluff;
  29. import handlers.effecthandlers.Buff;
  30. import handlers.effecthandlers.Cancel;
  31. import handlers.effecthandlers.CancelAll;
  32. import handlers.effecthandlers.CancelDebuff;
  33. import handlers.effecthandlers.ChameleonRest;
  34. import handlers.effecthandlers.ChanceSkillTrigger;
  35. import handlers.effecthandlers.ChangeFace;
  36. import handlers.effecthandlers.ChangeHairColor;
  37. import handlers.effecthandlers.ChangeHairStyle;
  38. import handlers.effecthandlers.CharmOfCourage;
  39. import handlers.effecthandlers.CharmOfLuck;
  40. import handlers.effecthandlers.ClanGate;
  41. import handlers.effecthandlers.ConfuseMob;
  42. import handlers.effecthandlers.Confusion;
  43. import handlers.effecthandlers.ConsumeBody;
  44. import handlers.effecthandlers.ConvertItem;
  45. import handlers.effecthandlers.CpDamPercent;
  46. import handlers.effecthandlers.CpHeal;
  47. import handlers.effecthandlers.CpHealOverTime;
  48. import handlers.effecthandlers.CpHealPercent;
  49. import handlers.effecthandlers.CrystalGradeModify;
  50. import handlers.effecthandlers.DamOverTime;
  51. import handlers.effecthandlers.DamOverTimePercent;
  52. import handlers.effecthandlers.Debuff;
  53. import handlers.effecthandlers.Disarm;
  54. import handlers.effecthandlers.DispelBySlot;
  55. import handlers.effecthandlers.EnemyCharge;
  56. import handlers.effecthandlers.EnlargeAbnormalSlot;
  57. import handlers.effecthandlers.FakeDeath;
  58. import handlers.effecthandlers.Fear;
  59. import handlers.effecthandlers.Fusion;
  60. import handlers.effecthandlers.GiveSp;
  61. import handlers.effecthandlers.Grow;
  62. import handlers.effecthandlers.Harvesting;
  63. import handlers.effecthandlers.Heal;
  64. import handlers.effecthandlers.HealOverTime;
  65. import handlers.effecthandlers.HealPercent;
  66. import handlers.effecthandlers.Hide;
  67. import handlers.effecthandlers.HpByLevel;
  68. import handlers.effecthandlers.ImmobileBuff;
  69. import handlers.effecthandlers.ImmobilePetBuff;
  70. import handlers.effecthandlers.IncreaseCharges;
  71. import handlers.effecthandlers.Invincible;
  72. import handlers.effecthandlers.ManaDamOverTime;
  73. import handlers.effecthandlers.ManaHeal;
  74. import handlers.effecthandlers.ManaHealByLevel;
  75. import handlers.effecthandlers.ManaHealOverTime;
  76. import handlers.effecthandlers.ManaHealPercent;
  77. import handlers.effecthandlers.MpByLevel;
  78. import handlers.effecthandlers.MpConsumePerLevel;
  79. import handlers.effecthandlers.Mute;
  80. import handlers.effecthandlers.Negate;
  81. import handlers.effecthandlers.NoblesseBless;
  82. import handlers.effecthandlers.Paralyze;
  83. import handlers.effecthandlers.Petrification;
  84. import handlers.effecthandlers.PhoenixBless;
  85. import handlers.effecthandlers.PhysicalAttackMute;
  86. import handlers.effecthandlers.PhysicalMute;
  87. import handlers.effecthandlers.ProtectionBlessing;
  88. import handlers.effecthandlers.RandomizeHate;
  89. import handlers.effecthandlers.RebalanceHP;
  90. import handlers.effecthandlers.Recovery;
  91. import handlers.effecthandlers.Relax;
  92. import handlers.effecthandlers.RemoveTarget;
  93. import handlers.effecthandlers.RestorationRandom;
  94. import handlers.effecthandlers.Root;
  95. import handlers.effecthandlers.ServitorShare;
  96. import handlers.effecthandlers.Signet;
  97. import handlers.effecthandlers.SignetAntiSummon;
  98. import handlers.effecthandlers.SignetMDam;
  99. import handlers.effecthandlers.SignetNoise;
  100. import handlers.effecthandlers.SilentMove;
  101. import handlers.effecthandlers.Sleep;
  102. import handlers.effecthandlers.Spoil;
  103. import handlers.effecthandlers.Stun;
  104. import handlers.effecthandlers.SummonAgathion;
  105. import handlers.effecthandlers.SummonPet;
  106. import handlers.effecthandlers.Sweeper;
  107. import handlers.effecthandlers.TargetMe;
  108. import handlers.effecthandlers.ThrowUp;
  109. import handlers.effecthandlers.TransferDamage;
  110. import handlers.effecthandlers.Transformation;
  111. import handlers.effecthandlers.UnsummonAgathion;
  112. import handlers.effecthandlers.Warp;
  113. /**
  114. * Effect Master handler.
  115. * @author BiggBoss
  116. */
  117. public final class EffectMasterHandler
  118. {
  119. private static final Logger _log = Logger.getLogger(EffectMasterHandler.class.getName());
  120. private static final Class<?> _loadInstances = EffectHandler.class;
  121. private static final Class<?>[] _effects =
  122. {
  123. AbortCast.class,
  124. RebalanceHP.class,
  125. Betray.class,
  126. BigHead.class,
  127. BlockResurrection.class,
  128. Bluff.class,
  129. Buff.class,
  130. Cancel.class,
  131. CancelAll.class,
  132. CancelDebuff.class,
  133. ChameleonRest.class,
  134. ChanceSkillTrigger.class,
  135. ChangeFace.class,
  136. ChangeHairColor.class,
  137. ChangeHairStyle.class,
  138. CharmOfCourage.class,
  139. CharmOfLuck.class,
  140. ClanGate.class,
  141. ConfuseMob.class,
  142. Confusion.class,
  143. ConsumeBody.class,
  144. ConvertItem.class,
  145. CpHeal.class,
  146. CpHealOverTime.class,
  147. CpHealPercent.class,
  148. CrystalGradeModify.class,
  149. CpDamPercent.class,
  150. DamOverTime.class,
  151. DamOverTimePercent.class,
  152. Debuff.class,
  153. DispelBySlot.class,
  154. Disarm.class,
  155. EnemyCharge.class,
  156. EnlargeAbnormalSlot.class,
  157. FakeDeath.class,
  158. Fear.class,
  159. Fusion.class,
  160. GiveSp.class,
  161. Grow.class,
  162. Harvesting.class,
  163. HealOverTime.class,
  164. HealPercent.class,
  165. Heal.class,
  166. Hide.class,
  167. HpByLevel.class,
  168. ImmobileBuff.class,
  169. IncreaseCharges.class,
  170. ImmobilePetBuff.class,
  171. Invincible.class,
  172. ManaDamOverTime.class,
  173. ManaHeal.class,
  174. ManaHealByLevel.class,
  175. ManaHealOverTime.class,
  176. ManaHealPercent.class,
  177. MpByLevel.class,
  178. MpConsumePerLevel.class,
  179. Mute.class,
  180. Negate.class,
  181. NoblesseBless.class,
  182. Paralyze.class,
  183. Petrification.class,
  184. PhoenixBless.class,
  185. PhysicalAttackMute.class,
  186. PhysicalMute.class,
  187. ProtectionBlessing.class,
  188. RandomizeHate.class,
  189. Recovery.class,
  190. Relax.class,
  191. RemoveTarget.class,
  192. RestorationRandom.class,
  193. Root.class,
  194. ServitorShare.class,
  195. Signet.class,
  196. SignetAntiSummon.class,
  197. SignetMDam.class,
  198. SignetNoise.class,
  199. SilentMove.class,
  200. Sleep.class,
  201. Spoil.class,
  202. Stun.class,
  203. SummonAgathion.class,
  204. SummonPet.class,
  205. Sweeper.class,
  206. TargetMe.class,
  207. ThrowUp.class,
  208. TransferDamage.class,
  209. Transformation.class,
  210. UnsummonAgathion.class,
  211. Warp.class,
  212. };
  213. public static void main(String[] args)
  214. {
  215. Object loadInstance = null;
  216. Method method = null;
  217. try
  218. {
  219. method = _loadInstances.getMethod("getInstance");
  220. loadInstance = method.invoke(_loadInstances);
  221. }
  222. catch (Exception e)
  223. {
  224. _log.log(Level.WARNING, "Failed invoking getInstance method for handler: " + _loadInstances.getSimpleName(), e);
  225. return;
  226. }
  227. method = null; // Releasing variable for next method
  228. for (Class<?> c : _effects)
  229. {
  230. try
  231. {
  232. if (c == null)
  233. {
  234. continue; // Disabled handler
  235. }
  236. if (method == null)
  237. {
  238. method = loadInstance.getClass().getMethod("registerHandler", Class.class);
  239. }
  240. method.invoke(loadInstance, c);
  241. }
  242. catch (Exception e)
  243. {
  244. _log.log(Level.WARNING, "Failed loading effect handler" + ((c == null) ? "!" : ":" + c.getSimpleName()), e);
  245. continue;
  246. }
  247. }
  248. // And lets try get size
  249. try
  250. {
  251. method = loadInstance.getClass().getMethod("size");
  252. Object returnVal = method.invoke(loadInstance);
  253. _log.log(Level.INFO, loadInstance.getClass().getSimpleName() + ": Loaded " + returnVal + " Handlers");
  254. }
  255. catch (Exception e)
  256. {
  257. _log.log(Level.WARNING, "Failed invoking size method for handler: " + loadInstance.getClass().getSimpleName(), e);
  258. }
  259. }
  260. }