functions_kafras.txt 19 KB

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