functions_kafras.txt 23 KB

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