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.
13 //===== Changelogs: ==========================================
14 //= 1.0 First Version. [Capuche]
15 //============================================================
17 - script Manager_TE -1,{
19 .@map$ = strnpcinfo(4);
20 if (.@map$ == "") end;
21 .@npc_name$ = strnpcinfo(0);
22 .@guild_id = getcastledata(.@map$,1);
23 if (.@guild_id == 0) {
24 killmonster .@map$, .@npc_name$ +"::OnMyMobDead";
25 donpcevent strnpcinfo(0)+"::OnEmpSpawn";
26 if (compare(.@map$,"te_aldecas")) {
27 monster .@map$,0,0,"Evil Druid",1117,10,.@npc_name$ +"::OnMyMobDead";
28 monster .@map$,0,0,"Khalitzburg",1132,4,.@npc_name$ +"::OnMyMobDead";
29 monster .@map$,0,0,"Abysmal Knight",1219,2,.@npc_name$ +"::OnMyMobDead";
30 monster .@map$,0,0,"Executioner",1205,1,.@npc_name$ +"::OnMyMobDead";
31 monster .@map$,0,0,"Penomena",1216,10,.@npc_name$ +"::OnMyMobDead";
32 monster .@map$,0,0,"Alarm",1193,18,.@npc_name$ +"::OnMyMobDead";
33 monster .@map$,0,0,"Clock",1269,9,.@npc_name$ +"::OnMyMobDead";
34 monster .@map$,0,0,"Raydric Archer",1276,7,.@npc_name$ +"::OnMyMobDead";
35 monster .@map$,0,0,"Wanderer",1208,3,.@npc_name$ +"::OnMyMobDead";
36 monster .@map$,0,0,"Alice",1275,1,.@npc_name$ +"::OnMyMobDead";
37 monster .@map$,0,0,"Bloody Knight",1268,1,.@npc_name$ +"::OnMyMobDead";
38 monster .@map$,0,0,"Dark Lord",1272,1,.@npc_name$ +"::OnMyMobDead";
39 if (.@map$ == "te_aldecas1") { setarray .@emproom[0],216,23; }
40 else if (.@map$ == "te_aldecas2") { setarray .@emproom[0],213,23; }
41 else if (.@map$ == "te_aldecas3") { setarray .@emproom[0],205,31; }
42 else if (.@map$ == "te_aldecas4") { setarray .@emproom[0],36,217; }
43 else if (.@map$ == "te_aldecas5") { setarray .@emproom[0],27,101; }
44 monster .@map$,.@emproom[0],.@emproom[1],"Dark Lord",1272,1,.@npc_name$ +"::OnMyMobDead";
45 monster .@map$,.@emproom[0],.@emproom[1],"Tower Keeper",1270,4,.@npc_name$ +"::OnMyMobDead";
46 monster .@map$,.@emproom[0],.@emproom[1],"Bloody Knight",1268,1,.@npc_name$ +"::OnMyMobDead";
47 monster .@map$,.@emproom[0],.@emproom[1],"Abysmal Knight",1219,1,.@npc_name$ +"::OnMyMobDead";
48 monster .@map$,.@emproom[0],.@emproom[1],"Raydric Archer",1276,5,.@npc_name$ +"::OnMyMobDead";
50 else if (compare(.@map$,"te_prtcas")) {
51 monster .@map$,0,0,"Raydric",1163,10,.@npc_name$ +"::OnMyMobDead";
52 monster .@map$,0,0,"Khalitzburg",1132,10,.@npc_name$ +"::OnMyMobDead";
53 monster .@map$,0,0,"Abysmal Knight",1219,5,.@npc_name$ +"::OnMyMobDead";
54 monster .@map$,0,0,"Bloody Knight",1268,5,.@npc_name$ +"::OnMyMobDead";
55 monster .@map$,0,0,"Stormy Knight",1251,1,.@npc_name$ +"::OnMyMobDead";
56 monster .@map$,0,0,"Hatii",1252,1,.@npc_name$ +"::OnMyMobDead";
57 monster .@map$,0,0,"Raydric Archer",1276,5,.@npc_name$ +"::OnMyMobDead";
58 monster .@map$,0,0,"Gryphon",1259,2,.@npc_name$ +"::OnMyMobDead";
59 monster .@map$,0,0,"Chimera",1283,2,.@npc_name$ +"::OnMyMobDead";
60 monster .@map$,0,0,"Alice",1275,1,.@npc_name$ +"::OnMyMobDead";
61 monster .@map$,0,0,"Zealotus",1200,1,.@npc_name$ +"::OnMyMobDead";
62 if (.@map$ == "te_prtcas01") { setarray .@emproom[0],197,197; }
63 else if (.@map$ == "te_prtcas02") { setarray .@emproom[0],157,174; }
64 else if (.@map$ == "te_prtcas03") { setarray .@emproom[0],16,220; }
65 else if (.@map$ == "te_prtcas04") { setarray .@emproom[0],291,14; }
66 else if (.@map$ == "te_prtcas05") { setarray .@emproom[0],266,266; }
67 monster .@map$,.@emproom[0],.@emproom[1],"Guardian Knight of Emperium",1268,1,.@npc_name$ +"::OnMyMobDead";
68 monster .@map$,.@emproom[0],.@emproom[1],"Chief Guardian Knight of Emperium",1251,1,.@npc_name$ +"::OnMyMobDead";
69 monster .@map$,.@emproom[0],.@emproom[1],"Hatii",1252,1,.@npc_name$ +"::OnMyMobDead";
70 monster .@map$,.@emproom[0],.@emproom[1],"Guardian Knight of Emperium",1219,2,.@npc_name$ +"::OnMyMobDead";
71 monster .@map$,.@emproom[0],.@emproom[1],"Raydric Archer",1276,5,.@npc_name$ +"::OnMyMobDead";
73 disablenpc "Kafra Employee#"+ replacestr(.@map$, "cas", "");
76 requestguildinfo .@guild_id;
77 donpcevent "::OnFlagTE" + strnpcinfo(2);// Guild emblem on flags.
78 if (getcastledata(.@map$,9) == 0)
79 disablenpc "Kafra Employee#"+ replacestr(.@map$, "cas", "");
81 // Load purchased Guardian in castles.
82 if (.@map$ == "te_aldecas1") donpcevent "Clode::OnSpawnGuardians";
83 else if (.@map$ == "te_aldecas2") donpcevent "Lares::OnSpawnGuardians";
84 else if (.@map$ == "te_aldecas3") donpcevent "Valerian::OnSpawnGuardians";
85 else if (.@map$ == "te_aldecas4") donpcevent "Alpores::OnSpawnGuardians";
86 else if (.@map$ == "te_aldecas5") donpcevent "Anpere::OnSpawnGuardians";
87 else if (.@map$ == "te_prtcas01") donpcevent "Kurbe::OnSpawnGuardians";
88 else if (.@map$ == "te_prtcas02") donpcevent "Kamiyu::OnSpawnGuardians";
89 else if (.@map$ == "te_prtcas03") donpcevent "Eduare::OnSpawnGuardians";
90 else if (.@map$ == "te_prtcas04") donpcevent "Casate::OnSpawnGuardians";
91 else if (.@map$ == "te_prtcas05") donpcevent "Pisaro::OnSpawnGuardians";
96 .@map$ = strnpcinfo(4);
97 if (!mobcount( .@map$, strnpcinfo(0) +"::OnAgitBreak" )) {
98 if (.@map$ == "te_aldecas1") { setarray .@emproom[0],216,23; }
99 else if (.@map$ == "te_aldecas2") { setarray .@emproom[0],213,23; }
100 else if (.@map$ == "te_aldecas3") { setarray .@emproom[0],205,31; }
101 else if (.@map$ == "te_aldecas4") { setarray .@emproom[0],36,217; }
102 else if (.@map$ == "te_aldecas5") { setarray .@emproom[0],27,101; }
103 else if (.@map$ == "te_prtcas01") { setarray .@emproom[0],197,197; }
104 else if (.@map$ == "te_prtcas02") { setarray .@emproom[0],157,174; }
105 else if (.@map$ == "te_prtcas03") { setarray .@emproom[0],16,220; }
106 else if (.@map$ == "te_prtcas04") { setarray .@emproom[0],291,14; }
107 else if (.@map$ == "te_prtcas05") { setarray .@emproom[0],266,266; }
108 monster .@map$,.@emproom[0],.@emproom[1],"Emperium",1288,1, strnpcinfo(0) +"::OnAgitBreak";
113 .@map$ = strnpcinfo(4);
114 if (.@map$ == "") end;
116 maprespawnguildid .@map$, getcastledata(.@map$,1),2;// warp all non-guild members
118 donpcevent strnpcinfo(0)+"::OnEmpSpawn";
119 callsub S_Message,"OnCommandOn";
124 .@map$ = strnpcinfo(4);
125 if (.@map$ == "") end;
127 if (getcastledata(.@map$,1))
128 killmonster .@map$, strnpcinfo(0) +"::OnAgitBreak";
129 callsub S_Message,"OnReset";
133 .@guild_id = getcharid(2);
134 .@map$ = strnpcinfo(4);
136 .@economy = getcastledata(.@map$,2) - 5;// Adjust economy Invest Level for Castle
138 setcastledata .@map$, 2,1;
140 setcastledata .@map$, 2,.@economy;
141 .@defense = getcastledata(.@map$,3) - 5;// Adjust Defense Invest Level for Castle
143 setcastledata .@map$, 3,1;
145 setcastledata .@map$, 3,.@defense;
146 setcastledata .@map$,1,.@guild_id;
148 // Reset Invest information and refresh castle data
149 for ( .@i = 4; .@i <= 9; .@i++ )
150 setcastledata .@map$,.@i,0;
151 donpcevent strnpcinfo(0) +"::OnAgitInit3";// spawn guardians / monsters
153 // Erase Guardian Database information if the new owners do not have Guardian Research.
154 if (getgdskilllv(.@guild_id,10002) == 0) {
155 for ( .@i = 10; .@i <= 17; .@i++ )
156 setcastledata .@map$,.@i,0;
159 mapannounce .@map$,"Emperium has been destroyed.",bc_map,"0x00FF00",FW_BOLD,20,0,40;
160 maprespawnguildid .@map$,.@guild_id,2;// Respawn all but new castle-occupants, don't remove monsters.
164 donpcevent strnpcinfo(0) +"::OnEmpSpawn";
166 announce "The [" + getcastlename(.@map$) + "] castle has been conquered by the [" + getguildName(.@guild_id) + "] guild.",bc_all|bc_woe;
170 .@map$ = strnpcinfo(4);
171 if (.@map$ == "") end;
172 .@tmp$ = replacestr(.@map$, "cas", "");
173 killmonster .@map$, "Kafra Employee#"+ .@tmp$ +"::OnGuardianDied";
174 disablenpc "Kafra Employee#"+ .@tmp$;
175 setcastledata .@map$,1,0;
177 announce "Guild Base [" + getcastlename(.@map$) + "] has been abandoned.",bc_all;
178 donpcevent strnpcinfo(0) +"::OnAgitInit3";
182 .@map$ = strnpcinfo(4);
183 .@guild_id = getcastledata(.@map$,1);
186 announce "The [" + getcastlename(.@map$) + "] castle is occupied by the [" + getguildname(.@guild_id) + "] guild.",bc_all,"0xFF0000",FW_NORMAL,10;
188 announce "The [" + getcastlename(.@map$) + "] castle is currently unoccupied.", bc_all,"0xFF0000",FW_NORMAL,10;
189 if (compare( .@map$,"te_alde" ))
190 .@string$ = "alde0"+ charat( .@map$,getstrlen(.@map$)-1 );
192 .@string$ = "prt0"+ charat( .@map$,getstrlen(.@map$)-1 );
193 donpcevent "#popswitch_"+ .@string$ +"::"+ getarg(0);// monsters for mission TE
195 if (.@map$ == "te_aldecas1") {
196 donpcevent "Blacksmith Cano#tegod01::OnInit";// god item TE
197 $2012_tegod_kafra = 0;
198 $@2012_tegirls_alde01 = 0;
200 else if (.@map$ == "te_prtcas01") {
201 $2012_tegod_gloria = 0;
202 $@2012_tegirls_prt01 = 0;
203 donpcevent "Blacksmith Kai#tegod01::OnInit";
212 //============================================================
213 - script Kafra_Staff_TE -1,{
214 .@guild_id = getcastledata( strnpcinfo(4),1 );
215 .@guildname$ = getguildname(.@guild_id);
218 mes "[Kafra Employee]";
219 if (.@guild_id == getcharid(2)) {
220 mes "Welcome. ^ff0000" + .@guildname$ + "^000000 Member.";
221 mes "The Kafra Corporation will stay with you wherever you go.";
223 switch( select( "Use Storage", "Use Teleport Service", "Rent a Pushcart", "Cancel" ) ) {
225 if (getskilllv("NV_BASIC") > 5) {
226 mes "[Kafra Employee]";
227 mes "Here, let me open";
228 mes "your Storage for you.";
229 mes "Thank you for using";
230 mes "the Kafra Service.";
234 mes "[Kafra Employee]";
235 mes "I'm sorry, but you";
236 mes "need the Novice's";
237 mes "Basic Skill Level 6 to";
238 mes "use the Storage Service.";
243 if (compare( strnpcinfo(4),"alde" ) == 1)
244 callsub( S_Warp, "Aldebaran", "aldebaran",132,103 );
246 callsub( S_Warp, "Prontera", "prontera",278,211 );
248 mes "[Kafra Employee]";
249 if (BaseClass != Job_Merchant) {
250 mes "I'm sorry, but the";
251 mes "Pushcart rental service";
252 mes "is only available to Merchants,";
253 mes "Blacksmiths and Alchemists.";
256 else if (checkcart()) {
257 mes "You already have";
258 mes "a Pushcart equipped.";
259 mes "Unfortunately, we can't";
260 mes "rent more than one to";
261 mes "each customer at a time.";
265 mes "The Pushcart rental";
266 mes "fee is 800 zeny. Would";
267 mes "you like to rent a Pushcart?";
269 if (select( "Rent a Pushcart","Cancel" ) == 1) {
271 mes "[Kafra Employee]";
272 mes "I'm sorry, but you";
273 mes "don't have enough";
274 mes "zeny to pay the Pushcart";
275 mes "rental fee of 800 zeny.";
279 RESRVPTS = RESRVPTS + 80;
287 mes "[Kafra Employee]";
288 mes "We, here at Kafra Corporation,";
289 mes "are always endeavoring to provide you with the best services. We hope that we meet your adventuring needs and standards of excellence.";
295 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.";
302 mes "[Kafra Employee]";
304 mes "your destination.";
306 switch( select( getarg(0) + " -> 200 z", "Cancel it" ) ) {
309 mes "[Kafra Employee]";
310 mes "I'm sorry, but you don't have";
311 mes "enough zeny for the Teleport";
312 mes "Service. The fee to teleport";
313 mes "to "+getarg(0)+" is 200 zeny.";
319 RESRVPTS = RESRVPTS + 20;
320 warp getarg(1), getarg(2),getarg(3);
331 // Castle Managers (Invest)
332 //============================================================
333 - script invest_TE -1,{
334 function GuardianData;
336 .@map$ = strnpcinfo(4);
337 .@npc_name$ = "[ Butler "+ strnpcinfo(1) +"]";
338 .@guild_id = getcastledata(.@map$,1);
339 .@guildmaster$ = getguildmaster(.@guild_id);
342 if (.@guild_id == 0) {
343 mes "I have been waiting for a master to fulfill my destiny.";
344 mes "Brave soul... fate will guide you towards your future...";
347 if (strcharinfo(0) != .@guildmaster$) {
348 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!";
351 mes "Welcome. My honorable master, ^ff0000"+strcharinfo(0)+"^000000...";
352 mes "Your humble servent, "+strnpcinfo(1)+", is here to serve you.";
354 switch( select( "Castle briefing", "Invest in commercial growth", "Invest in Castle Defenses", "Summon Guardian", "Hire / Fire a Kafra Employee", "Go into Master's room" ) ) {
356 .@economy_today = getcastledata(.@map$,4);
357 .@defense_today = getcastledata(.@map$,5);
359 mes "I will report the Castle briefing, Master.";
361 mes "^0000ffNow, the commercial growth level is "+GetCastleData(.@map$,2)+".";
362 if (.@economy_today > 0)
363 mes " You invested "+.@economy_today+" times in past 1 day.";
364 mes " Now, the Castle Defense level is "+GetCastleData(.@map$,3)+".^000000";
365 if (.@defense_today > 0)
366 mes " ^0000ff- You invested "+.@defense_today+" times in past 1 day.^000000";
368 mes "That's all I have to report, Master.";
372 .@economy = getcastledata(.@map$,2);
373 setarray .@eco_invest[0], 5,5000, 10,10000, 15,20000, 20,35000, 25,55000, 30,80000, 35,110000, 40,145000, 45,185000, 50,230000,
374 55,280000, 60,335000, 65,395000, 70,460000, 75,530000, 80,605000, 85,685000, 90,770000, 95,860000, 100,955000;
375 for ( .@i = 0; .@i < getarraysize(.@eco_invest); .@i += 2 )
376 if (.@economy <= .@eco_invest[.@i]) break;
377 callsub( S_Invest, 4, .@eco_invest[.@i+1], getcastledata(.@map$,4), "commercial growth", "quantity of goods made by the guild will increase", "future", "economist", "riches" );
380 .@defense = getcastledata(.@map$,3);
381 setarray .@def_invest[0], 5,10000, 10,20000, 15,40000, 20,70000, 25,110000, 30,160000, 35,220000, 40,290000, 45,370000, 50,460000,
382 55,560000, 60,670000, 65,790000, 70,920000, 75,1060000, 80,1210000, 85,1370000, 90,1540000, 95,1720000, 100,1910000;
383 for ( .@i = 0; .@i < getarraysize(.@def_invest); .@i += 2 )
384 if (.@defense <= .@def_invest[.@i]) break;
385 callsub( S_Invest, 5, .@def_invest[.@i+1], getcastledata(.@map$,5), "Castle Defenses", "durability of Guardians and the Emperium will increase", "coming battles", "strategist", "Defenses" );
389 mes "Will you summon a Guardian? It'll be a protector to defend us loyally.";
390 mes "Please select a guardian to defend us.";
392 GuardianData( .@mob_id, .@x, .@y, .@name$ );
393 for ( .@i = 0; .@i < MAX_GUARDIANS ; .@i++ ) {
394 if (guardianinfo(.@map$,.@i,0))
395 .@menu$ = .@menu$ + getmonsterinfo(.@mob_id[.@i],MOB_NAME) + " - Implemented (" + guardianinfo(.@map$,.@i,2) + "/" + guardianinfo(.@map$,.@i,1) + "):";// hp/hpmax
397 .@menu$ = .@menu$ + getmonsterinfo(.@mob_id[.@i],MOB_NAME) + " - Not Implemented:";
399 .@s = select(.@menu$) -1;
401 mes "Will you summon the chosen guardian? 10,000 zeny are required to summon a Guardian.";
403 if (select( "Summon","Cancel" ) == 2) {
405 mes "I did as you ordered. But please remember if you the have money to spare, it'll be better to set it up.";
409 if (getgdskilllv(.@guild_id,10002) == 0) {
410 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.";
412 else if (getcastledata( .@map$,(.@s+10) ) == 1)
413 mes "Master, you already have summoned that Guardian. We cannot summon another.";
414 else if (Zeny < 10000)
415 mes "Well... I'm sorry but we don't have funds to summon the Guardian. We failed to summon the Guardian.";
418 setcastledata .@map$,(.@s+10),1;
419 guardian .@map$, .@x[.@s], .@y[.@s], .@name$[.@s], .@mob_id[.@s], "Kafra Employee#"+ replacestr(.@map$, "cas", "") +"::OnGuardianDied", .@s;
420 mes "We completed the summoning of the Guardian. Our defenses are now increased with it in place.";
426 if (getcastledata(.@map$,9) == 1) {
427 mes "We are currently hiring a Kafra Employee... Do you want to fire the Kafra Employee?";
429 if (select( "Fire","Cancel" ) == 2) {
431 mes "She worked hard in my opinion. It was a good decision to keep her.";
435 mes "[ Hired Kafra Employee ]";
436 mes "I worked so hard... How can you do that, Master?... Please... Please reconsider... Check it again, Master... Please...";
438 if (select( "Fire","Cancel" ) == 2) {
439 mes "[ Hired Kafra Employee ]";
440 mes "I'll work hard for you... Thank you!";
443 mes "[ Hired Kafra Employee ]";
444 mes "Oh, my goodness! This is nonsense!";
447 disablenpc "Kafra Employee#" + replacestr(.@map$, "cas", "");
448 setcastledata .@map$,9,0;
451 mes "I have discharged the Kafra Employee... But... are you unsatisfied with something?";
454 mes "Will you contact the kafra Main Office and Hire a Employee for our Castle?";
455 mes "^ff0000 10,000 zeny is required for their services. ";
457 if (select( "Hire.","Cancel" ) == 2) {
459 mes "I did as you ordered, but some of our members will be unhappy. It will be better to hire a Kafra Employee quickly.";
463 if (getgdskilllv(.@guild_id,10001) == 0) {
464 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.";
468 mes "Well... I'm sorry but we don't have enough funds to hire a Kafra Employee.";
472 enablenpc "Kafra Employee#" + replacestr(.@map$, "cas", "");
473 setcastledata .@map$,9,1;
475 mes "We obtained a contract with the kafra Main Office, and hired a Kafra Employee.";
478 mes "[ Hired Kafra Employee ]";
479 mes "How do you do? I was dispatched from the Main Office.";
480 mes "I'll do my best to not tarnish the reputation of the Guild.";
484 mes "The Contract terms of the hired Kafra Employee are for 1 month and after this term, you will need to to pay an additional fee.";
485 mes "It will be useful for our members.";
490 mes "Do you want to visit the room where our valuables are stored?";
491 mes "That room is restricted to you... you are the only one with access to it.";
494 mes "If you don't open the treasure box within time limits, there is a possibility of losing it when unexpected situation occurs.";
495 mes "Please make sure to remember that always, Master.";
496 mes "So, for our guild's improvement, you must find time to collect it.";
498 switch( select( "Go into Master's room.","Cancel" ) ) {
501 mes "I'll show you the secret path. Follow me...please.";
502 mes "When you want to return here, please press the secret switch.";
504 if (.@map$ == "te_aldecas1") warp "te_aldecas1",113,223;
505 else if (.@map$ == "te_aldecas2") warp "te_aldecas2",134,225;
506 else if (.@map$ == "te_aldecas3") warp "te_aldecas3",229,267;
507 else if (.@map$ == "te_aldecas4") warp "te_aldecas4",83,17;
508 else if (.@map$ == "te_aldecas5") warp "te_aldecas5",64,8;
509 else if (.@map$ == "te_prtcas01") warp "te_prtcas01",15,209;
510 else if (.@map$ == "te_prtcas02") warp "te_prtcas02",207,229;
511 else if (.@map$ == "te_prtcas03") warp "te_prtcas03",190,130;
512 else if (.@map$ == "te_prtcas04") warp "te_prtcas04",275,160;
513 else if (.@map$ == "te_prtcas05") warp "te_prtcas05",281,176;
517 mes "Goods are produced once a day... if you don't remove them in time, they will not be produced anymore.";
518 mes "Therefore, it will be better if you check up on them from time to time.";
524 .@cost_invest = getarg(1);
525 .@num_invest_today = getarg(2);
526 .@npc_name$ = "[ Butler "+ strnpcinfo(1) +"]";
527 if (.@num_invest_today)// Quadruple the cost of investing if you've already invested once.
528 .@cost_invest = .@cost_invest * 4;
531 mes "If you invest in "+ getarg(3) +", the "+ getarg(4) +". Therfore, if you consider our "+ getarg(5) +", investments will be a necessity.";
533 mes "Initially, you are able to invest just once but if you pay more money, you will be able to invest twice.";
535 if (getcastledata(strnpcinfo(4),2) >= 100) {
536 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";
539 if (.@num_invest_today >= 2) {
540 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.";
543 if (.@num_invest_today == 0)
544 mes "The current investment amount required is ^ff0000"+.@cost_invest+"^000000 zeny. Will you invest?";
546 mes "You've invested once today... if you wish to invest once more, ^ff0000"+.@cost_invest+"^000000 more zeny will be needed.";
548 switch( select( "Invest in "+ getarg(3) +".","Cancel" ) ) {
551 if (Zeny < .@cost_invest) {
552 mes "I'm sorry but there is not enough zeny to invest. You will have to try again when you have the funds, Master.";
555 Zeny = Zeny - .@cost_invest;
556 setcastledata strnpcinfo(4), getarg(0), (.@num_invest_today +1);
557 mes "We finished the investment safely. I expect that our "+ getarg(3) +" level will be increased by tomorrow.";
561 mes "I'll do as you bid, my master... There is no hurry. We will do our best.";
565 function GuardianData {
566 .@map$ = strnpcinfo(4);
567 if (.@map$ == "te_aldecas1") {
569 1287, 17, 218, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
570 1285, 39, 205, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
571 1285, 38, 196, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
572 1286, 21, 194, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
573 1286, 218, 24, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
574 1286, 213, 24, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
575 1286, 73, 70, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
576 1285, 45, 228, "Outer Castle Archer Guardian";// ARCHER_GUARDIAN
578 else if (.@map$ == "te_aldecas2") {
580 1287, 51, 183, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
581 1286, 27, 184, "Outer Castle Knight Guardian",// KNIGHT_GUARDIAN
582 1286, 88, 43, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
583 1285, 210, 7, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
584 1287, 60, 203, "Outer Castle Soldier Guardian",// SOLDIER_GUARDIAN
585 1285, 21, 177, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
586 1286, 117, 46, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
587 1285, 36, 183, "Outer Castle Archer Guardian";// ARCHER_GUARDIAN
589 else if (.@map$ == "te_aldecas3") {
591 1285, 110, 217, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
592 1286, 90, 112, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
593 1287, 86, 120, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
594 1285, 195, 151, "Inner Castle Archer Guardian",// ARCHER_GUARDIAN
595 1286, 116, 112, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
596 1287, 116, 76, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
597 1287, 64, 103, "Outer Castle Soldier Guardian",// SOLDIER_GUARDIAN
598 1285, 212, 160, "Inner Castle Archer Guardian";// ARCHER_GUARDIAN
600 else if (.@map$ == "te_aldecas4") {
602 1285, 187, 100, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
603 1285, 192, 42, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
604 1286, 55, 88, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
605 1287, 145, 209, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
606 1287, 169, 53, "Outer Castle Soldier Guardian",// SOLDIER_GUARDIAN
607 1287, 198, 77, "Outer Castle Soldier Guardian",// SOLDIER_GUARDIAN
608 1285, 148, 88, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
609 1286, 48, 72, "Inner Castle Knight Guardian";// KNIGHT_GUARDIAN
611 else if (.@map$ == "te_aldecas5") {
613 1285, 51, 202, "Inner Castle Archer Guardian",// ARCHER_GUARDIAN
614 1286, 27, 221, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
615 1286, 145, 78, "Outer Castle Knight Guardian",// KNIGHT_GUARDIAN
616 1287, 157, 192, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
617 1287, 157, 74, "Outer Castle Soldier Guardian",// SOLDIER_GUARDIAN
618 1285, 188, 79, "Inner Castle Archer Guardian",// ARCHER_GUARDIAN
619 1286, 156, 73, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
620 1286, 41, 112, "Inner Castle Knight Guardian";// KNIGHT_GUARDIAN
622 else if (.@map$ == "te_prtcas01") {
624 1287, 182, 68, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
625 1287, 182, 116, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
626 1287, 153, 86, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
627 1285, 59, 28, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
628 1285, 50, 36, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
629 1286, 184, 183, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
630 1286, 196, 189, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
631 1286, 107, 179, "Inner Castle Knight Guardian";// KNIGHT_GUARDIAN
633 else if (.@map$ == "te_prtcas02") {
635 1286, 162, 161, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
636 1286, 153, 161, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
637 1286, 178, 44, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
638 1287, 71, 75, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
639 1287, 49, 28, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
640 1285, 64, 186, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
641 1285, 76, 196, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
642 1285, 75, 175, "Outer Castle Archer Guardian";// ARCHER_GUARDIAN
644 else if (.@map$ == "te_prtcas03") {
646 1286, 191, 190, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
647 1286, 137, 190, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
648 1286, 45, 99, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
649 1287, 50, 87, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
650 1287, 41, 87, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
651 1285, 191, 42, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
652 1285, 179, 43, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
653 1285, 191, 72, "Outer Castle Archer Guardian";// ARCHER_GUARDIAN
655 else if (.@map$ == "te_prtcas04") {
657 1286, 276, 14, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
658 1286, 274, 35, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
659 1286, 246, 246, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
660 1287, 38, 240, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
661 1287, 29, 240, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
662 1287, 33, 258, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
663 1285, 78, 48, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
664 1285, 36, 61, "Outer Castle Archer Guardian";// ARCHER_GUARDIAN
666 else if (.@map$ == "te_prtcas05") {
668 1286, 266, 262, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
669 1286, 287, 280, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
670 1286, 245, 250, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN
671 1287, 236, 63, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
672 1287, 251, 63, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
673 1287, 278, 71, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN
674 1285, 32, 253, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN
675 1285, 44, 248, "Outer Castle Archer Guardian";// ARCHER_GUARDIAN
677 for ( .@i = 0; .@i < getarraysize(.@data$); .@i += 4 ) {
678 set getelementofarray( getarg(0),.@index ), .@data$[.@i];
679 set getelementofarray( getarg(1),.@index ), .@data$[.@i+1];
680 set getelementofarray( getarg(2),.@index ), .@data$[.@i+2];
681 set getelementofarray( getarg(3),.@index ), .@data$[.@i+3];
687 GuardianData( .@mob_id, .@x, .@y, .@name$ );
688 .@map$ = strnpcinfo(4);
689 .@tmp$ = replacestr(.@map$, "cas", "");
690 killmonster .@map$, "Kafra Employee#"+ .@tmp$ +"::OnGuardianDied";
691 for ( .@i = 0; .@i < MAX_GUARDIANS; .@i++ ) {
692 if (getcastledata( .@map$,(.@i+10) ))
693 guardian .@map$, .@x[.@i], .@y[.@i], .@name$[.@i], .@mob_id[.@i], "Kafra Employee#"+ .@tmp$ +"::OnGuardianDied",.@i;
697 // Guild Dungeon Entrances
698 //============================================================
699 - script lever2_TE -1,{
700 .@guild_id = getcastledata( strnpcinfo(4),1 );
701 if (.@guild_id == 0) {
702 mes "[Ringing Voice]";
703 mes "'Those who overcome an ordeal shows a great deal of bravery... and will find their way to another ordeal.'";
706 mes "[Ringing Voice]";
707 mes "'Only the truly brave can take the test.'";
710 mes "There's a small lever. Will you pull it?";
712 if (select( "Pull.","Don't pull." ) == 1) {
713 if (.@guild_id == getcharid(2)) {
714 .@npc_map$ = strnpcinfo(4);
715 if (compare( .@npc_map$,"te_alde" )) {
716 .@map$ = "teg_dun02";
717 if (.@npc_map$ == "te_aldecas1") setarray .@coord[0],32,122;
718 else if (.@npc_map$ == "te_aldecas2") setarray .@coord[0],79,30;
719 else if (.@npc_map$ == "te_aldecas3") setarray .@coord[0],165,38;
720 else if (.@npc_map$ == "te_aldecas4") setarray .@coord[0],160,148;
721 else if (.@npc_map$ == "te_aldecas5") setarray .@coord[0],103,169;
724 .@map$ = "teg_dun01";
725 if (.@npc_map$ == "te_prtcas01") setarray .@coord[0],28,251;
726 else if (.@npc_map$ == "te_prtcas02") setarray .@coord[0],164,268;
727 else if (.@npc_map$ == "te_prtcas03") setarray .@coord[0],164,179;
728 else if (.@npc_map$ == "te_prtcas04") setarray .@coord[0],268,203;
729 else if (.@npc_map$ == "te_prtcas05") setarray .@coord[0],199,28;
731 warp .@map$,.@coord[0],.@coord[1];
735 mes "Nothing happened.";
742 // Treasure Room Exit
743 //============================================================
744 - script lever1_TE -1,{
746 mes "There's a small lever. Will you pull it?";
748 if ( select( "Pull.","Do not." ) == 1 ) {
749 .@map$ = strnpcinfo(4);
750 if (.@map$ == "te_aldecas1") setarray .@coord[0],218,176;
751 else if (.@map$ == "te_aldecas2") setarray .@coord[0],51,179;
752 else if (.@map$ == "te_aldecas3") setarray .@coord[0],110,119;
753 else if (.@map$ == "te_aldecas4") setarray .@coord[0],67,117;
754 else if (.@map$ == "te_aldecas5") setarray .@coord[0],51,179;
755 else if (.@map$ == "te_prtcas01") setarray .@coord[0],112,183;
756 else if (.@map$ == "te_prtcas02") setarray .@coord[0],94,62;
757 else if (.@map$ == "te_prtcas03") setarray .@coord[0],51,101;
758 else if (.@map$ == "te_prtcas04") setarray .@coord[0],259,265;
759 else if (.@map$ == "te_prtcas05") setarray .@coord[0],36,38;
760 warp .@map$,.@coord[0],.@coord[1];
765 // Treasure Room Spawn Template
766 //============================================================
767 - script treasure_TE -1,{
768 OnClock0001:// Spawn Treasure Chests based on castle economy.
769 .@map$ = strnpcinfo(4);
770 if (.@map$ == "") end;
771 .@guild_id = getcastledata(.@map$,1);
772 if (.@guild_id == 0) end;
774 .@economy = getcastledata(.@map$,2);
775 .@defense = getcastledata(.@map$,3);
776 .@economy_today = getcastledata(.@map$,4);
777 .@defense_today = getcastledata(.@map$,5);
779 killmonster .@map$, strnpcinfo(0)+"::OnTreasureDied";
780 if (.@economy_today) {
781 .@economy = .@economy + .@economy_today + (rand(2) && getgdskilllv(.@guild_id,10014));
782 .@economy = ( .@economy > 100 ) ? 100 : .@economy;
783 setcastledata .@map$,2,.@economy;
784 setcastledata .@map$,4,0;
786 if (.@defense_today) {
787 .@defense = .@defense + .@defense_today;
788 .@defense = ( .@defense > 100 ) ? 100 : .@defense;
789 setcastledata .@map$,3,.@defense;
790 setcastledata .@map$,5,0;
793 if (.@map$ == "te_aldecas1") {
794 setarray .@data[0],// <mob_id>, <x>,<y>
795 2452, 115,226,// TREASURE_BOX_TE
796 2458, 122,226,// TREASURE_BOX_TE_6
820 else if (.@map$ == "te_aldecas2") {
822 2452, 134,231,// TREASURE_BOX_TE
823 2459, 135,231,// TREASURE_BOX_TE_7
847 else if (.@map$ == "te_aldecas3") {
849 2452, 224,269,// TREASURE_BOX_TE
850 2460, 225,269,// TREASURE_BOX_TE_8
874 else if (.@map$ == "te_aldecas4") {
876 2452, 84,13,// TREASURE_BOX_TE
877 2461, 85,13,// TREASURE_BOX_TE_9
901 else if (.@map$ == "te_aldecas5") {
903 2452, 62,12,// TREASURE_BOX_TE
904 2462, 62,11,// TREASURE_BOX_TE_10
927 else if (.@map$ == "te_prtcas01") {
929 2452, 8,211,// TREASURE_BOX_TE
930 2453, 9,211,// TREASURE_BOX_TE_1
954 else if (.@map$ == "te_prtcas02") {
956 2452, 201,228,// TREASURE_BOX_TE
957 2454, 202,228,// TREASURE_BOX_TE_2
981 else if (.@map$ == "te_prtcas03") {
983 2452, 187,132,// TREASURE_BOX_TE
984 2455, 188,132,// TREASURE_BOX_TE_3
1008 else if (.@map$ == "te_prtcas04") {
1010 2452, 269,162,// TREASURE_BOX_TE
1011 2456, 270,162,// TREASURE_BOX_TE_4
1035 else if (.@map$ == "te_prtcas05") {
1037 2452, 275,178,// TREASURE_BOX_TE
1038 2457, 276,178,// TREASURE_BOX_TE_5
1062 .@treasure_num = ( 4 + ( .@economy /5 ) ) *3;// x3 <-> data[] size
1063 for ( .@i = 0; .@i < getarraysize(.@data) && .@treasure_num > .@i; .@i += 3 )// nb. [4;24] chests
1064 monster .@map$, .@data[.@i+1], .@data[.@i+2],"Treasure Chest", .@data[.@i],1, strnpcinfo(0)+"::OnTreasureDied";
1070 // Flag warp Template
1071 //============================================================
1072 function script F_flag_woe_TE {
1073 .@castle$ = getarg(1);
1074 .@guild_id = getcastledata( .@castle$,1 );
1075 if (.@guild_id == 0) {
1076 mes "[ Edict of the Divine Rune-Midgarts Kingdom ]";
1078 mes "1. Follow the ordinance of The Divine Rune-Midgarts Kingdom, ";
1079 mes "We declare that";
1080 mes "there is no formal master of this castle.";
1082 mes "2. To the one who can ";
1083 mes "overcome all trials";
1084 mes "and destroy the Emperium,";
1085 mes "the king will endow the one with";
1086 mes "ownership of this castle.";
1089 if (.@guild_id == getcharid(2) && getarg(0)) {
1090 mes "[ Echoing Voice ]";
1091 mes "Brave ones...";
1092 mes "Do you wish to return to your honorable place?";
1094 if (select( "Return to the guild castle.","Quit." ) == 1) {
1095 if (jobcanentermap(.@castle$) == 0) {
1096 mes "Tertiary job class and users with expanded levels are not allowed to participate in Training Siege Battles.";
1099 if (getcastledata( getarg(1),1 ) == getcharid(2))
1100 warp getarg(1),getarg(2),getarg(3);
1104 .@guildname$ = getguildname(.@guild_id);
1105 .@guildmaster$ = getguildmaster(.@guild_id);
1106 mes "[ Edict of the Divine Rune-Midgarts Kingdom ]";
1108 mes "1. Follow the ordinance of The Divine Rune-Midgarts Kingdom, ";
1109 mes "we approve that this place is in";
1110 mes "the private prossession of ^ff0000"+.@guildname$+"^000000 Guild.";
1112 mes "2. The guild Master of ^ff0000"+.@guildname$+"^000000 Guild is";
1113 mes "^ff0000"+.@guildmaster$+"^000000";
1114 mes "If there is anyone who objects to this,";
1115 mes "prove your strength and honor with a steel blade in your hand.";
1119 - script simple_info_TE -1,{
1120 callfunc( "F_flag_woe_TE",0,strnpcinfo(4) );
1122 if (strnpcinfo(4) != "")
1123 flagemblem getcastledata( strnpcinfo(4),1 );
1127 - script flag_te GUILD_FLAG,{
1130 if (strnpcinfo(2) != "")
1131 flagemblem getcastledata( strnpcinfo(2),1 );
1137 //============================================================
1138 prt_gld,1,4,0 script #Enterance Button prt CLEAR_NPC,{
1141 if ( callfunc( "F_GM_NPC", 1854,0, 0,9000 ) < 1 ) {
1142 mes "That's not right";
1145 mes "What do you want to do with the Gloria-bound warp?";
1147 switch( select( "Open it","Close it","Cancel","Rental item provided" ) ) {
1149 mes "Opening the warp.";
1150 enablenpc "to_gloria";
1153 mes "Closing the warp.";
1154 disablenpc "to_gloria";
1159 mes "You have 300 seconds.";
1160 rentitem 13083,300;// TE_Woe_Knife
1165 alde_gld,1,4,0 script #Enterance Button ald CLEAR_NPC,{
1168 if ( callfunc( "F_GM_NPC", 1854,0, 0,9000 ) < 1 ) {
1169 mes "That's not right";
1172 mes "What do you want to do with the Kafragarten-bound warp?";
1174 switch( select( "Open it","Close it","Cancel" ) ) {
1176 mes "Opening the warp.";
1177 enablenpc "to_kafragarten";
1180 mes "Closing the warp.";
1181 disablenpc "to_kafragarten";
1188 // God Item Hervor & Jormungand
1189 sec_in02,20,20,0 script Test Guide CLEAR_NPC,{
1192 if (callfunc( "F_GM_NPC", 18543792,0, 0,99999999 ) < 1) {
1196 mes "We provide material items needed for testing TE.";
1198 switch( select( "Materials for Hervor","Materials for Jormungand" ) ) {
1200 getitem 6595,2;// Hammer_Of_Velund
1201 getitem 6596,1;// Anvil_Of_Velund
1202 getitem 6594,4;// Magic_Bronze_Bullion
1203 getitem 6597,3;// Bracelet_Of_Velund
1204 getitem 6602,1;// Secret_Of_Rune
1205 getitem 6605,1;// Muspellium
1206 getitem 6604,1;// Essence_Of_Rune
1207 getitem 2115,1;// Valkyrja's_Shield
1210 getitem 6603,4;// Skin_Of_Hraesvelg
1211 getitem 6599,1;// Spirit_Of_Hugin
1212 getitem 6598,1;// Rib_Of_Jormungand
1213 getitem 6601,4;// Chisel_Of_Giant
1214 getitem 6600,1;// Spirit_Of_Munin
1215 getitem 6605,1;// Muspellium
1216 getitem 6604,1;// Essence_Of_Rune
1217 getitem 1473,1;// Wizardy_Staff