functions_kafras.txt 20 KB

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