functions_kafras.txt 23 KB

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