Advertisement
Guest User

Untitled

a guest
Jun 2nd, 2012
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 58.82 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. close;
  495. }
  496. if ((getcharid(2) != .@GID || strcharinfo(0) != getguildmaster(.@GID)) && getgmlevel() < $woe_mingmlv){ //CHANGED
  497. mes "I am loyal and I will follow my master ^ff0000" + getguildmaster(.@GID) + "^000000. We are Guardians! We defend to the bitter end!";
  498. close;
  499. }
  500. if (getgmlevel()) { mes "Welcome. Game Master, ^ff0000" + strcharinfo(0) + "^000000..."; } else { mes "Welcome. My honorable master, ^ff0000" + getguildmaster(.@GID) + "^000000..."; } //CHANGED
  501. mes "Whatever you need, I am at your service. I will be faithful in my duties.";
  502. next;
  503. switch(select("castle briefing:Invest in commercial growth:Invest in safeguard:Summon Guardian:Employ / discharge storehouse staff:Go into Master's room")) {
  504. case 1:
  505. mes "[ Steward " + .@name$ + " ]";
  506. mes "I will report the Castle briefing, Master.";
  507. mes " ";
  508. mes " ^0000ffNow, commercial growth level is " + GetCastleData(strnpcinfo(2),2) + ".";
  509. if (GetCastleData(strnpcinfo(2),4)) {
  510. mes " You invested " + GetCastleData(strnpcinfo(2),4) + "times in last 1 day.";
  511. }
  512. mes " Now, safeguard level is " + GetCastleData(strnpcinfo(2),3) + ".^000000";
  513. if (GetCastleData(strnpcinfo(2),5)) {
  514. mes " ^0000ff- You invested " + GetCastleData(strnpcinfo(2),5) + "times in last 1 day.^000000";
  515. }
  516. mes " ";
  517. mes "That's all to report, Master.";
  518. close;
  519. case 2:
  520. set .@Economy,GetCastleData(strnpcinfo(2),2);
  521. if(.@Economy < 8) set .@eco_invest,10000;
  522. if(.@Economy >= 8) set .@eco_invest,20000;
  523. if(.@Economy >= 16) set .@eco_invest,40000;
  524. if(.@Economy >= 25) set .@eco_invest,80000;
  525. if(.@Economy >= 34) set .@eco_invest,160000;
  526. if(.@Economy >= 44) set .@eco_invest,320000;
  527. if(.@Economy >= 54) set .@eco_invest,640000;
  528. if(.@Economy >= 65) set .@eco_invest,1280000;
  529. if(.@Economy >= 76) set .@eco_invest,2560000;
  530. if(.@Economy >= 88) set .@eco_invest,5120000;
  531. //Double the cost of investing if you've already invested once.
  532. if (GetCastleData(strnpcinfo(2),4)) {
  533. set .@eco_invest,.@eco_invest*2;
  534. }
  535. mes "[ Steward " + .@name$ + " ]";
  536. 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.";
  537. mes " ";
  538. mes "Originally you can invest just once but if you pay more money, you can invest twice.";
  539. mes " ";
  540. if (.@Economy == 100) {
  541. 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";
  542. close;
  543. }
  544. if (GetCastleData(strnpcinfo(2),4) == 2) {
  545. mes "^ff0000But you already invested twice today so you cannot invest any more.^000000 I expect our riches to increase in growth level.";
  546. close;
  547. }
  548. if (GetCastleData(strnpcinfo(2),4) == 0) {
  549. mes "Now the needed investment amount is ^ff0000" + .@eco_invest + "^000000 zeny. Will you invest?";
  550. }
  551. else {
  552. mes "You've invested once today... if you wish to invest once more, ^ff0000" + .@eco_invest + "^000000 more zeny will be needed.";
  553. }
  554. next;
  555. switch(select("Invest in commercial growth:Cancel")) {
  556. case 1:
  557. if (Zeny < .@eco_invest) {
  558. mes "[ Steward " + .@name$ + " ]";
  559. mes "I'm sorry but there is not enough zeny to invest. You will have to try again when you have the funds, Master.";
  560. close;
  561. }
  562. set zeny,zeny-.@eco_invest;
  563. SetCastleData strnpcinfo(2),4,GetCastleData(strnpcinfo(2),4)+1;
  564. SetCastleData strnpcinfo(2),2,.@Economy + 1 + (.@Economy<99 && rand(2) && getgdskilllv(.@GID,10014));
  565. mes "[ Steward " + .@name$ + "]";
  566. mes "We finished the investment safely. I expect that our growth level will be increased by tomorrow.";
  567. close;
  568. case 2:
  569. mes "[ Steward " + .@name$ + " ]";
  570. mes "I'll do as you bid, my master... There is no hurry. We will do our best.";
  571. close;
  572. }
  573. case 3:
  574. set .@Defence,GetCastleData(strnpcinfo(2),3);
  575. if(.@Defence < 8) set .@def_invest,20000;
  576. if(.@Defence >= 8) set .@def_invest,40000;
  577. if(.@Defence >= 16) set .@def_invest,80000;
  578. if(.@Defence >= 25) set .@def_invest,160000;
  579. if(.@Defence >= 34) set .@def_invest,320000;
  580. if(.@Defence >= 44) set .@def_invest,640000;
  581. if(.@Defence >= 54) set .@def_invest,1280000;
  582. if(.@Defence >= 65) set .@def_invest,2560000;
  583. if(.@Defence >= 76) set .@def_invest,5120000;
  584. if(.@Defence >= 88) set .@def_invest,10240000;
  585. //Double the cost of investing if you've already invested once.
  586. if (GetCastleData(strnpcinfo(2),5)) {
  587. set .@def_invest,.@def_invest*2;
  588. }
  589. mes "[ Steward " + .@name$ + " ]";
  590. 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.";
  591. mes " ";
  592. mes "Originally you can invest just once but if you pay more money, you can invest twice.";
  593. mes " ";
  594. if (.@Defence == 100) {
  595. 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";
  596. close;
  597. }
  598. if (GetCastleData(strnpcinfo(2),5) == 2) {
  599. mes "^ff0000But you already invested twice today so you cannot invest any more.^000000 I expect our riches to increase in growth level.";
  600. close;
  601. }
  602. if (GetCastleData(strnpcinfo(2),5) == 0) {
  603. mes "Now the needed investment amount is ^ff0000" + .@def_invest + "^000000 zeny. Will you invest?";
  604. }
  605. else {
  606. mes "You've invested once today... if you wish to invest once more, ^ff0000" + .@def_invest + "^000000 more zeny will be needed.";
  607. }
  608. next;
  609. switch(select("Invest in safeguard.:Cancel")) {
  610. case 1:
  611. if (Zeny < .@def_invest) {
  612. mes "[ Steward " + .@name$ + " ]";
  613. mes "I'm sorry but there is not enough zeny to invest. You will have to try again when you have the funds, Master.";
  614. close;
  615. }
  616. set zeny,zeny-.@def_invest;
  617. SetCastleData strnpcinfo(2),5,GetCastleData(strnpcinfo(2),5)+1;
  618. SetCastleData strnpcinfo(2),3,.@Defence+1;
  619. mes "[ Steward " + .@name$ + "]";
  620. mes "We finished the investment safely. I expect that the safeguard level will be increased by tomorrow.";
  621. close;
  622. case 2:
  623. mes "[ Steward " + .@name$ + " ]";
  624. mes "I'll do as you bid, my master... There is no hurry. We will do our best.";
  625. close;
  626.  
  627. }
  628. case 4:
  629. mes "[ Steward " + .@name$ + " ]";
  630. mes "Will you summon a Guardian? It'll be a protector to defend us loyally.";
  631. mes "Please select a guardian to defend us.";
  632. next;
  633. for( set .@i, 0; .@i <= 7 ; set .@i, .@i+1 ) {
  634. if (.@guardiantype[.@i] == 1) { set .@type$,"Guardian Soldier"; }
  635. else if (.@guardiantype[.@i] == 2) { set .@type$,"Guardian Archer"; }
  636. else { set .@type$,"Guardian Knight"; }
  637. if (guardianinfo(strnpcinfo(2),.@i,0)) {
  638. setarray .@gname$[.@i], .@type$ + " - Implemented (" + guardianinfo(strnpcinfo(2),.@i,2) + "/" + guardianinfo(strnpcinfo(2),.@i,1) + ")";
  639. }
  640. else {
  641. setarray .@gname$[.@i], .@type$ + " - Not Implemented";
  642. }
  643. }
  644. set .@menu$,.@gname$[0]+":"+.@gname$[1]+":"+.@gname$[2]+":"+.@gname$[3]+":"+.@gname$[4]+":"+.@gname$[5]+":"+.@gname$[6]+":"+.@gname$[7];
  645. set .@GDnum,select(.@menu$)+9;
  646. mes "[ Steward " + .@name$ + " ]";
  647. mes "Will you summon the chosen guardian? 10000 zeny is required to summon.";
  648. next;
  649. switch(select("Summon:Cancel")) {
  650. case 1:
  651. mes "[ Steward " + .@name$ + " ]";
  652. if (getgdskilllv(.@GID,10002) == 0) {
  653. 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.";
  654. close;
  655. }
  656. if (GetCastleData(strnpcinfo(2),.@GDnum) == 1) {
  657. mes "Master, you already have summoned that Guardian. We cannot summon another.";
  658. close;
  659. }
  660.  
  661. if (Zeny < 1000) {
  662. mes "Well... I'm sorry but we don't have funds to summon the Guardian. We failed to summon the Guardian.";
  663. close;
  664. }
  665. set zeny,zeny-10000;
  666. SetCastleData strnpcinfo(2),.@GDnum,1; // mark as 'installed'
  667. set .@UseGID,.@GDnum - 10;
  668. if (.@guardiantype[.@UseGID] == 1) { set .@type,1287; }
  669. else if (.@guardiantype[.@UseGID] == 2) { set .@type,1285; }
  670. else { set .@type,1286; }
  671. guardian strnpcinfo(2),.@guardianposx[.@UseGID],.@guardianposy[.@UseGID],strmobinfo(2,.@type),.@type,"Guardian#"+strnpcinfo(2)+"::OnGuardianDied",.@UseGID;
  672. mes "We completed the summoning of the Guardian. Our defenses are now increased with it in place.";
  673. close;
  674. case 2:
  675. mes "[ Steward " + .@name$ + " ]";
  676. mes "I did as you ordered. But please remember if you the have money to spare, it'll be better to set it up.";
  677. close;
  678. }
  679. case 5:
  680. if (GetCastleData(strnpcinfo(2),9) == 1) {
  681. mes "[ Steward " + .@name$ + " ]";
  682. mes "Now about the Kafra staff... Will you discharge the Kafra staff?";
  683. next;
  684. switch(select("Discharge:Cancel")) {
  685. case 1:
  686. cutin "kafra_01",2;
  687. mes "[ Hired Kafra staff ]";
  688. mes "I worked so hard... How can this be, Master?... I'll work harder if you're displeased... Please reconsider, Master.";
  689. next;
  690. switch(select("Discharge:Cancel")) {
  691. case 1:
  692. mes "[ Hired Kafra staff ]";
  693. mes "Oh, my god! This is nonsense!";
  694. next;
  695. cutin "kafra_01",255;
  696. break;
  697. case 2:
  698. mes "[ Hired Kafra staff ]";
  699. mes "I'll work harder... Thank you!";
  700. close2;
  701. cutin "kafra_01",255;
  702. end;
  703. }
  704. case 2:
  705. mes "[ Steward " + .@name$ + " ]";
  706. mes "Those Kafra are hard workers. I thought it would be best to keep the staff.";
  707. close;
  708. }
  709. disablenpc "Kafra Staff#"+strnpcinfo(2);
  710. SetCastleData strnpcinfo(2),9,0;
  711. mes "[ Steward " + .@name$ + " ]";
  712. mes "....";
  713. mes "Discharged Kafra staff... But... are you displeased with something?";
  714. close;
  715. }
  716. else {
  717. mes "[ Steward " + .@name$ + " ]";
  718. mes "Will you contract with the Kafra head office to hire Kafra staff in our castle?";
  719. mes "^ff0000 10000zeny is needed to hire. ";
  720. next;
  721. switch(select("Hire.:Cancel")) {
  722. case 1:
  723. mes "[ Steward " + .@name$ + " ]";
  724. if (getgdskilllv(.@GID,10001) == 0) {
  725. 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.";
  726. close;
  727. }
  728. if (Zeny < 10000) {
  729. mes "Well... I'm sorry but we don't have enough funds. We are unable to hire the Kafra staff.";
  730. close;
  731. }
  732. set zeny,zeny-10000;
  733. enablenpc "Kafra Staff#"+strnpcinfo(2);
  734. SetCastleData strnpcinfo(2),9,1;
  735. mes "We finished making the contract with the Kafra head office successfully. We hired a Kafra staff.";
  736. next;
  737. cutin "kafra_01",2;
  738. mes "[ Hired Kafra staff ]";
  739. mes "How do you do? I'm a dispatched Kafra from head office.";
  740. mes "I'll do my best to upkeep the reputation of Guild.";
  741. next;
  742. cutin "kafra_01",255 ;
  743. mes "[ Steward " + .@name$ + " ]";
  744. mes "The contract term of the hired Kafra staff is 1 month and after this term, you will have to pay an additional charge.";
  745. mes "It will be useful for our members.";
  746. close;
  747. case 2:
  748. mes "[ Steward " + .@name$ + " ]";
  749. mes "I did as you ordered, but some of our members will be unhappy. It will be better to hire a Kafra staff quickly.";
  750. close;
  751. }
  752. }
  753. case 6:
  754. mes "[ Steward " + .@name$ + " ]";
  755. mes "Do you want to visit the room where our valuables are stored?";
  756. mes "That room is restricted to you... you are the only one with access to it.";
  757. next;
  758. switch(select("Go into Master's room.:Cancel")) {
  759. case 1:
  760. mes "[ Steward " + .@name$ + " ]";
  761. mes "Please follow me, I will show you the secret passage.";
  762. mes "When you wish to return, pull this lever here...";
  763. close2;
  764. warp strnpcinfo(2),.@masterroom[0],.@masterroom[1];
  765. end;
  766. case 2:
  767. mes "[ Steward " + .@name$ + " ]";
  768. mes "Goods are produced once a day... if you don't make use of them, they will not produce.";
  769. mes "Therefore it would be better that you remove them over time for the Guild.";
  770. close;
  771. }
  772. }
  773. }
  774.  
  775.  
  776. // Guardian Spawner Template
  777. //============================================================
  778. - script Gld_Guard_Template::Gld_Guard_Template -1,{
  779. // Spawn Guardians in castles
  780. // When adding new castles, ensure that the coordinates coincide
  781. // with the coordinates defined in the Guild Steward template.
  782. OnSpawnGuardians:
  783. // Define the types of guardians on a per castle basis.
  784. // 1 - Soldier Guardian; 2 - Archer Guardian; 3 - Knight Guardian
  785. // Define the x spawn point for each uardian.
  786. // [0] = 1st guardian's x spawn point.
  787. // Define the y spawn point for each uardian.
  788. // [0] = 1st guardian's y spawn point.
  789. // Aldebaran (Luina) Castles
  790. if (strnpcinfo(2) == "aldeg_cas01") {
  791. setarray .@guardiantype[0],1,2,2,2,2,3,3,3;
  792. setarray .@guardianposx[0],17,39,38,45,21,218,213,73;
  793. setarray .@guardianposy[0],218,208,196,228,194,24,24,70;
  794. }
  795. else if (strnpcinfo(2) == "aldeg_cas02") {
  796. setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
  797. setarray .@guardianposx[0],27,88,117,60,51,21,36,210;
  798. setarray .@guardianposy[0],184,43,46,202,183,177,183,7;
  799. }
  800. else if (strnpcinfo(2) == "aldeg_cas03") {
  801. setarray .@guardiantype[0],3,3,1,1,1,2,2,2;
  802. setarray .@guardianposx[0],90,116,86,116,64,212,195,110;
  803. setarray .@guardianposy[0],112,112,120,76,103,160,151,217;
  804. }
  805. else if (strnpcinfo(2) == "aldeg_cas04") {
  806. setarray .@guardiantype[0],2,2,2,1,1,1,3,3;
  807. setarray .@guardianposx[0],187,192,148,145,169,198,48,55;
  808. setarray .@guardianposy[0],100,42,88,209,53,77,72,88;
  809. }
  810. else if (strnpcinfo(2) == "aldeg_cas05") {
  811. setarray .@guardiantype[0],2,2,1,1,3,3,3,3;
  812. setarray .@guardianposx[0],51,188,157,157,27,145,156,41;
  813. setarray .@guardianposy[0],202,79,192,74,221,78,73,112;
  814. }
  815. // Geffen (Britoniah) Castles
  816. else if (strnpcinfo(2) == "gefg_cas01") {
  817. setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
  818. setarray .@guardianposx[0],67,184,62,36,50,50,189,200;
  819. setarray .@guardianposy[0],179,20,41,186,186,67,41,167;
  820. }
  821. else if (strnpcinfo(2) == "gefg_cas02") {
  822. setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
  823. setarray .@guardianposx[0],64,56,166,35,20,19,166,159;
  824. setarray .@guardianposy[0],168,41,25,148,150,41,42,188;
  825. }
  826. else if (strnpcinfo(2) == "gefg_cas03") {
  827. setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
  828. setarray .@guardianposx[0],48,113,48,157,243,157,234,238;
  829. setarray .@guardianposy[0],176,214,207,62,41,45,25,160;
  830. }
  831. else if (strnpcinfo(2) == "gefg_cas04") {
  832. setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
  833. setarray .@guardianposx[0],53,31,49,29,147,57,160,148;
  834. setarray .@guardianposy[0],191,178,220,46,65,46,50,189;
  835. }
  836. else if (strnpcinfo(2) == "gefg_cas05") {
  837. setarray .@guardiantype[0],2,2,1,1,1,3,3,3;
  838. setarray .@guardianposx[0],45,71,72,66,177,66,177,193;
  839. setarray .@guardianposy[0],149,163,142,47,50,17,35,166;
  840. }
  841. // Payon (Baulder) Castles
  842. else if (strnpcinfo(2) == "payg_cas01") {
  843. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  844. setarray .@guardianposx[0],229,225,222,99,65,36,51,138;
  845. setarray .@guardianposy[0],92,80,111,45,31,127,144,133;
  846. }
  847. else if (strnpcinfo(2) == "payg_cas02") {
  848. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  849. setarray .@guardianposx[0],237,228,210,57,42,287,264,27;
  850. setarray .@guardianposy[0],54,72,41,241,241,257,272,20;
  851. }
  852. else if (strnpcinfo(2) == "payg_cas03") {
  853. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  854. setarray .@guardianposx[0],245,269,36,41,39,19,37,268;
  855. setarray .@guardianposy[0],37,51,39,39,65,276,277,244;
  856. }
  857. else if (strnpcinfo(2) == "payg_cas04") {
  858. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  859. setarray .@guardianposx[0],251,232,231,32,32,35,36,270;
  860. setarray .@guardianposy[0],212,212,175,287,232,45,17,41;
  861. }
  862. else if (strnpcinfo(2) == "payg_cas05") {
  863. setarray .@guardiantype[0],2,2,2,2,2,2,2,3;
  864. setarray .@guardianposx[0],19,33,266,266,263,263,250,36;
  865. setarray .@guardianposy[0],279,260,234,279,37,21,22,36;
  866. }
  867. // Prontera (Valkyrie Realms) Castles
  868. else if (strnpcinfo(2) == "prtg_cas01") {
  869. setarray .@guardiantype[0],1,1,1,2,2,3,3,3;
  870. setarray .@guardianposx[0],182,182,153,59,50,184,196,107;
  871. setarray .@guardianposy[0],62,116,86,28,36,183,189,179;
  872. }
  873. else if (strnpcinfo(2) == "prtg_cas02") {
  874. setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
  875. setarray .@guardianposx[0],161,153,178,71,49,64,7,75;
  876. setarray .@guardianposy[0],161,161,44,75,28,186,196,175;
  877. }
  878. else if (strnpcinfo(2) == "prtg_cas03") {
  879. setarray .@guardiantype[0],3,3,3,1,1,2,2,2;
  880. setarray .@guardianposx[0],191,137,45,50,41,191,179,191;
  881. setarray .@guardianposy[0],190,190,99,87,87,42,43,72;
  882. }
  883. else if (strnpcinfo(2) == "prtg_cas04") {
  884. setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
  885. setarray .@guardianposx[0],276,274,246,38,29,33,78,36;
  886. setarray .@guardianposy[0],14,35,246,240,240,258,48,61;
  887. }
  888. else if (strnpcinfo(2) == "prtg_cas05") {
  889. setarray .@guardiantype[0],3,3,3,1,1,1,2,2;
  890. setarray .@guardianposx[0],266,287,245,236,251,278,32,44;
  891. setarray .@guardianposy[0],262,280,250,63,63,253,253,248;
  892. }
  893. // Add custom Guild Castles here.
  894. else {
  895. end;
  896. }
  897.  
  898. // Kill all existing guardians before spawning new ones.
  899. // This should prevent duplicating Guardians when char Server disconnects.
  900. killmonster strnpcinfo(2),strnpcinfo(0)+"::OnGuardianDied";
  901.  
  902. for( set .@i, 0; .@i <= 7 ; set .@i, .@i+1 ) {
  903. set .@UseGID,.@i + 10;
  904. if (.@guardiantype[.@i] == 1) { set .@type,1287; }
  905. else if (.@guardiantype[.@i] == 2) { set .@type,1285; }
  906. else { set .@type,1286; }
  907. if (GetCastleData(strnpcinfo(2),.@UseGID)) {
  908. guardian strnpcinfo(2),.@guardianposx[.@i],.@guardianposy[.@i],strmobinfo(2,.@type),.@type,"Guardian#"+strnpcinfo(2)+"::OnGuardianDied",.@i;
  909. }
  910. }
  911. end;
  912.  
  913. OnGuardianDied:
  914. end;
  915. }
  916.  
  917. // Kafra Template
  918. //============================================================
  919. - script Gld_Kafra_Template::Gld_Kafra_Template -1,{
  920. // Store the Guild ID of castle occupant.
  921. set .@GID, GetCastleData(strnpcinfo(2),1);
  922.  
  923. if (compare(strnpcinfo(2),"aldeg")) {
  924. setarray .@destination$[0],"Al De Baran","aldebaran";
  925. setarray .@coordinates[0],132,103;
  926. }
  927. else if (compare(strnpcinfo(2),"gefg")) {
  928. setarray .@destination$[0],"Geffen","geffen";
  929. setarray .@coordinates[0],120,39;
  930. }
  931. else if (compare(strnpcinfo(2),"payg")) {
  932. setarray .@destination$[0],"Payon","payon";
  933. setarray .@coordinates[0],70,100;
  934. }
  935. else if (compare(strnpcinfo(2),"prtg")) {
  936. setarray .@destination$[0],"Prontera","prontera";
  937. setarray .@coordinates[0],116,72;
  938. }
  939. // Add custom Guild Castles here.
  940. else {
  941. end;
  942. }
  943.  
  944. cutin "kafra_01",2;
  945. if (getcharid(2) == .@GID) {
  946. mes "[Kafra staff]";
  947. mes "Welcome. ^ff0000" + getguildname(.@GID) + "^000000 Member.";
  948. mes "The Kafra Coporation will stay with you wherever you go.";
  949. next;
  950. switch(select("Use Storage:Use Guild Storage:Use Warp Service:Rent a Cart:Cancel")) {
  951. case 1:
  952. if (basicskillcheck() && getskilllv("NV_BASIC") < 6) {
  953. mes "[Kafra staff]";
  954. mes "I am sorry but you have to be at least Novice skill level 6 if you want to use the storage.";
  955. }
  956. else {
  957. callfunc("F_CheckKafCode"); //check your storage password, if set
  958. openstorage;
  959. }
  960. break;
  961. case 2:
  962. // Unofficial, but since it's already been in eA for ages
  963. // and used, I can't exactly remove it, now, can I? >:(
  964. if(guildopenstorage() == 1){
  965. mes "[Kafra Employee]";
  966. mes "I'm sorry but another guild member is using the guild storage";
  967. mes "right now. Please wait until that person is finished.";
  968. close2;
  969. cutin "", 255;
  970. end;
  971. }
  972. cutin "", 255;
  973. close;
  974. case 3:
  975. mes "[Kafra staff]";
  976. mes "Please let me know your destination.";
  977. next;
  978. switch(select(.@destination$ + " ^880000200 ^000000z:Cancel")) {
  979. case 1:
  980. if (Zeny < 200) {
  981. mes "[Kafra staff]";
  982. mes "You don't have enough money. Please check again.";
  983. }
  984. else {
  985. set zeny,zeny-200;
  986. set kf_10_pit,kf_10_pit+2;
  987. cutin "kafra_01",255;
  988. warp .@destination$[1],.@coordinates[0],.@coordinates[1];
  989. end;
  990. }
  991. break;
  992. case 2:
  993. break;
  994. }
  995. break;
  996. case 4:
  997. if(baseClass != Job_Merchant){
  998. mes "[Kafra staff]";
  999. mes "I am sorry. The Cart Service is only provided for the Merchant and Blacksmith class.";
  1000. }
  1001. else if(checkcart() == 1){
  1002. mes "[Kafra staff]";
  1003. mes "You have a cart equipped already.";
  1004. }
  1005. else {
  1006. mes "[Kafra staff]" ;
  1007. mes "The cart fee is 800 zeny. Do you want to rent a cart?";
  1008. next;
  1009. switch(select("Yes.:Cancel.")) {
  1010. case 1:
  1011. if (Zeny < 800) {
  1012. mes "[Kafra staff]";
  1013. mes "You don't have enough Money. You need 800 Zeny to rent a cart.";
  1014. }
  1015. else {
  1016. close2;
  1017. cutin "kafra_01",255;
  1018. set kf_10_pit,kf_10_pit+8;
  1019. set zeny,zeny-800;
  1020. setcart;
  1021. end;
  1022. }
  1023. break;
  1024. case 2:
  1025. break;
  1026. }
  1027. }
  1028. break;
  1029. case 5:
  1030. mes "[Kafra staff]";
  1031. mes "The Kafra corp. always tries to give the best service.";
  1032. mes "Thank you for using Kafra corp. Please come again.";
  1033. }
  1034. }
  1035. else {
  1036. mes "[Kafra staff]";
  1037. 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.";
  1038. }
  1039. close2;
  1040. cutin "kafra_01",255;
  1041. end;
  1042. }
  1043.  
  1044. // Guild Dungeon Switch Template
  1045. //============================================================
  1046. - script Gld_Dun_Template::Gld_Dun_Template -1,{
  1047. // Store the Guild ID of castle occupant.
  1048. set .@GID, GetCastleData(strnpcinfo(2),1);
  1049.  
  1050. // Pick what Dungeon I should warp too, and where in that dungeon.
  1051. if (compare(strnpcinfo(2),"aldeg")) {
  1052. set .@destination$,"gld_dun02";
  1053. if (compare(strnpcinfo(2),"cas01")) setarray .@coordinates[0],32,122;
  1054. else if (compare(strnpcinfo(2),"cas02")) setarray .@coordinates[0],79,32;
  1055. else if (compare(strnpcinfo(2),"cas03")) setarray .@coordinates[0],165,38;
  1056. else if (compare(strnpcinfo(2),"cas04")) setarray .@coordinates[0],160,148;
  1057. else if (compare(strnpcinfo(2),"cas05")) setarray .@coordinates[0],103,169;
  1058. }
  1059. else if (compare(strnpcinfo(2),"gefg")) {
  1060. set .@destination$,"gld_dun04";
  1061. if (compare(strnpcinfo(2),"cas01")) setarray .@coordinates[0],39,258;
  1062. else if (compare(strnpcinfo(2),"cas02")) setarray .@coordinates[0],125,270;
  1063. else if (compare(strnpcinfo(2),"cas03")) setarray .@coordinates[0],268,251;
  1064. else if (compare(strnpcinfo(2),"cas04")) setarray .@coordinates[0],268,108;
  1065. else if (compare(strnpcinfo(2),"cas05")) setarray .@coordinates[0],230,35;
  1066. }
  1067. else if (compare(strnpcinfo(2),"payg")) {
  1068. set .@destination$,"gld_dun01";
  1069. if (compare(strnpcinfo(2),"cas01")) setarray .@coordinates[0],186,165;
  1070. else if (compare(strnpcinfo(2),"cas02")) setarray .@coordinates[0],54,165;
  1071. else if (compare(strnpcinfo(2),"cas03")) setarray .@coordinates[0],54,39;
  1072. else if (compare(strnpcinfo(2),"cas04")) setarray .@coordinates[0],186,39;
  1073. else if (compare(strnpcinfo(2),"cas05")) setarray .@coordinates[0],223,202;
  1074. }
  1075. else if (compare(strnpcinfo(2),"prtg")) {
  1076. set .@destination$,"gld_dun03";
  1077. if (compare(strnpcinfo(2),"cas01")) setarray .@coordinates[0],28,251;
  1078. else if (compare(strnpcinfo(2),"cas02")) setarray .@coordinates[0],164,268;
  1079. else if (compare(strnpcinfo(2),"cas03")) setarray .@coordinates[0],164,179;
  1080. else if (compare(strnpcinfo(2),"cas04")) setarray .@coordinates[0],268,203;
  1081. else if (compare(strnpcinfo(2),"cas05")) setarray .@coordinates[0],199,28;
  1082. }
  1083. // Add custom Guild Castles here.
  1084. else {
  1085. end;
  1086. }
  1087.  
  1088. if (.@GID == 0) {
  1089. mes "[ Echoing Voice ]";
  1090. mes " ' The one who can overcome an ordeal and show true bravery... will find the way... ' ";
  1091. close;
  1092. }
  1093. else {
  1094. mes "[ Echoing Voice ]";
  1095. mes " ' Only the one who can show true bravery can take this test. '";
  1096. next;
  1097. mes " ";
  1098. mes "There's a small lever. Will you pull it?";
  1099. next;
  1100. switch(select("Pull.:Do not.")) {
  1101. case 1:
  1102. if ((getcharid(2) == .@GID)) {
  1103. warp .@destination$,.@coordinates[0],.@coordinates[1];
  1104. end;
  1105. }
  1106. else {
  1107. mes " ";
  1108. mes " Nothing happened.";
  1109. close;
  1110. }
  1111. case 2:
  1112. close;
  1113. }
  1114. }
  1115. }
  1116.  
  1117. // Treasure Room Protection Template
  1118. //============================================================
  1119. - script Gld_Trea_Protect::Gld_Trea_Protect -1,{
  1120. //OnTouch2:
  1121. OnTouch:
  1122. // Store the Guild ID of castle occupant.
  1123. set .@GID, GetCastleData(strnpcinfo(2),1);
  1124.  
  1125. if (strcharinfo(0) != getguildmaster(.@GID)) {
  1126. if (compare(strnpcinfo(2),"aldeg")) {
  1127. warp "aldebaran",132,103;
  1128. }
  1129. else if (compare(strnpcinfo(2),"gefg")) {
  1130. warp "geffen",120,39;
  1131. }
  1132. else if (compare(strnpcinfo(2),"payg")) {
  1133. warp "payon",70,100;
  1134. }
  1135. else if (compare(strnpcinfo(2),"prtg")) {
  1136. warp "prontera",116,72;
  1137. }
  1138. // Add custom Guild Castles here.
  1139. else {
  1140. end;
  1141. }
  1142. }
  1143. end;
  1144. }
  1145.  
  1146. // Treasure Room Spawn Template
  1147. //============================================================
  1148. - script Gld_Trea_Spawn::Gld_Trea_Spawn -1,{
  1149. end;
  1150.  
  1151. OnClock0001:
  1152.  
  1153. for (set .@i, 1; .@i <= 7; set .@i, .@i+1) { //START CHANGED
  1154. for (set .@i_, 1; .@i_ <= 5; set .@i_, .@i_+1) {
  1155. if (getd("$woe_cas"+.@i+"_3$["+.@i_+"]") == strnpcinfo(2) && getd("$woe_cas"+.@i+"_tdisable["+.@i_+"]")) { end; }
  1156. }
  1157. } //END CHANGED
  1158.  
  1159. // Do nothing if this script is the template.
  1160. if (strnpcinfo(1) == "Gld_Trea_Spawn") end;
  1161.  
  1162. // If there is no owner, do nothing.
  1163. if (!GetCastleData(strnpcinfo(2),1)) end;
  1164.  
  1165. // Is there Economy in this castle?
  1166. set .@Treasure,GetCastleData(strnpcinfo(2),2)/5+4;
  1167.  
  1168. // Set information
  1169. if (strnpcinfo(2) == "aldeg_cas01") {
  1170. set .@treasurebox,1324;
  1171. 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;
  1172. 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;
  1173. }
  1174. else if (strnpcinfo(2) == "aldeg_cas02") {
  1175. set .@treasurebox,1326;
  1176. 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;
  1177. 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;
  1178. }
  1179. else if (strnpcinfo(2) == "aldeg_cas03") {
  1180. set .@treasurebox,1328;
  1181. 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;
  1182. 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;
  1183. }
  1184. else if (strnpcinfo(2) == "aldeg_cas04") {
  1185. set .@treasurebox,1330;
  1186. 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;
  1187. 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;
  1188. }
  1189. else if (strnpcinfo(2) == "aldeg_cas05") {
  1190. set .@treasurebox,1332;
  1191. 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;
  1192. 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;
  1193. }
  1194. else if (strnpcinfo(2) == "gefg_cas01") {
  1195. set .@treasurebox,1334;
  1196. 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;
  1197. 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;
  1198. }
  1199. else if (strnpcinfo(2) == "gefg_cas02") {
  1200. set .@treasurebox,1336;
  1201. 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;
  1202. 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;
  1203. }
  1204. else if (strnpcinfo(2) == "gefg_cas03") {
  1205. set .@treasurebox,1338;
  1206. 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;
  1207. 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;
  1208. }
  1209. else if (strnpcinfo(2) == "gefg_cas04") {
  1210. set .@treasurebox,1340;
  1211. 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;
  1212. 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;
  1213. }
  1214. else if (strnpcinfo(2) == "gefg_cas05") {
  1215. set .@treasurebox,1342;
  1216. 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;
  1217. 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;
  1218. }
  1219. else if (strnpcinfo(2) == "payg_cas01") {
  1220. set .@treasurebox,1344;
  1221. 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;
  1222. 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;
  1223. }
  1224. else if (strnpcinfo(2) == "payg_cas02") {
  1225. set .@treasurebox,1346;
  1226. 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;
  1227. 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;
  1228. }
  1229. else if (strnpcinfo(2) == "payg_cas03") {
  1230. set .@treasurebox,1348;
  1231. 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;
  1232. 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;
  1233. }
  1234. else if (strnpcinfo(2) == "payg_cas04") {
  1235. set .@treasurebox,1350;
  1236. 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;
  1237. 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;
  1238. }
  1239. else if (strnpcinfo(2) == "payg_cas05") {
  1240. set .@treasurebox,1352;
  1241. 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;
  1242. 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;
  1243. }
  1244. else if (strnpcinfo(2) == "prtg_cas01") {
  1245. set .@treasurebox,1354;
  1246. 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;
  1247. 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;
  1248. }
  1249. else if (strnpcinfo(2) == "prtg_cas02") {
  1250. set .@treasurebox,1356;
  1251. 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;
  1252. 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;
  1253. }
  1254. else if (strnpcinfo(2) == "prtg_cas03") {
  1255. set .@treasurebox,1358;
  1256. 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;
  1257. 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;
  1258. }
  1259. else if (strnpcinfo(2) == "prtg_cas04") {
  1260. set .@treasurebox,1360;
  1261. 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;
  1262. 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;
  1263. }
  1264. else if (strnpcinfo(2) == "prtg_cas05") {
  1265. set .@treasurebox,1362;
  1266. 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;
  1267. 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;
  1268. }
  1269. // Add custom Guild Castles here.
  1270. else {
  1271. end;
  1272. }
  1273.  
  1274. // Reset daily investment limit.
  1275. setcastledata strnpcinfo(2),4,0;
  1276. setcastledata strnpcinfo(2),5,0;
  1277.  
  1278. // Spawn boxes in proper order.
  1279. for (set .@i,0; .@i <= .@Treasure ; set .@i,.@i+1) {
  1280. // set treasure box ID
  1281. set .@boxid, .@treasurebox + (.@i+2) % 2;
  1282. set .@box,1 << .@i;
  1283. // Spawn or do not spawn chests if one already exists.
  1284. if ((getd("$@"+strnpcinfo(2)+"_treasure") & .@box) == 0) {
  1285. monster strnpcinfo(2),.@treasurex[.@i],.@treasurey[.@i],"Treasure Chest",.@boxid,1,"Treasure#"+strnpcinfo(2)+"::OnTreasureDied"+.@i;
  1286. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") | .@box;
  1287. }
  1288. }
  1289. end;
  1290.  
  1291. // Individual "You killed a chest" events to ensure proper spawning at the change of day.
  1292. OnTreasureDied0:
  1293. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~1;
  1294. end;
  1295. OnTreasureDied1:
  1296. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~2;
  1297. end;
  1298. OnTreasureDied2:
  1299. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~4;
  1300. end;
  1301. OnTreasureDied3:
  1302. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~8;
  1303. end;
  1304. OnTreasureDied4:
  1305. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~16;
  1306. end;
  1307. OnTreasureDied5:
  1308. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~32;
  1309. end;
  1310. OnTreasureDied6:
  1311. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~64;
  1312. end;
  1313. OnTreasureDied7:
  1314. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~128;
  1315. end;
  1316. OnTreasureDied8:
  1317. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~256;
  1318. end;
  1319. OnTreasureDied9:
  1320. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~512;
  1321. end;
  1322. OnTreasureDied10:
  1323. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~1024;
  1324. end;
  1325. OnTreasureDied11:
  1326. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~2048;
  1327. end;
  1328. OnTreasureDied12:
  1329. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~4096;
  1330. end;
  1331. OnTreasureDied13:
  1332. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~8192;
  1333. end;
  1334. OnTreasureDied14:
  1335. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~16384;
  1336. end;
  1337. OnTreasureDied15:
  1338. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~32768;
  1339. end;
  1340. OnTreasureDied16:
  1341. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~65536;
  1342. end;
  1343. OnTreasureDied17:
  1344. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~131072;
  1345. end;
  1346. OnTreasureDied18:
  1347. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~262144;
  1348. end;
  1349. OnTreasureDied19:
  1350. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~524288;
  1351. end;
  1352. OnTreasureDied20:
  1353. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~1048576;
  1354. end;
  1355. OnTreasureDied21:
  1356. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~2097152;
  1357. end;
  1358. OnTreasureDied22:
  1359. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~4194304;
  1360. end;
  1361. OnTreasureDied23:
  1362. setd "$@"+strnpcinfo(2)+"_treasure",getd("$@"+strnpcinfo(2)+"_treasure") & ~8388608;
  1363. end;
  1364. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement