Advertisement
Guest User

agit_template

a guest
Jun 10th, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 58.83 KB | None | 0 0
  1. //===== eAthena Script =======================================
  2. //= War of Emperium Guild Template File
  3. //===== By: ==================================================
  4. //= L0ne_W0lf
  5. //===== Current Version: =====================================
  6. //= 1.4
  7. //===== Compatible With: =====================================
  8. //= eAthena SVN
  9. //===== Description: =========================================
  10. //= [ Aegis Conversion]
  11. //= ----------------------------------------------------------
  12. //= - THIS FILE IS REQUIRED FOR GUILD CASTLES TO FUNCTION.
  13. //= ----------------------------------------------------------
  14. //= - Enables AGIT Manager inside Guild Strongholds.
  15. //= Visible Name required: Agit
  16. //= Manages the various functions used in and out of WoE.
  17. //=
  18. //= - Enables Stewards inside Guild Strongholds which let's
  19. //= the guild master invest in Defense and Economy, and
  20. //= to summon guardians, a Kafra, and enter master's room.
  21. //=
  22. //= - Guardian Spawning Template
  23. //= Visible Name required: Guardian
  24. //= Spawn guardians when guild castle data is recieved.
  25. //=
  26. //= - Enables Kafra Services inside Guild Strongholds.
  27. //= Visible Name required: Kafra Staff
  28. //= Storage, Guild Storage, Teleport Service, Cart rental.
  29. //=
  30. //= - Treasure Room Protection and Chest spawning.
  31. //= Chests will NOT be saved anymore in the event of crashes.
  32. //= Treasures will NOT spawn on a location that already has
  33. //= treasure chest spawned.
  34. //===== Additional Comments: =================================
  35. //= 1.0 First Version. No longer uses functions. [L0ne_W0lf]
  36. //= 1.1 Daily investement will now be reset. [L0ne_W0lf]
  37. //= Template will no longer try to spawn chests.
  38. //= 1.2 Fixed Eco Invest option charging twice. [L0ne_W0lf]
  39. //= 1.3 Fixed a loading flag emblem for Payon 1. [L0ne_W0lf]
  40. //= Fixed two typos regarding Guild Steward name.
  41. //= 1.4 Fixed a typo in defense investment. [L0ne_W0lf]
  42. //= 1.5 Fixed spawn point of the emperium in Payon 1. [L0ne_W0lf]
  43. //= Double-investing doubles the price now.
  44. //= Altered for WoE Setter v3... [[GM]Xeon]
  45. //============================================================
  46.  
  47. // AGIT Manager Template
  48. //============================================================
  49. - script Gld_Agit_Manager::Gld_Agit_Manager -1,{
  50. end;
  51.  
  52. // Load (or reload) specific information for a castle.
  53. OnInterIfInitOnce:
  54. if (strnpcinfo(2) == "aldeg_cas01") { GetCastleData "aldeg_cas01",0,strnpcinfo(0)+"::OnRecvCastle"; }
  55. else if (strnpcinfo(2) == "aldeg_cas02") { GetCastleData "aldeg_cas02",0,strnpcinfo(0)+"::OnRecvCastle"; }
  56. else if (strnpcinfo(2) == "aldeg_cas03") { GetCastleData "aldeg_cas03",0,strnpcinfo(0)+"::OnRecvCastle"; }
  57. else if (strnpcinfo(2) == "aldeg_cas04") { GetCastleData "aldeg_cas04",0,strnpcinfo(0)+"::OnRecvCastle"; }
  58. else if (strnpcinfo(2) == "aldeg_cas05") { GetCastleData "aldeg_cas05",0,strnpcinfo(0)+"::OnRecvCastle"; }
  59. else if (strnpcinfo(2) == "gefg_cas01") { GetCastleData "gefg_cas01",0,strnpcinfo(0)+"::OnRecvCastle"; }
  60. else if (strnpcinfo(2) == "gefg_cas02") { GetCastleData "gefg_cas02",0,strnpcinfo(0)+"::OnRecvCastle"; }
  61. else if (strnpcinfo(2) == "gefg_cas03") { GetCastleData "gefg_cas03",0,strnpcinfo(0)+"::OnRecvCastle"; }
  62. else if (strnpcinfo(2) == "gefg_cas04") { GetCastleData "gefg_cas04",0,strnpcinfo(0)+"::OnRecvCastle"; }
  63. else if (strnpcinfo(2) == "gefg_cas05") { GetCastleData "gefg_cas05",0,strnpcinfo(0)+"::OnRecvCastle"; }
  64. else if (strnpcinfo(2) == "payg_cas01") { GetCastleData "payg_cas01",0,strnpcinfo(0)+"::OnRecvCastle"; }
  65. else if (strnpcinfo(2) == "payg_cas02") { GetCastleData "payg_cas02",0,strnpcinfo(0)+"::OnRecvCastle"; }
  66. else if (strnpcinfo(2) == "payg_cas03") { GetCastleData "payg_cas03",0,strnpcinfo(0)+"::OnRecvCastle"; }
  67. else if (strnpcinfo(2) == "payg_cas04") { GetCastleData "payg_cas04",0,strnpcinfo(0)+"::OnRecvCastle"; }
  68. else if (strnpcinfo(2) == "payg_cas05") { GetCastleData "payg_cas05",0,strnpcinfo(0)+"::OnRecvCastle"; }
  69. else if (strnpcinfo(2) == "prtg_cas01") { GetCastleData "prtg_cas01",0,strnpcinfo(0)+"::OnRecvCastle"; }
  70. else if (strnpcinfo(2) == "prtg_cas02") { GetCastleData "prtg_cas02",0,strnpcinfo(0)+"::OnRecvCastle"; }
  71. else if (strnpcinfo(2) == "prtg_cas03") { GetCastleData "prtg_cas03",0,strnpcinfo(0)+"::OnRecvCastle"; }
  72. else if (strnpcinfo(2) == "prtg_cas04") { GetCastleData "prtg_cas04",0,strnpcinfo(0)+"::OnRecvCastle"; }
  73. else if (strnpcinfo(2) == "prtg_cas05") { GetCastleData "prtg_cas05",0,strnpcinfo(0)+"::OnRecvCastle"; }
  74. // Add custom Guild Castles here.
  75. else {
  76. end;
  77. }
  78. end;
  79.  
  80. // War of Emperium has started.
  81. OnAgitStart_: //CHANGED
  82. if (strnpcinfo(0) == "Gld_Agit_Manager") end;
  83. MapRespawnGuildID strnpcinfo(2),GetCastleData(strnpcinfo(2),1),2;
  84. GvgOn strnpcinfo(2);
  85.  
  86. // Spawn (fall through), or respawn the Emperium once it has been broken.
  87. OnStartArena:
  88. // OnAgitStart will fall through and spawn the Emperium.
  89. if (strnpcinfo(2) == "aldeg_cas01") { setarray .@emproom[0],216,23; }
  90. else if (strnpcinfo(2) == "aldeg_cas02") { setarray .@emproom[0],213,23; }
  91. else if (strnpcinfo(2) == "aldeg_cas03") { setarray .@emproom[0],205,31; }
  92. else if (strnpcinfo(2) == "aldeg_cas04") { setarray .@emproom[0],36,217; }
  93. else if (strnpcinfo(2) == "aldeg_cas05") { setarray .@emproom[0],27,101; }
  94. else if (strnpcinfo(2) == "gefg_cas01") { setarray .@emproom[0],197,181; }
  95. else if (strnpcinfo(2) == "gefg_cas02") { setarray .@emproom[0],176,178; }
  96. else if (strnpcinfo(2) == "gefg_cas03") { setarray .@emproom[0],244,166; }
  97. else if (strnpcinfo(2) == "gefg_cas04") { setarray .@emproom[0],174,177; }
  98. else if (strnpcinfo(2) == "gefg_cas05") { setarray .@emproom[0],194,184; }
  99. else if (strnpcinfo(2) == "payg_cas01") { setarray .@emproom[0],139,139; }
  100. else if (strnpcinfo(2) == "payg_cas02") { setarray .@emproom[0],38,25; }
  101. else if (strnpcinfo(2) == "payg_cas03") { setarray .@emproom[0],268,264; }
  102. else if (strnpcinfo(2) == "payg_cas04") { setarray .@emproom[0],270,28; }
  103. else if (strnpcinfo(2) == "payg_cas05") { setarray .@emproom[0],30,30; }
  104. else if (strnpcinfo(2) == "prtg_cas01") { setarray .@emproom[0],197,197; }
  105. else if (strnpcinfo(2) == "prtg_cas02") { setarray .@emproom[0],157,174; }
  106. else if (strnpcinfo(2) == "prtg_cas03") { setarray .@emproom[0],16,220; }
  107. else if (strnpcinfo(2) == "prtg_cas04") { setarray .@emproom[0],291,14; }
  108. else if (strnpcinfo(2) == "prtg_cas05") { setarray .@emproom[0],266,266; }
  109. // Add custom Guild Castles here.
  110. else {
  111. end;
  112. }
  113. if (!mobcount(strnpcinfo(2),"Agit#"+strnpcinfo(2)+"::OnAgitBreak")) {
  114. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Emperium",1288,1,"Agit#"+strnpcinfo(2)+"::OnAgitBreak";
  115. }
  116. end;
  117.  
  118. // The Emperium has been broken.
  119. OnAgitBreak:
  120. if ($@woes3_breaker) { //BEGIN CHANGED
  121. if (query_sql("select `char_id` from `woe_pbreaks` where `char_id` = '"+getcharid(0)+"'",.@ignore)) {
  122. query_sql("update `woe_pbreaks` set `breaks` = `breaks`+1 where `char_id` = '"+getcharid(0)+"'",.@ignore);
  123. } else {
  124. query_sql("insert into `woe_pbreaks` values('"+getcharid(0)+"','"+escape_sql(strcharinfo(0))+"','1')",.@ignore);
  125. }
  126. if (query_sql("select `guild_id` from `woe_gbreaks` where `guild_id` = '"+getcharid(2)+"'",.@ignore)) {
  127. query_sql("update `woe_gbreaks` set `breaks` = `breaks`+1 where `guild_id` = '"+getcharid(2)+"'",.@ignore);
  128. } else {
  129. query_sql("insert into `woe_gbreaks` values('"+getcharid(2)+"','"+escape_sql(getguildname(getcharid(2)))+"','1')",.@ignore);
  130. }
  131. } //END CHANGED
  132. set .@GID,getcharid(2);
  133. // Show and log error if an unguilded player breaks the Emperium. (Should NEVER happen)
  134. if (.@GID <= 0) {
  135. set .@notice$,"Character "+strcharinfo(0)+" ("+getcharid(0)+") broke the Emperium in Castle: "+strnpcinfo(2)+" while guildless. No data will be saved and Emperium respawned.";
  136. logmes .@notice$; debugmes .@notice$;
  137. donpcevent "Agit#"+strnpcinfo(2)+"::OnStartArena";
  138. end;
  139. }
  140. // Adjust Economy Invest Level for Castle
  141. set .@Economy,GetCastleData(strnpcinfo(2),2) - 5;
  142. if (.@Economy < 0) set .@Economy, 0;
  143. SetCastleData strnpcinfo(2), 2, .@Economy;
  144. // Adjust Defense Invest Level for Castle
  145. set .@Defence,GetCastleData(strnpcinfo(2),3) - 5;
  146. if (.@Defence < 0) set .@Defence, 0;
  147. SetCastleData strnpcinfo(2), 3, .@Defence;
  148.  
  149. // Set new Castle Occupant
  150. SetCastleData strnpcinfo(2),1, .@GID;
  151.  
  152. // Announce that the Emperium is destroyed, and respawn all but new castle-occupants.
  153. mapannounce strnpcinfo(2),"The emperium has been destroyed.",bc_map,"0x00CCFF";
  154. MapRespawnGuildID strnpcinfo(2),.@GID,2;
  155.  
  156. // Refresh castle data, disable Kafra and reset Invest information.
  157. GetCastleData strnpcinfo(2),0,strnpcinfo(0)+"::OnRecvCastle";
  158. disablenpc "Kafra Staff#"+strnpcinfo(2);
  159. for( set .@i, 4; .@i <= 9; set .@i, .@i+1 ) {
  160. SetCastleData strnpcinfo(2), .@i, 0;
  161. }
  162. // Erase Guardian Database information if the new owners do not have Guardian Research.
  163. if( getgdskilllv(.@GID,10002) == 0 ) {
  164. for( set .@i, 10; .@i <= 17; set .@i, .@i+1 ) {
  165. SetCastleData strnpcinfo(2), .@i, 0;
  166. }
  167. }
  168. // Respawn the Emperium, and display new owners.
  169. if (agitcheck()) {
  170. sleep2 500; // Slow down script execution slightly.
  171. donpcevent "Agit#"+strnpcinfo(2)+"::OnStartArena";
  172. }
  173. sleep2 getbattleflag("gvg_eliminate_time");
  174. if (!$woe_announcebreaker) { announce "The [" + getcastlename(strnpcinfo(2)) + "] castle has been conquered by the [" + getguildName(.@GID) + "] guild.",bc_all; } else { announce "The [" + getcastlename(strnpcinfo(2)) + "] castle has been conquered by "+strcharinfo(0)+" in the [" + getguildName(.@GID) + "] guild.",bc_all; } //CHANGED
  175. end;
  176.  
  177. // War of Emperium has ended.
  178. OnAgitEnd_: //CHANGED
  179. if (strnpcinfo(0) == "Gld_Agit_Manager") end;
  180. GvgOff strnpcinfo(2);
  181. KillMonster strnpcinfo(2),"Agit#"+strnpcinfo(2)+"::OnAgitBreak";
  182. end;
  183.  
  184. // Occupying Guild has been disbanded.
  185. OnGuildBreak:
  186. if (strnpcinfo(0) == "Gld_Agit_Manager") end;
  187. // Kill guardians, disable the Kafra, and set owner to 0.
  188. killmonster strnpcinfo(2),"Guardian#"+strnpcinfo(2)+"::OnGuardianDied";
  189. disablenpc "Kafra Staff#"+strnpcinfo(2);
  190. SetCastleData strnpcinfo(2),0,0;
  191. // Wait before refreshing guild information.
  192. sleep getbattleflag("gvg_eliminate_time");
  193. Announce "Guild Base [" + GetCastleName(strnpcinfo(2)) + "] has been abandoned.",0;
  194. GetCastleData strnpcinfo(2),0,strnpcinfo(0)+"::OnRecvCastle";
  195. end;
  196.  
  197. OnRecvCastle:
  198. RequestGuildInfo GetCastleData(strnpcinfo(2),1);
  199.  
  200. // Spawn Monsters if the castle is empty.
  201. set .@GID, GetCastleData(strnpcinfo(2),1);
  202. if (.@GID == 0&&$woe_mobspawn) { //CHANGED
  203. killmonsterall strnpcinfo(2);
  204. if (compare(strnpcinfo(2),"aldeg")) {
  205. // Normal Spawns
  206. monster strnpcinfo(2),0,0,"Evil Druid",1117,10;
  207. monster strnpcinfo(2),0,0,"Khalitzburg",1132,4;
  208. monster strnpcinfo(2),0,0,"Abysmal Knight",1219,2;
  209. monster strnpcinfo(2),0,0,"Executioner",1205,1;
  210. monster strnpcinfo(2),0,0,"Penomena",1216,10;
  211. monster strnpcinfo(2),0,0,"Alarm",1193,18;
  212. monster strnpcinfo(2),0,0,"Clock",1269,9;
  213. monster strnpcinfo(2),0,0,"Raydric Archer",1276,7;
  214. monster strnpcinfo(2),0,0,"Wanderer",1208,3;
  215. monster strnpcinfo(2),0,0,"Alice",1275,1;
  216. monster strnpcinfo(2),0,0,"Bloody Knight",1268,1;
  217. monster strnpcinfo(2),0,0,"Dark Lord",1272,1;
  218. // Set Emperium room spawn coordinates and spawn monsters.
  219. if (strnpcinfo(2) == "aldeg_cas01") { setarray .@emproom[0],216,23; }
  220. else if (strnpcinfo(2) == "aldeg_cas02") { setarray .@emproom[0],213,23; }
  221. else if (strnpcinfo(2) == "aldeg_cas03") { setarray .@emproom[0],205,31; }
  222. else if (strnpcinfo(2) == "aldeg_cas04") { setarray .@emproom[0],36,217; }
  223. else if (strnpcinfo(2) == "aldeg_cas05") { setarray .@emproom[0],27,101; }
  224. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Dark Lord",1272,1;
  225. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Tower Keeper",1270,4;
  226. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Bloody Knight",1268,1;
  227. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Abysmal Knight",1219,1;
  228. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Raydric Archer",1276,5;
  229. }
  230. else if (compare(strnpcinfo(2),"gefg")) {
  231. // Normal Spawns
  232. monster strnpcinfo(2),0,0,"Evil Druid",1117,10;
  233. monster strnpcinfo(2),0,0,"Wind Ghost",1263,11;
  234. monster strnpcinfo(2),0,0,"Bathory",1102,10;
  235. monster strnpcinfo(2),0,0,"Jakk",1130,10;
  236. monster strnpcinfo(2),0,0,"Marduk",1140,20;
  237. monster strnpcinfo(2),0,0,"Raydric",1163,9;
  238. monster strnpcinfo(2),0,0,"Alice",1275,1;
  239. monster strnpcinfo(2),0,0,"Abysmal Knight",1219,1;
  240. monster strnpcinfo(2),0,0,"Moonlight Flower",1150,1;
  241. monster strnpcinfo(2),0,0,"Phreeoni",1159,1;
  242. // Set Emperium room spawn coordinates and spawn monsters.
  243. if (strnpcinfo(2) == "gefg_cas01") { setarray .@emproom[0],197,181; }
  244. else if (strnpcinfo(2) == "gefg_cas02") { setarray .@emproom[0],176,178; }
  245. else if (strnpcinfo(2) == "gefg_cas03") { setarray .@emproom[0],244,166; }
  246. else if (strnpcinfo(2) == "gefg_cas04") { setarray .@emproom[0],174,177; }
  247. else if (strnpcinfo(2) == "gefg_cas05") { setarray .@emproom[0],194,184; }
  248. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Mysteltainn",1203,1;
  249. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Orc Hero",1087,1;
  250. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"High Orc",1213,10;
  251. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Orc Archer",1189,10;
  252. }
  253. else if (compare(strnpcinfo(2),"payg")) {
  254. // Normal Spawns
  255. monster strnpcinfo(2),0,0,"Greatest General",1277,9;
  256. monster strnpcinfo(2),0,0,"Wanderer",1208,10;
  257. monster strnpcinfo(2),0,0,"Mutant Dragonoid",1262,5;
  258. monster strnpcinfo(2),0,0,"Bathory",1102,5;
  259. monster strnpcinfo(2),0,0,"Moonlight Flower",1150,1;
  260. monster strnpcinfo(2),0,0,"Eddga",1115,1;
  261. monster strnpcinfo(2),0,0,"Horong",1129,11;
  262. monster strnpcinfo(2),0,0,"Raydric Archer",1276,5;
  263. monster strnpcinfo(2),0,0,"Kobold Archer",1282,4;
  264. monster strnpcinfo(2),0,0,"Gargoyle",1253,5;
  265. // Set Emperium room spawn coordinates and spawn monsters.
  266. if (strnpcinfo(2) == "payg_cas01") { setarray .@emproom[0],139,139; }
  267. else if (strnpcinfo(2) == "payg_cas02") { setarray .@emproom[0],38,25; }
  268. else if (strnpcinfo(2) == "payg_cas03") { setarray .@emproom[0],268,264; }
  269. else if (strnpcinfo(2) == "payg_cas04") { setarray .@emproom[0],270,28; }
  270. else if (strnpcinfo(2) == "payg_cas05") { setarray .@emproom[0],30,30; }
  271. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Moonlight Flower",1150,1;
  272. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Eddga",1115,1;
  273. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Wanderer",1208,6;
  274. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Raydric Archer",1276,5;
  275. }
  276. else if (compare(strnpcinfo(2),"prtg")) {
  277. // Normal Spawns
  278. monster strnpcinfo(2),0,0,"Raydric",1163,1;
  279. monster strnpcinfo(2),0,0,"Khalitzburg",1132,10;
  280. monster strnpcinfo(2),0,0,"Abysmal Knight",1219,5;
  281. monster strnpcinfo(2),0,0,"Bloody Knight",1268,5;
  282. monster strnpcinfo(2),0,0,"Stormy Knight",1251,1;
  283. monster strnpcinfo(2),0,0,"Hatii",1252,1;
  284. monster strnpcinfo(2),0,0,"Raydric Archer",1276,5;
  285. monster strnpcinfo(2),0,0,"Gryphon",1259,2;
  286. monster strnpcinfo(2),0,0,"Chimera",1283,3;
  287. monster strnpcinfo(2),0,0,"Alice",1275,1;
  288. monster strnpcinfo(2),0,0,"Zealotus",1200,1;
  289. // Set Emperium room spawn coordinates and spawn monsters.
  290. if (strnpcinfo(2) == "prtg_cas01") { setarray .@emproom[0],197,197; }
  291. else if (strnpcinfo(2) == "prtg_cas02") { setarray .@emproom[0],157,174; }
  292. else if (strnpcinfo(2) == "prtg_cas03") { setarray .@emproom[0],16,220; }
  293. else if (strnpcinfo(2) == "prtg_cas04") { setarray .@emproom[0],291,14; }
  294. else if (strnpcinfo(2) == "prtg_cas05") { setarray .@emproom[0],266,266; }
  295. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Guardian Knight",1268,1;
  296. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Guardian Master",1251,1;
  297. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Hatii",1252,1;
  298. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Guardian Knight",1219,1;
  299. monster strnpcinfo(2),.@emproom[0],.@emproom[1],"Raydric Archer",1276,5;
  300. }
  301. // Add custom Guild Castles here.
  302. else {
  303. end;
  304. }
  305. //donpcevent "Agit#"+strnpcinfo(2)+"::OnStartArena"; //CHANGED
  306. // Disable Kafra Staff...
  307. disablenpc "Kafra Staff#"+strnpcinfo(2);
  308. end;
  309. }
  310. else {
  311. // Otherwise place the guild emblem on flags.
  312. if (strnpcinfo(2) == "aldeg_cas01") { donpcevent "::OnRecvCastleA01"; }
  313. else if (strnpcinfo(2) == "aldeg_cas02") { donpcevent "::OnRecvCastleA02"; }
  314. else if (strnpcinfo(2) == "aldeg_cas03") { donpcevent "::OnRecvCastleA03"; }
  315. else if (strnpcinfo(2) == "aldeg_cas04") { donpcevent "::OnRecvCastleA04"; }
  316. else if (strnpcinfo(2) == "aldeg_cas05") { donpcevent "::OnRecvCastleA05"; }
  317. else if (strnpcinfo(2) == "gefg_cas01") { donpcevent "::OnRecvCastleG01"; }
  318. else if (strnpcinfo(2) == "gefg_cas02") { donpcevent "::OnRecvCastleG02"; }
  319. else if (strnpcinfo(2) == "gefg_cas03") { donpcevent "::OnRecvCastleG03"; }
  320. else if (strnpcinfo(2) == "gefg_cas04") { donpcevent "::OnRecvCastleG04"; }
  321. else if (strnpcinfo(2) == "gefg_cas05") { donpcevent "::OnRecvCastleG05"; }
  322. else if (strnpcinfo(2) == "payg_cas01") { donpcevent "::OnRecvCastlePy01"; }
  323. else if (strnpcinfo(2) == "payg_cas02") { donpcevent "::OnRecvCastlePy02"; }
  324. else if (strnpcinfo(2) == "payg_cas03") { donpcevent "::OnRecvCastlePy03"; }
  325. else if (strnpcinfo(2) == "payg_cas04") { donpcevent "::OnRecvCastlePy04"; }
  326. else if (strnpcinfo(2) == "payg_cas05") { donpcevent "::OnRecvCastlePy05"; }
  327. else if (strnpcinfo(2) == "prtg_cas01") { donpcevent "::OnRecvCastlePt01"; }
  328. else if (strnpcinfo(2) == "prtg_cas02") { donpcevent "::OnRecvCastlePt02"; }
  329. else if (strnpcinfo(2) == "prtg_cas03") { donpcevent "::OnRecvCastlePt03"; }
  330. else if (strnpcinfo(2) == "prtg_cas04") { donpcevent "::OnRecvCastlePt04"; }
  331. else if (strnpcinfo(2) == "prtg_cas05") { donpcevent "::OnRecvCastlePt05"; }
  332. // Add custom Guild Castles here.
  333. else {
  334. end;
  335. }
  336. // And load purchased Guardian in castles.
  337. donpcevent "Guardian#"+strnpcinfo(2)+"::OnSpawnGuardians";
  338. // And display Kafra if purchased.
  339. if (GetCastleData(strnpcinfo(2),9) < 1) disablenpc "Kafra Staff#"+strnpcinfo(2);
  340. }
  341. end;
  342. }
  343.  
  344. // Guild Steward Template
  345. //============================================================
  346. - script Gld_Mngr_Template::Gld_Mngr_Template -1,{
  347. OnTalk: //CHANGED
  348. // What is the Display Name of the NPC?
  349. set .@name$,strnpcinfo(1);
  350.  
  351. // Store the Guild ID of castle occupant.
  352. set .@GID, GetCastleData(strnpcinfo(2),1);
  353.  
  354. // Define the types of guardians on a per castle basis.
  355. // 1 - Soldier Guardian; 2 - Archer Guardian; 3 - Knight Guardian
  356. // Define the x spawn point for each uardian.
  357. // [0] = 1st guardian's x spawn point.
  358. // Define the y spawn point for each guardian.
  359. // [0] = 1st guardian's y spawn point.
  360. // Define the coordinates of the "Treasure Room."
  361. // Aldebaran (Luina) Castles
  362. if (strnpcinfo(2) == "aldeg_cas01") {
  363. setarray .@guardiantype[0],1,2,2,2,2,3,3,3;
  364. setarray .@guardianposx[0],17,39,38,45,21,218,213,73;
  365. setarray .@guardianposy[0],218,208,196,228,194,24,24,70;
  366. setarray .@masterroom[0],113,223;
  367. }
  368. else if (strnpcinfo(2) == "aldeg_cas02") {
  369. setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
  370. setarray .@guardianposx[0],27,88,117,60,51,21,36,210;
  371. setarray .@guardianposy[0],184,43,46,202,183,177,183,7;
  372. setarray .@masterroom[0],134,225;
  373. }
  374. else if (strnpcinfo(2) == "aldeg_cas03") {
  375. setarray .@guardiantype[0],3,3,1,1,1,2,2,2;
  376. setarray .@guardianposx[0],90,116,86,116,64,212,195,110;
  377. setarray .@guardianposy[0],112,112,120,76,103,160,151,217;
  378. setarray .@masterroom[0],229,267;
  379. }
  380. else if (strnpcinfo(2) == "aldeg_cas04") {
  381. setarray .@guardiantype[0],2,2,2,1,1,1,3,3;
  382. setarray .@guardianposx[0],187,192,148,145,169,198,48,55;
  383. setarray .@guardianposy[0],100,42,88,209,53,77,72,88;
  384. setarray .@masterroom[0],83,17;
  385. }
  386. else if (strnpcinfo(2) == "aldeg_cas05") {
  387. setarray .@guardiantype[0],2,2,1,1,3,3,3,3;
  388. setarray .@guardianposx[0],51,188,157,157,27,145,156,41;
  389. setarray .@guardianposy[0],202,79,192,74,221,78,73,112;
  390. setarray .@masterroom[0],64,8;
  391. }
  392. // Geffen (Britoniah) Castles
  393. else if (strnpcinfo(2) == "gefg_cas01") {
  394. setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
  395. setarray .@guardianposx[0],67,184,62,36,50,50,189,200;
  396. setarray .@guardianposy[0],179,20,41,186,186,67,41,167;
  397. setarray .@masterroom[0],152,117;
  398. }
  399. else if (strnpcinfo(2) == "gefg_cas02") {
  400. setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
  401. setarray .@guardianposx[0],64,56,166,35,20,19,166,159;
  402. setarray .@guardianposy[0],168,41,25,148,150,41,42,188;
  403. setarray .@masterroom[0],145,115;
  404. }
  405. else if (strnpcinfo(2) == "gefg_cas03") {
  406. setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
  407. setarray .@guardianposx[0],48,113,48,157,243,157,234,238;
  408. setarray .@guardianposy[0],176,214,207,62,41,45,25,160;
  409. setarray .@masterroom[0],275,289;
  410. }
  411. else if (strnpcinfo(2) == "gefg_cas04") {
  412. setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
  413. setarray .@guardianposx[0],53,31,49,29,147,57,160,148;
  414. setarray .@guardianposy[0],191,178,220,46,65,46,50,189;
  415. setarray .@masterroom[0],116,123;
  416. }
  417. else if (strnpcinfo(2) == "gefg_cas05") {
  418. setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
  419. setarray .@guardianposx[0],45,71,72,66,177,66,177,193;
  420. setarray .@guardianposy[0],149,163,142,47,50,17,35,166;
  421. setarray .@masterroom[0],149,106;
  422. }
  423. // Payon (Baulder) Castles
  424. else if (strnpcinfo(2) == "payg_cas01") {
  425. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  426. setarray .@guardianposx[0],229,225,222,99,65,36,51,138;
  427. setarray .@guardianposy[0],92,80,111,45,31,127,144,133;
  428. setarray .@masterroom[0],295,8;
  429. }
  430. else if (strnpcinfo(2) == "payg_cas02") {
  431. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  432. setarray .@guardianposx[0],237,228,210,57,42,287,264,27;
  433. setarray .@guardianposy[0],54,72,41,241,241,257,272,20;
  434. setarray .@masterroom[0],141,149;
  435. }
  436. else if (strnpcinfo(2) == "payg_cas03") {
  437. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  438. setarray .@guardianposx[0],245,269,36,41,39,19,37,268;
  439. setarray .@guardianposy[0],37,51,39,39,65,276,277,244;
  440. setarray .@masterroom[0],163,167;
  441. }
  442. else if (strnpcinfo(2) == "payg_cas04") {
  443. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  444. setarray .@guardianposx[0],251,232,231,32,32,35,36,270;
  445. setarray .@guardianposy[0],212,212,175,287,232,45,17,41;
  446. setarray .@masterroom[0],151,47;
  447. }
  448. else if (strnpcinfo(2) == "payg_cas05") {
  449. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  450. setarray .@guardianposx[0],19,33,266,266,263,263,250,36;
  451. setarray .@guardianposy[0],279,260,234,279,37,21,22,36;
  452. setarray .@masterroom[0],153,137;
  453. }
  454. // Prontera (Valkyrie Realms) Castles
  455. else if (strnpcinfo(2) == "prtg_cas01") {
  456. setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
  457. setarray .@guardianposx[0],182,182,153,59,50,184,196,107;
  458. setarray .@guardianposy[0],62,116,86,28,36,183,189,179;
  459. setarray .@masterroom[0],15,209;
  460. }
  461. else if (strnpcinfo(2) == "prtg_cas02") {
  462. setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
  463. setarray .@guardianposx[0],161,153,178,71,49,64,7,75;
  464. setarray .@guardianposy[0],161,161,44,75,28,186,196,175;
  465. setarray .@masterroom[0],207,229;
  466. }
  467. else if (strnpcinfo(2) == "prtg_cas03") {
  468. setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
  469. setarray .@guardianposx[0],191,137,45,50,41,191,179,191;
  470. setarray .@guardianposy[0],190,190,99,87,87,42,43,72;
  471. setarray .@masterroom[0],190,130;
  472. }
  473. else if (strnpcinfo(2) == "prtg_cas04") {
  474. setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
  475. setarray .@guardianposx[0],276,274,246,38,29,33,78,36;
  476. setarray .@guardianposy[0],14,35,246,240,240,258,48,61;
  477. setarray .@masterroom[0],275,160;
  478. }
  479. else if (strnpcinfo(2) == "prtg_cas05") {
  480. setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
  481. setarray .@guardianposx[0],266,287,245,236,251,278,32,44;
  482. setarray .@guardianposy[0],262,280,250,63,63,253,253,248;
  483. setarray .@masterroom[0],281,176;
  484. }
  485. // Add custom Guild Castles here.
  486. else {
  487. end;
  488. }
  489.  
  490. mes "[ Steward " + .@name$ + " ]";
  491. if (.@GID == 0 && getgmlevel() < $woe_mingmlv) { //CHANGED
  492. mes "I'm waiting for my master to return.";
  493. mes "If you wish to speak with him, you will have to wait as well. ";
  494.  
  495. close;
  496. }
  497. if ((getcharid(2) != .@GID || strcharinfo(0) != getguildmaster(.@GID)) && getgmlevel() < $woe_mingmlv){ //CHANGED
  498. mes "I am loyal and I will follow my master ^ff0000" + getguildmaster(.@GID) + "^000000. We are Guardians! We defend to the bitter end!";
  499. close;
  500. }
  501. if (getgmlevel()) { mes "Welcome. Game Master, ^ff0000" + strcharinfo(0) + "^000000..."; } else { mes "Welcome. My honorable master, ^ff0000" + getguildmaster(.@GID) + "^000000..."; } //CHANGED
  502. mes "Whatever you need, I am at your service. I will be faithful in my duties.";
  503. next;
  504. switch(select("castle briefing:Invest in commercial growth:Invest in safeguard:Summon Guardian:Employ / discharge storehouse staff:Go into Master's room")) {
  505. case 1:
  506. mes "[ Steward " + .@name$ + " ]";
  507. mes "I will report the Castle briefing, Master.";
  508. mes " ";
  509. mes " ^0000ffNow, commercial growth level is " + GetCastleData(strnpcinfo(2),2) + ".";
  510. if (GetCastleData(strnpcinfo(2),4)) {
  511. mes " You invested " + GetCastleData(strnpcinfo(2),4) + "times in last 1 day.";
  512. }
  513. mes " Now, safeguard level is " + GetCastleData(strnpcinfo(2),3) + ".^000000";
  514. if (GetCastleData(strnpcinfo(2),5)) {
  515. mes " ^0000ff- You invested " + GetCastleData(strnpcinfo(2),5) + "times in last 1 day.^000000";
  516. }
  517. mes " ";
  518. mes "That's all to report, Master.";
  519. close;
  520. case 2:
  521. set .@Economy,GetCastleData(strnpcinfo(2),2);
  522. if(.@Economy < 8) set .@eco_invest,10000;
  523. if(.@Economy >= 8) set .@eco_invest,20000;
  524. if(.@Economy >= 16) set .@eco_invest,40000;
  525. if(.@Economy >= 25) set .@eco_invest,80000;
  526. if(.@Economy >= 34) set .@eco_invest,160000;
  527. if(.@Economy >= 44) set .@eco_invest,320000;
  528. if(.@Economy >= 54) set .@eco_invest,640000;
  529. if(.@Economy >= 65) set .@eco_invest,1280000;
  530. if(.@Economy >= 76) set .@eco_invest,2560000;
  531. if(.@Economy >= 88) set .@eco_invest,5120000;
  532. //Double the cost of investing if you've already invested once.
  533. if (GetCastleData(strnpcinfo(2),4)) {
  534. set .@eco_invest,.@eco_invest*2;
  535. }
  536. mes "[ Steward " + .@name$ + " ]";
  537. mes "If you raise commercial growth, the quantity of goods made by the guild will increase. So if you want a prosperous future, investment will be required.";
  538. mes " ";
  539. mes "Originally you can invest just once but if you pay more money, you can invest twice.";
  540. mes " ";
  541. if (.@Economy == 100) {
  542. mes "^ff0000But the commercial growth level of our castle is peaked at 100%. It doesn't need any more investment. As I expected you have a great acumen, Master.^000000";
  543. close;
  544. }
  545. if (GetCastleData(strnpcinfo(2),4) == 2) {
  546. mes "^ff0000But you already invested twice today so you cannot invest any more.^000000 I expect our riches to increase in growth level.";
  547. close;
  548. }
  549. if (GetCastleData(strnpcinfo(2),4) == 0) {
  550. mes "Now the needed investment amount is ^ff0000" + .@eco_invest + "^000000 zeny. Will you invest?";
  551. }
  552. else {
  553. mes "You've invested once today... if you wish to invest once more, ^ff0000" + .@eco_invest + "^000000 more zeny will be needed.";
  554. }
  555. next;
  556. switch(select("Invest in commercial growth:Cancel")) {
  557. case 1:
  558. if (Zeny < .@eco_invest) {
  559. mes "[ Steward " + .@name$ + " ]";
  560. mes "I'm sorry but there is not enough zeny to invest. You will have to try again when you have the funds, Master.";
  561. close;
  562. }
  563. set zeny,zeny-.@eco_invest;
  564. SetCastleData strnpcinfo(2),4,GetCastleData(strnpcinfo(2),4)+1;
  565. SetCastleData strnpcinfo(2),2,.@Economy + 1 + (.@Economy<99 && rand(2) && getgdskilllv(.@GID,10014));
  566. mes "[ Steward " + .@name$ + "]";
  567. mes "We finished the investment safely. I expect that our growth level will be increased by tomorrow.";
  568. close;
  569. case 2:
  570. mes "[ Steward " + .@name$ + " ]";
  571. mes "I'll do as you bid, my master... There is no hurry. We will do our best.";
  572. close;
  573. }
  574. case 3:
  575. set .@Defence,GetCastleData(strnpcinfo(2),3);
  576. if(.@Defence < 8) set .@def_invest,20000;
  577. if(.@Defence >= 8) set .@def_invest,40000;
  578. if(.@Defence >= 16) set .@def_invest,80000;
  579. if(.@Defence >= 25) set .@def_invest,160000;
  580. if(.@Defence >= 34) set .@def_invest,320000;
  581. if(.@Defence >= 44) set .@def_invest,640000;
  582. if(.@Defence >= 54) set .@def_invest,1280000;
  583. if(.@Defence >= 65) set .@def_invest,2560000;
  584. if(.@Defence >= 76) set .@def_invest,5120000;
  585. if(.@Defence >= 88) set .@def_invest,10240000;
  586. //Double the cost of investing if you've already invested once.
  587. if (GetCastleData(strnpcinfo(2),5)) {
  588. set .@def_invest,.@def_invest*2;
  589. }
  590. mes "[ Steward " + .@name$ + " ]";
  591. mes "If you raise the safeguard, the durability of the Guardians and emperium will increase. So if you expect more defenses in battles, investment will be required.";
  592. mes " ";
  593. mes "Originally you can invest just once but if you pay more money, you can invest twice.";
  594. mes " ";
  595. if (.@Defence == 100) {
  596. mes "^ff0000But the safeguard level of our castle is peaked at 100%. It doesn't need any more investment. As I expected you have a great acumen, Master.^000000";
  597. close;
  598. }
  599. if (GetCastleData(strnpcinfo(2),5) == 2) {
  600. mes "^ff0000But you already invested twice today so you cannot invest any more.^000000 I expect our riches to increase in growth level.";
  601. close;
  602. }
  603. if (GetCastleData(strnpcinfo(2),5) == 0) {
  604. mes "Now the needed investment amount is ^ff0000" + .@def_invest + "^000000 zeny. Will you invest?";
  605. }
  606. else {
  607. mes "You've invested once today... if you wish to invest once more, ^ff0000" + .@def_invest + "^000000 more zeny will be needed.";
  608. }
  609. next;
  610. switch(select("Invest in safeguard.:Cancel")) {
  611. case 1:
  612. if (Zeny < .@def_invest) {
  613. mes "[ Steward " + .@name$ + " ]";
  614. mes "I'm sorry but there is not enough zeny to invest. You will have to try again when you have the funds, Master.";
  615. close;
  616. }
  617. set zeny,zeny-.@def_invest;
  618. SetCastleData strnpcinfo(2),5,GetCastleData(strnpcinfo(2),5)+1;
  619. SetCastleData strnpcinfo(2),3,.@Defence+1;
  620. mes "[ Steward " + .@name$ + "]";
  621. mes "We finished the investment safely. I expect that the safeguard level will be increased by tomorrow.";
  622. close;
  623. case 2:
  624. mes "[ Steward " + .@name$ + " ]";
  625. mes "I'll do as you bid, my master... There is no hurry. We will do our best.";
  626. close;
  627.  
  628. }
  629. case 4:
  630. mes "[ Steward " + .@name$ + " ]";
  631. mes "Will you summon a Guardian? It'll be a protector to defend us loyally.";
  632. mes "Please select a guardian to defend us.";
  633. next;
  634. for( set .@i, 0; .@i <= 7 ; set .@i, .@i+1 ) {
  635. if (.@guardiantype[.@i] == 1) { set .@type$,"Guardian Soldier"; }
  636. else if (.@guardiantype[.@i] == 2) { set .@type$,"Guardian Archer"; }
  637. else { set .@type$,"Guardian Knight"; }
  638. if (guardianinfo(strnpcinfo(2),.@i,0)) {
  639. setarray .@gname$[.@i], .@type$ + " - Implemented (" + guardianinfo(strnpcinfo(2),.@i,2) + "/" + guardianinfo(strnpcinfo(2),.@i,1) + ")";
  640. }
  641. else {
  642. setarray .@gname$[.@i], .@type$ + " - Not Implemented";
  643. }
  644. }
  645. set .@menu$,.@gname$[0]+":"+.@gname$[1]+":"+.@gname$[2]+":"+.@gname$[3]+":"+.@gname$[4]+":"+.@gname$[5]+":"+.@gname$[6]+":"+.@gname$[7];
  646. set .@GDnum,select(.@menu$)+9;
  647. mes "[ Steward " + .@name$ + " ]";
  648. mes "Will you summon the chosen guardian? 10000 zeny is required to summon.";
  649. next;
  650. switch(select("Summon:Cancel")) {
  651. case 1:
  652. mes "[ Steward " + .@name$ + " ]";
  653. if (getgdskilllv(.@GID,10002) == 0) {
  654. mes "Master, we have not the resources to Summon the Guardian. If you want to accumulate them, you have to learn the Guild skill, We failed to summon the Guardian.";
  655. close;
  656. }
  657. if (GetCastleData(strnpcinfo(2),.@GDnum) == 1) {
  658. mes "Master, you already have summoned that Guardian. We cannot summon another.";
  659. close;
  660. }
  661.  
  662. if (Zeny < 1000) {
  663. mes "Well... I'm sorry but we don't have funds to summon the Guardian. We failed to summon the Guardian.";
  664. close;
  665. }
  666. set zeny,zeny-10000;
  667. SetCastleData strnpcinfo(2),.@GDnum,1; // mark as 'installed'
  668. set .@UseGID,.@GDnum - 10;
  669. if (.@guardiantype[.@UseGID] == 1) { set .@type,1287; }
  670. else if (.@guardiantype[.@UseGID] == 2) { set .@type,1285; }
  671. else { set .@type,1286; }
  672. guardian strnpcinfo(2),.@guardianposx[.@UseGID],.@guardianposy[.@UseGID],strmobinfo(2,.@type),.@type,"Guardian#"+strnpcinfo(2)+"::OnGuardianDied",.@UseGID;
  673. mes "We completed the summoning of the Guardian. Our defenses are now increased with it in place.";
  674. close;
  675. case 2:
  676. mes "[ Steward " + .@name$ + " ]";
  677. mes "I did as you ordered. But please remember if you the have money to spare, it'll be better to set it up.";
  678. close;
  679. }
  680. case 5:
  681. if (GetCastleData(strnpcinfo(2),9) == 1) {
  682. mes "[ Steward " + .@name$ + " ]";
  683. mes "Now about the Kafra staff... Will you discharge the Kafra staff?";
  684. next;
  685. switch(select("Discharge:Cancel")) {
  686. case 1:
  687. cutin "kafra_01",2;
  688. mes "[ Hired Kafra staff ]";
  689. mes "I worked so hard... How can this be, Master?... I'll work harder if you're displeased... Please reconsider, Master.";
  690. next;
  691. switch(select("Discharge:Cancel")) {
  692. case 1:
  693. mes "[ Hired Kafra staff ]";
  694. mes "Oh, my god! This is nonsense!";
  695. next;
  696. cutin "kafra_01",255;
  697. break;
  698. case 2:
  699. mes "[ Hired Kafra staff ]";
  700. mes "I'll work harder... Thank you!";
  701. close2;
  702. cutin "kafra_01",255;
  703. end;
  704. }
  705. case 2:
  706. mes "[ Steward " + .@name$ + " ]";
  707. mes "Those Kafra are hard workers. I thought it would be best to keep the staff.";
  708. close;
  709. }
  710. disablenpc "Kafra Staff#"+strnpcinfo(2);
  711. SetCastleData strnpcinfo(2),9,0;
  712. mes "[ Steward " + .@name$ + " ]";
  713. mes "....";
  714. mes "Discharged Kafra staff... But... are you displeased with something?";
  715. close;
  716. }
  717. else {
  718. mes "[ Steward " + .@name$ + " ]";
  719. mes "Will you contract with the Kafra head office to hire Kafra staff in our castle?";
  720. mes "^ff0000 10000zeny is needed to hire. ";
  721. next;
  722. switch(select("Hire.:Cancel")) {
  723. case 1:
  724. mes "[ Steward " + .@name$ + " ]";
  725. if (getgdskilllv(.@GID,10001) == 0) {
  726. mes "Master, we cannot hire Kafra staff because we didn't make a contract with the Kafra head office. If you want to make a contract with the Kafra head office, you have to learn the Guild skill.";
  727. close;
  728. }
  729. if (Zeny < 10000) {
  730. mes "Well... I'm sorry but we don't have enough funds. We are unable to hire the Kafra staff.";
  731. close;
  732. }
  733. set zeny,zeny-10000;
  734. enablenpc "Kafra Staff#"+strnpcinfo(2);
  735. SetCastleData strnpcinfo(2),9,1;
  736. mes "We finished making the contract with the Kafra head office successfully. We hired a Kafra staff.";
  737. next;
  738. cutin "kafra_01",2;
  739. mes "[ Hired Kafra staff ]";
  740. mes "How do you do? I'm a dispatched Kafra from head office.";
  741. mes "I'll do my best to upkeep the reputation of Guild.";
  742. next;
  743. cutin "kafra_01",255 ;
  744. mes "[ Steward " + .@name$ + " ]";
  745. mes "The contract term of the hired Kafra staff is 1 month and after this term, you will have to pay an additional charge.";
  746. mes "It will be useful for our members.";
  747. close;
  748. case 2:
  749. mes "[ Steward " + .@name$ + " ]";
  750. mes "I did as you ordered, but some of our members will be unhappy. It will be better to hire a Kafra staff quickly.";
  751. close;
  752. }
  753. }
  754. case 6:
  755. mes "[ Steward " + .@name$ + " ]";
  756. mes "Do you want to visit the room where our valuables are stored?";
  757. mes "That room is restricted to you... you are the only one with access to it.";
  758. next;
  759. switch(select("Go into Master's room.:Cancel")) {
  760. case 1:
  761. mes "[ Steward " + .@name$ + " ]";
  762. mes "Please follow me, I will show you the secret passage.";
  763. mes "When you wish to return, pull this lever here...";
  764. close2;
  765. warp strnpcinfo(2),.@masterroom[0],.@masterroom[1];
  766. end;
  767. case 2:
  768. mes "[ Steward " + .@name$ + " ]";
  769. mes "Goods are produced once a day... if you don't make use of them, they will not produce.";
  770. mes "Therefore it would be better that you remove them over time for the Guild.";
  771. close;
  772. }
  773. }
  774. }
  775.  
  776.  
  777. // Guardian Spawner Template
  778. //============================================================
  779. - script Gld_Guard_Template::Gld_Guard_Template -1,{
  780. // Spawn Guardians in castles
  781. // When adding new castles, ensure that the coordinates coincide
  782. // with the coordinates defined in the Guild Steward template.
  783. OnSpawnGuardians:
  784. // Define the types of guardians on a per castle basis.
  785. // 1 - Soldier Guardian; 2 - Archer Guardian; 3 - Knight Guardian
  786. // Define the x spawn point for each uardian.
  787. // [0] = 1st guardian's x spawn point.
  788. // Define the y spawn point for each uardian.
  789. // [0] = 1st guardian's y spawn point.
  790. // Aldebaran (Luina) Castles
  791. if (strnpcinfo(2) == "aldeg_cas01") {
  792. setarray .@guardiantype[0],1,2,2,2,2,3,3,3;
  793. setarray .@guardianposx[0],17,39,38,45,21,218,213,73;
  794. setarray .@guardianposy[0],218,208,196,228,194,24,24,70;
  795. }
  796. else if (strnpcinfo(2) == "aldeg_cas02") {
  797. setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
  798. setarray .@guardianposx[0],27,88,117,60,51,21,36,210;
  799. setarray .@guardianposy[0],184,43,46,202,183,177,183,7;
  800. }
  801. else if (strnpcinfo(2) == "aldeg_cas03") {
  802. setarray .@guardiantype[0],3,3,1,1,1,2,2,2;
  803. setarray .@guardianposx[0],90,116,86,116,64,212,195,110;
  804. setarray .@guardianposy[0],112,112,120,76,103,160,151,217;
  805. }
  806. else if (strnpcinfo(2) == "aldeg_cas04") {
  807. setarray .@guardiantype[0],2,2,2,1,1,1,3,3;
  808. setarray .@guardianposx[0],187,192,148,145,169,198,48,55;
  809. setarray .@guardianposy[0],100,42,88,209,53,77,72,88;
  810. }
  811. else if (strnpcinfo(2) == "aldeg_cas05") {
  812. setarray .@guardiantype[0],2,2,1,1,3,3,3,3;
  813. setarray .@guardianposx[0],51,188,157,157,27,145,156,41;
  814. setarray .@guardianposy[0],202,79,192,74,221,78,73,112;
  815. }
  816. // Geffen (Britoniah) Castles
  817. else if (strnpcinfo(2) == "gefg_cas01") {
  818. setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
  819. setarray .@guardianposx[0],67,184,62,36,50,50,189,200;
  820. setarray .@guardianposy[0],179,20,41,186,186,67,41,167;
  821. }
  822. else if (strnpcinfo(2) == "gefg_cas02") {
  823. setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
  824. setarray .@guardianposx[0],64,56,166,35,20,19,166,159;
  825. setarray .@guardianposy[0],168,41,25,148,150,41,42,188;
  826. }
  827. else if (strnpcinfo(2) == "gefg_cas03") {
  828. setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
  829. setarray .@guardianposx[0],48,113,48,157,243,157,234,238;
  830. setarray .@guardianposy[0],176,214,207,62,41,45,25,160;
  831. }
  832. else if (strnpcinfo(2) == "gefg_cas04") {
  833. setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
  834. setarray .@guardianposx[0],53,31,49,29,147,57,160,148;
  835. setarray .@guardianposy[0],191,178,220,46,65,46,50,189;
  836. }
  837. else if (strnpcinfo(2) == "gefg_cas05") {
  838. setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
  839. setarray .@guardianposx[0],45,71,72,66,177,66,177,193;
  840. setarray .@guardianposy[0],149,163,142,47,50,17,35,166;
  841. }
  842. // Payon (Baulder) Castles
  843. else if (strnpcinfo(2) == "payg_cas01") {
  844. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  845. setarray .@guardianposx[0],229,225,222,99,65,36,51,138;
  846. setarray .@guardianposy[0],92,80,111,45,31,127,144,133;
  847. }
  848. else if (strnpcinfo(2) == "payg_cas02") {
  849. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  850. setarray .@guardianposx[0],237,228,210,57,42,287,264,27;
  851. setarray .@guardianposy[0],54,72,41,241,241,257,272,20;
  852. }
  853. else if (strnpcinfo(2) == "payg_cas03") {
  854. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  855. setarray .@guardianposx[0],245,269,36,41,39,19,37,268;
  856. setarray .@guardianposy[0],37,51,39,39,65,276,277,244;
  857. }
  858. else if (strnpcinfo(2) == "payg_cas04") {
  859. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  860. setarray .@guardianposx[0],251,232,231,32,32,35,36,270;
  861. setarray .@guardianposy[0],212,212,175,287,232,45,17,41;
  862. }
  863. else if (strnpcinfo(2) == "payg_cas05") {
  864. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  865. setarray .@guardianposx[0],19,33,266,266,263,263,250,36;
  866. setarray .@guardianposy[0],279,260,234,279,37,21,22,36;
  867. }
  868. // Prontera (Valkyrie Realms) Castles
  869. else if (strnpcinfo(2) == "prtg_cas01") {
  870. setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
  871. setarray .@guardianposx[0],182,182,153,59,50,184,196,107;
  872. setarray .@guardianposy[0],62,116,86,28,36,183,189,179;
  873. }
  874. else if (strnpcinfo(2) == "prtg_cas02") {
  875. setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
  876. setarray .@guardianposx[0],161,153,178,71,49,64,7,75;
  877. setarray .@guardianposy[0],161,161,44,75,28,186,196,175;
  878. }
  879. else if (strnpcinfo(2) == "prtg_cas03") {
  880. setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
  881. setarray .@guardianposx[0],191,137,45,50,41,191,179,191;
  882. setarray .@guardianposy[0],190,190,99,87,87,42,43,72;
  883. }
  884. else if (strnpcinfo(2) == "prtg_cas04") {
  885. setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
  886. setarray .@guardianposx[0],276,274,246,38,29,33,78,36;
  887. setarray .@guardianposy[0],14,35,246,240,240,258,48,61;
  888. }
  889. else if (strnpcinfo(2) == "prtg_cas05") {
  890. setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
  891. setarray .@guardianposx[0],266,287,245,236,251,278,32,44;
  892. setarray .@guardianposy[0],262,280,250,63,63,253,253,248;
  893. }
  894. // Add custom Guild Castles here.
  895. else {
  896. end;
  897. }
  898.  
  899. // Kill all existing guardians before spawning new ones.
  900. // This should prevent duplicating Guardians when char Server disconnects.
  901. killmonster strnpcinfo(2),strnpcinfo(0)+"::OnGuardianDied";
  902.  
  903. for( set .@i, 0; .@i <= 7 ; set .@i, .@i+1 ) {
  904. set .@UseGID,.@i + 10;
  905. if (.@guardiantype[.@i] == 1) { set .@type,1287; }
  906. else if (.@guardiantype[.@i] == 2) { set .@type,1285; }
  907. else { set .@type,1286; }
  908. if (GetCastleData(strnpcinfo(2),.@UseGID)) {
  909. guardian strnpcinfo(2),.@guardianposx[.@i],.@guardianposy[.@i],strmobinfo(2,.@type),.@type,"Guardian#"+strnpcinfo(2)+"::OnGuardianDied",.@i;
  910. }
  911. }
  912. end;
  913.  
  914. OnGuardianDied:
  915. end;
  916. }
  917.  
  918. // Kafra Template
  919. //============================================================
  920. - script Gld_Kafra_Template::Gld_Kafra_Template -1,{
  921. // Store the Guild ID of castle occupant.
  922. set .@GID, GetCastleData(strnpcinfo(2),1);
  923.  
  924. if (compare(strnpcinfo(2),"aldeg")) {
  925. setarray .@destination$[0],"Al De Baran","aldebaran";
  926. setarray .@coordinates[0],132,103;
  927. }
  928. else if (compare(strnpcinfo(2),"gefg")) {
  929. setarray .@destination$[0],"Geffen","geffen";
  930. setarray .@coordinates[0],120,39;
  931. }
  932. else if (compare(strnpcinfo(2),"payg")) {
  933. setarray .@destination$[0],"Payon","payon";
  934. setarray .@coordinates[0],70,100;
  935. }
  936. else if (compare(strnpcinfo(2),"prtg")) {
  937. setarray .@destination$[0],"Prontera","prontera";
  938. setarray .@coordinates[0],116,72;
  939. }
  940. // Add custom Guild Castles here.
  941. else {
  942. end;
  943. }
  944.  
  945. cutin "kafra_01",2;
  946. if (getcharid(2) == .@GID) {
  947. mes "[Kafra staff]";
  948. mes "Welcome. ^ff0000" + getguildname(.@GID) + "^000000 Member.";
  949. mes "The Kafra Coporation will stay with you wherever you go.";
  950. next;
  951. switch(select("Use Storage:Use Guild Storage:Use Warp Service:Rent a Cart:Cancel")) {
  952. case 1:
  953. if (basicskillcheck() && getskilllv("NV_BASIC") < 6) {
  954. mes "[Kafra staff]";
  955. mes "I am sorry but you have to be at least Novice skill level 6 if you want to use the storage.";
  956. }
  957. else {
  958. callfunc("F_CheckKafCode"); //check your storage password, if set
  959. openstorage;
  960. }
  961. break;
  962. case 2:
  963. // Unofficial, but since it's already been in eA for ages
  964. // and used, I can't exactly remove it, now, can I? >:(
  965. if(guildopenstorage(0) == 1){
  966. mes "[Kafra Employee]";
  967. mes "I'm sorry but another guild member is using the guild storage";
  968. mes "right now. Please wait until that person is finished.";
  969. close2;
  970. cutin "", 255;
  971. end;
  972. }
  973. cutin "", 255;
  974. close;
  975. case 3:
  976. mes "[Kafra staff]";
  977. mes "Please let me know your destination.";
  978. next;
  979. switch(select(.@destination$ + " ^880000200 ^000000z:Cancel")) {
  980. case 1:
  981. if (Zeny < 200) {
  982. mes "[Kafra staff]";
  983. mes "You don't have enough money. Please check again.";
  984. }
  985. else {
  986. set zeny,zeny-200;
  987. set kf_10_pit,kf_10_pit+2;
  988. cutin "kafra_01",255;
  989. warp .@destination$[1],.@coordinates[0],.@coordinates[1];
  990. end;
  991. }
  992. break;
  993. case 2:
  994. break;
  995. }
  996. break;
  997. case 4:
  998. if(baseClass != Job_Merchant){
  999. mes "[Kafra staff]";
  1000. mes "I am sorry. The Cart Service is only provided for the Merchant and Blacksmith class.";
  1001. }
  1002. else if(checkcart() == 1){
  1003. mes "[Kafra staff]";
  1004. mes "You have a cart equipped already.";
  1005. }
  1006. else {
  1007. mes "[Kafra staff]" ;
  1008. mes "The cart fee is 800 zeny. Do you want to rent a cart?";
  1009. next;
  1010. switch(select("Yes.:Cancel.")) {
  1011. case 1:
  1012. if (Zeny < 800) {
  1013. mes "[Kafra staff]";
  1014. mes "You don't have enough Money. You need 800 Zeny to rent a cart.";
  1015. }
  1016. else {
  1017. close2;
  1018. cutin "kafra_01",255;
  1019. set kf_10_pit,kf_10_pit+8;
  1020. set zeny,zeny-800;
  1021. setcart;
  1022. end;
  1023. }
  1024. break;
  1025. case 2:
  1026. break;
  1027. }
  1028. }
  1029. break;
  1030. case 5:
  1031. mes "[Kafra staff]";
  1032. mes "The Kafra corp. always tries to give the best service.";
  1033. mes "Thank you for using Kafra corp. Please come again.";
  1034. }
  1035. }
  1036. else {
  1037. mes "[Kafra staff]";
  1038. mes "I am instructed to service only for the ^ff0000" + getguildname(.@GID) + "^000000 Guild. Please try another Kafra staff member around here. Sorry for the inconvenience.";
  1039. }
  1040. close2;
  1041. cutin "kafra_01",255;
  1042. end;
  1043. }
  1044.  
  1045. // Guild Dungeon Switch Template
  1046. //============================================================
  1047. - script Gld_Dun_Template::Gld_Dun_Template -1,{
  1048. // Store the Guild ID of castle occupant.
  1049. set .@GID, GetCastleData(strnpcinfo(2),1);
  1050.  
  1051. // Pick what Dungeon I should warp too, and where in that dungeon.
  1052. if (compare(strnpcinfo(2),"aldeg")) {
  1053. set .@destination$,"gld_dun02";
  1054. if (compare(strnpcinfo(2),"cas01")) setarray .@coordinates[0],32,122;
  1055. else if (compare(strnpcinfo(2),"cas02")) setarray .@coordinates[0],79,32;
  1056. else if (compare(strnpcinfo(2),"cas03")) setarray .@coordinates[0],165,38;
  1057. else if (compare(strnpcinfo(2),"cas04")) setarray .@coordinates[0],160,148;
  1058. else if (compare(strnpcinfo(2),"cas05")) setarray .@coordinates[0],103,169;
  1059. }
  1060. else if (compare(strnpcinfo(2),"gefg")) {
  1061. set .@destination$,"gld_dun04";
  1062. if (compare(strnpcinfo(2),"cas01")) setarray .@coordinates[0],39,258;
  1063. else if (compare(strnpcinfo(2),"cas02")) setarray .@coordinates[0],125,270;
  1064. else if (compare(strnpcinfo(2),"cas03")) setarray .@coordinates[0],268,251;
  1065. else if (compare(strnpcinfo(2),"cas04")) setarray .@coordinates[0],268,108;
  1066. else if (compare(strnpcinfo(2),"cas05")) setarray .@coordinates[0],230,35;
  1067. }
  1068. else if (compare(strnpcinfo(2),"payg")) {
  1069. set .@destination$,"gld_dun01";
  1070. if (compare(strnpcinfo(2),"cas01")) setarray .@coordinates[0],186,165;
  1071. else if (compare(strnpcinfo(2),"cas02")) setarray .@coordinates[0],54,165;
  1072. else if (compare(strnpcinfo(2),"cas03")) setarray .@coordinates[0],54,39;
  1073. else if (compare(strnpcinfo(2),"cas04")) setarray .@coordinates[0],186,39;
  1074. else if (compare(strnpcinfo(2),"cas05")) setarray .@coordinates[0],223,202;
  1075. }
  1076. else if (compare(strnpcinfo(2),"prtg")) {
  1077. set .@destination$,"gld_dun03";
  1078. if (compare(strnpcinfo(2),"cas01")) setarray .@coordinates[0],28,251;
  1079. else if (compare(strnpcinfo(2),"cas02")) setarray .@coordinates[0],164,268;
  1080. else if (compare(strnpcinfo(2),"cas03")) setarray .@coordinates[0],164,179;
  1081. else if (compare(strnpcinfo(2),"cas04")) setarray .@coordinates[0],268,203;
  1082. else if (compare(strnpcinfo(2),"cas05")) setarray .@coordinates[0],199,28;
  1083. }
  1084. // Add custom Guild Castles here.
  1085. else {
  1086. end;
  1087. }
  1088.  
  1089. if (.@GID == 0) {
  1090. mes "[ Echoing Voice ]";
  1091. mes " ' The one who can overcome an ordeal and show true bravery... will find the way... ' ";
  1092. close;
  1093. }
  1094. else {
  1095. mes "[ Echoing Voice ]";
  1096. mes " ' Only the one who can show true bravery can take this test. '";
  1097. next;
  1098. mes " ";
  1099. mes "There's a small lever. Will you pull it?";
  1100. next;
  1101. switch(select("Pull.:Do not.")) {
  1102. case 1:
  1103. if ((getcharid(2) == .@GID)) {
  1104. warp .@destination$,.@coordinates[0],.@coordinates[1];
  1105. end;
  1106. }
  1107. else {
  1108. mes " ";
  1109. mes " Nothing happened.";
  1110. close;
  1111. }
  1112. case 2:
  1113. close;
  1114. }
  1115. }
  1116. }
  1117.  
  1118. // Treasure Room Protection Template
  1119. //============================================================
  1120. - script Gld_Trea_Protect::Gld_Trea_Protect -1,{
  1121. //OnTouch2:
  1122. OnTouch:
  1123. // Store the Guild ID of castle occupant.
  1124. set .@GID, GetCastleData(strnpcinfo(2),1);
  1125.  
  1126. if (strcharinfo(0) != getguildmaster(.@GID)) {
  1127. if (compare(strnpcinfo(2),"aldeg")) {
  1128. warp "aldebaran",132,103;
  1129. }
  1130. else if (compare(strnpcinfo(2),"gefg")) {
  1131. warp "geffen",120,39;
  1132. }
  1133. else if (compare(strnpcinfo(2),"payg")) {
  1134. warp "payon",70,100;
  1135. }
  1136. else if (compare(strnpcinfo(2),"prtg")) {
  1137. warp "prontera",116,72;
  1138. }
  1139. // Add custom Guild Castles here.
  1140. else {
  1141. end;
  1142. }
  1143. }
  1144. end;
  1145. }
  1146.  
  1147. // Treasure Room Spawn Template
  1148. //============================================================
  1149. - script Gld_Trea_Spawn::Gld_Trea_Spawn -1,{
  1150. end;
  1151.  
  1152. OnClock0001:
  1153.  
  1154. for (set .@i, 1; .@i <= 7; set .@i, .@i+1) { //START CHANGED
  1155. for (set .@i_, 1; .@i_ <= 5; set .@i_, .@i_+1) {
  1156. if (getd("$woe_cas"+.@i+"_3$["+.@i_+"]") == strnpcinfo(2) && getd("$woe_cas"+.@i+"_tdisable["+.@i_+"]")) { end; }
  1157. }
  1158. } //END CHANGED
  1159.  
  1160. // Do nothing if this script is the template.
  1161. if (strnpcinfo(1) == "Gld_Trea_Spawn") end;
  1162.  
  1163. // If there is no owner, do nothing.
  1164. if (!GetCastleData(strnpcinfo(2),1)) end;
  1165.  
  1166. // Is there Economy in this castle?
  1167. set .@Treasure,GetCastleData(strnpcinfo(2),2)/5+4;
  1168.  
  1169. // Set information
  1170. if (strnpcinfo(2) == "aldeg_cas01") {
  1171. set .@treasurebox,1324;
  1172. setarray .@treasurex[0],115,122,115,122,116,117,118,119,120,121,121,121,121,121,121,120,119,118,117,116,116,116,116,116;
  1173. setarray .@treasurey[0],226,226,219,219,225,225,225,225,225,225,224,223,222,221,220,220,220,220,220,220,221,222,223,224;
  1174. }
  1175. else if (strnpcinfo(2) == "aldeg_cas02") {
  1176. set .@treasurebox,1326;
  1177. setarray .@treasurex[0],134,135,135,134,132,133,134,135,136,137,137,137,137,137,137,136,135,134,133,132,132,132,132,132;
  1178. setarray .@treasurey[0],231,231,230,230,233,233,233,233,233,233,232,231,230,229,228,228,228,228,228,228,229,230,231,232;
  1179. }
  1180. else if (strnpcinfo(2) == "aldeg_cas03") {
  1181. set .@treasurebox,1328;
  1182. setarray .@treasurex[0],224,225,225,224,222,223,224,225,226,227,227,227,227,227,227,226,225,224,223,222,222,222,222,222;
  1183. setarray .@treasurey[0],269,269,268,268,271,271,271,271,271,271,270,269,268,267,266,266,266,266,266,266,267,268,269,270;
  1184. }
  1185. else if (strnpcinfo(2) == "aldeg_cas04") {
  1186. set .@treasurebox,1330;
  1187. setarray .@treasurex[0],84,85,85,84,82,83,84,85,86,87,87,87,87,87,87,86,85,84,83,82,82,82,82,82;
  1188. setarray .@treasurey[0],13,13,12,12,15,15,15,15,15,15,14,13,12,11,10,10,10,10,10,10,11,12,13,14;
  1189. }
  1190. else if (strnpcinfo(2) == "aldeg_cas05") {
  1191. set .@treasurebox,1332;
  1192. setarray .@treasurex[0],61,62,62,61,59,60,61,62,63,64,64,64,64,64,64,63,62,61,60,59,59,59,59,59;
  1193. setarray .@treasurey[0],12,12,11,11,14,14,14,14,14,14,13,12,11,10,9,9,9,9,9,9,10,11,12,13;
  1194. }
  1195. else if (strnpcinfo(2) == "gefg_cas01") {
  1196. set .@treasurebox,1334;
  1197. setarray .@treasurex[0],153,154,154,153,151,152,153,154,155,156,156,156,156,156,156,155,154,153,152,151,151,151,151,151;
  1198. setarray .@treasurey[0],113,113,112,112,115,115,115,115,115,115,114,113,112,111,110,110,110,110,110,110,111,112,113,114;
  1199. }
  1200. else if (strnpcinfo(2) == "gefg_cas02") {
  1201. set .@treasurebox,1336;
  1202. setarray .@treasurex[0],139,140,140,139,137,138,139,140,141,142,142,142,142,142,142,141,140,139,138,137,137,137,137,137;
  1203. setarray .@treasurey[0],115,115,114,114,117,117,117,117,117,117,116,115,114,113,112,112,112,112,112,112,113,114,115,116;
  1204. }
  1205. else if (strnpcinfo(2) == "gefg_cas03") {
  1206. set .@treasurebox,1338;
  1207. setarray .@treasurex[0],269,270,270,269,267,268,269,270,271,272,272,272,272,272,272,271,270,269,268,267,267,267,267,267;
  1208. setarray .@treasurey[0],291,291,290,290,293,293,293,293,293,293,292,291,290,289,288,288,288,288,288,288,289,290,291,292;
  1209. }
  1210. else if (strnpcinfo(2) == "gefg_cas04") {
  1211. set .@treasurebox,1340;
  1212. setarray .@treasurex[0],115,116,116,115,113,114,115,116,117,118,118,118,118,118,118,117,116,115,114,113,113,113,113,113;
  1213. setarray .@treasurey[0],119,119,118,118,121,121,121,121,121,121,120,119,118,117,116,116,116,116,116,116,117,118,119,120;
  1214. }
  1215. else if (strnpcinfo(2) == "gefg_cas05") {
  1216. set .@treasurebox,1342;
  1217. setarray .@treasurex[0],143,144,144,143,141,142,143,144,145,146,146,146,146,146,146,145,144,143,142,141,141,141,141,141;
  1218. setarray .@treasurey[0],110,110,109,109,112,112,112,112,112,112,111,110,109,108,107,107,107,107,107,107,108,109,110,111;
  1219. }
  1220. else if (strnpcinfo(2) == "payg_cas01") {
  1221. set .@treasurebox,1344;
  1222. setarray .@treasurex[0],289,292,292,289,288,289,290,291,292,293,293,293,293,293,293,292,291,290,289,288,288,288,288,288;
  1223. setarray .@treasurey[0],10,10,7,7,11,11,11,11,11,11,10,9,8,7,6,6,6,6,6,6,7,8,9,10;
  1224. }
  1225. else if (strnpcinfo(2) == "payg_cas02") {
  1226. set .@treasurebox,1346;
  1227. setarray .@treasurex[0],143,146,146,143,142,143,144,145,146,147,147,147,147,147,147,146,145,144,143,142,142,142,142,142;
  1228. setarray .@treasurey[0],146,146,143,143,147,147,147,147,147,147,146,145,144,143,142,142,142,142,142,142,143,144,145,146;
  1229. }
  1230. else if (strnpcinfo(2) == "payg_cas03") {
  1231. set .@treasurebox,1348;
  1232. setarray .@treasurex[0],158,159,159,158,156,157,158,159,160,161,161,161,161,161,161,160,159,158,157,156,156,156,156,156;
  1233. setarray .@treasurey[0],169,169,168,168,171,171,171,171,171,171,170,169,168,167,166,166,166,166,166,166,167,168,169,170;
  1234. }
  1235. else if (strnpcinfo(2) == "payg_cas04") {
  1236. set .@treasurebox,1350;
  1237. setarray .@treasurex[0],146,147,147,146,144,145,146,147,148,149,149,149,149,149,149,148,147,146,145,144,144,144,144,144;
  1238. setarray .@treasurey[0],48,48,47,47,50,50,50,50,50,50,49,48,47,46,45,45,45,45,45,45,46,47,48,49;
  1239. }
  1240. else if (strnpcinfo(2) == "payg_cas05") {
  1241. set .@treasurebox,1352;
  1242. setarray .@treasurex[0],155,158,158,155,154,155,156,157,158,159,159,159,159,159,159,158,157,156,155,154,154,154,154,154;
  1243. setarray .@treasurey[0],134,134,131,131,135,135,135,135,135,135,134,133,132,131,130,130,130,130,130,130,131,132,133,134;
  1244. }
  1245. else if (strnpcinfo(2) == "prtg_cas01") {
  1246. set .@treasurebox,1354;
  1247. setarray .@treasurex[0],10,11,11,10,8,9,10,11,12,13,13,13,13,13,13,12,11,10,9,8,8,8,8,8;
  1248. setarray .@treasurey[0],209,209,208,208,211,211,211,211,211,211,210,209,208,207,206,206,206,206,206,206,207,208,209,210;
  1249. }
  1250. else if (strnpcinfo(2) == "prtg_cas02") {
  1251. set .@treasurebox,1356;
  1252. setarray .@treasurex[0],201,202,202,201,199,200,201,202,203,204,204,204,204,204,204,203,202,201,200,199,199,199,199,199;
  1253. setarray .@treasurey[0],228,228,227,227,230,230,230,230,230,230,229,228,227,226,225,225,225,225,225,225,226,227,228,229;
  1254. }
  1255. else if (strnpcinfo(2) == "prtg_cas03") {
  1256. set .@treasurebox,1358;
  1257. setarray .@treasurex[0],187,188,188,187,185,186,187,188,189,190,190,190,190,190,190,189,188,187,186,185,185,185,185,185;
  1258. setarray .@treasurey[0],132,132,131,131,134,134,134,134,134,134,133,132,131,130,129,129,129,129,129,129,130,131,132,133;
  1259. }
  1260. else if (strnpcinfo(2) == "prtg_cas04") {
  1261. set .@treasurebox,1360;
  1262. setarray .@treasurex[0],269,270,270,269,267,268,269,270,271,272,272,272,272,272,272,271,270,269,268,267,267,267,267,267;
  1263. setarray .@treasurey[0],162,162,161,161,164,164,164,164,164,164,163,162,161,160,159,159,159,159,159,159,160,161,162,163;
  1264. }
  1265. else if (strnpcinfo(2) == "prtg_cas05") {
  1266. set .@treasurebox,1362;
  1267. setarray .@treasurex[0],275,276,276,275,273,274,275,276,277,278,278,278,278,278,278,277,276,275,274,273,273,273,273,273;
  1268. setarray .@treasurey[0],178,178,177,177,180,180,180,180,180,180,179,178,177,176,175,175,175,175,175,175,176,177,178,179;
  1269. }
  1270. // Add custom Guild Castles here.
  1271. else {
  1272. end;
  1273. }
  1274.  
  1275. // Reset daily investment limit.
  1276. setcastledata strnpcinfo(2),4,0;
  1277. setcastledata strnpcinfo(2),5,0;
  1278.  
  1279. // Spawn boxes in proper order.
  1280. for (set .@i,0; .@i <= .@Treasure ; set .@i,.@i+1) {
  1281. // set treasure box ID
  1282. set .@boxid, .@treasurebox + (.@i+2) % 2;
  1283. set .@box,1 << .@i;
  1284. // Spawn or do not spawn chests if one already exists.
  1285. if ((getd("$@"+strnpcinfo(2)+"_treasure") & .@box) == 0) {
  1286. monster strnpcinfo(2),.@treasurex[.@i],.@treasurey[.@i],"Treasure Chest",.@boxid,1,"Treasure#"+strnpcinfo(2)+"::OnTreasureDied"+.@i;
  1287. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") | .@box;
  1288. }
  1289. }
  1290. end;
  1291.  
  1292. // Individual "You killed a chest" events to ensure proper spawning at the change of day.
  1293. OnTreasureDied0:
  1294. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~1;
  1295. end;
  1296. OnTreasureDied1:
  1297. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~2;
  1298. end;
  1299. OnTreasureDied2:
  1300. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~4;
  1301. end;
  1302. OnTreasureDied3:
  1303. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~8;
  1304. end;
  1305. OnTreasureDied4:
  1306. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~16;
  1307. end;
  1308. OnTreasureDied5:
  1309. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~32;
  1310. end;
  1311. OnTreasureDied6:
  1312. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~64;
  1313. end;
  1314. OnTreasureDied7:
  1315. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~128;
  1316. end;
  1317. OnTreasureDied8:
  1318. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~256;
  1319. end;
  1320. OnTreasureDied9:
  1321. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~512;
  1322. end;
  1323. OnTreasureDied10:
  1324. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~1024;
  1325. end;
  1326. OnTreasureDied11:
  1327. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~2048;
  1328. end;
  1329. OnTreasureDied12:
  1330. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~4096;
  1331. end;
  1332. OnTreasureDied13:
  1333. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~8192;
  1334. end;
  1335. OnTreasureDied14:
  1336. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~16384;
  1337. end;
  1338. OnTreasureDied15:
  1339. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~32768;
  1340. end;
  1341. OnTreasureDied16:
  1342. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~65536;
  1343. end;
  1344. OnTreasureDied17:
  1345. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~131072;
  1346. end;
  1347. OnTreasureDied18:
  1348. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~262144;
  1349. end;
  1350. OnTreasureDied19:
  1351. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~524288;
  1352. end;
  1353. OnTreasureDied20:
  1354. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~1048576;
  1355. end;
  1356. OnTreasureDied21:
  1357. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~2097152;
  1358. end;
  1359. OnTreasureDied22:
  1360. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~4194304;
  1361. end;
  1362. OnTreasureDied23:
  1363. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~8388608;
  1364. end;
  1365. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement