agit_main_te.txt 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220
  1. //===== rAthena Script =======================================
  2. //= War of Emperium TE - Template File
  3. //===== Description: =========================================
  4. //= [Official Conversion]
  5. //= Like agit_main, this file is required
  6. //= for TE castles to function.
  7. //= - Enables AGIT Manager.
  8. //= - Enables Stewards to invest.
  9. //= - Enables Kafra Services inside Guild.
  10. //= - Treasure Chest spawning.
  11. //= - Flag Template.
  12. //= - GM NPC.
  13. //===== Changelogs: ==========================================
  14. //= 1.0 First Version. [Capuche]
  15. //============================================================
  16. - script Manager_TE -1,{
  17. OnAgitInit3:
  18. .@map$ = strnpcinfo(4);
  19. if (.@map$ == "") end;
  20. .@npc_name$ = strnpcinfo(0);
  21. .@guild_id = getcastledata(.@map$,CD_GUILD_ID);
  22. if (.@guild_id == 0) {
  23. killmonster .@map$, .@npc_name$ +"::OnMyMobDead";
  24. donpcevent strnpcinfo(0)+"::OnEmpSpawn";
  25. if (compare(.@map$,"te_aldecas")) {
  26. monster .@map$,0,0,"Evil Druid",1117,10,.@npc_name$ +"::OnMyMobDead";
  27. monster .@map$,0,0,"Khalitzburg",1132,4,.@npc_name$ +"::OnMyMobDead";
  28. monster .@map$,0,0,"Abysmal Knight",1219,2,.@npc_name$ +"::OnMyMobDead";
  29. monster .@map$,0,0,"Executioner",1205,1,.@npc_name$ +"::OnMyMobDead";
  30. monster .@map$,0,0,"Penomena",1216,10,.@npc_name$ +"::OnMyMobDead";
  31. monster .@map$,0,0,"Alarm",1193,18,.@npc_name$ +"::OnMyMobDead";
  32. monster .@map$,0,0,"Clock",1269,9,.@npc_name$ +"::OnMyMobDead";
  33. monster .@map$,0,0,"Raydric Archer",1276,7,.@npc_name$ +"::OnMyMobDead";
  34. monster .@map$,0,0,"Wanderer",1208,3,.@npc_name$ +"::OnMyMobDead";
  35. monster .@map$,0,0,"Alice",1275,1,.@npc_name$ +"::OnMyMobDead";
  36. monster .@map$,0,0,"Bloody Knight",1268,1,.@npc_name$ +"::OnMyMobDead";
  37. monster .@map$,0,0,"Dark Lord",1272,1,.@npc_name$ +"::OnMyMobDead";
  38. if (.@map$ == "te_aldecas1") { setarray .@emproom[0],216,23; }
  39. else if (.@map$ == "te_aldecas2") { setarray .@emproom[0],213,23; }
  40. else if (.@map$ == "te_aldecas3") { setarray .@emproom[0],205,31; }
  41. else if (.@map$ == "te_aldecas4") { setarray .@emproom[0],36,217; }
  42. else if (.@map$ == "te_aldecas5") { setarray .@emproom[0],27,101; }
  43. monster .@map$,.@emproom[0],.@emproom[1],"Dark Lord",1272,1,.@npc_name$ +"::OnMyMobDead";
  44. monster .@map$,.@emproom[0],.@emproom[1],"Tower Keeper",1270,4,.@npc_name$ +"::OnMyMobDead";
  45. monster .@map$,.@emproom[0],.@emproom[1],"Bloody Knight",1268,1,.@npc_name$ +"::OnMyMobDead";
  46. monster .@map$,.@emproom[0],.@emproom[1],"Abysmal Knight",1219,1,.@npc_name$ +"::OnMyMobDead";
  47. monster .@map$,.@emproom[0],.@emproom[1],"Raydric Archer",1276,5,.@npc_name$ +"::OnMyMobDead";
  48. }
  49. else if (compare(.@map$,"te_prtcas")) {
  50. monster .@map$,0,0,"Raydric",1163,10,.@npc_name$ +"::OnMyMobDead";
  51. monster .@map$,0,0,"Khalitzburg",1132,10,.@npc_name$ +"::OnMyMobDead";
  52. monster .@map$,0,0,"Abysmal Knight",1219,5,.@npc_name$ +"::OnMyMobDead";
  53. monster .@map$,0,0,"Bloody Knight",1268,5,.@npc_name$ +"::OnMyMobDead";
  54. monster .@map$,0,0,"Stormy Knight",1251,1,.@npc_name$ +"::OnMyMobDead";
  55. monster .@map$,0,0,"Hatii",1252,1,.@npc_name$ +"::OnMyMobDead";
  56. monster .@map$,0,0,"Raydric Archer",1276,5,.@npc_name$ +"::OnMyMobDead";
  57. monster .@map$,0,0,"Gryphon",1259,2,.@npc_name$ +"::OnMyMobDead";
  58. monster .@map$,0,0,"Chimera",1283,2,.@npc_name$ +"::OnMyMobDead";
  59. monster .@map$,0,0,"Alice",1275,1,.@npc_name$ +"::OnMyMobDead";
  60. monster .@map$,0,0,"Zealotus",1200,1,.@npc_name$ +"::OnMyMobDead";
  61. if (.@map$ == "te_prtcas01") { setarray .@emproom[0],197,197; }
  62. else if (.@map$ == "te_prtcas02") { setarray .@emproom[0],157,174; }
  63. else if (.@map$ == "te_prtcas03") { setarray .@emproom[0],16,220; }
  64. else if (.@map$ == "te_prtcas04") { setarray .@emproom[0],291,14; }
  65. else if (.@map$ == "te_prtcas05") { setarray .@emproom[0],266,266; }
  66. monster .@map$,.@emproom[0],.@emproom[1],"Guardian Knight of Emperium",1268,1,.@npc_name$ +"::OnMyMobDead";
  67. monster .@map$,.@emproom[0],.@emproom[1],"Chief Guardian Knight of Emperium",1251,1,.@npc_name$ +"::OnMyMobDead";
  68. monster .@map$,.@emproom[0],.@emproom[1],"Hatii",1252,1,.@npc_name$ +"::OnMyMobDead";
  69. monster .@map$,.@emproom[0],.@emproom[1],"Guardian Knight of Emperium",1219,2,.@npc_name$ +"::OnMyMobDead";
  70. monster .@map$,.@emproom[0],.@emproom[1],"Raydric Archer",1276,5,.@npc_name$ +"::OnMyMobDead";
  71. }
  72. disablenpc "Kafra Employee#"+ replacestr(.@map$, "cas", "");
  73. }
  74. else {
  75. requestguildinfo .@guild_id;
  76. donpcevent "::OnFlagTE" + strnpcinfo(2);// Guild emblem on flags.
  77. if (getcastledata(.@map$,CD_ENABLED_KAFRA) == 0)
  78. disablenpc "Kafra Employee#"+ replacestr(.@map$, "cas", "");
  79. // Load purchased Guardian in castles.
  80. if (.@map$ == "te_aldecas1") donpcevent "Clode::OnSpawnGuardians";
  81. else if (.@map$ == "te_aldecas2") donpcevent "Lares::OnSpawnGuardians";
  82. else if (.@map$ == "te_aldecas3") donpcevent "Valerian::OnSpawnGuardians";
  83. else if (.@map$ == "te_aldecas4") donpcevent "Alpores::OnSpawnGuardians";
  84. else if (.@map$ == "te_aldecas5") donpcevent "Anpere::OnSpawnGuardians";
  85. else if (.@map$ == "te_prtcas01") donpcevent "Kurbe::OnSpawnGuardians";
  86. else if (.@map$ == "te_prtcas02") donpcevent "Kamiyu::OnSpawnGuardians";
  87. else if (.@map$ == "te_prtcas03") donpcevent "Eduare::OnSpawnGuardians";
  88. else if (.@map$ == "te_prtcas04") donpcevent "Casate::OnSpawnGuardians";
  89. else if (.@map$ == "te_prtcas05") donpcevent "Pisaro::OnSpawnGuardians";
  90. }
  91. end;
  92. OnEmpSpawn:
  93. .@map$ = strnpcinfo(4);
  94. if (!mobcount( .@map$, strnpcinfo(0) +"::OnAgitBreak" )) {
  95. if (.@map$ == "te_aldecas1") { setarray .@emproom[0],216,23; }
  96. else if (.@map$ == "te_aldecas2") { setarray .@emproom[0],213,23; }
  97. else if (.@map$ == "te_aldecas3") { setarray .@emproom[0],205,31; }
  98. else if (.@map$ == "te_aldecas4") { setarray .@emproom[0],36,217; }
  99. else if (.@map$ == "te_aldecas5") { setarray .@emproom[0],27,101; }
  100. else if (.@map$ == "te_prtcas01") { setarray .@emproom[0],197,197; }
  101. else if (.@map$ == "te_prtcas02") { setarray .@emproom[0],157,174; }
  102. else if (.@map$ == "te_prtcas03") { setarray .@emproom[0],16,220; }
  103. else if (.@map$ == "te_prtcas04") { setarray .@emproom[0],291,14; }
  104. else if (.@map$ == "te_prtcas05") { setarray .@emproom[0],266,266; }
  105. monster .@map$,.@emproom[0],.@emproom[1],"Emperium",1288,1, strnpcinfo(0) +"::OnAgitBreak";
  106. }
  107. end;
  108. OnAgitStart3:
  109. .@map$ = strnpcinfo(4);
  110. if (.@map$ == "") end;
  111. if (agitcheck3()) {
  112. maprespawnguildid .@map$, getcastledata(.@map$,CD_GUILD_ID),2;// warp all non-guild members
  113. gvgon3 .@map$;
  114. donpcevent strnpcinfo(0)+"::OnEmpSpawn";
  115. callsub S_Message,"OnCommandOn";
  116. }
  117. end;
  118. OnAgitEnd3:
  119. .@map$ = strnpcinfo(4);
  120. if (.@map$ == "") end;
  121. gvgoff3 .@map$;
  122. if (getcastledata(.@map$,CD_GUILD_ID))
  123. killmonster .@map$, strnpcinfo(0) +"::OnAgitBreak";
  124. callsub S_Message,"OnReset";
  125. end;
  126. OnAgitBreak:
  127. .@guild_id = getcharid(2);
  128. .@map$ = strnpcinfo(4);
  129. .@economy = getcastledata(.@map$,CD_CURRENT_ECONOMY) - 5;// Adjust economy Invest Level for Castle
  130. if (.@economy < 1)
  131. setcastledata .@map$, CD_CURRENT_ECONOMY,1;
  132. else
  133. setcastledata .@map$, CD_CURRENT_ECONOMY,.@economy;
  134. .@defense = getcastledata(.@map$,CD_CURRENT_DEFENSE) - 5;// Adjust Defense Invest Level for Castle
  135. if (.@defense < 1)
  136. setcastledata .@map$, CD_CURRENT_DEFENSE,1;
  137. else
  138. setcastledata .@map$, CD_CURRENT_DEFENSE,.@defense;
  139. setcastledata .@map$,CD_GUILD_ID,.@guild_id;
  140. // Reset Invest information and refresh castle data
  141. for ( .@i = CD_INVESTED_ECONOMY; .@i < CD_ENABLED_GUARDIAN00; .@i++ )
  142. setcastledata .@map$,.@i,0;
  143. donpcevent strnpcinfo(0) +"::OnAgitInit3";// spawn guardians / monsters
  144. // Erase Guardian Database information if the new owners do not have Guardian Research.
  145. if (getgdskilllv(.@guild_id,10002) == 0) {
  146. for ( .@i = CD_ENABLED_GUARDIAN00; .@i < CD_MAX; .@i++ )
  147. setcastledata .@map$,.@i,0;
  148. }
  149. mapannounce .@map$,"Emperium has been destroyed.",bc_map,"0x00FF00",FW_BOLD,20,0,40;
  150. maprespawnguildid .@map$,.@guild_id,2;// Respawn all but new castle-occupants, don't remove monsters.
  151. sleep 500;
  152. if (agitcheck3())
  153. donpcevent strnpcinfo(0) +"::OnEmpSpawn";
  154. sleep 7000;
  155. announce "The [" + getcastlename(.@map$) + "] castle has been conquered by the [" + getguildName(.@guild_id) + "] guild.",bc_all|bc_woe;
  156. end;
  157. OnGuildBreak:
  158. .@map$ = strnpcinfo(4);
  159. if (.@map$ == "") end;
  160. .@tmp$ = replacestr(.@map$, "cas", "");
  161. killmonster .@map$, "Kafra Employee#"+ .@tmp$ +"::OnGuardianDied";
  162. disablenpc "Kafra Employee#"+ .@tmp$;
  163. setcastledata .@map$,CD_GUILD_ID,0;
  164. sleep 7000;
  165. announce "Guild Base [" + getcastlename(.@map$) + "] has been abandoned.",bc_all;
  166. donpcevent strnpcinfo(0) +"::OnAgitInit3";
  167. end;
  168. S_Message:
  169. .@map$ = strnpcinfo(4);
  170. .@guild_id = getcastledata(.@map$,CD_GUILD_ID);
  171. if (.@guild_id)
  172. announce "The [" + getcastlename(.@map$) + "] castle is occupied by the [" + getguildname(.@guild_id) + "] guild.",bc_all,"0xFF0000",FW_NORMAL,10;
  173. else
  174. announce "The [" + getcastlename(.@map$) + "] castle is currently unoccupied.", bc_all,"0xFF0000",FW_NORMAL,10;
  175. if (compare( .@map$,"te_alde" ))
  176. .@string$ = "alde0"+ charat( .@map$,getstrlen(.@map$)-1 );
  177. else
  178. .@string$ = "prt0"+ charat( .@map$,getstrlen(.@map$)-1 );
  179. donpcevent "#popswitch_"+ .@string$ +"::"+ getarg(0);// monsters for mission TE
  180. if (.@map$ == "te_aldecas1") {
  181. donpcevent "Blacksmith Cano#tegod01::OnInit";// god item TE
  182. $2012_tegod_kafra = 0;
  183. $@2012_tegirls_alde01 = 0;
  184. }
  185. else if (.@map$ == "te_prtcas01") {
  186. $2012_tegod_gloria = 0;
  187. $@2012_tegirls_prt01 = 0;
  188. donpcevent "Blacksmith Kai#tegod01::OnInit";
  189. }
  190. return;
  191. OnMyMobDead:
  192. end;
  193. }
  194. // Guild Kafras
  195. //============================================================
  196. - script Kafra_Staff_TE -1,{
  197. .@guild_id = getcastledata( strnpcinfo(4),CD_GUILD_ID );
  198. .@guildname$ = getguildname(.@guild_id);
  199. cutin "kafra_01",2;
  200. mes "[Kafra Employee]";
  201. if (.@guild_id == getcharid(2)) {
  202. mes "Welcome. ^ff0000" + .@guildname$ + "^000000 Member.";
  203. mes "The Kafra Corporation will stay with you wherever you go.";
  204. next;
  205. switch( select( "Use Storage", "Use Teleport Service", "Rent a Pushcart", "Cancel" ) ) {
  206. case 1:
  207. if (getskilllv("NV_BASIC") > 5) {
  208. mes "[Kafra Employee]";
  209. mes "Here, let me open";
  210. mes "your Storage for you.";
  211. mes "Thank you for using";
  212. mes "the Kafra Service.";
  213. close2;
  214. openstorage;
  215. } else {
  216. mes "[Kafra Employee]";
  217. mes "I'm sorry, but you";
  218. mes "need the Novice's";
  219. mes "Basic Skill Level 6 to";
  220. mes "use the Storage Service.";
  221. close2;
  222. }
  223. break;
  224. case 2:
  225. if (compare( strnpcinfo(4),"alde" ) == 1)
  226. callsub( S_Warp, "Aldebaran", "aldebaran",132,103 );
  227. else
  228. callsub( S_Warp, "Prontera", "prontera",278,211 );
  229. case 3:
  230. mes "[Kafra Employee]";
  231. if (BaseClass != Job_Merchant) {
  232. mes "I'm sorry, but the";
  233. mes "Pushcart rental service";
  234. mes "is only available to Merchants,";
  235. mes "Blacksmiths and Alchemists.";
  236. close2;
  237. }
  238. else if (checkcart()) {
  239. mes "You already have";
  240. mes "a Pushcart equipped.";
  241. mes "Unfortunately, we can't";
  242. mes "rent more than one to";
  243. mes "each customer at a time.";
  244. close2;
  245. }
  246. else {
  247. mes "The Pushcart rental";
  248. mes "fee is 800 zeny. Would";
  249. mes "you like to rent a Pushcart?";
  250. next;
  251. if (select( "Rent a Pushcart","Cancel" ) == 1) {
  252. if (Zeny < 800) {
  253. mes "[Kafra Employee]";
  254. mes "I'm sorry, but you";
  255. mes "don't have enough";
  256. mes "zeny to pay the Pushcart";
  257. mes "rental fee of 800 zeny.";
  258. close2;
  259. }
  260. else {
  261. RESRVPTS = RESRVPTS + 80;
  262. Zeny = Zeny - 800;
  263. setcart();
  264. }
  265. }
  266. }
  267. break;
  268. case 4:
  269. mes "[Kafra Employee]";
  270. mes "We, here at Kafra Corporation,";
  271. mes "are always endeavoring to provide you with the best services. We hope that we meet your adventuring needs and standards of excellence.";
  272. close2;
  273. break;
  274. }
  275. }
  276. else {
  277. mes "I am instructed to only offer my services to the ^ff0000"+ .@guildname$ +"^000000 Guild. Please try another Kafra Employee around here. Sorry for the inconvenience.";
  278. close2;
  279. }
  280. cutin "",255;
  281. end;
  282. S_Warp:
  283. mes "[Kafra Employee]";
  284. mes "Please choose";
  285. mes "your destination.";
  286. next;
  287. switch( select( getarg(0) + " -> 200 z", "Cancel it" ) ) {
  288. case 1:
  289. if (Zeny < 200) {
  290. mes "[Kafra Employee]";
  291. mes "I'm sorry, but you don't have";
  292. mes "enough zeny for the Teleport";
  293. mes "Service. The fee to teleport";
  294. mes "to "+getarg(0)+" is 200 zeny.";
  295. close2;
  296. cutin "",255;
  297. end;
  298. }
  299. Zeny = Zeny - 200;
  300. RESRVPTS = RESRVPTS + 20;
  301. warp getarg(1), getarg(2),getarg(3);
  302. end;
  303. case 2:
  304. cutin "",255;
  305. end;
  306. }
  307. OnGuardianDied:
  308. end;
  309. }
  310. // Castle Managers (Invest)
  311. //============================================================
  312. - script invest_TE -1,{
  313. function GuardianData;
  314. .@map$ = strnpcinfo(4);
  315. .@npc_name$ = "[ Butler "+ strnpcinfo(1) +"]";
  316. .@guild_id = getcastledata(.@map$,CD_GUILD_ID);
  317. .@guildmaster$ = getguildmaster(.@guild_id);
  318. mes .@npc_name$;
  319. if (.@guild_id == 0) {
  320. mes "I have been waiting for a master to fulfill my destiny.";
  321. mes "Brave soul... fate will guide you towards your future...";
  322. close;
  323. }
  324. if (strcharinfo(0) != .@guildmaster$) {
  325. mes "No matter how much you pester me, I'll still follow my master ^ff0000"+.@guildmaster$+"^000000. Where are the Guardians?! Send these ruffians away right now!";
  326. close;
  327. }
  328. mes "Welcome. My honorable master, ^ff0000"+strcharinfo(0)+"^000000...";
  329. mes "Your humble servent, "+strnpcinfo(1)+", is here to serve you.";
  330. next;
  331. switch( select( "Castle briefing", "Invest in commercial growth", "Invest in Castle Defenses", "Summon Guardian", "Hire / Fire a Kafra Employee", "Go into Master's room" ) ) {
  332. case 1:
  333. .@economy_today = getcastledata(.@map$,CD_INVESTED_ECONOMY);
  334. .@defense_today = getcastledata(.@map$,CD_INVESTED_DEFENSE);
  335. mes .@npc_name$;
  336. mes "I will report the Castle briefing, Master.";
  337. mes " ";
  338. mes "^0000ffNow, the commercial growth level is "+GetCastleData(.@map$,CD_CURRENT_ECONOMY)+".";
  339. if (.@economy_today > 0)
  340. mes " You invested "+.@economy_today+" times in past 1 day.";
  341. mes " Now, the Castle Defense level is "+GetCastleData(.@map$,CD_CURRENT_DEFENSE)+".^000000";
  342. if (.@defense_today > 0)
  343. mes " ^0000ff- You invested "+.@defense_today+" times in past 1 day.^000000";
  344. mes " ";
  345. mes "That's all I have to report, Master.";
  346. close;
  347. case 2:
  348. .@economy = getcastledata(.@map$,CD_CURRENT_ECONOMY);
  349. setarray .@eco_invest[0], 5,5000, 10,10000, 15,20000, 20,35000, 25,55000, 30,80000, 35,110000, 40,145000, 45,185000, 50,230000,
  350. 55,280000, 60,335000, 65,395000, 70,460000, 75,530000, 80,605000, 85,685000, 90,770000, 95,860000, 100,955000;
  351. for ( .@i = 0; .@i < getarraysize(.@eco_invest); .@i += 2 )
  352. if (.@economy <= .@eco_invest[.@i]) break;
  353. callsub( S_Invest, 4, .@eco_invest[.@i+1], getcastledata(.@map$,CD_INVESTED_ECONOMY), "commercial growth", "quantity of goods made by the guild will increase", "future", "economist", "riches" );
  354. case 3:
  355. .@defense = getcastledata(.@map$,CD_CURRENT_DEFENSE);
  356. setarray .@def_invest[0], 5,10000, 10,20000, 15,40000, 20,70000, 25,110000, 30,160000, 35,220000, 40,290000, 45,370000, 50,460000,
  357. 55,560000, 60,670000, 65,790000, 70,920000, 75,1060000, 80,1210000, 85,1370000, 90,1540000, 95,1720000, 100,1910000;
  358. for ( .@i = 0; .@i < getarraysize(.@def_invest); .@i += 2 )
  359. if (.@defense <= .@def_invest[.@i]) break;
  360. callsub( S_Invest, 5, .@def_invest[.@i+1], getcastledata(.@map$,CD_INVESTED_DEFENSE), "Castle Defenses", "durability of Guardians and the Emperium will increase", "coming battles", "strategist", "Defenses" );
  361. case 4:
  362. mes .@npc_name$;
  363. mes "Will you summon a Guardian? It'll be a protector to defend us loyally.";
  364. mes "Please select a guardian to defend us.";
  365. next;
  366. GuardianData( .@mob_id, .@x, .@y, .@name$ );
  367. for ( .@i = 0; .@i < MAX_GUARDIANS ; .@i++ ) {
  368. if (guardianinfo(.@map$,.@i,0))
  369. .@menu$ = .@menu$ + getmonsterinfo(.@mob_id[.@i],MOB_NAME) + " - Implemented (" + guardianinfo(.@map$,.@i,2) + "/" + guardianinfo(.@map$,.@i,1) + "):";// hp/hpmax
  370. else
  371. .@menu$ = .@menu$ + getmonsterinfo(.@mob_id[.@i],MOB_NAME) + " - Not Implemented:";
  372. }
  373. .@s = select(.@menu$) -1;
  374. mes .@npc_name$;
  375. mes "Will you summon the chosen guardian? 10,000 zeny are required to summon a Guardian.";
  376. next;
  377. if (select( "Summon","Cancel" ) == 2) {
  378. mes .@npc_name$;
  379. mes "I did as you ordered. But please remember if you the have money to spare, it'll be better to set it up.";
  380. close;
  381. }
  382. mes .@npc_name$;
  383. if (getgdskilllv(.@guild_id,10002) == 0) {
  384. 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.";
  385. }
  386. else if (getcastledata( .@map$,(.@s + CD_ENABLED_GUARDIAN00) ) == 1)
  387. mes "Master, you already have summoned that Guardian. We cannot summon another.";
  388. else if (Zeny < 10000)
  389. mes "Well... I'm sorry but we don't have funds to summon the Guardian. We failed to summon the Guardian.";
  390. else {
  391. Zeny = Zeny - 10000;
  392. setcastledata .@map$,(.@s + CD_ENABLED_GUARDIAN00),1;
  393. guardian .@map$, .@x[.@s], .@y[.@s], .@name$[.@s], .@mob_id[.@s], "Kafra Employee#"+ replacestr(.@map$, "cas", "") +"::OnGuardianDied", .@s;
  394. mes "We completed the summoning of the Guardian. Our defenses are now increased with it in place.";
  395. }
  396. close;
  397. case 5:
  398. mes .@npc_name$;
  399. if (getcastledata(.@map$,CD_ENABLED_KAFRA) == 1) {
  400. mes "We are currently hiring a Kafra Employee... Do you want to fire the Kafra Employee?";
  401. next;
  402. if (select( "Fire","Cancel" ) == 2) {
  403. mes .@npc_name$;
  404. mes "She worked hard in my opinion. It was a good decision to keep her.";
  405. close;
  406. }
  407. cutin "kafra_01",2;
  408. mes "[ Hired Kafra Employee ]";
  409. mes "I worked so hard... How can you do that, Master?... Please... Please reconsider... Check it again, Master... Please...";
  410. next;
  411. if (select( "Fire","Cancel" ) == 2) {
  412. mes "[ Hired Kafra Employee ]";
  413. mes "I'll work hard for you... Thank you!";
  414. close;
  415. }
  416. mes "[ Hired Kafra Employee ]";
  417. mes "Oh, my goodness! This is nonsense!";
  418. next;
  419. cutin "",255;
  420. disablenpc "Kafra Employee#" + replacestr(.@map$, "cas", "");
  421. setcastledata .@map$,CD_ENABLED_KAFRA,0;
  422. mes .@npc_name$;
  423. mes "....";
  424. mes "I have discharged the Kafra Employee... But... are you unsatisfied with something?";
  425. close;
  426. }
  427. mes "Will you contact the kafra Main Office and Hire a Employee for our Castle?";
  428. mes "^ff0000 10,000 zeny is required for their services. ";
  429. next;
  430. if (select( "Hire.","Cancel" ) == 2) {
  431. mes .@npc_name$;
  432. mes "I did as you ordered, but some of our members will be unhappy. It will be better to hire a Kafra Employee quickly.";
  433. close;
  434. }
  435. mes .@npc_name$;
  436. if (getgdskilllv(.@guild_id,10001) == 0) {
  437. mes "Master, we can't hire a Kafra Employee because we don't have a contract with the Kafra Main Office. If you want to obtain a contract with the Kafra Main Office, you will need to learn the Guild skill first.";
  438. close;
  439. }
  440. if (Zeny < 10000) {
  441. mes "Well... I'm sorry but we don't have enough funds to hire a Kafra Employee.";
  442. close;
  443. }
  444. Zeny = Zeny - 10000;
  445. enablenpc "Kafra Employee#" + replacestr(.@map$, "cas", "");
  446. setcastledata .@map$,CD_ENABLED_KAFRA,1;
  447. mes "We obtained a contract with the kafra Main Office, and hired a Kafra Employee.";
  448. next;
  449. cutin "kafra_01",2;
  450. mes "[ Hired Kafra Employee ]";
  451. mes "How do you do? I was dispatched from the Main Office.";
  452. mes "I'll do my best to not tarnish the reputation of the Guild.";
  453. next;
  454. cutin "",255;
  455. mes .@npc_name$;
  456. mes "The Contract terms of the hired Kafra Employee are for 1 month and after this term, you will need to pay an additional fee.";
  457. mes "It will be useful for our members.";
  458. close;
  459. case 6:
  460. mes .@npc_name$;
  461. mes "Do you want to visit the room where our valuables are stored?";
  462. mes "That room is restricted to you... you are the only one with access to it.";
  463. next;
  464. mes .@npc_name$;
  465. mes "If you don't open the treasure box within time limits, there is a possibility of losing it when unexpected situation occurs.";
  466. mes "Please make sure to remember that always, Master.";
  467. mes "So, for our guild's improvement, you must find time to collect it.";
  468. next;
  469. switch( select( "Go into Master's room.","Cancel" ) ) {
  470. case 1:
  471. mes .@npc_name$;
  472. mes "I'll show you the secret path. Follow me...please.";
  473. mes "When you want to return here, please press the secret switch.";
  474. close2;
  475. if (.@map$ == "te_aldecas1") warp "te_aldecas1",113,223;
  476. else if (.@map$ == "te_aldecas2") warp "te_aldecas2",134,225;
  477. else if (.@map$ == "te_aldecas3") warp "te_aldecas3",229,267;
  478. else if (.@map$ == "te_aldecas4") warp "te_aldecas4",83,17;
  479. else if (.@map$ == "te_aldecas5") warp "te_aldecas5",64,8;
  480. else if (.@map$ == "te_prtcas01") warp "te_prtcas01",15,209;
  481. else if (.@map$ == "te_prtcas02") warp "te_prtcas02",207,229;
  482. else if (.@map$ == "te_prtcas03") warp "te_prtcas03",190,130;
  483. else if (.@map$ == "te_prtcas04") warp "te_prtcas04",275,160;
  484. else if (.@map$ == "te_prtcas05") warp "te_prtcas05",281,176;
  485. end;
  486. case 2:
  487. mes .@npc_name$;
  488. mes "Goods are produced once a day... if you don't remove them in time, they will not be produced anymore.";
  489. mes "Therefore, it will be better if you check up on them from time to time.";
  490. close;
  491. }
  492. }
  493. S_Invest:
  494. .@cost_invest = getarg(1);
  495. .@num_invest_today = getarg(2);
  496. .@npc_name$ = "[ Butler "+ strnpcinfo(1) +"]";
  497. if (.@num_invest_today)// Quadruple the cost of investing if you've already invested once.
  498. .@cost_invest = .@cost_invest * 4;
  499. mes .@npc_name$;
  500. mes "If you invest in "+ getarg(3) +", the "+ getarg(4) +". Therfore, if you consider our "+ getarg(5) +", investments will be a necessity.";
  501. mes " ";
  502. mes "Initially, you are able to invest just once but if you pay more money, you will be able to invest twice.";
  503. mes " ";
  504. if (getcastledata(strnpcinfo(4),CD_CURRENT_ECONOMY) >= 100) {
  505. mes "^ff0000The "+ getarg(3) +" level of our Castle is at it's highest, 100%. No more investments are needed. Just as I have expected from a great "+ getarg(6) +" like you, Master.^000000";
  506. close;
  507. }
  508. if (.@num_invest_today >= 2) {
  509. mes "^ff0000You have already invested twice today. You cannot invest any more.^000000 I expect the "+ getarg(7) +" of the guild to grow at a high rate.";
  510. close;
  511. }
  512. if (.@num_invest_today == 0)
  513. mes "The current investment amount required is ^ff0000"+.@cost_invest+"^000000 zeny. Will you invest?";
  514. else
  515. mes "You've invested once today... if you wish to invest once more, ^ff0000"+.@cost_invest+"^000000 more zeny will be needed.";
  516. next;
  517. switch( select( "Invest in "+ getarg(3) +".","Cancel" ) ) {
  518. case 1:
  519. mes .@npc_name$;
  520. if (Zeny < .@cost_invest) {
  521. mes "I'm sorry but there is not enough zeny to invest. You will have to try again when you have the funds, Master.";
  522. close;
  523. }
  524. Zeny = Zeny - .@cost_invest;
  525. setcastledata strnpcinfo(4), getarg(0), (.@num_invest_today +1);
  526. mes "We finished the investment safely. I expect that our "+ getarg(3) +" level will be increased by tomorrow.";
  527. close;
  528. case 2:
  529. mes .@npc_name$;
  530. mes "I'll do as you bid, my master... There is no hurry. We will do our best.";
  531. close;
  532. }
  533. function GuardianData {
  534. .@map$ = strnpcinfo(4);
  535. if (.@map$ == "te_aldecas1") {
  536. setarray .@data$[0],
  537. 1287, 17, 218, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
  538. 1285, 39, 205, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
  539. 1285, 38, 196, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
  540. 1286, 21, 194, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  541. 1286, 218, 24, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  542. 1286, 213, 24, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  543. 1286, 73, 70, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  544. 1285, 45, 228, "Outer Castle Archer Guardian";// ARCHER_GUARDIAN
  545. }
  546. else if (.@map$ == "te_aldecas2") {
  547. setarray .@data$[0],
  548. 1287, 51, 183, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
  549. 1286, 27, 184, "Outer Castle Knight Guardian",// KNIGHT_GUARDIAN
  550. 1286, 88, 43, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  551. 1285, 210, 7, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
  552. 1287, 60, 203, "Outer Castle Soldier Guardian",// SOLDIER_GUARDIAN
  553. 1285, 21, 177, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
  554. 1286, 117, 46, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  555. 1285, 36, 183, "Outer Castle Archer Guardian";// ARCHER_GUARDIAN
  556. }
  557. else if (.@map$ == "te_aldecas3") {
  558. setarray .@data$[0],
  559. 1285, 110, 217, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
  560. 1286, 90, 112, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  561. 1287, 86, 120, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
  562. 1285, 195, 151, "Inner Castle Archer Guardian",// ARCHER_GUARDIAN
  563. 1286, 116, 112, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  564. 1287, 116, 76, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
  565. 1287, 64, 103, "Outer Castle Soldier Guardian",// SOLDIER_GUARDIAN
  566. 1285, 212, 160, "Inner Castle Archer Guardian";// ARCHER_GUARDIAN
  567. }
  568. else if (.@map$ == "te_aldecas4") {
  569. setarray .@data$[0],
  570. 1285, 187, 100, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
  571. 1285, 192, 42, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
  572. 1286, 55, 88, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  573. 1287, 145, 209, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
  574. 1287, 169, 53, "Outer Castle Soldier Guardian",// SOLDIER_GUARDIAN
  575. 1287, 198, 77, "Outer Castle Soldier Guardian",// SOLDIER_GUARDIAN
  576. 1285, 148, 88, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
  577. 1286, 48, 72, "Inner Castle Knight Guardian";// KNIGHT_GUARDIAN
  578. }
  579. else if (.@map$ == "te_aldecas5") {
  580. setarray .@data$[0],
  581. 1285, 51, 202, "Inner Castle Archer Guardian",// ARCHER_GUARDIAN
  582. 1286, 27, 221, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  583. 1286, 145, 78, "Outer Castle Knight Guardian",// KNIGHT_GUARDIAN
  584. 1287, 157, 192, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
  585. 1287, 157, 74, "Outer Castle Soldier Guardian",// SOLDIER_GUARDIAN
  586. 1285, 188, 79, "Inner Castle Archer Guardian",// ARCHER_GUARDIAN
  587. 1286, 156, 73, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  588. 1286, 41, 112, "Inner Castle Knight Guardian";// KNIGHT_GUARDIAN
  589. }
  590. else if (.@map$ == "te_prtcas01") {
  591. setarray .@data$[0],
  592. 1287, 182, 68, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
  593. 1287, 182, 116, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
  594. 1287, 153, 86, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
  595. 1285, 59, 28, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
  596. 1285, 50, 36, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
  597. 1286, 184, 183, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  598. 1286, 196, 189, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  599. 1286, 107, 179, "Inner Castle Knight Guardian";// KNIGHT_GUARDIAN
  600. }
  601. else if (.@map$ == "te_prtcas02") {
  602. setarray .@data$[0],
  603. 1286, 162, 161, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  604. 1286, 153, 161, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  605. 1286, 178, 44, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  606. 1287, 71, 75, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
  607. 1287, 49, 28, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
  608. 1285, 64, 186, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
  609. 1285, 76, 196, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
  610. 1285, 75, 175, "Outer Castle Archer Guardian";// ARCHER_GUARDIAN
  611. }
  612. else if (.@map$ == "te_prtcas03") {
  613. setarray .@data$[0],
  614. 1286, 191, 190, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  615. 1286, 137, 190, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  616. 1286, 45, 99, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  617. 1287, 50, 87, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
  618. 1287, 41, 87, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
  619. 1285, 191, 42, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
  620. 1285, 179, 43, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
  621. 1285, 191, 72, "Outer Castle Archer Guardian";// ARCHER_GUARDIAN
  622. }
  623. else if (.@map$ == "te_prtcas04") {
  624. setarray .@data$[0],
  625. 1286, 276, 14, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  626. 1286, 274, 35, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  627. 1286, 246, 246, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  628. 1287, 38, 240, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
  629. 1287, 29, 240, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
  630. 1287, 33, 258, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
  631. 1285, 78, 48, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
  632. 1285, 36, 61, "Outer Castle Archer Guardian";// ARCHER_GUARDIAN
  633. }
  634. else if (.@map$ == "te_prtcas05") {
  635. setarray .@data$[0],
  636. 1286, 266, 262, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  637. 1286, 287, 280, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  638. 1286, 245, 250, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
  639. 1287, 236, 63, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
  640. 1287, 251, 63, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
  641. 1287, 278, 71, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
  642. 1285, 32, 253, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
  643. 1285, 44, 248, "Outer Castle Archer Guardian";// ARCHER_GUARDIAN
  644. }
  645. for ( .@i = 0; .@i < getarraysize(.@data$); .@i += 4 ) {
  646. set getelementofarray( getarg(0),.@index ), .@data$[.@i];
  647. set getelementofarray( getarg(1),.@index ), .@data$[.@i+1];
  648. set getelementofarray( getarg(2),.@index ), .@data$[.@i+2];
  649. set getelementofarray( getarg(3),.@index ), .@data$[.@i+3];
  650. .@index++;
  651. }
  652. }
  653. OnSpawnGuardians:
  654. GuardianData( .@mob_id, .@x, .@y, .@name$ );
  655. .@map$ = strnpcinfo(4);
  656. .@tmp$ = replacestr(.@map$, "cas", "");
  657. killmonster .@map$, "Kafra Employee#"+ .@tmp$ +"::OnGuardianDied";
  658. for ( .@i = 0; .@i < MAX_GUARDIANS; .@i++ ) {
  659. if (getcastledata( .@map$,(.@i + CD_ENABLED_GUARDIAN00) ))
  660. guardian .@map$, .@x[.@i], .@y[.@i], .@name$[.@i], .@mob_id[.@i], "Kafra Employee#"+ .@tmp$ +"::OnGuardianDied",.@i;
  661. }
  662. }
  663. // Guild Dungeon Entrances
  664. //============================================================
  665. - script lever2_TE -1,{
  666. .@guild_id = getcastledata( strnpcinfo(4),CD_GUILD_ID );
  667. if (.@guild_id == 0) {
  668. mes "[Ringing Voice]";
  669. mes "'Those who overcome an ordeal shows a great deal of bravery... and will find their way to another ordeal.'";
  670. close;
  671. }
  672. mes "[Ringing Voice]";
  673. mes "'Only the truly brave can take the test.'";
  674. next;
  675. mes " ";
  676. mes "There's a small lever. Will you pull it?";
  677. next;
  678. if (select( "Pull.","Don't pull." ) == 1) {
  679. if (.@guild_id == getcharid(2)) {
  680. .@npc_map$ = strnpcinfo(4);
  681. if (compare( .@npc_map$,"te_alde" )) {
  682. .@map$ = "teg_dun02";
  683. if (.@npc_map$ == "te_aldecas1") setarray .@coord[0],32,122;
  684. else if (.@npc_map$ == "te_aldecas2") setarray .@coord[0],79,30;
  685. else if (.@npc_map$ == "te_aldecas3") setarray .@coord[0],165,38;
  686. else if (.@npc_map$ == "te_aldecas4") setarray .@coord[0],160,148;
  687. else if (.@npc_map$ == "te_aldecas5") setarray .@coord[0],103,169;
  688. }
  689. else {
  690. .@map$ = "teg_dun01";
  691. if (.@npc_map$ == "te_prtcas01") setarray .@coord[0],28,251;
  692. else if (.@npc_map$ == "te_prtcas02") setarray .@coord[0],164,268;
  693. else if (.@npc_map$ == "te_prtcas03") setarray .@coord[0],164,179;
  694. else if (.@npc_map$ == "te_prtcas04") setarray .@coord[0],268,203;
  695. else if (.@npc_map$ == "te_prtcas05") setarray .@coord[0],199,28;
  696. }
  697. warp .@map$,.@coord[0],.@coord[1];
  698. }
  699. else {
  700. mes " ";
  701. mes "Nothing happened.";
  702. close;
  703. }
  704. }
  705. end;
  706. }
  707. // Treasure Room Exit
  708. //============================================================
  709. - script lever1_TE -1,{
  710. mes " ";
  711. mes "There's a small lever. Will you pull it?";
  712. next;
  713. if ( select( "Pull.","Do not." ) == 1 ) {
  714. .@map$ = strnpcinfo(4);
  715. if (.@map$ == "te_aldecas1") setarray .@coord[0],218,176;
  716. else if (.@map$ == "te_aldecas2") setarray .@coord[0],51,179;
  717. else if (.@map$ == "te_aldecas3") setarray .@coord[0],110,119;
  718. else if (.@map$ == "te_aldecas4") setarray .@coord[0],67,117;
  719. else if (.@map$ == "te_aldecas5") setarray .@coord[0],51,179;
  720. else if (.@map$ == "te_prtcas01") setarray .@coord[0],112,183;
  721. else if (.@map$ == "te_prtcas02") setarray .@coord[0],94,62;
  722. else if (.@map$ == "te_prtcas03") setarray .@coord[0],51,101;
  723. else if (.@map$ == "te_prtcas04") setarray .@coord[0],259,265;
  724. else if (.@map$ == "te_prtcas05") setarray .@coord[0],36,38;
  725. warp .@map$,.@coord[0],.@coord[1];
  726. }
  727. end;
  728. }
  729. // Treasure Room Spawn Template
  730. //============================================================
  731. - script treasure_TE -1,{
  732. OnClock0001:// Spawn Treasure Chests based on castle economy.
  733. .@map$ = strnpcinfo(4);
  734. if (.@map$ == "") end;
  735. .@guild_id = getcastledata(.@map$,CD_GUILD_ID);
  736. if (.@guild_id == 0) end;
  737. .@economy = getcastledata(.@map$,CD_CURRENT_ECONOMY);
  738. .@defense = getcastledata(.@map$,CD_CURRENT_DEFENSE);
  739. .@economy_today = getcastledata(.@map$,CD_INVESTED_ECONOMY);
  740. .@defense_today = getcastledata(.@map$,CD_INVESTED_DEFENSE);
  741. killmonster .@map$, strnpcinfo(0)+"::OnTreasureDied";
  742. if (.@economy_today) {
  743. .@economy = .@economy + .@economy_today + (rand(2) && getgdskilllv(.@guild_id,10014));
  744. .@economy = ( .@economy > 100 ) ? 100 : .@economy;
  745. setcastledata .@map$,CD_CURRENT_ECONOMY,.@economy;
  746. setcastledata .@map$,CD_INVESTED_ECONOMY,0;
  747. }
  748. if (.@defense_today) {
  749. .@defense = .@defense + .@defense_today;
  750. .@defense = ( .@defense > 100 ) ? 100 : .@defense;
  751. setcastledata .@map$,CD_CURRENT_DEFENSE,.@defense;
  752. setcastledata .@map$,CD_INVESTED_DEFENSE,0;
  753. }
  754. if (.@map$ == "te_aldecas1") {
  755. setarray .@data[0],// <mob_id>, <x>,<y>
  756. 2452, 115,226,// TREASURE_BOX_TE
  757. 2458, 122,226,// TREASURE_BOX_TE_6
  758. 2452, 115,219,
  759. 2458, 122,219,
  760. 2452, 116,225,
  761. 2458, 117,225,
  762. 2452, 118,225,
  763. 2458, 119,225,
  764. 2452, 120,225,
  765. 2458, 121,225,
  766. 2452, 121,224,
  767. 2458, 121,223,
  768. 2452, 121,222,
  769. 2458, 121,221,
  770. 2452, 121,220,
  771. 2458, 120,220,
  772. 2452, 119,220,
  773. 2458, 118,220,
  774. 2452, 117,220,
  775. 2458, 116,220,
  776. 2452, 116,221,
  777. 2458, 116,222,
  778. 2452, 116,223,
  779. 2458, 116,224;
  780. }
  781. else if (.@map$ == "te_aldecas2") {
  782. setarray .@data[0],
  783. 2452, 134,231,// TREASURE_BOX_TE
  784. 2459, 135,231,// TREASURE_BOX_TE_7
  785. 2452, 135,230,
  786. 2459, 134,230,
  787. 2452, 132,233,
  788. 2459, 133,233,
  789. 2452, 134,233,
  790. 2459, 135,233,
  791. 2452, 136,233,
  792. 2459, 137,233,
  793. 2452, 137,232,
  794. 2459, 137,231,
  795. 2452, 137,230,
  796. 2459, 137,229,
  797. 2452, 137,228,
  798. 2459, 136,228,
  799. 2452, 135,228,
  800. 2459, 134,228,
  801. 2452, 133,228,
  802. 2459, 132,228,
  803. 2452, 132,229,
  804. 2459, 132,230,
  805. 2452, 132,231,
  806. 2459, 132,232;
  807. }
  808. else if (.@map$ == "te_aldecas3") {
  809. setarray .@data[0],
  810. 2452, 224,269,// TREASURE_BOX_TE
  811. 2460, 225,269,// TREASURE_BOX_TE_8
  812. 2452, 225,268,
  813. 2460, 224,268,
  814. 2452, 222,271,
  815. 2460, 223,271,
  816. 2452, 224,271,
  817. 2460, 225,271,
  818. 2452, 226,271,
  819. 2460, 227,271,
  820. 2452, 227,270,
  821. 2460, 227,269,
  822. 2452, 227,268,
  823. 2460, 227,267,
  824. 2452, 227,266,
  825. 2460, 226,266,
  826. 2452, 225,266,
  827. 2460, 224,266,
  828. 2452, 223,266,
  829. 2460, 222,266,
  830. 2452, 222,267,
  831. 2460, 222,268,
  832. 2452, 222,269,
  833. 2460, 222,270;
  834. }
  835. else if (.@map$ == "te_aldecas4") {
  836. setarray .@data[0],
  837. 2452, 84,13,// TREASURE_BOX_TE
  838. 2461, 85,13,// TREASURE_BOX_TE_9
  839. 2452, 85,12,
  840. 2461, 84,12,
  841. 2452, 82,15,
  842. 2461, 83,15,
  843. 2452, 84,15,
  844. 2461, 85,15,
  845. 2452, 86,15,
  846. 2461, 87,15,
  847. 2452, 87,14,
  848. 2461, 87,13,
  849. 2452, 87,12,
  850. 2461, 87,11,
  851. 2452, 87,10,
  852. 2461, 86,10,
  853. 2452, 85,10,
  854. 2461, 84,10,
  855. 2452, 83,10,
  856. 2461, 82,10,
  857. 2452, 82,11,
  858. 2461, 82,12,
  859. 2452, 82,13,
  860. 2461, 82,14;
  861. }
  862. else if (.@map$ == "te_aldecas5") {
  863. setarray .@data[0],
  864. 2452, 62,12,// TREASURE_BOX_TE
  865. 2462, 62,11,// TREASURE_BOX_TE_10
  866. 2452, 61,11,
  867. 2462, 59,14,
  868. 2452, 60,14,
  869. 2462, 61,14,
  870. 2452, 62,14,
  871. 2462, 63,14,
  872. 2452, 64,14,
  873. 2462, 64,13,
  874. 2452, 64,12,
  875. 2462, 64,11,
  876. 2452, 64,10,
  877. 2462, 64,9,
  878. 2452, 63,9,
  879. 2462, 62,9,
  880. 2452, 61,9,
  881. 2462, 60,9,
  882. 2452, 59,9,
  883. 2462, 59,10,
  884. 2452, 59,11,
  885. 2462, 59,12,
  886. 2452, 59,13;
  887. }
  888. else if (.@map$ == "te_prtcas01") {
  889. setarray .@data[0],
  890. 2452, 8,211,// TREASURE_BOX_TE
  891. 2453, 9,211,// TREASURE_BOX_TE_1
  892. 2452, 10,211,
  893. 2453, 11,211,
  894. 2452, 12,211,
  895. 2453, 13,211,
  896. 2452, 13,209,
  897. 2453, 12,209,
  898. 2452, 11,209,
  899. 2453, 10,209,
  900. 2452, 9,209,
  901. 2453, 8,209,
  902. 2452, 8,207,
  903. 2453, 9,207,
  904. 2452, 10,207,
  905. 2453, 11,207,
  906. 2452, 12,207,
  907. 2453, 13,207,
  908. 2452, 13,206,
  909. 2453, 12,206,
  910. 2452, 11,206,
  911. 2453, 10,206,
  912. 2452, 9,206,
  913. 2453, 8,206;
  914. }
  915. else if (.@map$ == "te_prtcas02") {
  916. setarray .@data[0],
  917. 2452, 201,228,// TREASURE_BOX_TE
  918. 2454, 202,228,// TREASURE_BOX_TE_2
  919. 2452, 202,227,
  920. 2454, 201,227,
  921. 2452, 199,230,
  922. 2454, 200,230,
  923. 2452, 201,230,
  924. 2454, 202,230,
  925. 2452, 203,230,
  926. 2454, 204,230,
  927. 2452, 204,229,
  928. 2454, 204,228,
  929. 2452, 204,227,
  930. 2454, 204,226,
  931. 2452, 204,225,
  932. 2454, 203,225,
  933. 2452, 202,225,
  934. 2454, 201,225,
  935. 2452, 200,225,
  936. 2454, 199,225,
  937. 2452, 199,226,
  938. 2454, 199,227,
  939. 2452, 199,228,
  940. 2454, 199,229;
  941. }
  942. else if (.@map$ == "te_prtcas03") {
  943. setarray .@data[0],
  944. 2452, 187,132,// TREASURE_BOX_TE
  945. 2455, 188,132,// TREASURE_BOX_TE_3
  946. 2452, 188,131,
  947. 2455, 187,131,
  948. 2452, 185,134,
  949. 2455, 186,134,
  950. 2452, 187,134,
  951. 2455, 188,134,
  952. 2452, 189,134,
  953. 2455, 190,134,
  954. 2452, 190,133,
  955. 2455, 190,132,
  956. 2452, 190,131,
  957. 2455, 190,130,
  958. 2452, 190,129,
  959. 2455, 189,129,
  960. 2452, 188,129,
  961. 2455, 187,129,
  962. 2452, 186,129,
  963. 2455, 185,129,
  964. 2452, 185,130,
  965. 2455, 185,131,
  966. 2452, 185,132,
  967. 2455, 185,133;
  968. }
  969. else if (.@map$ == "te_prtcas04") {
  970. setarray .@data[0],
  971. 2452, 269,162,// TREASURE_BOX_TE
  972. 2456, 270,162,// TREASURE_BOX_TE_4
  973. 2452, 270,161,
  974. 2456, 269,161,
  975. 2452, 267,164,
  976. 2456, 268,164,
  977. 2452, 269,164,
  978. 2456, 270,164,
  979. 2452, 271,164,
  980. 2456, 272,164,
  981. 2452, 272,163,
  982. 2456, 272,162,
  983. 2452, 272,161,
  984. 2456, 272,160,
  985. 2452, 272,159,
  986. 2456, 271,159,
  987. 2452, 270,159,
  988. 2456, 269,159,
  989. 2452, 268,159,
  990. 2456, 267,159,
  991. 2452, 267,160,
  992. 2456, 267,161,
  993. 2452, 267,162,
  994. 2456, 267,163;
  995. }
  996. else if (.@map$ == "te_prtcas05") {
  997. setarray .@data[0],
  998. 2452, 275,178,// TREASURE_BOX_TE
  999. 2457, 276,178,// TREASURE_BOX_TE_5
  1000. 2452, 276,177,
  1001. 2457, 275,177,
  1002. 2452, 273,180,
  1003. 2457, 274,180,
  1004. 2452, 275,180,
  1005. 2457, 276,180,
  1006. 2452, 277,180,
  1007. 2457, 278,180,
  1008. 2452, 278,179,
  1009. 2457, 278,178,
  1010. 2452, 278,177,
  1011. 2457, 278,176,
  1012. 2452, 278,175,
  1013. 2457, 277,175,
  1014. 2452, 276,175,
  1015. 2457, 275,175,
  1016. 2452, 274,175,
  1017. 2457, 273,175,
  1018. 2452, 273,176,
  1019. 2457, 273,177,
  1020. 2452, 273,178,
  1021. 2457, 273,179;
  1022. }
  1023. .@treasure_num = ( 4 + ( .@economy /5 ) ) *3;// x3 <-> data[] size
  1024. for ( .@i = 0; .@i < getarraysize(.@data) && .@treasure_num > .@i; .@i += 3 )// nb. [4;24] chests
  1025. monster .@map$, .@data[.@i+1], .@data[.@i+2],"Treasure Chest", .@data[.@i],1, strnpcinfo(0)+"::OnTreasureDied";
  1026. OnTreasureDied:
  1027. end;
  1028. }
  1029. // Flag warp Template
  1030. //============================================================
  1031. function script F_flag_woe_TE {
  1032. .@castle$ = getarg(1);
  1033. .@guild_id = getcastledata( .@castle$,CD_GUILD_ID );
  1034. if (.@guild_id == 0) {
  1035. mes "[ Edict of the Divine Rune-Midgarts Kingdom ]";
  1036. mes " ";
  1037. mes "1. Follow the ordinance of The Divine Rune-Midgarts Kingdom, ";
  1038. mes "We declare that";
  1039. mes "there is no formal master of this castle.";
  1040. mes " ";
  1041. mes "2. To the one who can ";
  1042. mes "overcome all trials";
  1043. mes "and destroy the Emperium,";
  1044. mes "the king will endow the one with";
  1045. mes "ownership of this castle.";
  1046. close;
  1047. }
  1048. if (.@guild_id == getcharid(2) && getarg(0)) {
  1049. mes "[ Echoing Voice ]";
  1050. mes "Brave ones...";
  1051. mes "Do you wish to return to your honorable place?";
  1052. next;
  1053. if (select( "Return to the guild castle.","Quit." ) == 1) {
  1054. if (jobcanentermap(.@castle$) == 0) {
  1055. mes "Tertiary job class and users with expanded levels are not allowed to participate in Training Siege Battles.";
  1056. close;
  1057. }
  1058. if (getcastledata( getarg(1),CD_GUILD_ID ) == getcharid(2))
  1059. warp getarg(1),getarg(2),getarg(3);
  1060. end;
  1061. }
  1062. }
  1063. .@guildname$ = getguildname(.@guild_id);
  1064. .@guildmaster$ = getguildmaster(.@guild_id);
  1065. mes "[ Edict of the Divine Rune-Midgarts Kingdom ]";
  1066. mes " ";
  1067. mes "1. Follow the ordinance of The Divine Rune-Midgarts Kingdom, ";
  1068. mes "we approve that this place is in";
  1069. mes "the private prossession of ^ff0000"+.@guildname$+"^000000 Guild.";
  1070. mes " ";
  1071. mes "2. The guild Master of ^ff0000"+.@guildname$+"^000000 Guild is";
  1072. mes "^ff0000"+.@guildmaster$+"^000000";
  1073. mes "If there is anyone who objects to this,";
  1074. mes "prove your strength and honor with a steel blade in your hand.";
  1075. close;
  1076. }
  1077. - script simple_info_TE -1,{
  1078. callfunc( "F_flag_woe_TE",0,strnpcinfo(4) );
  1079. OnInit:
  1080. if (strnpcinfo(4) != "")
  1081. flagemblem getcastledata( strnpcinfo(4),CD_GUILD_ID );
  1082. end;
  1083. }
  1084. - script flag_te GUILD_FLAG,{
  1085. end;
  1086. OnInit:
  1087. if (strnpcinfo(2) != "")
  1088. flagemblem getcastledata( strnpcinfo(2),CD_GUILD_ID );
  1089. end;
  1090. }
  1091. // GM NPC
  1092. //============================================================
  1093. prt_gld,1,4,0 script #Enterance Button prt CLEAR_NPC,{
  1094. mes "password";
  1095. next;
  1096. if ( callfunc( "F_GM_NPC", 1854,0, 0,9000 ) < 1 ) {
  1097. mes "That's not right";
  1098. close;
  1099. }
  1100. mes "What do you want to do with the Gloria-bound warp?";
  1101. next;
  1102. switch( select( "Open it","Close it","Cancel","Rental item provided" ) ) {
  1103. case 1:
  1104. mes "Opening the warp.";
  1105. enablenpc "to_gloria";
  1106. close;
  1107. case 2:
  1108. mes "Closing the warp.";
  1109. disablenpc "to_gloria";
  1110. close;
  1111. case 3:
  1112. end;
  1113. case 4:
  1114. mes "You have 300 seconds.";
  1115. rentitem 13083,300;// TE_Woe_Knife
  1116. close;
  1117. }
  1118. }
  1119. alde_gld,1,4,0 script #Enterance Button ald CLEAR_NPC,{
  1120. mes "password";
  1121. next;
  1122. if ( callfunc( "F_GM_NPC", 1854,0, 0,9000 ) < 1 ) {
  1123. mes "That's not right";
  1124. close;
  1125. }
  1126. mes "What do you want to do with the Kafragarten-bound warp?";
  1127. next;
  1128. switch( select( "Open it","Close it","Cancel" ) ) {
  1129. case 1:
  1130. mes "Opening the warp.";
  1131. enablenpc "to_kafragarten";
  1132. close;
  1133. case 2:
  1134. mes "Closing the warp.";
  1135. disablenpc "to_kafragarten";
  1136. close;
  1137. case 3:
  1138. end;
  1139. }
  1140. }
  1141. // God Item Hervor & Jormungand
  1142. sec_in02,20,20,0 script Test Guide CLEAR_NPC,{
  1143. mes "Password?";
  1144. next;
  1145. if (callfunc( "F_GM_NPC", 18543792,0, 0,99999999 ) < 1) {
  1146. mes "Aww...";
  1147. close;
  1148. }
  1149. mes "We provide material items needed for testing TE.";
  1150. next;
  1151. switch( select( "Materials for Hervor","Materials for Jormungand" ) ) {
  1152. case 1:
  1153. getitem 6595,2;// Hammer_Of_Velund
  1154. getitem 6596,1;// Anvil_Of_Velund
  1155. getitem 6594,4;// Magic_Bronze_Bullion
  1156. getitem 6597,3;// Bracelet_Of_Velund
  1157. getitem 6602,1;// Secret_Of_Rune
  1158. getitem 6605,1;// Muspellium
  1159. getitem 6604,1;// Essence_Of_Rune
  1160. getitem 2115,1;// Valkyrja's_Shield
  1161. end;
  1162. case 2:
  1163. getitem 6603,4;// Skin_Of_Hraesvelg
  1164. getitem 6599,1;// Spirit_Of_Hugin
  1165. getitem 6598,1;// Rib_Of_Jormungand
  1166. getitem 6601,4;// Chisel_Of_Giant
  1167. getitem 6600,1;// Spirit_Of_Munin
  1168. getitem 6605,1;// Muspellium
  1169. getitem 6604,1;// Essence_Of_Rune
  1170. getitem 1473,1;// Wizardy_Staff
  1171. end;
  1172. }
  1173. }