agit_main_se.txt 60 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828
  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),1)) {
  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),9) < 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),1),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),1)) {
  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),1,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),1)) {
  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),1)) end;
  131. killmonster strnpcinfo(2),strnpcinfo(0)+"::OnTreasureDied";
  132. if (getcastledata(strnpcinfo(2),4)) {
  133. set .@Economy,getcastledata(strnpcinfo(2),2);
  134. setcastledata strnpcinfo(2),2,.@Economy+getcastledata(strnpcinfo(2),4)+(rand(2) && getgdskilllv(getcastledata(strnpcinfo(2),1),10014));
  135. if (getcastledata(strnpcinfo(2),2) > 100) setcastledata strnpcinfo(2),2,100;
  136. setcastledata strnpcinfo(2),4,0;
  137. }
  138. if (getcastledata(strnpcinfo(2),5)) {
  139. set .@Defence,getcastledata(strnpcinfo(2),3);
  140. setcastledata strnpcinfo(2),3,.@Defence+getcastledata(strnpcinfo(2),5);
  141. if (getcastledata(strnpcinfo(2),3) > 100) setcastledata strnpcinfo(2),3,100;
  142. setcastledata strnpcinfo(2),5,0;
  143. }
  144. set .@Treasure,getcastledata(strnpcinfo(2),2)/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),1);
  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 (getcharid(2) != .@GID || strcharinfo(0) != getguildmaster(.@GID)) {
  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),2)+".";
  229. if (getcastledata(strnpcinfo(4),4) > 0) {
  230. mes "Last time, you invested in";
  231. mes "Commercial Growth "+getcastledata(strnpcinfo(4),4)+".";
  232. }
  233. next;
  234. mes "[ Steward ]";
  235. mes "Our stronghold's";
  236. mes "safeguard level is "+getcastledata(strnpcinfo(4),3)+".";
  237. if (getcastledata(strnpcinfo(4),5) > 0) {
  238. mes "Last time, you invested";
  239. mes "in defense "+getcastledata(strnpcinfo(4),5)+" times.";
  240. }
  241. mes " ";
  242. mes "That is all, master.";
  243. close;
  244. case 2:
  245. set .@Economy,getcastledata(strnpcinfo(4),2);
  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),4)) 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),4) >= 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),4) == 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),4) >= 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),4,getcastledata(strnpcinfo(4),4)+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),3);
  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),5)) 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),3) == 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),5) >= 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),5) == 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),5) >= 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),5,getcastledata(strnpcinfo(4),5)+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),9) == 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),9,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),9,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),2)-5;
  596. if (.@Economy < 0) set .@Economy, 0;
  597. setcastledata strnpcinfo(4),2,.@Economy;
  598. // Lower Castle Defence
  599. set .@Defence,getcastledata(strnpcinfo(4),3)-5;
  600. if (.@Defence < 0) set .@Defence, 0;
  601. setcastledata strnpcinfo(4),3,.@Defence;
  602. // Set new owner
  603. setcastledata strnpcinfo(4),1,.@GID;
  604. // Clear castle's data.
  605. for(set .@i,4; .@i<10; 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),1),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),1);
  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 (strcharinfo(0) != getguildmaster(.@GID)) {
  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),1);
  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 (basicskillcheck() && getskilllv("NV_BASIC") < 6) {
  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),1);
  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],56,54,225;
  989. setarray .@color$[0],"Red","Yellow","Blue";
  990. while(1) {
  991. if (.@roof0 > 7) break;
  992. set .@i, rand(3);
  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),1);
  1087. set .@num, atoi(charat(strnpcinfo(1),15));
  1088. set .@var$,"$agit_"+strnpcinfo(2);
  1089. if (getcharid(2) == .@GID) {
  1090. if (strcharinfo(0) == getguildmaster(.@GID)) {
  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),3);
  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. set .@num, atoi(charat(strnpcinfo(1),2));
  1487. if (.@num == 0) {
  1488. if (compare(strnpcinfo(2),"arug")) {
  1489. if (strnpcinfo(2) == "arug_cas01") {
  1490. setarray .@wall[0],238,74,8,6,0;
  1491. setarray .@x[0],239,241,243,245;
  1492. setarray .@y[0], 73, 73, 73, 73;
  1493. }
  1494. else if (strnpcinfo(2) == "arug_cas02") {
  1495. setarray .@wall[0],136,136,8,6,0;
  1496. setarray .@x[0],137,139,141,143;
  1497. setarray .@y[0],137,137,137,137;
  1498. }
  1499. else { // Castles 3,4,5 are identical.
  1500. setarray .@wall[0],138,110,8,6,0;
  1501. setarray .@x[0],139,141,143,145;
  1502. setarray .@y[0],111,111,111,111;
  1503. }
  1504. }
  1505. else {
  1506. if (strnpcinfo(2) == "schg_cas02") {
  1507. setarray .@wall[0],290,98,8,0,0;
  1508. setarray .@x[0],289,289,289,289;
  1509. setarray .@y[0], 98,100,102,104;
  1510. }
  1511. else if (strnpcinfo(2) == "schg_cas03") {
  1512. setarray .@wall[0],326,301,6,6,0;
  1513. setarray .@x[0],326,328,330;
  1514. setarray .@y[0],300,300,300;
  1515. }
  1516. else { // Castles 1,4,5 are identical.
  1517. setarray .@wall[0],114,48,13,6,0;
  1518. setarray .@x[0],115,117,119,121,123,125;
  1519. setarray .@y[0], 49, 49, 49, 49, 49, 49;
  1520. }
  1521. }
  1522. }
  1523. else if (.@num == 1) {
  1524. if (compare(strnpcinfo(2),"arug")) {
  1525. if (strnpcinfo(2) == "arug_cas01") {
  1526. setarray .@wall[0],239,53,8,6,1;
  1527. setarray .@x[0],239,241,243,240,242,244;
  1528. setarray .@y[0], 55, 55, 55, 54, 54, 54;
  1529. }
  1530. else if (strnpcinfo(2) == "arug_cas02") {
  1531. setarray .@wall[0],150,223,12,6,1;
  1532. setarray .@x[0],151,153,155,157,159,161;
  1533. setarray .@y[0],222,222,222,222,222,222;
  1534. }
  1535. else { // Castles 3,4,5 are identical.
  1536. setarray .@wall[0],139,158,6,6,1;
  1537. setarray .@x[0],140,142,144,139,141,143;
  1538. setarray .@y[0],157,157,157,156,156,156;
  1539. }
  1540. }
  1541. else {
  1542. if (strnpcinfo(2) == "schg_cas02") {
  1543. setarray .@wall[0],279,98,8,0,1;
  1544. setarray .@x[0],280,280,280,281,281,281;
  1545. setarray .@y[0], 98,100,102, 99,101,103;
  1546. }
  1547. else if (strnpcinfo(2) == "schg_cas03") {
  1548. setarray .@wall[0],325,277,8,6,1;
  1549. setarray .@x[0],326,328,330,327,329,331;
  1550. setarray .@y[0],278,278,278,279,279,279;
  1551. }
  1552. else { // Castles 1,4,5 are identical.
  1553. setarray .@wall[0],114,51,13,6,1;
  1554. setarray .@x[0],115,117,119,121,123,125;
  1555. setarray .@y[0], 50, 50, 50, 50, 50, 50;
  1556. }
  1557. }
  1558. }
  1559. else if (.@num == 2) {
  1560. if (compare(strnpcinfo(2),"arug")) {
  1561. if (strnpcinfo(2) == "arug_cas01") {
  1562. setarray .@wall[0],107,124,6,6,1;
  1563. setarray .@x[0],107,109,111,108,110,112;
  1564. setarray .@y[0],122,122,122,123,123,123;
  1565. }
  1566. else if (strnpcinfo(2) == "arug_cas02") {
  1567. setarray .@wall[0],125,342,8,0,1;
  1568. setarray .@x[0],126,126,126,127,127,127;
  1569. setarray .@y[0],343,345,347,344,346,348;
  1570. }
  1571. else { // Castles 3,4,5 are identical.
  1572. setarray .@wall[0],138,210,8,6,1;
  1573. setarray .@x[0],140,142,144,139,141,143;
  1574. setarray .@y[0],209,209,209,208,208,208;
  1575. }
  1576. }
  1577. else {
  1578. if (strnpcinfo(2) == "schg_cas02") {
  1579. setarray .@wall[0],230,213,6,0,1;
  1580. setarray .@x[0],231,231,231,232,232,232;
  1581. setarray .@y[0],213,215,217,213,215,217;
  1582. }
  1583. else if (strnpcinfo(2) == "schg_cas03") {
  1584. setarray .@wall[0],200,230,8,0,1;
  1585. setarray .@x[0],201,201,201,202,202,202;
  1586. setarray .@y[0],231,233,235,232,234,236;
  1587. }
  1588. else { // Castles 1,4,5 are identical.
  1589. setarray .@wall[0],114,154,13,6,1;
  1590. setarray .@x[0],115,117,119,121,123,125;
  1591. setarray .@y[0],153,153,153,153,153,153;
  1592. }
  1593. }
  1594. }
  1595. else {
  1596. if (compare(strnpcinfo(2),"arug")) {
  1597. if (strnpcinfo(2) == "arug_cas01") {
  1598. setarray .@wall[0],84,171,8,6,1;
  1599. setarray .@x[0], 84, 86, 88, 90;
  1600. setarray .@y[0],170,170,170,170;
  1601. }
  1602. else if (strnpcinfo(2) == "arug_cas02") {
  1603. setarray .@wall[0],38,314,12,6,1;
  1604. setarray .@x[0], 40, 42, 44, 46;
  1605. setarray .@y[0],315,315,315,315;
  1606. }
  1607. else { // Castles 3,4,5 are identical.
  1608. setarray .@wall[0],138,263,8,6,1;
  1609. setarray .@x[0],139,141,143,145;
  1610. setarray .@y[0],262,262,262,262;
  1611. }
  1612. }
  1613. else {
  1614. if (strnpcinfo(2) == "schg_cas02") {
  1615. setarray .@wall[0],160,141,6,6,1;
  1616. setarray .@x[0],160,162,164,166;
  1617. setarray .@y[0],140,140,140,140;
  1618. }
  1619. else if (strnpcinfo(2) == "schg_cas03") {
  1620. setarray .@wall[0],285,198,8,0,1;
  1621. setarray .@x[0],284,284,284,284;
  1622. setarray .@y[0],199,201,203,205;
  1623. }
  1624. else { // Castles 1,4,5 are identical.
  1625. setarray .@wall[0],116,241,11,6,1;
  1626. setarray .@x[0],116,118,120,122;
  1627. setarray .@y[0],240,240,240,240;
  1628. }
  1629. }
  1630. }
  1631. if (.@num == 3) set getd(".MyMobCount_"+.@num+strnpcinfo(2)),4;
  1632. else if (.@num) set getd(".MyMobCount_"+.@num+strnpcinfo(2)),6;
  1633. 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);
  1634. set .@j,(getd(".MyMobCount_"+.@num+strnpcinfo(2)))?getd(".MyMobCount_"+.@num+strnpcinfo(2)):getarraysize(.@x);
  1635. for(set .@i,0; .@i<.@j; set .@i,.@i+1)
  1636. guardian strnpcinfo(2),.@x[.@i],.@y[.@i]," ",1905,strnpcinfo(0)+"::OnBarrierDestroyed";
  1637. end;
  1638. OnBarrierDestroyed:
  1639. set .@num, atoi(charat(strnpcinfo(1),2));
  1640. if (!.@num) end;
  1641. set getd(".MyMobCount_"+.@num+strnpcinfo(2)),getd(".MyMobCount_"+.@num+strnpcinfo(2))-1;
  1642. if (getd(".MyMobCount_"+.@num+strnpcinfo(2)) == 0) {
  1643. set .@var$,substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9);
  1644. setd "$agit_"+.@var$+"["+(.@num+1)+"]",1;
  1645. setarray .@count$[0],"1st","2nd","3rd";
  1646. mapannounce strnpcinfo(2),"The "+.@count$[.@num-1]+" Fortress Gate is destroyed.",bc_map,"0x00ff00";
  1647. delwall .@var$+"_"+strnpcinfo(1);
  1648. }
  1649. end;
  1650. OnDisable:
  1651. delwall substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9)+"_"+strnpcinfo(1);
  1652. killmonster strnpcinfo(2),strnpcinfo(0)+"::OnBarrierDestroyed";
  1653. end;
  1654. }
  1655. // Link Flags (function)
  1656. //============================================================
  1657. function script LinkFlag {
  1658. if (!getcharid(2) || getcharid(2) != getcastledata(strnpcinfo(4),1)) end;
  1659. if (getarg(0) == "Convenience Facility") {
  1660. mes "^3355FFThis is the Stronghold";
  1661. mes "Teleport Service. Would";
  1662. mes "you like to teleport to the";
  1663. mes "Convenience Facility for";
  1664. mes "guild members?^000000";
  1665. if(select("Go to Convenience Facility:Cancel") == 1)
  1666. warp strnpcinfo(4),getarg(1),getarg(2);
  1667. close;
  1668. }
  1669. if (getarg(0) == "Emperium Center") {
  1670. mes "^3355FFThis is the Stronghold";
  1671. mes "Teleport Service. Would";
  1672. mes "you like to teleport to";
  1673. mes "the Emperium Center?^000000";
  1674. if(select("Teleport:Cancel") == 1)
  1675. warp strnpcinfo(4),getarg(1),getarg(2);
  1676. close;
  1677. }
  1678. mes "^3355FFThis is the Stronghold";
  1679. mes "Teleport Service. Please";
  1680. mes "choose a destination";
  1681. mes "within the stronghold.^000000";
  1682. for(set .@i,0; .@i<getargcount(); set .@i,.@i+3)
  1683. set .@menu$, .@menu$+getarg(.@i)+":";
  1684. set .@menu$, .@menu$+"Cancel";
  1685. set .@i, select(.@menu$)-1;
  1686. if (.@i != getargcount()/3)
  1687. warp strnpcinfo(4),getarg(.@i*3+1),getarg(.@i*3+2);
  1688. close;
  1689. }
  1690. // Return Flags (function)
  1691. //============================================================
  1692. function script ReturnFlag {
  1693. set .@str$, (compare(strnpcinfo(4),"aru"))?"Arunafeltz":"Schwaltzvalt";
  1694. set .@GID, getcastledata(getarg(0),1);
  1695. if (!.@GID) {
  1696. mes "[ "+.@str$+" Royal Edict ]";
  1697. mes "The Holy Kingdom of";
  1698. mes .@str$+" declares that";
  1699. mes "one has yet to claim lordship";
  1700. mes "over this stronghold. The one";
  1701. mes "that breaks the Emperium will";
  1702. mes "be recognized as its new owner.";
  1703. close;
  1704. }
  1705. if (getcharid(2) == .@GID && getarg(1,0)) {
  1706. mes "[ Ringing Voice ]";
  1707. mes "Courageous one,";
  1708. mes "do you wish to return";
  1709. mes "to your stronghold?";
  1710. next;
  1711. if(select("Return to the Stronghold:Cancel") == 1 && getcharid(2) == getcastledata(getarg(0),1)) {
  1712. if (compare(getarg(0),"arug")) {
  1713. if (getarg(0) == "arug_cas01") setarray .@i[0],67,193;
  1714. else if (getarg(0) == "arug_cas02") setarray .@i[0],43,256;
  1715. else setarray .@i[0],121,318; // Castles 3,4,5 are identical.
  1716. }
  1717. else {
  1718. if (getarg(0) == "schg_cas02") setarray .@i[0],136,188;
  1719. else if (getarg(0) == "schg_cas03") setarray .@i[0],308,202;
  1720. else setarray .@i[0],120,290; // Castles 1,4,5 are identical.
  1721. }
  1722. warp getarg(0),.@i[0],.@i[1];
  1723. }
  1724. close;
  1725. }
  1726. mes "[ "+.@str$+" Royal Edict ]";
  1727. mes "The Holy Kingdom of";
  1728. mes .@str$+" decrees that";
  1729. mes "this stronghold is owned";
  1730. mes "by the ^FF0000"+getguildname(.@GID)+"^000000 Guild.";
  1731. next;
  1732. mes "[ "+.@str$+" Royal Edict ]";
  1733. mes "^FF0000"+getguildmaster(.@GID)+"^000000 is";
  1734. mes "Guild Master of ^FF0000"+getguildname(.@GID)+"^000000.";
  1735. mes "Any that object must claim this";
  1736. mes "stronghold through strength of";
  1737. mes "steel and magic during the";
  1738. mes "appointed Guild Siege times.";
  1739. close;
  1740. }
  1741. // Treasure Room Switches
  1742. //============================================================
  1743. - script Switch#template -1,{
  1744. mes " ";
  1745. mes "^3355FFWill you pull";
  1746. mes "this small lever?^000000";
  1747. next;
  1748. if(select("Pull Lever:Cancel") == 2) close;
  1749. if (compare(strnpcinfo(4),"arug")) {
  1750. if (strnpcinfo(4) == "arug_cas01") setarray .@i[0],121,357;
  1751. else if (strnpcinfo(4) == "arug_cas02") setarray .@i[0],387,323;
  1752. else setarray .@i[0],321,57; // Castles 3,4,5 are identical.
  1753. }
  1754. else {
  1755. if (strnpcinfo(4) == "schg_cas02") setarray .@i[0],339,79;
  1756. else if (strnpcinfo(4) == "schg_cas03") setarray .@i[0],57,13;
  1757. else setarray .@i[0],275,244; // Castles 1,4,5 are identical.
  1758. }
  1759. warp strnpcinfo(4),.@i[0],.@i[1];
  1760. close;
  1761. }
  1762. // Guild Dungeon Warps
  1763. //============================================================
  1764. - script Sunflower#template -1,{
  1765. if (getcharid(2) == getcastledata(strnpcinfo(4),1)) {
  1766. mes "- It's an amazingly huge sunflower; as big as a human! ... You feel something mysterious emanating from the flower. -";
  1767. next;
  1768. switch(select("Hold the stem.:Do nothing.")) {
  1769. case 1:
  1770. if (compare(strnpcinfo(4),"arug")) {
  1771. set .@map$,"arug_dun01";
  1772. setarray .@mapx[0],350,350,50, 50,200;
  1773. setarray .@mapy[0],350, 50,50,350,386;
  1774. }
  1775. else {
  1776. set .@map$,"schg_dun01";
  1777. setarray .@mapx[0],262, 94, 79,212,322;
  1778. setarray .@mapy[0],314,284,140, 70,166;
  1779. }
  1780. set .@i, atoi(charat(strnpcinfo(4),9))-1;
  1781. warp .@map$,.@mapx[.@i],.@mapy[.@i];
  1782. close;
  1783. case 2:
  1784. mes "It's too scary to touch unknown things.";
  1785. close;
  1786. }
  1787. }
  1788. }