agit_main.txt 57 KB

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