functions_kafras.txt 24 KB

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