RecoBonus.java 1.9 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.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. { 25, 50, 50, 50, 50, 50, 50, 50, 50, 50 },
  24. { 16, 33, 50, 50, 50, 50, 50, 50, 50, 50 },
  25. { 12, 25, 37, 50, 50, 50, 50, 50, 50, 50 },
  26. { 10, 20, 30, 40, 50, 50, 50, 50, 50, 50 },
  27. { 8, 16, 25, 33, 41, 50, 50, 50, 50, 50 },
  28. { 7, 14, 21, 28, 35, 42, 50, 50, 50, 50 },
  29. { 6, 12, 18, 25, 31, 37, 43, 50, 50, 50 },
  30. { 5, 11, 16, 22, 27, 33, 38, 44, 50, 50 },
  31. { 5, 10, 15, 20, 25, 30, 35, 40, 45, 50 }
  32. };
  33. public static int getRecoBonus(L2PcInstance activeChar)
  34. {
  35. if (activeChar != null && activeChar.isOnline())
  36. {
  37. if (activeChar.getRecomHave() == 0)
  38. return 0;
  39. int _lvl = activeChar.getLevel() / 10;
  40. int _exp = (Math.min(100, activeChar.getRecomHave()) - 1) / 10;
  41. return _recoBonus[_lvl][_exp];
  42. }
  43. return 0;
  44. }
  45. public static double getRecoMultiplier(L2PcInstance activeChar)
  46. {
  47. double _multiplier = 1;
  48. double bonus = getRecoBonus(activeChar);
  49. if(bonus > 0)
  50. _multiplier = (1 + (bonus / 100));
  51. if(_multiplier < 1)
  52. _multiplier = 1;
  53. return _multiplier;
  54. }
  55. }