functions_kafras.txt 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. //===== eAthena Script =======================================
  2. //= Kafra Functions
  3. //===== By: ==================================================
  4. //= Lotsa People (1.0)
  5. //= eAthena Dev Team
  6. //= Darlskies, Darkchild, Syrus22, Lupus, kobra_k88 (2.0)
  7. //===== Current Version: =====================================
  8. //= 5.2
  9. //===== Compatible With: =====================================
  10. //= eAthena 1.0
  11. //===== Description: =========================================
  12. //= These functions handle save, storage, cart rental, teleport,
  13. //= and Kafra pass options for all Kafra NPCs.
  14. //===== Additional Comments: =================================
  15. //= v1.1 Now using functions v2.1 Added Cart Rent for Classes: Whitesmith, Professor.
  16. //= Replaced checkoption(x) into checkcart(0) [Lupus] v2.1b Added Fix Kafra Pass Func [Kobra_k88]
  17. //= 2.2 Final fix of the Kafra Pass Exploit! [Lupus] a -Izlude[4] fix
  18. //= 2.2a Minor changes to function calls. Using agruments. Added Guild options. [kobra_k88]
  19. //= 2.2b This version uses arrays for the teleport option. Rearranged next statements to make menu transitions smoother. [kobra_k88]
  20. //= 2.3 Removed SAVE from Niflheim. [Lupus]
  21. //= 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]
  22. //= 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]
  23. //= 2.5 Added Louyang official Kafra, fixes some Kafras, not letting you to Save your position [Lupus]
  24. //= 2.6 Reverted Dungeons Kafras (they should offer only Storage). Added temp Ayothaya Kafra
  25. //= 2.7 Added correct Ayothaya, Louyang & Amatsu Kafras. [Lupus]
  26. //= 2.8 Fixed Amatsu Storage problems [Lupus] 2.9 Fixed spelling mistakes. [Nexon]
  27. //= 3.0 Added special "not working teleport menu" for Einbroch Kafras [Lupus]
  28. //= 3.1 Removed callfunc Is_####_Class in favor of baseClass [Silentdragon]
  29. //= 3.2 Fixed an exploit [Lupus]
  30. //= 4.0 Added Kafra storage password protection. [Lupus]
  31. //= to block Kafra Password, read comments at 350 line
  32. //= Note: You can change '1337' value to another to raise password protection
  33. //= 5.0 Fixed the close2;....close; end; lines. Who let them slip away? =/ [erKURITA]
  34. //= Also, the kafra upon warp was giving back the zeny. Removed. [erKURITA]
  35. //= 5.1 Optimized a little, added no tele/save arg's [Evera]
  36. //= 5.1a Temporary? Added F_ClearGarbage to clear unused/outdated variables [Lupus]
  37. //= 5.2 By default commented out custom Guilds Kafra's "Guild Storage". [Lupus]
  38. //============================================================
  39. // Main Function ===========================================================
  40. //= arg(0): Used to determine which welcome message to show.
  41. //= arg(1): Used to determine which menu to display.
  42. //= arg(2): Used to determine if the info menu is shown in F_KafInfo.
  43. //==========================================================================
  44. function script F_Kafra {
  45. set @kafPass, 0;
  46. callfunc "F_ClearGarbage"; //Clear outdated, unused variables
  47. mes "[Kafra]";
  48. switch(getarg(0)){
  49. default:
  50. case 0:
  51. mes "Welcome to Kafra Corp. We will stay with you wherever you go.";
  52. break;
  53. //Niflheim
  54. case 1:
  55. mes "Welcome... Kafra Services.... Will be with you even if you die.....";
  56. break;
  57. //Guilds Castles
  58. case 2:
  59. mes "Welcome, ^5533FF" + GetGuildName(@GID) + "^000000 members. We will stay with you wherever you go";
  60. break;
  61. //Amatsu
  62. case 3:
  63. mes "So, have you come from a faraway land to study our culture, or are you just sightseeing?";
  64. mes "In either case, why not stay awhile?";
  65. mes "The air is eternally heavy with the";
  66. mes "scent of pleasant wildflowers.";
  67. break;
  68. //Louyang, Ayothaya
  69. case 4:
  70. mes "With our many Kafra";
  71. mes "service locations, you're never";
  72. mes "far from home.";
  73. break;
  74. }
  75. next;
  76. M_Menu:
  77. cleararray @K_Menu0$[0],"",7;
  78. switch(getarg(1)){
  79. //only Save & Storage
  80. case 1:
  81. setarray @K_Menu0$[0],"-Save","-Use Storage","-Cancel";
  82. break;
  83. //only Storage
  84. case 2:
  85. setarray @K_Menu0$[0],"-Use Storage","-Cancel";
  86. break;
  87. //Common w/o teleport
  88. case 3:
  89. setarray @K_Menu0$[0],"-Save","-Use Storage","-Rent a Cart","-Kafra Pass","-Other Information Check","-Cancel";
  90. break;
  91. //Case 4 is Einbroch no tele message.
  92. //Common w/o save and teleport
  93. case 5:
  94. setarray @K_Menu0$[0],"-Use Storage","-Rent a Cart","-Kafra Pass","-Other Information Check","-Cancel";
  95. break;
  96. //Only storage and other info check
  97. case 6:
  98. setarray @K_Menu0$[0],"-Use Storage","-Other Information Check","-Cancel";
  99. break;
  100. //Common Kafra
  101. default:
  102. setarray @K_Menu0$[0],"-Save","-Use Storage","-Use Teleport Service","-Rent a Cart","-Kafra Pass","-Other Information Check","-Cancel";
  103. break;
  104. }
  105. if(getarg(0)==2) {
  106. //Guilds Kafra
  107. cleararray @K_Menu0$[0],"",7;
  108. setarray @K_Menu0$[0],"-Use Storage","-Use Teleport Service","-Rent a Cart","-Cancel";
  109. //cleararray @K_Menu0$[0],"",7;
  110. //setarray @K_Menu0$[0],"-Use Storage","-Use Guild Storage","-Rent a Cart","-Use Teleport Service","-Cancel";
  111. }
  112. menu @K_Menu0$[0],K_Menu0,@K_Menu0$[1],K_Menu1,@K_Menu0$[2],K_Menu2,
  113. @K_Menu0$[3],K_Menu3,@K_Menu0$[4],K_Menu4,@K_Menu0$[5],K_Menu5,
  114. @K_Menu0$[6],K_Menu6,@K_Menu0$[7],K_Menu7;
  115. K_Menu0:
  116. set @num,0;
  117. goto K_Menuf;
  118. K_Menu1:
  119. set @num,1;
  120. goto K_Menuf;
  121. K_Menu2:
  122. set @num,2;
  123. goto K_Menuf;
  124. K_Menu3:
  125. set @num,3;
  126. goto K_Menuf;
  127. K_Menu4:
  128. set @num,4;
  129. goto K_Menuf;
  130. K_Menu5:
  131. set @num,5;
  132. goto K_Menuf;
  133. K_Menu6:
  134. set @num,6;
  135. goto K_Menuf;
  136. K_Menu7:
  137. set @num,7;
  138. K_Menuf:
  139. if (@K_Menu0$[@num] == "-Save") return;
  140. if (@K_Menu0$[@num] == "-Use Storage"){
  141. //Don't charge for a common Kafra Storage in your Castle
  142. if(getarg(0) == 2) callfunc "F_KafStor",2;
  143. else callfunc "F_KafStor",0;
  144. next;
  145. goto M_Menu;
  146. }
  147. if (@K_Menu0$[@num] == "-Use Teleport Service"){
  148. if(getarg(1) == 4){ //Check for Einbroch Tele notice
  149. mes "[Kafra]";
  150. mes "Because of the ^FF0000Limited Transport Agreement^000000, the Kafra Corporation cannot provide Teleport Services in the Schwarzwald Republic.";
  151. next;
  152. mes "[Kafra]";
  153. mes "We ask that you please";
  154. mes "use the Airship Service";
  155. mes "instead. Thank you for your";
  156. mes "understanding and cooperation.";
  157. next;
  158. goto M_Menu;
  159. }
  160. callfunc "F_KafTele",getarg(0);
  161. goto M_Menu;
  162. }
  163. if (@K_Menu0$[@num] == "-Rent a Cart"){
  164. if(callfunc("F_KafCart",getarg(0)) == 1) next;
  165. goto M_Menu;
  166. }
  167. if (@K_Menu0$[@num] == "-Kafra Pass"){
  168. if(callfunc("F_KafPass") == 1) next;
  169. goto M_Menu;
  170. }
  171. if (@K_Menu0$[@num] == "-Other Information Check"){
  172. callfunc "F_KafInfo",getarg(2);
  173. goto M_Menu;
  174. }
  175. if (@K_Menu0$[@num] == "-Cancel"){
  176. callfunc "F_KafEnd",getarg(0),0;
  177. end;
  178. }
  179. if (@K_Menu0$[@num] == "-Use Guild Storage"){
  180. callfunc "F_KafStor",1;
  181. next;
  182. goto M_Menu;
  183. }
  184. }
  185. // Storage Function =======================================================
  186. function script F_KafStor {
  187. if(getarg(0) == 1) goto L_Guild;
  188. if(basicskillcheck(0) > 0 && getskilllv(1) < 6) goto sL_JbLvl;
  189. if(BaseJob == Job_Novice) set @fee, 30;
  190. if(BaseJob != Job_Novice) set @fee, 60;
  191. if(@kafPass==1 || getarg(0) == 2) set @fee, 0;
  192. if(Zeny<@fee) goto sL_Zeny;
  193. set Zeny, Zeny-@fee;
  194. set RESRVPTS, RESRVPTS + (@fee/5);
  195. mes "[Kafra]";
  196. mes "Close this window to open your storage.";
  197. mes "We hope to see you again soon.";
  198. callfunc("F_CheckKafCode"); //check your storage password, if set
  199. close2;
  200. openstorage;
  201. cutin "", 255;
  202. end;
  203. sL_JbLvl:
  204. mes "[Kafra]";
  205. mes "I am sorry but you have to be at least Novice level 6 if you want to use the storage.";
  206. return;
  207. sL_Zeny:
  208. mes "[Kafra]";
  209. mes "Dear you don't have enough money. The Storage fee is "+@fee+" Zeny.";
  210. return;
  211. L_Guild:
  212. if(guildopenstorage(0) == 1) goto L_InUse;
  213. cutin "", 255;
  214. close;
  215. L_InUse:
  216. mes "[Kafra]";
  217. mes "I'm sorry but another guild member is using the guild storage";
  218. mes "right now. Please wait until that person is finished.";
  219. close2;
  220. cutin "", 255;
  221. end;
  222. }
  223. // Teleport Function ==================================================
  224. function script F_KafTele {
  225. mes "[Kafra]";
  226. if (@kafPass==1) mes "Since you're using a Kafra Pass, any warp is free!";
  227. mes "Please set your destination.";
  228. next;
  229. menu @wrpC$[0],M_Wrp0, @wrpC$[1],M_Wrp1, @wrpC$[2],M_Wrp2, @wrpC$[3],M_Wrp3,
  230. @wrpC$[4],M_Wrp4, @wrpC$[5],M_Wrp5, @wrpC$[6],M_Wrp6;
  231. M_Wrp0:
  232. set @num, 0;
  233. goto L_Warp;
  234. M_Wrp1:
  235. set @num, 1;
  236. goto L_Warp;
  237. M_Wrp2:
  238. set @num, 2;
  239. goto L_Warp;
  240. M_Wrp3:
  241. set @num, 3;
  242. goto L_Warp;
  243. M_Wrp4:
  244. set @num, 4;
  245. goto L_Warp;
  246. M_Wrp5:
  247. set @num, 5;
  248. goto L_Warp;
  249. M_Wrp6:
  250. set @num, 6;
  251. L_Warp:
  252. if (@wrpC$[@num] == "Cancel") return;
  253. if (@kafPass==1) set @wrpP[@num], 0;
  254. if (Zeny<@wrpP[@num]) goto sL_CantTele;
  255. set Zeny, Zeny-@wrpP[@num];
  256. if (@kafPass==0) set RESRVPTS, RESRVPTS + (@wrpP[@num]/16);
  257. if (@wrpD$[@num] == "Alberta") warp "alberta.gat", 117, 56;
  258. if (@wrpD$[@num] == "Al De Baran") warp "aldebaran.gat",143,110;
  259. if (@wrpD$[@num] == "Aldebaran") warp "aldebaran.gat",143,110;
  260. if (@wrpD$[@num] == "Comodo") warp "comodo.gat", 207, 144;
  261. if (@wrpD$[@num] == "Izlude") warp "izlude.gat", 91, 105;
  262. if (@wrpD$[@num] == "Geffen") warp "geffen.gat", 120, 39;
  263. if (@wrpD$[@num] == "Morroc") warp "morocc.gat", 156, 46;
  264. if (@wrpD$[@num] == "Payon") warp "payon.gat", 168, 103;
  265. if (@wrpD$[@num] == "Prontera") warp "prontera.gat", 116, 72;
  266. if (@wrpD$[@num] == "Coal Mine(Dead Pit)") warp "mjolnir_02.gat", 82, 347;
  267. if (@wrpD$[@num] == "Comodo Pharos Lighthouse") warp "cmd_fild07.gat", 127, 134;
  268. if (@wrpD$[@num] == "Orc Dungeon") warp "gef_fild10.gat", 52, 326;
  269. if (@wrpD$[@num] == "Umbala") warp "umbala.gat", 130, 130;
  270. if (@wrpD$[@num] == "Yuno") warp "yuno.gat", 157, 123;
  271. cutin "", 255;
  272. end;
  273. sL_CantTele:
  274. mes "[Kafra]";
  275. mes "Dear you don't have enough money. Please check your funds again.";
  276. close2;
  277. cutin "", 255;
  278. end;
  279. }
  280. // Cart Function ========================================================
  281. function script F_KafCart {
  282. if(baseClass != Job_Merchant) goto sL_CantRent;
  283. if(getskilllv(39)==0) goto sL_NeedSkill;
  284. if(checkcart(0) == 1) goto sL_GotCart;
  285. if(getarg(0) == 2) goto L_Guild;
  286. mes "[Kafra]";
  287. if(@kafPass==0) mes "The Cart Fee is 800 Zeny. Do you want to Rent a Cart?";
  288. else mes "Since you're using a Kafra Pass, you can rent a cart for free!";
  289. next;
  290. menu "-Rent a Cart.",-, "-Cancel.",M_End;
  291. if(Zeny<800 && kafPass==0) goto sL_CartFee;
  292. if(@kafPass==0) {
  293. set Zeny,Zeny-800;
  294. if(@kafPass==0) set RESRVPTS, RESRVPTS + 48;
  295. }
  296. L_Guild:
  297. setcart;
  298. mes "[Kafra]";
  299. mes "Here is your cart.";
  300. return 1;
  301. sL_CantRent:
  302. mes "[Kafra]";
  303. mes "I'm sorry dear. The Cart service is only provided for the Merchant and Blacksmith Class.";
  304. return 1;
  305. sL_NeedSkill:
  306. mes "[Kafra]";
  307. mes "I'm sorry but you need the skill ^0000FF'Pushcart'^000000 to rent a cart.";
  308. return 1;
  309. sL_GotCart:
  310. mes "[Kafra]";
  311. mes "Excuse me... but you already have a cart....";
  312. emotion 4;
  313. return 1;
  314. sL_CartFee:
  315. mes "[Kafra]";
  316. mes "Dear, you don't have enough Money. You need 800 Zeny.";
  317. return 1;
  318. M_End:
  319. return 0;
  320. }
  321. // Pass Function ===============================================================
  322. function script F_KafPass {
  323. sM_Menu:
  324. menu "Use a Kafra Pass.",-, "What is a Kafra Pass?",sM_PassInfo, "Cancel",sM_End;
  325. mes "[Kafra]";
  326. mes "Let me just check your pass.....";
  327. next;
  328. if(usedKafPass==0 && countitem(1084)<1) goto sL_NeedPass;
  329. set @kafPass,1;
  330. set usedKafPass, usedKafPass + 1;
  331. if(usedKafPass>=3) goto sL_PassExpire;
  332. if(usedKafPass > 1) goto L_Cont; //fixed Lupus
  333. delitem 1084,1;
  334. mes "(you hand her your pass)";
  335. next;
  336. mes "[Kafra]";
  337. mes "Great! Everything seems to be in order. Now that your pass is activated, you may rent a cart or use the teleport services for free.";
  338. mes "Your pass number has been entered into our database so you no longer need it.";
  339. next;
  340. L_Cont:
  341. mes "[Kafra]";
  342. mes "You will be able to use the Cart Rental and Teleport services free of charge ^5533FF"+(3 - usedKafPass)+"^000000 more times with any Kafra service agent you choose.";
  343. return 1;
  344. sL_NeedPass:
  345. mes "[Kafra]";
  346. mes "I'm sorry but you don't have a kafra pass to use....";
  347. next;
  348. goto sM_Menu;
  349. sL_PassExpire:
  350. mes "[Kafra]";
  351. mes "This is going to be the 3rd and final time you use this pass, therefore it is now expired.";
  352. next;
  353. set usedKafPass,0;
  354. mes "[Kafra]";
  355. mes "You may now use the Teleport and Cart Rental services for free.";
  356. return 1;
  357. sM_PassInfo:
  358. mes "[Kafra]";
  359. mes "A ^5533FFKafra Pass^000000 is a unique voucher that lets you use Kafra services for free!";
  360. mes "The Kafra services that you may use for free are the ^FF3355Teleport^000000 service and the ^FF3355Cart Rental^000000 service.";
  361. next;
  362. mes "[Kafra]";
  363. mes "Kafra passes can be purchased at the Kafra Corp. Main office in Al De Baran.";
  364. next;
  365. mes "[Kafra]";
  366. mes "To use a Kafra Pass, simply choose the option to 'Use a Kafra Pass', when speaking with a Kafra agent such as myself.";
  367. mes "Your pass number will be entered into our database, and you will then be able to use the Teleport, and Cart Rental Kafra services free of charge.";
  368. next;
  369. mes "[Kafra]";
  370. mes "Once you have finished using the desired services, and have stopped interacting with the Kafra, your 'free use' session will end.";
  371. mes "You will have a total of ^5533FF 3 'free use' sessions^000000 available upon activation of your Kafra Pass.";
  372. next;
  373. mes "[Kafra]";
  374. mes "To begin another 'free use' session, simply select the 'Use a Kafra Pass' option when speaking with a Kafra Agent.";
  375. next;
  376. mes "[Kafra]";
  377. mes "Believe me when I say that the Kafra Pass is a great bargain!!";
  378. mes "With the Kafra Pass, we hope to give players some incentive to use our great services.";
  379. next;
  380. goto sM_Menu;
  381. sM_End:
  382. return 0;
  383. }
  384. // Special Reserve Points Function ===========================================
  385. function script F_KafInfo {
  386. sM_Menu:
  387. //Uncomment next line to block Kafra Storage Protection
  388. // if(getarg(0) == 0) menu "-Special Reserve Check",sM_ResChk, "-Kafra Locations",sM_KafLoc, "-Cancel",sM_End;
  389. if(getarg(0) == 0) menu "-Special Reserve Check",sM_ResChk, "-Storage Password Service",sM_KafPassword, "-Kafra Locations",sM_KafLoc, "-Cancel",sM_End;
  390. sM_ResChk:
  391. mes "[Kafra]";
  392. mes "Here is your current amount of special reserve points:";
  393. mes "^0000ff"+RESRVPTS+"^000000.";
  394. next;
  395. mes "[Kafra]";
  396. mes "Remember to continue using Kafra services such as Storage and Teleport, to earn more special reserve points.";
  397. next;
  398. mes "[Kafra]";
  399. mes "You can trade them in at the Kafra Main Office in Al De Baran for useful items and cool prizes.";
  400. next;
  401. if(getarg(0) == 1) return;
  402. goto sM_Menu;
  403. sM_KafLoc:
  404. mes "[Kafra]";
  405. mes "The flashing signals on your mini-map point to the locations of all of the Kafra Agents in this city.";
  406. viewpoint 1,@viewpX[0],@viewpY[0],1,0xFF00FF;
  407. viewpoint 1,@viewpX[1],@viewpY[1],2,0xFF00FF;
  408. viewpoint 1,@viewpX[2],@viewpY[2],3,0xFF00FF;
  409. viewpoint 1,@viewpX[3],@viewpY[3],4,0xFF00FF;
  410. next;
  411. viewpoint 2,@viewpX[0],@viewpY[0],1,0xFF00FF;
  412. viewpoint 2,@viewpX[1],@viewpY[1],2,0xFF00FF;
  413. viewpoint 2,@viewpX[2],@viewpY[2],3,0xFF00FF;
  414. viewpoint 2,@viewpX[3],@viewpY[3],4,0xFF00FF;
  415. goto sM_Menu;
  416. sM_KafPassword:
  417. callfunc("F_SetKafCode");
  418. sM_End:
  419. return;
  420. }
  421. // End Function =====================================================
  422. // arg(0): used to determine what message to display.
  423. // arg(1): used to determine if save message is displayed.
  424. //===================================================================
  425. function script F_KafEnd {
  426. mes "[Kafra]";
  427. if(getarg(1)==1) mes "Your respawn point has been saved."; // only shown when a player uses save
  428. if(getarg(0)!=1) mes "Thank you for using Kafra Services. We hope to see you again soon.";
  429. if(getarg(0)==1) mes "We, Kafra Corporation.... Will be with you.... whenever.... wherever... therefore.... please don't forget us.....";
  430. close2;
  431. cutin "", 255;
  432. emotion 15;
  433. close;
  434. end;
  435. }
  436. // Check Storage Password Function ====================
  437. function script F_CheckKafCode {
  438. if(#kafra_code==0) return;
  439. mes "Enter your storage password:";
  440. set @code_,0;
  441. input @code_;
  442. if(@code_ != #kafra_code-getcharid(3)-1337) {
  443. dispbottom "Wrong storage password.";
  444. close2;
  445. cutin "",255;
  446. end;
  447. }
  448. set @kafcode_try,0;
  449. set @code_,0;
  450. return;
  451. }
  452. // Set / Change / Clear Storage Password Function ====================
  453. function script F_SetKafCode 115,{
  454. mes "[Kafra]";
  455. if(#kafra_code) {
  456. mes "Your storage is protected with a password. What would you do now?";
  457. next;
  458. menu "Change old password -> 5000z",-,
  459. "Remove storage password -> 1000z",M_CLEAR,
  460. "Cancel",M_END;
  461. } else {
  462. mes "Kafra Services proudly presents you a new service:";
  463. mes "Additional storage protection with a password.";
  464. next;
  465. menu "Set new password -> 5000z",M_SET,
  466. "Cancel",M_END;
  467. }
  468. mes "[Kafra]";
  469. mes "At first, please enter your ^0000FFold password^000000.";
  470. set @code,callfunc("F_EntKafCode");
  471. if(@code==0 || @code != #kafra_code-getcharid(3)-1337) {
  472. mes "Wrong password. You can't set a new password.";
  473. emotion e_hmm;
  474. goto M_END;
  475. }
  476. next;
  477. M_SET:
  478. mes "[Kafra]";
  479. mes "Now enter your ^FF0000new password^000000 to protect your storage from thieves.";
  480. set @code,callfunc("F_EntKafCode");
  481. if(@code==0) {
  482. mes "The password hasn't been changed.";
  483. emotion e_hmm;
  484. goto M_END;
  485. }
  486. next;
  487. mes "[Kafra]";
  488. if(Zeny < 5000) goto L_ZENY;
  489. set Zeny,Zeny-5000;
  490. set RESRVPTS, RESRVPTS + (5000/50);
  491. set #kafra_code,@code+getcharid(3)+1337;
  492. mes "You've protected your storage with a secret password.";
  493. mes "Thank you for using Kafra Services.";
  494. emotion e_thx;
  495. goto M_END;
  496. M_CLEAR:
  497. mes "[Kafra]";
  498. mes "Please, enter your password before its removal.";
  499. set @code,callfunc("F_EntKafCode");
  500. if(@code==0) {
  501. mes "The password hasn't been removed.";
  502. emotion e_hmm;
  503. goto M_END;
  504. }
  505. next;
  506. mes "[Kafra]";
  507. if(Zeny < 1000) goto L_ZENY;
  508. set Zeny,Zeny-1000;
  509. set RESRVPTS, RESRVPTS + (1000/50);
  510. if(@code == #kafra_code-getcharid(3)-1337) {
  511. set #kafra_code,0;
  512. mes "You've successfully cleared your storage password.";
  513. mes "Thank you for using Kafra Services.";
  514. emotion e_thx;
  515. } else {
  516. mes "Wrong password. We won't return your 1000z.";
  517. mes "Please, next time enter correct password.";
  518. emotion e_sry;
  519. }
  520. goto M_END;
  521. L_ZENY:
  522. mes "You don't have enough zeny.";
  523. emotion e_cash;
  524. M_END:
  525. close2;
  526. cutin "",255;
  527. end;
  528. }
  529. // Basic Password Validation Function ====================
  530. function script F_EntKafCode {
  531. mes "Enter a number 1000~10000000:";
  532. set @code_,0;
  533. set @kafcode_try,@kafcode_try+1;
  534. if(@kafcode_try>10) {
  535. set @kafcode_try,0;
  536. logmes "Hack: Tried to fit storage password.";
  537. }
  538. input @code_;
  539. if(@code_<1000) {
  540. mes "You shouldn't use such short password.";
  541. return 0;
  542. }
  543. if(@code_>10000000) {
  544. mes "You can't use such big password.";
  545. return 0;
  546. }
  547. return @code_;
  548. }