functions_kafras.txt 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. //===== eAthena Script =======================================
  2. //= Kafra Functions
  3. //===== By: ==================================================
  4. //= Lotsa People (1.0)
  5. //= eAthena Dev Team
  6. //= Darlskies, Darkchild, Syrus22, Lupus, kobra_k88 (2.0)
  7. //===== Current Version: =====================================
  8. //= 3.2
  9. //===== Compatible With: =====================================
  10. //= eAthena 1.0
  11. //===== Description: =========================================
  12. //= These functions handle save, storage, cart rental, teleport,
  13. //= and Kafra pass options for all Kafra NPCs.
  14. //===== Additional Comments: =================================
  15. //= v1.1 Now using functions v2.1 Added Cart Rent for Classes: Whitesmith, Professor.
  16. //= Replaced checkoption(x) into checkcart(0) [Lupus] v2.1b Added Fix Kafra Pass Func [Kobra_k88]
  17. //= 2.2 Final fix of the Kafra Pass Exploit! [Lupus] a -Izlude[4] fix
  18. //= 2.2a Minor changes to function calls. Using agruments. Added Guild options. [kobra_k88]
  19. //= 2.2b This version uses arrays for the teleport option. Rearranged next statements to make menu transitions smoother. [kobra_k88]
  20. //= 2.3 Removed SAVE from Niflheim. [Lupus]
  21. //= 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]
  22. //= 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]
  23. //= 2.5 Added Louyang official Kafra, fixes some Kafras, not letting you to Save your position [Lupus]
  24. //= 2.6 Reverted Dungeons Kafras (they should offer only Storage). Added temp Ayothaya Kafra
  25. //= 2.7 Added correct Ayothaya, Louyang & Amatsu Kafras. [Lupus]
  26. //= 2.8 Fixed Amatsu Storage problems [Lupus] 2.9 Fixed spelling mistakes. [Nexon]
  27. //= 3.0 Added special "not working teleport menu" for Einbroch Kafras [Lupus]
  28. //= 3.1 Removed callfunc Is_####_Class in favor of baseClass [Silentdragon]
  29. //= 3.2 Fixed an exploit [Lupus]
  30. //============================================================
  31. // Main Function ===========================================================
  32. //= arg(0): Used to determine which welcome message to show.
  33. //= arg(1): Used to determine which menu to display.
  34. //= arg(2): Used to determine if the info menu is shown in F_KafInfo.
  35. //==========================================================================
  36. function script F_Kafra {
  37. set @kafPass, 0;
  38. mes "[Kafra]";
  39. if(getarg(0)==0) mes "Welcome to Kafra Corp. We will stay with you wherever you go.";
  40. //Niflheim
  41. if(getarg(0)==1) mes "Welcome... Kafra Services.... Will be with you even if you die.....";
  42. //Guilds Castles
  43. if(getarg(0)==2) mes "Welcome, ^5533FF" + GetGuildName(@GID) + "^000000 members. We will stay with you wherever you go";
  44. //Amatsu
  45. if(getarg(0)==3) mes "So, have you come from a faraway land to study our culture, or are you just sightseeing?";
  46. if(getarg(0)==3) mes "In either case, why not stay awhile?";
  47. if(getarg(0)==3) mes "The air is eternally heavy with the";
  48. if(getarg(0)==3) mes "scent of pleasant wildflowers.";
  49. //Louyang, Ayothaya
  50. if(getarg(0)==4) mes "With our many Kafra";
  51. if(getarg(0)==4) mes "service locations, you're never";
  52. if(getarg(0)==4) mes "far from home.";
  53. next;
  54. M_Menu:
  55. //Guilds Kafra
  56. if(getarg(0)==2) menu "-Use Storage",M_FStorage, "-Use Guild Storage",M_GStorage, "-Rent a Cart",M_Cart, "-Use Teleport Service",M_Teleport, "-Cancel",M_End;
  57. //only Save & Storage
  58. if(getarg(1)==1) menu "-Save",M_Save,"-Use Storage",M_Storage, "-Cancel",M_End;
  59. //only Storage
  60. if(getarg(1)==2) menu "-Use Storage",M_Storage, "-Cancel",M_End;
  61. //Common w/o teleport
  62. if(getarg(1)==3) menu "-Save",M_Save, "-Use Storage",M_Storage, "-Rent a Cart",M_Cart, "-Kafra Pass",M_Pass,
  63. "-Other Information Check",M_Info, "-Cancel",M_End;
  64. //Common Kafra (with Teleport Notice in Einbroch)
  65. if(getarg(1)==4) menu "-Save",M_Save, "-Use Storage",M_Storage, "-Use Teleport Service",M_NoTeleport, "-Rent a Cart",M_Cart, "-Kafra Pass",M_Pass,
  66. "-Other Information Check",M_Info, "-Cancel",M_End;
  67. //Common Kafra
  68. menu "-Save",M_Save, "-Use Storage",M_Storage, "-Use Teleport Service",M_Teleport, "-Rent a Cart",M_Cart, "-Kafra Pass",M_Pass,
  69. "-Other Information Check",M_Info, "-Cancel",M_End;
  70. M_Save:
  71. return;
  72. M_Storage:
  73. callfunc "F_KafStor",0;
  74. next;
  75. goto M_Menu;
  76. M_GStorage:
  77. callfunc "F_KafStor",1;
  78. next;
  79. goto M_Menu;
  80. //Don't charge for a common Kafra Storage in your Castle
  81. M_FStorage:
  82. callfunc "F_KafStor",2;
  83. next;
  84. goto M_Menu;
  85. M_Teleport:
  86. callfunc "F_KafTele",getarg(0);
  87. goto M_Menu;
  88. M_Cart:
  89. if(callfunc("F_KafCart",getarg(0)) == 1) next;
  90. goto M_Menu;
  91. M_Pass:
  92. if(callfunc("F_KafPass") == 1) next;
  93. goto M_Menu;
  94. M_Info:
  95. callfunc "F_KafInfo",getarg(2);
  96. goto M_Menu;
  97. M_End:
  98. callfunc "F_KafEnd",getarg(0),0;
  99. end;
  100. M_NoTeleport:
  101. mes "[Kafra]";
  102. mes "Because of the ^FF0000Limited Transport Agreement^000000, the Kafra Corporation cannot provide Teleport Services in the Schwarzwald Republic.";
  103. next;
  104. mes "[Kafra]";
  105. mes "We ask that you please";
  106. mes "use the Airship Service";
  107. mes "instead. Thank you for your";
  108. mes "understanding and cooperation.";
  109. next;
  110. goto M_Menu;
  111. }
  112. // Storage Function =======================================================
  113. function script F_KafStor {
  114. if(getarg(0) == 1) goto L_Guild;
  115. if(basicskillcheck(0) > 0 && getskilllv(1) < 6) goto sL_JbLvl;
  116. if(BaseJob == Job_Novice) set @fee, 30;
  117. if(BaseJob != Job_Novice) set @fee, 60;
  118. if(@kafPass==1 || getarg(0) == 2) set @fee, 0;
  119. if(Zeny<@fee) goto sL_Zeny;
  120. set Zeny, Zeny-@fee;
  121. set RESRVPTS, RESRVPTS + (@fee/5);
  122. mes "[Kafra]";
  123. mes "Close this window to open your storage.";
  124. mes "We hope to see you again soon.";
  125. close2;
  126. openstorage;
  127. cutin "", 255;
  128. close;
  129. end;
  130. sL_JbLvl:
  131. mes "[Kafra]";
  132. mes "I am sorry but you have to be at least Novice level 6 if you want to use the storage.";
  133. return;
  134. sL_Zeny:
  135. mes "[Kafra]";
  136. mes "Dear you don't have enough money. The Storage fee is "+@fee+" Zeny.";
  137. return;
  138. L_Guild:
  139. if(guildopenstorage(0) == 1) goto L_InUse;
  140. cutin "", 255;
  141. close;
  142. L_InUse:
  143. mes "[Kafra]";
  144. mes "I'm sorry but another guild member is using the guild storage";
  145. mes "right now. Please wait until that person is finished.";
  146. close2;
  147. cutin "", 255;
  148. close;
  149. end;
  150. }
  151. // Teleport Function ==================================================
  152. function script F_KafTele {
  153. mes "[Kafra]";
  154. if (@kafPass==1) mes "Since you're using a Kafra Pass, any warp is free!";
  155. mes "Please set your destination.";
  156. next;
  157. menu @wrpC$[0],M_Wrp0, @wrpC$[1],M_Wrp1, @wrpC$[2],M_Wrp2, @wrpC$[3],M_Wrp3,
  158. @wrpC$[4],M_Wrp4, @wrpC$[5],M_Wrp5, @wrpC$[6],M_Wrp6;
  159. M_Wrp0:
  160. set @num, 0;
  161. goto L_Warp;
  162. M_Wrp1:
  163. set @num, 1;
  164. goto L_Warp;
  165. M_Wrp2:
  166. set @num, 2;
  167. goto L_Warp;
  168. M_Wrp3:
  169. set @num, 3;
  170. goto L_Warp;
  171. M_Wrp4:
  172. set @num, 4;
  173. goto L_Warp;
  174. M_Wrp5:
  175. set @num, 5;
  176. goto L_Warp;
  177. M_Wrp6:
  178. set @num, 6;
  179. L_Warp:
  180. if (@wrpC$[@num] == "Cancel") return;
  181. if (@kafPass==1) set @wrpP[@num], 0;
  182. if (Zeny<@wrpP[@num]) goto sL_CantTele;
  183. set Zeny, Zeny-@wrpP[@num];
  184. if (@kafPass==0) set RESRVPTS, RESRVPTS + (@wrpP[@num]/16);
  185. if (@wrpD$[@num] == "Alberta") warp "alberta.gat", 117, 56;
  186. if (@wrpD$[@num] == "Al De Baran") warp "aldebaran.gat",143,110;
  187. if (@wrpD$[@num] == "Comodo") warp "comodo.gat", 207, 144;
  188. if (@wrpD$[@num] == "Izlude") warp "izlude.gat", 91, 105;
  189. if (@wrpD$[@num] == "Geffen") warp "geffen.gat", 120, 39;
  190. if (@wrpD$[@num] == "Morroc") warp "morocc.gat", 156, 46;
  191. if (@wrpD$[@num] == "Payon") warp "payon.gat", 168, 103;
  192. if (@wrpD$[@num] == "Prontera") warp "prontera.gat", 116, 72;
  193. if (@wrpD$[@num] == "Coal Mine(Dead Pit)") warp "mjolnir_02.gat", 82, 347;
  194. if (@wrpD$[@num] == "Comodo Pharos Lighthouse") warp "cmd_fild07.gat", 127, 134;
  195. if (@wrpD$[@num] == "Orc Dungeon") warp "gef_fild10.gat", 52, 326;
  196. if (@wrpD$[@num] == "Umbala") warp "umbala.gat", 130, 130;
  197. if (@wrpD$[@num] == "Yuno") warp "yuno.gat", 157, 123;
  198. close2; // this part safegaurds against errors/typos
  199. set zeny, zeny + @wrpP[@num];
  200. cutin "", 255;
  201. close;
  202. end;
  203. sL_CantTele:
  204. mes "[Kafra]";
  205. mes "Dear you don't have enough money. Please check your funds again.";
  206. close2;
  207. cutin "", 255;
  208. close;
  209. end;
  210. }
  211. // Cart Function ========================================================
  212. function script F_KafCart {
  213. if(baseClass != Job_Merchant) goto sL_CantRent;
  214. if(getskilllv(39)==0) goto sL_NeedSkill;
  215. if(checkcart(0) == 1) goto sL_GotCart;
  216. if(getarg(0) == 2) goto L_Guild;
  217. mes "[Kafra]";
  218. if(@kafPass==0) mes "The Cart Fee is 800 Zeny. Do you want to Rent a Cart?";
  219. if(@kafPass==1) mes "Since you're using a Kafra Pass, you can rent a cart for free!";
  220. next;
  221. menu "-Rent a Cart.",-, "-Cancel.",M_End;
  222. if(Zeny<800 && kafPass==0) goto sL_CartFee;
  223. if(@kafPass==0) set Zeny,Zeny-800;
  224. if(@kafPass==0) set RESRVPTS, RESRVPTS + 48;
  225. L_Guild:
  226. setcart;
  227. mes "[Kafra]";
  228. mes "Here is your cart.";
  229. return 1;
  230. sL_CantRent:
  231. mes "[Kafra]";
  232. mes "I'm sorry dear. The Cart service is only provided for the Merchant and Blacksmith Class.";
  233. return 1;
  234. sL_NeedSkill:
  235. mes "[Kafra]";
  236. mes "I'm sorry but you need the skill ^0000FF'Pushcart'^000000 to rent a cart.";
  237. return 1;
  238. sL_GotCart:
  239. mes "[Kafra]";
  240. mes "Excuse me... but you already have a cart....";
  241. emotion 4;
  242. return 1;
  243. sL_CartFee:
  244. mes "[Kafra]";
  245. mes "Dear, you don't have enough Money. You need 800 Zeny.";
  246. return 1;
  247. M_End:
  248. return 0;
  249. }
  250. // Pass Function ===============================================================
  251. function script F_KafPass {
  252. sM_Menu:
  253. menu "Use a Kafra Pass.",-, "What is a Kafra Pass?",sM_PassInfo, "Cancel",sM_End;
  254. mes "[Kafra]";
  255. mes "Let me just check your pass.....";
  256. next;
  257. if(usedKafPass==0 && countitem(1084)<1) goto sL_NeedPass;
  258. set @kafPass,1;
  259. set usedKafPass, usedKafPass + 1;
  260. if(usedKafPass>=3) goto sL_PassExpire;
  261. if(usedKafPass > 1) goto L_Cont; //fixed Lupus
  262. delitem 1084,1;
  263. mes "(you hand her your pass)";
  264. next;
  265. mes "[Kafra]";
  266. mes "Great! Everything seems to be in order. Now that your pass is activated, you may rent a cart or use the teleport services for free.";
  267. mes "Your pass number has been entered into our database so you no longer need it.";
  268. next;
  269. L_Cont:
  270. mes "[Kafra]";
  271. mes "You will be able to use the Cart Rental and Teleport services free of charge ^5533FF"+(3 - usedKafPass)+"^000000 more times with any Kafra service agent you choose.";
  272. return 1;
  273. sL_NeedPass:
  274. mes "[Kafra]";
  275. mes "I'm sorry but you don't have a kafra pass to use....";
  276. next;
  277. goto sM_Menu;
  278. sL_PassExpire:
  279. mes "[Kafra]";
  280. mes "This is going to be the 3rd and final time you use this pass, therefore it is now expired.";
  281. next;
  282. set usedKafPass,0;
  283. mes "[Kafra]";
  284. mes "You may now use the Teleport and Cart Rental services for free.";
  285. return 1;
  286. sM_PassInfo:
  287. mes "[Kafra]";
  288. mes "A ^5533FFKafra Pass^000000 is a unique voucher that lets you use Kafra services for free!";
  289. mes "The Kafra services that you may use for free are the ^FF3355Teleport^000000 service and the ^FF3355Cart Rental^000000 service.";
  290. next;
  291. mes "[Kafra]";
  292. mes "Kafra passes can be purchased at the Kafra Corp. Main office in Al De Baran.";
  293. next;
  294. mes "[Kafra]";
  295. mes "To use a Kafra Pass, simply choose the option to 'Use a Kafra Pass', when speaking with a Kafra agent such as myself.";
  296. mes "Your pass number will be entered into our database, and you will then be able to use the Teleport, and Cart Rental Kafra services free of charge.";
  297. next;
  298. mes "[Kafra]";
  299. mes "Once you have finished using the desired services, and have stopped interacting with the Kafra, your 'free use' session will end.";
  300. mes "You will have a total of ^5533FF 3 'free use' sessions^000000 available upon activation of your Kafra Pass.";
  301. next;
  302. mes "[Kafra]";
  303. mes "To begin another 'free use' session, simply select the 'Use a Kafra Pass' option when speaking with a Kafra Agent.";
  304. next;
  305. mes "[Kafra]";
  306. mes "Believe me when I say that the Kafra Pass is a great bargain!!";
  307. mes "With the Kafra Pass, we hope to give players some incentive to use our great services.";
  308. next;
  309. goto sM_Menu;
  310. sM_End:
  311. return 0;
  312. }
  313. // Special Reserve Points Function ===========================================
  314. function script F_KafInfo {
  315. sM_Menu:
  316. if(getarg(0) == 0) menu "-Special Reserve Check",sM_ResChk, "-Kafra Locations",sM_KafLoc, "-Cancel",sM_End;
  317. sM_ResChk:
  318. mes "[Kafra]";
  319. mes "Here is your current amount of special reserve points:";
  320. mes "^0000ff"+RESRVPTS+"^000000.";
  321. next;
  322. mes "[Kafra]";
  323. mes "Remember to continue using Kafra services such as Storage and Teleport, to earn more special reserve points.";
  324. next;
  325. mes "[Kafra]";
  326. mes "You can trade them in at the Kafra Main Office in Al De Baran for useful items and cool prizes.";
  327. next;
  328. if(getarg(0) == 1) return;
  329. goto sM_Menu;
  330. sM_KafLoc:
  331. mes "[Kafra]";
  332. mes "The flashing signals on your mini-map point to the locations of all of the Kafra Agents in this city.";
  333. viewpoint 1,@viewpX[0],@viewpY[0],1,0xFF00FF;
  334. viewpoint 1,@viewpX[1],@viewpY[1],2,0xFF00FF;
  335. viewpoint 1,@viewpX[2],@viewpY[2],3,0xFF00FF;
  336. viewpoint 1,@viewpX[3],@viewpY[3],4,0xFF00FF;
  337. next;
  338. viewpoint 2,@viewpX[0],@viewpY[0],1,0xFF00FF;
  339. viewpoint 2,@viewpX[1],@viewpY[1],2,0xFF00FF;
  340. viewpoint 2,@viewpX[2],@viewpY[2],3,0xFF00FF;
  341. viewpoint 2,@viewpX[3],@viewpY[3],4,0xFF00FF;
  342. goto sM_Menu;
  343. sM_End:
  344. return;
  345. }
  346. // End Function =====================================================
  347. // arg(0): used to determine what message to display.
  348. // arg(1): used to determine if save message is displayed.
  349. //===================================================================
  350. function script F_KafEnd {
  351. mes "[Kafra]";
  352. if(getarg(1)==1) mes "Your respawn point has been saved."; // only shown when a player uses save
  353. if(getarg(0)!=1) mes "Thank you for using Kafra Services. We hope to see you again soon.";
  354. if(getarg(0)==1) mes "We, Kafra Corporation.... Will be with you.... whenever.... wherever... therefore.... please don't forget us.....";
  355. close2;
  356. cutin "", 255;
  357. emotion 15;
  358. close;
  359. end;
  360. }