gldfunc_manager.txt 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. //===== eAthena Script =======================================
  2. //= War of Emperium Guild Manager Function
  3. //===== By: ==================================================
  4. //= jAthena - kalen (1.0) & eAthena Team
  5. //===== Current Version: =====================================
  6. //= 1.7
  7. //===== Compatible With: =====================================
  8. //= eAthena 0.1+; RO Episode 4+
  9. //===== Description: =========================================
  10. //= The Guild Manager allows the Guildmaster to invest in comerce
  11. //= and defense, hire guardians and kafras, go to the treasure room,
  12. //= and surrender the guild castle.
  13. //==============================================
  14. //= Break down of arguments used in the function:
  15. //= arg(0): name of Castle Manager
  16. //= arg(1): name of guild castle.
  17. //= arg(2): x1 coordinate for warp to treasure room
  18. //= arg(3): y1 coordinate for warp to treasure room
  19. //= arg(4): guild script suffix for kafra, Guardian scripts etc.
  20. //===== Additional Comments: =================================
  21. //= 1.31: Added support for Emsolute Develop [celest]
  22. //= 1.2: All Guild manager scripts use this function. Optimized Comerce and Defense investment. [kobra_k88]
  23. //= 1.2a Function now returns to script that called it. Added disablenpc line to surrender castle option to remove kafra upon surrender.[kobra_k88]
  24. //= 1.2b U can't surrender the base during WOE [Lupus]
  25. //= 1.2c Fixed issue of guardians hp not increasing upon defense investment.[kobra_k88]
  26. //= 1.3 Now you can't install Guardians during WOE [Lupus]
  27. //= 1.4 Remove surrender abbility (Was 100% custom as far as I can tell) [Kayla]
  28. //= 1.41 Fixed possible Economy investment overflow with Emsolute Develop learnt [Lupus]
  29. //= 1.5 Official Novice Castles Menu (u can't invest / hire guardians) [Lupus]
  30. //= 1.6 According to recent info u can re-install Guardians during WoE [Lupus]
  31. //= 1.6a Fix for guild manager recognizing [KarLaeda]
  32. //= 1.6b Fixed the chance for double invest, now 50% instead of 49% [Lupus]
  33. //= 1.7 Changed the names of the Kafra from "Service" to "Staff" [L0ne_W0lf]
  34. //============================================================
  35. //==============================================
  36. function script F_GldManager {
  37. set @GID, GetCastleData(getarg(1),1);
  38. mes "[ "+getarg(0)+" ]";
  39. if (@GID == 0){
  40. mes "I am waiting for my master. Brave adventurer, follow your destiny!";
  41. return 0;
  42. }
  43. if (getcharid(2) != @GID){
  44. mes "I am here to follow ^5533FF" + getguildmaster(@GID) + "^000000's command! Hey! Your not even a part of the guild!!";
  45. mes "Where are the guardians? Destroy these intruders!";
  46. return 0;
  47. }
  48. if (strcharinfo(0) != getguildmaster(@GID)){
  49. mes "You're not ^5533FF" + getguildmaster(@GID) + "^000000! I am here to follow ^5533FF" + getguildmaster(@GID) + "^000000's command only";
  50. return 0;
  51. }
  52. mes "Welcome Master ^5533FF" + getguildmaster(@GID) + "^000000 ! I will assist you in any way I can!";
  53. next;
  54. //Novice Castles. (we don't need ELSE here. Menu has direct labels)
  55. if(getarg(1) == "nguild_prt" || getarg(1) == "nguild_alde" || getarg(1) == "nguild_gef" || getarg(1) == "nguild_pay" )
  56. menu "Kafra Staff Employment / Dismissal",M_Kaf, "Enter Treasure Room",M_Treas, "Cancel",M_End;
  57. //Common WoE Castles
  58. menu "Guild Base Briefing",M_Base, "Commerce Investment",M_Comrc, "Defence Investment",M_Def, "Guardian Installation",M_Guard,
  59. "Kafra Staff Employment / Dismissal",M_Kaf, "Enter Treasure Room",M_Treas, "Cancel",M_End;
  60. //========================
  61. M_Base:
  62. //=========
  63. mes "[ "+getarg(0)+" ]";
  64. mes "Guild Base Investment Information.";
  65. mes " ";
  66. mes "Current Commerce Investment is : ^FF3322" + GetCastleData(getarg(1),2) + "^000000 points.";
  67. mes "^0000ff - You have invested " + GetCastleData(getarg(1),4) + " times today.^000000";
  68. next;
  69. mes "[ "+getarg(0)+" ]";
  70. mes "Current Defence Investment is : ^FF3322" + GetCastleData(getarg(1),3) + "^000000 points.";
  71. mes "^0000ff- You have invested " + GetCastleData(getarg(1),5) + " times today.^000000";
  72. mes " ";
  73. mes "That is about it.";
  74. return 0;
  75. //========================
  76. M_Comrc:
  77. //=========
  78. set @TriggerE,GetCastleData(getarg(1),4);
  79. set @Economy,GetCastleData(getarg(1),2);
  80. if(@Economy < 8) set @eco_invest,10000;
  81. if(@Economy >= 8) set @eco_invest,20000;
  82. if(@Economy >= 16) set @eco_invest,40000;
  83. if(@Economy >= 25) set @eco_invest,80000;
  84. if(@Economy >= 34) set @eco_invest,160000;
  85. if(@Economy >= 44) set @eco_invest,320000;
  86. if(@Economy >= 54) set @eco_invest,640000;
  87. if(@Economy >= 65) set @eco_invest,1280000;
  88. if(@Economy >= 76) set @eco_invest,2560000;
  89. if(@Economy >= 88) set @eco_invest,5120000;
  90. mes "[ "+getarg(0)+" ]";
  91. if(@TriggerE == 2){
  92. mes "^ff0000You have already invested twice today, and that's the limit.^000000 I'm expecting to see our riches grow at a high level.";
  93. return 0;
  94. }
  95. if(@Economy >= 100){
  96. mes "^ff0000This Castle's commerce investment is already maxed at 100 points. You don't have to invest any further.^000000";
  97. return 0;
  98. }
  99. mes "If you improve your Commerce Investment, the guild's productive power increases to produce more goods.";
  100. mes "So an investment will be required if you're considering future growth.";
  101. next;
  102. mes "[ "+getarg(0)+" ]";
  103. if(@TriggerE == 0) {
  104. mes "You can invest up to two times a day, but the second time costs more";
  105. mes "The needed investment amount is ^5533FF" + @eco_invest + "^000000 zeny.";
  106. } else {
  107. set @eco_invest,@eco_invest*4;
  108. mes "You've already invested once today, but you can invest again at ^5533FF" + @eco_invest + "^000000 Zeny.";
  109. }
  110. next;
  111. mes "[ "+getarg(0)+" ]";
  112. mes "Would you like to invest?";
  113. next;
  114. menu "Invest Commerce.",-,"Cancel.",M_End;
  115. mes "[ "+getarg(0)+" ]";
  116. if(Zeny < @eco_invest){
  117. mes "Master, you do not have enough money to invest. Investment has been cancelled.";
  118. return 0;
  119. }
  120. set Zeny,Zeny-@eco_invest;
  121. SetCastleData getarg(1),4,@TriggerE+1;
  122. // if we learnt Emsolute Develop there's 50% chance to get +1 investment again
  123. SetCastleData getarg(1),2,@Economy + 1 + (@Economy<99 && rand(2) && getgdskilllv(@GID,10014));
  124. mes "You have invested successfully.";
  125. return 0;
  126. //=========================
  127. M_Def:
  128. //========
  129. set @TriggerD,GetCastleData(getarg(1),5);
  130. set @Defence,GetCastleData(getarg(1),3);
  131. if(@Defence < 8) set @def_invest,20000;
  132. if(@Defence >= 8) set @def_invest,40000;
  133. if(@Defence >= 16) set @def_invest,80000;
  134. if(@Defence >= 25) set @def_invest,160000;
  135. if(@Defence >= 34) set @def_invest,320000;
  136. if(@Defence >= 44) set @def_invest,640000;
  137. if(@Defence >= 54) set @def_invest,1280000;
  138. if(@Defence >= 65) set @def_invest,2560000;
  139. if(@Defence >= 76) set @def_invest,5120000;
  140. if(@Defence >= 88) set @def_invest,10240000;
  141. mes "[ "+getarg(0)+" ]";
  142. if(@TriggerD == 2){
  143. mes "^ff0000You have already invested twice today, and that's the limit.^000000 I'm expecting to see our riches grow at a high level.";
  144. return 0;
  145. }
  146. if(@Defence >= 100){
  147. mes "^ff0000This Castle's Defence Investment is already maxed at 100 points. You don't have to invest any further.^000000";
  148. return 0;
  149. }
  150. mes "If you improve investment of defence, the durability of our Guardians and the Emperium will increase.";
  151. mes "So if you consider our future battles, an investment will be required.";
  152. next;
  153. mes "[ "+getarg(0)+" ]";
  154. if(@TriggerD == 0) {
  155. mes "You can invest up to two times a day, but the second time costs more";
  156. mes "The needed investment amount is ^5533FF" + @def_invest + "^000000 zeny.";
  157. } else {
  158. set @def_invest,@def_invest*4;
  159. mes "You've already invested once today, but you can invest again at ^5533FF" + @def_invest + "^000000 Zeny.";
  160. }
  161. next;
  162. mes "[ "+getarg(0)+" ]";
  163. mes "Would you like to invest?";
  164. next;
  165. menu "Invest Defence.",-, "Cancel",M_End;
  166. mes "[ "+getarg(0)+" ]";
  167. if(Zeny < @def_invest){
  168. mes "Master, you do not have enough money to invest in Defence. Defence investment has been cancelled.";
  169. return 0;
  170. }
  171. set Zeny,Zeny-@def_invest;
  172. SetCastleData getarg(1),5,@TriggerD+1;
  173. SetCastleData getarg(1),3,@Defence+1;
  174. // set new hp values for guardians
  175. set @Defence, @Defence + 1;
  176. set @AGuardian, 28634 + (@Defence*2000);
  177. set @KGuardian, 30214 + (@Defence*2000);
  178. set @SGuardian, 15670 + (@Defence*2000);
  179. //set @AGuardian,strmobinfo(4,1285) + (@Defence*2000);
  180. //set @KGuardian,strmobinfo(4,1286) + (@Defence*2000);
  181. //set @SGuardian,strmobinfo(4,1287) + (@Defence*2000);
  182. if (GetCastleData(getarg(1),10) == 1) SetCastleData getarg(1),18,@SGuardian;
  183. if (GetCastleData(getarg(1),11) == 1) SetCastleData getarg(1),19,@SGuardian;
  184. if (GetCastleData(getarg(1),12) == 1) SetCastleData getarg(1),20,@SGuardian;
  185. if (GetCastleData(getarg(1),13) == 1) SetCastleData getarg(1),21,@AGuardian;
  186. if (GetCastleData(getarg(1),14) == 1) SetCastleData getarg(1),22,@AGuardian;
  187. if (GetCastleData(getarg(1),15) == 1) SetCastleData getarg(1),23,@KGuardian;
  188. if (GetCastleData(getarg(1),16) == 1) SetCastleData getarg(1),24,@KGuardian;
  189. if (GetCastleData(getarg(1),17) == 1) SetCastleData getarg(1),25,@KGuardian;
  190. mes "You have invested successfully.";
  191. return 0;
  192. //=========================
  193. M_Guard:
  194. //=========
  195. mes "[ "+getarg(0)+" ]";
  196. if (getgdskilllv(@GID,10002) == 0){
  197. mes "I'm sorry Master but you cannot install any guardians right now. Your guild must learn the Guild skill ^5533FFGuardian Research^000000 first.";
  198. mes "Guardian Installation has been cancelled.";
  199. return 0;
  200. }
  201. set @Defence,GetCastleData(getarg(1),3);
  202. set @Guardian0,guardianinfo(0);
  203. set @Guardian1,guardianinfo(1);
  204. set @Guardian2,guardianinfo(2);
  205. set @Guardian3,guardianinfo(3);
  206. set @Guardian4,guardianinfo(4);
  207. set @Guardian5,guardianinfo(5);
  208. set @Guardian6,guardianinfo(6);
  209. set @Guardian7,guardianinfo(7);
  210. set @AGuardian, 28634 + (@Defence*2000);
  211. set @KGuardian, 30214 + (@Defence*2000);
  212. set @SGuardian, 15670 + (@Defence*2000);
  213. //set @AGuardian,strmobinfo(4,1285) + (@Defence*2000);
  214. //set @KGuardian,strmobinfo(4,1286) + (@Defence*2000);
  215. //set @SGuardian,strmobinfo(4,1287) + (@Defence*2000);
  216. //uncomment the following line to disable guardians Installation during WoE
  217. //if(agitcheck()) goto L_CantGuard;
  218. mes "Would you like to install a guardian? Guardians will protect the guild base from enemies.";
  219. mes "Please choose a guardian.";
  220. next;
  221. menu "Soldier Guardian (" + @Guardian0 + "/" + @SGuardian + ")",L4_1,
  222. "Soldier Guardian (" + @Guardian1 + "/" + @SGuardian + ")",L4_2,
  223. "Soldier Guardian (" + @Guardian2 + "/" + @SGuardian + ")",L4_3,
  224. "Archer Guardian (" + @Guardian3 + "/" + @AGuardian + ")",L4_4,
  225. "Archer Guardian (" + @Guardian4 + "/" + @AGuardian + ")",L4_5,
  226. "Knight Guardian (" + @Guardian5 + "/" + @KGuardian + ")",L4_6,
  227. "Knight Guardian (" + @Guardian6 + "/" + @KGuardian + ")",L4_7,
  228. "Knight Guardian (" + @Guardian7 + "/" + @KGuardian + ")",L4_8;
  229. L4_1:
  230. if (GetCastleData(getarg(1),10) == 1) goto L_GotGuard;
  231. set @GDnum,10;
  232. set @GDnum2,18;
  233. set @GuardianHP,@SGuardian;
  234. goto L4_9;
  235. L4_2:
  236. if (GetCastleData(getarg(1),11) == 1) goto L_GotGuard;
  237. set @GDnum,11;
  238. set @GDnum2,19;
  239. set @GuardianHP,@SGuardian;
  240. goto L4_9;
  241. L4_3:
  242. if (GetCastleData(getarg(1),12) == 1) goto L_GotGuard;
  243. set @GDnum,12;
  244. set @GDnum2,20;
  245. set @GuardianHP,@SGuardian;
  246. goto L4_9;
  247. L4_4:
  248. if (GetCastleData(getarg(1),13) == 1) goto L_GotGuard;
  249. set @GDnum,13;
  250. set @GDnum2,21;
  251. set @GuardianHP,@AGuardian;
  252. goto L4_9;
  253. L4_5:
  254. if (GetCastleData(getarg(1),14) == 1) goto L_GotGuard;
  255. set @GDnum,14;
  256. set @GDnum2,22;
  257. set @GuardianHP,@AGuardian;
  258. goto L4_9;
  259. L4_6:
  260. if (GetCastleData(getarg(1),15) == 1) goto L_GotGuard;
  261. set @GDnum,15;
  262. set @GDnum2,23;
  263. set @GuardianHP,@KGuardian;
  264. goto L4_9;
  265. L4_7:
  266. if (GetCastleData(getarg(1),16) == 1) goto L_GotGuard;
  267. set @GDnum,16;
  268. set @GDnum2,24;
  269. set @GuardianHP,@KGuardian;
  270. goto L4_9;
  271. L4_8:
  272. if (GetCastleData(getarg(1),17) == 1) goto L_GotGuard;
  273. set @GDnum,17;
  274. set @GDnum2,25;
  275. set @GuardianHP,@KGuardian;
  276. L4_9:
  277. mes "[ "+getarg(0)+" ]";
  278. mes "Would you really like to install a guardian? You need ^5533FF10,000 zeny^000000 to install one....";
  279. next;
  280. menu "Install",-, "Cancel",M_End;
  281. if (Zeny < 10000){
  282. mes "[ "+getarg(0)+" ]";
  283. mes "I'm sorry Master, but you do not have enough zeny for a Guardian.";
  284. return 0;
  285. }
  286. set Zeny,Zeny-10000;
  287. SetCastleData getarg(1),@GDnum,1;
  288. SetCastleData getarg(1),@GDnum2,@GuardianHP;
  289. return 1;
  290. L_GotGuard:
  291. mes "[ "+getarg(0)+" ]";
  292. mes "Excuse me Master, but that guardian has already been installed.....";
  293. emotion 4;
  294. return 0;
  295. L_CantGuard:
  296. mes "Master.... don't you know that we can't install guardians during the War Of Emperium?!!";
  297. emotion 4;
  298. return 0;
  299. //===========================
  300. M_Kaf:
  301. //======
  302. mes "[ "+getarg(0)+" ]";
  303. if (GetCastleData(getarg(1),9) == 1) goto L_Dismiss;
  304. if (getgdskilllv(@GID,10001) == 0){
  305. mes "Master, you don't have a contract with the Kafra Staff Company.";
  306. mes "In order to hire a Kafra, you must first learn the Guild skill ^5533FFContract With Kafra^000000.";
  307. return 0;
  308. }
  309. L_Hire:
  310. mes "Would you like to employ the services of a Kafra? You will need ^5533FF10,000 Zeny^000000 to do so... ";
  311. next;
  312. menu "Employ Kafra.",-,"Cancel",sM_KafEnd;
  313. mes "[ "+getarg(0)+" ]";
  314. if (Zeny < 10000){
  315. mes "Master, you do not have enough money to employ a Kafra. Employment has been cancelled.";
  316. return 0;
  317. }
  318. set Zeny,Zeny-10000;
  319. enablenpc "Kafra Staff#"+getarg(4);
  320. SetCastleData getarg(1),9,1;
  321. mes "You have created a contract with the Kafra Staff Company.";
  322. next;
  323. cutin "kafra_01",2;
  324. mes "[ Kafra Staff ]";
  325. mes "How do you do? I'm here to provide you with helpful service! I'll do the best I can to serve you.";
  326. next;
  327. cutin "kafra_01",255;
  328. mes "[ "+getarg(0)+" ]";
  329. //mes "Your employment contract lasts ^5533FF1 month^000000. After this term is over you will have to create a new contract.";
  330. mes "I think the Kafra Staff will benefit our guild members.";
  331. return 0;
  332. sM_KafEnd:
  333. mes "[ "+getarg(0)+" ]";
  334. mes "As you wish Master. But I suggest we get a Kafra as soon as possible!";
  335. return 0;
  336. L_Dismiss:
  337. mes "Would you like to dismiss the current Kafra?";
  338. next;
  339. menu "Dismissal",-,"Cancel",sM_KafEnd2;
  340. cutin "kafra_01",2;
  341. mes "[ Kafra Staff ]";
  342. mes "Have I done anything wrong? If I did, will you please forgive me?";
  343. next;
  344. menu "Dismiss",-,"Cancel",ssM_KafEnd2;
  345. mes "[ Kafra Staff ]";
  346. mes "It's unfortunate that I won't be able to serve your guild anymore....";
  347. next;
  348. disablenpc "Kafra Staff#"+getarg(4);
  349. SetCastleData getarg(1),9,0;
  350. cutin "kafra_01",255;
  351. mes "[ "+getarg(0)+" ]";
  352. mes "The Kafra has been dismissed. But... we should really get a Kafra as soon as possible!";
  353. return 0;
  354. ssM_KafEnd2:
  355. mes "[ Kafra Staff ]";
  356. mes "Thank you master, I'll do my best! ^^.";
  357. cutin "kafra_01",255;
  358. return 0;
  359. sM_KafEnd2:
  360. mes "[ "+getarg(0)+" ]";
  361. mes "Master, I think you should keep the current Kafra Staff because she is already trying her best to serve us";
  362. return 0;
  363. //=========================
  364. M_Treas:
  365. //========
  366. mes "[ "+getarg(0)+" ]";
  367. mes "Would you to go to our Treasure Room? Only you, the Guild Master, are allowed to enter this room.";
  368. next;
  369. menu "Enter Treasure room.",-,"Cancel",sM_TresEnd;
  370. mes "[ "+getarg(0)+" ]";
  371. mes "Please follow me through the secret passage way.";
  372. mes "You must pull down on the secret switch in order to get out.";
  373. next;
  374. warp getarg(1),getarg(2),getarg(3);
  375. return 0;
  376. sM_TresEnd:
  377. mes "[ "+getarg(0)+" ]";
  378. mes "The goods are produced everyday.";
  379. mes "You should get them whenever you can because they might dissapear if you take them at the wrong time.";
  380. return 0;
  381. //==========================
  382. M_End:
  383. //=======
  384. mes "[ "+getarg(0)+" ]";
  385. mes "As you wish, master.";
  386. return 0;
  387. }