ClassId.java 10 KB

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