L2EtcItem.java 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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.templates.item;
  16. import com.l2jserver.gameserver.templates.StatsSet;
  17. /**
  18. * This class is dedicated to the management of EtcItem.
  19. *
  20. * @version $Revision: 1.2.2.1.2.3 $ $Date: 2005/03/27 15:30:10 $
  21. */
  22. public final class L2EtcItem extends L2Item
  23. {
  24. private final String[] _skill;
  25. private final String _handler;
  26. /**
  27. * Constructor for EtcItem.
  28. * @see L2Item constructor
  29. * @param type : L2EtcItemType designating the type of object Etc
  30. * @param set : StatsSet designating the set of couples (key,value) for description of the Etc
  31. */
  32. public L2EtcItem(L2EtcItemType type, StatsSet set)
  33. {
  34. super(type, set);
  35. _skill = set.getString("skill").split(";");
  36. _handler = set.getString("handler");
  37. }
  38. /**
  39. * Returns the type of Etc Item
  40. * @return L2EtcItemType
  41. */
  42. @Override
  43. public L2EtcItemType getItemType()
  44. {
  45. return (L2EtcItemType)super._type;
  46. }
  47. /**
  48. * Returns if the item is consumable
  49. * @return boolean
  50. */
  51. @Override
  52. public final boolean isConsumable()
  53. {
  54. return ((getItemType() == L2EtcItemType.SHOT) || (getItemType() == L2EtcItemType.POTION)); // || (type == L2EtcItemType.SCROLL));
  55. }
  56. /**
  57. * Returns the ID of the Etc item after applying the mask.
  58. * @return int : ID of the EtcItem
  59. */
  60. @Override
  61. public int getItemMask()
  62. {
  63. return getItemType().mask();
  64. }
  65. /**
  66. * Returns skills linked to that EtcItem
  67. * @return
  68. */
  69. public String[] getSkills()
  70. {
  71. return _skill;
  72. }
  73. public String getHandlerName()
  74. {
  75. return _handler;
  76. }
  77. }