ea_job_system.txt 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. //===== Athena Doc=== =====================================
  2. //= eAthena Job System
  3. //===== By ================================================
  4. //= Skotlex
  5. //===== Version ===========================================
  6. //= 0.1
  7. //=========================================================
  8. //= 0.1 - First release, explained as well as I could.
  9. //===== Description =======================================
  10. //= A reference description of eA's inner job system (for
  11. //= use on scripts through the eaclass and roclass script
  12. //= commands)
  13. //=========================================================
  14. Preface:
  15. -------------------------------------------------------------------------------
  16. Most scripters are aware of the class values used in RO and their constants specified on db/const.txt. Each class has a number associated to it for referencing, so when someone's class is 9 that means they are a wizard. However, this list of job numbers has no real order behind it, and no logic behind it's assignation.
  17. You can add 3999 to a job to get their rebirth ID, but if you try to do the same to get the Baby class ID, that fails on the super Baby class. Also, there's no way to calculate, from a given first class, which classes would be their "evolution". That is, given the Archer's ID, you cannot just add a value that will return you "Hunter", and will still work if applied to the other classes. It didn't help much when they added Taekwon Boy, a first class, with an ID of 4046, and much later they added Ninja/Gunslinger with the IDs 25/24. How do you identify a first class on all this mess without recurring to very ugly range checks?
  18. The eA Job System:
  19. -------------------------------------------------------------------------------
  20. Since the code also required to do this kind of checks for various skills (The Soul Linker Spirit buffs specially come to mind), an alternate job ID system was developed, which attempts to make more sense and make it easier to check where a particular job stands in relation to the rest.
  21. The scheme consists in that every job can be broken down by 3 criteria:
  22. - Base Job: This determines to which class-tree a job belongs. All jobs can be traced back to their root. The base job of all classes has to be one of the following:
  23. EAJ_NOVICE 0x0
  24. EAJ_SWORDMAN 0x1
  25. EAJ_MAGE 0x2
  26. EAJ_ARCHER 0x3
  27. EAJ_ACOLYTE 0x4
  28. EAJ_MERCHANT 0x5
  29. EAJ_THIEF 0x6
  30. EAJ_TAEKWON 0x7
  31. EAJ_GUNSLINGER 0x9
  32. EAJ_NINJA 0x10
  33. - Branch: All classes can be classified as "1st Class", "2-1 Class" or "2-2 Class":
  34. EAJL_2_1 0x100
  35. EAJL_2_2 0x200
  36. EAJL_2 0x300
  37. - The third category is type. Classes can either be normal, rebirth/advanced or adopted.
  38. EAJL_UPPER 0x1000
  39. EAJL_BABY 0x2000
  40. So using these three categories, any job class can be constructed from the others. Let's take a swordman, for example.
  41. The first step is basic swordman, with nothing else:
  42. EAJ_SWORDMAN
  43. The next step is to either become a 2-1 or a 2-2 job:
  44. EAJ_SWORDMAN|EAJL_2_1 -> EAJ_KNIGHT
  45. EAJ_SWORDMAN|EAJL_2_2 -> EAJ_CRUSADER
  46. if a swordman is adopted...
  47. EAJ_SWORDMAN|EAJL_BABY -> EAJ_BABY_SWORDMAN
  48. Or getting out the rebirth versions of a swordman:
  49. EAJ_SWORDMAN|EAJL_UPPER -> EAJ_SWORDMAN_HIGH
  50. EAJ_SWORDMAN|EAJL_2_1|EAJL_UPPER -> EAJ_LORD_KNIGHT
  51. EAJ_SWORDMAN|EAJL_2_2|EAJL_UPPER -> EAJ_PALADIN
  52. Why are we using the bitwise OR operand ('|') rather than just adding? Because the OR is wreck-proof:
  53. EAJ_SWORDMAN_HIGH|EAJL_UPPER -> EAJ_SWORDMAN_HIGH
  54. If we had used addition, we would have gotten a completely different result.
  55. The EAJL (eA Job Level) constants
  56. -------------------------------------------------------------------------------
  57. There are a few constants which can be used to filter out and make job comparisons easier.
  58. EAJL_2_1:
  59. Checks if the class is a 2-1 class:
  60. if (@job&EAJL_2_1)
  61. mes "Using the classic 2-1 job, huh?";
  62. EAJL_2_2:
  63. Checks if the class is 2-2.
  64. EAJL_2:
  65. Checks if the class is a 2nd Class. If the check fails, you can be sure the character is a first class.
  66. if (!(@job&EAJL_2))
  67. mes "Will you wait until Job 50 to change?";
  68. EAJL_UPPER:
  69. Check if a class is Rebirth/Advanced:
  70. if(@job&EAJL_UPPER)
  71. mes "It must have taken you a LONG time...";
  72. EAJL_BABY:
  73. Check if a class is an adopted class.
  74. if (@job&EAJ_BABY)
  75. mes "Don't you hate being weak?";
  76. EAJ_UPPERMASK:
  77. The upper mask can be used to "strip" the upper/baby characteristics of a class, used when you want to know if someone is a certain class regardless of rebirth/adopted status. For example, the following code would go through for Monks, Champions and Baby Monks:
  78. if ((@job&EAJ_UPPERMASK) == EAJ_MONK)
  79. mes "Aren't knuckles such a cool weapon?";
  80. Note that if instead of EAJ_MONK you used EAJ_CHAMPION or EAJ_BABY_MONK, the check would had never passed, since the upper/baby state has been removed from the original job when checking.
  81. EAJ_BASEMASK:
  82. This mask strips also the 2nd class attributes. It can be used to check against the basic job of a character. For example, the following code would go through for Merchants (+Baby Merchant and High Merchant), Blacksmiths (+Baby blacksmiths and Whitesmith) and Alchemist (+Baby Alchemist and +Creator):
  83. if ((@job&EAJ_BASEMASK) == EAJ_MERCHANT)
  84. mes "Why I can't have discount like you guys do?";
  85. Note that, like before, if you try to check versus any of the other classes (High merchant, blacksmith, etc) instead of basic merchant, the check will always fail for the same reasons previously explained.
  86. The script commands eaclass, roclass:
  87. -------------------------------------------------------------------------------
  88. These script commands are what you can use in scripts to convert between the RO classic job id, and eA's job system. The following script code demonstrates how to use these script commands to guess what your next job will be:
  89. set @eac, eaclass();
  90. if (@eac&EAJL_2)
  91. { //2nd class
  92. //If upper or baby, you can't rebirth
  93. if (@eac&(EAJL_UPPER|EAJL_BABY)) {
  94. mes "You can't go anywhere, can you?";
  95. close;
  96. }
  97. //Note that if we remove the EAJL_BABY check up there, the following check
  98. //will also fail, because there's no such thing as Rebirth-Baby classes.
  99. set @newclass, roclass(@eac|EAJL_UPPER);
  100. if (@newclass == -1) {
  101. //Don't you hate this of SG and SL?
  102. mes "Haha, your class doesn't has a rebirth version yet!";
  103. close;
  104. }
  105. mes "Still dreaming of the day you become a "+jobname(@newclass)+"?";
  106. close;
  107. }
  108. set @class1, roclass(@eac|EAJL_2_1);
  109. set @class2, roclass(@eac|EAJL_2_2);
  110. if (@class1 == -1) {
  111. //NJ/GS are the only classes who get stuck on their 1st class forever.
  112. mes "Looks like you are stuck forever on that class.";
  113. close;
  114. }
  115. if (@class2 == -1) {
  116. //Not quite true, currently the only 1st class that doesn't has two choices is Novice -> Supernovice (see s.novice section below)
  117. mes "Looks like you have no choice but to be a "+jobname(@class1)+".";
  118. close;
  119. }
  120. mes "Have you decided yet if you want to be a "+jobname(@class1)+" or a "+jobname(@class2)+"?";
  121. close;
  122. Oddities of the System:
  123. -------------------------------------------------------------------------------
  124. About Bards and Dancers:
  125. These two classes are considered the same in eA's job system, since they both are the 2-2 job of archers. The only way to tell them apart is by using the gender of the character we are referring to. The script command roclass() will automatically use the gender of the attached player (or 'male' if there's no such player), but you can also explicitly pass the gender to the script command when there's no player attached.
  126. About Novices and Super Novices:
  127. These are treated a bit differently from you'd expect. Because.. for instance, a novice is not supposed to be a 1st class, but it is considered as one on this tree system:
  128. EAJ_NOVICE -> Novice
  129. EAJ_NOVICE|EAJL_2_1 -> EAJ_SUPER_NOVICE
  130. EAJ_NOVICE|EAJL_UPPER -> EAJ_NOVICE_HIGH
  131. EAJ_NOVICE|EAJL_BABY -> EAJ_BABY
  132. EAJ_NOVICE|EAJL_BABY|EAJL_2_1 -> EAJ_SUPER_BABY
  133. So as you can see, on this job system, the Super Novice is treated as the 2-1 job of a Novice, and the Novice job it's at the same level of the other 1st jobs. Even though that may seem like a hindrance, it makes it very easy to add a check to discard Novice types from a quest:
  134. if ((@job&EAJ_BASEMASK) == EAJ_NOVICE)
  135. //Novice class detected.