Advertisement
Guest User

Untitled

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