agit_main_se.txt 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847
  1. //===== rAthena Script =======================================
  2. //= War of Emperium SE - Template File
  3. //===== By: ==================================================
  4. //= Euphy
  5. //===== Current Version: =====================================
  6. //= 1.4a
  7. //===== Compatible With: =====================================
  8. //= rAthena Project
  9. //===== Description: =========================================
  10. //= Like agit_main, this file is required
  11. //= for SE castles to function.
  12. //===== Additional Comments: =================================
  13. //= 0.x Previous authors: L0ne_W0lf, Zephyrus, Brian.
  14. //= 1.0 If anything breaks, blame Maki. [Euphy]
  15. //= 1.1 Fixed an incorrect label execution. [Euphy]
  16. //= 1.2 Hopefully fixed a processing error. [Euphy]
  17. //= 1.3 Fixed barricade issue in schg_cas02. [Cookie]
  18. //= 1.4 Added OnGuildBreak event and a spawn check. [Euphy]
  19. //= 1.4a Fixed Guardian Stone respawns. [Euphy]
  20. //============================================================
  21. // Core, triggers all other events
  22. //============================================================
  23. - script Manager#template -1,{
  24. OnAgitInit2:
  25. OnRecvCastle2:
  26. if (strnpcinfo(2) == "template") end;
  27. if (!getcastledata(strnpcinfo(2),CD_GUILD_ID)) {
  28. donpcevent strnpcinfo(0)+"::OnStart";
  29. // Monster spawns are identical for all castles.
  30. monster strnpcinfo(2),0,0,"Evil Druid",1117,10;
  31. monster strnpcinfo(2),0,0,"Khalitzburg",1132,4;
  32. monster strnpcinfo(2),0,0,"Abysmal Knight",1219,3;
  33. monster strnpcinfo(2),0,0,"Executioner",1205,1;
  34. monster strnpcinfo(2),0,0,"Penomena",1216,10;
  35. monster strnpcinfo(2),0,0,"Alarm",1193,18;
  36. monster strnpcinfo(2),0,0,"Clock",1269,9;
  37. monster strnpcinfo(2),0,0,"Raydric Archer",1276,12;
  38. monster strnpcinfo(2),0,0,"Wanderer",1208,3;
  39. monster strnpcinfo(2),0,0,"Alice",1275,1;
  40. monster strnpcinfo(2),0,0,"Bloody Knight",1268,2;
  41. monster strnpcinfo(2),0,0,"Dark Lord",1272,2;
  42. monster strnpcinfo(2),0,0,"Tower Keeper",1270,4;
  43. }
  44. if (getcastledata(strnpcinfo(2),CD_ENABLED_KAFRA) < 1)
  45. disablenpc "Kafra Employee#"+substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9);
  46. end;
  47. OnAgitStart2:
  48. if (strnpcinfo(2) == "template") end;
  49. if (agitcheck2()) {
  50. maprespawnguildid strnpcinfo(2),getcastledata(strnpcinfo(2),CD_GUILD_ID),2;
  51. gvgon strnpcinfo(2);
  52. donpcevent strnpcinfo(0)+"::OnStart";
  53. }
  54. else for(set .@i,0; .@i<4; set .@i,.@i+1)
  55. donpcevent "RL"+.@i+"#"+strnpcinfo(2)+"::OnDisable";
  56. end;
  57. OnAgitEnd2:
  58. if (strnpcinfo(2) == "template") end;
  59. gvgoff strnpcinfo(2);
  60. if (getcastledata(strnpcinfo(2),CD_GUILD_ID)) {
  61. set .@str$,substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9);
  62. killmonster strnpcinfo(2),"Steward#"+.@str$+"::OnStartArena";
  63. donpcevent strnpcinfo(0)+"::OnReset";
  64. donpcevent "Steward#"+.@str$+"::OnStop";
  65. }
  66. end;
  67. OnGuildBreak:
  68. if (strnpcinfo(2) == "template") end;
  69. killmonster strnpcinfo(2),"gard1#"+strnpcinfo(2)+"::OnGuardianDied";
  70. killmonster strnpcinfo(2),"gard2#"+strnpcinfo(2)+"::OnGuardianDied";
  71. disablenpc "Kafra Employee#"+substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9);
  72. setcastledata strnpcinfo(2),CD_GUILD_ID,0;
  73. sleep 7000;
  74. announce "Guild Base ["+getcastlename(strnpcinfo(2))+"] has been abandoned.",0;
  75. donpcevent strnpcinfo(0)+"::OnRecvCastle2";
  76. end;
  77. OnStart:
  78. // $agit_ar0x[] - $agit_sc0x[]
  79. // 1st Guardian stone, 2nd Guardian stone, Barrier 1, Barrier 2, Barrier 3, Summon Guardians
  80. // Settings for all but Summon Guardians: 0 = Okay | 1 = Destroyed | 2 = Repairing
  81. // Summon Guardians: 0 = Do not Summon | 1 = Summon
  82. if (getcastledata(strnpcinfo(2),CD_GUILD_ID)) {
  83. setarray getd("$agit_"+substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9)+"[0]"),0,0,0,0,0,0;
  84. donpcevent "df1#"+strnpcinfo(2)+"::OnEnable";
  85. donpcevent "df2#"+strnpcinfo(2)+"::OnEnable";
  86. for(set .@i,0; .@i<4; set .@i,.@i+1)
  87. donpcevent "RL"+.@i+"#"+strnpcinfo(2)+"::OnEnable";
  88. }
  89. OnEmpSpawn:
  90. set .@str$, substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9);
  91. if (mobcount(strnpcinfo(2),"Steward#"+.@str$+"::OnStartArena")) end;
  92. if (compare(strnpcinfo(2),"arug")) {
  93. if (strnpcinfo(2) == "arug_cas01") setarray .@i[0],87,219;
  94. else if (strnpcinfo(2) == "arug_cas02") setarray .@i[0],89,256;
  95. else setarray .@i[0],141,293; // Castles 3,4,5 are identical.
  96. }
  97. else {
  98. if (strnpcinfo(2) == "schg_cas02") setarray .@i[0],162,193;
  99. else if (strnpcinfo(2) == "schg_cas03") setarray .@i[0],338,202;
  100. else setarray .@i[0],120,272; // Castles 1,4,5 are identical.
  101. }
  102. monster strnpcinfo(2),.@i[0],.@i[1],"Emperium",1288,1,"Steward#"+.@str$+"::OnStartArena";
  103. end;
  104. OnReset:
  105. set .@str$, substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9);
  106. donpcevent "df1#"+strnpcinfo(2)+"::OnDisable";
  107. donpcevent "df2#"+strnpcinfo(2)+"::OnDisable";
  108. donpcevent "gard1#"+strnpcinfo(2)+"::OnReset";
  109. donpcevent "gard2#"+strnpcinfo(2)+"::OnReset";
  110. donpcevent "1st Guardian Stone#"+.@str$+"::OnDisable";
  111. donpcevent "2nd Guardian Stone#"+.@str$+"::OnDisable";
  112. for(set .@i,1; .@i<4; set .@i,.@i+1)
  113. donpcevent "Control Device0"+.@i+"#"+.@str$+"::OnDisable";
  114. for(set .@i,0; .@i<4; set .@i,.@i+1)
  115. donpcevent "RL"+.@i+"#"+strnpcinfo(2)+"::OnDisable";
  116. if (agitcheck2())
  117. setarray getd("$agit_"+substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9)+"[0]"),0,0,1,1,1,0;
  118. end;
  119. OnChange:
  120. set .@str$, substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9);
  121. setarray getd("$agit_"+.@str$+"[0]"),2,2,1,1,2,0;
  122. donpcevent strnpcinfo(0)+"::OnEmpSpawn";
  123. donpcevent "Control Device03#"+.@str$+"::OnEnable";
  124. donpcevent "1st Guardian Stone#"+.@str$+"::OnEnable";
  125. donpcevent "2nd Guardian Stone#"+.@str$+"::OnEnable";
  126. end;
  127. OnClock0001:
  128. // Spawn Treasure Chests based on castle economy.
  129. if (strnpcinfo(2) == "template") end;
  130. if (!getcastledata(strnpcinfo(2),CD_GUILD_ID)) end;
  131. killmonster strnpcinfo(2),strnpcinfo(0)+"::OnTreasureDied";
  132. if (getcastledata(strnpcinfo(2),CD_INVESTED_ECONOMY)) {
  133. set .@Economy,getcastledata(strnpcinfo(2),CD_CURRENT_ECONOMY);
  134. setcastledata strnpcinfo(2),CD_CURRENT_ECONOMY,.@Economy+getcastledata(strnpcinfo(2),CD_INVESTED_ECONOMY)+(rand(2) && getgdskilllv(getcastledata(strnpcinfo(2),CD_GUILD_ID),10014));
  135. if (getcastledata(strnpcinfo(2),CD_CURRENT_ECONOMY) > 100) setcastledata strnpcinfo(2),CD_CURRENT_ECONOMY,100;
  136. setcastledata strnpcinfo(2),CD_INVESTED_ECONOMY,0;
  137. }
  138. if (getcastledata(strnpcinfo(2),CD_INVESTED_DEFENSE)) {
  139. set .@Defence,getcastledata(strnpcinfo(2),CD_CURRENT_DEFENSE);
  140. setcastledata strnpcinfo(2),CD_CURRENT_DEFENSE,.@Defence+getcastledata(strnpcinfo(2),CD_INVESTED_DEFENSE);
  141. if (getcastledata(strnpcinfo(2),CD_CURRENT_DEFENSE) > 100) setcastledata strnpcinfo(2),CD_CURRENT_DEFENSE,100;
  142. setcastledata strnpcinfo(2),CD_INVESTED_DEFENSE,0;
  143. }
  144. set .@Treasure,getcastledata(strnpcinfo(2),CD_CURRENT_ECONOMY)/5+4;
  145. if (!.@Treasure) end;
  146. freeloop(1);
  147. if (compare(strnpcinfo(2),"arug")) {
  148. if (strnpcinfo(2) == "arug_cas01") {
  149. set .@treasurebox,1943;
  150. setarray .@treasurex[0],251,252,253,254,255,256,257,258,251,252,253,254,255,256,257,258,251,252,253,254,255,256,257,258;
  151. setarray .@treasurey[0],369,369,369,369,368,368,368,368,367,367,367,367,366,366,366,366,365,365,365,365,364,364,364,364;
  152. }
  153. else if (strnpcinfo(2) == "arug_cas02") {
  154. set .@treasurebox,1944;
  155. setarray .@treasurex[0],382,383,384,385,386,387,384,385,386,387,388,389,382,383,384,385,386,387,384,385,386,387,388,389;
  156. setarray .@treasurey[0],231,231,231,231,231,231,230,230,230,230,230,230,225,225,225,225,225,225,224,224,224,224,224,224;
  157. }
  158. else { // Castles 3,4,5 are identical, except 4's treasure.
  159. set .@treasurebox,(strnpcinfo(2) == "arug_cas04")?1946:1945;
  160. setarray .@treasurex[0],291,292,293,294,295,296,293,294,295,296,297,298,291,292,293,294,295,296,293,294,295,296,297,298;
  161. setarray .@treasurey[0],276,276,276,276,276,276,274,274,274,274,274,274,272,272,272,272,272,272,269,269,269,269,269,269;
  162. }
  163. }
  164. else {
  165. if (strnpcinfo(2) == "schg_cas02") {
  166. set .@treasurebox,1939;
  167. setarray .@treasurex[0],249,250,251,252,253,246,247,248,249,250,250,251,252,253,246,247,248,249,250,249,250,251,252,253;
  168. setarray .@treasurey[0],378,378,378,378,378,376,376,376,376,376,374,374,374,374,372,372,372,372,372,370,370,370,370,370;
  169. }
  170. else if (strnpcinfo(2) == "schg_cas03") {
  171. set .@treasurebox,1940;
  172. setarray .@treasurex[0],189,190,191,192,193,194,189,190,191,192,193,194,189,190,191,192,193,194,189,190,191,192,193,194;
  173. setarray .@treasurey[0], 21, 21, 21, 21, 21, 21, 19, 19, 19, 19, 19, 19, 17, 17, 17, 17, 17, 17, 15, 15, 15, 15, 15, 15;
  174. }
  175. else { // Castles 1,4,5 are identical, except treasures.
  176. if (strnpcinfo(2) == "schg_cas01") set .@treasurebox,1938;
  177. else if (strnpcinfo(2) == "schg_cas04") set .@treasurebox,1941;
  178. else set .@treasurebox,1942;
  179. setarray .@treasurex[0],388,388,388,387,386,385,384,384,384,384,384,384,385,386,387,388,389,390,390,390,389,388,387,386;
  180. setarray .@treasurey[0],388,389,390,390,390,390,389,388,387,386,385,384,384,384,384,384,384,384,385,386,386,386,386,386;
  181. }
  182. }
  183. for(set .@i,0; .@i<4; set .@i,.@i+1)
  184. monster strnpcinfo(2),.@treasurex[.@i],.@treasurey[.@i],"Treasure Chest",(.@i%2)?.@treasurebox:1324,1,strnpcinfo(0)+"::OnTreasureDied";
  185. for(set .@i,4; .@i<24; set .@i,.@i+1) {
  186. if (.@Treasure < .@i+1) break;
  187. monster strnpcinfo(2),.@treasurex[.@i],.@treasurey[.@i],"Treasure Chest",(.@i%2)?.@treasurebox:1324,1,strnpcinfo(0)+"::OnTreasureDied";
  188. }
  189. freeloop(0);
  190. end;
  191. OnTreasureDied:
  192. end;
  193. }
  194. // Guild Manager
  195. //============================================================
  196. - script Steward#template -1,{
  197. set .@GID, getcastledata(strnpcinfo(4),CD_GUILD_ID);
  198. if (!.@GID) {
  199. mes "[ Steward ]";
  200. mes "I await for the master";
  201. mes "whom destiny will choose";
  202. mes "for me. Do you think you";
  203. mes "have to courage and strength";
  204. mes "to conquer this stronghold?";
  205. close;
  206. }
  207. if (is_guild_leader(.@GID) == false) {
  208. mes "[ Steward ]";
  209. mes "Hmpf. Your threats don't";
  210. mes "scare me! Guardians, drive";
  211. mes "this infidel away from here!";
  212. mes "I will always be loyal to the";
  213. mes "master of this stronghold,";
  214. mes "the one and only ^FF0000"+getguildmaster(.@GID)+"^000000.";
  215. close;
  216. }
  217. mes "[ Steward ]";
  218. mes "Ah, Master ^FF0000"+getguildmaster(.@GID)+"^000000...";
  219. mes "How shall I serve you today?";
  220. mes "Was there an aspect of this";
  221. mes "stronghold's maintenance";
  222. mes "you wanted to discuss?";
  223. next;
  224. switch(select("Stronghold Briefing:Invest in Commercial Growth:Invest in Defense growth:Hire/Fire Storage Staff:Go to Master's room")) {
  225. case 1:
  226. mes "[ Steward ]";
  227. mes "The Commercial Growth";
  228. mes "Level of the stronghold is ^0000ff"+getcastledata(strnpcinfo(4),CD_CURRENT_ECONOMY)+".";
  229. if (getcastledata(strnpcinfo(4),CD_INVESTED_ECONOMY) > 0) {
  230. mes "Last time, you invested in";
  231. mes "Commercial Growth "+getcastledata(strnpcinfo(4),CD_INVESTED_ECONOMY)+".";
  232. }
  233. next;
  234. mes "[ Steward ]";
  235. mes "Our stronghold's";
  236. mes "safeguard level is "+getcastledata(strnpcinfo(4),CD_CURRENT_DEFENSE)+".";
  237. if (getcastledata(strnpcinfo(4),CD_INVESTED_DEFENSE) > 0) {
  238. mes "Last time, you invested";
  239. mes "in defense "+getcastledata(strnpcinfo(4),CD_INVESTED_DEFENSE)+" times.";
  240. }
  241. mes " ";
  242. mes "That is all, master.";
  243. close;
  244. case 2:
  245. set .@Economy,getcastledata(strnpcinfo(4),CD_CURRENT_ECONOMY);
  246. setarray .@cost[0],5000,10000,20000,35000,55000,80000,110000,145000,185000,230000,280000,335000,395000,460000,530000,605000,685000,770000,860000,955000;
  247. set .@j,0;
  248. for(set .@i,6; .@i<101; set .@i,.@i+5) {
  249. if (.@Economy < .@i) {
  250. set .@eco_invest,.@cost[.@j];
  251. break;
  252. }
  253. set .@j, .@j+1;
  254. }
  255. // Quadruple the cost of investing if you've already invested once.
  256. if (getcastledata(strnpcinfo(4),CD_INVESTED_ECONOMY)) set .@eco_invest,.@eco_invest*4;
  257. mes "[ Steward ]";
  258. mes "Raising the stronghold's";
  259. mes "commercial growth will";
  260. mes "increase the quantity of";
  261. mes "goods produced for the guild.";
  262. mes "Investing in commercial growth";
  263. mes "will help the guild's future.";
  264. next;
  265. mes "[ Steward ]";
  266. mes "You can make one investment";
  267. mes "each day, but if you can make";
  268. mes "two investments if you pay";
  269. mes "more Zeny: this will speed";
  270. mes "up commercial development,";
  271. mes "but can be quite expensive.";
  272. next;
  273. if (.@Economy == 100) {
  274. mes "[ Steward ]";
  275. mes "However, our stronghold's";
  276. mes "commerical growth level is";
  277. mes "at 100%. It's not possible to";
  278. mes "develop commercial growth";
  279. mes "any further than that.";
  280. close;
  281. }
  282. if (getcastledata(strnpcinfo(4),CD_INVESTED_ECONOMY) >= 2) {
  283. mes "[ Steward ]";
  284. mes "You've already made two";
  285. mes "investments today, so you'll";
  286. mes "have to wait until tomorrow";
  287. mes "to make another investment.";
  288. close;
  289. }
  290. if (getcastledata(strnpcinfo(4),CD_INVESTED_ECONOMY) == 0) {
  291. mes "[ Steward ]";
  292. mes "You must pay ^FF0000"+.@eco_invest+"^000000 Zeny";
  293. mes "to make an investment";
  294. mes "Will you invest in this";
  295. mes "stronghold's commerical";
  296. mes "development now?";
  297. }
  298. else {
  299. mes "[ Steward ]";
  300. mes "You must pay ^FF0000"+.@eco_invest+"^000000";
  301. mes "more Zeny to make a second";
  302. mes "investment today. Will you";
  303. mes "invest one more time?";
  304. }
  305. next;
  306. switch(select("Invest in Commercial Growth:Cancel")) {
  307. case 1:
  308. if (getcastledata(strnpcinfo(4),CD_INVESTED_ECONOMY) >= 2) {
  309. mes "[ Steward ]";
  310. mes "You've already made two";
  311. mes "investments today, so you'll";
  312. mes "have to wait until tomorrow";
  313. mes "to make another investment.";
  314. close;
  315. }
  316. if (Zeny < .@eco_invest) {
  317. mes "[ Steward ]";
  318. mes "I'm sorry, Master, but";
  319. mes "you do not have enough";
  320. mes "Zeny to make an investment";
  321. mes "for the guild today.";
  322. close;
  323. }
  324. set Zeny, Zeny-.@eco_invest;
  325. setcastledata strnpcinfo(4),CD_INVESTED_ECONOMY,getcastledata(strnpcinfo(4),CD_INVESTED_ECONOMY)+1;
  326. mes "[ Steward ]";
  327. mes "A wise use of the guild's";
  328. mes "funds, Master. We can expect";
  329. mes "to see the results of this";
  330. mes "investment by tomorrow.";
  331. close;
  332. case 2:
  333. mes "[ Steward ]";
  334. mes "As you command, Master.";
  335. close;
  336. }
  337. case 3:
  338. set .@Defence,getcastledata(strnpcinfo(4),CD_CURRENT_DEFENSE);
  339. setarray .@cost[0],10000,20000,40000,70000,110000,160000,220000,290000,370000,460000,560000,670000,790000,920000,1060000,1210000,1370000,1540000,1720000,1910000;
  340. set .@j,0;
  341. for(set .@i,6; .@i<101; set .@i,.@i+5) {
  342. if (.@Defence < .@i) {
  343. set .@def_invest,.@cost[.@j];
  344. break;
  345. }
  346. set .@j, .@j+1;
  347. }
  348. // Quadruple the cost of investing if you've already invested once.
  349. if (getcastledata(strnpcinfo(4),CD_INVESTED_DEFENSE)) set .@def_invest,.@def_invest*4;
  350. mes "[ Steward ]";
  351. mes "Investing in our stronghold's";
  352. mes "defense will enhance the";
  353. mes "durability of our Guardians";
  354. mes "and the Emperium. We'll need";
  355. mes "every advantage to protect";
  356. mes "ourselves from our enemies.";
  357. next;
  358. mes "[ Steward ]";
  359. mes "You can invest in defense";
  360. mes "once per day, but if you pay";
  361. mes "more Zeny, you can invest";
  362. mes "a maximum of two times daily.";
  363. next;
  364. mes "[ Steward ]";
  365. if (getcastledata(strnpcinfo(4),CD_CURRENT_DEFENSE) == 100) {
  366. mes "The Defense Level of this";
  367. mes "stronghold is 100%, and";
  368. mes "cannot be increased further.";
  369. close;
  370. }
  371. if (getcastledata(strnpcinfo(4),CD_INVESTED_DEFENSE) >= 2) {
  372. mes "Master, you've already";
  373. mes "invested in Defense twice";
  374. mes "today. You'll need to wait";
  375. mes "until tomorrow if you really";
  376. mes "want to increase our defenses.";
  377. close;
  378. }
  379. if (getcastledata(strnpcinfo(4),CD_INVESTED_DEFENSE) == 0) {
  380. mes "We need ^FF0000"+.@def_invest+"^000000";
  381. mes "Zeny to invest in our";
  382. mes "stronghold's defenses.";
  383. mes "Will you invest now?";
  384. }
  385. else {
  386. mes "We need ^FF0000"+.@def_invest+"^000000";
  387. mes "Zeny to invest in our";
  388. mes "stronghold's defenses";
  389. mes "a second time today.";
  390. mes "Will you invest now?";
  391. }
  392. next;
  393. switch(select("Invest in Defense:Cancel")) {
  394. case 1:
  395. if (getcastledata(strnpcinfo(4),CD_INVESTED_DEFENSE) >= 2) {
  396. mes "[ Steward ]";
  397. mes "Master, you've already";
  398. mes "invested in Defense twice";
  399. mes "today. You'll need to wait";
  400. mes "until tomorrow if you really";
  401. mes "want to increase our defenses.";
  402. close;
  403. }
  404. if (Zeny < .@def_invest) {
  405. mes "[ Steward ]";
  406. mes "I'm sorry, Master, but";
  407. mes "you do not have enough";
  408. mes "Zeny to make an investment";
  409. mes "for the guild today.";
  410. close;
  411. }
  412. set Zeny, Zeny-.@def_invest;
  413. setcastledata strnpcinfo(4),CD_INVESTED_DEFENSE,getcastledata(strnpcinfo(4),CD_INVESTED_DEFENSE)+1;
  414. mes "[ Steward ]";
  415. mes "A wise use of the guild's";
  416. mes "funds, Master. Increasing";
  417. mes "the frequency of treasure";
  418. mes "procured by the guild will";
  419. mes "definitely help us all.";
  420. close;
  421. case 2:
  422. mes "[ Steward ]";
  423. mes "As you command, Master.";
  424. close;
  425. }
  426. case 4:
  427. if (getcastledata(strnpcinfo(4),CD_ENABLED_KAFRA) == 1) {
  428. mes "[ Steward ]";
  429. mes "Do you wish to dismiss";
  430. mes "the Kafra Employee that";
  431. mes "we've hired for the guild?";
  432. next;
  433. switch(select("Dismiss:Cancel")) {
  434. case 1:
  435. cutin "kafra_01",2;
  436. mes "[ Hired Kafra Employee ]";
  437. mes "Master, please reconsider!";
  438. mes "I've been working very hard";
  439. mes "for the success of the guild!";
  440. mes "I'll try harder to serve the";
  441. mes "guild members of this";
  442. mes "stronghold, I promise!";
  443. next;
  444. switch(select("Dismiss:Cancel")) {
  445. case 1:
  446. mes "[ Hired Kafra Employee ]";
  447. mes "Why?! What have I done";
  448. mes "to deserve this? Waaah~!";
  449. next;
  450. cutin "kafra_01",255;
  451. break;
  452. case 2:
  453. mes "[ Hired Kafra Employee ]";
  454. mes "Thank you, Master!";
  455. mes "I'll obey your every";
  456. mes "command as best I can!";
  457. mes "You won't regret this!";
  458. close;
  459. }
  460. break;
  461. case 2:
  462. mes "[ Steward ]";
  463. mes "She works very hard,";
  464. mes "in my opinion. It was in";
  465. mes "all of our best interests to";
  466. mes "allow her to stay with us.";
  467. close;
  468. }
  469. disablenpc "Kafra Employee#"+strnpcinfo(2);
  470. setcastledata strnpcinfo(4),CD_ENABLED_KAFRA,0;
  471. mes "[ Steward ]";
  472. mes "That Kafra Employee";
  473. mes "has been dismissed.";
  474. mes "Were really dissatisfied";
  475. mes "by the quality of her service?";
  476. close;
  477. }
  478. else {
  479. mes "[ Steward ]";
  480. mes "Will you hire a";
  481. mes "Kafra Employee to serve";
  482. mes "our stronghold? You must";
  483. mes "pay ^FF000010,000 Zeny^000000 to hire one.";
  484. next;
  485. switch(select("Hire:Cancel")) {
  486. case 1:
  487. if (getgdskilllv(.@GID,10001) == 0) {
  488. mes "[ Steward ]";
  489. mes "Master, we cannot hire a";
  490. mes "Kafra Employee because";
  491. mes "you have not yet attained";
  492. mes "the ^FF0000Contract with Kafra^000000";
  493. mes "guild skill.";
  494. close;
  495. }
  496. if (Zeny < 10000) {
  497. mes "[ Steward ]";
  498. mes "Master, we cannot hire a";
  499. mes "Kafra Employee because";
  500. mes "we do not have enough";
  501. mes "funds to pay the contract fee.";
  502. close;
  503. }
  504. set Zeny, Zeny-10000;
  505. enablenpc "Kafra Employee#"+strnpcinfo(2);
  506. setcastledata strnpcinfo(4),CD_ENABLED_KAFRA,1;
  507. mes "[ Steward ]";
  508. mes "Very well. We have formed";
  509. mes "a contract with the Kafra";
  510. mes "Head Office, and hired a";
  511. mes "Kafra Employee for our";
  512. mes "stronghold. Here she is~";
  513. next;
  514. cutin "kafra_01",2;
  515. mes "[ Hired Kafra Employee ]";
  516. mes "How do you do? I've";
  517. mes "been dispatched by the";
  518. mes "Kafra Head Office to";
  519. mes "serve your guild's needs.";
  520. mes "I'll do my best to follow";
  521. mes "your every command, Master.";
  522. next;
  523. cutin "kafra_01",255;
  524. mes "[ Steward ]";
  525. mes "Our contract will expire";
  526. mes "after one month, so we must";
  527. mes "pay additional fees to keep";
  528. mes "this Kafra Employee in";
  529. mes "the service of our guild.";
  530. close;
  531. case 2:
  532. mes "[ Steward ]";
  533. mes "As you command, Master.";
  534. mes "However, I suggest hiring";
  535. mes "a Kafra Employee as soon";
  536. mes "as possible since our guild";
  537. mes "would greatly benefit from";
  538. mes "the convenient Kafra services.";
  539. close;
  540. }
  541. }
  542. case 5:
  543. mes "[ Steward ]";
  544. mes "Do you wish to enter the";
  545. mes "Guild Treasure Room?";
  546. mes "Only you, the Guild Master,";
  547. mes "are permitted to enter.";
  548. next;
  549. mes "[ Steward ]";
  550. mes "Please remember to open";
  551. mes "the Treasure Boxes at the";
  552. mes "proper time. Otherwise, the";
  553. mes "treasure may disappear if";
  554. mes "something unexpected happens.";
  555. next;
  556. switch(select("Go to Treasure Room:Cancel")) {
  557. case 1:
  558. mes "[ Steward ]";
  559. mes "Allow me to guide you";
  560. mes "on the secret path to";
  561. mes "the Treasure Room.";
  562. mes "Press the secret switch";
  563. mes "when you wish to return here.";
  564. close2;
  565. if (compare(strnpcinfo(4),"arug")) {
  566. if (strnpcinfo(4) == "arug_cas01") setarray .@i[0],250,363;
  567. else if (strnpcinfo(4) == "arug_cas02") setarray .@i[0],382,227;
  568. else setarray .@i[0],292,266; // Castles 3,4,5 are identical.
  569. }
  570. else {
  571. if (strnpcinfo(4) == "schg_cas02") setarray .@i[0],249,373;
  572. else if (strnpcinfo(4) == "schg_cas03") setarray .@i[0],190,16;
  573. else setarray .@i[0],381,381; // Castles 1,4,5 are identical.
  574. }
  575. warp strnpcinfo(4),.@i[0],.@i[1];
  576. end;
  577. case 2:
  578. mes "[ Steward ]";
  579. mes "Items in the Treasure Room";
  580. mes "are produced once each day.";
  581. mes "Therefore, you must obtain";
  582. mes "the treasure items everyday.";
  583. mes "For the sake of the guild,";
  584. mes "prioritize treasure harvesting!";
  585. close;
  586. }
  587. }
  588. OnStop:
  589. awake strnpcinfo(0);
  590. end;
  591. OnStartArena:
  592. set .@GID,getcharid(2);
  593. set .@region$, (compare(strnpcinfo(4),"arug"))?"Valfreyja":"Nithafjoll";
  594. // Lower castle Economy
  595. set .@Economy,getcastledata(strnpcinfo(4),CD_CURRENT_ECONOMY)-5;
  596. if (.@Economy < 0) set .@Economy, 0;
  597. setcastledata strnpcinfo(4),CD_CURRENT_ECONOMY,.@Economy;
  598. // Lower Castle Defence
  599. set .@Defence,getcastledata(strnpcinfo(4),CD_CURRENT_DEFENSE)-5;
  600. if (.@Defence < 0) set .@Defence, 0;
  601. setcastledata strnpcinfo(4),CD_CURRENT_DEFENSE,.@Defence;
  602. // Set new owner
  603. setcastledata strnpcinfo(4),CD_GUILD_ID,.@GID;
  604. // Clear castle's data.
  605. for(set .@i,CD_INVESTED_ECONOMY; .@i<CD_ENABLED_GUARDIAN00; set .@i,.@i+1)
  606. setcastledata strnpcinfo(4),.@i,0;
  607. // Disable Kafra
  608. disablenpc "Kafra Employee#"+strnpcinfo(2);
  609. announce "The ["+getguildname(.@GID)+"] guild conquered the ["+.@region$+" "+charat(strnpcinfo(2),3)+"] stronghold of "+getcastlename(strnpcinfo(4))+"!",bc_all|bc_woe;
  610. mapannounce strnpcinfo(4),"The emperium has been shattered!",bc_map,"0x00FF00",FW_NORMAL,20,0,40;
  611. donpcevent "Manager#"+strnpcinfo(4)+"::OnReset";
  612. maprespawnguildid strnpcinfo(4),getcastledata(strnpcinfo(4),CD_GUILD_ID),2;
  613. donpcevent "Manager#"+strnpcinfo(4)+"::OnRecvCastle2";
  614. donpcevent "::OnRecvCastle"+strnpcinfo(2);
  615. sleep 10000;
  616. if (agitcheck2()) {
  617. donpcevent "Manager#"+strnpcinfo(4)+"::OnChange";
  618. mapannounce strnpcinfo(4),"Rebuild this stronghold's Guardian Stones and Fortress Gates to secure your guild's new aquisition!",bc_map,"0x00FF00",FW_NORMAL,20,0,40;
  619. }
  620. end;
  621. }
  622. // Castle Guardians
  623. //============================================================
  624. - script Guardian#template -1,{
  625. set .@GID, getcastledata(strnpcinfo(4),CD_GUILD_ID);
  626. set .@n$, "["+strnpcinfo(1)+"]";
  627. if (!.@GID) {
  628. mes .@n$;
  629. mes "Great job. Now, all you";
  630. mes "need to do is destroy this";
  631. mes "Emperium to gain ownership";
  632. mes "over this stronghold.";
  633. close;
  634. }
  635. if (getcharid(2) == .@GID) {
  636. if (is_guild_leader() == false) {
  637. mes .@n$;
  638. mes "As guardian of this";
  639. mes "stronghold, I answer only";
  640. mes "to the master of the guild";
  641. mes "that controls this place.";
  642. close;
  643. }
  644. else {
  645. if (!agitcheck2()) {
  646. mes .@n$;
  647. mes "I am "+strnpcinfo(1)+", guardian of";
  648. mes "this stronghold. For now,";
  649. mes "all is quiet in this place.";
  650. next;
  651. switch(select("Converse:Cancel")) {
  652. case 1:
  653. mes .@n$;
  654. mes "Do you have any questions";
  655. mes "about this stronghold?";
  656. next;
  657. switch(select("Guardian Stones:Fortress Gates:Link Flags:Battle Strategy:Cancel")) {
  658. case 1:
  659. mes .@n$;
  660. mes "There is one Emperium";
  661. mes "and two Guardian Stones in";
  662. mes "each fortress. These stones";
  663. mes "are the first line of defense,";
  664. mes "and must be destroyed before";
  665. mes "enemies can even enter.";
  666. next;
  667. mes .@n$;
  668. mes "The stones are located in";
  669. mes "^4D4DFFGate Houses^000000 which must be";
  670. mes "protected to prevent enemies";
  671. mes "from reaching the Emperium.";
  672. mes "Guardian Stones can ^4D4DFFrecall";
  673. mes "your Guardians^000000 for protection.";
  674. next;
  675. mes .@n$;
  676. mes "Fortresses with higher levels";
  677. mes "of defense can summon more";
  678. mes "Guardians: this is why it is";
  679. mes "so important for guilds to";
  680. mes "invest in Defense Growth.";
  681. next;
  682. mes .@n$;
  683. mes "Guardian Stones that have";
  684. mes "been destroyed can be revived";
  685. mes "after a certain time, but one of the guild members must give";
  686. mes "me the order. I can also report the status of the Guardian Stones.";
  687. close;
  688. case 2:
  689. mes .@n$;
  690. mes "^4D4DFFFortress Gates^000000 are the second line of guild stronghold defense,";
  691. mes "and are protected by extra barricades activated by the Guardian Stones.";
  692. mes "These gates are located in three different parts of the fortress.";
  693. next;
  694. mes .@n$;
  695. mes "Barricades are protected by";
  696. mes "Guardian Stones, and are";
  697. mes "restored when the Guardian";
  698. mes "Stones are retrieved. However,";
  699. mes "it is not as easy to restore";
  700. mes "destroyed Fortress Gates.";
  701. next;
  702. mes .@n$;
  703. mes "Fortress Gates can only be";
  704. mes "restored when the ^4D4DFFguild";
  705. mes "master of a stronghold";
  706. mes "changes^000000, or if ^4D4DFFrestoration";
  707. mes "is requested by the guild";
  708. mes "master of the stronghold^000000.";
  709. close;
  710. case 3:
  711. mes .@n$;
  712. mes "Strongholds have many";
  713. mes "Link Flags that allow you";
  714. mes "to access vital areas within";
  715. mes "restrictions placed by the";
  716. mes "Barricades. Usually, ^4D4DFFFlag 1";
  717. mes "links to the Gate House^000000.";
  718. next;
  719. mes .@n$;
  720. mes "Many flags link directly to";
  721. mes "the flag near the Emperium.";
  722. mes "The final numbered flag is";
  723. mes "linked to the Convenience";
  724. mes "Facility of the stronghold's";
  725. mes "owner. Keep this in mind.";
  726. close;
  727. case 4:
  728. mes .@n$;
  729. mes "Strategy? It would be better";
  730. mes "to develop your battle plan to";
  731. mes "exploit your guild's advantages";
  732. mes "and your enemies' weaknesses.";
  733. mes "Use the Gate Houses and Barricades, and rebuild as quickly as you can!";
  734. close;
  735. case 5:
  736. mes .@n$;
  737. mes "You have no questions";
  738. mes "to ask of me? Well, I'm";
  739. mes "here to serve your needs.";
  740. close;
  741. }
  742. case 2:
  743. mes .@n$;
  744. mes "I'm always here, so";
  745. mes "feel free to request my";
  746. mes "assistance whenever";
  747. mes "the need arises.";
  748. close;
  749. }
  750. }
  751. else {
  752. mes .@n$;
  753. mes "Greetings, "+strcharinfo(0)+".";
  754. mes "What are your orders?";
  755. next;
  756. switch(select("Increase Stronghold Defense:Situational Briefing:Cancel")) {
  757. case 1:
  758. if (!getd("$agit_"+strnpcinfo(2)+"[5]")) {
  759. if (getgdskilllv(.@GID,10002) == 0) {
  760. mes .@n$;
  761. mes "I'm sorry, but the Guardian";
  762. mes "Stones aren't powerful enough";
  763. mes "to summon Guardians yet. We";
  764. mes "need to accumulate more";
  765. mes "knowledge before they can";
  766. mes "summon any Guardians.";
  767. close;
  768. }
  769. else {
  770. mes .@n$;
  771. mes "I shall endeavor to summon";
  772. mes "a Guardian through a Guardian";
  773. mes "Stone. However, keep in mind";
  774. mes "that this will not work if the";
  775. mes "Guardian Stone is destroyed.";
  776. setd "$agit_"+strnpcinfo(2)+"[5]",1;
  777. if (!getd("$agit_"+strnpcinfo(2)+"[0]"))
  778. donpcevent "gard1#"+strnpcinfo(4)+"::OnEnable";
  779. if (!getd("$agit_"+strnpcinfo(2)+"[1]"))
  780. donpcevent "gard2#"+strnpcinfo(4)+"::OnEnable";
  781. close;
  782. }
  783. }
  784. else {
  785. mes .@n$;
  786. mes "You've already commanded";
  787. mes "me to summon a Guardian";
  788. mes "to defend the stronghold.";
  789. close;
  790. }
  791. case 2:
  792. mes .@n$;
  793. mes "Our defense status is...";
  794. setarray .@status$[0],"^4D4DFFOperational","^FF0000Destroyed","^008000Repairing";
  795. mes "1st Guardian Stone: "+.@status$[getd("$agit_"+strnpcinfo(2)+"[0]")]+"^000000";
  796. mes "2nd Guardian Stone: "+.@status$[getd("$agit_"+strnpcinfo(2)+"[1]")]+"^000000";
  797. mes "1st Fortress Gate: "+.@status$[getd("$agit_"+strnpcinfo(2)+"[2]")]+"^000000";
  798. mes "2nd Fortress Gate: "+.@status$[getd("$agit_"+strnpcinfo(2)+"[3]")]+"^000000";
  799. mes "3rd Fortress Gate: "+.@status$[getd("$agit_"+strnpcinfo(2)+"[4]")]+"^000000";
  800. close;
  801. case 3:
  802. mes .@n$;
  803. mes "I'll be standing by,";
  804. mes "awaiting your orders.";
  805. close;
  806. }
  807. }
  808. }
  809. }
  810. else {
  811. mes .@n$;
  812. mes "Who are you? Scoundrel!";
  813. mes "Leave this stronghold now!";
  814. close;
  815. }
  816. OnInit:
  817. setarray getd("$agit_"+strnpcinfo(2)+"[0]"),0,0,0,0,0,0;
  818. end;
  819. }
  820. // Guild Kafras
  821. //============================================================
  822. - script Kafra#template -1,{
  823. cutin "kafra_01",2;
  824. set .@GID, getcastledata(strnpcinfo(4),CD_GUILD_ID);
  825. if (getcharid(2) == .@GID && getgdskilllv(.@GID,10001)) {
  826. mes "[Kafra Employee]";
  827. mes "Welcome, proud member";
  828. mes "of the ^FF0000"+GetGuildName(.@GID)+"^000000 Guild!";
  829. mes "The Kafra Corporation is ready";
  830. mes "to assist you wherever you go!";
  831. next;
  832. switch(select("Use Storage:Use Warp Service:Rent Pushcart:Cancel")) {
  833. case 1:
  834. if(!callfunc("F_CanOpenStorage")){
  835. mes "[Kafra Employee]";
  836. mes "I'm so sorry, but you must";
  837. mes "have at least Novice Skill";
  838. mes "Lv.6 to use the Storage.";
  839. }
  840. else openstorage;
  841. break;
  842. case 2:
  843. mes "[Kafra Employee]";
  844. mes "Please tell me your";
  845. mes "Warp destination.";
  846. next;
  847. switch(select("Rachel -> 200 z:Cancel")) {
  848. case 1:
  849. if (Zeny < 200) {
  850. mes "[Kafra Employee]";
  851. mes "I'm sorry, but you don't";
  852. mes "have enough Zeny to pay";
  853. mes "the warp fee. Would you";
  854. mes "please check your funds again?";
  855. close2;
  856. cutin "kafra_01",255;
  857. end;
  858. }
  859. set Zeny, Zeny-200;
  860. warp "rachel",115,125;
  861. end;
  862. case 2:
  863. cutin "kafra_01",255;
  864. break;
  865. }
  866. break;
  867. case 3:
  868. if (BaseClass != Job_Merchant) {
  869. mes "[Kafra Employee]";
  870. mes "I'm sorry, but the Pushcart";
  871. mes "rental service can only be";
  872. mes "used by Merchant, Blacksmith,";
  873. mes "and Alchemist class characters.";
  874. }
  875. else if (checkcart() == 1) {
  876. mes "[Kafra Employee]";
  877. mes "Hm? You've already";
  878. mes "rented a Pushcart.";
  879. }
  880. else {
  881. mes "[Kafra Employee]";
  882. mes "The Pushcart rental fee";
  883. mes "is 800 Zeny. Would you";
  884. mes "like to rent a Pushcart?";
  885. next;
  886. switch(select("Rent Pushcart:Cancel")) {
  887. case 1:
  888. if (Zeny < 800) {
  889. mes "[Kafra Employee]";
  890. mes "I'm sorry, but you don't";
  891. mes "have enough Zeny to rent";
  892. mes "one of our Pushcarts.";
  893. close2;
  894. cutin "kafra_01",255;
  895. end;
  896. }
  897. set Zeny, Zeny-800;
  898. setcart;
  899. break;
  900. case 2:
  901. break;
  902. }
  903. }
  904. break;
  905. case 4:
  906. mes "[Kafra Employee]";
  907. mes "Thank you for using the";
  908. mes "Kafra Service. Wherever";
  909. mes "you go, Kafra will be";
  910. mes "there to support you!";
  911. close2;
  912. cutin "kafra_01",255;
  913. end;
  914. }
  915. close2;
  916. cutin "kafra_01",255;
  917. end;
  918. }
  919. else {
  920. mes "[Kafra Employee]";
  921. mes "I'm sorry, but I've been";
  922. mes "exclusively contracted";
  923. mes "to the members of the";
  924. mes "^FF0000"+getguildname(.@GID)+"^000000 Guild.";
  925. mes "You'll have to ask another";
  926. mes "Kafra Employee to help you...";
  927. close2;
  928. cutin "kafra_01",255;
  929. end;
  930. }
  931. }
  932. // Guardian Stones (2)
  933. //============================================================
  934. - script Guardian Stone#template -1,{
  935. set .@GID, getcastledata(strnpcinfo(4),CD_GUILD_ID);
  936. set .@num, atoi(charat(strnpcinfo(1),0));
  937. set .@var$,"$agit_"+strnpcinfo(2);
  938. if (getcharid(2) == .@GID) {
  939. mes "^3355FFYou will need the";
  940. mes "following materials to";
  941. mes "rebuild a destroyed";
  942. mes "Guardian Stone.^000000";
  943. next;
  944. mes "1 Oridecon";
  945. mes "1 Elunium";
  946. mes "30 Stones";
  947. mes "5 Blue Gemstones";
  948. mes "5 Yellow Gemstones";
  949. mes "5 Red Gemstones";
  950. next;
  951. mes "^3355FFDo you want to continue?^000000";
  952. next;
  953. if(select("No:Continue") == 1) {
  954. mes "^3355FFWork canceled.^000000";
  955. close;
  956. }
  957. if ((countitem(984) > 0) && (countitem(985) > 0) && (countitem(7049) > 29) && (countitem(717) > 4) && (countitem(715) > 4) && (countitem(716) > 4)) {
  958. mes "^3355FFArrange Stones, Elunium, and";
  959. mes "Oridecon, in that order, in the";
  960. mes "center. Then you must arrange";
  961. mes "the enchanted Gemstones to";
  962. mes "rebuild the Guardian Stone.^000000";
  963. next;
  964. setarray .@stone$[0],"Elunium","Oridecon","Stones";
  965. set .@i, select("Elunium:Oridecon:Stone")-1;
  966. if (.@i == 2) set .@nice,.@nice+10;
  967. mes "^3355FF"+.@stone$[.@i]+" has been";
  968. mes "placed in the center.^000000";
  969. next;
  970. set .@i, select("Elunium:Oridecon:Stone")-1;
  971. if (.@i == 0) set .@nice,.@nice+10;
  972. mes "^3355FFYou have lined the";
  973. mes "outside of the center";
  974. mes "with some "+.@stone$[.@i]+".^000000";
  975. next;
  976. set .@i, select("Elunium:Oridecon:Stone")-1;
  977. if (.@i == 1) set .@nice,.@nice+10;
  978. mes "^3355FFYou covered the";
  979. mes "rest of the materials";
  980. mes "with some "+.@stone$[.@i]+".^000000";
  981. next;
  982. mes "^3355FFNow you need to arrange";
  983. mes "the enchanted Gemstones";
  984. mes "accordingly. You can identify";
  985. mes "their Magic properties by";
  986. mes "their casting effect.^000000";
  987. next;
  988. setarray .@effect[0],EF_BEGINSPELL4,EF_BEGINSPELL2,EF_VOLCANO;
  989. setarray .@color$[0],"Red","Yellow","Blue";
  990. while(1) {
  991. if (.@roof0 > 7) break;
  992. set .@i, rand(getarraysize(.@effect));
  993. specialeffect .@effect[.@i];
  994. mes "^3355FFThe Gemstones must";
  995. mes "be arranged in the correct";
  996. mes "order according to their";
  997. mes "magic properties and power.^000000";
  998. next;
  999. set .@j, select("Red Gemstone:Yellow Gemstone:Blue Gemstone")-1;
  1000. mes "^3355FFYou placed the "+.@color$[.@j]+" Gemstone.^000000";
  1001. if (.@i == .@j) {
  1002. mes "^3355FFHowever, the Guardian Stone";
  1003. mes "Repair System failed because";
  1004. mes "of a magic power conflict.^000000";
  1005. close;
  1006. }
  1007. set .@nice,.@nice+10;
  1008. set .@roof0,.@roof0+1;
  1009. specialeffect EF_STEAL;
  1010. next;
  1011. }
  1012. if (.@nice > 90) {
  1013. if (!getd(.@var$+"["+(.@num-1)+"]")) {
  1014. mes "^3355FFThe Guardian Stone";
  1015. mes "Repair System has";
  1016. mes "already completed.^000000";
  1017. close;
  1018. }
  1019. else {
  1020. if (!agitcheck2()) {
  1021. mes "^3355FFIt is impossible to";
  1022. mes "rebuild the Guardian";
  1023. mes "Stone because the";
  1024. mes "Emperium is not present.^000000";
  1025. close;
  1026. }
  1027. else {
  1028. mes "^3355FFThe Gemstones have been";
  1029. mes "arranged, and the Guardian";
  1030. mes "Stone is successfully repaired.^000000";
  1031. delitem 984,1; //Oridecon
  1032. delitem 985,1; //Elunium
  1033. delitem 7049,30; //Stone
  1034. delitem 717,5; //Blue_Gemstone
  1035. delitem 715,5; //Yellow_Gemstone
  1036. delitem 716,5; //Red_Gemstone
  1037. close2;
  1038. donpcevent "df"+.@num+"#"+strnpcinfo(4)+"::OnEnable";
  1039. specialeffect EF_ICECRASH;
  1040. disablenpc strnpcinfo(0);
  1041. setd .@var$+"["+(.@num-1)+"]",0;
  1042. set .@df_all,getd(.@var$+"[0]")+getd(.@var$+"[1]");
  1043. if (!.@df_all) {
  1044. mapannounce strnpcinfo(4),"Both Guardian Stones have been erected, bolstering this stronghold's defenses!",bc_map,"0x00ff00";
  1045. donpcevent "RL0#"+strnpcinfo(4)+"::OnEnable";
  1046. }
  1047. else mapannounce strnpcinfo(4),"The "+strnpcinfo(1)+" has been repaired successfully.",bc_map,"0x00ff00";
  1048. if (getd(.@var$+"[5]") == 1)
  1049. donpcevent "gard"+.@num+"#"+strnpcinfo(4)+"::OnEnable";
  1050. end;
  1051. }
  1052. }
  1053. }
  1054. else {
  1055. mes "^3355FFAfter all of that work...";
  1056. mes "It looks like you failed";
  1057. mes "to fix the Guardian Stone,";
  1058. mes "and lost some materials.^000000";
  1059. delitem 7049,10; //Stone
  1060. delitem 717,2; //Blue_Gemstone
  1061. delitem 715,2; //Yellow_Gemstone
  1062. delitem 716,2; //Red_Gemstone
  1063. close;
  1064. }
  1065. }
  1066. else {
  1067. mes "^3355FFYou don't have enough";
  1068. mes "materials to repair";
  1069. mes "the Guardian Stone.^000000";
  1070. close;
  1071. }
  1072. }
  1073. end;
  1074. OnInit:
  1075. OnDisable:
  1076. disablenpc strnpcinfo(0);
  1077. end;
  1078. OnEnable:
  1079. enablenpc strnpcinfo(0);
  1080. specialeffect EF_MAPPILLAR2;
  1081. end;
  1082. }
  1083. // Control Devices (3)
  1084. //============================================================
  1085. - script Control#template -1,{
  1086. set .@GID, getcastledata(strnpcinfo(4),CD_GUILD_ID);
  1087. set .@num, atoi(charat(strnpcinfo(1),15));
  1088. set .@var$,"$agit_"+strnpcinfo(2);
  1089. if (getcharid(2) == .@GID) {
  1090. if (is_guild_leader() == true) {
  1091. if (getd(.@var$+"["+(.@num+1)+"]") == 2) {
  1092. mes "^3355FFDemolished Fortress";
  1093. mes "Gates can be repaired,";
  1094. mes "but you will need to gather";
  1095. mes "the following materials.^000000";
  1096. next;
  1097. mes "^4D4DFF10 Steel^000000,";
  1098. mes "^4D4DFF30 Trunks^000000,";
  1099. mes "^4D4DFF5 Oridecon^000000, and";
  1100. mes "^4D4DFF10 Emveretarcon^000000.";
  1101. next;
  1102. select("Continue");
  1103. if ((countitem(1019) > 29) && (countitem(999) > 9) && (countitem(1011) > 9) && (countitem(984) > 4)) {
  1104. mes "^3355FFYou will need Trunks to";
  1105. mes "repair the support frame,";
  1106. mes "Oridecon to enhance the";
  1107. mes "gate's endurance, and";
  1108. mes "Emveretarcon to basically";
  1109. mes "hold everything together.^000000";
  1110. next;
  1111. set .@ro_of01,rand(10,15);
  1112. while(1) {
  1113. if (.@ro_of02 == .@ro_of01) break;
  1114. else {
  1115. switch(rand(1,4)) {
  1116. case 1:
  1117. mes "^3355FFThe support frame";
  1118. mes "is badly damaged:";
  1119. mes "fixing this part";
  1120. mes "is a top priority.^000000";
  1121. next;
  1122. switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
  1123. case 1:
  1124. mes "^3355FFThe frame has been";
  1125. mes "reinforced with wood.^000000";
  1126. set .@rp_temp,.@rp_temp+1;
  1127. set .@ro_of02,.@ro_of02+1;
  1128. specialeffect2 EF_REPAIRWEAPON;
  1129. next;
  1130. break;
  1131. case 2:
  1132. mes "^3355FFYou tried using steel,";
  1133. mes "but it's not working very";
  1134. mes "well. You'll have to try";
  1135. mes "something else.^000000";
  1136. close;
  1137. case 3:
  1138. mes "^3355FFYou tried using emveretarcon";
  1139. mes "to reinforce the gate, but it's";
  1140. mes "not working well at all.";
  1141. mes "You'll have to start over.^000000";
  1142. close;
  1143. case 4:
  1144. mes "^3355FFYou tried using oridecon,";
  1145. mes "but it's not working very";
  1146. mes "well. You'll have to try";
  1147. mes "something else.^000000";
  1148. close;
  1149. }
  1150. break;
  1151. case 2:
  1152. mes "^3355FFIt looks like the gate's";
  1153. mes "overall endurance needs to";
  1154. mes "be reinforced with something.^000000";
  1155. next;
  1156. switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
  1157. case 1:
  1158. mes "^3355FFYou tried using wood";
  1159. mes "to reinforce the gate.^000000";
  1160. set .@ro_of02,.@ro_of02+1;
  1161. next;
  1162. break;
  1163. case 2:
  1164. mes "^3355FFYou tried using steel";
  1165. mes "to reinforce the gate, but";
  1166. mes "it's not working well at all.";
  1167. mes "You'll have to start over.^000000";
  1168. close;
  1169. case 3:
  1170. mes "^3355FFYou tried using emveretarcon";
  1171. mes "to reinforce the gate, but it's";
  1172. mes "not working well at all.";
  1173. mes "You'll have to start over.^000000";
  1174. close;
  1175. case 4:
  1176. mes "^3355FFYou hammered the";
  1177. mes "oridecon: it looks";
  1178. mes "like this will work.^000000";
  1179. set .@rp_temp,.@rp_temp+1;
  1180. set .@ro_of02,.@ro_of02+1;
  1181. specialeffect2 EF_REPAIRWEAPON;
  1182. next;
  1183. break;
  1184. }
  1185. break;
  1186. case 3:
  1187. mes "^3355FFThe damage to the gate";
  1188. mes "has caused all these";
  1189. mes "cracks. You'll have to";
  1190. mes "weld them solid somehow.^000000";
  1191. next;
  1192. switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
  1193. case 1:
  1194. mes "^3355FFYou tried using wood to fix";
  1195. mes "this problem, but it seems";
  1196. mes "to have made it worse.";
  1197. mes "You'll have to start all over.^000000";
  1198. close;
  1199. case 2:
  1200. mes "^3355FFYou used steel to weld";
  1201. mes "all the cracks: the gate is";
  1202. mes "is starting to look more solid.^000000";
  1203. set .@rp_temp,.@rp_temp+1;
  1204. set .@ro_of02,.@ro_of02+1;
  1205. specialeffect2 EF_REPAIRWEAPON;
  1206. next;
  1207. break;
  1208. case 3:
  1209. mes "^3355FFYou tried using emveretarcon";
  1210. mes "to reinforce the gate, but it's";
  1211. mes "not working well at all.";
  1212. mes "You'll have to start over.^000000";
  1213. close;
  1214. case 4:
  1215. mes "^3355FFYou tried using oridecon,";
  1216. mes "but it's not working very";
  1217. mes "well. You'll have to try";
  1218. mes "something else.^000000";
  1219. close;
  1220. }
  1221. break;
  1222. case 4:
  1223. mes "^3355FFNow you need to make";
  1224. mes "sure that the gate is held";
  1225. mes "together pretty solidly.^000000";
  1226. next;
  1227. switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
  1228. case 1:
  1229. mes "^3355FFYou tried using wood to fix";
  1230. mes "this problem, but it seems";
  1231. mes "to have made it worse.";
  1232. mes "You'll have to start all over.^000000";
  1233. close;
  1234. case 2:
  1235. mes "^3355FFYou tried using steel,";
  1236. mes "but it's not working very";
  1237. mes "well. You'll have to try";
  1238. mes "something else.^000000";
  1239. close;
  1240. case 3:
  1241. mes "^3355FFYou successfully used";
  1242. mes "the emveretarcon to repair";
  1243. mes "much of the gate's damage.^000000";
  1244. set .@rp_temp,.@rp_temp+1;
  1245. set .@ro_of02,.@ro_of02+1;
  1246. specialeffect2 EF_REPAIRWEAPON;
  1247. next;
  1248. break;
  1249. case 4:
  1250. mes "^3355FFYou tried using oridecon,";
  1251. mes "but it's not working very";
  1252. mes "well. You'll have to try";
  1253. mes "something else.^000000";
  1254. close;
  1255. }
  1256. }
  1257. }
  1258. }
  1259. mes "^3355FFWell, it looks like";
  1260. mes "you're just about done";
  1261. mes "with repairing the gate.^000000";
  1262. next;
  1263. if (!agitcheck2()) {
  1264. mes "^3355FFUnfortunately, the Fortress";
  1265. mes "Gate can't be reconstructed:";
  1266. mes "the Emperium is no longer here.^000000";
  1267. close;
  1268. }
  1269. else {
  1270. if (.@rp_temp == .@ro_of01) {
  1271. mes "^3355FFThe Fortress Gate has";
  1272. mes "been successfully repaired!^000000";
  1273. delitem 1019,30; //Wooden_Block
  1274. delitem 999,10; //Steel
  1275. delitem 1011,10; //Emveretarcon
  1276. delitem 984,5; //Oridecon
  1277. close2;
  1278. donpcevent "RL"+.@num+"#"+strnpcinfo(4)+"::OnEnable";
  1279. disablenpc strnpcinfo(0);
  1280. if (.@num == 1) set .@str$,"1st";
  1281. else if (.@num == 2) set .@str$,"2nd";
  1282. else if (.@num == 3) set .@str$,"3rd";
  1283. mapannounce strnpcinfo(4),"The "+.@str$+" Fortress Gate has been reconstructed!",bc_map,"0x00ff00";
  1284. if (.@num == 1) setd .@var$+"[2]",0;
  1285. else {
  1286. setarray getd(.@var$+"["+.@num+"]"),2,0;
  1287. donpcevent "Control Device0"+(.@num-1)+"#"+strnpcinfo(2)+"::OnEnable";
  1288. }
  1289. end;
  1290. }
  1291. else {
  1292. mes "^3355FFThe wall has been breached,";
  1293. mes "and the attempt to repair the";
  1294. mes "Fortress Gate has failed.";
  1295. mes "You lost some of your";
  1296. mes "repair resources...^000000";
  1297. delitem 984,2; //Oridecon
  1298. delitem 999,4; //Steel
  1299. delitem 1019,14; //Wooden_Block
  1300. delitem 1011,3; //Emveretarcon
  1301. close;
  1302. }
  1303. }
  1304. }
  1305. else {
  1306. mes "^3355FFYou can't attempt to repair";
  1307. mes "the Fortress Gate if you don't";
  1308. mes "have all the needed materials.^000000";
  1309. close;
  1310. }
  1311. }
  1312. }
  1313. }
  1314. end;
  1315. OnInit:
  1316. OnDisable:
  1317. disablenpc strnpcinfo(0);
  1318. end;
  1319. OnEnable:
  1320. enablenpc strnpcinfo(0);
  1321. end;
  1322. }
  1323. // Guardian Summoners (2)
  1324. //============================================================
  1325. - script gard#template -1,{
  1326. OnEnable:
  1327. // .@x[i],.@y[i]: Normal coordinates, #0-21.
  1328. // .@w[x],.@w[y]: Special coordinates if 'defence' is under 11.
  1329. if (compare(strnpcinfo(2),"arug")) {
  1330. if (strnpcinfo(2) == "arug_cas01") {
  1331. setarray .@w[0],195,250,292,188;
  1332. setarray .@x[0],233,252,232,201,224,196,269,252,201,224,222, 294,256,240,246,235,235,246,240,256,254,242;
  1333. setarray .@y[0], 83, 81,108,130,168,137, 89, 81,130,168,129, 210,203,133, 92,132,132, 92,133,203, 95,151;
  1334. }
  1335. else if (strnpcinfo(2) == "arug_cas02") {
  1336. setarray .@w[0],20,169,268,169;
  1337. setarray .@x[0],104,67,67,113,122,67, 90, 91,122, 20,67, 175,204,211,209,161,186,183,150,161,209,211;
  1338. setarray .@y[0], 32,36,85, 87,112,60,167,119,112,169,85, 31, 32, 63, 88, 91,170,121,110, 91, 88, 63;
  1339. }
  1340. else { // Castles 3,4,5 are identical.
  1341. setarray .@w[0],66,157,211,159;
  1342. setarray .@x[0],130,128,128,128,110,91,65, 65,110,128,128, 156,172,154,156,155,187,212,211,155,156,172;
  1343. setarray .@y[0], 60, 77, 90,100, 96,53,71,103, 96,100, 77, 101, 95, 90, 77, 60, 54, 67,105, 60, 77, 95;
  1344. }
  1345. }
  1346. else {
  1347. if (strnpcinfo(2) == "schg_cas02") {
  1348. setarray .@w[0],337,95,307,222;
  1349. setarray .@x[0],326,337,334,296,285,236,285,296,334,337,334, 359,300,337,317,307,300,337,317,307,359,236;
  1350. setarray .@y[0], 83, 95,119, 82, 40, 41, 40, 82,119, 95,119, 85,119,154,183,222,119,154,183,222, 85, 41;
  1351. }
  1352. else if (strnpcinfo(2) == "schg_cas03") {
  1353. setarray .@w[0],306,325,364,305;
  1354. setarray .@x[0],323,273,288,306,323,323,273,288,306,273,273, 338,364,365,317,338,338,364,365,317,364,329;
  1355. setarray .@y[0],308,309,306,326,308,308,309,306,325,309,309, 309,305,261,318,310,309,305,261,318,305,314;
  1356. }
  1357. else { // Castles 1,4,5 are identical.
  1358. setarray .@w[0],108,32,128,42,187,15; // Contains an extra pair, for whatever reason.
  1359. setarray .@x[0],111,109,65,110,88,64,47,109,111,112,120, 130,129,151,187,128,152,187,128,130,130,151;
  1360. setarray .@y[0], 18, 44,22, 40,20,40,43, 48, 18, 32, 37, 22, 47, 18, 15, 42, 43, 15, 42, 22, 28, 18;
  1361. }
  1362. }
  1363. if (charat(strnpcinfo(1),4) == "2") set .@z,11;
  1364. freeloop(1);
  1365. set .@defence,getcastledata(strnpcinfo(2),CD_CURRENT_DEFENSE);
  1366. callsub OnSummon,.@z;
  1367. if (.@defence > 70) set getd(".MyMobCount_"+charat(strnpcinfo(1),4)+strnpcinfo(2)),5;
  1368. else if (.@defence > 50) set getd(".MyMobCount_"+charat(strnpcinfo(1),4)+strnpcinfo(2)),4;
  1369. else if (.@defence > 30) set getd(".MyMobCount_"+charat(strnpcinfo(1),4)+strnpcinfo(2)),3;
  1370. else if (.@defence > 10) set getd(".MyMobCount_"+charat(strnpcinfo(1),4)+strnpcinfo(2)),2;
  1371. if (.@w[4] && .@z)
  1372. guardian strnpcinfo(2),.@w[4],.@w[5],"Guardian Soldier",1899,strnpcinfo(0)+"::OnGuardianDied";
  1373. else if (.@defence < 11) {
  1374. set getd(".MyMobCount_"+charat(strnpcinfo(1),4)+strnpcinfo(2)),2;
  1375. set .@i,(.@z)?2:0;
  1376. guardian strnpcinfo(2),.@w[.@i],.@w[.@i+1],"Guardian Soldier",1899,strnpcinfo(0)+"::OnGuardianDied";
  1377. }
  1378. else for(set .@i,1; .@i<getd(".MyMobCount_"+charat(strnpcinfo(1),4)+strnpcinfo(2)); set .@i,.@i+1)
  1379. callsub OnSummon,.@i+.@z;
  1380. freeloop(0);
  1381. copyarray getd(".x_"+strnpcinfo(2)+"[0]"),.@x[0],22;
  1382. copyarray getd(".y_"+strnpcinfo(2)+"[0]"),.@y[0],22;
  1383. setd ".timer_"+charat(strnpcinfo(1),4)+strnpcinfo(2),4+.@z;
  1384. setarray .count$[5],"1st","2nd","3rd","4th","5th";
  1385. initnpctimer;
  1386. end;
  1387. OnTimer300000:
  1388. OnTimer900000:
  1389. OnTimer1800000:
  1390. OnTimer2700000:
  1391. OnTimer3600000:
  1392. if (charat(strnpcinfo(1),4) == "2") end;
  1393. set .@var$,".timer_"+charat(strnpcinfo(1),4)+strnpcinfo(2);
  1394. setd .@var$, getd(.@var$)+1;
  1395. set getd(".MyMobCount_"+charat(strnpcinfo(1),4)+strnpcinfo(2)),getd(".MyMobCount_"+charat(strnpcinfo(1),4)+strnpcinfo(2))+1;
  1396. callsub OnSummon,getd(.@var$);
  1397. setarray .count$[5],"1st","2nd","3rd","4th","5th";
  1398. mapannounce strnpcinfo(2),"The "+.count$[getd(.@var$)]+" Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
  1399. if (getd(.@var$) == 9) {
  1400. setd .@var$,0;
  1401. stopnpctimer;
  1402. }
  1403. end;
  1404. OnTimer600000:
  1405. OnTimer1200000:
  1406. OnTimer2100000:
  1407. OnTimer3000000:
  1408. OnTimer3900000:
  1409. if (!(charat(strnpcinfo(1),4) == "2")) end;
  1410. set .@var$,".timer_"+charat(strnpcinfo(1),4)+strnpcinfo(2);
  1411. setd .@var$, getd(.@var$)+1;
  1412. set getd(".MyMobCount_"+charat(strnpcinfo(1),4)+strnpcinfo(2)),getd(".MyMobCount_"+charat(strnpcinfo(1),4)+strnpcinfo(2))+1;
  1413. callsub OnSummon,getd(.@var$);
  1414. if (getd(.@var$) == 20) {
  1415. setd .@var$,0;
  1416. stopnpctimer;
  1417. }
  1418. end;
  1419. OnSummon:
  1420. guardian strnpcinfo(2),getd(".x_"+strnpcinfo(2)+"["+getarg(0)+"]"),getd(".y_"+strnpcinfo(2)+"["+getarg(0)+"]"),"Guardian Soldier",1899,strnpcinfo(0)+"::OnGuardianDied";
  1421. return;
  1422. OnGuardianDied:
  1423. if (charat(strnpcinfo(1),4) == "2") set .@z,11;
  1424. set getd(".MyMobCount_"+charat(strnpcinfo(1),4)+strnpcinfo(2)),getd(".MyMobCount_"+charat(strnpcinfo(1),4)+strnpcinfo(2))-1;
  1425. if (getd(".MyMobCount_"+charat(strnpcinfo(1),4)+strnpcinfo(2)) < 2) {
  1426. set getd(".MyMobCount_"+charat(strnpcinfo(1),4)+strnpcinfo(2)),getd(".MyMobCount_"+charat(strnpcinfo(1),4)+strnpcinfo(2))+1;
  1427. callsub OnSummon,10+.@z;
  1428. }
  1429. end;
  1430. OnReset:
  1431. stopnpctimer;
  1432. killmonster strnpcinfo(2),strnpcinfo(0)+"::OnGuardianDied";
  1433. deletearray getd(".x_"+strnpcinfo(2)+"[0]"),22;
  1434. deletearray getd(".y_"+strnpcinfo(2)+"[0]"),22;
  1435. end;
  1436. }
  1437. // Guardian Stone Summoners (2)
  1438. //============================================================
  1439. - script df#template -1,{
  1440. OnEnable:
  1441. if (compare(strnpcinfo(2),"arug")) {
  1442. if (strnpcinfo(2) == "arug_cas01") setarray .@i[0],210,234,308,189;
  1443. else if (strnpcinfo(2) == "arug_cas02") setarray .@i[0],33,168,245,168;
  1444. else setarray .@i[0],65,171,212,149; // Castles 3,4,5 are identical.
  1445. }
  1446. else {
  1447. if (strnpcinfo(2) == "schg_cas02") setarray .@i[0],231,58,335,230;
  1448. else if (strnpcinfo(2) == "schg_cas03") setarray .@i[0],242,309,376,251;
  1449. else setarray .@i[0],27,35,207,75; // Castles 1,4,5 are identical.
  1450. }
  1451. set .@num, atoi(charat(strnpcinfo(1),2));
  1452. set .@j,(.@num == 1)?0:2;
  1453. guardian strnpcinfo(2),.@i[.@j],.@i[.@j+1],((.@num == 1)?"1st":"2nd")+" Guardian Stone",1906+.@num,strnpcinfo(0)+"::OnGuardianStoneDied";
  1454. end;
  1455. OnDisable:
  1456. killmonster strnpcinfo(2),strnpcinfo(0)+"::OnGuardianStoneDied";
  1457. setd "$agit_"+substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9)+"["+(atoi(charat(strnpcinfo(1),2))-1)+"]",1;
  1458. stopnpctimer;
  1459. end;
  1460. OnGuardianStoneDied:
  1461. set .@num, atoi(charat(strnpcinfo(1),2));
  1462. set .@var$,"$agit_"+substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9);
  1463. setd .@var$+"["+(.@num-1)+"]",1;
  1464. if (getd(.@var$+"[0]") == 1 || getd(.@var$+"[0]") == 2) set .@destroyed, .@destroyed+1;
  1465. if (getd(.@var$+"[1]") == 1 || getd(.@var$+"[1]") == 2) set .@destroyed, .@destroyed+1;
  1466. if (.@destroyed == 2) {
  1467. mapannounce strnpcinfo(2),"All of the Guardian Stones have been destroyed!",bc_map,"0x00ff00";
  1468. donpcevent "RL0#"+strnpcinfo(2)+"::OnDisable";
  1469. }
  1470. else mapannounce strnpcinfo(2),"The "+((.@num == 1)?"1st":"2nd")+" Guardian Stone has been destroyed!",bc_map,"0x00ff00";
  1471. donpcevent "gard"+.@num+"#"+strnpcinfo(2)+"::OnReset";
  1472. initnpctimer;
  1473. end;
  1474. OnTimer300000:
  1475. set .@num, atoi(charat(strnpcinfo(1),2));
  1476. set .@str$,substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9);
  1477. donpcevent ((.@num == 1)?"1st":"2nd")+" Guardian Stone#"+.@str$+"::OnEnable";
  1478. setd "$agit_"+.@str$+"["+(atoi(charat(strnpcinfo(1),2))-1)+"]",2;
  1479. stopnpctimer;
  1480. end;
  1481. }
  1482. // Barrier Summoners (4)
  1483. //============================================================
  1484. - script RL#template -1,{
  1485. OnEnable:
  1486. .@npc_name$ = strnpcinfo(0);
  1487. .@npc_visible$ = strnpcinfo(1);
  1488. .@npc_hidden$ = strnpcinfo(2);
  1489. set .@num, atoi(charat(.@npc_visible$,2));
  1490. if (.@num == 0) {
  1491. if (compare(.@npc_hidden$,"arug")) {
  1492. if (.@npc_hidden$ == "arug_cas01") {
  1493. setarray .@wall[0],238,74,8,6,0;
  1494. setarray .@x[0],239,241,243,245;
  1495. setarray .@y[0], 73, 73, 73, 73;
  1496. }
  1497. else if (.@npc_hidden$ == "arug_cas02") {
  1498. setarray .@wall[0],136,136,8,6,0;
  1499. setarray .@x[0],137,139,141,143;
  1500. setarray .@y[0],137,137,137,137;
  1501. }
  1502. else { // Castles 3,4,5 are identical.
  1503. setarray .@wall[0],138,110,8,6,0;
  1504. setarray .@x[0],139,141,143,145;
  1505. setarray .@y[0],111,111,111,111;
  1506. }
  1507. }
  1508. else {
  1509. if (.@npc_hidden$ == "schg_cas02") {
  1510. setarray .@wall[0],290,98,8,0,0;
  1511. setarray .@x[0],289,289,289,289;
  1512. setarray .@y[0], 98,100,102,104;
  1513. }
  1514. else if (.@npc_hidden$ == "schg_cas03") {
  1515. setarray .@wall[0],326,301,6,6,0;
  1516. setarray .@x[0],326,328,330;
  1517. setarray .@y[0],300,300,300;
  1518. }
  1519. else { // Castles 1,4,5 are identical.
  1520. setarray .@wall[0],114,48,13,6,0;
  1521. setarray .@x[0],115,117,119,121,123,125;
  1522. setarray .@y[0], 49, 49, 49, 49, 49, 49;
  1523. }
  1524. }
  1525. }
  1526. else if (.@num == 1) {
  1527. if (compare(.@npc_hidden$,"arug")) {
  1528. if (.@npc_hidden$ == "arug_cas01") {
  1529. setarray .@wall[0],239,53,8,6,1;
  1530. setarray .@x[0],239,241,243,240,242,244;
  1531. setarray .@y[0], 55, 55, 55, 54, 54, 54;
  1532. }
  1533. else if (.@npc_hidden$ == "arug_cas02") {
  1534. setarray .@wall[0],150,223,12,6,1;
  1535. setarray .@x[0],151,153,155,157,159,161;
  1536. setarray .@y[0],222,222,222,222,222,222;
  1537. }
  1538. else { // Castles 3,4,5 are identical.
  1539. setarray .@wall[0],139,158,6,6,1;
  1540. setarray .@x[0],140,142,144,139,141,143;
  1541. setarray .@y[0],157,157,157,156,156,156;
  1542. }
  1543. }
  1544. else {
  1545. if (.@npc_hidden$ == "schg_cas02") {
  1546. setarray .@wall[0],279,98,8,0,1;
  1547. setarray .@x[0],280,280,280,281,281,281;
  1548. setarray .@y[0], 98,100,102, 99,101,103;
  1549. }
  1550. else if (.@npc_hidden$ == "schg_cas03") {
  1551. setarray .@wall[0],325,277,8,6,1;
  1552. setarray .@x[0],326,328,330,327,329,331;
  1553. setarray .@y[0],278,278,278,279,279,279;
  1554. }
  1555. else { // Castles 1,4,5 are identical.
  1556. setarray .@wall[0],114,51,13,6,1;
  1557. setarray .@x[0],115,117,119,121,123,125;
  1558. setarray .@y[0], 50, 50, 50, 50, 50, 50;
  1559. }
  1560. }
  1561. }
  1562. else if (.@num == 2) {
  1563. if (compare(.@npc_hidden$,"arug")) {
  1564. if (.@npc_hidden$ == "arug_cas01") {
  1565. setarray .@wall[0],107,124,6,6,1;
  1566. setarray .@x[0],107,109,111,108,110,112;
  1567. setarray .@y[0],122,122,122,123,123,123;
  1568. }
  1569. else if (.@npc_hidden$ == "arug_cas02") {
  1570. setarray .@wall[0],125,342,8,0,1;
  1571. setarray .@x[0],126,126,126,127,127,127;
  1572. setarray .@y[0],343,345,347,344,346,348;
  1573. }
  1574. else { // Castles 3,4,5 are identical.
  1575. setarray .@wall[0],138,210,8,6,1;
  1576. setarray .@x[0],140,142,144,139,141,143;
  1577. setarray .@y[0],209,209,209,208,208,208;
  1578. }
  1579. }
  1580. else {
  1581. if (.@npc_hidden$ == "schg_cas02") {
  1582. setarray .@wall[0],230,213,6,0,1;
  1583. setarray .@x[0],231,231,231,232,232,232;
  1584. setarray .@y[0],213,215,217,213,215,217;
  1585. }
  1586. else if (.@npc_hidden$ == "schg_cas03") {
  1587. setarray .@wall[0],200,230,8,0,1;
  1588. setarray .@x[0],201,201,201,202,202,202;
  1589. setarray .@y[0],231,233,235,232,234,236;
  1590. }
  1591. else { // Castles 1,4,5 are identical.
  1592. setarray .@wall[0],114,154,13,6,1;
  1593. setarray .@x[0],115,117,119,121,123,125;
  1594. setarray .@y[0],153,153,153,153,153,153;
  1595. }
  1596. }
  1597. }
  1598. else {
  1599. if (compare(.@npc_hidden$,"arug")) {
  1600. if (.@npc_hidden$ == "arug_cas01") {
  1601. setarray .@wall[0],84,171,8,6,1;
  1602. setarray .@x[0], 84, 86, 88, 90;
  1603. setarray .@y[0],170,170,170,170;
  1604. }
  1605. else if (.@npc_hidden$ == "arug_cas02") {
  1606. setarray .@wall[0],38,314,12,6,1;
  1607. setarray .@x[0], 40, 42, 44, 46;
  1608. setarray .@y[0],315,315,315,315;
  1609. }
  1610. else { // Castles 3,4,5 are identical.
  1611. setarray .@wall[0],138,263,8,6,1;
  1612. setarray .@x[0],139,141,143,145;
  1613. setarray .@y[0],262,262,262,262;
  1614. }
  1615. }
  1616. else {
  1617. if (.@npc_hidden$ == "schg_cas02") {
  1618. setarray .@wall[0],160,141,6,6,1;
  1619. setarray .@x[0],160,162,164,166;
  1620. setarray .@y[0],140,140,140,140;
  1621. }
  1622. else if (.@npc_hidden$ == "schg_cas03") {
  1623. setarray .@wall[0],285,198,8,0,1;
  1624. setarray .@x[0],284,284,284,284;
  1625. setarray .@y[0],199,201,203,205;
  1626. }
  1627. else { // Castles 1,4,5 are identical.
  1628. setarray .@wall[0],116,241,11,6,1;
  1629. setarray .@x[0],116,118,120,122;
  1630. setarray .@y[0],240,240,240,240;
  1631. }
  1632. }
  1633. }
  1634. setwall .@npc_hidden$,.@wall[0],.@wall[1],.@wall[2],.@wall[3],.@wall[4],substr(.@npc_hidden$,0,1)+substr(.@npc_hidden$,8,9)+"_"+.@npc_visible$;
  1635. switch(.@num) {
  1636. case 0:
  1637. killmonster .@npc_hidden$, .@npc_name$ + "::OnBarrierDestroyed";
  1638. .@j = getarraysize(.@x);
  1639. for ( .@i = 0; .@i < .@j; ++.@i ) {
  1640. .@unit_id = guardian( .@npc_hidden$,.@x[.@i],.@y[.@i]," ",1905, .@npc_name$ + "::OnBarrierDestroyed" );
  1641. setunitdata .@unit_id,UMOB_DMGIMMUNE,1; // The 1st barricades are immunes to damage until both Guardian Stones are destroyed
  1642. }
  1643. end;
  1644. case 3:
  1645. setd ".MyMobCount_" + .@num + .@npc_hidden$, 4;
  1646. break;
  1647. default:
  1648. setd ".MyMobCount_" + .@num + .@npc_hidden$, 6;
  1649. break;
  1650. }
  1651. for ( .@i = 0; .@i < getd( ".MyMobCount_" + .@num + .@npc_hidden$ ); ++.@i )
  1652. guardian .@npc_hidden$,.@x[.@i],.@y[.@i]," ",1905, .@npc_name$ + "::OnBarrierDestroyed";
  1653. end;
  1654. OnBarrierDestroyed:
  1655. set .@num, atoi(charat(strnpcinfo(1),2));
  1656. if (!.@num) end;
  1657. set getd(".MyMobCount_"+.@num+strnpcinfo(2)),getd(".MyMobCount_"+.@num+strnpcinfo(2))-1;
  1658. if (getd(".MyMobCount_"+.@num+strnpcinfo(2)) == 0) {
  1659. set .@var$,substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9);
  1660. setd "$agit_"+.@var$+"["+(.@num+1)+"]",1;
  1661. setarray .@count$[0],"1st","2nd","3rd";
  1662. mapannounce strnpcinfo(2),"The "+.@count$[.@num-1]+" Fortress Gate is destroyed.",bc_map,"0x00ff00";
  1663. delwall .@var$+"_"+strnpcinfo(1);
  1664. }
  1665. end;
  1666. OnDisable:
  1667. .@wall_name$ = substr(strnpcinfo(2),0,1) + substr(strnpcinfo(2),8,9) + "_" + strnpcinfo(1);
  1668. if (checkwall(.@wall_name$) == true)
  1669. delwall .@wall_name$;
  1670. killmonster strnpcinfo(2),strnpcinfo(0)+"::OnBarrierDestroyed";
  1671. end;
  1672. }
  1673. // Link Flags (function)
  1674. //============================================================
  1675. function script LinkFlag {
  1676. if (!getcharid(2) || getcharid(2) != getcastledata(strnpcinfo(4),CD_GUILD_ID)) end;
  1677. if (getarg(0) == "Convenience Facility") {
  1678. mes "^3355FFThis is the Stronghold";
  1679. mes "Teleport Service. Would";
  1680. mes "you like to teleport to the";
  1681. mes "Convenience Facility for";
  1682. mes "guild members?^000000";
  1683. if(select("Go to Convenience Facility:Cancel") == 1)
  1684. warp strnpcinfo(4),getarg(1),getarg(2);
  1685. close;
  1686. }
  1687. if (getarg(0) == "Emperium Center") {
  1688. mes "^3355FFThis is the Stronghold";
  1689. mes "Teleport Service. Would";
  1690. mes "you like to teleport to";
  1691. mes "the Emperium Center?^000000";
  1692. if(select("Teleport:Cancel") == 1)
  1693. warp strnpcinfo(4),getarg(1),getarg(2);
  1694. close;
  1695. }
  1696. mes "^3355FFThis is the Stronghold";
  1697. mes "Teleport Service. Please";
  1698. mes "choose a destination";
  1699. mes "within the stronghold.^000000";
  1700. for(set .@i,0; .@i<getargcount(); set .@i,.@i+3)
  1701. set .@menu$, .@menu$+getarg(.@i)+":";
  1702. set .@menu$, .@menu$+"Cancel";
  1703. set .@i, select(.@menu$)-1;
  1704. if (.@i != getargcount()/3)
  1705. warp strnpcinfo(4),getarg(.@i*3+1),getarg(.@i*3+2);
  1706. close;
  1707. }
  1708. // Return Flags (function)
  1709. //============================================================
  1710. function script ReturnFlag {
  1711. .@map$ = getarg(0);
  1712. set .@str$, (compare(strnpcinfo(4),"aru"))?"Arunafeltz":"Schwarzwald";
  1713. .@GID = getcastledata(.@map$,CD_GUILD_ID);
  1714. if (!.@GID) {
  1715. mes "[ "+.@str$+" Royal Edict ]";
  1716. mes "The Holy Kingdom of";
  1717. mes .@str$+" declares that";
  1718. mes "one has yet to claim lordship";
  1719. mes "over this stronghold. The one";
  1720. mes "that breaks the Emperium will";
  1721. mes "be recognized as its new owner.";
  1722. close;
  1723. }
  1724. if (getcharid(2) == .@GID && getarg(1,0)) {
  1725. mes "[ Ringing Voice ]";
  1726. mes "Courageous one,";
  1727. mes "do you wish to return";
  1728. mes "to your stronghold?";
  1729. next;
  1730. if(select("Return to the Stronghold:Cancel") == 1 && getcharid(2) == getcastledata(.@map$,CD_GUILD_ID)) {
  1731. if (compare(.@map$,"arug")) {
  1732. if (.@map$ == "arug_cas01") setarray .@i[0],67,193;
  1733. else if (.@map$ == "arug_cas02") setarray .@i[0],43,256;
  1734. else setarray .@i[0],121,318; // Castles 3,4,5 are identical.
  1735. }
  1736. else {
  1737. if (.@map$ == "schg_cas02") setarray .@i[0],136,188;
  1738. else if (.@map$ == "schg_cas03") setarray .@i[0],308,202;
  1739. else setarray .@i[0],120,290; // Castles 1,4,5 are identical.
  1740. }
  1741. warp .@map$,.@i[0],.@i[1];
  1742. }
  1743. close;
  1744. }
  1745. mes "[ "+.@str$+" Royal Edict ]";
  1746. mes "The Holy Kingdom of";
  1747. mes .@str$+" decrees that";
  1748. mes "this stronghold is owned";
  1749. mes "by the ^FF0000"+getguildname(.@GID)+"^000000 Guild.";
  1750. next;
  1751. mes "[ "+.@str$+" Royal Edict ]";
  1752. mes "^FF0000"+getguildmaster(.@GID)+"^000000 is";
  1753. mes "Guild Master of ^FF0000"+getguildname(.@GID)+"^000000.";
  1754. mes "Any that object must claim this";
  1755. mes "stronghold through strength of";
  1756. mes "steel and magic during the";
  1757. mes "appointed Guild Siege times.";
  1758. close;
  1759. }
  1760. // Treasure Room Switches
  1761. //============================================================
  1762. - script Switch#template -1,{
  1763. mes " ";
  1764. mes "^3355FFWill you pull";
  1765. mes "this small lever?^000000";
  1766. next;
  1767. if(select("Pull Lever:Cancel") == 2) close;
  1768. if (compare(strnpcinfo(4),"arug")) {
  1769. if (strnpcinfo(4) == "arug_cas01") setarray .@i[0],121,357;
  1770. else if (strnpcinfo(4) == "arug_cas02") setarray .@i[0],387,323;
  1771. else setarray .@i[0],321,57; // Castles 3,4,5 are identical.
  1772. }
  1773. else {
  1774. if (strnpcinfo(4) == "schg_cas02") setarray .@i[0],339,79;
  1775. else if (strnpcinfo(4) == "schg_cas03") setarray .@i[0],57,13;
  1776. else setarray .@i[0],275,244; // Castles 1,4,5 are identical.
  1777. }
  1778. warp strnpcinfo(4),.@i[0],.@i[1];
  1779. close;
  1780. }
  1781. // Guild Dungeon Warps
  1782. //============================================================
  1783. - script Sunflower#template -1,{
  1784. if (getcharid(2) == getcastledata(strnpcinfo(4),CD_GUILD_ID)) {
  1785. mes "- It's an amazingly huge sunflower; as big as a human! ... You feel something mysterious emanating from the flower. -";
  1786. next;
  1787. switch(select("Hold the stem.:Do nothing.")) {
  1788. case 1:
  1789. if (compare(strnpcinfo(4),"arug")) {
  1790. set .@map$,"arug_dun01";
  1791. setarray .@mapx[0],350,350,50, 50,200;
  1792. setarray .@mapy[0],350, 50,50,350,386;
  1793. }
  1794. else {
  1795. set .@map$,"schg_dun01";
  1796. setarray .@mapx[0],262, 94, 79,212,322;
  1797. setarray .@mapy[0],314,284,140, 70,166;
  1798. }
  1799. set .@i, atoi(charat(strnpcinfo(4),9))-1;
  1800. warp .@map$,.@mapx[.@i],.@mapy[.@i];
  1801. close;
  1802. case 2:
  1803. mes "It's too scary to touch unknown things.";
  1804. close;
  1805. }
  1806. }
  1807. }