functions_kafras.txt 22 KB

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