L2PcTemplate.java 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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.chars;
  16. import java.util.List;
  17. import com.l2jserver.gameserver.model.base.ClassId;
  18. import com.l2jserver.gameserver.model.base.Race;
  19. import com.l2jserver.gameserver.templates.StatsSet;
  20. import javolution.util.FastList;
  21. /**
  22. * @author mkizub
  23. */
  24. public class L2PcTemplate extends L2CharTemplate
  25. {
  26. /** The Class object of the L2PcInstance */
  27. public final ClassId classId;
  28. public final Race race;
  29. public final String className;
  30. public final int spawnX;
  31. public final int spawnY;
  32. public final int spawnZ;
  33. public final int classBaseLevel;
  34. public final float lvlHpAdd;
  35. public final float lvlHpMod;
  36. public final float lvlCpAdd;
  37. public final float lvlCpMod;
  38. public final float lvlMpAdd;
  39. public final float lvlMpMod;
  40. public final double fCollisionHeight_female;
  41. public final double fCollisionRadius_female;
  42. private List<PcTemplateItem> _items = new FastList<PcTemplateItem>();
  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. fCollisionRadius_female = set.getDouble("collision_radius_female");
  60. fCollisionHeight_female = set.getDouble("collision_height_female");
  61. }
  62. /**
  63. * Adds starter equipment
  64. * @param i
  65. */
  66. public void addItem(int itemId, int amount, boolean equipped)
  67. {
  68. _items.add(new PcTemplateItem(itemId, amount, equipped));
  69. }
  70. /**
  71. *
  72. * @return itemIds of all the starter equipment
  73. */
  74. public List<PcTemplateItem> getItems()
  75. {
  76. return _items;
  77. }
  78. public static final class PcTemplateItem
  79. {
  80. private final int _itemId;
  81. private final int _amount;
  82. private final boolean _equipped;
  83. /**
  84. * @param amount
  85. * @param itemId
  86. */
  87. public PcTemplateItem(int itemId, int amount, boolean equipped)
  88. {
  89. _itemId = itemId;
  90. _amount = amount;
  91. _equipped = equipped;
  92. }
  93. /**
  94. * @return Returns the itemId.
  95. */
  96. public int getItemId()
  97. {
  98. return _itemId;
  99. }
  100. /**
  101. * @return Returns the amount.
  102. */
  103. public int getAmount()
  104. {
  105. return _amount;
  106. }
  107. /**
  108. * @return Returns the if the item should be equipped after char creation.
  109. */
  110. public boolean isEquipped()
  111. {
  112. return _equipped;
  113. }
  114. }
  115. }