L2PcTemplate.java 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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 javolution.util.FastList;
  18. import com.l2jserver.gameserver.model.base.ClassId;
  19. import com.l2jserver.gameserver.model.base.Race;
  20. import com.l2jserver.gameserver.templates.StatsSet;
  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 itemId
  65. * @param amount
  66. * @param equipped
  67. */
  68. public void addItem(int itemId, int amount, boolean equipped)
  69. {
  70. _items.add(new PcTemplateItem(itemId, amount, equipped));
  71. }
  72. /**
  73. *
  74. * @return itemIds of all the starter equipment
  75. */
  76. public List<PcTemplateItem> getItems()
  77. {
  78. return _items;
  79. }
  80. public static final class PcTemplateItem
  81. {
  82. private final int _itemId;
  83. private final int _amount;
  84. private final boolean _equipped;
  85. /**
  86. * @param amount
  87. * @param itemId
  88. * @param equipped
  89. */
  90. public PcTemplateItem(int itemId, int amount, boolean equipped)
  91. {
  92. _itemId = itemId;
  93. _amount = amount;
  94. _equipped = equipped;
  95. }
  96. /**
  97. * @return Returns the itemId.
  98. */
  99. public int getItemId()
  100. {
  101. return _itemId;
  102. }
  103. /**
  104. * @return Returns the amount.
  105. */
  106. public int getAmount()
  107. {
  108. return _amount;
  109. }
  110. /**
  111. * @return Returns the if the item should be equipped after char creation.
  112. */
  113. public boolean isEquipped()
  114. {
  115. return _equipped;
  116. }
  117. }
  118. public final int getFallHeight()
  119. {
  120. return 333; // TODO: unhardcode it
  121. }
  122. }