//===== rAthena Script ======================================= //= War of Emperium TE - Template File //===== Description: ========================================= //= [Official Conversion] //= Like agit_main, this file is required //= for TE castles to function. //= - Enables AGIT Manager. //= - Enables Stewards to invest. //= - Enables Kafra Services inside Guild. //= - Treasure Chest spawning. //= - Flag Template. //= - GM NPC. //===== Changelogs: ========================================== //= 1.0 First Version. [Capuche] //============================================================ - script Manager_TE -1,{ OnAgitInit3: .@map$ = strnpcinfo(4); if (.@map$ == "") end; .@guild_id = getcastledata(.@map$,1); if (.@guild_id == 0) { killmonsterall .@map$; donpcevent strnpcinfo(0)+"::OnEmpSpawn"; if (compare(.@map$,"te_aldecas")) { monster .@map$,0,0,"Evil Druid",1117,10; monster .@map$,0,0,"Khalitzburg",1132,4; monster .@map$,0,0,"Abysmal Knight",1219,2; monster .@map$,0,0,"Executioner",1205,1; monster .@map$,0,0,"Penomena",1216,10; monster .@map$,0,0,"Alarm",1193,18; monster .@map$,0,0,"Clock",1269,9; monster .@map$,0,0,"Raydric Archer",1276,7; monster .@map$,0,0,"Wanderer",1208,3; monster .@map$,0,0,"Alice",1275,1; monster .@map$,0,0,"Bloody Knight",1268,1; monster .@map$,0,0,"Dark Lord",1272,1; if (.@map$ == "te_aldecas1") { setarray .@emproom[0],216,23; } else if (.@map$ == "te_aldecas2") { setarray .@emproom[0],213,23; } else if (.@map$ == "te_aldecas3") { setarray .@emproom[0],205,31; } else if (.@map$ == "te_aldecas4") { setarray .@emproom[0],36,217; } else if (.@map$ == "te_aldecas5") { setarray .@emproom[0],27,101; } monster .@map$,.@emproom[0],.@emproom[1],"Dark Lord",1272,1; monster .@map$,.@emproom[0],.@emproom[1],"Tower Keeper",1270,4; monster .@map$,.@emproom[0],.@emproom[1],"Bloody Knight",1268,1; monster .@map$,.@emproom[0],.@emproom[1],"Abysmal Knight",1219,1; monster .@map$,.@emproom[0],.@emproom[1],"Raydric Archer",1276,5; } else if (compare(.@map$,"te_prtcas")) { monster .@map$,0,0,"Raydric",1163,10; monster .@map$,0,0,"Khalitzburg",1132,10; monster .@map$,0,0,"Abysmal Knight",1219,5; monster .@map$,0,0,"Bloody Knight",1268,5; monster .@map$,0,0,"Stormy Knight",1251,1; monster .@map$,0,0,"Hatii",1252,1; monster .@map$,0,0,"Raydric Archer",1276,5; monster .@map$,0,0,"Gryphon",1259,2; monster .@map$,0,0,"Chimera",1283,2; monster .@map$,0,0,"Alice",1275,1; monster .@map$,0,0,"Zealotus",1200,1; if (.@map$ == "te_prtcas01") { setarray .@emproom[0],197,197; } else if (.@map$ == "te_prtcas02") { setarray .@emproom[0],157,174; } else if (.@map$ == "te_prtcas03") { setarray .@emproom[0],16,220; } else if (.@map$ == "te_prtcas04") { setarray .@emproom[0],291,14; } else if (.@map$ == "te_prtcas05") { setarray .@emproom[0],266,266; } monster .@map$,.@emproom[0],.@emproom[1],"Guardian Knight of Emperium",1268,1; monster .@map$,.@emproom[0],.@emproom[1],"Chief Guardian Knight of Emperium",1251,1; monster .@map$,.@emproom[0],.@emproom[1],"Hatii",1252,1; monster .@map$,.@emproom[0],.@emproom[1],"Guardian Knight of Emperium",1219,2; monster .@map$,.@emproom[0],.@emproom[1],"Raydric Archer",1276,5; } disablenpc "Kafra Staff#"+ .@map$; } else { requestguildinfo .@guild_id; donpcevent "::OnFlagTE" + strnpcinfo(2);// Guild emblem on flags. if (getcastledata(.@map$,9) == 0) disablenpc "Kafra Staff#"+ .@map$; // Load purchased Guardian in castles. if (.@map$ == "te_aldecas1") donpcevent "Clode::OnSpawnGuardians"; else if (.@map$ == "te_aldecas2") donpcevent "Lares::OnSpawnGuardians"; else if (.@map$ == "te_aldecas3") donpcevent "Valerian::OnSpawnGuardians"; else if (.@map$ == "te_aldecas4") donpcevent "Alpores::OnSpawnGuardians"; else if (.@map$ == "te_aldecas5") donpcevent "Anpere::OnSpawnGuardians"; else if (.@map$ == "te_prtcas01") donpcevent "Kurbe::OnSpawnGuardians"; else if (.@map$ == "te_prtcas02") donpcevent "Kamiyu::OnSpawnGuardians"; else if (.@map$ == "te_prtcas03") donpcevent "Eduare::OnSpawnGuardians"; else if (.@map$ == "te_prtcas04") donpcevent "Casate::OnSpawnGuardians"; else if (.@map$ == "te_prtcas05") donpcevent "Pisaro::OnSpawnGuardians"; } end; OnEmpSpawn: .@map$ = strnpcinfo(4); if (!mobcount( .@map$, strnpcinfo(0) +"::OnAgitBreak" )) { if (.@map$ == "te_aldecas1") { setarray .@emproom[0],216,23; } else if (.@map$ == "te_aldecas2") { setarray .@emproom[0],213,23; } else if (.@map$ == "te_aldecas3") { setarray .@emproom[0],205,31; } else if (.@map$ == "te_aldecas4") { setarray .@emproom[0],36,217; } else if (.@map$ == "te_aldecas5") { setarray .@emproom[0],27,101; } else if (.@map$ == "te_prtcas01") { setarray .@emproom[0],197,197; } else if (.@map$ == "te_prtcas02") { setarray .@emproom[0],157,174; } else if (.@map$ == "te_prtcas03") { setarray .@emproom[0],16,220; } else if (.@map$ == "te_prtcas04") { setarray .@emproom[0],291,14; } else if (.@map$ == "te_prtcas05") { setarray .@emproom[0],266,266; } monster .@map$,.@emproom[0],.@emproom[1],"Emperium",1288,1, strnpcinfo(0) +"::OnAgitBreak"; } end; OnAgitStart3: .@map$ = strnpcinfo(4); if (.@map$ == "") end; if (agitcheck3()) { maprespawnguildid .@map$, getcastledata(.@map$,1),6;// warp all non-guild members and remove monsters (like woe fe) gvgon3 .@map$; donpcevent strnpcinfo(0)+"::OnEmpSpawn"; callsub S_Message,"OnCommandOn"; } end; OnAgitEnd3: .@map$ = strnpcinfo(4); if (.@map$ == "") end; gvgoff3 .@map$; if (getcastledata(.@map$,1)) killmonster .@map$, strnpcinfo(0) +"::OnAgitBreak"; callsub S_Message,"OnReset"; end; OnAgitBreak: .@guild_id = getcharid(2); .@map$ = strnpcinfo(4); .@economy = getcastledata(.@map$,2) - 5;// Adjust economy Invest Level for Castle if (.@economy < 0) setcastledata .@map$, 2,0; else setcastledata .@map$, 2,.@economy; .@defense = getcastledata(.@map$,3) - 5;// Adjust Defense Invest Level for Castle if (.@defense < 0) setcastledata .@map$, 3,0; else setcastledata .@map$, 3,.@defense; setcastledata .@map$,1,.@guild_id; // Reset Invest information and refresh castle data for ( .@i = 4; .@i <= 9; .@i++ ) setcastledata .@map$,.@i,0; donpcevent strnpcinfo(0) +"::OnAgitInit3"; // Erase Guardian Database information if the new owners do not have Guardian Research. if (getgdskilllv(.@guild_id,10002) == 0) { for ( .@i = 10; .@i <= 17; .@i++ ) setcastledata .@map$,.@i,0; } mapannounce .@map$,"Emperium has been destroyed.",bc_map,"0x00FF00",FW_BOLD,20,0,40; maprespawnguildid .@map$,.@guild_id,6;// Respawn all but new castle-occupants. sleep 500; if (agitcheck3()) donpcevent strnpcinfo(0) +"::OnEmpSpawn"; sleep 7000; announce strnpcinfo(2) +" in the fortress of [" + getcastlename(.@map$) + "] is occupied by [" + getguildname(.@guild_id) + "] guild.", bc_all,"0xFF0000",FW_NORMAL,10; end; OnGuildBreak: .@map$ = strnpcinfo(4); if (.@map$ == "") end; killmonster .@map$, "Kafra Staff#"+ strnpcinfo(4) +"::OnGuardianDied"; disablenpc "Kafra Staff#"+ .@map$; setcastledata .@map$,1,0; sleep 7000; announce "Guild Base [" + getcastlename(.@map$) + "] has been abandoned.",bc_all; donpcevent strnpcinfo(0) +"::OnAgitInit3"; end; S_Message: .@map$ = strnpcinfo(4); .@guild_id = getcastledata(.@map$,1); if (.@guild_id) announce strnpcinfo(2) +" in the fortress of [" + getcastlename(.@map$) + "] is occupied by [" + getguildname(.@guild_id) + "] guild.", bc_all,"0xFF0000",FW_NORMAL,10; else announce "The [" + getcastlename(.@map$) + "] castle is currently unoccupied.", bc_all,"0xFF0000",FW_NORMAL,10; if (compare( .@map$,"te_alde" )) .@string$ = "alde0"+ charat( .@map$,getstrlen(.@map$)-1 ); else .@string$ = "prt0"+ charat( .@map$,getstrlen(.@map$)-1 ); donpcevent "#popswitch_"+ .@string$ +"::"+ getarg(0);// monsters for mission TE if (.@map$ == "te_aldecas1") { donpcevent "Blacksmith Cano#tegod01::OnInit";// god item TE $@2012_tegod_kafra = 0; $@2012_tegirls_alde01 = 0; } else if (.@map$ == "te_prtcas01") { $@2012_tegod_gloria = 0; $@2012_tegirls_prt01 = 0; donpcevent "Blacksmith Kai#tegod01::OnInit"; } return; } // Guild Kafras //============================================================ - script Kafra_Staff_TE -1,{ .@guild_id = getcastledata( strnpcinfo(4),1 ); .@guildname$ = getguildname(.@guild_id); cutin "kafra_01",2; mes "[Kafra Staff]"; if (.@guild_id == getcharid(2)) { mes "Welcome, members of ^ff0000" + .@guildname$ + "^000000."; mes "Kafra Service Inc. is always on your side."; next; switch( select( "Use storage service", "Use warp service", "Use cart service", "Close it" ) ) { case 1: if (getskilllv("NV_BASIC") > 5) openstorage; else { mes "[Kafra Staff]"; mes "To use the storage service, your beginner skill level must be higher than 6."; close2; } break; case 2: if (compare( strnpcinfo(4),"alde" ) == 1) callsub( S_Warp, "Aldebaran", "aldebaran",132,103 ); else callsub( S_Warp, "Prontera", "prontera",278,211 ); case 3: mes "[Kafra Staff]"; if (BaseClass != Job_Merchant) { mes "We're sorry."; mes "Cart service is an exclusive service for merchants, blacksmiths, and alchemists only."; close2; } else if (checkcart()) { mes "You have a cart installed to you currently."; close2; } else { mes "We charge 800 Zeny for the cart service. Would you like to use it?"; next; if (select( "Yes","No" ) == 1) { if (Zeny < 800) { mes "[Kafra Staff]"; mes "You don't have enough money to purchase this service. You need 800 Zeny in order to use the cart service."; close2; } else { RESRVPTS = RESRVPTS + 80; Zeny = Zeny - 800; setcart(); } } } break; case 4: mes "[Kafra Staff]"; mes "At Kafra Service Inc., we do our utmost to provide the best and satisfy our customers by managing the quality of our services strictly."; mes "Thanks for choosing Kafra Service Inc."; close2; break; } } else { mes "I made a contract to work for members of ^ff0000" + .@guildname$ + "^000000 only. Please consult one of our Kafra personnel in different locations. We're sorry for the inconvenience."; close2; } cutin "",255; end; S_Warp: mes "[Kafra Staff]"; mes "Tell me your destination."; next; switch( select( getarg(0) + " -> 200 z", "Cancel it" ) ) { case 1: if (Zeny < 200) { mes "[Kafra Staff]"; mes "Member -. You don't have enough money to purchase the service. Please check your account again."; close2; cutin "",255; end; } Zeny = Zeny - 200; RESRVPTS = RESRVPTS + 20; warp getarg(1), getarg(2),getarg(3); end; case 2: cutin "",255; end; } OnGuardianDied: end; } // Castle Managers (Invest) //============================================================ - script invest_TE -1,{ function GuardianData; .@map$ = strnpcinfo(4); .@npc_name$ = "[ Butler "+ strnpcinfo(1) +"]"; .@guild_id = getcastledata(.@map$,1); .@guildmaster$ = getguildmaster(.@guild_id); mes .@npc_name$; if (.@guild_id == 0) { mes "I'm waiting for someone who are meant to be my master."; mes "Oh, you courageous one... tempt your fate."; close; } if (strcharinfo(0) != .@guildmaster$) { mes "No matter how much you threaten me, I shall follow my master ^ff0000" + .@guildmaster$ + "^000000 only! Where are the guardians! Kick out these scondrels immediately!"; close; } mes "Welcome. ^ff0000" + .@guildmaster$ + "^000000, my master..."; mes "You may command my services. I shall carry out my duties faithfully."; next; switch( select( "Check current status of the fortress", "Invest in commercial development level", "Invest in defense level", "Deploy guardians", "Employ / Dismiss a warehouseman", "Enter master's room" ) ) { case 1: .@economy_today = getcastledata(.@map$,4); .@defense_today = getcastledata(.@map$,5); mes .@npc_name$; mes "Let me give you a report on the current status of the fortress."; mes ""; mes "^0000ffThe current commercial level is " + getcastledata(.@map$,2) + "~."; if (.@economy_today > 0) mes "You have invested ~ " + .@economy_today + " times within the past 1 day."; mes "The current defense level is " + getcastledata(.@map$,3) + "~.^000000"; if (.@defense_today > 0) mes "^0000ff- Within the past 1 day, you have invested ~ " + .@defense_today + " times.^000000"; mes ""; mes "That's about it."; close; case 2: .@economy = getcastledata(.@map$,2); setarray .@eco_invest[0], 5,5000, 10,10000, 15,20000, 20,35000, 25,55000, 30,80000, 35,110000, 40,145000, 45,185000, 50,230000, 55,280000, 60,335000, 65,395000, 70,460000, 75,530000, 80,605000, 85,685000, 90,770000, 95,860000, 100,955000; for ( .@i = 0; .@i < getarraysize(.@eco_invest); .@i += 2 ) if (.@economy <= .@eco_invest[.@i]) break; callsub( S_Invest, 4, .@eco_invest[.@i+1], getcastledata(.@map$,4), "commercial development", "number of items produced within the guild increases" ); case 3: .@defense = getcastledata(.@map$,3); setarray .@def_invest[0], 5,10000, 10,20000, 15,40000, 20,70000, 25,110000, 30,160000, 35,220000, 40,290000, 45,370000, 50,460000, 55,560000, 60,670000, 65,790000, 70,920000, 75,1060000, 80,1210000, 85,1370000, 90,1540000, 95,1720000, 100,1910000; for ( .@i = 0; .@i < getarraysize(.@def_invest); .@i += 2 ) if (.@defense <= .@def_invest[.@i]) break; callsub( S_Invest, 5, .@def_invest[.@i+1], getcastledata(.@map$,5), "defense", "durability of guardian and Emperiums increase" ); case 4: mes .@npc_name$; mes "Do you want to install a guardian? A guardian will be protecting our fortress ceaselessly."; mes "Select a guardian that you wish to install."; next; GuardianData( .@mob_id, .@x, .@y, .@name$ ); for ( .@i = 0; .@i < MAX_GUARDIANS ; .@i++ ) { if (guardianinfo(.@map$,.@i,0)) .@menu$ = .@menu$ + getmonsterinfo(.@mob_id[.@i],MOB_NAME) + " - Implemented (" + guardianinfo(.@map$,.@i,2) + "/" + guardianinfo(.@map$,.@i,1) + "):";// hp/hpmax else .@menu$ = .@menu$ + getmonsterinfo(.@mob_id[.@i],MOB_NAME) + " - Not Implemented:"; } .@s = select(.@menu$) -1; mes .@npc_name$; mes "Are you sure you want to install the selected guardian? You need 10000 Zeny to proceed."; next; if (select( "Install it.","Forget it." ) == 2) { mes .@npc_name$; mes "I did just as you said. However, make sure to install a guardian in the future when you can afford it."; close; } mes .@npc_name$; if (getgdskilllv(.@guild_id,10002) == 0) { mes "Master, you do not have any research knowledge required for installation of a guardian. In order to accumulate knowledge about installation of a guardian, you need to master ^ff0000Guardian Manufacturing Studies^000000 among other guild skills."; mes "You have failed to install a guardian."; } else if (getcastledata( .@map$,(.@s+10) ) == 1) mes "Master... you have installed that guardian already. You may not proceed with the installation."; else if (Zeny < 10000) mes "You don't have enough resources required for installation of a guardian. Unfortunately... you have failed to install a guardian."; else { Zeny = Zeny - 10000; setcastledata .@map$,(.@s+10),1; guardian .@map$, .@x[.@s], .@y[.@s], .@name$[.@s], .@mob_id[.@s], "Kafra Staff#"+ strnpcinfo(4) +"::OnGuardianDied", .@s; mes "A guardian has been installed successfully. We have a reliable ally that protects our fortress now."; } close; case 5: mes .@npc_name$; if (getcastledata(.@map$,9) == 1) { mes "Currently, a Kafra staff is employed... Do you want to fire a Kafra staff?"; next; if (select( "Dismiss him.","Forget it." ) == 2) { mes .@npc_name$; mes "I think that Kafra staff is working really hard. I thought it'd be nice to just keep him thinking about other members."; close; } cutin "kafra_01",2; mes "[ Hired Kafra Staff ]"; mes "I've been working so hard... but why are you firing me? Please, Master... show me your generosity and please reconsider it, please."; next; if (select( "Dismiss him.","Forget it." ) == 2) { mes "[ Hired Kafra Staff ]"; mes "I'll do my best... thank you so much."; close; } mes "[ Hired Kafra Staff ]"; mes "Aahhhh! It's not fair~!"; next; cutin "",255; disablenpc "Kafra Staff#" + .@map$; setcastledata .@map$,9,0; mes .@npc_name$; mes "... ."; mes "A Kafra staff has been fired... Was there something you didn't like about him?"; close; } mes "Do you want to make a contract with Kafra's headquarter and hire a staff in the fortress?"; mes "^ff0000You need 10000 Zeny for that though..."; next; if (select( "Hire a staff.","Forget it." ) == 2) { mes .@npc_name$; mes "Your wish is my command. But we should hire a Kafra staff sooner of later for the sake of other members."; close; } mes .@npc_name$; if (getgdskilllv(.@guild_id,10001) == 0) { mes "Master, you are unable to hire a Kafra staff since you didn't make a contract with Kafra's headquarter yet. In order to make a contract with Kafra's headquarter, you need to master ^ff0000 Contract with Kafra^000000 skill among other guild skills."; close; } if (Zeny < 10000) { mes "Unfortunately... you do not have enough money in your account. You have failed to hire a Kafra staff."; close; } Zeny = Zeny - 10000; enablenpc "Kafra Staff#" + .@map$; setcastledata .@map$,9,1; mes "You have made a contract with Kafra's headquarter successfully. You have hired a Kafra staff."; next; cutin "kafra_01",2; mes "[ Hired Kafra Staff ]"; mes "Nice to meet you. I'm Kafra dispatched from the headquarter."; mes "I'll do my best to live up to the guild's reputation."; next; cutin "",255; mes .@npc_name$; mes "The contract period for a Kafra staff will be one month, and after that, you pay extra fees."; mes "From now on, it's going to be much easier for the members."; close; case 6: mes .@npc_name$; mes "Do you want to go to the room where our precious items are stored?"; mes "It's a place only for you, our master... no one, other than you, is allowed to enter."; next; mes .@npc_name$; mes "If you don't open the treasure box within time limits, there is a possibility of losing it when unexpected situation occurs."; mes "Please make sure to remember that always, Master."; mes "So, for our guild's improvement, you must find time to collect it."; next; switch( select( "Enter master's room","Do not enter." ) ) { case 1: mes .@npc_name$; mes "I will take you to the secret path that leads to the room. Follow me, please."; mes "When you wish to return, press a secret button."; close2; if (.@map$ == "te_aldecas1") warp "te_aldecas1",113,223; else if (.@map$ == "te_aldecas2") warp "te_aldecas2",134,225; else if (.@map$ == "te_aldecas3") warp "te_aldecas3",229,267; else if (.@map$ == "te_aldecas4") warp "te_aldecas4",83,17; else if (.@map$ == "te_aldecas5") warp "te_aldecas5",64,8; else if (.@map$ == "te_prtcas01") warp "te_prtcas01",15,209; else if (.@map$ == "te_prtcas02") warp "te_prtcas02",207,229; else if (.@map$ == "te_prtcas03") warp "te_prtcas03",190,130; else if (.@map$ == "te_prtcas04") warp "te_prtcas04",275,160; else if (.@map$ == "te_prtcas05") warp "te_prtcas05",281,176; end; case 2: mes .@npc_name$; mes "Items are produced once a day... but if you don't collect them in time, they don't come in anymore."; mes "So, for our guild's improvement, you must find time to collect them."; close; } } S_Invest: .@cost_invest = getarg(1); .@num_invest_today = getarg(2); .@npc_name$ = "[ Butler "+ strnpcinfo(1) +"]"; if (.@num_invest_today)// Quadruple the cost of investing if you've already invested once. .@cost_invest = .@cost_invest * 4; mes .@npc_name$; mes "If you raise "+ getarg(3) +" level, the "+ getarg(4) +". So, if you think about the future, you have to invest in it."; mes ""; mes "Originally, you are allowed to invest once a day. However, if you pay extra, you can also invest in it twice a day."; mes ""; if (getcastledata(strnpcinfo(4),2) >= 100) { mes "^ff0000But the current level is already 100%, which is as high as it can get, and you don't need to invest in it anymore. Surely, you have a great insight.^000000"; close; } if (.@num_invest_today >= 2) { mes "^ff0000But since you have already invested twice, you are not allowed to make any additional investment today. ^000000I can't wait until we become wealthy with increased level of commercial development."; close; } if (.@num_invest_today == 0) mes "The amount of investment required is ^ff0000" + .@cost_invest + "^000000 Zeny. Would you like to invest?"; else mes "You've already invested once. Do you want to invest again? ^ff0000" + .@cost_invest + "^000000 Zeny is needed additionally."; next; switch( select( "Invest in commercial development level","Forget it." ) ) { case 1: mes .@npc_name$; if (Zeny < .@cost_invest) { mes "Master, unfortunately, we do not have enough Zeny in our account. We failed to make an investment."; close; } Zeny = Zeny - .@cost_invest; setcastledata strnpcinfo(4), getarg(0), (.@num_invest_today +1); mes "We have made an investment successfully! I'm looking forward to our future. The level of our commercial development will be increased by tomorrow."; close; case 2: mes .@npc_name$; mes "Your wish is my command, my master... There is no need to rush. We will do just fine."; close; } function GuardianData { .@map$ = strnpcinfo(4); if (.@map$ == "te_aldecas1") { setarray .@data$[0], 1287, 17, 218, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN 1285, 39, 205, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN 1285, 38, 196, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN 1286, 21, 194, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1286, 218, 24, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1286, 213, 24, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1286, 73, 70, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1285, 45, 228, "Outer Castle Archer Guardian";// ARCHER_GUARDIAN } else if (.@map$ == "te_aldecas2") { setarray .@data$[0], 1287, 51, 183, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN 1286, 27, 184, "Outer Castle Knight Guardian",// KNIGHT_GUARDIAN 1286, 88, 43, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1285, 210, 7, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN 1287, 60, 203, "Outer Castle Soldier Guardian",// SOLDIER_GUARDIAN 1285, 21, 177, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN 1286, 117, 46, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1285, 36, 183, "Outer Castle Archer Guardian";// ARCHER_GUARDIAN } else if (.@map$ == "te_aldecas3") { setarray .@data$[0], 1285, 110, 217, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN 1286, 90, 112, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1287, 86, 120, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN 1285, 195, 151, "Inner Castle Archer Guardian",// ARCHER_GUARDIAN 1286, 116, 112, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1287, 116, 76, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN 1287, 64, 103, "Outer Castle Soldier Guardian",// SOLDIER_GUARDIAN 1285, 212, 160, "Inner Castle Archer Guardian";// ARCHER_GUARDIAN } else if (.@map$ == "te_aldecas4") { setarray .@data$[0], 1285, 187, 100, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN 1285, 192, 42, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN 1286, 55, 88, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1287, 145, 209, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN 1287, 169, 53, "Outer Castle Soldier Guardian",// SOLDIER_GUARDIAN 1287, 198, 77, "Outer Castle Soldier Guardian",// SOLDIER_GUARDIAN 1285, 148, 88, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN 1286, 48, 72, "Inner Castle Knight Guardian";// KNIGHT_GUARDIAN } else if (.@map$ == "te_aldecas5") { setarray .@data$[0], 1285, 51, 202, "Inner Castle Archer Guardian",// ARCHER_GUARDIAN 1286, 27, 221, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1286, 145, 78, "Outer Castle Knight Guardian",// KNIGHT_GUARDIAN 1287, 157, 192, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN 1287, 157, 74, "Outer Castle Soldier Guardian",// SOLDIER_GUARDIAN 1285, 188, 79, "Inner Castle Archer Guardian",// ARCHER_GUARDIAN 1286, 156, 73, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1286, 41, 112, "Inner Castle Knight Guardian";// KNIGHT_GUARDIAN } else if (.@map$ == "te_prtcas01") { setarray .@data$[0], 1287, 182, 68, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN 1287, 182, 116, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN 1287, 153, 86, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN 1285, 59, 28, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN 1285, 50, 36, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN 1286, 184, 183, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1286, 196, 189, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1286, 107, 179, "Inner Castle Knight Guardian";// KNIGHT_GUARDIAN } else if (.@map$ == "te_prtcas02") { setarray .@data$[0], 1286, 162, 161, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1286, 153, 161, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1286, 178, 44, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1287, 71, 75, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN 1287, 49, 28, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN 1285, 64, 186, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN 1285, 76, 196, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN 1285, 75, 175, "Outer Castle Archer Guardian";// ARCHER_GUARDIAN } else if (.@map$ == "te_prtcas03") { setarray .@data$[0], 1286, 191, 190, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1286, 137, 190, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1286, 45, 99, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1287, 50, 87, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN 1287, 41, 87, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN 1285, 191, 42, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN 1285, 179, 43, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN 1285, 191, 72, "Outer Castle Archer Guardian";// ARCHER_GUARDIAN } else if (.@map$ == "te_prtcas04") { setarray .@data$[0], 1286, 276, 14, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1286, 274, 35, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1286, 246, 246, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1287, 38, 240, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN 1287, 29, 240, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN 1287, 33, 258, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN 1285, 78, 48, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN 1285, 36, 61, "Outer Castle Archer Guardian";// ARCHER_GUARDIAN } else if (.@map$ == "te_prtcas05") { setarray .@data$[0], 1286, 266, 262, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1286, 287, 280, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1286, 245, 250, "Inner Castle Knight Guardian",// KNIGHT_GUARDIAN 1287, 236, 63, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN 1287, 251, 63, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN 1287, 278, 71, "Inner Castle Soldier Guardian",// SOLDIER_GUARDIAN 1285, 32, 253, "Outer Castle Archer Guardian",// ARCHER_GUARDIAN 1285, 44, 248, "Outer Castle Archer Guardian";// ARCHER_GUARDIAN } for ( .@i = 0; .@i < getarraysize(.@data$); .@i += 4 ) { set getelementofarray( getarg(0),.@index ), .@data$[.@i]; set getelementofarray( getarg(1),.@index ), .@data$[.@i+1]; set getelementofarray( getarg(2),.@index ), .@data$[.@i+2]; set getelementofarray( getarg(3),.@index ), .@data$[.@i+3]; .@index++; } } OnSpawnGuardians: GuardianData( .@mob_id, .@x, .@y, .@name$ ); .@map$ = strnpcinfo(4); killmonster .@map$, "Kafra Staff#"+ strnpcinfo(4) +"::OnGuardianDied"; for ( .@i = 0; .@i < MAX_GUARDIANS; .@i++ ) { if (getcastledata( .@map$,(.@i+10) )) guardian .@map$, .@x[.@i], .@y[.@i], .@name$[.@i], .@mob_id[.@i], "Kafra Staff#"+ strnpcinfo(4) +"::OnGuardianDied",.@i; } } // Guild Dungeon Entrances //============================================================ - script lever2_TE -1,{ .@guild_id = getcastledata( strnpcinfo(4),1 ); if (.@guild_id == 0) { mes "[ A penetrative voice ]"; mes "You, who overcame hardships and became the master of courage, shall find another path of trials... '"; close; } mes "[ A penetrative voice ]"; mes "Only the master of courage shall be put to the test.'"; next; mes " "; mes "There is a small lever. Do you want to pull it?"; next; if (select( "Pull it.","Do not pull it." ) == 1) { if (.@guild_id == getcharid(2)) { .@npc_map$ = strnpcinfo(4); if (compare( .@npc_map$,"te_alde" )) { .@map$ = "teg_dun02"; if (.@npc_map$ == "te_aldecas1") setarray .@coord[0],32,122; else if (.@npc_map$ == "te_aldecas2") setarray .@coord[0],79,30; else if (.@npc_map$ == "te_aldecas3") setarray .@coord[0],165,38; else if (.@npc_map$ == "te_aldecas4") setarray .@coord[0],160,148; else if (.@npc_map$ == "te_aldecas5") setarray .@coord[0],103,169; } else { .@map$ = "teg_dun01"; if (.@npc_map$ == "te_prtcas01") setarray .@coord[0],28,251; else if (.@npc_map$ == "te_prtcas02") setarray .@coord[0],164,268; else if (.@npc_map$ == "te_prtcas03") setarray .@coord[0],164,179; else if (.@npc_map$ == "te_prtcas04") setarray .@coord[0],268,203; else if (.@npc_map$ == "te_prtcas05") setarray .@coord[0],199,28; } warp .@map$,.@coord[0],.@coord[1]; } else { mes " "; mes "Nothing happened."; close; } } end; } // Treasure Room Exit //============================================================ - script lever1_TE -1,{ mes " "; mes "There is a small lever. Do you want to pull it?"; next; if ( select( "Pull it.","Do not pull it." ) == 1 ) { .@map$ = strnpcinfo(4); if (.@map$ == "te_aldecas1") setarray .@coord[0],218,176; else if (.@map$ == "te_aldecas2") setarray .@coord[0],51,179; else if (.@map$ == "te_aldecas3") setarray .@coord[0],110,119; else if (.@map$ == "te_aldecas4") setarray .@coord[0],67,117; else if (.@map$ == "te_aldecas5") setarray .@coord[0],51,179; else if (.@map$ == "te_prtcas01") setarray .@coord[0],112,183; else if (.@map$ == "te_prtcas02") setarray .@coord[0],94,62; else if (.@map$ == "te_prtcas03") setarray .@coord[0],51,101; else if (.@map$ == "te_prtcas04") setarray .@coord[0],259,265; else if (.@map$ == "te_prtcas05") setarray .@coord[0],36,38; warp .@map$,.@coord[0],.@coord[1]; } end; } // Treasure Room Spawn Template //============================================================ - script treasure_TE -1,{ OnClock0001:// Spawn Treasure Chests based on castle economy. .@map$ = strnpcinfo(4); if (.@map$ == "") end; .@guild_id = getcastledata(.@map$,1); if (.@guild_id == 0) end; .@economy = getcastledata(.@map$,2); .@defense = getcastledata(.@map$,3); .@economy_today = getcastledata(.@map$,4); .@defense_today = getcastledata(.@map$,5); killmonster .@map$, strnpcinfo(0)+"::OnTreasureDied"; if (.@economy_today) { .@economy = .@economy + .@economy_today + (rand(2) && getgdskilllv(.@guild_id,10014)); .@economy = ( .@economy > 100 ) ? 100 : .@economy; setcastledata .@map$,2,.@economy; setcastledata .@map$,4,0; } if (.@defense_today) { .@defense = .@defense + .@defense_today; .@defense = ( .@defense > 100 ) ? 100 : .@defense; setcastledata .@map$,3,.@defense; setcastledata .@map$,5,0; } if (.@map$ == "te_aldecas1") { setarray .@data[0],// , , 2452, 115,226,// TREASURE_BOX_TE 2458, 122,226,// TREASURE_BOX_TE_6 2452, 115,219, 2458, 122,219, 2452, 116,225, 2458, 117,225, 2452, 118,225, 2458, 119,225, 2452, 120,225, 2458, 121,225, 2452, 121,224, 2458, 121,223, 2452, 121,222, 2458, 121,221, 2452, 121,220, 2458, 120,220, 2452, 119,220, 2458, 118,220, 2452, 117,220, 2458, 116,220, 2452, 116,221, 2458, 116,222, 2452, 116,223, 2458, 116,224; } else if (.@map$ == "te_aldecas2") { setarray .@data[0], 2452, 134,231,// TREASURE_BOX_TE 2459, 135,231,// TREASURE_BOX_TE_7 2452, 135,230, 2459, 134,230, 2452, 132,233, 2459, 133,233, 2452, 134,233, 2459, 135,233, 2452, 136,233, 2459, 137,233, 2452, 137,232, 2459, 137,231, 2452, 137,230, 2459, 137,229, 2452, 137,228, 2459, 136,228, 2452, 135,228, 2459, 134,228, 2452, 133,228, 2459, 132,228, 2452, 132,229, 2459, 132,230, 2452, 132,231, 2459, 132,232; } else if (.@map$ == "te_aldecas3") { setarray .@data[0], 2452, 224,269,// TREASURE_BOX_TE 2460, 225,269,// TREASURE_BOX_TE_8 2452, 225,268, 2460, 224,268, 2452, 222,271, 2460, 223,271, 2452, 224,271, 2460, 225,271, 2452, 226,271, 2460, 227,271, 2452, 227,270, 2460, 227,269, 2452, 227,268, 2460, 227,267, 2452, 227,266, 2460, 226,266, 2452, 225,266, 2460, 224,266, 2452, 223,266, 2460, 222,266, 2452, 222,267, 2460, 222,268, 2452, 222,269, 2460, 222,270; } else if (.@map$ == "te_aldecas4") { setarray .@data[0], 2452, 84,13,// TREASURE_BOX_TE 2461, 85,13,// TREASURE_BOX_TE_9 2452, 85,12, 2461, 84,12, 2452, 82,15, 2461, 83,15, 2452, 84,15, 2461, 85,15, 2452, 86,15, 2461, 87,15, 2452, 87,14, 2461, 87,13, 2452, 87,12, 2461, 87,11, 2452, 87,10, 2461, 86,10, 2452, 85,10, 2461, 84,10, 2452, 83,10, 2461, 82,10, 2452, 82,11, 2461, 82,12, 2452, 82,13, 2461, 82,14; } else if (.@map$ == "te_aldecas5") { setarray .@data[0], 2452, 62,12,// TREASURE_BOX_TE 2462, 62,11,// TREASURE_BOX_TE_10 2452, 61,11, 2462, 59,14, 2452, 60,14, 2462, 61,14, 2452, 62,14, 2462, 63,14, 2452, 64,14, 2462, 64,13, 2452, 64,12, 2462, 64,11, 2452, 64,10, 2462, 64,9, 2452, 63,9, 2462, 62,9, 2452, 61,9, 2462, 60,9, 2452, 59,9, 2462, 59,10, 2452, 59,11, 2462, 59,12, 2452, 59,13; } else if (.@map$ == "te_prtcas01") { setarray .@data[0], 2452, 8,211,// TREASURE_BOX_TE 2453, 9,211,// TREASURE_BOX_TE_1 2452, 10,211, 2453, 11,211, 2452, 12,211, 2453, 13,211, 2452, 13,209, 2453, 12,209, 2452, 11,209, 2453, 10,209, 2452, 9,209, 2453, 8,209, 2452, 8,207, 2453, 9,207, 2452, 10,207, 2453, 11,207, 2452, 12,207, 2453, 13,207, 2452, 13,206, 2453, 12,206, 2452, 11,206, 2453, 10,206, 2452, 9,206, 2453, 8,206; } else if (.@map$ == "te_prtcas02") { setarray .@data[0], 2452, 201,228,// TREASURE_BOX_TE 2454, 202,228,// TREASURE_BOX_TE_2 2452, 202,227, 2454, 201,227, 2452, 199,230, 2454, 200,230, 2452, 201,230, 2454, 202,230, 2452, 203,230, 2454, 204,230, 2452, 204,229, 2454, 204,228, 2452, 204,227, 2454, 204,226, 2452, 204,225, 2454, 203,225, 2452, 202,225, 2454, 201,225, 2452, 200,225, 2454, 199,225, 2452, 199,226, 2454, 199,227, 2452, 199,228, 2454, 199,229; } else if (.@map$ == "te_prtcas03") { setarray .@data[0], 2452, 187,132,// TREASURE_BOX_TE 2455, 188,132,// TREASURE_BOX_TE_3 2452, 188,131, 2455, 187,131, 2452, 185,134, 2455, 186,134, 2452, 187,134, 2455, 188,134, 2452, 189,134, 2455, 190,134, 2452, 190,133, 2455, 190,132, 2452, 190,131, 2455, 190,130, 2452, 190,129, 2455, 189,129, 2452, 188,129, 2455, 187,129, 2452, 186,129, 2455, 185,129, 2452, 185,130, 2455, 185,131, 2452, 185,132, 2455, 185,133; } else if (.@map$ == "te_prtcas04") { setarray .@data[0], 2452, 269,162,// TREASURE_BOX_TE 2456, 270,162,// TREASURE_BOX_TE_4 2452, 270,161, 2456, 269,161, 2452, 267,164, 2456, 268,164, 2452, 269,164, 2456, 270,164, 2452, 271,164, 2456, 272,164, 2452, 272,163, 2456, 272,162, 2452, 272,161, 2456, 272,160, 2452, 272,159, 2456, 271,159, 2452, 270,159, 2456, 269,159, 2452, 268,159, 2456, 267,159, 2452, 267,160, 2456, 267,161, 2452, 267,162, 2456, 267,163; } else if (.@map$ == "te_prtcas05") { setarray .@data[0], 2452, 275,178,// TREASURE_BOX_TE 2457, 276,178,// TREASURE_BOX_TE_5 2452, 276,177, 2457, 275,177, 2452, 273,180, 2457, 274,180, 2452, 275,180, 2457, 276,180, 2452, 277,180, 2457, 278,180, 2452, 278,179, 2457, 278,178, 2452, 278,177, 2457, 278,176, 2452, 278,175, 2457, 277,175, 2452, 276,175, 2457, 275,175, 2452, 274,175, 2457, 273,175, 2452, 273,176, 2457, 273,177, 2452, 273,178, 2457, 273,179; } .@treasure_num = ( 4 + ( .@economy /5 ) ) *3;// x3 <-> data[] size for ( .@i = 0; .@i < getarraysize(.@data) && .@treasure_num > .@i; .@i += 3 )// nb. [4;24] chests monster .@map$, .@data[.@i+1], .@data[.@i+2],"Treasure Chest", .@data[.@i],1, strnpcinfo(0)+"::OnTreasureDied"; OnTreasureDied: end; } // Flag warp Template //============================================================ function script F_flag_woe_TE { .@guild_id = getcastledata( getarg(1),1 ); if (.@guild_id == 0) { mes "[ Decree of Sacred Kingdom of Rune-Midgarts ]"; mes ""; mes "1. The Treaty of Sacred Kingdom of Rune-Midgarts"; mes "and the Republic of Schwaltzvalt"; mes "hereby declares that this is a fortress"; mes "with no legal ownership."; mes ""; mes "2. However, those who overcome hardships"; mes "and destroy Emperiums"; mes "shall be endowed with the ownership"; mes "of this fortress,"; mes "authorized by the King."; close; } if (.@guild_id == getcharid(2) && getarg(0)) { mes "[ A penetrative voice ]"; mes "Come, all ye brave..."; mes "Do you wish to return with honor?"; next; if (select( "Return to the fortress.","Forget it." ) == 1) { if (canParticipateSiegeTE() == 0) { mes "Tertiary job class and users with expanded levels are not allowed to participate in Siege Battles TE."; close; } if (getcastledata( getarg(1),1 ) == getcharid(2)) warp getarg(1),getarg(2),getarg(3); end; } } .@guildname$ = getguildname(.@guild_id); .@guildmaster$ = getguildmaster(.@guild_id); mes "[ Decree of Sacred Kingdom of Rune-Midgarts ]"; mes ""; mes "1. The Treaty of Sacred Kingdom of Rune-Midgarts"; mes "and the Republic of Schwaltzvalt hereby declares that"; mes "hereby declares that this place belongs to^ff0000 " + .@guildname$; mes "^000000 guild."; mes ""; mes "2. The master of ^ff0000" + .@guildname$ + "^000000 guild is"; mes "^ff0000" + .@guildmaster$ + "^000000, and"; mes "whoever wishes to make objections to this"; mes "shall raise his sword and uphold his honor."; close; } - script simple_info_TE -1,{ callfunc( "F_flag_woe_TE",0,strnpcinfo(4) ); OnInit: if (strnpcinfo(4) != "") flagemblem getcastledata( strnpcinfo(4),1 ); end; } - script flag_te GUILD_FLAG,{ end; OnInit: if (strnpcinfo(2) != "") flagemblem getcastledata( strnpcinfo(2),1 ); end; } // GM NPC //============================================================ prt_gld,1,4,0 script #Enterance Button prt CLEAR_NPC,{ mes "password"; next; if ( callfunc( "F_GM_NPC", 1854,0, 0,9000 ) < 1 ) { mes "That's not right"; close; } mes "What do you want to do with the Gloria-bound warp?"; next; switch( select( "Open it","Close it","Cancel","Rental item provided" ) ) { case 1: mes "Opening the warp."; enablenpc "to_gloria"; close; case 2: mes "Closing the warp."; disablenpc "to_gloria"; close; case 3: end; case 4: mes "You have 300 seconds."; rentitem 13083,300;// TE_Woe_Knife close; } } alde_gld,1,4,0 script #Enterance Button ald CLEAR_NPC,{ mes "password"; next; if ( callfunc( "F_GM_NPC", 1854,0, 0,9000 ) < 1 ) { mes "That's not right"; close; } mes "What do you want to do with the Kafragarten-bound warp?"; next; switch( select( "Open it","Close it","Cancel" ) ) { case 1: mes "Opening the warp."; enablenpc "to_kafragarten"; close; case 2: mes "Closing the warp."; disablenpc "to_kafragarten"; close; case 3: end; } } // God Item Hervor & Jormungand sec_in02,20,20,0 script Test Guide CLEAR_NPC,{ mes "Password?"; next; if (callfunc( "F_GM_NPC", 18543792,0, 0,99999999 ) < 1) { mes "Aww..."; close; } mes "We provide material items needed for testing TE."; next; switch( select( "Materials for Hervor","Materials for Jormungand" ) ) { case 1: getitem 6595,2;// Hammer_Of_Velund getitem 6596,1;// Anvil_Of_Velund getitem 6594,4;// Magic_Bronze_Bullion getitem 6597,3;// Bracelet_Of_Velund getitem 6602,1;// Secret_Of_Rune getitem 6605,1;// Muspellium getitem 6604,1;// Essence_Of_Rune getitem 2115,1;// Valkyrja's_Shield end; case 2: getitem 6603,4;// Skin_Of_Hraesvelg getitem 6599,1;// Spirit_Of_Hugin getitem 6598,1;// Rib_Of_Jormungand getitem 6601,4;// Chisel_Of_Giant getitem 6600,1;// Spirit_Of_Munin getitem 6605,1;// Muspellium getitem 6604,1;// Essence_Of_Rune getitem 1473,1;// Wizardy_Staff end; } }