agit_main.txt 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350
  1. //===== rAthena Script =======================================
  2. //= War of Emperium Guild Template File
  3. //===== By: ==================================================
  4. //= L0ne_W0lf
  5. //===== Current Version: =====================================
  6. //= 1.9
  7. //===== Compatible With: =====================================
  8. //= rAthena SVN
  9. //===== Description: =========================================
  10. //= [ Aegis Conversion]
  11. //= ----------------------------------------------------------
  12. //= - THIS FILE IS REQUIRED FOR GUILD CASTLES TO FUNCTION.
  13. //= ----------------------------------------------------------
  14. //= - Enables AGIT Manager inside Guild Strongholds.
  15. //= Visible Name required: Agit
  16. //= Manages the various functions used in and out of WoE.
  17. //=
  18. //= - Enables Stewards inside Guild Strongholds which let's
  19. //= the guild master invest in Defense and Economy, and
  20. //= to summon guardians, a Kafra, and enter master's room.
  21. //=
  22. //= - Guardian Spawning Template
  23. //= Visible Name required: Guardian
  24. //= Spawn guardians when guild castle data is recieved.
  25. //=
  26. //= - Enables Kafra Services inside Guild Strongholds.
  27. //= Visible Name required: Kafra Employee
  28. //= Storage, Guild Storage, Teleport Service, Cart rental.
  29. //=
  30. //= - Treasure Chest spawning.
  31. //= Chests will NOT be saved anymore in the event of crashes.
  32. //= Treasures will NOT spawn on a location that already has
  33. //= treasure chest spawned.
  34. //===== Additional Comments: =================================
  35. //= 1.0 First Version. No longer uses functions. [L0ne_W0lf]
  36. //= 1.1 Daily investement will now be reset. [L0ne_W0lf]
  37. //= Template will no longer try to spawn chests.
  38. //= 1.2 Fixed Eco Invest option charging twice. [L0ne_W0lf]
  39. //= 1.3 Fixed a loading flag emblem for Payon 1. [L0ne_W0lf]
  40. //= Fixed two typos regarding Guild Steward name.
  41. //= 1.4 Fixed a typo in defense investment. [L0ne_W0lf]
  42. //= 1.5 Fixed spawn point of the emperium in Payon 1. [L0ne_W0lf]
  43. //= Double-investing doubles the price now.
  44. //= 1.6 Corrected Zeny check when summoning guardians. [L0ne_W0lf]
  45. //= Corrected cost for investing, thanks to Ai4rei.
  46. //= Second invest is now quadruple the value of the first
  47. //= Investing now happens at the turn of the day.
  48. //= 1.6a Corrected conditions in the new investing blocks. [L0ne_W0lf]
  49. //= 1.6b Moved where investments are added to eco/def. [L0ne_W0lf]
  50. //= 1.7 Updated Agitbreak announcements, added bc_woe [L0ne_W0lf]
  51. //= and added extended anouncement format for mapannounce.
  52. //= 1.8 Fixed a possible exploit in guild castle investment. [Brian]
  53. //= 1.9 Partially rewrote Script. [Masao]
  54. //============================================================
  55. // WoE : Main Functions
  56. //============================================================
  57. - script Gld_Agit_Manager::Gld_Agit_Manager -1,{
  58. end;
  59. // War of Emperium has started.
  60. OnAgitStart:
  61. if (strnpcinfo(0) == "Gld_Agit_Manager") end;
  62. MapRespawnGuildID strnpcinfo(2),GetCastleData(strnpcinfo(2),1),6;
  63. GvgOn strnpcinfo(2);
  64. // Spawn (fall through), or respawn the Emperium once it has been broken.
  65. OnStartArena:
  66. // OnAgitStart will fall through and spawn the Emperium.
  67. if (strnpcinfo(2) == "aldeg_cas01") { setarray .@emproom[0],216,23; }
  68. else if (strnpcinfo(2) == "aldeg_cas02") { setarray .@emproom[0],213,23; }
  69. else if (strnpcinfo(2) == "aldeg_cas03") { setarray .@emproom[0],205,31; }
  70. else if (strnpcinfo(2) == "aldeg_cas04") { setarray .@emproom[0],36,217; }
  71. else if (strnpcinfo(2) == "aldeg_cas05") { setarray .@emproom[0],27,101; }
  72. else if (strnpcinfo(2) == "gefg_cas01") { setarray .@emproom[0],197,181; }
  73. else if (strnpcinfo(2) == "gefg_cas02") { setarray .@emproom[0],176,178; }
  74. else if (strnpcinfo(2) == "gefg_cas03") { setarray .@emproom[0],244,166; }
  75. else if (strnpcinfo(2) == "gefg_cas04") { setarray .@emproom[0],174,177; }
  76. else if (strnpcinfo(2) == "gefg_cas05") { setarray .@emproom[0],194,184; }
  77. else if (strnpcinfo(2) == "payg_cas01") { setarray .@emproom[0],139,139; }
  78. else if (strnpcinfo(2) == "payg_cas02") { setarray .@emproom[0],38,25; }
  79. else if (strnpcinfo(2) == "payg_cas03") { setarray .@emproom[0],269,265; }
  80. else if (strnpcinfo(2) == "payg_cas04") { setarray .@emproom[0],270,28; }
  81. else if (strnpcinfo(2) == "payg_cas05") { setarray .@emproom[0],30,30; }
  82. else if (strnpcinfo(2) == "prtg_cas01") { setarray .@emproom[0],197,197; }
  83. else if (strnpcinfo(2) == "prtg_cas02") { setarray .@emproom[0],157,174; }
  84. else if (strnpcinfo(2) == "prtg_cas03") { setarray .@emproom[0],16,220; }
  85. else if (strnpcinfo(2) == "prtg_cas04") { setarray .@emproom[0],291,14; }
  86. else if (strnpcinfo(2) == "prtg_cas05") { setarray .@emproom[0],266,266; }
  87. // Add custom Guild Castles here.
  88. else {
  89. end;
  90. }
  91. if (!mobcount(strnpcinfo(2),"Agit#"+strnpcinfo(2)+"::OnAgitBreak")) {
  92. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Emperium",1288,1,"Agit#"+strnpcinfo(2)+"::OnAgitBreak";
  93. }
  94. end;
  95. // The Emperium has been broken.
  96. OnAgitBreak:
  97. set .@GID,getcharid(2);
  98. // Show and log error if an unguilded player breaks the Emperium. (Should NEVER happen)
  99. if (.@GID <= 0) {
  100. set .@notice$,"Character "+strcharinfo(0)+" ("+getcharid(0)+") broke the Emperium in Castle: "+strnpcinfo(2)+" while guildless. No data will be saved and Emperium respawned.";
  101. logmes .@notice$; debugmes .@notice$;
  102. donpcevent "Agit#"+strnpcinfo(2)+"::OnStartArena";
  103. end;
  104. }
  105. // Adjust Economy Invest Level for Castle
  106. set .@Economy,GetCastleData(strnpcinfo(2),2) - 5;
  107. if (.@Economy < 0) set .@Economy, 0;
  108. SetCastleData strnpcinfo(2), 2, .@Economy;
  109. // Adjust Defense Invest Level for Castle
  110. set .@Defence,GetCastleData(strnpcinfo(2),3) - 5;
  111. if (.@Defence < 0) set .@Defence, 0;
  112. SetCastleData strnpcinfo(2), 3, .@Defence;
  113. // Set new Castle Occupant
  114. SetCastleData strnpcinfo(2),1, .@GID;
  115. // Announce that the Emperium is destroyed, and respawn all but new castle-occupants.
  116. mapannounce strnpcinfo(2),"The emperium has been destroyed.",bc_map|bc_woe,"0x00CCFF",FW_NORMAL,12;
  117. MapRespawnGuildID strnpcinfo(2),.@GID,6;
  118. // Refresh castle data, disable Kafra and reset Invest information.
  119. donpcevent strnpcinfo(0)+"::OnRecvCastle";
  120. disablenpc "Kafra Staff#"+strnpcinfo(2);
  121. for( set .@i, 4; .@i <= 9; set .@i, .@i+1 ) {
  122. SetCastleData strnpcinfo(2), .@i, 0;
  123. }
  124. // Erase Guardian Database information if the new owners do not have Guardian Research.
  125. if( getgdskilllv(.@GID,10002) == 0 ) {
  126. for( set .@i, 10; .@i <= 17; set .@i, .@i+1 ) {
  127. SetCastleData strnpcinfo(2), .@i, 0;
  128. }
  129. }
  130. // Respawn the Emperium, and display new owners.
  131. sleep 500; // Slow down script execution slightly.
  132. if( agitcheck() )
  133. donpcevent "Agit#"+strnpcinfo(2)+"::OnStartArena";
  134. sleep 7000;
  135. announce "The [" + getcastlename(strnpcinfo(2)) + "] castle has been conquered by the [" + getguildName(.@GID) + "] guild.",bc_all|bc_woe;
  136. end;
  137. // War of Emperium has ended.
  138. OnAgitEnd:
  139. if (strnpcinfo(0) == "Gld_Agit_Manager") end;
  140. GvgOff strnpcinfo(2);
  141. // If the castle has no owner at the end of WoE, do not kill Emperium.
  142. if (GetCastleData(strnpcinfo(2),1)) {
  143. KillMonster strnpcinfo(2),"Agit#"+strnpcinfo(2)+"::OnAgitBreak";
  144. }
  145. end;
  146. // Occupying Guild has been disbanded.
  147. OnGuildBreak:
  148. if (strnpcinfo(0) == "Gld_Agit_Manager") end;
  149. // Kill guardians, disable the Kafra, and set owner to 0.
  150. killmonster strnpcinfo(2),"Guardian#"+strnpcinfo(2)+"::OnGuardianDied";
  151. disablenpc "Kafra Staff#"+strnpcinfo(2);
  152. SetCastleData strnpcinfo(2),0,0;
  153. // Wait before refreshing guild information.
  154. sleep 7000;
  155. Announce "Guild Base [" + GetCastleName(strnpcinfo(2)) + "] has been abandoned.",0;
  156. donpcevent strnpcinfo(0)+"::OnRecvCastle";
  157. end;
  158. OnAgitInit:
  159. OnRecvCastle:
  160. if (strnpcinfo(0) == "Gld_Agit_Manager") end;
  161. // Spawn Monsters if the castle is empty.
  162. set .@GID, GetCastleData(strnpcinfo(2),1);
  163. if (.@GID == 0) {
  164. killmonsterall strnpcinfo(2);
  165. if (compare(strnpcinfo(2),"aldeg")) {
  166. // Normal Spawns
  167. monster strnpcinfo(2),0,0,"Evil Druid",1117,10;
  168. monster strnpcinfo(2),0,0,"Khalitzburg",1132,4;
  169. monster strnpcinfo(2),0,0,"Abysmal Knight",1219,2;
  170. monster strnpcinfo(2),0,0,"Executioner",1205,1;
  171. monster strnpcinfo(2),0,0,"Penomena",1216,10;
  172. monster strnpcinfo(2),0,0,"Alarm",1193,18;
  173. monster strnpcinfo(2),0,0,"Clock",1269,9;
  174. monster strnpcinfo(2),0,0,"Raydric Archer",1276,7;
  175. monster strnpcinfo(2),0,0,"Wanderer",1208,3;
  176. monster strnpcinfo(2),0,0,"Alice",1275,1;
  177. monster strnpcinfo(2),0,0,"Bloody Knight",1268,1;
  178. monster strnpcinfo(2),0,0,"Dark Lord",1272,1;
  179. // Set Emperium room spawn coordinates and spawn monsters.
  180. if (strnpcinfo(2) == "aldeg_cas01") { setarray .@emproom[0],216,23; }
  181. else if (strnpcinfo(2) == "aldeg_cas02") { setarray .@emproom[0],213,23; }
  182. else if (strnpcinfo(2) == "aldeg_cas03") { setarray .@emproom[0],205,31; }
  183. else if (strnpcinfo(2) == "aldeg_cas04") { setarray .@emproom[0],36,217; }
  184. else if (strnpcinfo(2) == "aldeg_cas05") { setarray .@emproom[0],27,101; }
  185. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Dark Lord",1272,1;
  186. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Tower Keeper",1270,4;
  187. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Bloody Knight",1268,1;
  188. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Abysmal Knight",1219,1;
  189. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Raydric Archer",1276,5;
  190. }
  191. else if (compare(strnpcinfo(2),"gefg")) {
  192. // Normal Spawns
  193. monster strnpcinfo(2),0,0,"Evil Druid",1117,10;
  194. monster strnpcinfo(2),0,0,"Wind Ghost",1263,11;
  195. monster strnpcinfo(2),0,0,"Bathory",1102,10;
  196. monster strnpcinfo(2),0,0,"Jakk",1130,10;
  197. monster strnpcinfo(2),0,0,"Marduk",1140,20;
  198. monster strnpcinfo(2),0,0,"Raydric",1163,9;
  199. monster strnpcinfo(2),0,0,"Alice",1275,1;
  200. monster strnpcinfo(2),0,0,"Abysmal Knight",1219,1;
  201. monster strnpcinfo(2),0,0,"Moonlight Flower",1150,1;
  202. monster strnpcinfo(2),0,0,"Phreeoni",1159,1;
  203. // Set Emperium room spawn coordinates and spawn monsters.
  204. if (strnpcinfo(2) == "gefg_cas01") { setarray .@emproom[0],197,181; }
  205. else if (strnpcinfo(2) == "gefg_cas02") { setarray .@emproom[0],176,178; }
  206. else if (strnpcinfo(2) == "gefg_cas03") { setarray .@emproom[0],244,166; }
  207. else if (strnpcinfo(2) == "gefg_cas04") { setarray .@emproom[0],174,177; }
  208. else if (strnpcinfo(2) == "gefg_cas05") { setarray .@emproom[0],194,184; }
  209. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Mysteltainn",1203,1;
  210. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Orc Hero",1087,1;
  211. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"High Orc",1213,10;
  212. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Orc Archer",1189,10;
  213. }
  214. else if (compare(strnpcinfo(2),"payg")) {
  215. // Normal Spawns
  216. monster strnpcinfo(2),0,0,"Greatest General",1277,9;
  217. monster strnpcinfo(2),0,0,"Wanderer",1208,10;
  218. monster strnpcinfo(2),0,0,"Mutant Dragonoid",1262,5;
  219. monster strnpcinfo(2),0,0,"Bathory",1102,5;
  220. monster strnpcinfo(2),0,0,"Moonlight Flower",1150,1;
  221. monster strnpcinfo(2),0,0,"Eddga",1115,1;
  222. monster strnpcinfo(2),0,0,"Horong",1129,11;
  223. monster strnpcinfo(2),0,0,"Raydric Archer",1276,5;
  224. monster strnpcinfo(2),0,0,"Kobold Archer",1282,4;
  225. monster strnpcinfo(2),0,0,"Gargoyle",1253,5;
  226. // Set Emperium room spawn coordinates and spawn monsters.
  227. if (strnpcinfo(2) == "payg_cas01") { setarray .@emproom[0],139,139; }
  228. else if (strnpcinfo(2) == "payg_cas02") { setarray .@emproom[0],38,25; }
  229. else if (strnpcinfo(2) == "payg_cas03") { setarray .@emproom[0],269,265; }
  230. else if (strnpcinfo(2) == "payg_cas04") { setarray .@emproom[0],270,28; }
  231. else if (strnpcinfo(2) == "payg_cas05") { setarray .@emproom[0],30,30; }
  232. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Moonlight Flower",1150,1;
  233. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Eddga",1115,1;
  234. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Wanderer",1208,6;
  235. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Raydric Archer",1276,5;
  236. }
  237. else if (compare(strnpcinfo(2),"prtg")) {
  238. // Normal Spawns
  239. monster strnpcinfo(2),0,0,"Raydric",1163,1;
  240. monster strnpcinfo(2),0,0,"Khalitzburg",1132,10;
  241. monster strnpcinfo(2),0,0,"Abysmal Knight",1219,5;
  242. monster strnpcinfo(2),0,0,"Bloody Knight",1268,5;
  243. monster strnpcinfo(2),0,0,"Stormy Knight",1251,1;
  244. monster strnpcinfo(2),0,0,"Hatii",1252,1;
  245. monster strnpcinfo(2),0,0,"Raydric Archer",1276,5;
  246. monster strnpcinfo(2),0,0,"Gryphon",1259,2;
  247. monster strnpcinfo(2),0,0,"Chimera",1283,3;
  248. monster strnpcinfo(2),0,0,"Alice",1275,1;
  249. monster strnpcinfo(2),0,0,"Zealotus",1200,1;
  250. // Set Emperium room spawn coordinates and spawn monsters.
  251. if (strnpcinfo(2) == "prtg_cas01") { setarray .@emproom[0],197,197; }
  252. else if (strnpcinfo(2) == "prtg_cas02") { setarray .@emproom[0],157,174; }
  253. else if (strnpcinfo(2) == "prtg_cas03") { setarray .@emproom[0],16,220; }
  254. else if (strnpcinfo(2) == "prtg_cas04") { setarray .@emproom[0],291,14; }
  255. else if (strnpcinfo(2) == "prtg_cas05") { setarray .@emproom[0],266,266; }
  256. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Guardian Knight",1268,1;
  257. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Guardian Master",1251,1;
  258. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Hatii",1252,1;
  259. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Guardian Knight",1219,1;
  260. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Raydric Archer",1276,5;
  261. }
  262. // Add custom Guild Castles here.
  263. else {
  264. end;
  265. }
  266. donpcevent "Agit#"+strnpcinfo(2)+"::OnStartArena";
  267. // Disable Kafra Staff...
  268. disablenpc "Kafra Staff#"+strnpcinfo(2);
  269. end;
  270. }
  271. else {
  272. OnInterIfInitOnce:
  273. // Otherwise place the guild emblem on flags.
  274. if (strnpcinfo(2) == "aldeg_cas01") { donpcevent "::OnRecvCastleA01"; }
  275. else if (strnpcinfo(2) == "aldeg_cas02") { donpcevent "::OnRecvCastleA02"; }
  276. else if (strnpcinfo(2) == "aldeg_cas03") { donpcevent "::OnRecvCastleA03"; }
  277. else if (strnpcinfo(2) == "aldeg_cas04") { donpcevent "::OnRecvCastleA04"; }
  278. else if (strnpcinfo(2) == "aldeg_cas05") { donpcevent "::OnRecvCastleA05"; }
  279. else if (strnpcinfo(2) == "gefg_cas01") { donpcevent "::OnRecvCastleG01"; }
  280. else if (strnpcinfo(2) == "gefg_cas02") { donpcevent "::OnRecvCastleG02"; }
  281. else if (strnpcinfo(2) == "gefg_cas03") { donpcevent "::OnRecvCastleG03"; }
  282. else if (strnpcinfo(2) == "gefg_cas04") { donpcevent "::OnRecvCastleG04"; }
  283. else if (strnpcinfo(2) == "gefg_cas05") { donpcevent "::OnRecvCastleG05"; }
  284. else if (strnpcinfo(2) == "payg_cas01") { donpcevent "::OnRecvCastlePy01"; }
  285. else if (strnpcinfo(2) == "payg_cas02") { donpcevent "::OnRecvCastlePy02"; }
  286. else if (strnpcinfo(2) == "payg_cas03") { donpcevent "::OnRecvCastlePy03"; }
  287. else if (strnpcinfo(2) == "payg_cas04") { donpcevent "::OnRecvCastlePy04"; }
  288. else if (strnpcinfo(2) == "payg_cas05") { donpcevent "::OnRecvCastlePy05"; }
  289. else if (strnpcinfo(2) == "prtg_cas01") { donpcevent "::OnRecvCastlePt01"; }
  290. else if (strnpcinfo(2) == "prtg_cas02") { donpcevent "::OnRecvCastlePt02"; }
  291. else if (strnpcinfo(2) == "prtg_cas03") { donpcevent "::OnRecvCastlePt03"; }
  292. else if (strnpcinfo(2) == "prtg_cas04") { donpcevent "::OnRecvCastlePt04"; }
  293. else if (strnpcinfo(2) == "prtg_cas05") { donpcevent "::OnRecvCastlePt05"; }
  294. // Add custom Guild Castles here.
  295. else {
  296. end;
  297. }
  298. // And load purchased Guardian in castles.
  299. donpcevent "Guardian#"+strnpcinfo(2)+"::OnSpawnGuardians";
  300. // And display Kafra if purchased.
  301. if (GetCastleData(strnpcinfo(2),9) < 1) disablenpc "Kafra Staff#"+strnpcinfo(2);
  302. }
  303. end;
  304. }
  305. // WoE : Guild Kafras
  306. //============================================================
  307. - script Kafra Staff#woe::guildkafra -1,{
  308. set .@GID,GetCastleData(strnpcinfo(2),1);
  309. if (compare(strnpcinfo(2),"aldeg")) {
  310. setarray .@destination$[0],"Al De Baran","aldebaran";
  311. setarray .@coordinates[0],132,103;
  312. }
  313. else if (compare(strnpcinfo(2),"gefg")) {
  314. setarray .@destination$[0],"Geffen","geffen";
  315. setarray .@coordinates[0],120,39;
  316. }
  317. else if (compare(strnpcinfo(2),"payg")) {
  318. setarray .@destination$[0],"Payon","payon";
  319. setarray .@coordinates[0],70,100;
  320. }
  321. else if (compare(strnpcinfo(2),"prtg")) {
  322. setarray .@destination$[0],"Prontera","prontera";
  323. setarray .@coordinates[0],278,211;
  324. }
  325. // Add custom Guild Castles here.
  326. else {
  327. end;
  328. }
  329. cutin "kafra_01",2;
  330. if (getcharid(2) == .@GID) {
  331. mes "[Kafra Employee]";
  332. mes "Welcome. ^ff0000" + GetGuildName(.@GID) + "^000000 Member.";
  333. mes "The Kafra Corporation will stay with you wherever you go.";
  334. next;
  335. switch (select("Use Storage:Use Teleport Service:Rent a Pushcart:Cancel")) {
  336. case 1:
  337. if (getskilllv("NV_BASIC") < 6) {
  338. mes "[Kafra Employee]";
  339. mes "I'm sorry, but you";
  340. mes "need the Novice's";
  341. mes "Basic Skill Level 6 to";
  342. mes "use the Storage Service.";
  343. close2;
  344. cutin "",255;
  345. end;
  346. }
  347. mes "[Kafra Employee]";
  348. mes "Here, let me open";
  349. mes "your Storage for you.";
  350. mes "Thank you for using";
  351. mes "the Kafra Service.";
  352. close2;
  353. cutin "",255;
  354. openstorage;
  355. end;
  356. case 2:
  357. mes "[Kafra Employee]";
  358. mes "Please choose";
  359. mes "your destination.";
  360. next;
  361. switch (select(.@destination$+" -> 200z:Cancel")) {
  362. case 1:
  363. if (Zeny < 200) {
  364. mes "[Kafra Employee]";
  365. mes "I'm sorry, but you don't have";
  366. mes "enough zeny for the Teleport";
  367. mes "Service. The fee to teleport";
  368. mes "to "+.@destination$+" is 200 zeny.";
  369. close2;
  370. cutin "",255;
  371. end;
  372. }
  373. set Zeny, Zeny - 200;
  374. set RESRVPTS,RESRVPTS+2;
  375. close2;
  376. warp .@destination$[1],.@coordinates[0],.@coordinates[1];
  377. end;
  378. case 2:
  379. close2;
  380. cutin "",255;
  381. end;
  382. }
  383. case 3:
  384. if (BaseClass != Job_Merchant) {
  385. mes "[Kafra Employee]";
  386. mes "I'm sorry, but the";
  387. mes "Pushcart rental service";
  388. mes "is only available to Merchants,";
  389. mes "Blacksmiths, Master Smiths,";
  390. mes "Alchemists, Biochemists,";
  391. mes "Mechanics and Geneticists.";
  392. close2;
  393. cutin "",255;
  394. end;
  395. }
  396. if (checkcart()) {
  397. mes "[Kafra Employee]";
  398. mes "You already have";
  399. mes "a Pushcart equipped.";
  400. mes "Unfortunately, we can't";
  401. mes "rent more than one to";
  402. mes "each customer at a time.";
  403. close2;
  404. cutin "",255;
  405. end;
  406. }
  407. mes "[Kafra Employee]";
  408. mes "The Pushcart rental";
  409. mes "fee is 800 zeny. Would";
  410. mes "you like to rent a Pushcart?";
  411. next;
  412. switch (select("Rent a Pushcart.:Cancel")) {
  413. case 1:
  414. if (Zeny < 800) {
  415. mes "[Kafra Employee]";
  416. mes "I'm sorry, but you";
  417. mes "don't have enough";
  418. mes "zeny to pay the Pushcart";
  419. mes "rental fee of 800 zeny.";
  420. close2;
  421. cutin "",255;
  422. end;
  423. }
  424. set RESRVPTS,RESRVPTS+8;
  425. set Zeny, Zeny - 800;
  426. setcart;
  427. close2;
  428. cutin "",255;
  429. end;
  430. case 2:
  431. close2;
  432. cutin "",255;
  433. end;
  434. }
  435. case 4:
  436. mes "[Kafra Employee]";
  437. mes "We, here at Kafra Corporation,";
  438. mes "are always endeavoring to provide you with the best services. We hope that we meet your adventuring needs and standards of excellence.";
  439. close2;
  440. cutin "",255;
  441. end;
  442. }
  443. }
  444. mes "[Kafra Employee]";
  445. mes "I am instructed to only offer my services to the ^ff0000"+GetGuildName(.@GID)+"^000000 Guild. Please try another Kafra Employee around here. Sorry for the inconvenience.";
  446. close2;
  447. cutin "",255;
  448. end;
  449. }
  450. // WoE : Castle Managers
  451. //============================================================
  452. - script Castle Manager#cm::cm -1,{
  453. set .@GID,GetCastleData(strnpcinfo(2),1);
  454. // .@guardiantype = Defines the types of guardians per castle basis.
  455. // 1 - Soldier Guardian, 2 - Archer Guardian, 3 - Knight Guardian
  456. // .@guardianposx = Define the x spawn point for each uardian.
  457. // [0] = 1st guardian's x spawn point.
  458. // .@guardianposy = Define the y spawn point for each guardian.
  459. // [0] = 1st guardian's y spawn point.
  460. // .@masterroom = Defines the coordinates of the Treasure Room.
  461. if (strnpcinfo(2) == "aldeg_cas01") {
  462. setarray .@guardiantype[0],1,2,2,2,2,3,3,3;
  463. setarray .@guardianposx[0],17,39,38,45,21,218,213,73;
  464. setarray .@guardianposy[0],218,208,196,228,194,24,24,70;
  465. setarray .@masterroom[0],113,223;
  466. }
  467. else if (strnpcinfo(2) == "aldeg_cas02") {
  468. setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
  469. setarray .@guardianposx[0],27,88,117,60,51,21,36,210;
  470. setarray .@guardianposy[0],184,43,46,202,183,177,183,7;
  471. setarray .@masterroom[0],134,225;
  472. }
  473. else if (strnpcinfo(2) == "aldeg_cas03") {
  474. setarray .@guardiantype[0],3,3,1,1,1,2,2,2;
  475. setarray .@guardianposx[0],90,116,86,116,64,212,195,110;
  476. setarray .@guardianposy[0],112,112,120,76,103,160,151,217;
  477. setarray .@masterroom[0],229,267;
  478. }
  479. else if (strnpcinfo(2) == "aldeg_cas04") {
  480. setarray .@guardiantype[0],2,2,2,1,1,1,3,3;
  481. setarray .@guardianposx[0],187,192,148,145,169,198,48,55;
  482. setarray .@guardianposy[0],100,42,88,209,53,77,72,88;
  483. setarray .@masterroom[0],83,17;
  484. }
  485. else if (strnpcinfo(2) == "aldeg_cas05") {
  486. setarray .@guardiantype[0],2,2,1,1,3,3,3,3;
  487. setarray .@guardianposx[0],51,188,157,157,27,145,156,41;
  488. setarray .@guardianposy[0],202,79,192,74,221,78,73,112;
  489. setarray .@masterroom[0],64,8;
  490. }
  491. // Geffen (Britoniah) Castles
  492. else if (strnpcinfo(2) == "gefg_cas01") {
  493. setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
  494. setarray .@guardianposx[0],67,184,62,36,50,50,189,200;
  495. setarray .@guardianposy[0],179,20,41,186,186,67,41,167;
  496. setarray .@masterroom[0],152,117;
  497. }
  498. else if (strnpcinfo(2) == "gefg_cas02") {
  499. setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
  500. setarray .@guardianposx[0],64,56,166,35,20,19,166,159;
  501. setarray .@guardianposy[0],168,41,25,148,150,41,42,188;
  502. setarray .@masterroom[0],145,115;
  503. }
  504. else if (strnpcinfo(2) == "gefg_cas03") {
  505. setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
  506. setarray .@guardianposx[0],48,113,48,157,243,157,234,238;
  507. setarray .@guardianposy[0],176,214,207,62,41,45,25,160;
  508. setarray .@masterroom[0],275,289;
  509. }
  510. else if (strnpcinfo(2) == "gefg_cas04") {
  511. setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
  512. setarray .@guardianposx[0],53,31,49,29,147,57,160,148;
  513. setarray .@guardianposy[0],191,178,220,46,65,46,50,189;
  514. setarray .@masterroom[0],116,123;
  515. }
  516. else if (strnpcinfo(2) == "gefg_cas05") {
  517. setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
  518. setarray .@guardianposx[0],45,71,72,66,177,66,177,193;
  519. setarray .@guardianposy[0],149,163,142,47,50,17,35,166;
  520. setarray .@masterroom[0],149,106;
  521. }
  522. // Payon (Baulder) Castles
  523. else if (strnpcinfo(2) == "payg_cas01") {
  524. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  525. setarray .@guardianposx[0],229,225,222,99,65,36,51,138;
  526. setarray .@guardianposy[0],92,80,111,45,31,127,144,133;
  527. setarray .@masterroom[0],295,8;
  528. }
  529. else if (strnpcinfo(2) == "payg_cas02") {
  530. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  531. setarray .@guardianposx[0],237,228,210,57,42,287,264,27;
  532. setarray .@guardianposy[0],54,72,41,241,241,257,272,20;
  533. setarray .@masterroom[0],141,149;
  534. }
  535. else if (strnpcinfo(2) == "payg_cas03") {
  536. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  537. setarray .@guardianposx[0],245,269,36,41,39,19,37,268;
  538. setarray .@guardianposy[0],37,51,39,39,65,276,277,244;
  539. setarray .@masterroom[0],163,167;
  540. }
  541. else if (strnpcinfo(2) == "payg_cas04") {
  542. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  543. setarray .@guardianposx[0],251,232,231,32,32,35,36,270;
  544. setarray .@guardianposy[0],212,212,175,287,232,45,17,41;
  545. setarray .@masterroom[0],151,47;
  546. }
  547. else if (strnpcinfo(2) == "payg_cas05") {
  548. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  549. setarray .@guardianposx[0],19,33,266,266,263,263,250,36;
  550. setarray .@guardianposy[0],279,260,234,279,37,21,22,36;
  551. setarray .@masterroom[0],153,137;
  552. }
  553. // Prontera (Valkyrie Realms) Castles
  554. else if (strnpcinfo(2) == "prtg_cas01") {
  555. setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
  556. setarray .@guardianposx[0],182,182,153,59,50,184,196,107;
  557. setarray .@guardianposy[0],62,116,86,28,36,183,189,179;
  558. setarray .@masterroom[0],15,209;
  559. }
  560. else if (strnpcinfo(2) == "prtg_cas02") {
  561. setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
  562. setarray .@guardianposx[0],161,153,178,71,49,64,7,75;
  563. setarray .@guardianposy[0],161,161,44,75,28,186,196,175;
  564. setarray .@masterroom[0],207,229;
  565. }
  566. else if (strnpcinfo(2) == "prtg_cas03") {
  567. setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
  568. setarray .@guardianposx[0],191,137,45,50,41,191,179,191;
  569. setarray .@guardianposy[0],190,190,99,87,87,42,43,72;
  570. setarray .@masterroom[0],190,130;
  571. }
  572. else if (strnpcinfo(2) == "prtg_cas04") {
  573. setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
  574. setarray .@guardianposx[0],276,274,246,38,29,33,78,36;
  575. setarray .@guardianposy[0],14,35,246,240,240,258,48,61;
  576. setarray .@masterroom[0],275,160;
  577. }
  578. else if (strnpcinfo(2) == "prtg_cas05") {
  579. setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
  580. setarray .@guardianposx[0],266,287,245,236,251,278,32,44;
  581. setarray .@guardianposy[0],262,280,250,63,63,253,253,248;
  582. setarray .@masterroom[0],281,176;
  583. }
  584. // Add custom Guild Castles here.
  585. else {
  586. end;
  587. }
  588. if (.@GID == 0) {
  589. mes "["+strnpcinfo(1)+"]";
  590. mes "I have been waiting for a master to fulfill my destiny.";
  591. mes "Brave soul... fate will guide you towards your future...";
  592. close;
  593. }
  594. if (GetGuildMaster(.@GID) != strcharinfo(0)) {
  595. mes "["+strnpcinfo(1)+"]";
  596. mes "No matter how much you pester me, I'll still follow my master ^ff0000"+GetGuildMaster(.@GID)+"^000000. Where are the Guardians?! Send these ruffians away right now!";
  597. close;
  598. }
  599. mes "["+strnpcinfo(1)+"]";
  600. mes "Welcome. My honorable master, ^ff0000"+strcharinfo(0)+"^000000...";
  601. mes "Your humble servent, "+strnpcinfo(1)+", is here to serve you.";
  602. next;
  603. switch (select("Castle briefing:Invest in commercial growth:Invest in Castle Defenses:Summon Guardian:Hire / Fire a Kafra Employee:Go into Master's room")) {
  604. case 1:
  605. mes "["+strnpcinfo(1)+"]";
  606. mes "I will report the Castle briefing, Master.";
  607. mes " ";
  608. mes "^0000ffNow, the commercial growth level is "+GetCastleData(strnpcinfo(2),2)+".";
  609. if (GetCastleData(strnpcinfo(2),4)) {
  610. mes " You invested "+GetCastleData(strnpcinfo(2),4)+" times in past 1 day.";
  611. }
  612. mes " Now, the Castle Defense level is "+GetCastleData(strnpcinfo(2),3)+".^000000";
  613. if (GetCastleData(strnpcinfo(2),5)) {
  614. mes " ^0000ff- You invested "+GetCastleData(strnpcinfo(2),5)+" times in past 1 day.^000000";
  615. }
  616. mes " ";
  617. mes "That's all I have to report, Master.";
  618. close;
  619. case 2:
  620. set .@Economy,GetCastleData(strnpcinfo(2),2);
  621. if (.@Economy < 6) { set .@eco_invest,5000; }
  622. else if ((.@Economy >= 6) && (.@Economy <= 10)) { set .@eco_invest,10000; }
  623. else if ((.@Economy >= 11) && (.@Economy <= 15)) { set .@eco_invest,20000; }
  624. else if ((.@Economy >= 16) && (.@Economy <= 20)) { set .@eco_invest,35000; }
  625. else if ((.@Economy >= 21) && (.@Economy <= 25)) { set .@eco_invest,55000; }
  626. else if ((.@Economy >= 26) && (.@Economy <= 30)) { set .@eco_invest,80000; }
  627. else if ((.@Economy >= 31) && (.@Economy <= 35)) { set .@eco_invest,110000; }
  628. else if ((.@Economy >= 36) && (.@Economy <= 40)) { set .@eco_invest,145000; }
  629. else if ((.@Economy >= 41) && (.@Economy <= 45)) { set .@eco_invest,185000; }
  630. else if ((.@Economy >= 46) && (.@Economy <= 50)) { set .@eco_invest,230000; }
  631. else if ((.@Economy >= 51) && (.@Economy <= 55)) { set .@eco_invest,280000; }
  632. else if ((.@Economy >= 56) && (.@Economy <= 60)) { set .@eco_invest,335000; }
  633. else if ((.@Economy >= 61) && (.@Economy <= 65)) { set .@eco_invest,395000; }
  634. else if ((.@Economy >= 66) && (.@Economy <= 70)) { set .@eco_invest,460000; }
  635. else if ((.@Economy >= 71) && (.@Economy <= 75)) { set .@eco_invest,530000; }
  636. else if ((.@Economy >= 76) && (.@Economy <= 80)) { set .@eco_invest,605000; }
  637. else if ((.@Economy >= 81) && (.@Economy <= 85)) { set .@eco_invest,685000; }
  638. else if ((.@Economy >= 86) && (.@Economy <= 90)) { set .@eco_invest,770000; }
  639. else if ((.@Economy >= 91) && (.@Economy <= 95)) { set .@eco_invest,860000; }
  640. else if ((.@Economy >= 96) && (.@Economy <= 100)) { set .@eco_invest,955000; }
  641. //Quadruple the cost of investing if you've already invested once.
  642. if (GetCastleData(strnpcinfo(2),4)) {
  643. set .@eco_invest,.@eco_invest*4;
  644. }
  645. mes "["+strnpcinfo(1)+"]";
  646. mes "If you invest in commercial growth, the quantity of goods made by the guild will increase. Therfore, if you consider our future, investments will be a necessity.";
  647. mes " ";
  648. mes "Initially, you are able to invest just once but if you pay more money, you will be able to invest twice.";
  649. if (.@Economy >= 100) {
  650. mes " ";
  651. mes "^ff0000The commercial growth level of our Castle is at it's highest, 100%. No more investments are needed. Just as I have expected from a great economist like you, Master.^000000";
  652. close;
  653. }
  654. if (GetCastleData(strnpcinfo(2),4) >= 2) {
  655. mes " ";
  656. mes "^ff0000You have already invested twice today. You cannot invest any more.^000000 I expect riches of the guild to grow at a high rate.";
  657. close;
  658. }
  659. if (GetCastleData(strnpcinfo(2),4) == 0) {
  660. mes " ";
  661. mes "The current investment amount required is ^ff0000"+.@eco_invest+"^000000 zeny. Will you invest?";
  662. }
  663. else {
  664. mes " ";
  665. mes "You've invested once today... if you wish to invest once more, ^ff0000"+.@eco_invest+"^000000 more zeny will be needed.";
  666. }
  667. next;
  668. switch (select("Invest in commercial growth:Cancel")) {
  669. case 1:
  670. if (Zeny < .@eco_invest) {
  671. mes "["+strnpcinfo(1)+"]";
  672. mes "I'm sorry but there is not enough zeny to invest. You will have to try again when you have the funds, Master.";
  673. close;
  674. }
  675. set Zeny, Zeny - .@eco_invest;
  676. SetCastleData strnpcinfo(2),4,GetCastleData(strnpcinfo(2),4)+1;
  677. mes "[ "+strnpcinfo(1)+"]";
  678. mes "We finished the investment safely. I expect that our growth level will be increased by tomorrow.";
  679. close;
  680. case 2:
  681. mes "["+strnpcinfo(1)+"]";
  682. mes "I'll do as you bid, my master... There is no hurry. We will do our best.";
  683. close;
  684. }
  685. case 3:
  686. set .@Defence,GetCastleData(strnpcinfo(2),3);
  687. if (.@Defence < 6) { set .@def_invest,10000; }
  688. else if ((.@Defence >= 6) && (.@Defence <= 10)) { set .@def_invest,20000; }
  689. else if ((.@Defence >= 11) && (.@Defence <= 15)) { set .@def_invest,40000; }
  690. else if ((.@Defence >= 16) && (.@Defence <= 20)) { set .@def_invest,70000; }
  691. else if ((.@Defence >= 21) && (.@Defence <= 25)) { set .@def_invest,110000; }
  692. else if ((.@Defence >= 26) && (.@Defence <= 30)) { set .@def_invest,160000; }
  693. else if ((.@Defence >= 31) && (.@Defence <= 35)) { set .@def_invest,220000; }
  694. else if ((.@Defence >= 36) && (.@Defence <= 40)) { set .@def_invest,290000; }
  695. else if ((.@Defence >= 41) && (.@Defence <= 45)) { set .@def_invest,370000; }
  696. else if ((.@Defence >= 46) && (.@Defence <= 50)) { set .@def_invest,460000; }
  697. else if ((.@Defence >= 51) && (.@Defence <= 55)) { set .@def_invest,560000; }
  698. else if ((.@Defence >= 56) && (.@Defence <= 60)) { set .@def_invest,670000; }
  699. else if ((.@Defence >= 61) && (.@Defence <= 65)) { set .@def_invest,790000; }
  700. else if ((.@Defence >= 66) && (.@Defence <= 70)) { set .@def_invest,920000; }
  701. else if ((.@Defence >= 71) && (.@Defence <= 75)) { set .@def_invest,1060000; }
  702. else if ((.@Defence >= 76) && (.@Defence <= 80)) { set .@def_invest,1210000; }
  703. else if ((.@Defence >= 81) && (.@Defence <= 85)) { set .@def_invest,1370000; }
  704. else if ((.@Defence >= 86) && (.@Defence <= 90)) { set .@def_invest,1540000; }
  705. else if ((.@Defence >= 91) && (.@Defence <= 95)) { set .@def_invest,1720000; }
  706. else if ((.@Defence >= 96) && (.@Defence <= 100)) { set .@def_invest,1910000; }
  707. //Quadruple the cost of investing if you've already invested once.
  708. if (GetCastleData(strnpcinfo(2),5)) {
  709. set .@def_invest,.@def_invest*4;
  710. }
  711. mes "["+strnpcinfo(1)+"]";
  712. mes "If you raise Castle Defenses, the durability of Guardians and the Emperium will increase. Therefore, if you consider our coming battles, some investment in this area will be required.";
  713. mes " ";
  714. mes "Originally you can invest just once but if you pay more money, you can invest twice.";
  715. if (.@Defence >= 100) {
  716. mes " ";
  717. mes "^ff0000But the Castle Defense level of our Castle is at it's highest, 100%. No more investments are needed. Just as I have expected from a great strategist like you, Master.^000000";
  718. close;
  719. }
  720. if (GetCastleData(strnpcinfo(2),5) >= 2) {
  721. mes " ";
  722. mes "^ff0000You have already invested twice today. You cannot invest any more.^000000 I expect the Defenses of the guild to grow at a high rate.";
  723. close;
  724. }
  725. if (GetCastleData(strnpcinfo(2),5) == 0) {
  726. mes " ";
  727. mes "The current investment amount required is ^ff0000"+.@def_invest+"^000000 zeny. Will you invest?";
  728. }
  729. else {
  730. mes " ";
  731. mes "You've invested once today... if you wish to invest once more, ^ff0000"+.@def_invest+"^000000 more zeny will be needed.";
  732. }
  733. next;
  734. switch (select("Invest in Castle Defenses.:Cancel")) {
  735. case 1:
  736. if (Zeny < .@def_invest) {
  737. mes "["+strnpcinfo(1)+"]";
  738. mes "I'm sorry but there is not enough zeny to invest. You will have to try again when you have the funds, Master.";
  739. close;
  740. }
  741. set Zeny, Zeny - .@def_invest;
  742. SetCastleData strnpcinfo(2),5,GetCastleData(strnpcinfo(2),5)+1;
  743. mes "[ "+strnpcinfo(1)+"]";
  744. mes "We finished the investment safely. I expect that our Castle Defense level will be increased by tomorrow.";
  745. close;
  746. case 2:
  747. mes "["+strnpcinfo(1)+"]";
  748. mes "I'll do as you bid, my master... There is no hurry. We will do our best.";
  749. close;
  750. }
  751. case 4:
  752. mes "["+strnpcinfo(1)+"]";
  753. mes "Will you summon a Guardian? It'll be a protector to defend us loyally.";
  754. mes "Please select a guardian to defend us.";
  755. next;
  756. for( set .@i, 0; .@i <= 7 ; set .@i, .@i+1 ) {
  757. if (.@guardiantype[.@i] == 1) { set .@type$,"Guardian Soldier"; }
  758. else if (.@guardiantype[.@i] == 2) { set .@type$,"Guardian Archer"; }
  759. else { set .@type$,"Guardian Knight"; }
  760. if (guardianinfo(strnpcinfo(2),.@i,0)) {
  761. setarray .@gname$[.@i], .@type$ + " - Implemented (" + guardianinfo(strnpcinfo(2),.@i,2) + "/" + guardianinfo(strnpcinfo(2),.@i,1) + ")";
  762. }
  763. else {
  764. setarray .@gname$[.@i], .@type$ + " - Not Implemented";
  765. }
  766. }
  767. set .@menu$,.@gname$[0]+":"+.@gname$[1]+":"+.@gname$[2]+":"+.@gname$[3]+":"+.@gname$[4]+":"+.@gname$[5]+":"+.@gname$[6]+":"+.@gname$[7];
  768. set .@GDnum,select(.@menu$)+9;
  769. mes "["+strnpcinfo(1)+"]";
  770. mes "Will you summon the chosen guardian? 10,000 zeny are required to summon a Guardian.";
  771. next;
  772. switch (select("Summon:Cancel")) {
  773. case 1:
  774. if (getgdskilllv(.@GID,10002) == 0) {
  775. mes "["+strnpcinfo(1)+"]";
  776. mes "Master, we have not the resources to Summon the Guardian. If you want to accumulate them, you have to learn the Guild skill. We failed to summon the Guardian.";
  777. close;
  778. }
  779. if (GetCastleData(strnpcinfo(2),.@GDnum) == 1) {
  780. mes "["+strnpcinfo(1)+"]";
  781. mes "Master, you already have summoned that Guardian. We cannot summon another.";
  782. close;
  783. }
  784. if (Zeny < 10000) {
  785. mes "["+strnpcinfo(1)+"]";
  786. mes "Well... I'm sorry but we don't have funds to summon the Guardian. We failed to summon the Guardian.";
  787. close;
  788. }
  789. set Zeny, Zeny - 10000;
  790. SetCastleData strnpcinfo(2),.@GDnum,1; // mark as 'installed'
  791. set .@UseGID,.@GDnum - 10;
  792. if (.@guardiantype[.@UseGID] == 1) { set .@type,1287; }
  793. else if (.@guardiantype[.@UseGID] == 2) { set .@type,1285; }
  794. else { set .@type,1286; }
  795. guardian strnpcinfo(2),.@guardianposx[.@UseGID],.@guardianposy[.@UseGID],strmobinfo(2,.@type),.@type,"Guardian#"+strnpcinfo(2)+"::OnGuardianDied",.@UseGID;
  796. mes "["+strnpcinfo(1)+"]";
  797. mes "We completed the summoning of the Guardian. Our defenses are now increased with it in place.";
  798. close;
  799. case 2:
  800. mes "["+strnpcinfo(1)+"]";
  801. mes "I did as you ordered. But please remember if you the have money to spare, it'll be better to set it up.";
  802. close;
  803. }
  804. case 5:
  805. if (GetCastleData(strnpcinfo(2),9) == 1) {
  806. mes "["+strnpcinfo(1)+"]";
  807. mes "We are currently hiring a Kafra Employee... Do you want to fire the Kafra Employee?";
  808. next;
  809. switch (select("Fire:Cancel")) {
  810. case 1:
  811. cutin "kafra_01",2;
  812. mes "[ Hired Kafra Employee ]";
  813. mes "I worked so hard... How can you do that, Master?... Please... Please reconsider... Check it again, Master... Please...";
  814. next;
  815. switch (select("Fire:Cancel")) {
  816. case 1:
  817. mes "[ Hired Kafra Employee ]";
  818. mes "Oh, my goodness! This is nonsense!";
  819. next;
  820. cutin "",255;
  821. close;
  822. case 2:
  823. mes "[ Hired Kafra Employee ]";
  824. mes "I'll work hard for you... Thank you!";
  825. close;
  826. }
  827. case 2:
  828. mes "["+strnpcinfo(1)+"]";
  829. mes "She worked hard in my opinion. It was a good decision to keep her.";
  830. close;
  831. }
  832. disablenpc "Kafra Staff#"+strnpcinfo(2);
  833. SetCastleData strnpcinfo(2),9,0;
  834. mes "["+strnpcinfo(1)+"]";
  835. mes "....";
  836. mes "I have discharged the Kafra Employee... But... are you unsatisfied with something?";
  837. close;
  838. }
  839. mes "["+strnpcinfo(1)+"]";
  840. mes "Will you contact the kafra Main Office and Hire a Employee for our Castle?";
  841. mes "^ff0000 10,000 zeny is required for their services. ";
  842. next;
  843. switch (select("Hire.:Cancel")) {
  844. case 1:
  845. if (getgdskilllv(.@GID,10001) == 0) {
  846. mes "["+strnpcinfo(1)+"]";
  847. mes "Master, we can't hire a Kafra Employee because we don't have a contract with the Kafra Main Office. If you want to obtain a contract with the Kafra Main Office, you will need to learn the Guild skill first.";
  848. close;
  849. }
  850. if (Zeny < 10000) {
  851. mes "["+strnpcinfo(1)+"]";
  852. mes "Well... I'm sorry but we don't have enough funds to hire a Kafra Employee.";
  853. close;
  854. }
  855. set Zeny, Zeny - 10000;
  856. enablenpc "Kafra Staff#"+strnpcinfo(2);
  857. SetCastleData strnpcinfo(2),9,1;
  858. mes "["+strnpcinfo(1)+"]";
  859. mes "We obtained a contract with the kafra Main Office, and hired a Kafra Employee.";
  860. next;
  861. cutin "kafra_01",2;
  862. mes "[ Hired Kafra Employee ]";
  863. mes "How do you do? I was dispatched from the Main Office.";
  864. mes "I'll do my best to not tarnish the reputation of the Guild.";
  865. next;
  866. cutin "",255;
  867. mes "["+strnpcinfo(1)+"]";
  868. mes "The Contract terms of the hired Kafra Employee are for 1 month and after this term, you will need to to pay an additional fee.";
  869. mes "It will be useful for our members.";
  870. close;
  871. case 2:
  872. mes "["+strnpcinfo(1)+"]";
  873. mes "I did as you ordered, but some of our members will be unhappy. It will be better to hire a Kafra Employee quickly.";
  874. close;
  875. }
  876. case 6:
  877. mes "["+strnpcinfo(1)+"]";
  878. mes "Do you want to visit the room where our valuables are stored?";
  879. mes "That room is restricted to you... you are the only one with access to it.";
  880. next;
  881. switch (select("Go into Master's room.:Cancel")) {
  882. case 1:
  883. mes "["+strnpcinfo(1)+"]";
  884. mes "I'll show you the secret path. Follow me...please.";
  885. mes "When you want to return here, please press the secret switch.";
  886. close2;
  887. warp strnpcinfo(2),.@masterroom[0],.@masterroom[1];
  888. end;
  889. case 2:
  890. mes "["+strnpcinfo(1)+"]";
  891. mes "Goods are produced once a day... if you don't remove them in time, they will not be produced anymore.";
  892. mes "Therefore, it will be better if you check up on them from time to time.";
  893. close;
  894. }
  895. }
  896. }
  897. // WoE : Guild Dungeon Entrances
  898. //============================================================
  899. - script Lever#gd::gdlever -1,{
  900. set .@GID,GetCastleData(strnpcinfo(2),1);
  901. if (.@GID == 0) {
  902. mes "[Ringing Voice]";
  903. mes "'Those who overcome an ordeal shows a great deal of bravery... and will find their way to another ordeal.'";
  904. close;
  905. }
  906. if (compare(strnpcinfo(2),"aldeg")) {
  907. set .@destination$,"gld_dun02";
  908. if (compare(strnpcinfo(2),"cas01")) setarray .@coordinates[0],32,122;
  909. else if (compare(strnpcinfo(2),"cas02")) setarray .@coordinates[0],79,30;
  910. else if (compare(strnpcinfo(2),"cas03")) setarray .@coordinates[0],165,38;
  911. else if (compare(strnpcinfo(2),"cas04")) setarray .@coordinates[0],160,148;
  912. else if (compare(strnpcinfo(2),"cas05")) setarray .@coordinates[0],103,169;
  913. }
  914. else if (compare(strnpcinfo(2),"gefg")) {
  915. set .@destination$,"gld_dun04";
  916. if (compare(strnpcinfo(2),"cas01")) setarray .@coordinates[0],39,258;
  917. else if (compare(strnpcinfo(2),"cas02")) setarray .@coordinates[0],125,270;
  918. else if (compare(strnpcinfo(2),"cas03")) setarray .@coordinates[0],268,251;
  919. else if (compare(strnpcinfo(2),"cas04")) setarray .@coordinates[0],268,108;
  920. else if (compare(strnpcinfo(2),"cas05")) setarray .@coordinates[0],230,35;
  921. }
  922. else if (compare(strnpcinfo(2),"payg")) {
  923. set .@destination$,"gld_dun01";
  924. if (compare(strnpcinfo(2),"cas01")) setarray .@coordinates[0],186,165;
  925. else if (compare(strnpcinfo(2),"cas02")) setarray .@coordinates[0],54,165;
  926. else if (compare(strnpcinfo(2),"cas03")) setarray .@coordinates[0],54,39;
  927. else if (compare(strnpcinfo(2),"cas04")) setarray .@coordinates[0],186,39;
  928. else if (compare(strnpcinfo(2),"cas05")) setarray .@coordinates[0],223,202;
  929. }
  930. else if (compare(strnpcinfo(2),"prtg")) {
  931. set .@destination$,"gld_dun03";
  932. if (compare(strnpcinfo(2),"cas01")) setarray .@coordinates[0],28,251;
  933. else if (compare(strnpcinfo(2),"cas02")) setarray .@coordinates[0],164,268;
  934. else if (compare(strnpcinfo(2),"cas03")) setarray .@coordinates[0],164,179;
  935. else if (compare(strnpcinfo(2),"cas04")) setarray .@coordinates[0],268,203;
  936. else if (compare(strnpcinfo(2),"cas05")) setarray .@coordinates[0],199,28;
  937. }
  938. // Add custom Guild Castles here.
  939. else {
  940. end;
  941. }
  942. mes "[Ringing Voice]";
  943. mes "'Only the truly brave can take the test.'";
  944. next;
  945. mes " ";
  946. mes "There's a small lever. Will you pull it?";
  947. next;
  948. if(select("Pull.:Don't pull.") == 1) {
  949. if (getcharid(2) == .@GID) {
  950. close2;
  951. warp .@destination$,.@coordinates[0],.@coordinates[1];
  952. end;
  953. }
  954. mes " ";
  955. mes "Nothing happened.";
  956. close;
  957. }
  958. close;
  959. }
  960. // Guardian Spawner Template
  961. //============================================================
  962. - script Gld_Guard_Template::Gld_Guard_Template -1,{
  963. // Spawn Guardians in castles
  964. // When adding new castles, ensure that the coordinates coincide
  965. // with the coordinates defined in the Guild Steward template.
  966. OnSpawnGuardians:
  967. // Define the types of guardians on a per castle basis.
  968. // 1 - Soldier Guardian; 2 - Archer Guardian; 3 - Knight Guardian
  969. // Define the x spawn point for each uardian.
  970. // [0] = 1st guardian's x spawn point.
  971. // Define the y spawn point for each uardian.
  972. // [0] = 1st guardian's y spawn point.
  973. // Aldebaran (Luina) Castles
  974. if (strnpcinfo(2) == "aldeg_cas01") {
  975. setarray .@guardiantype[0],1,2,2,2,2,3,3,3;
  976. setarray .@guardianposx[0],17,39,38,45,21,218,213,73;
  977. setarray .@guardianposy[0],218,208,196,228,194,24,24,70;
  978. }
  979. else if (strnpcinfo(2) == "aldeg_cas02") {
  980. setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
  981. setarray .@guardianposx[0],27,88,117,60,51,21,36,210;
  982. setarray .@guardianposy[0],184,43,46,202,183,177,183,7;
  983. }
  984. else if (strnpcinfo(2) == "aldeg_cas03") {
  985. setarray .@guardiantype[0],3,3,1,1,1,2,2,2;
  986. setarray .@guardianposx[0],90,116,86,116,64,212,195,110;
  987. setarray .@guardianposy[0],112,112,120,76,103,160,151,217;
  988. }
  989. else if (strnpcinfo(2) == "aldeg_cas04") {
  990. setarray .@guardiantype[0],2,2,2,1,1,1,3,3;
  991. setarray .@guardianposx[0],187,192,148,145,169,198,48,55;
  992. setarray .@guardianposy[0],100,42,88,209,53,77,72,88;
  993. }
  994. else if (strnpcinfo(2) == "aldeg_cas05") {
  995. setarray .@guardiantype[0],2,2,1,1,3,3,3,3;
  996. setarray .@guardianposx[0],51,188,157,157,27,145,156,41;
  997. setarray .@guardianposy[0],202,79,192,74,221,78,73,112;
  998. }
  999. // Geffen (Britoniah) Castles
  1000. else if (strnpcinfo(2) == "gefg_cas01") {
  1001. setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
  1002. setarray .@guardianposx[0],67,184,62,36,50,50,189,200;
  1003. setarray .@guardianposy[0],179,20,41,186,186,67,41,167;
  1004. }
  1005. else if (strnpcinfo(2) == "gefg_cas02") {
  1006. setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
  1007. setarray .@guardianposx[0],64,56,166,35,20,19,166,159;
  1008. setarray .@guardianposy[0],168,41,25,148,150,41,42,188;
  1009. }
  1010. else if (strnpcinfo(2) == "gefg_cas03") {
  1011. setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
  1012. setarray .@guardianposx[0],48,113,48,157,243,157,234,238;
  1013. setarray .@guardianposy[0],176,214,207,62,41,45,25,160;
  1014. }
  1015. else if (strnpcinfo(2) == "gefg_cas04") {
  1016. setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
  1017. setarray .@guardianposx[0],53,31,49,29,147,57,160,148;
  1018. setarray .@guardianposy[0],191,178,220,46,65,46,50,189;
  1019. }
  1020. else if (strnpcinfo(2) == "gefg_cas05") {
  1021. setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
  1022. setarray .@guardianposx[0],45,71,72,66,177,66,177,193;
  1023. setarray .@guardianposy[0],149,163,142,47,50,17,35,166;
  1024. }
  1025. // Payon (Baulder) Castles
  1026. else if (strnpcinfo(2) == "payg_cas01") {
  1027. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  1028. setarray .@guardianposx[0],229,225,222,99,65,36,51,138;
  1029. setarray .@guardianposy[0],92,80,111,45,31,127,144,133;
  1030. }
  1031. else if (strnpcinfo(2) == "payg_cas02") {
  1032. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  1033. setarray .@guardianposx[0],237,228,210,57,42,287,264,27;
  1034. setarray .@guardianposy[0],54,72,41,241,241,257,272,20;
  1035. }
  1036. else if (strnpcinfo(2) == "payg_cas03") {
  1037. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  1038. setarray .@guardianposx[0],245,269,36,41,39,19,37,268;
  1039. setarray .@guardianposy[0],37,51,39,39,65,276,277,244;
  1040. }
  1041. else if (strnpcinfo(2) == "payg_cas04") {
  1042. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  1043. setarray .@guardianposx[0],251,232,231,32,32,35,36,270;
  1044. setarray .@guardianposy[0],212,212,175,287,232,45,17,41;
  1045. }
  1046. else if (strnpcinfo(2) == "payg_cas05") {
  1047. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  1048. setarray .@guardianposx[0],19,33,266,266,263,263,250,36;
  1049. setarray .@guardianposy[0],279,260,234,279,37,21,22,36;
  1050. }
  1051. // Prontera (Valkyrie Realms) Castles
  1052. else if (strnpcinfo(2) == "prtg_cas01") {
  1053. setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
  1054. setarray .@guardianposx[0],182,182,153,59,50,184,196,107;
  1055. setarray .@guardianposy[0],62,116,86,28,36,183,189,179;
  1056. }
  1057. else if (strnpcinfo(2) == "prtg_cas02") {
  1058. setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
  1059. setarray .@guardianposx[0],161,153,178,71,49,64,7,75;
  1060. setarray .@guardianposy[0],161,161,44,75,28,186,196,175;
  1061. }
  1062. else if (strnpcinfo(2) == "prtg_cas03") {
  1063. setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
  1064. setarray .@guardianposx[0],191,137,45,50,41,191,179,191;
  1065. setarray .@guardianposy[0],190,190,99,87,87,42,43,72;
  1066. }
  1067. else if (strnpcinfo(2) == "prtg_cas04") {
  1068. setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
  1069. setarray .@guardianposx[0],276,274,246,38,29,33,78,36;
  1070. setarray .@guardianposy[0],14,35,246,240,240,258,48,61;
  1071. }
  1072. else if (strnpcinfo(2) == "prtg_cas05") {
  1073. setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
  1074. setarray .@guardianposx[0],266,287,245,236,251,278,32,44;
  1075. setarray .@guardianposy[0],262,280,250,63,63,253,253,248;
  1076. }
  1077. // Add custom Guild Castles here.
  1078. else {
  1079. end;
  1080. }
  1081. // Kill all existing guardians before spawning new ones.
  1082. // This should prevent duplicating Guardians when char Server disconnects.
  1083. killmonster strnpcinfo(2),strnpcinfo(0)+"::OnGuardianDied";
  1084. for( set .@i, 0; .@i <= 7 ; set .@i, .@i+1 ) {
  1085. set .@UseGID,.@i + 10;
  1086. if (.@guardiantype[.@i] == 1) { set .@type,1287; }
  1087. else if (.@guardiantype[.@i] == 2) { set .@type,1285; }
  1088. else { set .@type,1286; }
  1089. if (GetCastleData(strnpcinfo(2),.@UseGID)) {
  1090. guardian strnpcinfo(2),.@guardianposx[.@i],.@guardianposy[.@i],strmobinfo(2,.@type),.@type,"Guardian#"+strnpcinfo(2)+"::OnGuardianDied",.@i;
  1091. }
  1092. }
  1093. end;
  1094. OnGuardianDied:
  1095. end;
  1096. }
  1097. // Treasure Room Spawn Template
  1098. //============================================================
  1099. - script Gld_Trea_Spawn::Gld_Trea_Spawn -1,{
  1100. end;
  1101. OnClock0001:
  1102. // Do nothing if this script is the template.
  1103. if (strnpcinfo(1) == "Gld_Trea_Spawn") end;
  1104. set .@GID, GetCastleData(strnpcinfo(2),1);
  1105. // If there is no owner, do nothing.
  1106. if (!.@GID) end;
  1107. // Is there Economy in this castle?
  1108. set .@Treasure,GetCastleData(strnpcinfo(2),2)/5+4;
  1109. // Set information
  1110. if (strnpcinfo(2) == "aldeg_cas01") {
  1111. set .@treasurebox,1324;
  1112. setarray .@treasurex[0],115,122,115,122,116,117,118,119,120,121,121,121,121,121,121,120,119,118,117,116,116,116,116,116;
  1113. setarray .@treasurey[0],226,226,219,219,225,225,225,225,225,225,224,223,222,221,220,220,220,220,220,220,221,222,223,224;
  1114. }
  1115. else if (strnpcinfo(2) == "aldeg_cas02") {
  1116. set .@treasurebox,1326;
  1117. setarray .@treasurex[0],134,135,135,134,132,133,134,135,136,137,137,137,137,137,137,136,135,134,133,132,132,132,132,132;
  1118. setarray .@treasurey[0],231,231,230,230,233,233,233,233,233,233,232,231,230,229,228,228,228,228,228,228,229,230,231,232;
  1119. }
  1120. else if (strnpcinfo(2) == "aldeg_cas03") {
  1121. set .@treasurebox,1328;
  1122. setarray .@treasurex[0],224,225,225,224,222,223,224,225,226,227,227,227,227,227,227,226,225,224,223,222,222,222,222,222;
  1123. setarray .@treasurey[0],269,269,268,268,271,271,271,271,271,271,270,269,268,267,266,266,266,266,266,266,267,268,269,270;
  1124. }
  1125. else if (strnpcinfo(2) == "aldeg_cas04") {
  1126. set .@treasurebox,1330;
  1127. setarray .@treasurex[0],84,85,85,84,82,83,84,85,86,87,87,87,87,87,87,86,85,84,83,82,82,82,82,82;
  1128. setarray .@treasurey[0],13,13,12,12,15,15,15,15,15,15,14,13,12,11,10,10,10,10,10,10,11,12,13,14;
  1129. }
  1130. else if (strnpcinfo(2) == "aldeg_cas05") {
  1131. set .@treasurebox,1332;
  1132. setarray .@treasurex[0],61,62,62,61,59,60,61,62,63,64,64,64,64,64,64,63,62,61,60,59,59,59,59,59;
  1133. setarray .@treasurey[0],12,12,11,11,14,14,14,14,14,14,13,12,11,10,9,9,9,9,9,9,10,11,12,13;
  1134. }
  1135. else if (strnpcinfo(2) == "gefg_cas01") {
  1136. set .@treasurebox,1334;
  1137. setarray .@treasurex[0],153,154,154,153,151,152,153,154,155,156,156,156,156,156,156,155,154,153,152,151,151,151,151,151;
  1138. setarray .@treasurey[0],113,113,112,112,115,115,115,115,115,115,114,113,112,111,110,110,110,110,110,110,111,112,113,114;
  1139. }
  1140. else if (strnpcinfo(2) == "gefg_cas02") {
  1141. set .@treasurebox,1336;
  1142. setarray .@treasurex[0],139,140,140,139,137,138,139,140,141,142,142,142,142,142,142,141,140,139,138,137,137,137,137,137;
  1143. setarray .@treasurey[0],115,115,114,114,117,117,117,117,117,117,116,115,114,113,112,112,112,112,112,112,113,114,115,116;
  1144. }
  1145. else if (strnpcinfo(2) == "gefg_cas03") {
  1146. set .@treasurebox,1338;
  1147. setarray .@treasurex[0],269,270,270,269,267,268,269,270,271,272,272,272,272,272,272,271,270,269,268,267,267,267,267,267;
  1148. setarray .@treasurey[0],291,291,290,290,293,293,293,293,293,293,292,291,290,289,288,288,288,288,288,288,289,290,291,292;
  1149. }
  1150. else if (strnpcinfo(2) == "gefg_cas04") {
  1151. set .@treasurebox,1340;
  1152. setarray .@treasurex[0],115,116,116,115,113,114,115,116,117,118,118,118,118,118,118,117,116,115,114,113,113,113,113,113;
  1153. setarray .@treasurey[0],119,119,118,118,121,121,121,121,121,121,120,119,118,117,116,116,116,116,116,116,117,118,119,120;
  1154. }
  1155. else if (strnpcinfo(2) == "gefg_cas05") {
  1156. set .@treasurebox,1342;
  1157. setarray .@treasurex[0],143,144,144,143,141,142,143,144,145,146,146,146,146,146,146,145,144,143,142,141,141,141,141,141;
  1158. setarray .@treasurey[0],110,110,109,109,112,112,112,112,112,112,111,110,109,108,107,107,107,107,107,107,108,109,110,111;
  1159. }
  1160. else if (strnpcinfo(2) == "payg_cas01") {
  1161. set .@treasurebox,1344;
  1162. setarray .@treasurex[0],289,292,292,289,288,289,290,291,292,293,293,293,293,293,293,292,291,290,289,288,288,288,288,288;
  1163. setarray .@treasurey[0],10,10,7,7,11,11,11,11,11,11,10,9,8,7,6,6,6,6,6,6,7,8,9,10;
  1164. }
  1165. else if (strnpcinfo(2) == "payg_cas02") {
  1166. set .@treasurebox,1346;
  1167. setarray .@treasurex[0],143,146,146,143,142,143,144,145,146,147,147,147,147,147,147,146,145,144,143,142,142,142,142,142;
  1168. setarray .@treasurey[0],146,146,143,143,147,147,147,147,147,147,146,145,144,143,142,142,142,142,142,142,143,144,145,146;
  1169. }
  1170. else if (strnpcinfo(2) == "payg_cas03") {
  1171. set .@treasurebox,1348;
  1172. setarray .@treasurex[0],158,159,159,158,156,157,158,159,160,161,161,161,161,161,161,160,159,158,157,156,156,156,156,156;
  1173. setarray .@treasurey[0],169,169,168,168,171,171,171,171,171,171,170,169,168,167,166,166,166,166,166,166,167,168,169,170;
  1174. }
  1175. else if (strnpcinfo(2) == "payg_cas04") {
  1176. set .@treasurebox,1350;
  1177. setarray .@treasurex[0],146,147,147,146,144,145,146,147,148,149,149,149,149,149,149,148,147,146,145,144,144,144,144,144;
  1178. setarray .@treasurey[0],48,48,47,47,50,50,50,50,50,50,49,48,47,46,45,45,45,45,45,45,46,47,48,49;
  1179. }
  1180. else if (strnpcinfo(2) == "payg_cas05") {
  1181. set .@treasurebox,1352;
  1182. setarray .@treasurex[0],155,158,158,155,154,155,156,157,158,159,159,159,159,159,159,158,157,156,155,154,154,154,154,154;
  1183. setarray .@treasurey[0],134,134,131,131,135,135,135,135,135,135,134,133,132,131,130,130,130,130,130,130,131,132,133,134;
  1184. }
  1185. else if (strnpcinfo(2) == "prtg_cas01") {
  1186. set .@treasurebox,1354;
  1187. setarray .@treasurex[0],10,11,11,10,8,9,10,11,12,13,13,13,13,13,13,12,11,10,9,8,8,8,8,8;
  1188. setarray .@treasurey[0],209,209,208,208,211,211,211,211,211,211,210,209,208,207,206,206,206,206,206,206,207,208,209,210;
  1189. }
  1190. else if (strnpcinfo(2) == "prtg_cas02") {
  1191. set .@treasurebox,1356;
  1192. setarray .@treasurex[0],201,202,202,201,199,200,201,202,203,204,204,204,204,204,204,203,202,201,200,199,199,199,199,199;
  1193. setarray .@treasurey[0],228,228,227,227,230,230,230,230,230,230,229,228,227,226,225,225,225,225,225,225,226,227,228,229;
  1194. }
  1195. else if (strnpcinfo(2) == "prtg_cas03") {
  1196. set .@treasurebox,1358;
  1197. setarray .@treasurex[0],187,188,188,187,185,186,187,188,189,190,190,190,190,190,190,189,188,187,186,185,185,185,185,185;
  1198. setarray .@treasurey[0],132,132,131,131,134,134,134,134,134,134,133,132,131,130,129,129,129,129,129,129,130,131,132,133;
  1199. }
  1200. else if (strnpcinfo(2) == "prtg_cas04") {
  1201. set .@treasurebox,1360;
  1202. setarray .@treasurex[0],269,270,270,269,267,268,269,270,271,272,272,272,272,272,272,271,270,269,268,267,267,267,267,267;
  1203. setarray .@treasurey[0],162,162,161,161,164,164,164,164,164,164,163,162,161,160,159,159,159,159,159,159,160,161,162,163;
  1204. }
  1205. else if (strnpcinfo(2) == "prtg_cas05") {
  1206. set .@treasurebox,1362;
  1207. setarray .@treasurex[0],275,276,276,275,273,274,275,276,277,278,278,278,278,278,278,277,276,275,274,273,273,273,273,273;
  1208. setarray .@treasurey[0],178,178,177,177,180,180,180,180,180,180,179,178,177,176,175,175,175,175,175,175,176,177,178,179;
  1209. }
  1210. // Add custom Guild Castles here.
  1211. else {
  1212. end;
  1213. }
  1214. // Apply investment to Eco. and Def. Only happens if there were investments made.
  1215. // Permanent Development can only happen once per day.
  1216. if (GetCastleData(strnpcinfo(2),4)) {
  1217. set .@Economy,GetCastleData(strnpcinfo(2),2);
  1218. SetCastleData strnpcinfo(2),2,.@Economy + GetCastleData(strnpcinfo(2),4) + (rand(2) && getgdskilllv(.@GID,10014));
  1219. if (GetCastleData(strnpcinfo(2),2) > 100) SetCastleData strnpcinfo(2),2,100;
  1220. }
  1221. if (GetCastleData(strnpcinfo(2),5)) {
  1222. set .@Defence,GetCastleData(strnpcinfo(2),3);
  1223. SetCastleData strnpcinfo(2),3,.@Defence + GetCastleData(strnpcinfo(2),5);
  1224. if (GetCastleData(strnpcinfo(2),3) > 100) SetCastleData strnpcinfo(2),3,100;
  1225. }
  1226. // Reset daily investment limits.
  1227. setcastledata strnpcinfo(2),4,0;
  1228. setcastledata strnpcinfo(2),5,0;
  1229. // Spawn boxes in proper order.
  1230. for (set .@i,0; .@i < .@Treasure ; set .@i,.@i+1) {
  1231. // set treasure box ID
  1232. set .@boxid, .@treasurebox + (.@i+2) % 2;
  1233. set .@box,1 << .@i;
  1234. // Spawn or do not spawn chests if one already exists.
  1235. if ((getd("$@"+strnpcinfo(2)+"_treasure") & .@box) == 0) {
  1236. monster strnpcinfo(2),.@treasurex[.@i],.@treasurey[.@i],"Treasure Chest",.@boxid,1,"Treasure#"+strnpcinfo(2)+"::OnTreasureDied"+.@i;
  1237. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") | .@box;
  1238. }
  1239. }
  1240. end;
  1241. // Individual "You killed a chest" events to ensure proper spawning at the change of day.
  1242. OnTreasureDied0:
  1243. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~1;
  1244. end;
  1245. OnTreasureDied1:
  1246. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~2;
  1247. end;
  1248. OnTreasureDied2:
  1249. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~4;
  1250. end;
  1251. OnTreasureDied3:
  1252. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~8;
  1253. end;
  1254. OnTreasureDied4:
  1255. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~16;
  1256. end;
  1257. OnTreasureDied5:
  1258. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~32;
  1259. end;
  1260. OnTreasureDied6:
  1261. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~64;
  1262. end;
  1263. OnTreasureDied7:
  1264. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~128;
  1265. end;
  1266. OnTreasureDied8:
  1267. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~256;
  1268. end;
  1269. OnTreasureDied9:
  1270. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~512;
  1271. end;
  1272. OnTreasureDied10:
  1273. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~1024;
  1274. end;
  1275. OnTreasureDied11:
  1276. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~2048;
  1277. end;
  1278. OnTreasureDied12:
  1279. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~4096;
  1280. end;
  1281. OnTreasureDied13:
  1282. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~8192;
  1283. end;
  1284. OnTreasureDied14:
  1285. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~16384;
  1286. end;
  1287. OnTreasureDied15:
  1288. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~32768;
  1289. end;
  1290. OnTreasureDied16:
  1291. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~65536;
  1292. end;
  1293. OnTreasureDied17:
  1294. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~131072;
  1295. end;
  1296. OnTreasureDied18:
  1297. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~262144;
  1298. end;
  1299. OnTreasureDied19:
  1300. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~524288;
  1301. end;
  1302. OnTreasureDied20:
  1303. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~1048576;
  1304. end;
  1305. OnTreasureDied21:
  1306. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~2097152;
  1307. end;
  1308. OnTreasureDied22:
  1309. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~4194304;
  1310. end;
  1311. OnTreasureDied23:
  1312. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~8388608;
  1313. end;
  1314. }