gldfunc_manager.txt 16 KB

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