agit_template.txt 57 KB

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