gldfunc_manager.txt 17 KB

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