//===== rAthena Script ======================================= //= War of Emperium SE - Template File //===== By: ================================================== //= Euphy //===== Current Version: ===================================== //= 1.4a //===== Compatible With: ===================================== //= rAthena Project //===== Description: ========================================= //= Like agit_main, this file is required //= for SE castles to function. //===== Additional Comments: ================================= //= 0.x Previous authors: L0ne_W0lf, Zephyrus, Brian. //= 1.0 If anything breaks, blame Maki. [Euphy] //= 1.1 Fixed an incorrect label execution. [Euphy] //= 1.2 Hopefully fixed a processing error. [Euphy] //= 1.3 Fixed barricade issue in schg_cas02. [Cookie] //= 1.4 Added OnGuildBreak event and a spawn check. [Euphy] //= 1.4a Fixed Guardian Stone respawns. [Euphy] //============================================================ // Core, triggers all other events //============================================================ - script Manager#template -1,{ OnAgitInit2: OnRecvCastle2: if (strnpcinfo(2) == "template") end; if (!getcastledata(strnpcinfo(2),CD_GUILD_ID)) { donpcevent strnpcinfo(0)+"::OnStart"; // Monster spawns are identical for all castles. monster strnpcinfo(2),0,0,"Evil Druid",1117,10; monster strnpcinfo(2),0,0,"Khalitzburg",1132,4; monster strnpcinfo(2),0,0,"Abysmal Knight",1219,3; monster strnpcinfo(2),0,0,"Executioner",1205,1; monster strnpcinfo(2),0,0,"Penomena",1216,10; monster strnpcinfo(2),0,0,"Alarm",1193,18; monster strnpcinfo(2),0,0,"Clock",1269,9; monster strnpcinfo(2),0,0,"Raydric Archer",1276,12; monster strnpcinfo(2),0,0,"Wanderer",1208,3; monster strnpcinfo(2),0,0,"Alice",1275,1; monster strnpcinfo(2),0,0,"Bloody Knight",1268,2; monster strnpcinfo(2),0,0,"Dark Lord",1272,2; monster strnpcinfo(2),0,0,"Tower Keeper",1270,4; } if (getcastledata(strnpcinfo(2),CD_ENABLED_KAFRA) < 1) disablenpc "Kafra Employee#"+substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9); end; OnAgitStart2: if (strnpcinfo(2) == "template") end; if (agitcheck2()) { maprespawnguildid strnpcinfo(2),getcastledata(strnpcinfo(2),CD_GUILD_ID),2; gvgon strnpcinfo(2); donpcevent strnpcinfo(0)+"::OnStart"; } else for(set .@i,0; .@i<4; set .@i,.@i+1) donpcevent "RL"+.@i+"#"+strnpcinfo(2)+"::OnDisable"; end; OnAgitEnd2: if (strnpcinfo(2) == "template") end; gvgoff strnpcinfo(2); if (getcastledata(strnpcinfo(2),CD_GUILD_ID)) { set .@str$,substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9); killmonster strnpcinfo(2),"Steward#"+.@str$+"::OnStartArena"; donpcevent strnpcinfo(0)+"::OnReset"; donpcevent "Steward#"+.@str$+"::OnStop"; } end; OnGuildBreak: if (strnpcinfo(2) == "template") end; killmonster strnpcinfo(2),"gard1#"+strnpcinfo(2)+"::OnGuardianDied"; killmonster strnpcinfo(2),"gard2#"+strnpcinfo(2)+"::OnGuardianDied"; disablenpc "Kafra Employee#"+substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9); setcastledata strnpcinfo(2),CD_GUILD_ID,0; sleep 7000; announce "Guild Base ["+getcastlename(strnpcinfo(2))+"] has been abandoned.",0; donpcevent strnpcinfo(0)+"::OnRecvCastle2"; end; OnStart: // $agit_ar0x[] - $agit_sc0x[] // 1st Guardian stone, 2nd Guardian stone, Barrier 1, Barrier 2, Barrier 3, Summon Guardians // Settings for all but Summon Guardians: 0 = Okay | 1 = Destroyed | 2 = Repairing // Summon Guardians: 0 = Do not Summon | 1 = Summon if (getcastledata(strnpcinfo(2),CD_GUILD_ID)) { setarray getd("$agit_"+substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9)+"[0]"),0,0,0,0,0,0; donpcevent "df1#"+strnpcinfo(2)+"::OnEnable"; donpcevent "df2#"+strnpcinfo(2)+"::OnEnable"; for(set .@i,0; .@i<4; set .@i,.@i+1) donpcevent "RL"+.@i+"#"+strnpcinfo(2)+"::OnEnable"; } OnEmpSpawn: set .@str$, substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9); if (mobcount(strnpcinfo(2),"Steward#"+.@str$+"::OnStartArena")) end; if (compare(strnpcinfo(2),"arug")) { if (strnpcinfo(2) == "arug_cas01") setarray .@i[0],87,219; else if (strnpcinfo(2) == "arug_cas02") setarray .@i[0],89,256; else setarray .@i[0],141,293; // Castles 3,4,5 are identical. } else { if (strnpcinfo(2) == "schg_cas02") setarray .@i[0],162,193; else if (strnpcinfo(2) == "schg_cas03") setarray .@i[0],338,202; else setarray .@i[0],120,272; // Castles 1,4,5 are identical. } monster strnpcinfo(2),.@i[0],.@i[1],"Emperium",1288,1,"Steward#"+.@str$+"::OnStartArena"; end; OnReset: set .@str$, substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9); donpcevent "df1#"+strnpcinfo(2)+"::OnDisable"; donpcevent "df2#"+strnpcinfo(2)+"::OnDisable"; donpcevent "gard1#"+strnpcinfo(2)+"::OnReset"; donpcevent "gard2#"+strnpcinfo(2)+"::OnReset"; donpcevent "1st Guardian Stone#"+.@str$+"::OnDisable"; donpcevent "2nd Guardian Stone#"+.@str$+"::OnDisable"; for(set .@i,1; .@i<4; set .@i,.@i+1) donpcevent "Control Device0"+.@i+"#"+.@str$+"::OnDisable"; for(set .@i,0; .@i<4; set .@i,.@i+1) donpcevent "RL"+.@i+"#"+strnpcinfo(2)+"::OnDisable"; if (agitcheck2()) setarray getd("$agit_"+substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9)+"[0]"),0,0,1,1,1,0; end; OnChange: set .@str$, substr(strnpcinfo(2),0,1)+substr(strnpcinfo(2),8,9); setarray getd("$agit_"+.@str$+"[0]"),2,2,1,1,2,0; donpcevent strnpcinfo(0)+"::OnEmpSpawn"; donpcevent "Control Device03#"+.@str$+"::OnEnable"; donpcevent "1st Guardian Stone#"+.@str$+"::OnEnable"; donpcevent "2nd Guardian Stone#"+.@str$+"::OnEnable"; end; OnClock0001: // Spawn Treasure Chests based on castle economy. if (strnpcinfo(2) == "template") end; if (!getcastledata(strnpcinfo(2),CD_GUILD_ID)) end; killmonster strnpcinfo(2),strnpcinfo(0)+"::OnTreasureDied"; if (getcastledata(strnpcinfo(2),CD_INVESTED_ECONOMY)) { set .@Economy,getcastledata(strnpcinfo(2),CD_CURRENT_ECONOMY); setcastledata strnpcinfo(2),CD_CURRENT_ECONOMY,.@Economy+getcastledata(strnpcinfo(2),CD_INVESTED_ECONOMY)+(rand(2) && getgdskilllv(getcastledata(strnpcinfo(2),CD_GUILD_ID),10014)); if (getcastledata(strnpcinfo(2),CD_CURRENT_ECONOMY) > 100) setcastledata strnpcinfo(2),CD_CURRENT_ECONOMY,100; setcastledata strnpcinfo(2),CD_INVESTED_ECONOMY,0; } if (getcastledata(strnpcinfo(2),CD_INVESTED_DEFENSE)) { set .@Defence,getcastledata(strnpcinfo(2),CD_CURRENT_DEFENSE); setcastledata strnpcinfo(2),CD_CURRENT_DEFENSE,.@Defence+getcastledata(strnpcinfo(2),CD_INVESTED_DEFENSE); if (getcastledata(strnpcinfo(2),CD_CURRENT_DEFENSE) > 100) setcastledata strnpcinfo(2),CD_CURRENT_DEFENSE,100; setcastledata strnpcinfo(2),CD_INVESTED_DEFENSE,0; } set .@Treasure,getcastledata(strnpcinfo(2),CD_CURRENT_ECONOMY)/5+4; if (!.@Treasure) end; freeloop(1); if (compare(strnpcinfo(2),"arug")) { if (strnpcinfo(2) == "arug_cas01") { set .@treasurebox,1943; setarray .@treasurex[0],251,252,253,254,255,256,257,258,251,252,253,254,255,256,257,258,251,252,253,254,255,256,257,258; setarray .@treasurey[0],369,369,369,369,368,368,368,368,367,367,367,367,366,366,366,366,365,365,365,365,364,364,364,364; } else if (strnpcinfo(2) == "arug_cas02") { set .@treasurebox,1944; setarray .@treasurex[0],382,383,384,385,386,387,384,385,386,387,388,389,382,383,384,385,386,387,384,385,386,387,388,389; setarray .@treasurey[0],231,231,231,231,231,231,230,230,230,230,230,230,225,225,225,225,225,225,224,224,224,224,224,224; } else { // Castles 3,4,5 are identical, except 4's treasure. set .@treasurebox,(strnpcinfo(2) == "arug_cas04")?1946:1945; setarray .@treasurex[0],291,292,293,294,295,296,293,294,295,296,297,298,291,292,293,294,295,296,293,294,295,296,297,298; setarray .@treasurey[0],276,276,276,276,276,276,274,274,274,274,274,274,272,272,272,272,272,272,269,269,269,269,269,269; } } else { if (strnpcinfo(2) == "schg_cas02") { set .@treasurebox,1939; setarray .@treasurex[0],249,250,251,252,253,246,247,248,249,250,250,251,252,253,246,247,248,249,250,249,250,251,252,253; setarray .@treasurey[0],378,378,378,378,378,376,376,376,376,376,374,374,374,374,372,372,372,372,372,370,370,370,370,370; } else if (strnpcinfo(2) == "schg_cas03") { set .@treasurebox,1940; setarray .@treasurex[0],189,190,191,192,193,194,189,190,191,192,193,194,189,190,191,192,193,194,189,190,191,192,193,194; setarray .@treasurey[0], 21, 21, 21, 21, 21, 21, 19, 19, 19, 19, 19, 19, 17, 17, 17, 17, 17, 17, 15, 15, 15, 15, 15, 15; } else { // Castles 1,4,5 are identical, except treasures. if (strnpcinfo(2) == "schg_cas01") set .@treasurebox,1938; else if (strnpcinfo(2) == "schg_cas04") set .@treasurebox,1941; else set .@treasurebox,1942; setarray .@treasurex[0],388,388,388,387,386,385,384,384,384,384,384,384,385,386,387,388,389,390,390,390,389,388,387,386; setarray .@treasurey[0],388,389,390,390,390,390,389,388,387,386,385,384,384,384,384,384,384,384,385,386,386,386,386,386; } } for(set .@i,0; .@i<4; set .@i,.@i+1) monster strnpcinfo(2),.@treasurex[.@i],.@treasurey[.@i],"Treasure Chest",(.@i%2)?.@treasurebox:1324,1,strnpcinfo(0)+"::OnTreasureDied"; for(set .@i,4; .@i<24; set .@i,.@i+1) { if (.@Treasure < .@i+1) break; monster strnpcinfo(2),.@treasurex[.@i],.@treasurey[.@i],"Treasure Chest",(.@i%2)?.@treasurebox:1324,1,strnpcinfo(0)+"::OnTreasureDied"; } freeloop(0); end; OnTreasureDied: end; } // Guild Manager //============================================================ - script Steward#template -1,{ set .@GID, getcastledata(strnpcinfo(4),CD_GUILD_ID); if (!.@GID) { mes "[ Steward ]"; mes "I await for the master"; mes "whom destiny will choose"; mes "for me. Do you think you"; mes "have to courage and strength"; mes "to conquer this stronghold?"; close; } if (is_guild_leader(.@GID) == false) { mes "[ Steward ]"; mes "Hmpf. Your threats don't"; mes "scare me! Guardians, drive"; mes "this infidel away from here!"; mes "I will always be loyal to the"; mes "master of this stronghold,"; mes "the one and only ^FF0000"+getguildmaster(.@GID)+"^000000."; close; } mes "[ Steward ]"; mes "Ah, Master ^FF0000"+getguildmaster(.@GID)+"^000000..."; mes "How shall I serve you today?"; mes "Was there an aspect of this"; mes "stronghold's maintenance"; mes "you wanted to discuss?"; next; switch(select("Stronghold Briefing:Invest in Commercial Growth:Invest in Defense growth:Hire/Fire Storage Staff:Go to Master's room")) { case 1: mes "[ Steward ]"; mes "The Commercial Growth"; mes "Level of the stronghold is ^0000ff"+getcastledata(strnpcinfo(4),CD_CURRENT_ECONOMY)+"."; if (getcastledata(strnpcinfo(4),CD_INVESTED_ECONOMY) > 0) { mes "Last time, you invested in"; mes "Commercial Growth "+getcastledata(strnpcinfo(4),CD_INVESTED_ECONOMY)+"."; } next; mes "[ Steward ]"; mes "Our stronghold's"; mes "safeguard level is "+getcastledata(strnpcinfo(4),CD_CURRENT_DEFENSE)+"."; if (getcastledata(strnpcinfo(4),CD_INVESTED_DEFENSE) > 0) { mes "Last time, you invested"; mes "in defense "+getcastledata(strnpcinfo(4),CD_INVESTED_DEFENSE)+" times."; } mes " "; mes "That is all, master."; close; case 2: set .@Economy,getcastledata(strnpcinfo(4),CD_CURRENT_ECONOMY); setarray .@cost[0],5000,10000,20000,35000,55000,80000,110000,145000,185000,230000,280000,335000,395000,460000,530000,605000,685000,770000,860000,955000; set .@j,0; for(set .@i,6; .@i<101; set .@i,.@i+5) { if (.@Economy < .@i) { set .@eco_invest,.@cost[.@j]; break; } set .@j, .@j+1; } // Quadruple the cost of investing if you've already invested once. if (getcastledata(strnpcinfo(4),CD_INVESTED_ECONOMY)) set .@eco_invest,.@eco_invest*4; mes "[ Steward ]"; mes "Raising the stronghold's"; mes "commercial growth will"; mes "increase the quantity of"; mes "goods produced for the guild."; mes "Investing in commercial growth"; mes "will help the guild's future."; next; mes "[ Steward ]"; mes "You can make one investment"; mes "each day, but if you can make"; mes "two investments if you pay"; mes "more Zeny: this will speed"; mes "up commercial development,"; mes "but can be quite expensive."; next; if (.@Economy == 100) { mes "[ Steward ]"; mes "However, our stronghold's"; mes "commerical growth level is"; mes "at 100%. It's not possible to"; mes "develop commercial growth"; mes "any further than that."; close; } if (getcastledata(strnpcinfo(4),CD_INVESTED_ECONOMY) >= 2) { mes "[ Steward ]"; mes "You've already made two"; mes "investments today, so you'll"; mes "have to wait until tomorrow"; mes "to make another investment."; close; } if (getcastledata(strnpcinfo(4),CD_INVESTED_ECONOMY) == 0) { mes "[ Steward ]"; mes "You must pay ^FF0000"+.@eco_invest+"^000000 Zeny"; mes "to make an investment"; mes "Will you invest in this"; mes "stronghold's commerical"; mes "development now?"; } else { mes "[ Steward ]"; mes "You must pay ^FF0000"+.@eco_invest+"^000000"; mes "more Zeny to make a second"; mes "investment today. Will you"; mes "invest one more time?"; } next; switch(select("Invest in Commercial Growth:Cancel")) { case 1: if (getcastledata(strnpcinfo(4),CD_INVESTED_ECONOMY) >= 2) { mes "[ Steward ]"; mes "You've already made two"; mes "investments today, so you'll"; mes "have to wait until tomorrow"; mes "to make another investment."; close; } if (Zeny < .@eco_invest) { mes "[ Steward ]"; mes "I'm sorry, Master, but"; mes "you do not have enough"; mes "Zeny to make an investment"; mes "for the guild today."; close; } set Zeny, Zeny-.@eco_invest; setcastledata strnpcinfo(4),CD_INVESTED_ECONOMY,getcastledata(strnpcinfo(4),CD_INVESTED_ECONOMY)+1; mes "[ Steward ]"; mes "A wise use of the guild's"; mes "funds, Master. We can expect"; mes "to see the results of this"; mes "investment by tomorrow."; close; case 2: mes "[ Steward ]"; mes "As you command, Master."; close; } case 3: set .@Defence,getcastledata(strnpcinfo(4),CD_CURRENT_DEFENSE); setarray .@cost[0],10000,20000,40000,70000,110000,160000,220000,290000,370000,460000,560000,670000,790000,920000,1060000,1210000,1370000,1540000,1720000,1910000; set .@j,0; for(set .@i,6; .@i<101; set .@i,.@i+5) { if (.@Defence < .@i) { set .@def_invest,.@cost[.@j]; break; } set .@j, .@j+1; } // Quadruple the cost of investing if you've already invested once. if (getcastledata(strnpcinfo(4),CD_INVESTED_DEFENSE)) set .@def_invest,.@def_invest*4; mes "[ Steward ]"; mes "Investing in our stronghold's"; mes "defense will enhance the"; mes "durability of our Guardians"; mes "and the Emperium. We'll need"; mes "every advantage to protect"; mes "ourselves from our enemies."; next; mes "[ Steward ]"; mes "You can invest in defense"; mes "once per day, but if you pay"; mes "more Zeny, you can invest"; mes "a maximum of two times daily."; next; mes "[ Steward ]"; if (getcastledata(strnpcinfo(4),CD_CURRENT_DEFENSE) == 100) { mes "The Defense Level of this"; mes "stronghold is 100%, and"; mes "cannot be increased further."; close; } if (getcastledata(strnpcinfo(4),CD_INVESTED_DEFENSE) >= 2) { mes "Master, you've already"; mes "invested in Defense twice"; mes "today. You'll need to wait"; mes "until tomorrow if you really"; mes "want to increase our defenses."; close; } if (getcastledata(strnpcinfo(4),CD_INVESTED_DEFENSE) == 0) { mes "We need ^FF0000"+.@def_invest+"^000000"; mes "Zeny to invest in our"; mes "stronghold's defenses."; mes "Will you invest now?"; } else { mes "We need ^FF0000"+.@def_invest+"^000000"; mes "Zeny to invest in our"; mes "stronghold's defenses"; mes "a second time today."; mes "Will you invest now?"; } next; switch(select("Invest in Defense:Cancel")) { case 1: if (getcastledata(strnpcinfo(4),CD_INVESTED_DEFENSE) >= 2) { mes "[ Steward ]"; mes "Master, you've already"; mes "invested in Defense twice"; mes "today. You'll need to wait"; mes "until tomorrow if you really"; mes "want to increase our defenses."; close; } if (Zeny < .@def_invest) { mes "[ Steward ]"; mes "I'm sorry, Master, but"; mes "you do not have enough"; mes "Zeny to make an investment"; mes "for the guild today."; close; } set Zeny, Zeny-.@def_invest; setcastledata strnpcinfo(4),CD_INVESTED_DEFENSE,getcastledata(strnpcinfo(4),CD_INVESTED_DEFENSE)+1; mes "[ Steward ]"; mes "A wise use of the guild's"; mes "funds, Master. Increasing"; mes "the frequency of treasure"; mes "procured by the guild will"; mes "definitely help us all."; close; case 2: mes "[ Steward ]"; mes "As you command, Master."; close; } case 4: if (getcastledata(strnpcinfo(4),CD_ENABLED_KAFRA) == 1) { mes "[ Steward ]"; mes "Do you wish to dismiss"; mes "the Kafra Employee that"; mes "we've hired for the guild?"; next; switch(select("Dismiss:Cancel")) { case 1: cutin "kafra_01",2; mes "[ Hired Kafra Employee ]"; mes "Master, please reconsider!"; mes "I've been working very hard"; mes "for the success of the guild!"; mes "I'll try harder to serve the"; mes "guild members of this"; mes "stronghold, I promise!"; next; switch(select("Dismiss:Cancel")) { case 1: mes "[ Hired Kafra Employee ]"; mes "Why?! What have I done"; mes "to deserve this? Waaah~!"; next; cutin "kafra_01",255; break; case 2: mes "[ Hired Kafra Employee ]"; mes "Thank you, Master!"; mes "I'll obey your every"; mes "command as best I can!"; mes "You won't regret this!"; close; } break; case 2: mes "[ Steward ]"; mes "She works very hard,"; mes "in my opinion. It was in"; mes "all of our best interests to"; mes "allow her to stay with us."; close; } disablenpc "Kafra Employee#"+strnpcinfo(2); setcastledata strnpcinfo(4),CD_ENABLED_KAFRA,0; mes "[ Steward ]"; mes "That Kafra Employee"; mes "has been dismissed."; mes "Were really dissatisfied"; mes "by the quality of her service?"; close; } else { mes "[ Steward ]"; mes "Will you hire a"; mes "Kafra Employee to serve"; mes "our stronghold? You must"; mes "pay ^FF000010,000 Zeny^000000 to hire one."; next; switch(select("Hire:Cancel")) { case 1: if (getgdskilllv(.@GID,10001) == 0) { mes "[ Steward ]"; mes "Master, we cannot hire a"; mes "Kafra Employee because"; mes "you have not yet attained"; mes "the ^FF0000Contract with Kafra^000000"; mes "guild skill."; close; } if (Zeny < 10000) { mes "[ Steward ]"; mes "Master, we cannot hire a"; mes "Kafra Employee because"; mes "we do not have enough"; mes "funds to pay the contract fee."; close; } set Zeny, Zeny-10000; enablenpc "Kafra Employee#"+strnpcinfo(2); setcastledata strnpcinfo(4),CD_ENABLED_KAFRA,1; mes "[ Steward ]"; mes "Very well. We have formed"; mes "a contract with the Kafra"; mes "Head Office, and hired a"; mes "Kafra Employee for our"; mes "stronghold. Here she is~"; next; cutin "kafra_01",2; mes "[ Hired Kafra Employee ]"; mes "How do you do? I've"; mes "been dispatched by the"; mes "Kafra Head Office to"; mes "serve your guild's needs."; mes "I'll do my best to follow"; mes "your every command, Master."; next; cutin "kafra_01",255; mes "[ Steward ]"; mes "Our contract will expire"; mes "after one month, so we must"; mes "pay additional fees to keep"; mes "this Kafra Employee in"; mes "the service of our guild."; close; case 2: mes "[ Steward ]"; mes "As you command, Master."; mes "However, I suggest hiring"; mes "a Kafra Employee as soon"; mes "as possible since our guild"; mes "would greatly benefit from"; mes "the convenient Kafra services."; close; } } case 5: mes "[ Steward ]"; mes "Do you wish to enter the"; mes "Guild Treasure Room?"; mes "Only you, the Guild Master,"; mes "are permitted to enter."; next; mes "[ Steward ]"; mes "Please remember to open"; mes "the Treasure Boxes at the"; mes "proper time. Otherwise, the"; mes "treasure may disappear if"; mes "something unexpected happens."; next; switch(select("Go to Treasure Room:Cancel")) { case 1: mes "[ Steward ]"; mes "Allow me to guide you"; mes "on the secret path to"; mes "the Treasure Room."; mes "Press the secret switch"; mes "when you wish to return here."; close2; if (compare(strnpcinfo(4),"arug")) { if (strnpcinfo(4) == "arug_cas01") setarray .@i[0],250,363; else if (strnpcinfo(4) == "arug_cas02") setarray .@i[0],382,227; else setarray .@i[0],292,266; // Castles 3,4,5 are identical. } else { if (strnpcinfo(4) == "schg_cas02") setarray .@i[0],249,373; else if (strnpcinfo(4) == "schg_cas03") setarray .@i[0],190,16; else setarray .@i[0],381,381; // Castles 1,4,5 are identical. } warp strnpcinfo(4),.@i[0],.@i[1]; end; case 2: mes "[ Steward ]"; mes "Items in the Treasure Room"; mes "are produced once each day."; mes "Therefore, you must obtain"; mes "the treasure items everyday."; mes "For the sake of the guild,"; mes "prioritize treasure harvesting!"; close; } } OnStop: awake strnpcinfo(0); end; OnStartArena: set .@GID,getcharid(2); set .@region$, (compare(strnpcinfo(4),"arug"))?"Valfreyja":"Nithafjoll"; // Lower castle Economy set .@Economy,getcastledata(strnpcinfo(4),CD_CURRENT_ECONOMY)-5; if (.@Economy < 0) set .@Economy, 0; setcastledata strnpcinfo(4),CD_CURRENT_ECONOMY,.@Economy; // Lower Castle Defence set .@Defence,getcastledata(strnpcinfo(4),CD_CURRENT_DEFENSE)-5; if (.@Defence < 0) set .@Defence, 0; setcastledata strnpcinfo(4),CD_CURRENT_DEFENSE,.@Defence; // Set new owner setcastledata strnpcinfo(4),CD_GUILD_ID,.@GID; // Clear castle's data. for(set .@i,CD_INVESTED_ECONOMY; .@i 200 z:Cancel")) { case 1: if (Zeny < 200) { mes "[Kafra Employee]"; mes "I'm sorry, but you don't"; mes "have enough Zeny to pay"; mes "the warp fee. Would you"; mes "please check your funds again?"; close2; cutin "kafra_01",255; end; } set Zeny, Zeny-200; warp "rachel",115,125; end; case 2: cutin "kafra_01",255; break; } break; case 3: if (BaseClass != Job_Merchant) { mes "[Kafra Employee]"; mes "I'm sorry, but the Pushcart"; mes "rental service can only be"; mes "used by Merchant, Blacksmith,"; mes "and Alchemist class characters."; } else if (checkcart() == 1) { mes "[Kafra Employee]"; mes "Hm? You've already"; mes "rented a Pushcart."; } else { mes "[Kafra Employee]"; mes "The Pushcart rental fee"; mes "is 800 Zeny. Would you"; mes "like to rent a Pushcart?"; next; switch(select("Rent Pushcart:Cancel")) { case 1: if (Zeny < 800) { mes "[Kafra Employee]"; mes "I'm sorry, but you don't"; mes "have enough Zeny to rent"; mes "one of our Pushcarts."; close2; cutin "kafra_01",255; end; } set Zeny, Zeny-800; setcart; break; case 2: break; } } break; case 4: mes "[Kafra Employee]"; mes "Thank you for using the"; mes "Kafra Service. Wherever"; mes "you go, Kafra will be"; mes "there to support you!"; close2; cutin "kafra_01",255; end; } close2; cutin "kafra_01",255; end; } else { mes "[Kafra Employee]"; mes "I'm sorry, but I've been"; mes "exclusively contracted"; mes "to the members of the"; mes "^FF0000"+getguildname(.@GID)+"^000000 Guild."; mes "You'll have to ask another"; mes "Kafra Employee to help you..."; close2; cutin "kafra_01",255; end; } } // Guardian Stones (2) //============================================================ - script Guardian Stone#template -1,{ set .@GID, getcastledata(strnpcinfo(4),CD_GUILD_ID); set .@num, atoi(charat(strnpcinfo(1),0)); set .@var$,"$agit_"+strnpcinfo(2); if (getcharid(2) == .@GID) { mes "^3355FFYou will need the"; mes "following materials to"; mes "rebuild a destroyed"; mes "Guardian Stone.^000000"; next; mes "1 Oridecon"; mes "1 Elunium"; mes "30 Stones"; mes "5 Blue Gemstones"; mes "5 Yellow Gemstones"; mes "5 Red Gemstones"; next; mes "^3355FFDo you want to continue?^000000"; next; if(select("No:Continue") == 1) { mes "^3355FFWork canceled.^000000"; close; } if ((countitem(984) > 0) && (countitem(985) > 0) && (countitem(7049) > 29) && (countitem(717) > 4) && (countitem(715) > 4) && (countitem(716) > 4)) { mes "^3355FFArrange Stones, Elunium, and"; mes "Oridecon, in that order, in the"; mes "center. Then you must arrange"; mes "the enchanted Gemstones to"; mes "rebuild the Guardian Stone.^000000"; next; setarray .@stone$[0],"Elunium","Oridecon","Stones"; set .@i, select("Elunium:Oridecon:Stone")-1; if (.@i == 2) set .@nice,.@nice+10; mes "^3355FF"+.@stone$[.@i]+" has been"; mes "placed in the center.^000000"; next; set .@i, select("Elunium:Oridecon:Stone")-1; if (.@i == 0) set .@nice,.@nice+10; mes "^3355FFYou have lined the"; mes "outside of the center"; mes "with some "+.@stone$[.@i]+".^000000"; next; set .@i, select("Elunium:Oridecon:Stone")-1; if (.@i == 1) set .@nice,.@nice+10; mes "^3355FFYou covered the"; mes "rest of the materials"; mes "with some "+.@stone$[.@i]+".^000000"; next; mes "^3355FFNow you need to arrange"; mes "the enchanted Gemstones"; mes "accordingly. You can identify"; mes "their Magic properties by"; mes "their casting effect.^000000"; next; setarray .@effect[0],EF_BEGINSPELL4,EF_BEGINSPELL2,EF_VOLCANO; setarray .@color$[0],"Red","Yellow","Blue"; while(1) { if (.@roof0 > 7) break; set .@i, rand(getarraysize(.@effect)); specialeffect .@effect[.@i]; mes "^3355FFThe Gemstones must"; mes "be arranged in the correct"; mes "order according to their"; mes "magic properties and power.^000000"; next; set .@j, select("Red Gemstone:Yellow Gemstone:Blue Gemstone")-1; mes "^3355FFYou placed the "+.@color$[.@j]+" Gemstone.^000000"; if (.@i == .@j) { mes "^3355FFHowever, the Guardian Stone"; mes "Repair System failed because"; mes "of a magic power conflict.^000000"; close; } set .@nice,.@nice+10; set .@roof0,.@roof0+1; specialeffect EF_STEAL; next; } if (.@nice > 90) { if (!getd(.@var$+"["+(.@num-1)+"]")) { mes "^3355FFThe Guardian Stone"; mes "Repair System has"; mes "already completed.^000000"; close; } else { if (!agitcheck2()) { mes "^3355FFIt is impossible to"; mes "rebuild the Guardian"; mes "Stone because the"; mes "Emperium is not present.^000000"; close; } else { mes "^3355FFThe Gemstones have been"; mes "arranged, and the Guardian"; mes "Stone is successfully repaired.^000000"; delitem 984,1; //Oridecon delitem 985,1; //Elunium delitem 7049,30; //Stone delitem 717,5; //Blue_Gemstone delitem 715,5; //Yellow_Gemstone delitem 716,5; //Red_Gemstone close2; donpcevent "df"+.@num+"#"+strnpcinfo(4)+"::OnEnable"; specialeffect EF_ICECRASH; disablenpc(); setd .@var$+"["+(.@num-1)+"]",0; set .@df_all,getd(.@var$+"[0]")+getd(.@var$+"[1]"); if (!.@df_all) { mapannounce strnpcinfo(4),"Both Guardian Stones have been erected, bolstering this stronghold's defenses!",bc_map,"0x00ff00"; donpcevent "RL0#"+strnpcinfo(4)+"::OnEnable"; } else mapannounce strnpcinfo(4),"The "+strnpcinfo(1)+" has been repaired successfully.",bc_map,"0x00ff00"; if (getd(.@var$+"[5]") == 1) donpcevent "gard"+.@num+"#"+strnpcinfo(4)+"::OnEnable"; end; } } } else { mes "^3355FFAfter all of that work..."; mes "It looks like you failed"; mes "to fix the Guardian Stone,"; mes "and lost some materials.^000000"; delitem 7049,10; //Stone delitem 717,2; //Blue_Gemstone delitem 715,2; //Yellow_Gemstone delitem 716,2; //Red_Gemstone close; } } else { mes "^3355FFYou don't have enough"; mes "materials to repair"; mes "the Guardian Stone.^000000"; close; } } end; OnInit: OnDisable: disablenpc(); end; OnEnable: enablenpc(); specialeffect EF_MAPPILLAR2; end; } // Control Devices (3) //============================================================ - script Control#template -1,{ set .@GID, getcastledata(strnpcinfo(4),CD_GUILD_ID); set .@num, atoi(charat(strnpcinfo(1),15)); set .@var$,"$agit_"+strnpcinfo(2); if (getcharid(2) == .@GID) { if (is_guild_leader() == true) { if (getd(.@var$+"["+(.@num+1)+"]") == 2) { mes "^3355FFDemolished Fortress"; mes "Gates can be repaired,"; mes "but you will need to gather"; mes "the following materials.^000000"; next; mes "^4D4DFF10 Steel^000000,"; mes "^4D4DFF30 Trunks^000000,"; mes "^4D4DFF5 Oridecon^000000, and"; mes "^4D4DFF10 Emveretarcon^000000."; next; select("Continue"); if ((countitem(1019) > 29) && (countitem(999) > 9) && (countitem(1011) > 9) && (countitem(984) > 4)) { mes "^3355FFYou will need Trunks to"; mes "repair the support frame,"; mes "Oridecon to enhance the"; mes "gate's endurance, and"; mes "Emveretarcon to basically"; mes "hold everything together.^000000"; next; set .@ro_of01,rand(10,15); while(1) { if (.@ro_of02 == .@ro_of01) break; else { switch(rand(1,4)) { case 1: mes "^3355FFThe support frame"; mes "is badly damaged:"; mes "fixing this part"; mes "is a top priority.^000000"; next; switch(select("Trunk:Steel:Emveretarcon:Oridecon")) { case 1: mes "^3355FFThe frame has been"; mes "reinforced with wood.^000000"; set .@rp_temp,.@rp_temp+1; set .@ro_of02,.@ro_of02+1; specialeffect2 EF_REPAIRWEAPON; next; break; case 2: mes "^3355FFYou tried using steel,"; mes "but it's not working very"; mes "well. You'll have to try"; mes "something else.^000000"; close; case 3: mes "^3355FFYou tried using emveretarcon"; mes "to reinforce the gate, but it's"; mes "not working well at all."; mes "You'll have to start over.^000000"; close; case 4: mes "^3355FFYou tried using oridecon,"; mes "but it's not working very"; mes "well. You'll have to try"; mes "something else.^000000"; close; } break; case 2: mes "^3355FFIt looks like the gate's"; mes "overall endurance needs to"; mes "be reinforced with something.^000000"; next; switch(select("Trunk:Steel:Emveretarcon:Oridecon")) { case 1: mes "^3355FFYou tried using wood"; mes "to reinforce the gate.^000000"; set .@ro_of02,.@ro_of02+1; next; break; case 2: mes "^3355FFYou tried using steel"; mes "to reinforce the gate, but"; mes "it's not working well at all."; mes "You'll have to start over.^000000"; close; case 3: mes "^3355FFYou tried using emveretarcon"; mes "to reinforce the gate, but it's"; mes "not working well at all."; mes "You'll have to start over.^000000"; close; case 4: mes "^3355FFYou hammered the"; mes "oridecon: it looks"; mes "like this will work.^000000"; set .@rp_temp,.@rp_temp+1; set .@ro_of02,.@ro_of02+1; specialeffect2 EF_REPAIRWEAPON; next; break; } break; case 3: mes "^3355FFThe damage to the gate"; mes "has caused all these"; mes "cracks. You'll have to"; mes "weld them solid somehow.^000000"; next; switch(select("Trunk:Steel:Emveretarcon:Oridecon")) { case 1: mes "^3355FFYou tried using wood to fix"; mes "this problem, but it seems"; mes "to have made it worse."; mes "You'll have to start all over.^000000"; close; case 2: mes "^3355FFYou used steel to weld"; mes "all the cracks: the gate is"; mes "is starting to look more solid.^000000"; set .@rp_temp,.@rp_temp+1; set .@ro_of02,.@ro_of02+1; specialeffect2 EF_REPAIRWEAPON; next; break; case 3: mes "^3355FFYou tried using emveretarcon"; mes "to reinforce the gate, but it's"; mes "not working well at all."; mes "You'll have to start over.^000000"; close; case 4: mes "^3355FFYou tried using oridecon,"; mes "but it's not working very"; mes "well. You'll have to try"; mes "something else.^000000"; close; } break; case 4: mes "^3355FFNow you need to make"; mes "sure that the gate is held"; mes "together pretty solidly.^000000"; next; switch(select("Trunk:Steel:Emveretarcon:Oridecon")) { case 1: mes "^3355FFYou tried using wood to fix"; mes "this problem, but it seems"; mes "to have made it worse."; mes "You'll have to start all over.^000000"; close; case 2: mes "^3355FFYou tried using steel,"; mes "but it's not working very"; mes "well. You'll have to try"; mes "something else.^000000"; close; case 3: mes "^3355FFYou successfully used"; mes "the emveretarcon to repair"; mes "much of the gate's damage.^000000"; set .@rp_temp,.@rp_temp+1; set .@ro_of02,.@ro_of02+1; specialeffect2 EF_REPAIRWEAPON; next; break; case 4: mes "^3355FFYou tried using oridecon,"; mes "but it's not working very"; mes "well. You'll have to try"; mes "something else.^000000"; close; } } } } mes "^3355FFWell, it looks like"; mes "you're just about done"; mes "with repairing the gate.^000000"; next; if (!agitcheck2()) { mes "^3355FFUnfortunately, the Fortress"; mes "Gate can't be reconstructed:"; mes "the Emperium is no longer here.^000000"; close; } else { if (.@rp_temp == .@ro_of01) { mes "^3355FFThe Fortress Gate has"; mes "been successfully repaired!^000000"; delitem 1019,30; //Wooden_Block delitem 999,10; //Steel delitem 1011,10; //Emveretarcon delitem 984,5; //Oridecon close2; donpcevent "RL"+.@num+"#"+strnpcinfo(4)+"::OnEnable"; disablenpc(); if (.@num == 1) set .@str$,"1st"; else if (.@num == 2) set .@str$,"2nd"; else if (.@num == 3) set .@str$,"3rd"; mapannounce strnpcinfo(4),"The "+.@str$+" Fortress Gate has been reconstructed!",bc_map,"0x00ff00"; if (.@num == 1) setd .@var$+"[2]",0; else { setarray getd(.@var$+"["+.@num+"]"),2,0; donpcevent "Control Device0"+(.@num-1)+"#"+strnpcinfo(2)+"::OnEnable"; } end; } else { mes "^3355FFThe wall has been breached,"; mes "and the attempt to repair the"; mes "Fortress Gate has failed."; mes "You lost some of your"; mes "repair resources...^000000"; delitem 984,2; //Oridecon delitem 999,4; //Steel delitem 1019,14; //Wooden_Block delitem 1011,3; //Emveretarcon close; } } } else { mes "^3355FFYou can't attempt to repair"; mes "the Fortress Gate if you don't"; mes "have all the needed materials.^000000"; close; } } } } end; OnInit: OnDisable: disablenpc(); end; OnEnable: enablenpc(); end; } // Guardian Summoners (2) //============================================================ - script gard#template -1,{ OnEnable: // .@x[i],.@y[i]: Normal coordinates, #0-21. // .@w[x],.@w[y]: Special coordinates if 'defence' is under 11. if (compare(strnpcinfo(2),"arug")) { if (strnpcinfo(2) == "arug_cas01") { setarray .@w[0],195,250,292,188; setarray .@x[0],233,252,232,201,224,196,269,252,201,224,222, 294,256,240,246,235,235,246,240,256,254,242; setarray .@y[0], 83, 81,108,130,168,137, 89, 81,130,168,129, 210,203,133, 92,132,132, 92,133,203, 95,151; } else if (strnpcinfo(2) == "arug_cas02") { setarray .@w[0],20,169,268,169; setarray .@x[0],104,67,67,113,122,67, 90, 91,122, 20,67, 175,204,211,209,161,186,183,150,161,209,211; setarray .@y[0], 32,36,85, 87,112,60,167,119,112,169,85, 31, 32, 63, 88, 91,170,121,110, 91, 88, 63; } else { // Castles 3,4,5 are identical. setarray .@w[0],66,157,211,159; setarray .@x[0],130,128,128,128,110,91,65, 65,110,128,128, 156,172,154,156,155,187,212,211,155,156,172; setarray .@y[0], 60, 77, 90,100, 96,53,71,103, 96,100, 77, 101, 95, 90, 77, 60, 54, 67,105, 60, 77, 95; } } else { if (strnpcinfo(2) == "schg_cas02") { setarray .@w[0],337,95,307,222; setarray .@x[0],326,337,334,296,285,236,285,296,334,337,334, 359,300,337,317,307,300,337,317,307,359,236; setarray .@y[0], 83, 95,119, 82, 40, 41, 40, 82,119, 95,119, 85,119,154,183,222,119,154,183,222, 85, 41; } else if (strnpcinfo(2) == "schg_cas03") { setarray .@w[0],306,325,364,305; setarray .@x[0],323,273,288,306,323,323,273,288,306,273,273, 338,364,365,317,338,338,364,365,317,364,329; setarray .@y[0],308,309,306,326,308,308,309,306,325,309,309, 309,305,261,318,310,309,305,261,318,305,314; } else { // Castles 1,4,5 are identical. setarray .@w[0],108,32,128,42,187,15; // Contains an extra pair, for whatever reason. setarray .@x[0],111,109,65,110,88,64,47,109,111,112,120, 130,129,151,187,128,152,187,128,130,130,151; setarray .@y[0], 18, 44,22, 40,20,40,43, 48, 18, 32, 37, 22, 47, 18, 15, 42, 43, 15, 42, 22, 28, 18; } } if (charat(strnpcinfo(1),4) == "2") set .@z,11; freeloop(1); set .@defence,getcastledata(strnpcinfo(2),CD_CURRENT_DEFENSE); callsub OnSummon,.@z; if (.@defence > 70) set getd(".MyMobCount_"+charat(strnpcinfo(1),4)+strnpcinfo(2)),5; else if (.@defence > 50) set getd(".MyMobCount_"+charat(strnpcinfo(1),4)+strnpcinfo(2)),4; else if (.@defence > 30) set getd(".MyMobCount_"+charat(strnpcinfo(1),4)+strnpcinfo(2)),3; else if (.@defence > 10) set getd(".MyMobCount_"+charat(strnpcinfo(1),4)+strnpcinfo(2)),2; if (.@w[4] && .@z) guardian strnpcinfo(2),.@w[4],.@w[5],"Guardian Soldier",1899,strnpcinfo(0)+"::OnGuardianDied"; else if (.@defence < 11) { set getd(".MyMobCount_"+charat(strnpcinfo(1),4)+strnpcinfo(2)),2; set .@i,(.@z)?2:0; guardian strnpcinfo(2),.@w[.@i],.@w[.@i+1],"Guardian Soldier",1899,strnpcinfo(0)+"::OnGuardianDied"; } else for(set .@i,1; .@i