summaryrefslogtreecommitdiff
path: root/npc/custom/eAAC_Scripts/kafraExpress/global_functionsKE.txt
blob: 5dbe75677ae42a979c1071f3bc37ab977615af1d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
//===== eAthena Script ======================================= 
//= Global functions
//===== By: ================================================== 
//= Skotlex 
//===== Current Version: ===================================== 
//= 1.5
//===== Compatible With: ===================================== 
//= eAthena SVN R3424+, RO Ep6+
//===== Description: ========================================= 
//= Global Functions
//= 
//===== Additional Comments: ================================= 
//= GF_getJobName= function for getting a job's name
//= GF_getJobName2= gets a jobs name modified by Type (see below)
//= GF_getJobId=  gets a jobs number modified by Type (see below)
//= GF_getJobLevel= identifies novices/1st/2nd among classes
//= GF_getJobType= identifies normal/advanced/babies classes
//= - GF_getJobClass= identifies job class (swordie, mage, etc)
//============================================================ 

function	script	GF_getJobName	{

	switch (getarg(0)) {

	case Job_Novice:
		return "novice";
	case Job_Acolyte:
		return "acolyte";
	case Job_Archer:
		return "archer";
	case Job_Mage:
		return "mage";
	case Job_Merchant:
		return "merchant";
	case Job_Swordman:
		return "swordsman";
	case Job_Thief:
		return "thief";
	case Job_Taekwon:
		return "taekwon kid";
	case Job_SuperNovice:
		return "super novice";
		
	case Job_Hunter:
		return "hunter";
	case Job_Dancer:
		return "dancer";
	case Job_Bard:
		return "bard";
	case Job_Priest:
		return "priest";
	case Job_Monk:
		return "monk";
	case Job_Wizard:
		return "wizard";
	case Job_Sage:
		return "sage";
	case Job_BlackSmith:
		return "blacksmith";
	case Job_Alchem:
		return "alchemist";
	case Job_Knight:
	case Job_Knight2:
		return "knight";
	case Job_Crusader:
	case Job_Crusader2:
		return "crusader";
	case Job_Assassin:
		return "assassin";
	case Job_Rogue:
		return "rogue";
	case Job_Star_Gladiator:
	case Job_Star_Gladiator2:
		return "star gladiator";
	case Job_Soul_Linker:
		return "soul linker";
		
	case Job_Novice_High:
		return "high novice";
	case Job_Acolyte_High:
		return "high acolyte";
	case Job_Archer_High:
		return "high archer";
	case Job_Mage_High:
		return "high mage";
	case Job_Merchant_High:
		return "high merchant";
	case Job_Swordman_High:
		return "high swordsman";
	case Job_Thief_High:
		return "high thief";
		
	case Job_Assassin_Cross:
		return "assassin cross";
	case Job_Champion:
		return "champion";
	case Job_Clown:
		return "minstrel";
	case Job_Creator:
		return "biochemist";
	case Job_Gypsy:
		return "gypsy";
	case Job_High_Priest:
		return "high priest";
	case Job_High_Wizard:
		return "high wizard";
	case Job_Lord_Knight:
	case Job_Lord_Knight2:
		return "lord knight";
	case Job_Paladin:
	case Job_Paladin2:
		return "paladin";
	case Job_Professor:
		return "professor";
	case Job_Sniper:
		return "sniper";
	case Job_Stalker:
		return "stalker";
	case Job_Whitesmith:
		return "whitesmith";

	case Job_Baby:
		return "baby";
	case Job_Baby_Acolyte:
		return "baby acolyte";
	case Job_Baby_Archer:
		return "baby archer";
	case Job_Baby_Mage:
		return "baby mage";
	case Job_Baby_Merchant:
		return "baby merchant";
	case Job_Baby_Swordman:
		return "baby swordsman";
	case Job_Baby_Thief:
		return "baby thief";
	case Job_Super_Baby:
		return "super baby";

	case Job_Baby_Hunter:
		return "baby hunter";
	case Job_Baby_Dancer:
		return "baby dancer";
	case Job_Baby_Bard:
		return "baby bard";
	case Job_Baby_Priest:
		return "baby priest";
	case Job_Baby_Monk:
		return "baby monk";
	case Job_Baby_Wizard:
		return "baby wizard";
	case Job_Baby_Sage:
		return "baby sage";
	case Job_Baby_BlackSmith:
		return "baby blacksmith";
	case Job_Baby_Alchem:
		return "baby alchemist";
	case Job_Baby_Knight:
	case Job_Baby_Knight2:
		return "baby knight";
	case Job_Baby_Crusader:
	case Job_Baby_Crusader2:
		return "baby crusader";
	case Job_Baby_Assassin:
		return "baby assassin";
	case Job_Baby_Rogue:
		return "baby rogue";
	default:
		return "unknown";
	}

}

