1 | //===== eAthena Script ======================================= |
---|
2 | //= Kafra Functions |
---|
3 | //===== By: ================================================== |
---|
4 | //= eAthena Dev Team |
---|
5 | //= Darlskies, Darkchild, Syrus22, Lupus, kobra_k88 (2.0) |
---|
6 | //= L0ne_W0lf |
---|
7 | //===== Current Version: ===================================== |
---|
8 | //= 6.1 |
---|
9 | //===== Compatible With: ===================================== |
---|
10 | //= eAthena 1.0 |
---|
11 | //===== Description: ========================================= |
---|
12 | //= These functions handle save, storage, cart rental, teleport, |
---|
13 | //= and Free Teleport/Warp/Rent Cart options for all Kafra NPCs. |
---|
14 | //= |
---|
15 | //= Kafra's will need a lot of work. The Welcome Message argument |
---|
16 | //= may become obsolete, as most kafras have a slightly differing |
---|
17 | //= Welcome message. |
---|
18 | //===== Additional Comments: ================================= |
---|
19 | //= v1.1 Now using functions v2.1 Added Cart Rent for Classes: Whitesmith, Professor. |
---|
20 | //= Replaced checkoption(x) into checkcart(0) [Lupus] v2.1b Added Fix Kafra Pass Func [Kobra_k88] |
---|
21 | //= 2.2 Final fix of the Kafra Pass Exploit! [Lupus] a -Izlude[4] fix |
---|
22 | //= 2.2a Minor changes to function calls. Using agruments. Added Guild options. [kobra_k88] |
---|
23 | //= 2.2b This version uses arrays for the teleport option. Rearranged next statements to make menu transitions smoother. [kobra_k88] |
---|
24 | //= 2.3 Removed SAVE from Niflheim. [Lupus] |
---|
25 | //= 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] |
---|
26 | //= 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] |
---|
27 | //= 2.5 Added Louyang official Kafra, fixes some Kafras, not letting you to Save your position [Lupus] |
---|
28 | //= 2.6 Reverted Dungeons Kafras (they should offer only Storage). Added temp Ayothaya Kafra |
---|
29 | //= 2.7 Added correct Ayothaya, Louyang & Amatsu Kafras. [Lupus] |
---|
30 | //= 2.8 Fixed Amatsu Storage problems [Lupus] 2.9 Fixed spelling mistakes. [Nexon] |
---|
31 | //= 3.0 Added special "not working teleport menu" for Einbroch Kafras [Lupus] |
---|
32 | //= 3.1 Removed callfunc Is_####_Class in favor of baseClass [Silentdragon] |
---|
33 | //= 3.2 Fixed an exploit [Lupus] |
---|
34 | //= 4.0 Added Kafra storage password protection. [Lupus] |
---|
35 | //= to block Kafra Password, read comments at 350 line |
---|
36 | //= Note: You can change '1337' value to another to raise password protection |
---|
37 | //= 5.0 Fixed the close2;....close; end; lines. Who let them slip away? =/ [erKURITA] |
---|
38 | //= Also, the kafra upon warp was giving back the zeny. Removed. [erKURITA] |
---|
39 | //= 5.1 Optimized a little, added no tele/save arg's [Evera] |
---|
40 | //= 5.1a Temporary? Added F_ClearGarbage to clear unused/outdated variables [Lupus] |
---|
41 | //= 5.2 By default commented out custom Guilds Kafra's "Guild Storage". [Lupus] |
---|
42 | //= 5.3 uncommented Guild Storage. Confirmed kRO feature. [Lupus] |
---|
43 | //= 5.4 added -Guide option (Kafra shows you nearest Guide) Work in progress. |
---|
44 | //= Need all coords for all guides.. and somehow pass their coords to kafra. |
---|
45 | //= Removed universal Kafra Pass, added 3 new Kafra Tickets [Lupus] |
---|
46 | //= 5.4b temporary moved "-Guide" from the 1st menu punct [Lupus] |
---|
47 | //= 5.5 Added proper Niflheim welcome message. [L0ne_W0lf] |
---|
48 | //= Cleaned up the menus a bit. Got rid of the proceeding "-" prefix. |
---|
49 | //= 5.5b Missed a preceeding hyphen, which was screwing up teleporting. [L0ne_W0lf] |
---|
50 | //= 5.6 Further dialog updates, added dynamic costs for cart and storage use. [L0ne_W0lf] |
---|
51 | //= Updated some functions to handle Guild Kafras the way they should. |
---|
52 | //= 5.6a Corrected a few wrong names in the teleport function. [L0ne_W0lf] |
---|
53 | //= 5.7 Correced end message no longer displaying, and the duplicate names [L0ne_W0lf] |
---|
54 | //= Thanks to Barron-Monster for pointing out the issues. |
---|
55 | //= 5.8 Fixed another double name being shown when "saving" [L0ne_W0lf] |
---|
56 | //= 5.9 Fixed the Kafra Welcome message for guilds. Thanks Barron-Monster. [L0ne_W0lf] |
---|
57 | //= 6.0 Closed Kafra Password exploit in Cool Event Corp. Storages until we got a client/packet based password support. |
---|
58 | //= Added 2 args into F_SetKafCode to fit it in Cool Evnt Co. NPC [Lupus] |
---|
59 | //= 6.1 Added menu for Turbo Track Kafra Staff. [L0ne_W0lf] |
---|
60 | //============================================================ |
---|
61 | |
---|
62 | |
---|
63 | // Main Function =========================================================== |
---|
64 | //= arg(0): Used to determine which welcome message to show. |
---|
65 | //= arg(1): Used to determine which menu to display. |
---|
66 | //= arg(2): Used to determine if the info menu is shown in F_KafInfo. |
---|
67 | //= arg(3): Cost to use Storage |
---|
68 | //= arg(4): Cost to Rent a Pushcart |
---|
69 | //========================================================================== |
---|
70 | function script F_Kafra { |
---|
71 | callfunc "F_ClearGarbage"; //Clear outdated, unused variables |
---|
72 | |
---|
73 | //Display Kafra Welcome Message |
---|
74 | switch(getarg(0)){ |
---|
75 | //Default message (obsolete) |
---|
76 | default: |
---|
77 | case 0: |
---|
78 | mes "[Kafra Employee]"; |
---|
79 | mes "Welcome to the"; |
---|
80 | mes "Kafra Corporartion."; |
---|
81 | mes "The Kafra services"; |
---|
82 | mes "are always on your side."; |
---|
83 | mes "How may I assist you?"; |
---|
84 | break; |
---|
85 | |
---|
86 | //Niflheim specific message |
---|
87 | case 1: |
---|
88 | mes "[Kafra Employee]"; |
---|
89 | mes "^666666W-weeeelc-c-come"; |
---|
90 | mes "to th-the K-kaaafrrrra"; |
---|
91 | mes "C-coorpoor-r-ratioooonn...^000000"; |
---|
92 | break; |
---|
93 | |
---|
94 | //Guild Castle Kafra message |
---|
95 | case 2: |
---|
96 | set @GID,getcharid(2); |
---|
97 | mes "[Kafra Employee]"; |
---|
98 | mes "Welcome. ^ff0000" + GetGuildName(@GID) + "^000000 Member."; |
---|
99 | mes "The Kafra Coporation will stay with you wherever you go."; |
---|
100 | break; |
---|
101 | |
---|
102 | //Amatsu specific message (obsolete) |
---|
103 | case 3: |
---|
104 | mes "[Kafra Employee]"; |
---|
105 | mes "So, have you come from a faraway land to study our culture, or are you just sightseeing?"; |
---|
106 | mes "In either case, why not stay awhile?"; |
---|
107 | mes "The air is eternally heavy with the"; |
---|
108 | mes "scent of pleasant wildflowers."; |
---|
109 | break; |
---|
110 | |
---|
111 | //Louyang and Ayothaya specific message (obsolete) |
---|
112 | case 4: |
---|
113 | mes "[Kafra Employee]"; |
---|
114 | mes "With our many Kafra"; |
---|
115 | mes "service locations, you're never"; |
---|
116 | mes "far from home."; |
---|
117 | break; |
---|
118 | |
---|
119 | //NPC has it's own welcome message. (Display nothing) |
---|
120 | case 5: |
---|
121 | break; |
---|
122 | } |
---|
123 | next; |
---|
124 | |
---|
125 | M_Menu: |
---|
126 | cleararray @K_Menu0$[0],"",7; |
---|
127 | switch(getarg(1)){ |
---|
128 | // Save and Storage only |
---|
129 | case 1: |
---|
130 | setarray @K_Menu0$[0],"Save","Use Storage","Cancel"; |
---|
131 | break; |
---|
132 | |
---|
133 | // Storage only |
---|
134 | case 2: |
---|
135 | setarray @K_Menu0$[0],"Use Storage","Cancel"; |
---|
136 | break; |
---|
137 | |
---|
138 | // No Teleport (Common) |
---|
139 | case 3: |
---|
140 | setarray @K_Menu0$[0],"Save","Use Storage","Rent a Pushcart","Guide","Check Other Information","Cancel"; |
---|
141 | break; |
---|
142 | |
---|
143 | // Case 4 is Einbroch no tele message. |
---|
144 | |
---|
145 | // No save, or teleport. (Common) |
---|
146 | case 5: |
---|
147 | setarray @K_Menu0$[0],"Use Storage","Rent a Pushcart","Check Other Information","Guide","Cancel"; |
---|
148 | break; |
---|
149 | |
---|
150 | // Storage and Check Other Information only. |
---|
151 | case 6: |
---|
152 | setarray @K_Menu0$[0],"Use Storage","Guide","Check Other Information","Cancel"; |
---|
153 | break; |
---|
154 | |
---|
155 | // Save, Storage, and Pushcart only (Kafra Warehouse) |
---|
156 | case 7: |
---|
157 | setarray @K_Menu0$[0],"Save","Use Storage","Rent a Pushcart","Cancel"; |
---|
158 | break; |
---|
159 | |
---|
160 | // Save, Storage, Other Check information. (Turbo track) |
---|
161 | case 8: |
---|
162 | setarray @K_Menu0$[0],"Save","Use Storage","Check Other Information","Cancel"; |
---|
163 | break; |
---|
164 | |
---|
165 | // Common Kafra Employee |
---|
166 | default: |
---|
167 | setarray @K_Menu0$[0],"Save","Use Storage","Use Teleport Service","Rent a Pushcart","Guide","Check Other Information","Cancel"; |
---|
168 | break; |
---|
169 | } |
---|
170 | |
---|
171 | // Guild Kafra Menu override (free Teleport, free Storage, Free Cart) |
---|
172 | if(getarg(0)==2) { |
---|
173 | cleararray @K_Menu0$[0],"",7; |
---|
174 | setarray @K_Menu0$[0],"Use Storage","Use Guild Storage","Rent a Pushcart","Use Teleport Service","Cancel"; |
---|
175 | } |
---|
176 | menu @K_Menu0$[0],K_Menu0,@K_Menu0$[1],K_Menu1,@K_Menu0$[2],K_Menu2, |
---|
177 | @K_Menu0$[3],K_Menu3,@K_Menu0$[4],K_Menu4,@K_Menu0$[5],K_Menu5, |
---|
178 | @K_Menu0$[6],K_Menu6,@K_Menu0$[7],K_Menu7; |
---|
179 | K_Menu0: |
---|
180 | set @num,0; |
---|
181 | goto K_Menuf; |
---|
182 | K_Menu1: |
---|
183 | set @num,1; |
---|
184 | goto K_Menuf; |
---|
185 | K_Menu2: |
---|
186 | set @num,2; |
---|
187 | goto K_Menuf; |
---|
188 | K_Menu3: |
---|
189 | set @num,3; |
---|
190 | goto K_Menuf; |
---|
191 | K_Menu4: |
---|
192 | set @num,4; |
---|
193 | goto K_Menuf; |
---|
194 | K_Menu5: |
---|
195 | set @num,5; |
---|
196 | goto K_Menuf; |
---|
197 | K_Menu6: |
---|
198 | set @num,6; |
---|
199 | goto K_Menuf; |
---|
200 | K_Menu7: |
---|
201 | set @num,7; |
---|
202 | K_Menuf: |
---|
203 | if (@K_Menu0$[@num] == "Save") return; |
---|
204 | if (@K_Menu0$[@num] == "Use Storage"){ |
---|
205 | // Do not charge for Guild Storage |
---|
206 | if(getarg(0) == 2) callfunc "F_KafStor",2,0,0; |
---|
207 | else callfunc "F_KafStor",0,getarg(3),getarg(0); |
---|
208 | next; |
---|
209 | goto M_Menu; |
---|
210 | } |
---|
211 | if (@K_Menu0$[@num] == "Use Teleport Service"){ |
---|
212 | // Display Einbroch "No Teleport Service" notice. |
---|
213 | if(getarg(1) == 4){ |
---|
214 | mes "[Kafra Employee]"; |
---|
215 | mes "Because of the ^FF0000Limited"; |
---|
216 | mes "Transport Agreement^000000, the"; |
---|
217 | mes "Kafra Corporation cannot"; |
---|
218 | mes "provide Teleport Services"; |
---|
219 | mes "in the Schwaltzvalt Republic."; |
---|
220 | next; |
---|
221 | mes "[Kafra Employee]"; |
---|
222 | mes "We ask that you please"; |
---|
223 | mes "use the Airship Service"; |
---|
224 | mes "instead. Thank you for your"; |
---|
225 | mes "understanding and cooperation."; |
---|
226 | next; |
---|
227 | goto M_Menu; |
---|
228 | } |
---|
229 | callfunc "F_KafTele",getarg(0); |
---|
230 | goto M_Menu; |
---|
231 | } |
---|
232 | if (@K_Menu0$[@num] == "Rent a Pushcart"){ |
---|
233 | if(callfunc("F_KafCart",getarg(0),getarg(4)) == 1) next; |
---|
234 | goto M_Menu; |
---|
235 | } |
---|
236 | if (@K_Menu0$[@num] == "Guide"){ |
---|
237 | callfunc "F_KafGuide"; |
---|
238 | next; |
---|
239 | goto M_Menu; |
---|
240 | } |
---|
241 | if (@K_Menu0$[@num] == "Check Other Information"){ |
---|
242 | callfunc "F_KafInfo",getarg(2); |
---|
243 | goto M_Menu; |
---|
244 | } |
---|
245 | if (@K_Menu0$[@num] == "Cancel"){ |
---|
246 | callfunc "F_KafEnd",getarg(0),0; |
---|
247 | end; |
---|
248 | } |
---|
249 | if (@K_Menu0$[@num] == "Use Guild Storage"){ |
---|
250 | callfunc "F_KafStor",1,0; |
---|
251 | next; |
---|
252 | goto M_Menu; |
---|
253 | } |
---|
254 | |
---|
255 | } |
---|
256 | |
---|
257 | |
---|
258 | // Storage Function ======================================================= |
---|
259 | function script F_KafStor { |
---|
260 | // Unable to access Guild Storage (Busy) |
---|
261 | if(getarg(0) == 1){ |
---|
262 | if(guildopenstorage(0) == 1){ |
---|
263 | mes "[Kafra Employee]"; |
---|
264 | mes "I'm sorry but another guild member is using the guild storage"; |
---|
265 | mes "right now. Please wait until that person is finished."; |
---|
266 | close2; |
---|
267 | cutin "", 255; |
---|
268 | end; |
---|
269 | } |
---|
270 | cutin "", 255; |
---|
271 | close; |
---|
272 | } |
---|
273 | |
---|
274 | // Unable to access Normal Storage (Insufficient Basic Skills) |
---|
275 | if(basicskillcheck() && getskilllv("NV_BASIC") < 6){ |
---|
276 | mes "[Kafra Employee]"; |
---|
277 | // Niflheim Specific Message |
---|
278 | if (getarg(2) == 1) { |
---|
279 | mes "^666666S-s-ssoooorry,"; |
---|
280 | mes "y-you're a-a-aaaa"; |
---|
281 | mes "Nooviiice... N-neeeds"; |
---|
282 | mes "B-basic sssskill l-level 6...^000000"; |
---|
283 | return; |
---|
284 | } |
---|
285 | mes "I'm sorry, but you"; |
---|
286 | mes "need the Novice's"; |
---|
287 | mes "Basic Skill Level 6 to"; |
---|
288 | mes "use the Storage Service."; |
---|
289 | return; |
---|
290 | } |
---|
291 | |
---|
292 | // Accessing Normal Storage (Skipped if accessing Storage from Guild castle) |
---|
293 | if(getarg(0) != 2){ |
---|
294 | // Consume "Free Ticket for Kafra Storage" if available. |
---|
295 | if(countitem(7059)) delitem 7059,1; |
---|
296 | else { |
---|
297 | if(Zeny<getarg(1)){ |
---|
298 | mes "[Kafra Employee]"; |
---|
299 | // Niflheim Specific Message |
---|
300 | if (getarg(2) == 1) { |
---|
301 | percentheal -50,-50; |
---|
302 | mes "^666666Zeeeeeny..."; |
---|
303 | mes "M-more z-zeny...!"; |
---|
304 | mes "N-neeed 150... zeny..."; |
---|
305 | mes "Ergh! T-taking bl-blood~!^000000"; |
---|
306 | return; |
---|
307 | } |
---|
308 | //Standard Message |
---|
309 | mes "I'm sorry, but you don't"; |
---|
310 | mes "have enough zeny to use"; |
---|
311 | mes "the Storage Service. Our"; |
---|
312 | mes "Storage access fee is "+getarg(1)+" zeny."; |
---|
313 | return; |
---|
314 | } |
---|
315 | set Zeny, Zeny-getarg(1); |
---|
316 | set RESRVPTS, RESRVPTS + (getarg(1)/5); |
---|
317 | } |
---|
318 | } |
---|
319 | |
---|
320 | // Surpress the "End" message if in guild castle. |
---|
321 | if (getarg(0) != 2) { |
---|
322 | // Niflheim specific Message |
---|
323 | if (getarg(2) == 1) { |
---|
324 | percentheal 0,-10; |
---|
325 | mes "[Kafra Employee]"; |
---|
326 | mes "^666666Thank you.. for... using..."; |
---|
327 | mes "Thank you.. for... using..."; |
---|
328 | mes "Thank you.. for... using..."; |
---|
329 | mes "Thank you.. for... using..."; |
---|
330 | mes "Thank you.. for... using...^000000"; |
---|
331 | } |
---|
332 | // Normal message |
---|
333 | else { |
---|
334 | mes "[Kafra Employee]"; |
---|
335 | mes "Here, let me open"; |
---|
336 | mes "your Storage for you."; |
---|
337 | mes "Thank you for using"; |
---|
338 | mes "the Kafra Service."; |
---|
339 | } |
---|
340 | } |
---|
341 | callfunc("F_CheckKafCode"); //check your storage password, if set |
---|
342 | |
---|
343 | close2; |
---|
344 | openstorage; |
---|
345 | cutin "", 255; |
---|
346 | end; |
---|
347 | } |
---|
348 | |
---|
349 | |
---|
350 | // Teleport Function ================================================== |
---|
351 | function script F_KafTele { |
---|
352 | mes "[Kafra Employee]"; |
---|
353 | mes "Please choose"; |
---|
354 | mes "your destination."; |
---|
355 | next; |
---|
356 | |
---|
357 | menu @wrpC$[0],M_Wrp0, @wrpC$[1],M_Wrp1, @wrpC$[2],M_Wrp2, @wrpC$[3],M_Wrp3, |
---|
358 | @wrpC$[4],M_Wrp4, @wrpC$[5],M_Wrp5, @wrpC$[6],M_Wrp6; |
---|
359 | |
---|
360 | M_Wrp0: |
---|
361 | set @num, 0; |
---|
362 | goto L_Warp; |
---|
363 | M_Wrp1: |
---|
364 | set @num, 1; |
---|
365 | goto L_Warp; |
---|
366 | M_Wrp2: |
---|
367 | set @num, 2; |
---|
368 | goto L_Warp; |
---|
369 | M_Wrp3: |
---|
370 | set @num, 3; |
---|
371 | goto L_Warp; |
---|
372 | M_Wrp4: |
---|
373 | set @num, 4; |
---|
374 | goto L_Warp; |
---|
375 | M_Wrp5: |
---|
376 | set @num, 5; |
---|
377 | goto L_Warp; |
---|
378 | M_Wrp6: |
---|
379 | set @num, 6; |
---|
380 | |
---|
381 | L_Warp: |
---|
382 | if (@wrpC$[@num] == "Cancel") return; |
---|
383 | // Consume "Free Ticket for Kafra Transportation" if available. |
---|
384 | // Do not consume if in Guild castle |
---|
385 | if(countitem(7060) > 0 && getarg(0) != 2) delitem 7060,1; |
---|
386 | else { |
---|
387 | if (Zeny<@wrpP[@num]){ |
---|
388 | mes "[Kafra Employee]"; |
---|
389 | mes "I'm sorry, but you don't have"; |
---|
390 | mes "enough zeny for the Teleport"; |
---|
391 | mes "Service. The fee to teleport"; |
---|
392 | mes "to "+@wrpD$[@num]+" is "+@wrpP[@num]+" zeny."; |
---|
393 | close2; |
---|
394 | cutin "", 255; |
---|
395 | end; |
---|
396 | } |
---|
397 | set Zeny, Zeny-@wrpP[@num]; |
---|
398 | set RESRVPTS, RESRVPTS + (@wrpP[@num]/16); |
---|
399 | } |
---|
400 | if (@wrpD$[@num] == "Alberta") warp "alberta", 117, 56; |
---|
401 | if (@wrpD$[@num] == "Al De Baran") warp "aldebaran",143,110; |
---|
402 | if (@wrpD$[@num] == "Aldebaran") warp "aldebaran",143,110; |
---|
403 | if (@wrpD$[@num] == "Comodo") warp "comodo", 207, 144; |
---|
404 | if (@wrpD$[@num] == "Izlude") warp "izlude", 91, 105; |
---|
405 | if (@wrpD$[@num] == "Geffen") warp "geffen", 120, 39; |
---|
406 | if (@wrpD$[@num] == "Morroc") warp "morocc", 156, 46; |
---|
407 | if (@wrpD$[@num] == "Payon") warp "payon", 168, 103; |
---|
408 | if (@wrpD$[@num] == "Prontera") warp "prontera", 116, 72; |
---|
409 | if (@wrpD$[@num] == "Mjolnir Dead Pit") warp "mjolnir_02", 82, 347; |
---|
410 | if (@wrpD$[@num] == "Comodo Pharos Beacon") warp "cmd_fild07", 127, 134; |
---|
411 | if (@wrpD$[@num] == "Orc Dungeon") warp "gef_fild10", 52, 326; |
---|
412 | if (@wrpD$[@num] == "Umbala") warp "umbala", 130, 130; |
---|
413 | if (@wrpD$[@num] == "Juno") warp "yuno", 157, 123; |
---|
414 | cutin "", 255; |
---|
415 | end; |
---|
416 | } |
---|
417 | |
---|
418 | |
---|
419 | // Cart Function ======================================================== |
---|
420 | function script F_KafCart { |
---|
421 | // Ensure that the class wanting to rent a pushcart is a merchant |
---|
422 | if(baseClass != Job_Merchant){ |
---|
423 | mes "[Kafra Employee]"; |
---|
424 | mes "I'm sorry, but the"; |
---|
425 | mes "Pushcart rental service"; |
---|
426 | mes "is only available to Merchants,"; |
---|
427 | mes "Blacksmiths, Master Smiths,"; |
---|
428 | mes "Alchemists and Biochemists."; |
---|
429 | return 1; |
---|
430 | } |
---|
431 | // Make sure the invoking character does not have a cart already |
---|
432 | else if(checkcart() == 1){ |
---|
433 | mes "[Kafra Employee]"; |
---|
434 | mes "You already have"; |
---|
435 | mes "a Pushcart equipped."; |
---|
436 | mes "Unfortunately, we can't"; |
---|
437 | mes "rent more than one to"; |
---|
438 | mes "each customer at a time."; |
---|
439 | return 1; |
---|
440 | } |
---|
441 | |
---|
442 | // Consume "Free Ticket for the Cart Service" if available. |
---|
443 | // Do not consume if in Guild castle. |
---|
444 | if(countitem(7061) > 0 && getarg(0) != 2) delitem 7061,1; |
---|
445 | else { |
---|
446 | mes "[Kafra Employee]"; |
---|
447 | mes "The Pushcart rental"; |
---|
448 | mes "fee is "+getarg(1)+" zeny. Would"; |
---|
449 | mes "you like to rent a Pushcart?"; |
---|
450 | next; |
---|
451 | menu "Rent a Pushcart.",-, "Cancel.",M_End; |
---|
452 | if(Zeny<getarg(1)){ |
---|
453 | mes "[Kafra Employee]"; |
---|
454 | mes "I'm sorry, but you"; |
---|
455 | mes "don't have enough"; |
---|
456 | mes "zeny to pay the Pushcart"; |
---|
457 | mes "rental fee of "+getarg(1)+" zeny."; |
---|
458 | return 1; |
---|
459 | } |
---|
460 | set Zeny,Zeny-getarg(1); |
---|
461 | set RESRVPTS, RESRVPTS + 48; |
---|
462 | } |
---|
463 | setcart; |
---|
464 | return 1; |
---|
465 | |
---|
466 | M_End: |
---|
467 | return 0; |
---|
468 | } |
---|
469 | |
---|
470 | |
---|
471 | // Pass Function =============================================================== |
---|
472 | function script F_KafGuide { |
---|
473 | mes "[Kafra Employee]"; |
---|
474 | mes "WIP..."; |
---|
475 | return; |
---|
476 | } |
---|
477 | |
---|
478 | // Special Reserve Points Function =========================================== |
---|
479 | function script F_KafInfo { |
---|
480 | |
---|
481 | sM_Menu: |
---|
482 | //Uncomment next line to block Kafra Storage Protection |
---|
483 | // if(getarg(0) == 0) menu "Check Special Reserve Points.",sM_ResChk, "Kafra Employee Locations",sM_KafLoc, "Cancel",sM_End; |
---|
484 | if(getarg(0) == 0) menu "Check Special Reserve Points.",sM_ResChk, "Storage Password Service",sM_KafCode, "Kafra Employee Locations",sM_KafLoc, "Cancel",sM_End; |
---|
485 | |
---|
486 | sM_ResChk: |
---|
487 | mes "[Kafra Employee]"; |
---|
488 | mes "Let's see..."; |
---|
489 | mes strcharinfo(0) + "..."; |
---|
490 | mes "Ah, you have a total of"; |
---|
491 | mes RESRVPTS+ " Special Reserve Points."; |
---|
492 | next; |
---|
493 | mes "[Kafra Employee]"; |
---|
494 | mes "You can exchange your"; |
---|
495 | mes "Special Reserve Points for"; |
---|
496 | mes "rewards at the Kafra Main Office in Al De Baran. Please use our"; |
---|
497 | mes "convenient services to see the benefits of our rewards program."; |
---|
498 | next; |
---|
499 | if(getarg(0) == 1) return; |
---|
500 | goto sM_Menu; |
---|
501 | |
---|
502 | sM_KafLoc: |
---|
503 | viewpoint 1,@viewpX[0],@viewpY[0],1,0xFF00FF; |
---|
504 | viewpoint 1,@viewpX[1],@viewpY[1],2,0xFF00FF; |
---|
505 | viewpoint 1,@viewpX[2],@viewpY[2],3,0xFF00FF; |
---|
506 | viewpoint 1,@viewpX[3],@viewpY[3],4,0xFF00FF; |
---|
507 | next; |
---|
508 | viewpoint 2,@viewpX[0],@viewpY[0],1,0xFF00FF; |
---|
509 | viewpoint 2,@viewpX[1],@viewpY[1],2,0xFF00FF; |
---|
510 | viewpoint 2,@viewpX[2],@viewpY[2],3,0xFF00FF; |
---|
511 | viewpoint 2,@viewpX[3],@viewpY[3],4,0xFF00FF; |
---|
512 | goto sM_Menu; |
---|
513 | |
---|
514 | sM_KafCode: |
---|
515 | callfunc("F_SetKafCode","[Kafra Employee]","Kafra Services"); |
---|
516 | |
---|
517 | sM_End: |
---|
518 | return; |
---|
519 | } |
---|
520 | |
---|
521 | |
---|
522 | // End Function ===================================================== |
---|
523 | // arg(0): used to determine what message to display. |
---|
524 | // arg(1): used to determine if save message is displayed. |
---|
525 | // arg(2): used to display the name of the area you're saving in. |
---|
526 | //=================================================================== |
---|
527 | function script F_KafEnd { |
---|
528 | mes "[Kafra Employee]"; |
---|
529 | //Save |
---|
530 | if(getarg(1)==1) { |
---|
531 | mes "Your Respawn Point"; |
---|
532 | mes "has been saved here"; |
---|
533 | mes getarg(2)+"."; |
---|
534 | mes "Thank you for using"; |
---|
535 | mes "the Kafra Services."; |
---|
536 | } |
---|
537 | |
---|
538 | // Generic End |
---|
539 | else if(getarg(0)==0 || getarg(0)==5) { |
---|
540 | mes "We, here at Kafra Corporation,"; |
---|
541 | mes "are always endeavoring to provide you with the best services. We hope that we meet your adventuring needs and standards of excellence."; |
---|
542 | } |
---|
543 | |
---|
544 | // Niflheim End |
---|
545 | else if(getarg(0)==1) { |
---|
546 | percentheal 0,- 25; |
---|
547 | mes "^666666Kaffffra n-never"; |
---|
548 | mes "diiiiiiiiiiiiiies. On..."; |
---|
549 | mes "On y-yooour siiiiide~^000000"; |
---|
550 | } |
---|
551 | |
---|
552 | close2; |
---|
553 | cutin "", 255; |
---|
554 | end; |
---|
555 | } |
---|
556 | |
---|
557 | // Check Storage Password Function ==================== |
---|
558 | function script F_CheckKafCode { |
---|
559 | if(#kafra_code==0) return; |
---|
560 | mes "Enter your storage password:"; |
---|
561 | set @code_,0; |
---|
562 | input @code_; |
---|
563 | if(@code_ != #kafra_code-getcharid(3)-1337) { |
---|
564 | dispbottom "Wrong storage password."; |
---|
565 | close2; |
---|
566 | cutin "",255; |
---|
567 | end; |
---|
568 | } |
---|
569 | set @kafcode_try,0; |
---|
570 | set @code_,0; |
---|
571 | return; |
---|
572 | } |
---|
573 | |
---|
574 | // Set / Change / Clear Storage Password Function ==================== |
---|
575 | // getarg(0) = NPC Name, getarg(1) = Company Name |
---|
576 | function script F_SetKafCode { |
---|
577 | mes getarg(0); |
---|
578 | if(#kafra_code) { |
---|
579 | mes "Your storage is protected with a password. What would you do now?"; |
---|
580 | next; |
---|
581 | menu "Change old password -> 5000z",-, |
---|
582 | "Remove storage password -> 1000z",M_CLEAR, |
---|
583 | "Cancel",M_END; |
---|
584 | } else { |
---|
585 | mes ""+getarg(1)+" proudly presents you a new service:"; |
---|
586 | mes "Additional storage protection with a password."; |
---|
587 | next; |
---|
588 | menu "Set new password -> 5000z",M_SET, |
---|
589 | "Cancel",M_END; |
---|
590 | } |
---|
591 | |
---|
592 | mes getarg(0); |
---|
593 | mes "At first, please enter your ^0000FFold password^000000."; |
---|
594 | set @code,callfunc("F_EntKafCode"); |
---|
595 | if(@code==0 || @code != #kafra_code-getcharid(3)-1337) { |
---|
596 | mes "Wrong password. You can't set a new password."; |
---|
597 | emotion e_hmm; |
---|
598 | goto M_END; |
---|
599 | } |
---|
600 | next; |
---|
601 | |
---|
602 | M_SET: |
---|
603 | mes getarg(0); |
---|
604 | mes "Now enter your ^FF0000new password^000000 to protect your storage from thieves."; |
---|
605 | set @code,callfunc("F_EntKafCode"); |
---|
606 | if(@code==0) { |
---|
607 | mes "The password hasn't been changed."; |
---|
608 | emotion e_hmm; |
---|
609 | goto M_END; |
---|
610 | } |
---|
611 | next; |
---|
612 | mes getarg(0); |
---|
613 | if(Zeny < 5000) goto L_ZENY; |
---|
614 | set Zeny,Zeny-5000; |
---|
615 | //set RESRVPTS, RESRVPTS + (5000/50); //hardcoded password doesn't add pts |
---|
616 | |
---|
617 | set #kafra_code,@code+getcharid(3)+1337; |
---|
618 | mes "You've protected your storage with a secret password."; |
---|
619 | mes "Thank you for using "+getarg(1)+"."; |
---|
620 | emotion e_thx; |
---|
621 | goto M_END; |
---|
622 | |
---|
623 | M_CLEAR: |
---|
624 | mes getarg(0); |
---|
625 | mes "Please, enter your password before its removal."; |
---|
626 | set @code,callfunc("F_EntKafCode"); |
---|
627 | if(@code==0) { |
---|
628 | mes "The password hasn't been removed."; |
---|
629 | emotion e_hmm; |
---|
630 | goto M_END; |
---|
631 | } |
---|
632 | next; |
---|
633 | mes getarg(0); |
---|
634 | if(Zeny < 1000) goto L_ZENY; |
---|
635 | set Zeny,Zeny-1000; |
---|
636 | //set RESRVPTS, RESRVPTS + (1000/50); //hardcoded password doesn't add pts |
---|
637 | if(@code == #kafra_code-getcharid(3)-1337) { |
---|
638 | set #kafra_code,0; |
---|
639 | mes "You've successfully cleared your storage password."; |
---|
640 | mes "Thank you for using "+getarg(1)+"."; |
---|
641 | emotion e_thx; |
---|
642 | } else { |
---|
643 | mes "Wrong password. We won't return your 1000z."; |
---|
644 | mes "Please, next time enter correct password."; |
---|
645 | emotion e_sry; |
---|
646 | } |
---|
647 | goto M_END; |
---|
648 | |
---|
649 | L_ZENY: |
---|
650 | mes "You don't have enough zeny."; |
---|
651 | emotion e_cash; |
---|
652 | M_END: |
---|
653 | close2; |
---|
654 | cutin "",255; |
---|
655 | end; |
---|
656 | } |
---|
657 | |
---|
658 | // Basic Password Validation Function ==================== |
---|
659 | function script F_EntKafCode { |
---|
660 | mes "Enter a number 1000~10000000:"; |
---|
661 | set @code_,0; |
---|
662 | set @kafcode_try,@kafcode_try+1; |
---|
663 | if(@kafcode_try>10) { |
---|
664 | set @kafcode_try,0; |
---|
665 | logmes "Hack: Tried to fit storage password."; |
---|
666 | } |
---|
667 | input @code_; |
---|
668 | if(@code_<1000) { |
---|
669 | mes "You shouldn't use such short password."; |
---|
670 | return 0; |
---|
671 | } |
---|
672 | if(@code_>10000000) { |
---|
673 | mes "You can't use such big password."; |
---|
674 | return 0; |
---|
675 | } |
---|
676 | return @code_; |
---|
677 | } |
---|