functions_kafras.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. //===== eAthena Script =======================================
  2. //= Kafra Functions
  3. //===== By: ==================================================
  4. //= Lotsa People (1.0)
  5. //= eAthena Dev Team
  6. //= Darlskies
  7. //= Darkchild
  8. //= Syrus22
  9. //= Lupus
  10. //= kobra_k88 (2.0)
  11. //===== Current Version: =====================================
  12. //= 2.3
  13. //===== Compatible With: =====================================
  14. //= eAthena 1.0
  15. //===== Description: ===============================================
  16. //= These functions handle save, storage, cart rental, teleport,
  17. //= and Kafra pass options for all Kafra NPCs.
  18. //===== Additional Comments: =================================
  19. //= v1.1 Now using functions :)
  20. //= v2.1 Added Cart Rent for Classes: Whitesmith, Professor.
  21. //= Replaced checkoption(x) into checkcart(0) [Lupus]
  22. //= v2.1b Added Fix Kafra Pass Func [Kobra_k88]
  23. //= 2.2 Final fix of the Kafra Pass Exploit! [Lupus] a -Izlude[4] fix
  24. //= 2.2a Minor changes to function calls. Using agruments. Added Guild options. [kobra_k88]
  25. //= 2.2b This version uses arrays for the teleport option.
  26. //= Rearranged next statements to make menu transitions smoother. [kobra_k88]
  27. //= 2.3 Removed SAVE from Niflheim. [Lupus]
  28. //= 2.3 removed "fix" by HawkMoon RTFM and check supernovice.txt . There's a SPECIAL Kafra
  29. //= which gives CARTS to SN for a special proce. [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. if(getarg(0)==1) mes "Welcome... Kafra Services.... Will be with you even if you die.....";
  41. if(getarg(0)==2) mes "Welcome, ^5533FF" + GetGuildName(@GID) + "^000000 members. We will stay with you wherever you go";
  42. next;
  43. M_Menu:
  44. if(getarg(0)==2) menu "-Use Storage",M_Storage, "-Use Guild Storage",M_GStorage, "-Rent a Cart",M_Cart, "-Use Teleport Service",M_Teleport, "-Cancel",M_End;
  45. if(getarg(1)==1) menu "-Use Storage",M_Storage, "-Cancel",M_End;
  46. menu "-Save",M_Save, "-Use Storage",M_Storage, "-Use Teleport Service",M_Teleport, "-Rent a Cart",M_Cart, "-Kafra Pass",M_Pass,
  47. "-Other Information Check",M_Info, "-Cancel",M_End;
  48. M_Save:
  49. return;
  50. M_Storage:
  51. callfunc "F_KafStor",getarg(0);
  52. next;
  53. goto M_Menu;
  54. M_GStorage:
  55. callfunc "F_KafStor",3;
  56. next;
  57. goto M_Menu;
  58. M_Teleport:
  59. callfunc "F_KafTele",getarg(0);
  60. goto M_Menu;
  61. M_Cart:
  62. if(callfunc("F_KafCart",getarg(0)) == 1) next;
  63. goto M_Menu;
  64. M_Pass:
  65. if(callfunc("F_KafPass") == 1) next;
  66. goto M_Menu;
  67. M_Info:
  68. callfunc "F_KafInfo",getarg(2);
  69. goto M_Menu;
  70. M_End:
  71. callfunc "F_KafEnd",getarg(0),0;
  72. end;
  73. }
  74. // Storage Function =======================================================
  75. function script F_KafStor {
  76. if(getarg(0) == 3) goto L_Guild;
  77. if((class ==Job_Novice) && (JobLevel<6)) goto sL_JbLvl;
  78. if(Class == Job_Novice) set @fee, 30;
  79. if(Class != Job_Novice) set @fee, 60;
  80. if(@kafPass==1 || getarg(0)==2) set @fee, 0;
  81. if(Zeny<@fee) goto sL_Zeny;
  82. set Zeny, Zeny-@fee;
  83. set RESRVPTS, RESRVPTS + (@fee/5);
  84. openstorage;
  85. cutin "", 255;
  86. close;
  87. sL_JbLvl:
  88. mes "[Kafra]";
  89. mes "I am sorry but you have to be at leaset Novice level 6 if you want to use the storage.";
  90. return;
  91. sL_Zeny:
  92. mes "[Kafra]";
  93. mes "Dear you don't have enough money. The Storage fee is "+@fee+" Zeny.";
  94. return;
  95. L_Guild:
  96. if(guildopenstorage(0) == 1) goto L_InUse;
  97. cutin "", 255;
  98. close;
  99. L_InUse:
  100. mes "[Kafra]";
  101. mes "I'm sorry but another guild member is using the guild storage";
  102. mes "right now. Please wait untill that person is finished.";
  103. close2;
  104. cutin "", 255;
  105. end;
  106. }
  107. // Teleport Function ==================================================
  108. function script F_KafTele {
  109. mes "[Kafra]";
  110. if (@kafPass==1) mes "Since you're using a Kafra Pass, any warp is free!";
  111. mes "Please set your destination.";
  112. next;
  113. menu @wrpC$[0],M_Wrp0, @wrpC$[1],M_Wrp1, @wrpC$[2],M_Wrp2, @wrpC$[3],M_Wrp3,
  114. @wrpC$[4],M_Wrp4, @wrpC$[5],M_Wrp5, @wrpC$[6],M_Wrp6;
  115. M_Wrp0:
  116. set @num, 0;
  117. goto L_Warp;
  118. M_Wrp1:
  119. set @num, 1;
  120. goto L_Warp;
  121. M_Wrp2:
  122. set @num, 2;
  123. goto L_Warp;
  124. M_Wrp3:
  125. set @num, 3;
  126. goto L_Warp;
  127. M_Wrp4:
  128. set @num, 4;
  129. goto L_Warp;
  130. M_Wrp5:
  131. set @num, 5;
  132. goto L_Warp;
  133. M_Wrp6:
  134. set @num, 6;
  135. L_Warp:
  136. if (@wrpC$[@num] == "Cancel") return;
  137. if (@kafPass==1) set @wrpP[@num], 0;
  138. if (Zeny<@wrpP[@num]) goto sL_CantTele;
  139. set Zeny, Zeny-@wrpP[@num];
  140. if (@kafPass==0) set RESRVPTS, RESRVPTS + (@wrpP[@num]/16);
  141. if (@wrpD$[@num] == "Alberta") warp "alberta.gat", 117, 56;
  142. if (@wrpD$[@num] == "Al De Baran") warp "aldebaran.gat",143,110;
  143. if (@wrpD$[@num] == "Comodo") warp "comodo.gat", 207, 144;
  144. if (@wrpD$[@num] == "Izlude") warp "izlude.gat", 91, 105;
  145. if (@wrpD$[@num] == "Geffen") warp "geffen.gat", 120, 39;
  146. if (@wrpD$[@num] == "Morroc") warp "morocc.gat", 156, 46;
  147. if (@wrpD$[@num] == "Payon") warp "payon.gat", 168, 103;
  148. if (@wrpD$[@num] == "Prontera") warp "prontera.gat", 116, 72;
  149. if (@wrpD$[@num] == "Coal Mine(Dead Pit)") warp "mjolnir_02.gat", 82, 347;
  150. if (@wrpD$[@num] == "Comodo Pharos Lighthouse") warp "cmd_fild07.gat", 127, 134;
  151. if (@wrpD$[@num] == "Orc Dungeon") warp "gef_fild10.gat", 52, 326;
  152. if (@wrpD$[@num] == "Umbala") warp "umbala.gat", 130, 130;
  153. if (@wrpD$[@num] == "Yuno") warp "yuno.gat", 157, 123;
  154. close2; // this part safegaurds against errors/typos
  155. set zeny, zeny + @wrpP[@num];
  156. cutin "", 255;
  157. end;
  158. sL_CantTele:
  159. mes "[Kafra]";
  160. mes "Dear you don't have enough money. Please check your funds again.";
  161. close2;
  162. cutin "", 255;
  163. end;
  164. }
  165. // Cart Function ========================================================
  166. function script F_KafCart {
  167. if(callfunc("Is_Merc_Class") == 0) goto sL_CantRent;
  168. if(getskilllv(39)==0) goto sL_NeedSkill;
  169. if(checkcart(0) == 1) goto sL_GotCart;
  170. if(getarg(0) == 2) goto L_Guild;
  171. mes "[Kafra]";
  172. if(@kafPass==0) mes "The Cart Fee is 800 Zeny. Do you want to Rent a Cart?";
  173. if(@kafPass==1) mes "Since you're using a Kafra Pass, you can rent a cart for free!";
  174. next;
  175. menu "-Rent a Cart.",-, "-Cancel.",M_End;
  176. if(Zeny<800 && kafPass==0) goto sL_CartFee;
  177. if(@kafPass==0) set Zeny,Zeny-800;
  178. if(@kafPass==0) set RESRVPTS, RESRVPTS + 48;
  179. L_Guild:
  180. setcart;
  181. mes "[Kafra]";
  182. mes "Here is your cart.";
  183. return 1;
  184. sL_CantRent:
  185. mes "[Kafra]";
  186. mes "I'm sorry dear. The Cart service is only provided for the Merchant and Blacksmith Class.";
  187. return 1;
  188. sL_NeedSkill:
  189. mes "[Kafra]";
  190. mes "I'm sorry but you need the skill ^0000FF'Pushcart'^000000 to rent a cart.";
  191. return 1;
  192. sL_GotCart:
  193. mes "[Kafra]";
  194. mes "Excuse me... but you already have a cart....";
  195. emotion 4;
  196. return 1;
  197. sL_CartFee:
  198. mes "[Kafra]";
  199. mes "Dear, you don't have enough Money. You need 800 Zeny.";
  200. return 1;
  201. M_End:
  202. return 0;
  203. }
  204. // Pass Function ===============================================================
  205. function script F_KafPass {
  206. sM_Menu:
  207. menu "Use a Kafra Pass.",-, "What is a Kafra Pass?",sM_PassInfo, "Cancel",sM_End;
  208. mes "[Kafra]";
  209. mes "Let me just check your pass.....";
  210. next;
  211. if(usedKafPass==0 && countitem(1084)<1) goto sL_NeedPass;
  212. set @kafPass,1;
  213. set usedKafPass, usedKafPass + 1;
  214. if(usedKafPass>=3) goto sL_PassExpire;
  215. if(usedKafPass > 1) goto L_Cont; //fixed Lupus
  216. mes "(you hand her your pass)";
  217. next;
  218. mes "[Kafra]";
  219. 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.";
  220. mes "Your pass number has been entered into our database so you no longer need it.";
  221. delitem 1084,1;
  222. next;
  223. L_Cont:
  224. mes "[Kafra]";
  225. 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.";
  226. return 1;
  227. sL_NeedPass:
  228. mes "[Kafra]";
  229. mes "I'm sorry but you don't have a kafra pass to use....";
  230. next;
  231. goto sM_Menu;
  232. sL_PassExpire:
  233. mes "[Kafra]";
  234. mes "This is going to be the 3rd and final time you use this pass, therefore it is now expired.";
  235. next;
  236. set usedKafPass,0;
  237. mes "[Kafra]";
  238. mes "You may now use the Teleport and Cart Rental services for free.";
  239. return 1;
  240. sM_PassInfo:
  241. mes "[Kafra]";
  242. mes "A ^5533FFKafra Pass^000000 is a unique voucher that lets you use Kafra services for free!";
  243. mes "The Kafra services that you may use for free are the ^FF3355Teleport^000000 service and the ^FF3355Cart Rental^000000 service.";
  244. next;
  245. mes "[Kafra]";
  246. mes "Kafra passes can be purchased at the Kafra Corp. Main office in Al De Baran.";
  247. next;
  248. mes "[Kafra]";
  249. mes "To use a Kafra Pass, simply choose the option to 'Use a Kafra Pass', when speaking with a Kafra agent such as myself.";
  250. 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.";
  251. next;
  252. mes "[Kafra]";
  253. mes "Once you have finished using the desired services, and have stoped interacting with the Kafra, your 'free use' session will end.";
  254. mes "You will have a total of ^5533FF 3 'free use' sessions^000000 available upon activation of your Kafra Pass.";
  255. next;
  256. mes "[Kafra]";
  257. mes "To begin another 'free use' session, simply select the 'Use a Kafra Pass' option when speaking with a Kafra Agent.";
  258. next;
  259. mes "[Kafra]";
  260. mes "Believe me when I say that the Kafra Pass is a great bargain!!";
  261. mes "With the Kafra Pass, we hope to give players some incentive to use our great services.";
  262. next;
  263. goto sM_Menu;
  264. sM_End:
  265. return 0;
  266. }
  267. // Special Reserve Points Function ===========================================
  268. function script F_KafInfo {
  269. sM_Menu:
  270. if(getarg(0) == 0) menu "-Special Reserve Check",sM_ResChk, "-Kafra Locations",sM_KafLoc, "-Cancel",sM_End;
  271. sM_ResChk:
  272. mes "[Kafra]";
  273. mes "Here is your current amount of special reserve points:";
  274. mes "^0000ff"+RESRVPTS+"^000000.";
  275. next;
  276. mes "[Kafra]";
  277. mes "Remember to continue using Kafra services such as Storage and Teleport, to earn more special reserve points.";
  278. next;
  279. mes "[Kafra]";
  280. mes "You can trade them in at the Kafra Main Office in Al De Baran for usefull items and cool prizes.";
  281. next;
  282. if(getarg(0) == 1) return;
  283. goto sM_Menu;
  284. sM_KafLoc:
  285. mes "[Kafra]";
  286. mes "The flashing signals on your mini-map point to the locations of all of the Kafra Agents in this city.";
  287. viewpoint 1,@viewpX[0],@viewpY[0],1,0xFF00FF;
  288. viewpoint 1,@viewpX[1],@viewpY[1],2,0xFF00FF;
  289. viewpoint 1,@viewpX[2],@viewpY[2],3,0xFF00FF;
  290. viewpoint 1,@viewpX[3],@viewpY[3],4,0xFF00FF;
  291. next;
  292. viewpoint 2,@viewpX[0],@viewpY[0],1,0xFF00FF;
  293. viewpoint 2,@viewpX[1],@viewpY[1],2,0xFF00FF;
  294. viewpoint 2,@viewpX[2],@viewpY[2],3,0xFF00FF;
  295. viewpoint 2,@viewpX[3],@viewpY[3],4,0xFF00FF;
  296. goto sM_Menu;
  297. sM_End:
  298. return;
  299. }
  300. // End Function =====================================================
  301. // arg(0): used to determine what message to display.
  302. // arg(1): used to determine if save message is diplayed.
  303. //===================================================================
  304. function script F_KafEnd {
  305. mes "[Kafra]";
  306. if(getarg(1)==1) mes "Your respawn point has been saved."; // only shown when a player uses save
  307. if(getarg(0)!=1) mes "Thank you for using Kafra Services. We hope to see you again soon.";
  308. if(getarg(0)==1) mes "We, Kafra Corporation.... Will be with you.... whenever.... wherever... therefore.... please don't forget us.....";
  309. close2;
  310. cutin "", 255;
  311. emotion 15;
  312. end;
  313. }