functions_kafras.txt 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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.2b
  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. //= Fixed typo >_< [Aria]
  28. //============================================================
  29. // Main Function ===========================================================
  30. //= arg(0): Used to determine which welcome message to show.
  31. //= arg(1): Used to determine which menu to display.
  32. //= arg(2): Used to determine if the info menu is shown in F_KafInfo.
  33. //==========================================================================
  34. function script F_Kafra {
  35. set @kafPass, 0;
  36. mes "[Kafra]";
  37. if(getarg(0)==0) mes "Welcome to Kafra Corp. We will stay with you wherever you go.";
  38. if(getarg(0)==1) mes "Welcome... Kafra Services.... Will be with you even if you die.....";
  39. if(getarg(0)==2) mes "Welcome, ^5533FF" + GetGuildName(@GID) + "^000000 members. We will stay with you wherever you go";
  40. next;
  41. M_Menu:
  42. 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;
  43. if(getarg(1)==1) menu "-Save",M_Save, "-Use Storage",M_Storage, "-Rent a Cart",M_Cart, "-Kafra Pass",M_Pass, "-Other Information Check",M_Info,
  44. "-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. callfunc "F_KafEnd",getarg(0),0;
  85. end;
  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. callfunc "F_KafEnd",0,0;
  97. end;
  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. end;
  153. sL_CantTele:
  154. mes "[Kafra]";
  155. mes "Dear you don't have enough money. Please check your funds again.";
  156. close2;
  157. cutin "", 255;
  158. end;
  159. }
  160. // Cart Function ========================================================
  161. function script F_KafCart {
  162. if(callfunc("Is_Merc_Class") == 0) goto sL_CantRent;
  163. if(getskilllv(39)==0) goto sL_NeedSkill;
  164. if(checkcart(0) == 1) goto sL_GotCart;
  165. if(getarg(0) == 2) goto L_Guild;
  166. mes "[Kafra]";
  167. if(@kafPass==0) mes "The Cart Fee is 800 Zeny. Do you want to Rent a Cart?";
  168. if(@kafPass==1) mes "Since you're using a Kafra Pass, you can rent a cart for free!";
  169. next;
  170. menu "-Rent a Cart.",-, "-Cancel.",M_End;
  171. if(Zeny<800 && kafPass==0) goto sL_CartFee;
  172. if(@kafPass==0) set Zeny,Zeny-800;
  173. if(@kafPass==0) set RESRVPTS, RESRVPTS + 48;
  174. L_Guild:
  175. setcart;
  176. mes "[Kafra]";
  177. mes "Here is your cart.";
  178. return 1;
  179. sL_CantRent:
  180. mes "[Kafra]";
  181. mes "I'm sorry dear. The Cart service is only provided for the Merchant and Blacksmith Class.";
  182. return 1;
  183. sL_NeedSkill:
  184. mes "[Kafra]";
  185. mes "I'm sorry but you need the skill ^0000FF'Pushcart'^000000 to rent a cart.";
  186. return 1;
  187. sL_GotCart:
  188. mes "[Kafra]";
  189. mes "Excuse me... but you already have a cart....";
  190. emotion 4;
  191. return 1;
  192. sL_CartFee:
  193. mes "[Kafra]";
  194. mes "Dear, you don't have enough Money. You need 800 Zeny.";
  195. return 1;
  196. M_End:
  197. return 0;
  198. }
  199. // Pass Function ===============================================================
  200. function script F_KafPass {
  201. sM_Menu:
  202. menu "Use a Kafra Pass.",-, "What is a Kafra Pass?",sM_PassInfo, "Cancel",sM_End;
  203. mes "[Kafra]";
  204. mes "Let me just check your pass.....";
  205. next;
  206. if(usedKafPass==0 && countitem(1084)<1) goto sL_NeedPass;
  207. set @kafPass,1;
  208. set usedKafPass, usedKafPass + 1;
  209. if(usedKafPass>=3) goto sL_PassExpire;
  210. if(usedKafPass > 1) goto L_Cont; //fixed Lupus
  211. mes "(you hand her your pass)";
  212. next;
  213. mes "[Kafra]";
  214. 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.";
  215. mes "Your pass number has been entered into our database so you no longer need it.";
  216. delitem 1084,1;
  217. next;
  218. L_Cont:
  219. mes "[Kafra]";
  220. 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.";
  221. return 1;
  222. sL_NeedPass:
  223. mes "[Kafra]";
  224. mes "I'm sorry but you don't have a kafra pass to use....";
  225. next;
  226. goto sM_Menu;
  227. sL_PassExpire:
  228. mes "[Kafra]";
  229. mes "This is going to be the 3rd and final time you use this pass, therefore it is now expired.";
  230. next;
  231. set usedKafPass,0;
  232. mes "[Kafra]";
  233. mes "You may now use the Teleport and Cart Rental services for free.";
  234. return 1;
  235. sM_PassInfo:
  236. mes "[Kafra]";
  237. mes "A ^5533FFKafra Pass^000000 is a unique voucher that lets you use Kafra services for free!";
  238. mes "The Kafra services that you may use for free are the ^FF3355Teleport^000000 service and the ^FF3355Cart Rental^000000 service.";
  239. next;
  240. mes "[Kafra]";
  241. mes "Kafra passes can be purchased at the Kafra Corp. Main office in Al De Baran.";
  242. next;
  243. mes "[Kafra]";
  244. mes "To use a Kafra Pass, simply choose the option to 'Use a Kafra Pass', when speaking with a Kafra agent such as myself.";
  245. 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.";
  246. next;
  247. mes "[Kafra]";
  248. mes "Once you have finished using the desired services, and have stoped interacting with the Kafra, your 'free use' session will end.";
  249. mes "You will have a total of ^5533FF 3 'free use' sessions^000000 available upon activation of your Kafra Pass.";
  250. next;
  251. mes "[Kafra]";
  252. mes "To begin another 'free use' session, simply select the 'Use a Kafra Pass' option when speaking with a Kafra Agent.";
  253. next;
  254. mes "[Kafra]";
  255. mes "Believe me when I say that the Kafra Pass is a great bargain!!";
  256. mes "With the Kafra Pass, we hope to give players some incentive to use our great services.";
  257. next;
  258. goto sM_Menu;
  259. sM_End:
  260. return 0;
  261. }
  262. // Special Reserve Points Function ===========================================
  263. function script F_KafInfo {
  264. sM_Menu:
  265. if(getarg(0) == 0) menu "-Special Reserve Check",sM_ResChk, "-Kafra Locations",sM_KafLoc, "-Cancel",sM_End;
  266. sM_ResChk:
  267. mes "[Kafra]";
  268. mes "Here is your current amount of special reserve points:";
  269. mes "^0000ff"+RESRVPTS+"^000000.";
  270. next;
  271. mes "[Kafra]";
  272. mes "Remember to continue using Kafra services such as Storage and Teleport, to earn more special reserve points.";
  273. next;
  274. mes "[Kafra]";
  275. mes "You can trade them in at the Kafra Main Office in Al De Baran for usefull items and cool prizes.";
  276. next;
  277. if(getarg(0) == 1) return;
  278. goto sM_Menu;
  279. sM_KafLoc:
  280. mes "[Kafra]";
  281. mes "The flashing signals on your mini-map point to the locations of all of the Kafra Agents in this city.";
  282. viewpoint 1,@viewpX[0],@viewpY[0],1,0xFF00FF;
  283. viewpoint 1,@viewpX[1],@viewpY[1],2,0xFF00FF;
  284. viewpoint 1,@viewpX[2],@viewpY[2],3,0xFF00FF;
  285. viewpoint 1,@viewpX[3],@viewpY[3],4,0xFF00FF;
  286. next;
  287. viewpoint 2,@viewpX[0],@viewpY[0],1,0xFF00FF;
  288. viewpoint 2,@viewpX[1],@viewpY[1],2,0xFF00FF;
  289. viewpoint 2,@viewpX[2],@viewpY[2],3,0xFF00FF;
  290. viewpoint 2,@viewpX[3],@viewpY[3],4,0xFF00FF;
  291. goto sM_Menu;
  292. sM_End:
  293. return;
  294. }
  295. // End Function =====================================================
  296. // arg(0): used to determine what message to display.
  297. // arg(1): used to determine if save message is diplayed.
  298. //===================================================================
  299. function script F_KafEnd {
  300. mes "[Kafra]";
  301. if(getarg(1)==1) mes "Your respawn point has been saved."; // only shown when a player uses save
  302. if(getarg(0)!=1) mes "Thank you for using Kafra Services. We hope to see you again soon.";
  303. if(getarg(0)==1) mes "We, Kafra Corporation.... Will be with you.... whenever.... wherever... therefore.... please don't forget us.....";
  304. close2;
  305. cutin "", 255;
  306. emotion 15;
  307. end;
  308. }