L2EnchantSkillGroup.java 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * Copyright (C) 2004-2013 L2J Server
  3. *
  4. * This file is part of L2J Server.
  5. *
  6. * L2J Server 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 Server 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 com.l2jserver.gameserver.model;
  20. import java.util.ArrayList;
  21. import java.util.List;
  22. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  23. public final class L2EnchantSkillGroup
  24. {
  25. private final int _id;
  26. private final List<EnchantSkillHolder> _enchantDetails = new ArrayList<>();
  27. public L2EnchantSkillGroup(int id)
  28. {
  29. _id = id;
  30. }
  31. public void addEnchantDetail(EnchantSkillHolder detail)
  32. {
  33. _enchantDetails.add(detail);
  34. }
  35. public int getId()
  36. {
  37. return _id;
  38. }
  39. public List<EnchantSkillHolder> getEnchantGroupDetails()
  40. {
  41. return _enchantDetails;
  42. }
  43. public static class EnchantSkillHolder
  44. {
  45. private final int _level;
  46. private final int _adenaCost;
  47. private final int _expCost;
  48. private final int _spCost;
  49. private final byte[] _rate;
  50. public EnchantSkillHolder(StatsSet set)
  51. {
  52. _level = set.getInt("level");
  53. _adenaCost = set.getInt("adena");
  54. _expCost = set.getInt("exp");
  55. _spCost = set.getInt("sp");
  56. _rate = new byte[24];
  57. for (int i = 0; i < 24; i++)
  58. {
  59. _rate[i] = set.getByte("chance" + (76 + i), (byte) 0);
  60. }
  61. }
  62. /**
  63. * @return Returns the level.
  64. */
  65. public int getLevel()
  66. {
  67. return _level;
  68. }
  69. /**
  70. * @return Returns the spCost.
  71. */
  72. public int getSpCost()
  73. {
  74. return _spCost;
  75. }
  76. public int getExpCost()
  77. {
  78. return _expCost;
  79. }
  80. public int getAdenaCost()
  81. {
  82. return _adenaCost;
  83. }
  84. public byte getRate(L2PcInstance ply)
  85. {
  86. if (ply.getLevel() < 76)
  87. {
  88. return 0;
  89. }
  90. return _rate[ply.getLevel() - 76];
  91. }
  92. }
  93. }