root/doc/ea_job_system.txt @ 23

Revision 1, 8.3 kB (checked in by jinshiro, 17 years ago)
Line 
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
15Preface:
16-------------------------------------------------------------------------------
17
18        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.
19
20        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?
21
22The eA Job System:
23-------------------------------------------------------------------------------
24
25        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.
26
27        The scheme consists in that every job can be broken down by 3 criteria:
28
29- 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:
30
31        EAJ_NOVICE      0x0
32        EAJ_SWORDMAN    0x1
33        EAJ_MAGE        0x2
34        EAJ_ARCHER      0x3
35        EAJ_ACOLYTE     0x4
36        EAJ_MERCHANT    0x5
37        EAJ_THIEF       0x6
38        EAJ_TAEKWON     0x7
39        EAJ_GUNSLINGER  0x9
40        EAJ_NINJA       0x10
41
42- Branch: All classes can be classified as "1st Class", "2-1 Class" or "2-2 Class":
43       
44        EAJL_2_1        0x100
45        EAJL_2_2        0x200
46        EAJL_2  0x300
47
48- The third category is type. Classes can either be normal, rebirth/advanced or adopted.
49
50        EAJL_UPPER      0x1000
51        EAJL_BABY       0x2000
52
53So using these three categories, any job class can be constructed from the others. Let's take a swordman, for example.
54
55The first step is basic swordman, with nothing else:
56
57        EAJ_SWORDMAN
58
59The next step is to either become a 2-1 or a 2-2 job:
60
61        EAJ_SWORDMAN|EAJL_2_1 -> EAJ_KNIGHT
62        EAJ_SWORDMAN|EAJL_2_2 -> EAJ_CRUSADER
63
64if a swordman is adopted...
65
66        EAJ_SWORDMAN|EAJL_BABY -> EAJ_BABY_SWORDMAN
67
68Or getting out the rebirth versions of a swordman:
69
70        EAJ_SWORDMAN|EAJL_UPPER -> EAJ_SWORDMAN_HIGH
71        EAJ_SWORDMAN|EAJL_2_1|EAJL_UPPER        -> EAJ_LORD_KNIGHT
72        EAJ_SWORDMAN|EAJL_2_2|EAJL_UPPER        -> EAJ_PALADIN
73
74Why are we using the bitwise OR operand ('|') rather than just adding? Because the OR is wreck-proof:
75
76        EAJ_SWORDMAN_HIGH|EAJL_UPPER -> EAJ_SWORDMAN_HIGH
77
78If we had used addition, we would have gotten a completely different result.
79
80The EAJL (eA Job Level) constants
81-------------------------------------------------------------------------------
82
83        There are a few constants which can be used to filter out and make job comparisons easier.
84
85EAJL_2_1:
86        Checks if the class is a 2-1 class:
87        if (@job&EAJL_2_1)
88                mes "Using the classic 2-1 job, huh?";
89
90EAJL_2_2:
91        Checks if the class is 2-2.
92
93EAJL_2:
94        Checks if the class is a 2nd Class. If the check fails, you can be sure the character is a first class.
95        if (!(@job&EAJL_2))
96                mes "Will you wait until Job 50 to change?";
97
98EAJL_UPPER:
99        Check if a class is Rebirth/Advanced:
100        if(@job&EAJL_UPPER)
101                mes "It must have taken you a LONG time...";
102
103EAJL_BABY:
104        Check if a class is an adopted class.
105        if (@job&EAJ_BABY)
106                mes "Don't you hate being weak?";
107
108EAJ_UPPERMASK:
109        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:
110        if ((@job&EAJ_UPPERMASK) == EAJ_MONK)
111                mes "Aren't knuckles such a cool weapon?";
112       
113        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.
114       
115EAJ_BASEMASK:
116        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):
117        if ((@job&EAJ_BASEMASK) == EAJ_MERCHANT)
118                mes "Why I can't have discount like you guys do?";
119
120        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.
121
122The script commands eaclass, roclass:
123-------------------------------------------------------------------------------
124
125        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:
126
127        set @eac, eaclass();
128        if (@eac&EAJL_2)
129        {       //2nd class
130                //If upper or baby, you can't rebirth
131                if (@eac&(EAJL_UPPER|EAJL_BABY)) {
132                        mes "You can't go anywhere, can you?";
133                        close;
134                }
135                //Note that if we remove the EAJL_BABY check up there, the following check
136                //will also fail, because there's no such thing as Rebirth-Baby classes.
137                set @newclass, roclass(@eac|EAJL_UPPER);
138                if (@newclass == -1) {
139                        //Don't you hate this of SG and SL?
140                        mes "Haha, your class doesn't has a rebirth version yet!";
141                        close;
142                }
143                mes "Still dreaming of the day you become a "+jobname(@newclass)+"?";
144                close;
145        }
146        set @class1, roclass(@eac|EAJL_2_1);
147        set @class2, roclass(@eac|EAJL_2_2);
148        if (@class1 == -1) {
149                //NJ/GS are the only classes who get stuck on their 1st class forever.
150                mes "Looks like you are stuck forever on that class.";
151                close;
152        }
153        if (@class2 == -1) {
154                //Not quite true, currently the only 1st class that doesn't has two choices is Novice -> Supernovice (see s.novice section below)
155                mes "Looks like you have no choice but to be a "+jobname(@class1)+".";
156                close;
157        }
158        mes "Have you decided yet if you want to be a "+jobname(@class1)+" or a "+jobname(@class2)+"?";
159        close;
160
161
162Oddities of the System:
163-------------------------------------------------------------------------------
164About Bards and Dancers:
165        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.
166
167About Novices and Super Novices:
168        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:
169
170        EAJ_NOVICE -> Novice
171        EAJ_NOVICE|EAJL_2_1 -> EAJ_SUPER_NOVICE
172        EAJ_NOVICE|EAJL_UPPER -> EAJ_NOVICE_HIGH
173        EAJ_NOVICE|EAJL_BABY    -> EAJ_BABY     
174        EAJ_NOVICE|EAJL_BABY|EAJL_2_1 -> EAJ_SUPER_BABY
175
176        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:
177
178        if ((@job&EAJ_BASEMASK) == EAJ_NOVICE)
179                //Novice class detected.
Note: See TracBrowser for help on using the browser.