L2Seed.java 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Copyright (C) 2004-2014 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 com.l2jserver.Config;
  21. public class L2Seed
  22. {
  23. private final int _seedId;
  24. private final int _cropId; // crop type
  25. private final int _level; // seed level
  26. private final int _matureId; // mature crop type
  27. private final int _reward1;
  28. private final int _reward2;
  29. private final int _castleId; // id of manor (castle id) where seed can be farmed
  30. private final boolean _isAlternative;
  31. private final int _limitSeeds;
  32. private final int _limitCrops;
  33. public L2Seed(StatsSet set)
  34. {
  35. _cropId = set.getInt("id");
  36. _seedId = set.getInt("seedId");
  37. _level = set.getInt("level");
  38. _matureId = set.getInt("mature_Id");
  39. _reward1 = set.getInt("reward1");
  40. _reward2 = set.getInt("reward2");
  41. _castleId = set.getInt("castleId");
  42. _isAlternative = set.getBoolean("alternative");
  43. _limitCrops = set.getInt("limit_crops");
  44. _limitSeeds = set.getInt("limit_seed");
  45. }
  46. public int getCastleId()
  47. {
  48. return _castleId;
  49. }
  50. public int getSeedId()
  51. {
  52. return _seedId;
  53. }
  54. public int getCropId()
  55. {
  56. return _cropId;
  57. }
  58. public int getMatureId()
  59. {
  60. return _matureId;
  61. }
  62. public int getReward(int type)
  63. {
  64. return (type == 1 ? _reward1 : _reward2);
  65. }
  66. public int getLevel()
  67. {
  68. return _level;
  69. }
  70. public boolean isAlternative()
  71. {
  72. return _isAlternative;
  73. }
  74. public int getSeedLimit()
  75. {
  76. return _limitSeeds * Config.RATE_DROP_MANOR;
  77. }
  78. public int getCropLimit()
  79. {
  80. return _limitCrops * Config.RATE_DROP_MANOR;
  81. }
  82. @Override
  83. public String toString()
  84. {
  85. return "SeedData [_id=" + _seedId + ", _level=" + _level + ", _crop=" + _cropId + ", _mature=" + _matureId + ", _type1=" + _reward1 + ", _type2=" + _reward2 + ", _manorId=" + _castleId + ", _isAlternative=" + _isAlternative + ", _limitSeeds=" + _limitSeeds + ", _limitCrops=" + _limitCrops + "]";
  86. }
  87. }