L2EnchantSkillGroup.java 2.3 KB

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