gldfunc_manager.txt 17 KB

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