agit_template.txt 57 KB

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