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