functions_kafras.txt 12 KB

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