gldfunc_manager.txt 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421
  1. //===== eAthena Script =======================================
  2. //= War of Emperium Guild Manager Function
  3. //===== By: ==================================================
  4. //= jAthena - kalen (1.0)
  5. //= 1.1 by Akaru, ho|yAnge|X, and Valaris
  6. //===== Current Version: =====================================
  7. //= 1.41
  8. //===== Compatible With: =====================================
  9. //= eAthena 0.1+; RO Episode 4+
  10. //===== Description: =========================================
  11. //= The Guild Manager allows the Guildmaster to invest in comerce
  12. //= and defense, hire guardians and kafras, go to the treasure room,
  13. //= and surrender the guild castle.
  14. //==============================================
  15. //= Break down of arguments used in the function:
  16. //= arg(0): name of Castle Manager
  17. //= arg(1): name of guild castle.
  18. //= arg(2): x1 coordinate for warp to treasure room
  19. //= arg(3): y1 coordinate for warp to treasure room
  20. //= arg(4): guild script suffix for kafra, gaurdian scripts etc.
  21. //===== Additional Comments: =================================
  22. //= v1.31: Added support for Emsolute Develop [celest]
  23. //= v1.2: All Guild manager scripts use this function. Optimized
  24. //= Comerce and Defense investment. [kobra_k88]
  25. //= v1.2a Function now returns to script that called it.
  26. //= Added disablenpc line to surrender castle option to remove kafra
  27. //= upon surrender.[kobra_k88]
  28. //= v1.2b U can't surrender the base during WOE [Lupus]
  29. //= v1.2c Fixed issue of guardians hp not increasing upon defense
  30. //= investment.[kobra_k88]
  31. //= v1.3 Now you can't install Guardians during WOE [Lupus]
  32. //= v1.4 Remove surrender abbility (Was 100% custom as far as I can tell) [Kayla]
  33. //= v1.41 Fixed possible Economy investment overflow with Emsolute Develop learnt [Lupus]
  34. //============================================================
  35. //==============================================
  36. function script F_GldManager {
  37. set @GID, GetCastleData(getarg(1)+".gat",1);
  38. if (strcharinfo(0) == getguildmaster(@GID)) goto L_Start;
  39. if (@GID == 0) goto L_NotOwn;
  40. if (getcharid(2) == @GID) goto L_Mem;
  41. L_NotMem:
  42. mes "[ "+getarg(0)+" ]";
  43. mes "I am here to follow ^5533FF" + getguildmaster(@GID) + "^000000's command! Hey! Your not even a part of the guild!!";
  44. mes "Where are the guardians? Destroy these intruders!";
  45. return 0;
  46. L_NotOwn:
  47. mes "[ "+getarg(0)+" ]";
  48. mes "I am waiting for my master. Brave adventurer, follow your destiny!";
  49. return 0;
  50. L_Mem:
  51. mes "[ "+getarg(0)+" ]";
  52. mes "You're not ^5533FF" + getguildmaster(@GID) + "^000000! I am here to follow ^5533FF" + getguildmaster(@GID) + "^000000's command only";
  53. return 0;
  54. L_Start:
  55. mes "[ "+getarg(0)+" ]";
  56. mes "Welcome Master ^5533FF" + getguildmaster(@GID) + "^000000 ! I will assist you in any way I can!";
  57. next;
  58. menu "Guild Base Briefing",M_Base, "Commerce Investment",M_Comrc, "Defence Investment",M_Def, "Guardian Installation",M_Gaurd,
  59. "Kafra Service 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)+".gat",2) + "^000000 points.";
  67. mes "^0000ff - You have invested " + GetCastleData(getarg(1)+".gat",4) + " times today.^000000";
  68. next;
  69. mes "[ "+getarg(0)+" ]";
  70. mes "Current Defence Investment is : ^FF3322" + GetCastleData(getarg(1)+".gat",3) + "^000000 points.";
  71. mes "^0000ff- You have invested " + GetCastleData(getarg(1)+".gat",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)+".gat",4);
  79. set @Economy,GetCastleData(getarg(1)+".gat",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) goto L_MaxTimesC;
  92. if(@Economy >= 100) goto L_MaxInvestC;
  93. mes "If you improve your Commerce Investment, the guild's productive power increases to produce more goods.";
  94. mes "So an investment will be required if you're considering future growth.";
  95. next;
  96. mes "[ "+getarg(0)+" ]";
  97. if(@TriggerE == 0) mes "You can invest up to two times a day, but the second time costs more";
  98. if(@TriggerE == 0) mes "The needed investment amount is ^5533FF" + @eco_invest + "^000000 zeny.";
  99. if(@TriggerE == 1) set @eco_invest,@eco_invest*4;
  100. if(@TriggerE == 1) mes "You've already invested once today, but you can invest again at ^5533FF" + @eco_invest + "^000000 Zeny.";
  101. next;
  102. mes "[ "+getarg(0)+" ]";
  103. mes "Would you like to invest?";
  104. next;
  105. menu "Invest Commerce.",-,"Cancel.",M_End;
  106. if(Zeny < @eco_invest) goto sL_NoZenyC;
  107. set Zeny,Zeny-@eco_invest;
  108. SetCastleData getarg(1)+".gat",4,@TriggerE+1;
  109. // if we learnt Emsolute Develop there's 50% chance to get +1 investment again
  110. SetCastleData getarg(1)+".gat",2,@Economy + 1 + (getgdskilllv(@GID,10014)>0 && rand(100)>50 && @Economy<99);
  111. mes "[ "+getarg(0)+" ]";
  112. mes "You have invested successfully.";
  113. return 0;
  114. sL_NoZenyC:
  115. mes "[ "+getarg(0)+" ]";
  116. mes "Master, you do not have enough money to invest. Investment has been cancelled.";
  117. return 0;
  118. L_MaxTimesC:
  119. 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.";
  120. return 0;
  121. L_MaxInvestC:
  122. mes "[ "+getarg(0)+" ]";
  123. mes " ";
  124. mes "^ff0000This Castle's commerce investment is already maxed at 100 points. You don't have to invest any further.^000000";
  125. return 0;
  126. //=========================
  127. M_Def:
  128. //========
  129. set @TriggerD,GetCastleData(getarg(1)+".gat",5);
  130. set @Defence,GetCastleData(getarg(1)+".gat",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) goto L_MaxTimesD;
  143. if(@Defence >= 100) goto L_MaxInvestD;
  144. mes "If you improve investment of defence, the durability of our Guardians and the Emperium will increase.";
  145. mes "So if you consider our future battles, an investment will be required.";
  146. next;
  147. mes "[ "+getarg(0)+" ]";
  148. if(@TriggerD == 0) mes "You can invest up to two times a day, but the second time costs more";
  149. if(@TriggerD == 0) mes "The needed investment amount is ^5533FF" + @def_invest + "^000000 zeny.";
  150. if(@TriggerD == 1) set @def_invest,@def_invest*4;
  151. if(@TriggerD == 1) mes "You've already invested once today, but you can invest again at ^5533FF" + @def_invest + "^000000 Zeny.";
  152. next;
  153. mes "[ "+getarg(0)+" ]";
  154. mes "Would you like to invest?";
  155. next;
  156. menu "Invest Defence.",-, "Cancel",M_End;
  157. if(Zeny < @def_invest) goto sL_NoZenyD;
  158. set Zeny,Zeny-@def_invest;
  159. SetCastleData getarg(1)+".gat",5,@TriggerD+1;
  160. SetCastleData getarg(1)+".gat",3,@Defence+1;
  161. // set new hp values for guardians
  162. set @Defence, @Defence + 1;
  163. set @AGuardian, 28634 + (@Defence*2000);
  164. set @KGuardian, 30214 + (@Defence*2000);
  165. set @SGuardian, 15670 + (@Defence*2000);
  166. //set @AGuardian,strmobinfo(4,1285) + (@Defence*2000);
  167. //set @KGuardian,strmobinfo(4,1286) + (@Defence*2000);
  168. //set @SGuardian,strmobinfo(4,1287) + (@Defence*2000);
  169. if (GetCastleData(getarg(1)+".gat",10) == 1) SetCastleData getarg(1)+".gat",18,@SGuardian;
  170. if (GetCastleData(getarg(1)+".gat",11) == 1) SetCastleData getarg(1)+".gat",19,@SGuardian;
  171. if (GetCastleData(getarg(1)+".gat",12) == 1) SetCastleData getarg(1)+".gat",20,@SGuardian;
  172. if (GetCastleData(getarg(1)+".gat",13) == 1) SetCastleData getarg(1)+".gat",21,@AGuardian;
  173. if (GetCastleData(getarg(1)+".gat",14) == 1) SetCastleData getarg(1)+".gat",22,@AGuardian;
  174. if (GetCastleData(getarg(1)+".gat",15) == 1) SetCastleData getarg(1)+".gat",23,@KGuardian;
  175. if (GetCastleData(getarg(1)+".gat",16) == 1) SetCastleData getarg(1)+".gat",24,@KGuardian;
  176. if (GetCastleData(getarg(1)+".gat",17) == 1) SetCastleData getarg(1)+".gat",25,@KGuardian;
  177. mes "[ "+getarg(0)+" ]";
  178. mes "You have invested successfully.";
  179. return 0;
  180. sL_NoZenyD:
  181. mes "[ "+getarg(0)+" ]";
  182. mes "Master, you do not have enough money to invest in Defence. Defence investment has been cancelled.";
  183. return 0;
  184. L_MaxTimesD:
  185. 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.";
  186. return 0;
  187. L_MaxInvestD:
  188. mes "^ff0000This Castle's Defence Investment is already maxed at 100 points. You don't have to invest any further.^000000";
  189. return 0;
  190. //=========================
  191. M_Gaurd:
  192. //=========
  193. if (getgdskilllv(@GID,10002) == 0) goto L_NoSkGuard;
  194. set @Defence,GetCastleData(getarg(1)+".gat",3);
  195. set @Guardian0,guardianinfo(0);
  196. set @Guardian1,guardianinfo(1);
  197. set @Guardian2,guardianinfo(2);
  198. set @Guardian3,guardianinfo(3);
  199. set @Guardian4,guardianinfo(4);
  200. set @Guardian5,guardianinfo(5);
  201. set @Guardian6,guardianinfo(6);
  202. set @Guardian7,guardianinfo(7);
  203. set @AGuardian, 28634 + (@Defence*2000);
  204. set @KGuardian, 30214 + (@Defence*2000);
  205. set @SGuardian, 15670 + (@Defence*2000);
  206. //set @AGuardian,strmobinfo(4,1285) + (@Defence*2000);
  207. //set @KGuardian,strmobinfo(4,1286) + (@Defence*2000);
  208. //set @SGuardian,strmobinfo(4,1287) + (@Defence*2000);
  209. mes "[ "+getarg(0)+" ]";
  210. if(agitcheck(0) != 0) goto L_CantGuard;
  211. mes "Would you like to install a guardian? Guardians will protect the guild base from enemies.";
  212. mes "Please choose a guardian.";
  213. next;
  214. menu "Soldier Guardian (" + @Guardian0 + "/" + @SGuardian + ")",L4_1,
  215. "Soldier Guardian (" + @Guardian1 + "/" + @SGuardian + ")",L4_2,
  216. "Soldier Guardian (" + @Guardian2 + "/" + @SGuardian + ")",L4_3,
  217. "Archer Guardian (" + @Guardian3 + "/" + @AGuardian + ")",L4_4,
  218. "Archer Guardian (" + @Guardian4 + "/" + @AGuardian + ")",L4_5,
  219. "Knight Guardian (" + @Guardian5 + "/" + @KGuardian + ")",L4_6,
  220. "Knight Guardian (" + @Guardian6 + "/" + @KGuardian + ")",L4_7,
  221. "Knight Guardian (" + @Guardian7 + "/" + @KGuardian + ")",L4_8;
  222. L4_1:
  223. if (GetCastleData(getarg(1)+".gat",10) == 1) goto L_GotGuard;
  224. set @GDnum,10;
  225. set @GDnum2,18;
  226. set @GuardianHP,@SGuardian;
  227. goto L4_9;
  228. L4_2:
  229. if (GetCastleData(getarg(1)+".gat",11) == 1) goto L_GotGuard;
  230. set @GDnum,11;
  231. set @GDnum2,19;
  232. set @GuardianHP,@SGuardian;
  233. goto L4_9;
  234. L4_3:
  235. if (GetCastleData(getarg(1)+".gat",12) == 1) goto L_GotGuard;
  236. set @GDnum,12;
  237. set @GDnum2,20;
  238. set @GuardianHP,@SGuardian;
  239. goto L4_9;
  240. L4_4:
  241. if (GetCastleData(getarg(1)+".gat",13) == 1) goto L_GotGuard;
  242. set @GDnum,13;
  243. set @GDnum2,21;
  244. set @GuardianHP,@AGuardian;
  245. goto L4_9;
  246. L4_5:
  247. if (GetCastleData(getarg(1)+".gat",14) == 1) goto L_GotGuard;
  248. set @GDnum,14;
  249. set @GDnum2,22;
  250. set @GuardianHP,@AGuardian;
  251. goto L4_9;
  252. L4_6:
  253. if (GetCastleData(getarg(1)+".gat",15) == 1) goto L_GotGuard;
  254. set @GDnum,15;
  255. set @GDnum2,23;
  256. set @GuardianHP,@KGuardian;
  257. goto L4_9;
  258. L4_7:
  259. if (GetCastleData(getarg(1)+".gat",16) == 1) goto L_GotGuard;
  260. set @GDnum,16;
  261. set @GDnum2,24;
  262. set @GuardianHP,@KGuardian;
  263. goto L4_9;
  264. L4_8:
  265. if (GetCastleData(getarg(1)+".gat",17) == 1) goto L_GotGuard;
  266. set @GDnum,17;
  267. set @GDnum2,25;
  268. set @GuardianHP,@KGuardian;
  269. L4_9:
  270. mes "[ "+getarg(0)+" ]";
  271. mes "Would you really like to install a guardian? You need ^5533FF10,000 zeny^000000 to install one....";
  272. next;
  273. menu "Install",-, "Cancel",M_End;
  274. if (Zeny < 10000) goto sL_NoZenyG;
  275. set Zeny,Zeny-10000;
  276. SetCastleData getarg(1)+".gat",@GDnum,1;
  277. SetCastleData getarg(1)+".gat",@GDnum2,@GuardianHP;
  278. return 1;
  279. sL_NoZenyG:
  280. mes "[ "+getarg(0)+" ]";
  281. mes "I'm sorry Master, but you do not have enough zeny for a Guardian.";
  282. return 0;
  283. L_NoSkGuard:
  284. mes "[ "+getarg(0)+" ]";
  285. mes "I'm sorry Master but you cannot install any guardians right now. Your guild must learn the Guild skill ^5533FFGuardian Research^000000 first.";
  286. mes "Guardian Installation has been cancelled.";
  287. return 0;
  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) goto L_NoSkKaf;
  303. L_Hire:
  304. mes "Would you like to employ the services of a Kafra? You will need ^5533FF10,000 Zeny^000000 to do so... ";
  305. next;
  306. menu "Employ Kafra.",-,"Cancel",sM_KafEnd;
  307. mes "[ "+getarg(0)+" ]";
  308. if (Zeny < 10000) goto sL_NoZenyK;
  309. set Zeny,Zeny-10000;
  310. enablenpc "Kafra Service#"+getarg(4);
  311. SetCastleData getarg(1)+".gat",9,1;
  312. mes "You have created a contract with the Kafra Service Company.";
  313. next;
  314. cutin "kafra_01",2;
  315. mes "[ Kafra Service ]";
  316. mes "How do you do? I'm here to provide you with helpful service! I'll do the best I can to serve you.";
  317. next;
  318. cutin "kafra_01",255;
  319. mes "[ "+getarg(0)+" ]";
  320. //mes "Your employment contract lasts ^5533FF1 month^000000. After this term is over you will have to create a new contract.";
  321. mes "I think the Kafra Service will benefit our guild members.";
  322. return 0;
  323. sL_NoZenyK:
  324. mes "Master, you do not have enough money to employ a Kafra. Employment has been cancelled.";
  325. return 0;
  326. sM_KafEnd:
  327. mes "[ "+getarg(0)+" ]";
  328. mes "As you wish Master. But I suggest we get a Kafra as soon as possible!";
  329. return 0;
  330. L_Dismiss:
  331. mes "Would you like to dismiss the current Kafra?";
  332. next;
  333. menu "Dismissal",-,"Cancel",sM_KafEnd2;
  334. cutin "kafra_01",2;
  335. mes "[ Kafra Service ]";
  336. mes "Have I done anything wrong? If I did, will you please forgive me?";
  337. next;
  338. menu "Dismiss",-,"Cancel",ssM_KafEnd2;
  339. mes "[ Kafra Service ]";
  340. mes "It's unfortunate that I won't be able to serve your guild anymore....";
  341. next;
  342. disablenpc "Kafra Service#"+getarg(4);
  343. SetCastleData getarg(1)+".gat",9,0;
  344. cutin "kafra_01",255;
  345. mes "[ "+getarg(0)+" ]";
  346. mes "The Kafra has been dismissed. But... we should really get a Kafra as soon as possible!";
  347. return 0;
  348. ssM_KafEnd2:
  349. mes "[ Kafra Service ]";
  350. mes "Thank you master, I'll do my best! ^^.";
  351. cutin "kafra_01",255;
  352. return 0;
  353. sM_KafEnd2:
  354. mes "[ "+getarg(0)+" ]";
  355. mes "Master, I think you should keep the current Kafra Service because she is already trying her best to serve us";
  356. return 0;
  357. L_NoSkKaf:
  358. mes "Master, you don't have a contract with the Kafra Service Company.";
  359. mes "In order to hire a Kafra, you must first learn the Guild skill ^5533FFContract With Kafra^000000.";
  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. }