HeroSkillTable.java 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package com.l2jserver.gameserver.datatables;
  16. import com.l2jserver.gameserver.model.skills.L2Skill;
  17. /**
  18. *
  19. * @author BiTi
  20. */
  21. public class HeroSkillTable
  22. {
  23. private static final L2Skill[] _heroSkills = new L2Skill[5];
  24. private static final int[] _heroSkillsId = {395, 396, 1374, 1375, 1376};
  25. private HeroSkillTable()
  26. {
  27. for (int i=0; i<_heroSkillsId.length; i++)
  28. _heroSkills[i] = SkillTable.getInstance().getInfo(_heroSkillsId[i], 1);
  29. }
  30. public static HeroSkillTable getInstance()
  31. {
  32. return SingletonHolder._instance;
  33. }
  34. public static L2Skill[] getHeroSkills()
  35. {
  36. return _heroSkills;
  37. }
  38. public static boolean isHeroSkill(int skillid)
  39. {
  40. /*
  41. * Do not perform checks directly on L2Skill array,
  42. * it will cause errors due to SkillTable not initialized
  43. */
  44. for (int id : _heroSkillsId)
  45. {
  46. if (id == skillid)
  47. return true;
  48. }
  49. return false;
  50. }
  51. @SuppressWarnings("synthetic-access")
  52. private static class SingletonHolder
  53. {
  54. protected static final HeroSkillTable _instance = new HeroSkillTable();
  55. }
  56. }