mercenary_rent.txt 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. //===== rAthena Script =======================================
  2. //= Mercenary related NPCs
  3. //===== By: ==================================================
  4. //= L0ne_W0lf
  5. //===== Current Version: =====================================
  6. //= 1.5
  7. //===== Compatible With: =====================================
  8. //= rAthena Project
  9. //===== Description: =========================================
  10. //= [Official Conversion]
  11. //= Sells Lancer, Sword, and Archer mercenaries,
  12. //= along with related mercenary items.
  13. //===== Additional Comments: =================================
  14. //= 1.0 First version. [L0ne_W0lf]
  15. //= 1.1 Optimization. [Zephyrus]
  16. //= 1.2 Removed redundent input. [L0ne_W0lf]
  17. //= 1.3 Duplicates now spawned from floating NPCs. [L0ne_W0lf]
  18. //= 1.4 Optimized and fixed wrong item id. [Joseph]
  19. //= 1.5 Added Mercenary Guild Switch & fixed a bug
  20. //= in izlude duplicate. [Capuche]
  21. //= 1.5a Change to F_GM_NPC function in Mercenary Guild Switch
  22. //============================================================
  23. - script Mercenary Manager#main -1,{
  24. setarray .@name$, "Spear", "Sword", "Bow";
  25. setarray .@faith$, "SPEAR_MERC_GUILD", "SWORD_MERC_GUILD", "ARCH_MERC_GUILD";
  26. setarray .@item, 12182, 12172, 12162;
  27. .@npc$ = strnpcinfo(2);
  28. for (.@size = getarraysize(.@name$); .@type < .@size; .@type++)
  29. if( compare( .@npc$,.@name$[.@type] ) ) break;
  30. .@faith_merc = mercenary_get_faith(getd(.@faith$[.@type]));
  31. mes "[Mercenary Manager]";
  32. mes "Welcome to the";
  33. mes .@name$[.@type] + " Mercenary Guild.";
  34. mes "What can I do for you?";
  35. next;
  36. switch(select("Hire Mercenary:Mercenary Info:Nothing:10th Grade Mercenaries")) {
  37. case 1:
  38. mes "[Mercenary Manager]";
  39. mes "You want to hire a";
  40. mes .@name$[.@type] + " Mercenary?";
  41. mes "Which Grade were you";
  42. mes "interested in hiring?";
  43. next;
  44. for (.@i = 1; .@i <= 9; .@i++)
  45. .@menu$ = .@menu$ + callfunc("F_GetNumSuffix",.@i) + " Grade " + .@name$[.@type] + " Mercenary:";
  46. .@Grade = select(.@menu$);
  47. .@BaseLevel = 5 + (.@Grade * 10);
  48. .@BaseLevel = (.@val > 90)? 90 : .@BaseLevel;
  49. .@ZenyCost = 7 * .@Grade;
  50. setarray .@FaithCost[7], 50,100,300;
  51. .@FaithCost = .@FaithCost[.@Grade];
  52. mes "[Mercenary Manager]";
  53. mes "So you want to hire a " + callfunc("F_GetNumSuffix",.@Grade);
  54. mes "Grade " + .@name$[.@type] + " Mercenary?";
  55. mes "You need to have attained";
  56. mes "Base Level " + .@BaseLevel + " or higher, and";
  57. mes "must pay the " + .@ZenyCost + ",000 zeny fee.";
  58. next;
  59. if(select("Yes:No") == 2) {
  60. mes "[Mercenary Manager]";
  61. mes "Oh, really? Well, now";
  62. mes "might not be a good time";
  63. mes "for you to consider hiring";
  64. mes "a Mercenary, but please feel";
  65. mes "free to come back if your";
  66. mes "needs change. Thank you~";
  67. }
  68. else if(.@FaithCost && .@faith_merc < .@FaithCost) {
  69. mes "[Mercenary Manager]";
  70. mes "Oh... Your Loyalty rating";
  71. mes "with the " + .@name$[.@type] + " Mercenary";
  72. mes "Guild isn't high enough to";
  73. mes "hire this Mercenary. Please";
  74. mes "come back after you earn";
  75. mes "" + .@FaithCost + " or more Loyalty with us.";
  76. }
  77. else if (BaseLevel < .@BaseLevel) {
  78. mes "[Mercenary Manager]";
  79. mes "I'm sorry, but your Base";
  80. mes "Level isn't high enough";
  81. mes "to hire this Mercenary.";
  82. mes "Please come back to me";
  83. mes "once you reach Base Level " + .@BaseLevel + ".";
  84. }
  85. else if (Zeny < .@ZenyCost * 1000) {
  86. mes "[Mercenary Manager]";
  87. mes "I'm sorry, but you";
  88. mes "don't have enough zeny";
  89. mes "to hire this Mercenary.";
  90. mes "The hiring fee is " + .@ZenyCost + ",000 zeny.";
  91. }
  92. else {
  93. mes "[Mercenary Manager]";
  94. mes "Great! Our Mercenaries";
  95. mes "are sincere and devoted";
  96. mes "to protecting their clients.";
  97. mes "Summoned Mercenaries will";
  98. mes "offer their support to you for";
  99. mes "30 minutes. Take care now.";
  100. Zeny = Zeny - (.@ZenyCost * 1000);
  101. getitem .@item[.@type] - 10 + .@Grade, 1;
  102. }
  103. close;
  104. case 2:
  105. mes "[Mercenary Manager]";
  106. mes "Mercenaries are soldiers";
  107. mes "that will fight at your side";
  108. mes "on the battlefield, but there";
  109. mes "are a few terms and conditions";
  110. mes "you must fulfill to hire them.";
  111. next;
  112. mes "[Mercenary Manager]";
  113. mes "You must fulfill a level";
  114. mes "requirement and pay a zeny";
  115. mes "fee to hire a Mercenary.";
  116. mes "Higher grade Mercenaries";
  117. mes "will also require that you";
  118. mes "build a Loyalty rating with us.";
  119. next;
  120. mes "[Mercenary Manager]";
  121. mes "Mercenary contracts can't be";
  122. mes "transferred to other people,";
  123. mes "and we only allow a 5 Base Level difference between the Mercenary";
  124. mes "and client so you can't hire one much stronger than you.";
  125. next;
  126. mes "[Mercenary Manager]";
  127. mes "Well, you can figure out the";
  128. mes "details when you actually form";
  129. mes "a contract with one of our";
  130. mes "Mercenaries, and receive";
  131. mes "the Summon Scroll that will";
  132. mes "call a Mercenary to your side.";
  133. next;
  134. mes "[Mercenary Manager]";
  135. mes "You can't give this scroll";
  136. mes "to anyone else, and the";
  137. mes "Mercenary will only remain";
  138. mes "with you for 30 minutes after";
  139. mes "you summon him. Don't forget";
  140. mes "about the time limit, okay?";
  141. close;
  142. case 3:
  143. mes "[Mercenary Manager]";
  144. mes "No? You didn't need any";
  145. mes "help? Well, feel free to";
  146. mes "ask me if you have any";
  147. mes "questions about Mercenaries.";
  148. close;
  149. case 4:
  150. mes "[Mercenary Manager]";
  151. mes "10th Grade Mercenaries are";
  152. mes "the best we have to offer,";
  153. mes "and we use different criteria";
  154. mes "for our clients to hire them.";
  155. mes "There's no zeny fee, but you";
  156. mes "must have 500 Loyalty.";
  157. next;
  158. mes "[Mercenary Manager]";
  159. mes "Once you make a contract";
  160. mes "with a 10th Grade Mercenary,";
  161. mes "your Loyalty rating will be";
  162. mes "decreased by 400. In other";
  163. mes "words, you pay 400 Loyalty";
  164. mes "to hire a 10th Grade Mercenary.";
  165. next;
  166. mes "[Mercenary Manager]";
  167. mes "You must also be at";
  168. mes "Base Level 90 or higher to";
  169. mes "hire a 10th Grade Mercenary.";
  170. mes "Are you still interested in";
  171. mes "forming this contract?";
  172. next;
  173. if (select("Yes:No") == 2) {
  174. mes "[Mercenary Manager]";
  175. mes "I understand... It takes";
  176. mes "hard work and sacrifice to";
  177. mes "even reach the point where";
  178. mes "you can hire a 10th Grade";
  179. mes "Mercenary. Have you considered";
  180. mes "hiring a lower grade Mercenary?";
  181. }
  182. else if (.@faith_merc < 500) {
  183. mes "[Mercenary Manager]";
  184. mes "I'm sorry, but your";
  185. mes "Loyalty rating is too";
  186. mes "low to hire a 10th Grade";
  187. mes "Mercenary. You must have";
  188. mes "500 or more Loyalty to";
  189. mes "form a contract with one.";
  190. }
  191. else if (BaseLevel < 90) {
  192. mes "[Mercenary Manager]";
  193. mes "I'm sorry, but you must";
  194. mes "be at Base Level 90 or";
  195. mes "higher to form a contract";
  196. mes "with a 10th Grade Mercenary.";
  197. }
  198. else {
  199. mes "[Mercenary Manager]";
  200. mes "Congratulations! It looks";
  201. mes "like you're planning in taking";
  202. mes "on some very dangerous work";
  203. mes "since you're hiring a 10th";
  204. mes "Grade Mercenary. I wish you";
  205. mes "the best of luck with him.";
  206. mercenary_set_faith getd(.@faith$[.@type]),-400;
  207. getitem .@item[.@type],1;
  208. }
  209. close;
  210. }
  211. }
  212. prontera,41,337,5 duplicate(Mercenary Manager#main) Mercenary Manager#Spear 8W_SOLDIER
  213. pay_arche,99,167,4 duplicate(Mercenary Manager#main) Mercenary Manager#Bow 4_M_JOB_HUNTER
  214. // Mercenary Merchant NPCs
  215. //============================================================
  216. - script Mercenary Merchant#dummy::MercMerchant -1,{
  217. mes "[Mercenary Goods Merchant]";
  218. mes "Hello, I sell goods";
  219. mes "that Mercenaries can";
  220. mes "use. Is there anything";
  221. mes "in particular that";
  222. mes "you're looking for?";
  223. next;
  224. setarray .@item, 12184, 12185, 12241, 12242, 12243;
  225. setarray .@cost, 2500, 5000, 800, 1500, 3000;
  226. for (.@size = getarraysize(.@item); .@i < .@size; .@i++)
  227. .@menu$ = .@menu$ + getitemname(.@item[.@i]) + ":";
  228. .@m = select(.@menu$)-1;
  229. .@str$ = .@cost[.@m] + "";
  230. .@len = getstrlen(.@str$);
  231. .@str_cost$ = (.@len <= 3)? .@str$ : insertchar(.@str$,",",.@len-3);
  232. mes "[Mercenary Goods Merchant]";
  233. mes getitemname(.@item[.@m]);
  234. mes "each cost " + .@str_cost$ + " zeny.";
  235. mes "How many would you like?";
  236. next;
  237. input .@input;
  238. if (!.@input) {
  239. mes "[Mercenary Goods Merchant]";
  240. mes "You changed your mind?";
  241. mes "Alright, feel free to come";
  242. mes "back to me whenever you want";
  243. mes "to buy any Mercenary Potions.";
  244. close;
  245. }
  246. else if (.@input < 0 || .@input > 10000) {
  247. mes "[Mercenary Goods Merchant]";
  248. mes "I'm sorry, but you";
  249. mes "can only buy up to";
  250. mes "10,000 of these potions";
  251. mes "at a time. Please enter";
  252. mes "a number from 1 to 10,000.";
  253. close;
  254. }
  255. else if (set(.@total_po, .@input * .@cost[.@m]) > Zeny) {
  256. mes "[Mercenary Goods Merchant]";
  257. mes "I'm sorry, but you don't";
  258. mes "have enough zeny for this";
  259. mes "many potions. Well, I'll be";
  260. mes "be here when you're ready";
  261. mes "to purchase something";
  262. mes "for your Mercenaries.";
  263. close;
  264. }
  265. else if (!checkweight(.@item[.@m], .@input)) {
  266. mes "[Mercenary Goods Merchant]";
  267. mes "If I gave you that many";
  268. mes "potions, you wouldn't be";
  269. mes "able to carry them with you.";
  270. mes "Please come back after";
  271. mes "you free up some space";
  272. mes "in your Inventory.";
  273. close;
  274. }
  275. mes "[Mercenary Goods Merchant]";
  276. if (.@input == 1)
  277. mes "Here's your " + getitemname(.@item[.@m]) + ".";
  278. else {
  279. mes "Here you are, this is exactly";
  280. mes callfunc("F_InsertPlural",.@input,getitemname(.@item[.@m])) + ".";
  281. }
  282. mes "Thank you, and please come";
  283. mes "again when you need more";
  284. mes "potions for your Mercenaries.";
  285. Zeny = Zeny - .@total_po;
  286. getitem .@item[.@m], .@input;
  287. close;
  288. }
  289. prontera,30,337,4 duplicate(MercMerchant) Mercenary Merchant#Spear 8_F_GIRL
  290. pay_arche,102,167,5 duplicate(MercMerchant) Mercenary Merchant#Bow 4_F_CAPEGIRL
  291. // Mercenary Switch NPCs
  292. //============================================================
  293. - script Mercenary_Switch -1,{
  294. setarray .@name$, "Spear","Sword","Bow";
  295. .@npc$ = strnpcinfo(2);
  296. for (.@size = getarraysize(.@name$); .@type < .@size; .@type++)
  297. if (.@npc$ == .@name$[.@type]) break;
  298. mes "[Checker]";
  299. mes "Please input a password.";
  300. next;
  301. .@i = callfunc("F_GM_NPC",1854,0,0,10000);
  302. mes "[Checker]";
  303. if (.@i == -2)
  304. mes "Error.";
  305. else if (.@i == 0)
  306. mes "Wrong number";
  307. else if (.@i == 1) {
  308. mes "Please select.";
  309. next;
  310. switch( select( "Turn off Mercenary NPC","Turn on Mercenary NPC" ) ) {
  311. case 1:
  312. mes "NPCs are turned off.";
  313. disablenpc "Mercenary Manager#" + .@name$[.@type];
  314. disablenpc "Mercenary Merchant#" + .@name$[.@type];
  315. break;
  316. case 2:
  317. mes "NPCs are turned on.";
  318. enablenpc "Mercenary Manager#" + .@name$[.@type];
  319. enablenpc "Mercenary Merchant#" + .@name$[.@type];
  320. break;
  321. }
  322. }
  323. close;
  324. }
  325. prontera,299,379,5 duplicate(Mercenary_Switch) Mercenary Switch#Spear 8W_SOLDIER
  326. pay_arche,170,185,5 duplicate(Mercenary_Switch) Mercenary Switch#Bow 4_F_CAPEGIRL
  327. izlude,245,250,4 duplicate(Mercenary_Switch) Mercenary Switch#Sword 4_F_HUWOMAN