RecoBonus.java 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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.entity;
  16. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  17. /**
  18. * @author Gnacik
  19. */
  20. public final class RecoBonus
  21. {
  22. private static final int[][] _recoBonus =
  23. {
  24. {
  25. 25,
  26. 50,
  27. 50,
  28. 50,
  29. 50,
  30. 50,
  31. 50,
  32. 50,
  33. 50,
  34. 50
  35. },
  36. {
  37. 16,
  38. 33,
  39. 50,
  40. 50,
  41. 50,
  42. 50,
  43. 50,
  44. 50,
  45. 50,
  46. 50
  47. },
  48. {
  49. 12,
  50. 25,
  51. 37,
  52. 50,
  53. 50,
  54. 50,
  55. 50,
  56. 50,
  57. 50,
  58. 50
  59. },
  60. {
  61. 10,
  62. 20,
  63. 30,
  64. 40,
  65. 50,
  66. 50,
  67. 50,
  68. 50,
  69. 50,
  70. 50
  71. },
  72. {
  73. 8,
  74. 16,
  75. 25,
  76. 33,
  77. 41,
  78. 50,
  79. 50,
  80. 50,
  81. 50,
  82. 50
  83. },
  84. {
  85. 7,
  86. 14,
  87. 21,
  88. 28,
  89. 35,
  90. 42,
  91. 50,
  92. 50,
  93. 50,
  94. 50
  95. },
  96. {
  97. 6,
  98. 12,
  99. 18,
  100. 25,
  101. 31,
  102. 37,
  103. 43,
  104. 50,
  105. 50,
  106. 50
  107. },
  108. {
  109. 5,
  110. 11,
  111. 16,
  112. 22,
  113. 27,
  114. 33,
  115. 38,
  116. 44,
  117. 50,
  118. 50
  119. },
  120. {
  121. 5,
  122. 10,
  123. 15,
  124. 20,
  125. 25,
  126. 30,
  127. 35,
  128. 40,
  129. 45,
  130. 50
  131. }
  132. };
  133. public static int getRecoBonus(L2PcInstance activeChar)
  134. {
  135. if ((activeChar != null) && activeChar.isOnline())
  136. {
  137. if (activeChar.getRecomHave() == 0)
  138. {
  139. return 0;
  140. }
  141. int _lvl = activeChar.getLevel() / 10;
  142. int _exp = (Math.min(100, activeChar.getRecomHave()) - 1) / 10;
  143. return _recoBonus[_lvl][_exp];
  144. }
  145. return 0;
  146. }
  147. public static double getRecoMultiplier(L2PcInstance activeChar)
  148. {
  149. double _multiplier = 1;
  150. double bonus = getRecoBonus(activeChar);
  151. if (bonus > 0)
  152. {
  153. _multiplier = (1 + (bonus / 100));
  154. }
  155. if (_multiplier < 1)
  156. {
  157. _multiplier = 1;
  158. }
  159. return _multiplier;
  160. }
  161. }