agit_main_se.txt 59 KB

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