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
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
|
//===== eAthena Script =======================================
//= Kafra Functions
//===== By: ==================================================
//= eAthena Dev Team
//= Darlskies, Darkchild, Syrus22, Lupus, kobra_k88 (2.0)
//===== Current Version: =====================================
//= 5.4b
//===== Compatible With: =====================================
//= eAthena 1.0
//===== Description: =========================================
//= These functions handle save, storage, cart rental, teleport,
//= and Free Teleport/Warp/Rent Cart options for all Kafra NPCs.
//=
//= Kafra's will need a lot of work. The Welcome Message argument
//= may become obsolete, as most kafras have a slightly differing
//= Welcome message.
//===== Additional Comments: =================================
//= v1.1 Now using functions v2.1 Added Cart Rent for Classes: Whitesmith, Professor.
//= Replaced checkoption(x) into checkcart(0) [Lupus] v2.1b Added Fix Kafra Pass Func [Kobra_k88]
//= 2.2 Final fix of the Kafra Pass Exploit! [Lupus] a -Izlude[4] fix
//= 2.2a Minor changes to function calls. Using agruments. Added Guild options. [kobra_k88]
//= 2.2b This version uses arrays for the teleport option. Rearranged next statements to make menu transitions smoother. [kobra_k88]
//= 2.3 Removed SAVE from Niflheim. [Lupus]
//= 2.3 removed "fix" by HawkMoon RTFM and check supernovice.txt . There's a SPECIAL Kafra which gives CARTS to SN for a special proce. [Lupus]
//= 2.4 Added Baby Class Support (Baby Novice check) Removed annoying storage feature where u had to close dialog window to be able to use your storage [Lupus]
//= 2.5 Added Louyang official Kafra, fixes some Kafras, not letting you to Save your position [Lupus]
//= 2.6 Reverted Dungeons Kafras (they should offer only Storage). Added temp Ayothaya Kafra
//= 2.7 Added correct Ayothaya, Louyang & Amatsu Kafras. [Lupus]
//= 2.8 Fixed Amatsu Storage problems [Lupus] 2.9 Fixed spelling mistakes. [Nexon]
//= 3.0 Added special "not working teleport menu" for Einbroch Kafras [Lupus]
//= 3.1 Removed callfunc Is_####_Class in favor of baseClass [Silentdragon]
//= 3.2 Fixed an exploit [Lupus]
//= 4.0 Added Kafra storage password protection. [Lupus]
//= to block Kafra Password, read comments at 350 line
//= Note: You can change '1337' value to another to raise password protection
//= 5.0 Fixed the close2;....close; end; lines. Who let them slip away? =/ [erKURITA]
//= Also, the kafra upon warp was giving back the zeny. Removed. [erKURITA]
//= 5.1 Optimized a little, added no tele/save arg's [Evera]
//= 5.1a Temporary? Added F_ClearGarbage to clear unused/outdated variables [Lupus]
//= 5.2 By default commented out custom Guilds Kafra's "Guild Storage". [Lupus]
//= 5.3 uncommented Guild Storage. Confirmed kRO feature. [Lupus]
//= 5.4 added -Guide option (Kafra shows you nearest Guide) Work in progress.
//= Need all coords for all guides.. and somehow pass their coords to kafra.
//= Removed universal Kafra Pass, added 3 new Kafra Tickets [Lupus]
//= 5.4b temporary moved "-Guide" from the 1st menu punct [Lupus]
//= 5.5 Added proper Niflheim welcome message. [L0ne_W0lf]
//= Cleaned up the menus a bit. Got rid of the proceeding "-" prefix.
//============================================================
// Main Function ===========================================================
//= arg(0): Used to determine which welcome message to show.
//= arg(1): Used to determine which menu to display.
//= arg(2): Used to determine if the info menu is shown in F_KafInfo.
//==========================================================================
function script F_Kafra {
callfunc "F_ClearGarbage"; //Clear outdated, unused variables
mes "[Kafra]";
switch(getarg(0)){
default:
case 0:
mes "Welcome to the";
mes "Kafra Corporartion.";
mes "The Kafra services";
mes "are always on your side.";
mes "How may I assist you?";
break;
//Niflheim
case 1:
mes "^666666W-weeeelc-c-come";
mes "to th-the K-kaaafrrrra";
mes "C-coorpoor-r-ratioooonn...^000000";
break;
//Guilds Castles
case 2:
mes "Welcome. ^ff0000" + GetGuildName(@GID) + "^000000 Member.";
mes "The Kafra Coporation will stay with you wherever you go.";
break;
//Amatsu
case 3:
mes "So, have you come from a faraway land to study our culture, or are you just sightseeing?";
mes "In either case, why not stay awhile?";
mes "The air is eternally heavy with the";
mes "scent of pleasant wildflowers.";
break;
//Louyang, Ayothaya
case 4:
mes "With our many Kafra";
mes "service locations, you're never";
mes "far from home.";
break;
}
next;
M_Menu:
cleararray @K_Menu0$[0],"",7;
switch(getarg(1)){
//only Save & Storage
case 1:
setarray @K_Menu0$[0],"Save","Use Storage","Cancel";
break;
//only Storage
case 2:
setarray @K_Menu0$[0],"Use Storage","Cancel";
break;
//Common w/o teleport
case 3:
setarray @K_Menu0$[0],"Save","Use Storage","Rent a Pushcart","Guide","Check Other Information","Cancel";
break;
//Case 4 is Einbroch no tele message.
//Common w/o save and teleport
case 5:
setarray @K_Menu0$[0],"Use Storage","Rent a Pushcart","Check Other Information","Guide","Cancel";
break;
//Only storage and other info check
case 6:
setarray @K_Menu0$[0],"Use Storage","Guide","Check Other Information","Cancel";
break;
//Common Kafra
default:
setarray @K_Menu0$[0],"Save","Use Storage","Use Teleport Service","Rent a Pushcart","Guide","Check Other Information","Cancel";
break;
}
if(getarg(0)==2) {
//Guilds Kafra (free Teleport, free Storage, Free Cart)
cleararray @K_Menu0$[0],"",7;
setarray @K_Menu0$[0],"Use Storage","Use Guild Storage","Rent a Cart","Use Teleport Service","Cancel";
}
menu @K_Menu0$[0],K_Menu0,@K_Menu0$[1],K_Menu1,@K_Menu0$[2],K_Menu2,
@K_Menu0$[3],K_Menu3,@K_Menu0$[4],K_Menu4,@K_Menu0$[5],K_Menu5,
@K_Menu0$[6],K_Menu6,@K_Menu0$[7],K_Menu7;
K_Menu0:
set @num,0;
goto K_Menuf;
K_Menu1:
set @num,1;
goto K_Menuf;
K_Menu2:
set @num,2;
goto K_Menuf;
K_Menu3:
set @num,3;
goto K_Menuf;
K_Menu4:
set @num,4;
goto K_Menuf;
K_Menu5:
set @num,5;
goto K_Menuf;
K_Menu6:
set @num,6;
goto K_Menuf;
K_Menu7:
set @num,7;
K_Menuf:
if (@K_Menu0$[@num] == "Save") return;
if (@K_Menu0$[@num] == "Use Storage"){
//Don't charge for a common Kafra Storage in your Castle
if(getarg(0) == 2) callfunc "F_KafStor",2;
else callfunc "F_KafStor",0;
next;
goto M_Menu;
}
if (@K_Menu0$[@num] == "-Use Teleport Service"){
if(getarg(1) == 4){ //Check for Einbroch Tele notice
mes "[Kafra]";
mes "Because of the ^FF0000Limited Transport Agreement^000000, the Kafra Corporation cannot provide Teleport Services in the Schwarzwald Republic.";
next;
mes "[Kafra]";
mes "We ask that you please";
mes "use the Airship Service";
mes "instead. Thank you for your";
mes "understanding and cooperation.";
next;
goto M_Menu;
}
callfunc "F_KafTele",getarg(0);
goto M_Menu;
}
if (@K_Menu0$[@num] == "Rent a Pushcart"){
if(callfunc("F_KafCart",getarg(0)) == 1) next;
goto M_Menu;
}
if (@K_Menu0$[@num] == "Guide"){
callfunc "F_KafGuide";
next;
goto M_Menu;
}
if (@K_Menu0$[@num] == "Check Other Information"){
callfunc "F_KafInfo",getarg(2);
goto M_Menu;
}
if (@K_Menu0$[@num] == "Cancel"){
callfunc "F_KafEnd",getarg(0),0;
end;
}
if (@K_Menu0$[@num] == "Use Guild Storage"){
callfunc "F_KafStor",1;
next;
goto M_Menu;
}
}
// Storage Function =======================================================
function script F_KafStor {
if(getarg(0) == 1){
if(guildopenstorage(0) == 1){
mes "[Kafra]";
mes "I'm sorry but another guild member is using the guild storage";
mes "right now. Please wait until that person is finished.";
close2;
cutin "", 255;
end;
}
cutin "", 255;
close;
}
if(basicskillcheck() && getskilllv(1) < 6){
mes "[Kafra]";
mes "I am sorry but you have to be at least Novice level 6 if you want to use the storage.";
return;
}
//don't charge for common storage in Castle
if(getarg(0) != 2){
//we'll use Free Ticket for Kafra Storage if available
if(countitem(7059)){
delitem 7059,1;
} else {
if(Zeny<40){
mes "[Kafra]";
mes "Dear you don't have enough money. The Storage fee is 40 Zeny.";
return;
}
set Zeny, Zeny-40;
set RESRVPTS, RESRVPTS + (40/5);
}
}
mes "[Kafra]";
mes "Close this window to open your storage.";
mes "We hope to see you again soon.";
callfunc("F_CheckKafCode"); //check your storage password, if set
close2;
openstorage;
cutin "", 255;
end;
}
// Teleport Function ==================================================
function script F_KafTele {
mes "[Kafra]";
mes "Please set your destination.";
next;
menu @wrpC$[0],M_Wrp0, @wrpC$[1],M_Wrp1, @wrpC$[2],M_Wrp2, @wrpC$[3],M_Wrp3,
@wrpC$[4],M_Wrp4, @wrpC$[5],M_Wrp5, @wrpC$[6],M_Wrp6;
M_Wrp0:
set @num, 0;
goto L_Warp;
M_Wrp1:
set @num, 1;
goto L_Warp;
M_Wrp2:
set @num, 2;
goto L_Warp;
M_Wrp3:
set @num, 3;
goto L_Warp;
M_Wrp4:
set @num, 4;
goto L_Warp;
M_Wrp5:
set @num, 5;
goto L_Warp;
M_Wrp6:
set @num, 6;
L_Warp:
if (@wrpC$[@num] == "Cancel") return;
// we'll use Free Ticket for Kafra Transportation if available
if(countitem(7060)){
delitem 7060,1;
} else {
if (Zeny<@wrpP[@num]){
mes "[Kafra]";
mes "Dear you don't have enough money. Please check your funds again.";
emotion e_cash;
close2;
cutin "", 255;
end;
}
set Zeny, Zeny-@wrpP[@num];
set RESRVPTS, RESRVPTS + (@wrpP[@num]/16);
}
if (@wrpD$[@num] == "Alberta") warp "alberta", 117, 56;
if (@wrpD$[@num] == "Al De Baran") warp "aldebaran",143,110;
if (@wrpD$[@num] == "Aldebaran") warp "aldebaran",143,110;
if (@wrpD$[@num] == "Comodo") warp "comodo", 207, 144;
if (@wrpD$[@num] == "Izlude") warp "izlude", 91, 105;
if (@wrpD$[@num] == "Geffen") warp "geffen", 120, 39;
if (@wrpD$[@num] == "Morroc") warp "morocc", 156, 46;
if (@wrpD$[@num] == "Payon") warp "payon", 168, 103;
if (@wrpD$[@num] == "Prontera") warp "prontera", 116, 72;
if (@wrpD$[@num] == "Coal Mine(Dead Pit)") warp "mjolnir_02", 82, 347;
if (@wrpD$[@num] == "Comodo Pharos Lighthouse") warp "cmd_fild07", 127, 134;
if (@wrpD$[@num] == "Orc Dungeon") warp "gef_fild10", 52, 326;
if (@wrpD$[@num] == "Umbala") warp "umbala", 130, 130;
if (@wrpD$[@num] == "Yuno") warp "yuno", 157, 123;
cutin "", 255;
end;
}
// Cart Function ========================================================
function script F_KafCart {
if(baseClass != Job_Merchant){
mes "[Kafra]";
mes "I'm sorry dear. The Cart service is only provided for the Merchant and Blacksmith Class.";
return 1;
}
if(getskilllv(39)==0){
mes "[Kafra]";
mes "I'm sorry but you need the skill ^0000FF'Pushcart'^000000 to rent a cart.";
return 1;
}
if(checkcart() == 1){
mes "[Kafra]";
mes "Excuse me... but you already have a cart....";
emotion e_swt;
return 1;
}
//get Cart in Guild for free
if(getarg(0) == 2) goto L_FreeCart;
//use Free Ticket for the Cart Service if available
if(countitem(7061)){
delitem 7061,1;
goto L_FreeCart;
}
mes "[Kafra]";
mes "The Cart Fee is 800 Zeny. Do you want to Rent a Cart?";
next;
menu "-Rent a Cart.",-, "-Cancel.",M_End;
if(Zeny<800){
mes "[Kafra]";
mes "Dear, you don't have enough Money. You need 800 Zeny.";
emotion e_cash;
return 1;
}
set Zeny,Zeny-800;
set RESRVPTS, RESRVPTS + 48;
L_FreeCart:
setcart;
mes "[Kafra]";
mes "Here is your cart.";
return 1;
M_End:
return 0;
}
// Pass Function ===============================================================
function script F_KafGuide {
mes "[Kafra]";
mes "WIP...";
return;
}
// Special Reserve Points Function ===========================================
function script F_KafInfo {
sM_Menu:
//Uncomment next line to block Kafra Storage Protection
// if(getarg(0) == 0) menu "-Special Reserve Check",sM_ResChk, "-Kafra Locations",sM_KafLoc, "-Cancel",sM_End;
if(getarg(0) == 0) menu "-Special Reserve Check",sM_ResChk, "-Storage Password Service",sM_KafCode, "-Kafra Locations",sM_KafLoc, "-Cancel",sM_End;
sM_ResChk:
mes "[Kafra]";
mes "Here is your current amount of special reserve points:";
mes "^0000ff"+RESRVPTS+"^000000.";
next;
mes "[Kafra]";
mes "Remember to continue using Kafra services such as Storage and Teleport, to earn more special reserve points.";
next;
mes "[Kafra]";
mes "You can trade them in at the Kafra Main Office in Al De Baran for useful items and cool prizes.";
next;
if(getarg(0) == 1) return;
goto sM_Menu;
sM_KafLoc:
mes "[Kafra]";
mes "The flashing signals on your mini-map point to the locations of all of the Kafra Agents in this city.";
viewpoint 1,@viewpX[0],@viewpY[0],1,0xFF00FF;
viewpoint 1,@viewpX[1],@viewpY[1],2,0xFF00FF;
viewpoint 1,@viewpX[2],@viewpY[2],3,0xFF00FF;
viewpoint 1,@viewpX[3],@viewpY[3],4,0xFF00FF;
next;
viewpoint 2,@viewpX[0],@viewpY[0],1,0xFF00FF;
viewpoint 2,@viewpX[1],@viewpY[1],2,0xFF00FF;
viewpoint 2,@viewpX[2],@viewpY[2],3,0xFF00FF;
viewpoint 2,@viewpX[3],@viewpY[3],4,0xFF00FF;
goto sM_Menu;
sM_KafCode:
callfunc("F_SetKafCode");
sM_End:
return;
}
// End Function =====================================================
// arg(0): used to determine what message to display.
// arg(1): used to determine if save message is displayed.
//===================================================================
function script F_KafEnd {
mes "[Kafra]";
if(getarg(1)==1) mes "Your respawn point has been saved."; // only shown when a player uses save
if(getarg(0)!=1) mes "Thank you for using Kafra Services. We hope to see you again soon.";
if(getarg(0)==1) mes "We, Kafra Corporation.... Will be with you.... whenever.... wherever... therefore.... please don't forget us.....";
close2;
cutin "", 255;
emotion e_thx;
close;
end;
}
// Check Storage Password Function ====================
function script F_CheckKafCode {
if(#kafra_code==0) return;
mes "Enter your storage password:";
set @code_,0;
input @code_;
if(@code_ != #kafra_code-getcharid(3)-1337) {
dispbottom "Wrong storage password.";
close2;
cutin "",255;
end;
}
set @kafcode_try,0;
set @code_,0;
return;
}
// Set / Change / Clear Storage Password Function ====================
function script F_SetKafCode {
mes "[Kafra]";
if(#kafra_code) {
mes "Your storage is protected with a password. What would you do now?";
next;
menu "Change old password -> 5000z",-,
"Remove storage password -> 1000z",M_CLEAR,
"Cancel",M_END;
} else {
mes "Kafra Services proudly presents you a new service:";
mes "Additional storage protection with a password.";
next;
menu "Set new password -> 5000z",M_SET,
"Cancel",M_END;
}
mes "[Kafra]";
mes "At first, please enter your ^0000FFold password^000000.";
set @code,callfunc("F_EntKafCode");
if(@code==0 || @code != #kafra_code-getcharid(3)-1337) {
mes "Wrong password. You can't set a new password.";
emotion e_hmm;
goto M_END;
}
next;
M_SET:
mes "[Kafra]";
mes "Now enter your ^FF0000new password^000000 to protect your storage from thieves.";
set @code,callfunc("F_EntKafCode");
if(@code==0) {
mes "The password hasn't been changed.";
emotion e_hmm;
goto M_END;
}
next;
mes "[Kafra]";
if(Zeny < 5000) goto L_ZENY;
set Zeny,Zeny-5000;
set RESRVPTS, RESRVPTS + (5000/50);
set #kafra_code,@code+getcharid(3)+1337;
mes "You've protected your storage with a secret password.";
mes "Thank you for using Kafra Services.";
emotion e_thx;
goto M_END;
M_CLEAR:
mes "[Kafra]";
mes "Please, enter your password before its removal.";
set @code,callfunc("F_EntKafCode");
if(@code==0) {
mes "The password hasn't been removed.";
emotion e_hmm;
goto M_END;
}
next;
mes "[Kafra]";
if(Zeny < 1000) goto L_ZENY;
set Zeny,Zeny-1000;
set RESRVPTS, RESRVPTS + (1000/50);
if(@code == #kafra_code-getcharid(3)-1337) {
set #kafra_code,0;
mes "You've successfully cleared your storage password.";
mes "Thank you for using Kafra Services.";
emotion e_thx;
} else {
mes "Wrong password. We won't return your 1000z.";
mes "Please, next time enter correct password.";
emotion e_sry;
}
goto M_END;
L_ZENY:
mes "You don't have enough zeny.";
emotion e_cash;
M_END:
close2;
cutin "",255;
end;
}
// Basic Password Validation Function ====================
function script F_EntKafCode {
mes "Enter a number 1000~10000000:";
set @code_,0;
set @kafcode_try,@kafcode_try+1;
if(@kafcode_try>10) {
set @kafcode_try,0;
logmes "Hack: Tried to fit storage password.";
}
input @code_;
if(@code_<1000) {
mes "You shouldn't use such short password.";
return 0;
}
if(@code_>10000000) {
mes "You can't use such big password.";
return 0;
}
return @code_;
}
|