functions_kafras.txt 12 KB

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