2
0

ClassId.java 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  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.model.base;
  16. /**
  17. * This class defines all classes (ex : human fighter, darkFighter...) that a player can chose.<BR><BR>
  18. *
  19. * Data :<BR><BR>
  20. * <li>id : The Identifier of the class</li>
  21. * <li>isMage : True if the class is a mage class</li>
  22. * <li>race : The race of this class</li>
  23. * <li>parent : The parent ClassId or null if this class is the root</li><BR><BR>
  24. *
  25. * @version $Revision: 1.4.4.4 $ $Date: 2005/03/27 15:29:33 $
  26. *
  27. */
  28. public enum ClassId
  29. {
  30. fighter(0x00, false, Race.Human, null),
  31. warrior(0x01, false, Race.Human, fighter),
  32. gladiator(0x02, false, Race.Human, warrior),
  33. warlord(0x03, false, Race.Human, warrior),
  34. knight(0x04, false, Race.Human, fighter),
  35. paladin(0x05, false, Race.Human, knight),
  36. darkAvenger(0x06, false, Race.Human, knight),
  37. rogue(0x07, false, Race.Human, fighter),
  38. treasureHunter(0x08, false, Race.Human, rogue),
  39. hawkeye(0x09, false, Race.Human, rogue),
  40. mage(0x0a, true, Race.Human, null),
  41. wizard(0x0b, true, Race.Human, mage),
  42. sorceror(0x0c, true, Race.Human, wizard),
  43. necromancer(0x0d, true, Race.Human, wizard),
  44. warlock(0x0e, true, true, Race.Human, wizard),
  45. cleric(0x0f, true, Race.Human, mage),
  46. bishop(0x10, true, Race.Human, cleric),
  47. prophet(0x11, true, Race.Human, cleric),
  48. elvenFighter(0x12, false, Race.Elf, null),
  49. elvenKnight(0x13, false, Race.Elf, elvenFighter),
  50. templeKnight(0x14, false, Race.Elf, elvenKnight),
  51. swordSinger(0x15, false, Race.Elf, elvenKnight),
  52. elvenScout(0x16, false, Race.Elf, elvenFighter),
  53. plainsWalker(0x17, false, Race.Elf, elvenScout),
  54. silverRanger(0x18, false, Race.Elf, elvenScout),
  55. elvenMage(0x19, true, Race.Elf, null),
  56. elvenWizard(0x1a, true, Race.Elf, elvenMage),
  57. spellsinger(0x1b, true, Race.Elf, elvenWizard),
  58. elementalSummoner(0x1c, true, true, Race.Elf, elvenWizard),
  59. oracle(0x1d, true, Race.Elf, elvenMage),
  60. elder(0x1e, true, Race.Elf, oracle),
  61. darkFighter(0x1f, false, Race.DarkElf, null),
  62. palusKnight(0x20, false, Race.DarkElf, darkFighter),
  63. shillienKnight(0x21, false, Race.DarkElf, palusKnight),
  64. bladedancer(0x22, false, Race.DarkElf, palusKnight),
  65. assassin(0x23, false, Race.DarkElf, darkFighter),
  66. abyssWalker(0x24, false, Race.DarkElf, assassin),
  67. phantomRanger(0x25, false, Race.DarkElf, assassin),
  68. darkMage(0x26, true, Race.DarkElf, null),
  69. darkWizard(0x27, true, Race.DarkElf, darkMage),
  70. spellhowler(0x28, true, Race.DarkElf, darkWizard),
  71. phantomSummoner(0x29, true, true, Race.DarkElf, darkWizard),
  72. shillienOracle(0x2a, true, Race.DarkElf, darkMage),
  73. shillenElder(0x2b, true, Race.DarkElf, shillienOracle),
  74. orcFighter(0x2c, false, Race.Orc, null),
  75. orcRaider(0x2d, false, Race.Orc, orcFighter),
  76. destroyer(0x2e, false, Race.Orc, orcRaider),
  77. orcMonk(0x2f, false, Race.Orc, orcFighter),
  78. tyrant(0x30, false, Race.Orc, orcMonk),
  79. orcMage(0x31, false, Race.Orc, null),
  80. orcShaman(0x32, true, Race.Orc, orcMage),
  81. overlord(0x33, true, Race.Orc, orcShaman),
  82. warcryer(0x34, true, Race.Orc, orcShaman),
  83. dwarvenFighter(0x35, false, Race.Dwarf, null),
  84. scavenger(0x36, false, Race.Dwarf, dwarvenFighter),
  85. bountyHunter(0x37, false, Race.Dwarf, scavenger),
  86. artisan(0x38, false, Race.Dwarf, dwarvenFighter),
  87. warsmith(0x39, false, Race.Dwarf, artisan),
  88. /*
  89. * Dummy Entries (id's already in decimal format)
  90. * btw FU NCSoft for the amount of work you put me
  91. * through to do this!!
  92. * <START>
  93. */
  94. dummyEntry1(58, false, null, null),
  95. dummyEntry2(59, false, null, null),
  96. dummyEntry3(60, false, null, null),
  97. dummyEntry4(61, false, null, null),
  98. dummyEntry5(62, false, null, null),
  99. dummyEntry6(63, false, null, null),
  100. dummyEntry7(64, false, null, null),
  101. dummyEntry8(65, false, null, null),
  102. dummyEntry9(66, false, null, null),
  103. dummyEntry10(67, false, null, null),
  104. dummyEntry11(68, false, null, null),
  105. dummyEntry12(69, false, null, null),
  106. dummyEntry13(70, false, null, null),
  107. dummyEntry14(71, false, null, null),
  108. dummyEntry15(72, false, null, null),
  109. dummyEntry16(73, false, null, null),
  110. dummyEntry17(74, false, null, null),
  111. dummyEntry18(75, false, null, null),
  112. dummyEntry19(76, false, null, null),
  113. dummyEntry20(77, false, null, null),
  114. dummyEntry21(78, false, null, null),
  115. dummyEntry22(79, false, null, null),
  116. dummyEntry23(80, false, null, null),
  117. dummyEntry24(81, false, null, null),
  118. dummyEntry25(82, false, null, null),
  119. dummyEntry26(83, false, null, null),
  120. dummyEntry27(84, false, null, null),
  121. dummyEntry28(85, false, null, null),
  122. dummyEntry29(86, false, null, null),
  123. dummyEntry30(87, false, null, null),
  124. /*
  125. * <END>
  126. * Of Dummy entries
  127. */
  128. /*
  129. * Now the bad boys! new class ids :)) (3rd classes)
  130. */
  131. duelist(0x58, false, Race.Human, gladiator),
  132. dreadnought(0x59, false, Race.Human, warlord),
  133. phoenixKnight(0x5a, false, Race.Human, paladin),
  134. hellKnight(0x5b, false, Race.Human, darkAvenger),
  135. sagittarius(0x5c, false, Race.Human, hawkeye),
  136. adventurer(0x5d, false, Race.Human, treasureHunter),
  137. archmage(0x5e, true, Race.Human, sorceror),
  138. soultaker(0x5f, true, Race.Human, necromancer),
  139. arcanaLord(0x60, true, true, Race.Human, warlock),
  140. cardinal(0x61, true, Race.Human, bishop),
  141. hierophant(0x62, true, Race.Human, prophet),
  142. evaTemplar(0x63, false, Race.Elf, templeKnight),
  143. swordMuse(0x64, false, Race.Elf, swordSinger),
  144. windRider(0x65, false, Race.Elf, plainsWalker),
  145. moonlightSentinel(0x66, false, Race.Elf, silverRanger),
  146. mysticMuse(0x67, true, Race.Elf, spellsinger),
  147. elementalMaster(0x68, true, true, Race.Elf, elementalSummoner),
  148. evaSaint(0x69, true, Race.Elf, elder),
  149. shillienTemplar(0x6a, false, Race.DarkElf, shillienKnight),
  150. spectralDancer(0x6b, false, Race.DarkElf, bladedancer),
  151. ghostHunter(0x6c, false, Race.DarkElf, abyssWalker),
  152. ghostSentinel(0x6d, false, Race.DarkElf, phantomRanger),
  153. stormScreamer(0x6e, true, Race.DarkElf, spellhowler),
  154. spectralMaster(0x6f, true, true, Race.DarkElf, phantomSummoner),
  155. shillienSaint(0x70, true, Race.DarkElf, shillenElder),
  156. titan(0x71, false, Race.Orc, destroyer),
  157. grandKhauatari(0x72, false, Race.Orc, tyrant),
  158. dominator(0x73, true, Race.Orc, overlord),
  159. doomcryer(0x74, true, Race.Orc, warcryer),
  160. fortuneSeeker(0x75, false, Race.Dwarf, bountyHunter),
  161. maestro(0x76, false, Race.Dwarf, warsmith),
  162. dummyEntry31(0x77, false, null, null),
  163. dummyEntry32(0x78, false, null, null),
  164. dummyEntry33(0x79, false, null, null),
  165. dummyEntry34(0x7a, false, null, null),
  166. maleSoldier(0x7b, false, Race.Kamael, null),
  167. femaleSoldier(0x7C, false, Race.Kamael, null),
  168. trooper(0x7D, false, Race.Kamael, maleSoldier),
  169. warder(0x7E, false, Race.Kamael, femaleSoldier),
  170. berserker(0x7F, false, Race.Kamael, trooper),
  171. maleSoulbreaker(0x80, false, Race.Kamael, trooper),
  172. femaleSoulbreaker(0x81, false, Race.Kamael, warder),
  173. arbalester(0x82, false, Race.Kamael, warder),
  174. doombringer(0x83, false, Race.Kamael, berserker),
  175. maleSoulhound(0x84, false, Race.Kamael, maleSoulbreaker),
  176. femaleSoulhound(0x85, false, Race.Kamael, femaleSoulbreaker),
  177. trickster(0x86, false, Race.Kamael, arbalester),
  178. inspector(0x87, false, Race.Kamael, null), //Hidden subclass, no first class which it comes from
  179. judicator(0x88, false, Race.Kamael, inspector);
  180. /** The Identifier of the Class */
  181. private final int _id;
  182. /** True if the class is a mage class */
  183. private final boolean _isMage;
  184. /** True if the class is a summoner class */
  185. private final boolean _isSummoner;
  186. /** The Race object of the class */
  187. private final Race _race;
  188. /** The parent ClassId or null if this class is a root */
  189. private final ClassId _parent;
  190. /**
  191. * Constructor of ClassId.<BR><BR>
  192. */
  193. private ClassId(int pId, boolean pIsMage, Race pRace, ClassId pParent)
  194. {
  195. this._id = pId;
  196. this._isMage = pIsMage;
  197. this._isSummoner = false;
  198. this._race = pRace;
  199. this._parent = pParent;
  200. }
  201. /**
  202. * Constructor of ClassId.<BR><BR>
  203. */
  204. private ClassId(int pId, boolean pIsMage, boolean pIsSummoner, Race pRace, ClassId pParent)
  205. {
  206. this._id = pId;
  207. this._isMage = pIsMage;
  208. this._isSummoner = pIsSummoner;
  209. this._race = pRace;
  210. this._parent = pParent;
  211. }
  212. /**
  213. * Return the Identifier of the Class.<BR><BR>
  214. */
  215. public final int getId()
  216. {
  217. return _id;
  218. }
  219. /**
  220. * Return True if the class is a mage class.<BR><BR>
  221. */
  222. public final boolean isMage()
  223. {
  224. return _isMage;
  225. }
  226. /**
  227. * Return True if the class is a summoner class.<BR><BR>
  228. */
  229. public final boolean isSummoner()
  230. {
  231. return _isSummoner;
  232. }
  233. /**
  234. * Return the Race object of the class.<BR><BR>
  235. */
  236. public final Race getRace()
  237. {
  238. return _race;
  239. }
  240. /**
  241. * Return True if this Class is a child of the selected ClassId.<BR><BR>
  242. *
  243. * @param cid The parent ClassId to check
  244. *
  245. */
  246. public final boolean childOf(ClassId cid)
  247. {
  248. if (_parent == null)
  249. return false;
  250. if (_parent == cid)
  251. return true;
  252. return _parent.childOf(cid);
  253. }
  254. /**
  255. * Return True if this Class is equal to the selected ClassId or a child of the selected ClassId.<BR><BR>
  256. *
  257. * @param cid The parent ClassId to check
  258. *
  259. */
  260. public final boolean equalsOrChildOf(ClassId cid)
  261. {
  262. return this == cid || childOf(cid);
  263. }
  264. /**
  265. * Return the child level of this Class (0=root, 1=child leve 1...).<BR><BR>
  266. *
  267. * @param cid The parent ClassId to check
  268. *
  269. */
  270. public final int level()
  271. {
  272. if (_id != 0x87 && _parent == null)
  273. return 0;
  274. if (_id == 0x87)
  275. return 2;
  276. if (_id == 0x88)
  277. return 3;
  278. return 1 + _parent.level();
  279. }
  280. /**
  281. * Return its parent ClassId<BR><BR>
  282. *
  283. */
  284. public final ClassId getParent()
  285. {
  286. return _parent;
  287. }
  288. }