Guest User

Untitled

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