functions_kafras.txt 19 KB

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