2
0

L2EtcItem.java 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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 net.sf.l2j.gameserver.templates.item;
  16. import net.sf.l2j.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. /**
  26. * Constructor for EtcItem.
  27. * @see L2Item constructor
  28. * @param type : L2EtcItemType designating the type of object Etc
  29. * @param set : StatsSet designating the set of couples (key,value) for description of the Etc
  30. */
  31. public L2EtcItem(L2EtcItemType type, StatsSet set)
  32. {
  33. super(type, set);
  34. _skill = set.getString("skill").split(";");
  35. }
  36. /**
  37. * Returns the type of Etc Item
  38. * @return L2EtcItemType
  39. */
  40. @Override
  41. public L2EtcItemType getItemType()
  42. {
  43. return (L2EtcItemType)super._type;
  44. }
  45. /**
  46. * Returns if the item is consumable
  47. * @return boolean
  48. */
  49. @Override
  50. public final boolean isConsumable()
  51. {
  52. return ((getItemType() == L2EtcItemType.SHOT) || (getItemType() == L2EtcItemType.POTION)); // || (type == L2EtcItemType.SCROLL));
  53. }
  54. /**
  55. * Returns the ID of the Etc item after applying the mask.
  56. * @return int : ID of the EtcItem
  57. */
  58. @Override
  59. public int getItemMask()
  60. {
  61. return getItemType().mask();
  62. }
  63. /**
  64. * Returns skills linked to that EtcItem
  65. * @return
  66. */
  67. public String[] getSkills()
  68. {
  69. return _skill;
  70. }
  71. }