agit_main_se.txt 58 KB

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