agit_main_se.txt 60 KB

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