agit_template.txt 58 KB

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