L2PcTemplate.java 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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;
  16. import java.util.List;
  17. import javolution.util.FastList;
  18. import net.sf.l2j.gameserver.datatables.ItemTable;
  19. import net.sf.l2j.gameserver.model.base.ClassId;
  20. import net.sf.l2j.gameserver.model.base.Race;
  21. /**
  22. * @author mkizub
  23. *
  24. * TODO To change the template for this generated type comment go to
  25. * Window - Preferences - Java - Code Style - Code Templates
  26. */
  27. public class L2PcTemplate extends L2CharTemplate {
  28. /** The Class object of the L2PcInstance */
  29. public final ClassId classId;
  30. public final Race race;
  31. public final String className;
  32. public final int spawnX;
  33. public final int spawnY;
  34. public final int spawnZ;
  35. public final int classBaseLevel;
  36. public final float lvlHpAdd;
  37. public final float lvlHpMod;
  38. public final float lvlCpAdd;
  39. public final float lvlCpMod;
  40. public final float lvlMpAdd;
  41. public final float lvlMpMod;
  42. private List<L2Item> _items = new FastList<L2Item>();
  43. public L2PcTemplate(StatsSet set)
  44. {
  45. super(set);
  46. classId = ClassId.values()[set.getInteger("classId")];
  47. race = Race.values()[set.getInteger("raceId")];
  48. className = set.getString("className");
  49. spawnX = set.getInteger("spawnX");
  50. spawnY = set.getInteger("spawnY");
  51. spawnZ = set.getInteger("spawnZ");
  52. classBaseLevel = set.getInteger("classBaseLevel");
  53. lvlHpAdd = set.getFloat("lvlHpAdd");
  54. lvlHpMod = set.getFloat("lvlHpMod");
  55. lvlCpAdd = set.getFloat("lvlCpAdd");
  56. lvlCpMod = set.getFloat("lvlCpMod");
  57. lvlMpAdd = set.getFloat("lvlMpAdd");
  58. lvlMpMod = set.getFloat("lvlMpMod");
  59. }
  60. /**
  61. * add starter equipment
  62. * @param i
  63. */
  64. public void addItem(int itemId)
  65. {
  66. L2Item item = ItemTable.getInstance().getTemplate(itemId);
  67. if (item != null)
  68. _items.add(item);
  69. }
  70. /**
  71. *
  72. * @return itemIds of all the starter equipment
  73. */
  74. public L2Item[] getItems()
  75. {
  76. return _items.toArray(new L2Item[_items.size()]);
  77. }
  78. }