//Returns job name using two params: JobId and Type
function	script	GF_getJobName2	{
	set @classId, callfunc("GF_getJobId", getarg(0), getarg(1));
	return callfunc("GF_getJobName", @classId);
}

//Returns a Job's ID modified by their Type
function	script	GF_getJobId	{
	set @classId, getarg(0);
	set @type, getarg(1);

	if (@classId == Job_SuperNovice || @classId == Job_Super_Baby) {
		switch (@type) {
		case 0:
			return Job_SuperNovice;
		case 2:
			return Job_Super_Baby;
		default:
			return @classId;
		}
	}
	if (@classId >= Job_Taekwon && @classId <= Job_Soul_Linker) {
		//Currently has no alternates.
		return @classId;	
	}
	if (@classId >= Job_Novice_High && @classId <= Job_Paladin2)
		set @classId, @classId -Job_Novice_High;
	else 	
	if (@classId >= Job_Baby && @classId <= Job_Super_Baby)
		set @classId, @classId -Job_Baby;
		
	if (@type == 1)
		set @classId, @classId +Job_Novice_High;
		
	if (@type == 2)
		set @classId, @classId +Job_Baby;

	return @classId;
}

//Returns the type of class:
//0= Novice, 1= First Class, 2= Second Class, 3= Super Novice
//4= Wedding
function	script	GF_getJobLevel	{

	set @classId, getarg(0);
	
	if (@classId >= Job_Novice_High && @classId <= Job_Paladin2)
		set @classId, @classId -Job_Novice_High;

	if (@classId >= Job_Baby && @classId <= Job_Baby_Crusader2)
		set @classId, @classId -Job_Baby;
	
	if(@classId == Job_Novice) {
		return 0;
	}
	if((@classId >= Job_Swordman && @classId <= Job_Thief)
		|| @classId == Job_Taekwon) {
		return 1;
	}
	if ((@classId >= Job_Knight && @classId <= Job_Crusader2)
	|| (@classId >= Job_Star_Gladiator && @classId <= Job_Soul_Linker)) {
		return 2;
	}
	
	if(@classId == Job_SuperNovice || @classId == Job_Super_Baby) {
		return 3;
	}
	if(@classId == 22) {
		return 4;
	}
	return -1;
}

//Returns the type of class, based on path:
//0= Normal Jobs, 1= Upper Jobs, 2= Baby Jobs
//Works the same as Upper, except you can pass any job id to get it's upper value
function	script	GF_getJobType	{
	set @classId, getarg(0);
	
	if ((@classId >= Job_Novice && @classId <= Job_SuperNovice) 
		|| (@classId >= Job_Taekwon && @classId <= Job_Soul_Linker)) {
		return 0;
	}
	if (@classId >= Job_Novice_High && @classId <= Job_Paladin2) {
		return 1;
	}
	if (@classId >= Job_Baby && @classId <= Job_Super_Baby) {
		return 2;
	}
	return -1;
}
//Returns the base class of the given job, return values are:
//Job_Novice (Novice, Baby Novice, Super Novice
//Job_Acolyte (Aco, Priest, Monk +High/Baby variations)
//Job_Archer (Archer, Sniper, Bard, Dancer +High/Baby variations)
//Job_Mage (Mage, Wizard, Sage +High/Baby variations)
//Job_Swordman (Swordsman, Knight, Crusader +High/Baby variations)
//Job_Thief (Thief, Assassin, Rogue +High/Baby variations)
//-1 : others (when wearing Tux/Wedding dress, for example)
//Works the same as baseClass, except you pass the class which you want
//examined.
function	script	GF_getJobClass	{
	set @classId, getarg(0);
	
	if (@classId >= Job_Novice_High && @classId <= Job_Paladin2)
		set @classId, @classId -Job_Novice_High;

	if (@classId >= Job_Baby && @classId <= Job_Baby_Crusader2)
		set @classId, @classId -Job_Baby;
	
	switch (@classId) {
	case Job_Novice:
	case Job_SuperNovice:
	case Job_Super_Baby:
		return Job_Novice;
		
	case Job_Acolyte:
	case Job_Priest:
	case Job_Monk:
		return Job_Acolyte;
		
	case Job_Archer:
	case Job_Hunter:
	case Job_Bard:
	case Job_Dancer:
		return Job_Archer;
	
	case Job_Mage:
	case Job_Wizard:
	case Job_Sage:
		return Job_Mage;

	case Job_Merchant:
	case Job_BlackSmith:
	case Job_Alchem:
		return Job_Merchant;
	
	case Job_Swordman:
	case Job_Knight:
	case Job_Knight2:
	case Job_Paladin:
	case Job_Paladin2:
		return Job_Swordman;
		
	case Job_Thief:
	case Job_Assassin:
	case Job_Rogue:
		return Job_Thief;

	case Job_Taekwon:
	case Job_Star_Gladiator:
	case Job_Star_Gladiator2:
	case Job_Soul_Linker:
		return Job_Taekwon;

	default:
		return -1;
	}
}