Advertisement
Guest User

Guild Storage Password

a guest
Jul 20th, 2016
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.90 KB | None | 0 0
  1. //===== Hercules 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. //===== Description: =========================================
  10. //= These functions handle save, storage, cart rental, teleport,
  11. //= and Free Teleport/Warp/Rent Cart options for all Kafra NPCs.
  12. //=
  13. //= Kafra's will need a lot of work. The Welcome Message argument
  14. //= may become obsolete, as most kafras have a slightly differing
  15. //= Welcome message.
  16. //===== Additional Comments: =================================
  17. //= 1.1 Now using functions v2.1 Added Cart Rent for Classes: Whitesmith, Professor.
  18. //= Replaced checkoption(x) into checkcart(0) [Lupus] v2.1b Added Fix Kafra Pass Func [Kobra_k88]
  19. //= 2.2 Final fix of the Kafra Pass Exploit! [Lupus] a -Izlude[4] fix
  20. //= 2.2a Minor changes to function calls. Using agruments. Added Guild options. [kobra_k88]
  21. //= 2.2b This version uses arrays for the teleport option. Rearranged next statements to make menu transitions smoother. [kobra_k88]
  22. //= 2.3 Removed SAVE from Niflheim. [Lupus]
  23. //= 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]
  24. //= 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]
  25. //= 2.5 Added Louyang official Kafra, fixes some Kafras, not letting you to Save your position [Lupus]
  26. //= 2.6 Reverted Dungeons Kafras (they should offer only Storage). Added temp Ayothaya Kafra
  27. //= 2.7 Added correct Ayothaya, Louyang & Amatsu Kafras. [Lupus]
  28. //= 2.8 Fixed Amatsu Storage problems [Lupus] 2.9 Fixed spelling mistakes. [Nexon]
  29. //= 3.0 Added special "not working teleport menu" for Einbroch Kafras [Lupus]
  30. //= 3.1 Removed callfunc Is_####_Class in favor of baseClass [Silentdragon]
  31. //= 3.2 Fixed an exploit [Lupus]
  32. //= 4.0 Added Kafra storage password protection. [Lupus]
  33. //= to block Kafra Password, read comments at 350 line
  34. //= 5.0 Fixed the close2;....close; end; lines. Who let them slip away? =/ [erKURITA]
  35. //= Also, the kafra upon warp was giving back the zeny. Removed. [erKURITA]
  36. //= 5.1 Optimized a little, added no tele/save arg's [Evera]
  37. //= 5.1a Temporary? Added F_ClearGarbage to clear unused/outdated variables [Lupus]
  38. //= 5.2 By default commented out custom Guilds Kafra's "Guild Storage". [Lupus]
  39. //= 5.3 uncommented Guild Storage. Confirmed kRO feature. [Lupus]
  40. //= 5.4 added -Guide option (Kafra shows you nearest Guide) Work in progress.
  41. //= Need all coords for all guides.. and somehow pass their coords to kafra.
  42. //= Removed universal Kafra Pass, added 3 new Kafra Tickets [Lupus]
  43. //= 5.4b temporary moved "-Guide" from the 1st menu punct [Lupus]
  44. //= 5.5 Added proper Niflheim welcome message. [L0ne_W0lf]
  45. //= Cleaned up the menus a bit. Got rid of the proceeding "-" prefix.
  46. //= 5.5b Missed a preceeding hyphen, which was screwing up teleporting. [L0ne_W0lf]
  47. //= 5.6 Further dialog updates, added dynamic costs for cart and storage use. [L0ne_W0lf]
  48. //= Updated some functions to handle Guild Kafras the way they should.
  49. //= 5.6a Corrected a few wrong names in the teleport function. [L0ne_W0lf]
  50. //= 5.7 Correced end message no longer displaying, and the duplicate names [L0ne_W0lf]
  51. //= Thanks to Barron-Monster for pointing out the issues.
  52. //= 5.8 Fixed another double name being shown when "saving" [L0ne_W0lf]
  53. //= 5.9 Fixed the Kafra Welcome message for guilds. Thanks Barron-Monster. [L0ne_W0lf]
  54. //= 6.0 Closed Kafra Password exploit in Cool Event Corp. Storages until we got a client/packet based password support.
  55. //= Added 2 args into F_SetKafCode to fit it in Cool Evnt Co. NPC [Lupus]
  56. //= 6.1 Added menu for Turbo Track Kafra Staff. [L0ne_W0lf]
  57. //= 6.2 Updated/Fixed warp cords. [Kisuka]
  58. //= 6.3 #kafra_code is now stored as is. [brianluau]
  59. //= 6.4 Removed unofficial Guide function. [Daegaladh]
  60. //= 6.5 Optimized. [Joseph]
  61. //= 6.6 Added Warp Points / View Points Function. [Joseph]
  62. //= 6.7 Added Rune Knight Kafra. [Euphy]
  63. //= 6.8 Improved compatibility with Zonda Staff NPCs. Modernized syntax. [Haru]
  64. //============================================================
  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 4_F_KAFRA8 {
  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. @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. next;
  121. while (true) {
  122. deletearray @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. // Storage, Save, and Pushcart (Dewata, reorder of case 7)
  146. case 10: setarray @K_Menu0$[0],"Use Storage","Save","Rent a Pushcart","Cancel"; break;
  147. // Default message (obsolete)
  148. default: setarray @K_Menu0$[0],"Save","Use Storage","Use Guild Storage","Rent a Pushcart","Check Other Information","Cancel"; break;
  149. }
  150. }
  151. .@menu$ = "";
  152. for (.@i = 0; .@i < getarraysize(@K_Menu0$); ++.@i)
  153. .@menu$ += @K_Menu0$[.@i] + ":";
  154. .@j = select(.@menu$) - 1;
  155. if (@K_Menu0$[.@j] == "Save") {
  156. return;
  157. } else if (@K_Menu0$[.@j] == "Use Storage") {
  158. // Do not charge for Guild Storage
  159. if(getarg(0) == 2)
  160. callfunc "F_KafStor",2,0,0,"[Kafra Employee]";
  161. else
  162. callfunc "F_KafStor",0,getarg(3),getarg(0),"[Kafra Employee]";
  163. next;
  164. } else if (@K_Menu0$[.@j] == "Use Teleport Service") {
  165. // Display Einbroch "No Teleport Service" notice.
  166. if (getarg(1) != 4) {
  167. callfunc "F_KafTele",getarg(0),"[Kafra Employee]";
  168. } else {
  169. mes "[Kafra Employee]";
  170. mes "Because of the ^FF0000Limited";
  171. mes "Transport Agreement^000000, the";
  172. mes "Kafra Corporation cannot";
  173. mes "provide Teleport Services";
  174. mes "in the Schwaltzvalt Republic.";
  175. next;
  176. mes "[Kafra Employee]";
  177. mes "We ask that you please";
  178. mes "use the Airship Service";
  179. mes "instead. Thank you for your";
  180. mes "understanding and cooperation.";
  181. }
  182. next;
  183. } else if (@K_Menu0$[.@j] == "Rent a Pushcart") {
  184. if(callfunc("F_KafCart",getarg(0),getarg(4),"[Kafra Employee]") == 1)
  185. next;
  186. } else if (@K_Menu0$[.@j] == "Check Other Information") {
  187. callfunc "F_KafInfo",getarg(2);
  188. next;
  189. } else if (@K_Menu0$[.@j] == "Cancel"){
  190. callfunc "F_KafEnd",getarg(0),0;
  191. end;
  192. } else if (@K_Menu0$[.@j] == "Use Guild Storage") {
  193. callfunc "F_KafStor",1,0,0,"[Kafra Employee]";
  194. next;
  195. }
  196. }
  197. }
  198.  
  199. //===================================================
  200. // Storage Function
  201. //= arg(0): Specifies the type of storage that has been requested:
  202. // 0 = Regular storage
  203. // 1 = Guild storage
  204. // 2 = Regular storage, in a castle (free of charge)
  205. //= arg(1): Cost to use storage.
  206. //= arg(2): The type of NPC this is being called from. Notable values:
  207. // 0,2-5 = Regular Kafra
  208. // 1 = Niflheim Kafra (special messages)
  209. // 6 = Zonda/Cool Event Staff (no RESRVPTS)
  210. //= arg(3): NPC title to display.
  211. //===================================================
  212. function script F_KafStor {
  213. // Unable to access Guild Storage (Busy)
  214. if (getarg(0) == 1) {
  215. if (guildopenstorage()) {
  216. mes getarg(3);
  217. mes "I'm sorry but another guild member is using the guild storage";
  218. mes "right now.";
  219. mes "OR you are not in a guild.";
  220. close2;
  221. cutin "", 255;
  222. end;
  223. }
  224. cutin "", 255;
  225. close;
  226. }
  227. // Unable to access Normal Storage (Insufficient Basic Skills)
  228. if (basicskillcheck() && getskilllv(NV_BASIC) < 6) {
  229. mes getarg(3);
  230. // Niflheim Specific Message
  231. if (getarg(2) == 1) {
  232. mes "^666666S-s-ssoooorry,";
  233. mes "y-you're a-a-aaaa";
  234. mes "Nooviiice... N-neeeds";
  235. mes "B-basic sssskill l-level 6...^000000";
  236. return;
  237. }
  238. mes "I'm sorry, but you";
  239. mes "need the Novice's";
  240. mes "Basic Skill Level 6 to";
  241. mes "use the Storage Service.";
  242. return;
  243. }
  244. // Accessing Normal Storage (Skipped if accessing Storage from Guild castle)
  245. if (getarg(0) != 2) {
  246. // Consume "Free Ticket for Kafra Storage" if available.
  247. if (countitem(Cargo_Free_Ticket)) {
  248. delitem Cargo_Free_Ticket, 1;
  249. } else {
  250. if (Zeny < getarg(1)) {
  251. mes getarg(3);
  252. // Niflheim Specific Message
  253. if (getarg(2) == 1) {
  254. percentheal -50,-50;
  255. mes "^666666Zeeeeeny...";
  256. mes "M-more z-zeny...!";
  257. mes "N-neeed 150... zeny...";
  258. mes "Ergh! T-taking bl-blood~!^000000";
  259. return;
  260. }
  261. // Standard Message
  262. mes "I'm sorry, but you don't";
  263. mes "have enough zeny to use";
  264. mes "the Storage Service. Our";
  265. mes "Storage access fee is "+getarg(1)+" zeny.";
  266. return;
  267. }
  268. Zeny -= getarg(1);
  269. if (getarg(2) != 6)
  270. RESRVPTS += getarg(1) / 5;
  271. }
  272. }
  273.  
  274. // Surpress the "End" message if in guild castle.
  275. if (getarg(0) != 2) {
  276. if (getarg(2) == 1) {
  277. // Niflheim specific Message
  278. percentheal 0,-10;
  279. mes getarg(3);
  280. for (.@i = 0; .@i < 5; ++.@i)
  281. mes "^666666Thank you.. for... using...^000000";
  282. } else if (getarg(2) == 6) {
  283. // Zonda
  284. mes getarg(3);
  285. mes "Let me open your personal";
  286. mes "storage for you right away.";
  287. mes "Thanks for supporting Cool";
  288. mes "Event Corp. by using our";
  289. mes "services. Have a good day~";
  290. } else {
  291. // Normal message
  292. mes getarg(3);
  293. mes "Here, let me open";
  294. mes "your Storage for you.";
  295. mes "Thank you for using";
  296. mes "the Kafra Service.";
  297. }
  298. }
  299. callfunc("F_CheckKafCode"); //check your storage password, if set
  300. close2;
  301. openstorage;
  302. cutin "", 255;
  303. end;
  304. }
  305.  
  306. //===================================================
  307. // Teleport Function
  308. //= arg(2): The type of NPC this is being called from. Notable values:
  309. // 2 = Guild Castle Kafra (don't consume tickets)
  310. // 6 = Zonda/Cool Event Staff (no RESRVPTS)
  311. //= arg(1): NPC title to display.
  312. //===================================================
  313. function script F_KafTele {
  314. mes getarg(1);
  315. mes "Please choose";
  316. mes "your destination.";
  317. next;
  318. .@menu$ = "";
  319. for (.@i = 0; .@i <= getarraysize(@wrpD$); ++.@i)
  320. .@menu$ += @wrpC$[.@i] + ":";
  321. .@j = select(.@menu$) - 1;
  322. if (@wrpC$[.@j] == "Cancel")
  323. return;
  324. // Consume "Free Ticket for Kafra Transportation" if available.
  325. // Do not consume if in Guild castle
  326. if (countitem(Warp_Free_Ticket) > 0 && getarg(0) != 2) {
  327. delitem Warp_Free_Ticket, 1;
  328. } else {
  329. if (Zeny < @wrpP[.@j]) {
  330. mes getarg(1);
  331. mes "I'm sorry, but you don't have";
  332. mes "enough zeny for the Teleport";
  333. mes "Service. The fee to teleport";
  334. mes "to "+@wrpD$[.@j]+" is "+@wrpP[.@j]+" zeny.";
  335. close2;
  336. cutin "", 255;
  337. end;
  338. }
  339. Zeny -= @wrpP[.@j];
  340. if (getarg(0) != 6)
  341. RESRVPTS += @wrpP[.@j] / 16;
  342. }
  343. cutin "", 255;
  344. if (@wrpD$[.@j] == "Al De Baran") warp "aldebaran",168,112;
  345. else if (@wrpD$[.@j] == "Alberta") warp "alberta", 117, 56;
  346. else if (@wrpD$[.@j] == "Comodo") warp "comodo", 209, 143;
  347. else if (@wrpD$[.@j] == "Comodo Pharos Beacon") warp "cmd_fild07", 127, 134;
  348. else if (@wrpD$[.@j] == "Geffen") warp "geffen", 120, 39;
  349. else if (@wrpD$[.@j] == "Izlude") { if (RENEWAL) warp "izlude", 128, 98; else warp "izlude", 91, 105; }
  350. else if (@wrpD$[.@j] == "Juno") warp "yuno", 158, 125;
  351. else if (@wrpD$[.@j] == "Mjolnir Dead Pit") warp "mjolnir_02", 99, 351;
  352. else if (@wrpD$[.@j] == "Morroc") warp "morocc", 156, 46;
  353. else if (@wrpD$[.@j] == "Orc Dungeon") warp "gef_fild10", 52, 326;
  354. else if (@wrpD$[.@j] == "Payon") warp "payon", 90, 120;
  355. else if (@wrpD$[.@j] == "Prontera") warp "prontera", 116, 72;
  356. else if (@wrpD$[.@j] == "Umbala") warp "umbala", 100, 154;
  357. else if (@wrpD$[.@j] == "Veins") warp "veins",205,101;
  358. else if (@wrpD$[.@j] == "Rachel") warp "rachel",115,125;
  359. end;
  360. }
  361.  
  362.  
  363. //===================================================
  364. // Cart Function
  365. //= arg(0): The type of NPC this is being called from. Notable values:
  366. // 0,1,3-5 = Regular Kafra
  367. // 2 = Guild Castle Kafra (don't consume tickets)
  368. // 6 = Zonda/Cool Event Staff (no RESRVPTS)
  369. //= arg(1): Cost to rent a cart.
  370. //= arg(2): NPC title to display.
  371. //===================================================
  372. function script F_KafCart {
  373. // Ensure that the class wanting to rent a pushcart is a merchant
  374. if (BaseClass != Job_Merchant) {
  375. mes getarg(2);
  376. mes "I'm sorry, but the";
  377. mes "Pushcart rental service";
  378. mes "is only available to Merchants,";
  379. mes "Blacksmiths, Master Smiths,";
  380. mes "Alchemists and Biochemists.";
  381. return 1;
  382. }
  383. if (getskilllv(MC_PUSHCART) == 0) {
  384. mes getarg(2);
  385. mes "You can only rent a cart after";
  386. mes "learning the Pushcart Skill.";
  387. return 1;
  388. }
  389. // Make sure the invoking character does not have a cart already
  390. if (checkcart() == 1) {
  391. mes getarg(2);
  392. mes "You already have";
  393. mes "a Pushcart equipped.";
  394. mes "Unfortunately, we can't";
  395. mes "rent more than one to";
  396. mes "each customer at a time.";
  397. return 1;
  398. }
  399. // Consume "Free Ticket for the Cart Service" if available.
  400. // Do not consume if in Guild castle.
  401. if (countitem(Cart_Free_Ticket) > 0 && getarg(0) != 2) {
  402. delitem Cart_Free_Ticket, 1;
  403. } else {
  404. mes getarg(2);
  405. mes "The Pushcart rental";
  406. mes "fee is "+getarg(1)+" zeny. Would";
  407. mes "you like to rent a Pushcart?";
  408. next;
  409. if (select("Rent a Pushcart.:Cancel") == 2)
  410. return 0;
  411. if (Zeny < getarg(1)) {
  412. mes getarg(2);
  413. mes "I'm sorry, but you";
  414. mes "don't have enough";
  415. mes "zeny to pay the Pushcart";
  416. mes "rental fee of "+getarg(1)+" zeny.";
  417. return 1;
  418. }
  419. Zeny -= getarg(1);
  420. if (getarg(0) != 6)
  421. RESRVPTS += 48;
  422. }
  423. setcart;
  424. return 1;
  425. }
  426.  
  427. //===================================================
  428. // Special Reserve Points Function
  429. //===================================================
  430. function script F_KafInfo {
  431. // Uncomment next line to block Kafra Storage Protection
  432. //.@block = 1;
  433. setarray .@m$, "Check Special Reserve Points.","Storage Password Service","Cancel";
  434. if (getarg(0) == 2) deletearray .@m$[1],2; // Port Malaya, Rune Knight: remove Storage Password and Kafra Employee Locations
  435. else if (.@block) deletearray .@m$[1],1; // Remove Storage Password
  436. while (true) {
  437. .@j = select(implode(.@m$,":")) - 1;
  438. if (.@m$[.@j] == "Check Special Reserve Points.") {
  439. mes "[Kafra Employee]";
  440. mes "Let's see...";
  441. mes strcharinfo(0) + "...";
  442. mes "Ah, you have a total of";
  443. mes RESRVPTS+ " Special Reserve Points.";
  444. next;
  445. mes "[Kafra Employee]";
  446. mes "You can exchange your";
  447. mes "Special Reserve Points for";
  448. mes "rewards at the Kafra Main Office in Al De Baran. Please use our";
  449. mes "convenient services to see the benefits of our rewards program.";
  450. next;
  451. if(getarg(0) == 1)
  452. return;
  453. next;
  454. for (.@i = 0; .@i <= 3; ++.@i)
  455. viewpoint 2,@viewpX[.@i],@viewpY[.@i],(.@i+1),0xFF00FF;
  456. } else if (.@m$[.@j] == "Storage Password Service") {
  457. callfunc("F_SetKafCode","[Kafra Employee]","Kafra Services");
  458. } else {
  459. return;
  460. }
  461. }
  462. }
  463.  
  464. // === End Function ==================================================
  465. // arg(0): used to determine what message to display.
  466. // arg(1): used to determine if save message is displayed.
  467. // arg(2): used to display the name of the area you're saving in.
  468. //===================================================================
  469. function script F_KafEnd {
  470. mes "[Kafra Employee]";
  471. if (getarg(1) == 1) {
  472. // Save
  473. mes "Your Respawn Point";
  474. mes "has been saved here";
  475. mes getarg(2)+".";
  476. mes "Thank you for using";
  477. mes "the Kafra Services.";
  478. } else if (getarg(0) == 0 || getarg(0) == 5) {
  479. // Generic End
  480. mes "We, here at Kafra Corporation,";
  481. mes "are always endeavoring to provide you with the best services. We hope that we meet your adventuring needs and standards of excellence.";
  482. } else if (getarg(0) == 1) {
  483. // Niflheim End
  484. percentheal 0,-25;
  485. mes "^666666Kaffffra n-never";
  486. mes "diiiiiiiiiiiiiies. On...";
  487. mes "On y-yooour siiiiide~^000000";
  488. }
  489. close2;
  490. cutin "", 255;
  491. end;
  492. }
  493.  
  494. //===================================================
  495. // Check Storage Password Function
  496. //===================================================
  497. function script F_CheckKafCode {
  498. if (!#kafra_code)
  499. return;
  500. mes "Enter your storage password:";
  501. @code_ = 0;
  502. input @code_;
  503. if (@code_ != #kafra_code) {
  504. dispbottom "Wrong storage password.";
  505. close2;
  506. cutin "",255;
  507. end;
  508. }
  509. @kafcode_try = 0;
  510. @code_ = 0;
  511. return;
  512. }
  513.  
  514. // === Set / Change / Clear Storage Password Function ===
  515. // getarg(0): NPC Name
  516. // getarg(1): Company Name
  517. //=======================================================
  518. function script F_SetKafCode {
  519. mes getarg(0);
  520. if (#kafra_code) {
  521. mes "Your storage is protected with a password. What would you do now?";
  522. next;
  523. switch (select("Change old password -> 5000z:Remove storage password -> 1000z:Cancel")) {
  524. case 1:
  525. mes getarg(0);
  526. mes "At first, please enter your ^0000FFold password^000000.";
  527. @code = callfunc("F_EntKafCode");
  528. if (!@code || @code != #kafra_code) {
  529. mes "Wrong password. You can't set a new password.";
  530. emotion e_hmm;
  531. break;
  532. }
  533. next;
  534. callsub S_SET,getarg(0),getarg(1);
  535. break;
  536. case 2:
  537. mes getarg(0);
  538. mes "Please, enter your password before its removal.";
  539. @code = callfunc("F_EntKafCode");
  540. if (!@code) {
  541. mes "The password hasn't been removed.";
  542. emotion e_hmm;
  543. break;
  544. }
  545. next;
  546. mes getarg(0);
  547. if (Zeny < 1000) {
  548. mes "You don't have enough zeny.";
  549. emotion e_cash;
  550. break;
  551. }
  552. Zeny -= 1000;
  553. if (@code == #kafra_code) {
  554. #kafra_code = 0;
  555. mes "You've successfully cleared your storage password.";
  556. mes "Thank you for using "+getarg(1)+".";
  557. emotion e_thx;
  558. } else {
  559. mes "Wrong password. We won't return your 1000z.";
  560. mes "Please, next time enter correct password.";
  561. emotion e_sry;
  562. }
  563. break;
  564. case 3:
  565. break;
  566. }
  567. } else {
  568. mes getarg(1)+" proudly presents you a new service:";
  569. mes "Additional storage protection with a password.";
  570. next;
  571. switch (select("Set new password -> 5000z:Cancel")) {
  572. case 1: callsub S_SET,getarg(0),getarg(1); break;
  573. case 2: break;
  574. }
  575. }
  576. close2;
  577. cutin "",255;
  578. end;
  579.  
  580. S_SET:
  581. mes getarg(0);
  582. mes "Now enter your ^FF0000new password^000000 to protect your storage from thieves.";
  583. @code = callfunc("F_EntKafCode");
  584. if (!@code) {
  585. mes "The password hasn't been changed.";
  586. emotion e_hmm;
  587. return;
  588. }
  589. next;
  590. mes getarg(0);
  591. if (Zeny < 5000) {
  592. mes "You don't have enough zeny.";
  593. emotion e_cash;
  594. return;
  595. }
  596. Zeny -= 5000;
  597. #kafra_code = @code;
  598. mes "You've protected your storage with a secret password.";
  599. mes "Thank you for using "+getarg(1)+".";
  600. emotion e_thx;
  601. return;
  602. }
  603.  
  604. //===================================================
  605. // Basic Password Validation Function
  606. //===================================================
  607. function script F_EntKafCode {
  608. mes "Enter a number 1000~10000000:";
  609. @code_ = 0;
  610. ++@kafcode_try;
  611. if (@kafcode_try > 10) {
  612. @kafcode_try = 0;
  613. logmes "Hack: Tried to fit storage password.";
  614. }
  615. if (input(@code_) == 1) {
  616. mes "You can't use such big password.";
  617. return 0;
  618. }
  619. if (@code_ < 1000) {
  620. mes "You shouldn't use such short password.";
  621. return 0;
  622. }
  623. return @code_;
  624. }
  625.  
  626. //===================================================
  627. // Warp Points / View Points Function
  628. //===================================================
  629. function script F_KafSet {
  630. deletearray @wrpC$;
  631. deletearray @wrpD$;
  632. deletearray @wrpP$;
  633. deletearray @viewpX;
  634. deletearray @viewpY;
  635. if (strnpcinfo(4) == "prontera") {
  636. setarray @wrpD$, "Izlude", "Geffen", "Payon", "Morroc", "Orc Dungeon", "Alberta";
  637. setarray @wrpP, 600, 1200, 1200, 1200, 1200, 1800;
  638. setarray @viewpX, 151, 29, 282, 152;
  639. setarray @viewpY, 29, 207, 200, 326;
  640. } else if (strnpcinfo(4) == "alberta") {
  641. setarray @wrpP, 1200, 1800, 1800;
  642. setarray @wrpD$, "Payon", "Morroc", "Prontera";
  643. setarray @viewpX, 28, 113, 0, 0;
  644. setarray @viewpY, 229, 60, 0, 0;
  645. } else if (strnpcinfo(4) == "aldebaran") {
  646. setarray @wrpP, 1200, 1200, 1800, 1700;
  647. setarray @wrpD$, "Geffen", "Juno" , "Izlude", "Mjolnir Dead Pit";
  648. } else if (strnpcinfo(4) == "comodo" ) {
  649. setarray @wrpD$, "Morroc", "Comodo Pharos Beacon", "Umbala";
  650. setarray @wrpP, 1800, 1200, 1800;
  651. } else if (strnpcinfo(4) == "cmd_fild07") {
  652. setarray @wrpD$, "Comodo", "Morroc";
  653. setarray @wrpP, 1200, 1200;
  654. } else if (strnpcinfo(4) == "geffen") {
  655. setarray @wrpD$, "Prontera", "Al De Baran", "Orc Dungeon", "Mjolnir Dead Pit";
  656. setarray @wrpP, 1200, 1200, 1200, 1700;
  657. setarray @viewpX, 120, 203;
  658. setarray @viewpY, 62, 123;
  659. } else if (strnpcinfo(4) == "izlude") {
  660. setarray @wrpD$, "Geffen", "Payon", "Morroc", "Al De Baran";
  661. setarray @wrpP, 1200, 1200, 1200, 1800;
  662. } else if (strnpcinfo(4) == "morocc") {
  663. setarray @wrpD$, "Prontera", "Payon", "Alberta", "Comodo", "Comodo Pharos Beacon";
  664. setarray @wrpP, 1200, 1200, 1800, 1800, 1200;
  665. setarray @viewpX, 156, 163, 28, 292;
  666. setarray @viewpY, 97, 260, 167, 211;
  667. } else if (strnpcinfo(4) == "umbala") {
  668. setarray @wrpD$, "Comodo";
  669. setarray @wrpP, 1800;
  670. } else if (strnpcinfo(4) == "payon") {
  671. setarray @wrpD$, "Prontera", "Alberta", "Morroc";
  672. setarray @wrpP, 1200, 1200, 1200;
  673. } else if (strnpcinfo(4) == "yuno") {
  674. setarray @wrpD$, "Al De Baran";
  675. setarray @wrpP, 1200;
  676. setarray @viewpX, 328, 278, 153, 0;
  677. setarray @viewpY, 108, 221, 187, 0;
  678. } else if (strnpcinfo(4) == "job3_rune01") {
  679. setarray @wrpD$, "Izlude", "Geffen", "Payon", "Morroc", "Alberta";
  680. setarray @wrpP, 600, 1200, 1200, 1200, 1800;
  681. } else if (strnpcinfo(4) == "rachel") {
  682. setarray @wrpD$, "Veins";
  683. setarray @wrpP, 2200;
  684. } else if (strnpcinfo(4) == "veins") {
  685. setarray @wrpD$, "Rachel";
  686. setarray @wrpP, 2200;
  687. }
  688. for (.@i = 0; .@i < getarraysize(@wrpD$); ++.@i)
  689. @wrpC$[.@i] = @wrpD$[.@i]+" -> "+@wrpP[.@i];
  690. @wrpC$[getarraysize(@wrpC$)] = "Cancel";
  691. return;
  692. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement