GMSkillTable.java 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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.L2Skill;
  17. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  18. /**
  19. *
  20. * @author Gnacik
  21. */
  22. public class GMSkillTable
  23. {
  24. private static final L2Skill[] _gmSkills = new L2Skill[34];
  25. private static final int[] _gmSkillsId = { 7029, 7041, 7042, 7043, 7044, 7045, 7046, 7047, 7048, 7049, 7050, 7051, 7052, 7053, 7054, 7055, 7056, 7057, 7058, 7059, 7060, 7061, 7062, 7063, 7064, 7088, 7089, 7090, 7091, 7092, 7093, 7094 ,7095, 7096 };
  26. private GMSkillTable()
  27. {
  28. for (int i = 0; i < _gmSkillsId.length; i++)
  29. {
  30. _gmSkills[i] = SkillTable.getInstance().getInfo(_gmSkillsId[i], 1);
  31. }
  32. }
  33. public static GMSkillTable getInstance()
  34. {
  35. return SingletonHolder._instance;
  36. }
  37. public static L2Skill[] getGMSkills()
  38. {
  39. return _gmSkills;
  40. }
  41. public static boolean isGMSkill(int skillid)
  42. {
  43. for (int id : _gmSkillsId)
  44. {
  45. if (id == skillid)
  46. {
  47. return true;
  48. }
  49. }
  50. return false;
  51. }
  52. public void addSkills(L2PcInstance gmchar)
  53. {
  54. for (L2Skill s : getGMSkills())
  55. {
  56. gmchar.addSkill(s, false); // Don't Save GM skills to database
  57. }
  58. }
  59. @SuppressWarnings("synthetic-access")
  60. private static class SingletonHolder
  61. {
  62. protected static final GMSkillTable _instance = new GMSkillTable();
  63. }
  64. }