agit_main.txt 58 KB

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