@LabelIndex 9761
@StringIndex 2021
class 0 chamberlain : citizen {
parameter:
	string	fnHi = "chamberlain_saius001.htm";
	string	fnViewReport = "chamberlain_saius002.htm";
	string	fnViewTaxRate = "chamberlain_saius003.htm";
	string	fnSetGate = "chamberlain_saius005.htm";
	string	fnSetSiegeTime1 = "chamberlain_saius006.htm";
	string	fnViewSiegeTime = "chamberlain_saius007.htm";
	string	fnManageWarehouse = "chamberlain_saius008.htm";
	string	fnNotMyLord = "chamberlain_saius009.htm";
	string	fnAfterOpenGate = "chamberlain_saius011.htm";
	string	fnAfterCloseGate = "chamberlain_saius012.htm";
	string	fnAlreadySetSiege = "chamberlain_saius013.htm";
	string	fnNotRegeistTime = "chamberlain_saius014.htm";
	string	fnSetSiegeTime2 = "chamberlain_saius015.htm";
	string	fnSetSiegeTime3 = "chamberlain_saius016.htm";
	string	fnSetSiegeTime4 = "chamberlain_saius017.htm";
	string	fnSetSiegeTime5 = "chamberlain_saius018.htm";
	string	fnAfterSetSiegeTime = "chamberlain_saius019.htm";
	string	fnSiegeViewReport = "chamberlain_saius020.htm";
	string	fnSiegeStoppedFunction = "chamberlain_saius021.htm";
	string	fnManorManage = "chamberlain_saius022.htm";
	string	fnManageWarehouse2 = "chamberlain_saius023.htm";
	string	fnNotEnoughMoney = "chamberlain_saius049.htm";
	string	fnBanish = "chamberlain_saius050.htm";
	string	fnAfterBanish = "chamberlain_saius051.htm";
	string	fnSiegeDefendList = "chamberlain_saius052.htm";
	string	fnDoorStrengthen = "chamberlain_saius053.htm";
	string	fnDoorLevel = "chamberlain_saius054.htm";
	string	fnDoorStrengthenConfirm = "chamberlain_saius055.htm";
	string	fnCurrentDoorLevelHigher = "chamberlain_saius056.htm";
	string	fnDoorHpLevelUp = "chamberlain_saius057.htm";
	string	fnSetSlowZone = "chamberlain_saius058.htm";
	string	fnSetDmgLevel = "chamberlain_saius059.htm";
	string	fnDmgZoneConfirm = "chamberlain_saius060.htm";
	string	fnCurrentDmgzoneLevelHigher = "chamberlain_saius061.htm";
	string	fnDmgZoneLevelUp = "chamberlain_saius062.htm";
	string	fnNoAuthority = "chamberlain_saius063.htm";
	string	fnSellPage = "chamberlain_saius064.htm";
	string	fnCastleList = "chamberlain_saius065.htm";
	string	fnCrownBefor = "chamberlain_saius066.htm";
	string	fnCrownAfter = "chamberlain_saius067.htm";
	string	fnSSDenial = "chamberlain_saius068.htm";
	string	fnSetTaxRate = "castlesettaxrate.htm";
	string	fnAfterSetTaxRate = "castleaftersettaxrate.htm";
	string	fnManageVault = "castlemanagevault.htm";
	string	fnNotEnoughBalance = "castlenotenoughbalance.htm";
	string	fnSellDawnTicket = "ssq_selldawnticket.htm";
	string	fnTooHighTaxRate = "castletoohightaxrate.htm";
	string	fnNotEnoughTicket = "ssq_notenoughticket.htm";
	string	fnNotDawnOrEvent = "ssq_notdawnorevent.htm";
	string	DDoorName1_1 = "aden_castle_outter_001";
	string	DDoorName1_2 = "aden_castle_outter_002";
	string	DDoorName2_1 = "aden_castle_left_001";
	string	DDoorName2_2 = "aden_castle_left_002";
	string	DDoorName3_1 = "aden_castle_right_001";
	string	DDoorName3_2 = "aden_castle_right_002";
	string	DDoorName4_1 = "aden_castle_inner_001";
	string	DDoorName4_2 = "aden_castle_inner_002";
	string	DDoorName5_1 = "aden_castle_left_003";
	string	DDoorName5_2 = "aden_castle_left_004";
	string	DDoorName6_1 = "aden_castle_right_003";
	string	DDoorName6_2 = "aden_castle_right_004";
	string	SDoorName1 = "aden_castle_terrace";
	string	SDoorName2 = "aden_castle_side_door1";
	string	SDoorName3 = "aden_castle_side_door2";
	string	SDoorName4 = "aden_castle_side_door3";
	string	SDoorName5 = "aden_castle_side_door4";
	string	WallName1 = "aden_castle_wall_in";
	string	WallName2 = "aden_castle_wall_left";
	string	WallName3 = "aden_castle_wall_right";
	string	dmgzonename1 = "aden_damage1_ctrltower";
	string	dmgzonename2 = "aden_damage2_ctrltower";
	int	DDoorPrice1_1 = 3000000;
	int	DDoorPrice1_2 = 4000000;
	int	DDoorPrice1_3 = 5000000;
	int	DDoorPrice2_1 = 750000;
	int	DDoorPrice2_2 = 900000;
	int	DDoorPrice2_3 = 1000000;
	int	DDoorPrice3_1 = 750000;
	int	DDoorPrice3_2 = 900000;
	int	DDoorPrice3_3 = 1000000;
	int	DDoorPrice4_1 = 750000;
	int	DDoorPrice4_2 = 900000;
	int	DDoorPrice4_3 = 1000000;
	int	WallPrice1_1 = 1600000;
	int	WallPrice1_2 = 1800000;
	int	WallPrice1_3 = 2000000;
	int	WallPrice1_1 = 1600000;
	int	WallPrice1_2 = 1800000;
	int	WallPrice1_3 = 2000000;
	int	WallPrice1_1 = 1600000;
	int	WallPrice1_2 = 1800000;
	int	WallPrice1_3 = 2000000;
	int	dmgzoneprice1_1 = 3000000;
	int	dmgzoneprice1_2 = 4000000;
	int	dmgzoneprice1_3 = 5000000;
	int	dmgzoneprice1_4 = 6000000;
	int	dmgzoneprice1_1 = 3000000;
	int	dmgzoneprice1_2 = 4000000;
	int	dmgzoneprice1_3 = 5000000;
	int	dmgzoneprice1_4 = 6000000;
	int	SSQ_DawnTicketQuantity = 300;
	int	SSQ_DawnTicketPrice = 1000;
	int	SSQ_DawnTicketBundle = 10;
	int	SSQ_DawnFactor_door = 80;
	int	SSQ_DawnFactor_dmg = 80;
	int	SSQ_DrawFactor_door = 100;
	int	SSQ_DrawFactor_dmg = 100;
	int	SSQ_DuskFactor_door = 300;
	int	SSQ_DuskFactor_dmg = 300;
	int	SSQ_DawnFactor_tax = 25;
	int	SSQ_DrawFactor_tax = 15;
	int	SSQ_DuskFactor_tax = 5;
	string	ShopName = "";
	string	fnAddTeleporter1 = "ol_mahum_steward_tamutak019.htm";
	string	fnAddTeleporter2 = "ol_mahum_steward_tamutak020.htm";
	string	fnTeleportLevelZero = "ol_mahum_steward_tamutak021.htm";
	int	fortress_id1 = -1;
	int	fortress_id2 = -1;
	int	fortress_id3 = -1;
	int	fortress_id4 = -1;
	int	fortress_id5 = -1;
	int	fortress_fstr = 1300101;
	int	fortress_status = 1300123;
	int	dominion_id = 81;
	int	decotype_hpregen = 1;
	int	decotype_mpregen = 2;
	int	decotype_cpregen = 3;
	int	decotype_xprestore = 4;
	int	decotype_teleport = 5;
	int	decotype_broadcast = 6;
	int	decotype_curtain = 7;
	int	decotype_hanging = 8;
	int	decotype_buff = 9;
	int	decotype_outerflag = 10;
	int	decotype_platform = 11;
	int	decotype_item = 12;
	string	fnManage = "ol_mahum_AgitDecoManage.htm";
	string	fnWarehouse = "agitwarehouse_b.htm";
	string	fnDecoReset = "agitresetdeco.htm";
	string	fnAfterSetDeco = "agitaftersetdeco.htm";
	string	fnAfterResetDeco = "agitafterresetdeco.htm";
	string	fnFailtoSetDeco = "agitfailtosetdeco.htm";
	string	fnFailtoResetDeco = "agitfailtoresetdeco.htm";
	string	fnDecoFunction = "agitdecofunction.htm";
	string	fnFuncDisabled = "agitfuncdisabled.htm";
	string	fnAgitBuff = "agitbuff";
	string	fnAfterBuyItem = "agitafterbuyitem.htm";
	string	fnManageRegen = "ol_mahum_agitdeco_ar01.htm";
	string	fnManageEtc = "ol_mahum_agitdeco_ae01.htm";
	string	fnDecoAlreadySet = "agitdecoalreadyset.htm";
	string	fnAfterBuff = "agitafterbuff.htm";
	string	fnNeedCoolTime = "agitneedcooltime.htm";
	string	fnNotEnoughMP = "agitnotenoughmp.htm";
	int	ppSetGate = 11;
	int	ppDecoFunction = 12;
	int	ppManage = 15;
	string	fileSetName = "CastleDeco";
	int	fstr_stage_lv = 9;
	int	fstr_percent = 10;
	string	fnNoFortressContract = "";
	string	fnMyFortressStatus = "";
	int	fortress_dependancy = 1300133;

property:
	TelPosList Position1 = {{"Talking Island Village"; -84169; 244693; -3729; 100000; 0 }};
	TelPosList Position2 = {{"Talking Island Village"; -84169; 244693; -3729; 100000; 0 }};
	BuySellList SellList0 = {{"advdeluxe_food_for_strider";10}};

handler:
	EventHandler CREATED() {
		myself::AddTimerEx(1077,1000);
		myself::RegisterTeleporterType(1,0);
		super;
	}

	EventHandler TALKED(talker) {
		if( myself::IsMyLord(talker) ) {
			myself::ShowPage(talker,fnHi);
		} else if( myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) {
			myself::ShowPage(talker,fnHi);
		} else {
			myself::ShowPage(talker,fnNotMyLord);
		}
	}

	EventHandler MENU_SELECTED(talker,ask,reply,state,fhtml0,i0,i1,i2,i3,s0) {
		if( ask == 0 ) {
			if( myself::IsMyLord(talker) ) {
				myself::ShowPage(talker,fnHi);
			} else if( myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) {
				myself::ShowPage(talker,fnHi);
			} else {
				myself::ShowPage(talker,fnNotMyLord);
			}
		}
		if( ask == -201 ) {
			switch(reply) {
				case 1: {
					if( myself::IsMyLord(talker) ) {
						if( myself::Castle_IsUnderSiege() || gg::GetDominionWarState(dominion_id) == 5 ) {
							myself::ShowPage(talker,fnSiegeViewReport);
						} else if( myself.sm.residence_id > 0 ) {
							if( myself::Castle_GetPledgeId() ) {
								myself::FHTML_SetFileName(fhtml0,fnViewReport);
								myself::FHTML_SetStr(fhtml0,"my_pledge_name",myself::Castle_GetPledgeName());
								myself::FHTML_SetStr(fhtml0,"my_owner_name",myself::Castle_GetOwnerName());
								myself::FHTML_SetStr(fhtml0,"feud_name",gg::MakeFString(( 1001000 + myself.sm.residence_id ),"","","","",""));
							}
							if( myself::GetSSQStatus() == 1 ) {
								myself::FHTML_SetStr(fhtml0,"ss_event",gg::MakeFString(1000507,"","","","",""));
							} else if( myself::GetSSQStatus() == 3 ) {
								myself::FHTML_SetStr(fhtml0,"ss_event",gg::MakeFString(1000508,"","","","",""));
							} else {
								myself::FHTML_SetStr(fhtml0,"ss_event",gg::MakeFString(1000509,"","","","",""));
							}
							if( myself::GetSSQStatus() != 1 && myself::GetSSQSealOwner(1) == 1 ) {
								myself::FHTML_SetStr(fhtml0,"ss_avarice",gg::MakeFString(1000510,"","","","",""));
							} else if( myself::GetSSQStatus() != 1 && myself::GetSSQSealOwner(1) == 2 ) {
								myself::FHTML_SetStr(fhtml0,"ss_avarice",gg::MakeFString(1000511,"","","","",""));
							} else {
								myself::FHTML_SetStr(fhtml0,"ss_avarice",gg::MakeFString(1000512,"","","","",""));
							}
							if( myself::GetSSQStatus() != 1 && myself::GetSSQSealOwner(2) == 1 ) {
								myself::FHTML_SetStr(fhtml0,"ss_revelation",gg::MakeFString(1000510,"","","","",""));
							} else if( myself::GetSSQStatus() != 1 && myself::GetSSQSealOwner(2) == 2 ) {
								myself::FHTML_SetStr(fhtml0,"ss_revelation",gg::MakeFString(1000511,"","","","",""));
							} else {
								myself::FHTML_SetStr(fhtml0,"ss_revelation",gg::MakeFString(1000512,"","","","",""));
							}
							if( myself::GetSSQStatus() != 1 && myself::GetSSQSealOwner(3) == 1 ) {
								myself::FHTML_SetStr(fhtml0,"ss_strife",gg::MakeFString(1000510,"","","","",""));
							} else if( myself::GetSSQStatus() != 1 && myself::GetSSQSealOwner(3) == 2 ) {
								myself::FHTML_SetStr(fhtml0,"ss_strife",gg::MakeFString(1000511,"","","","",""));
							} else {
								myself::FHTML_SetStr(fhtml0,"ss_strife",gg::MakeFString(1000512,"","","","",""));
							}
							myself::ShowFHTML(talker,fhtml0);
						}
					} else {
						myself::ShowPage(talker,fnNoAuthority);
					}
					break;
				}
				case 2: {
					if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,21) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
						if( myself::Castle_IsUnderSiege() || gg::GetDominionWarState(dominion_id) == 5 ) {
							myself::ShowPage(talker,fnSiegeStoppedFunction);
						} else if( myself::GetSSQSealOwner(3) == 1 ) {
							i0 = SSQ_DuskFactor_tax;
						} else if( myself::GetSSQSealOwner(3) == 2 ) {
							i0 = SSQ_DawnFactor_tax;
						} else {
							i0 = SSQ_DrawFactor_tax;
						}
						myself::FHTML_SetFileName(fhtml0,fnSetTaxRate);
						myself::FHTML_SetInt(fhtml0,"current_tax_rate",myself::Residence_GetTaxRateCurrent());
						myself::FHTML_SetInt(fhtml0,"next_tax_rate",myself::Residence_GetTaxRate());
						myself::FHTML_SetInt(fhtml0,"TaxLimit",i0);
						myself::ShowFHTML(talker,fhtml0);
					} else if( myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) {
						myself::FHTML_SetFileName(fhtml0,fnViewTaxRate);
						myself::FHTML_SetInt(fhtml0,"current_tax_rate",myself::Residence_GetTaxRateCurrent());
						myself::FHTML_SetInt(fhtml0,"next_tax_rate",myself::Residence_GetTaxRate());
						myself::ShowFHTML(talker,fhtml0);
					} else {
						myself::ShowPage(talker,fnNoAuthority);
					}
					break;
				}
				case 3: {
					if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,21) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
						myself::FHTML_SetFileName(fhtml0,fnManageVault);
						myself::FHTML_SetInt(fhtml0,"tax_income",myself::Residence_GetTaxIncome());
						myself::FHTML_SetInt(fhtml0,"tax_income_reserved",myself::Residence_GetTaxIncomeReserved());
						myself::FHTML_SetInt(fhtml0,"seed_income",myself::Manor_GetSeedIncome());
						myself::ShowFHTML(talker,fhtml0);
					} else {
						myself::ShowPage(talker,fnNoAuthority);
					}
					break;
				}
				case 4: {
					if( myself::IsMyLord(talker) || ( myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
						if( myself::Castle_IsUnderSiege() || gg::GetDominionWarState(dominion_id) == 5 ) {
							myself::ShowPage(talker,fnSiegeStoppedFunction);
						} else {
							myself::ShowPage(talker,fnCastleList);
						}
					} else {
						myself::ShowPage(talker,fnNoAuthority);
					}
					break;
				}
				case 5: {
					if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,18) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
						myself::OpenSiegeInfo(talker);
					} else {
						myself::ShowPage(talker,fnNoAuthority);
					}
					break;
				}
				case 6: {
					if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,17) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
						myself::FHTML_SetFileName(fhtml0,"manor.htm");
						myself::ShowFHTML(talker,fhtml0);
					} else {
						myself::ShowPage(talker,fnNoAuthority);
					}
					break;
				}
				case 7: {
					if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,19) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
						myself::ShowPage(talker,fnSellPage);
					} else {
						myself::ShowPage(talker,fnNoAuthority);
					}
					break;
				}
				case 8: {
					if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,20) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
						if( myself::Castle_IsUnderSiege() || gg::GetDominionWarState(dominion_id) == 5 ) {
							myself::ShowPage(talker,fnSiegeStoppedFunction);
						} else {
							myself::ShowPage(talker,fnBanish);
						}
					} else {
						myself::ShowPage(talker,fnNoAuthority);
					}
					break;
				}
				case 9: {
					if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,16) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
						if( myself::Castle_IsUnderSiege() || gg::GetDominionWarState(dominion_id) == 5 ) {
							myself::ShowPage(talker,fnSiegeStoppedFunction);
						} else {
							myself::ShowPage(talker,fnSetGate);
						}
					} else {
						myself::ShowPage(talker,fnNoAuthority);
					}
					break;
				}
				case 10: {
					if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,23) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
						if( gg::Castle_GetDomainFortressContractStatus(myself.sm.residence_id) == 0 ) {
							myself::ShowPage(talker,fnNoFortressContract);
							return;
						}
						if( myself::Castle_IsUnderSiege() || gg::GetDominionWarState(dominion_id) == 5 ) {
							myself::ShowPage(talker,fnSiegeStoppedFunction);
						} else if( myself::GetSSQStatus() == 1 || myself::GetSSQStatus() == 2 ) {
							myself::ShowPage(talker,fnSSDenial);
						} else {
							myself::ShowPage(talker,fnSiegeDefendList);
						}
					} else {
						myself::ShowPage(talker,fnNoAuthority);
					}
					break;
				}
				case 11: {
					if( myself::IsMyLord(talker) ) {
						if( myself::Castle_IsUnderSiege() || gg::GetDominionWarState(dominion_id) == 5 ) {
							myself::ShowPage(talker,fnSiegeStoppedFunction);
						} else if( gg::GetSSQPart(talker) == 2 ) {
							if( myself::GetSSQStatus() == 1 ) {
								if( myself::GetTicketBuyCount(talker) < ( SSQ_DawnTicketQuantity / SSQ_DawnTicketBundle ) ) {
									myself::FHTML_SetFileName(fhtml0,fnSellDawnTicket);
									myself::FHTML_SetInt(fhtml0,"DawnTicketLeft",( SSQ_DawnTicketQuantity - ( myself::GetTicketBuyCount(talker) * SSQ_DawnTicketBundle ) ));
									myself::FHTML_SetInt(fhtml0,"DawnTicketBundle",SSQ_DawnTicketBundle);
									myself::FHTML_SetInt(fhtml0,"DawnTicketPrice",( SSQ_DawnTicketPrice * SSQ_DawnTicketBundle ));
									myself::ShowFHTML(talker,fhtml0);
								} else {
									myself::ShowPage(talker,fnNotEnoughTicket);
								}
							} else {
								myself::ShowPage(talker,fnNotDawnOrEvent);
							}
						} else {
							myself::ShowPage(talker,fnNotDawnOrEvent);
						}
					} else {
						myself::ShowPage(talker,fnNoAuthority);
					}
					break;
				}
				case 12: {
					if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,19) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
						myself::Sell(talker,SellList0,"",fnHi,fnNotEnoughMoney,"");
					} else {
						myself::ShowPage(talker,fnNoAuthority);
					}
					break;
				}
				case 13: {
					if( myself::Castle_IsUnderSiege() || gg::GetDominionWarState(dominion_id) == 5 ) {
						myself::ShowPage(talker,fnSiegeStoppedFunction);
					} else if( myself::IsMyLord(talker) ) {
						if( gg::OwnItemCount(talker,6841) >= 1 ) {
							myself::ShowPage(talker,fnCrownBefor);
						} else if( myself.sm.residence_id > 0 ) {
							if( myself::Castle_GetPledgeId() ) {
								myself::FHTML_SetFileName(fhtml0,fnCrownAfter);
								myself::FHTML_SetStr(fhtml0,"my_owner_name",myself::Castle_GetOwnerName());
								myself::FHTML_SetStr(fhtml0,"feud_name",gg::MakeFString(( 1001000 + myself.sm.residence_id ),"","","","",""));
								myself::GiveItem1(talker,6841,1);
								myself::ShowFHTML(talker,fhtml0);
							}
						}
					} else {
						myself::ShowPage(talker,fnNoAuthority);
					}
					break;
				}
				case 14: {
					if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,18) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
						myself::RegisterDominion(dominion_id,talker);
					} else {
						myself::ShowPage(talker,fnNoAuthority);
					}
					break;
				}
				case 151: {
					if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,ppManage) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
						myself::FHTML_SetFileName(fhtml0,fnManageRegen);
						if( myself::Agit_GetDecoLevel(decotype_hpregen) == 0 ) {
							myself::FHTML_SetStr(fhtml0,"HP" + "Depth",gg::MakeFString(4,"","","","",""));
							myself::FHTML_SetStr(fhtml0,"HP" + "Expire",gg::MakeFString(4,"","","","",""));
							myself::FHTML_SetStr(fhtml0,"HP" + "Reset","");
						} else {
							i0 = ( myself::Agit_GetDecoLevel(decotype_hpregen) - 10 );
							myself::FHTML_SetStr(fhtml0,"HP" + "Depth",gg::MakeFString(fstr_percent,gg::IntToStr(( i0 * 20 )),"","","",""));
							myself::FHTML_SetStr(fhtml0,"HP" + "Cost","(" + gg::MakeFString(6,gg::IntToStr(myself::Agit_GetDecoFee(decotype_hpregen,myself::Agit_GetDecoLevel(decotype_hpregen))),gg::IntToStr(myself::Agit_GetDecoDay(decotype_hpregen,myself::Agit_GetDecoLevel(decotype_hpregen))),"","","") + ")");
							myself::FHTML_SetStr(fhtml0,"HP" + "Expire",gg::MakeFString(5,gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_hpregen),1)),gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_hpregen),2)),gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_hpregen),3)),"",""));
							myself::FHTML_SetStr(fhtml0,"HP" + "Reset",gg::MakeFString(7,fnBracketL,gg::IntToStr(decotype_hpregen),fnBracketR,"",""));
						}
						if( myself::Agit_GetDecoLevel(decotype_mpregen) == 0 ) {
							myself::FHTML_SetStr(fhtml0,"MP" + "Depth",gg::MakeFString(4,"","","","",""));
							myself::FHTML_SetStr(fhtml0,"MP" + "Expire",gg::MakeFString(4,"","","","",""));
							myself::FHTML_SetStr(fhtml0,"MP" + "Reset","");
						} else {
							i0 = ( myself::Agit_GetDecoLevel(decotype_mpregen) - 10 );
							myself::FHTML_SetStr(fhtml0,"MP" + "Depth",gg::MakeFString(fstr_percent,gg::IntToStr(( i0 * 5 )),"","","",""));
							myself::FHTML_SetStr(fhtml0,"MP" + "Cost","(" + gg::MakeFString(6,gg::IntToStr(myself::Agit_GetDecoFee(decotype_mpregen,myself::Agit_GetDecoLevel(decotype_mpregen))),gg::IntToStr(myself::Agit_GetDecoDay(decotype_mpregen,myself::Agit_GetDecoLevel(decotype_mpregen))),"","","") + ")");
							myself::FHTML_SetStr(fhtml0,"MP" + "Expire",gg::MakeFString(5,gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_mpregen),1)),gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_mpregen),2)),gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_mpregen),3)),"",""));
							myself::FHTML_SetStr(fhtml0,"MP" + "Reset",gg::MakeFString(7,fnBracketL,gg::IntToStr(decotype_mpregen),fnBracketR,"",""));
						}
						if( myself::Agit_GetDecoLevel(decotype_xprestore) == 0 ) {
							myself::FHTML_SetStr(fhtml0,"XP" + "Depth",gg::MakeFString(4,"","","","",""));
							myself::FHTML_SetStr(fhtml0,"XP" + "Expire",gg::MakeFString(4,"","","","",""));
							myself::FHTML_SetStr(fhtml0,"XP" + "Reset","");
						} else {
							i0 = ( myself::Agit_GetDecoLevel(decotype_xprestore) - 10 );
							myself::FHTML_SetStr(fhtml0,"XP" + "Depth",gg::MakeFString(fstr_percent,gg::IntToStr(( i0 * 5 )),"","","",""));
							myself::FHTML_SetStr(fhtml0,"XP" + "Cost","(" + gg::MakeFString(6,gg::IntToStr(myself::Agit_GetDecoFee(decotype_xprestore,myself::Agit_GetDecoLevel(decotype_xprestore))),gg::IntToStr(myself::Agit_GetDecoDay(decotype_xprestore,myself::Agit_GetDecoLevel(decotype_xprestore))),"","","") + ")");
							myself::FHTML_SetStr(fhtml0,"XP" + "Expire",gg::MakeFString(5,gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_xprestore),1)),gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_xprestore),2)),gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_xprestore),3)),"",""));
							myself::FHTML_SetStr(fhtml0,"XP" + "Reset",gg::MakeFString(7,fnBracketL,gg::IntToStr(decotype_xprestore),fnBracketR,"",""));
						}
						myself::ShowFHTML(talker,fhtml0);
					} else {
						myself::ShowPage(talker,fnNoAuthority);
					}
					break;
				}
				case 152: {
					if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,ppManage) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
						myself::FHTML_SetFileName(fhtml0,fnManageEtc);
						if( myself::Agit_GetDecoLevel(decotype_teleport) == 0 ) {
							myself::FHTML_SetStr(fhtml0,"TP" + "Depth",gg::MakeFString(4,"","","","",""));
							myself::FHTML_SetStr(fhtml0,"TP" + "Expire",gg::MakeFString(4,"","","","",""));
							myself::FHTML_SetStr(fhtml0,"TP" + "Reset","");
						} else {
							i0 = ( myself::Agit_GetDecoLevel(decotype_teleport) - 10 );
							myself::FHTML_SetStr(fhtml0,"TP" + "Depth",gg::MakeFString(fstr_stage_lv,gg::IntToStr(( i0 * 1 )),"","","",""));
							myself::FHTML_SetStr(fhtml0,"TP" + "Cost","(" + gg::MakeFString(6,gg::IntToStr(myself::Agit_GetDecoFee(decotype_teleport,myself::Agit_GetDecoLevel(decotype_teleport))),gg::IntToStr(myself::Agit_GetDecoDay(decotype_teleport,myself::Agit_GetDecoLevel(decotype_teleport))),"","","") + ")");
							myself::FHTML_SetStr(fhtml0,"TP" + "Expire",gg::MakeFString(5,gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_teleport),1)),gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_teleport),2)),gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_teleport),3)),"",""));
							myself::FHTML_SetStr(fhtml0,"TP" + "Reset",gg::MakeFString(7,fnBracketL,gg::IntToStr(decotype_teleport),fnBracketR,"",""));
						}
						if( myself::Agit_GetDecoLevel(decotype_broadcast) == 0 ) {
							myself::FHTML_SetStr(fhtml0,"BC" + "Depth",gg::MakeFString(4,"","","","",""));
							myself::FHTML_SetStr(fhtml0,"BC" + "Expire",gg::MakeFString(4,"","","","",""));
							myself::FHTML_SetStr(fhtml0,"BC" + "Reset","");
						} else {
							i0 = ( myself::Agit_GetDecoLevel(decotype_broadcast) - 10 );
							myself::FHTML_SetStr(fhtml0,"BC" + "Depth",gg::MakeFString(fstr_stage_lv,gg::IntToStr(( i0 * 1 )),"","","",""));
							myself::FHTML_SetStr(fhtml0,"BC" + "Cost","(" + gg::MakeFString(6,gg::IntToStr(myself::Agit_GetDecoFee(decotype_broadcast,myself::Agit_GetDecoLevel(decotype_broadcast))),gg::IntToStr(myself::Agit_GetDecoDay(decotype_broadcast,myself::Agit_GetDecoLevel(decotype_broadcast))),"","","") + ")");
							myself::FHTML_SetStr(fhtml0,"BC" + "Expire",gg::MakeFString(5,gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_broadcast),1)),gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_broadcast),2)),gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_broadcast),3)),"",""));
							myself::FHTML_SetStr(fhtml0,"BC" + "Reset",gg::MakeFString(7,fnBracketL,gg::IntToStr(decotype_broadcast),fnBracketR,"",""));
						}
						if( myself::Agit_GetDecoLevel(decotype_item) == 0 ) {
							myself::FHTML_SetStr(fhtml0,"IC" + "Depth",gg::MakeFString(4,"","","","",""));
							myself::FHTML_SetStr(fhtml0,"IC" + "Expire",gg::MakeFString(4,"","","","",""));
							myself::FHTML_SetStr(fhtml0,"IC" + "Reset","");
						} else {
							i0 = ( myself::Agit_GetDecoLevel(decotype_item) - 10 );
							myself::FHTML_SetStr(fhtml0,"IC" + "Depth",gg::MakeFString(fstr_stage_lv,gg::IntToStr(( i0 * 1 )),"","","",""));
							myself::FHTML_SetStr(fhtml0,"IC" + "Cost","(" + gg::MakeFString(6,gg::IntToStr(myself::Agit_GetDecoFee(decotype_item,myself::Agit_GetDecoLevel(decotype_item))),gg::IntToStr(myself::Agit_GetDecoDay(decotype_item,myself::Agit_GetDecoLevel(decotype_item))),"","","") + ")");
							myself::FHTML_SetStr(fhtml0,"IC" + "Expire",gg::MakeFString(5,gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_item),1)),gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_item),2)),gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_item),3)),"",""));
							myself::FHTML_SetStr(fhtml0,"IC" + "Reset",gg::MakeFString(7,fnBracketL,gg::IntToStr(decotype_item),fnBracketR,"",""));
						}
						if( myself::Agit_GetDecoLevel(decotype_buff) == 0 ) {
							myself::FHTML_SetStr(fhtml0,"BF" + "Depth",gg::MakeFString(4,"","","","",""));
							myself::FHTML_SetStr(fhtml0,"BF" + "Expire",gg::MakeFString(4,"","","","",""));
							myself::FHTML_SetStr(fhtml0,"BF" + "Reset","");
						} else {
							i0 = ( myself::Agit_GetDecoLevel(decotype_buff) - 10 );
							myself::FHTML_SetStr(fhtml0,"BF" + "Depth",gg::MakeFString(fstr_stage_lv,gg::IntToStr(( i0 * 1 )),"","","",""));
							myself::FHTML_SetStr(fhtml0,"BF" + "Cost","(" + gg::MakeFString(6,gg::IntToStr(myself::Agit_GetDecoFee(decotype_buff,myself::Agit_GetDecoLevel(decotype_buff))),gg::IntToStr(myself::Agit_GetDecoDay(decotype_buff,myself::Agit_GetDecoLevel(decotype_buff))),"","","") + ")");
							myself::FHTML_SetStr(fhtml0,"BF" + "Expire",gg::MakeFString(5,gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_buff),1)),gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_buff),2)),gg::IntToStr(gg::GetDateTime(myself::Agit_GetDecoExpire(decotype_buff),3)),"",""));
							myself::FHTML_SetStr(fhtml0,"BF" + "Reset",gg::MakeFString(7,fnBracketL,gg::IntToStr(decotype_buff),fnBracketR,"",""));
						}
						myself::ShowFHTML(talker,fhtml0);
					} else {
						myself::ShowPage(talker,fnNoAuthority);
					}
					break;
				}
				case 107: {
					if( myself::HavePledgePower(talker,ppDecoFunction) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) {
						if( myself::Agit_GetDecoLevel(decotype_buff) == 0 ) {
							myself::ShowPage(talker,fnFuncDisabled);
						} else {
							myself::FHTML_SetFileName(fhtml0,fnAgitBuff + "_" + gg::IntToStr(( myself::Agit_GetDecoLevel(decotype_buff) - 10 )) + ".htm");
							myself::FHTML_SetInt(fhtml0,"MPLeft",gg::FloatToInt(myself.sm.mp));
							myself::ShowFHTML(talker,fhtml0);
						}
					} else {
						myself::ShowPage(talker,fnNoAuthority);
					}
					break;
				}
				case 105: {
					if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,ppManage) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
						myself::ShowPage(talker,fnManage);
					} else {
						myself::ShowPage(talker,fnNoAuthority);
					}
					break;
				}
				case 103: {
					if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,ppDecoFunction) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
						myself::FHTML_SetFileName(fhtml0,fnDecoFunction);
						if( myself::Agit_GetDecoLevel(decotype_hpregen) == 0 ) {
							myself::FHTML_SetInt(fhtml0,"HPDepth",0);
						} else {
							myself::FHTML_SetInt(fhtml0,"HPDepth",( ( myself::Agit_GetDecoLevel(decotype_hpregen) - 10 ) * 20 ));
						}
						if( myself::Agit_GetDecoLevel(decotype_mpregen) == 0 ) {
							myself::FHTML_SetInt(fhtml0,"MPDepth",0);
						} else {
							myself::FHTML_SetInt(fhtml0,"MPDepth",( ( myself::Agit_GetDecoLevel(decotype_mpregen) - 10 ) * 5 ));
						}
						if( myself::Agit_GetDecoLevel(decotype_xprestore) == 0 ) {
							myself::FHTML_SetInt(fhtml0,"XPDepth",0);
						} else {
							myself::FHTML_SetInt(fhtml0,"XPDepth",( ( myself::Agit_GetDecoLevel(decotype_xprestore) - 10 ) * 5 ));
						}
						myself::ShowFHTML(talker,fhtml0);
					} else {
						myself::ShowPage(talker,fnNoAuthority);
					}
					break;
				}
				case 399: {
					myself::Castle_GetRelatedFortressList(talker);
				}
			}
		} else if( ask == -202 ) {
			if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,21) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
				if( myself::Castle_IsUnderSiege() || gg::GetDominionWarState(dominion_id) == 5 ) {
					myself::ShowPage(talker,fnSiegeStoppedFunction);
				} else if( myself::GetSSQSealOwner(3) == 1 ) {
					i0 = SSQ_DuskFactor_tax;
				} else if( myself::GetSSQSealOwner(3) == 2 ) {
					i0 = SSQ_DawnFactor_tax;
				} else {
					i0 = SSQ_DrawFactor_tax;
				}
				if( reply > i0 ) {
					myself::FHTML_SetFileName(fhtml0,fnTooHighTaxRate);
					myself::FHTML_SetInt(fhtml0,"TaxLimit",i0);
				} else {
					myself::FHTML_SetFileName(fhtml0,fnAfterSetTaxRate);
					if( reply < 0 ) {
						myself::Residence_SetTaxRate(0);
						myself::FHTML_SetInt(fhtml0,"next_tax_rate",0);
					} else {
						myself::Residence_SetTaxRate(reply);
						myself::FHTML_SetInt(fhtml0,"next_tax_rate",reply);
					}
				}
				myself::ShowFHTML(talker,fhtml0);
			} else {
				myself::ShowPage(talker,fnNoAuthority);
			}
		} else if( ask == -203 ) {
			if( myself::Castle_IsUnderSiege() || gg::GetDominionWarState(dominion_id) == 5 ) {
				myself::ShowPage(talker,fnSiegeStoppedFunction);
			} else if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,16) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
				switch(reply) {
					case 1: {
						gg::Castle_GateOpenClose2(DDoorName1_1,0);
						gg::Castle_GateOpenClose2(DDoorName1_2,0);
						myself::ShowPage(talker,fnAfterOpenGate);
						break;
					}
					case 101: {
						gg::Castle_GateOpenClose2(DDoorName1_1,1);
						gg::Castle_GateOpenClose2(DDoorName1_2,1);
						myself::ShowPage(talker,fnAfterCloseGate);
						break;
					}
					case 2: {
						gg::Castle_GateOpenClose2(DDoorName2_1,0);
						gg::Castle_GateOpenClose2(DDoorName2_2,0);
						myself::ShowPage(talker,fnAfterOpenGate);
						break;
					}
					case 102: {
						gg::Castle_GateOpenClose2(DDoorName2_1,1);
						gg::Castle_GateOpenClose2(DDoorName2_2,1);
						myself::ShowPage(talker,fnAfterCloseGate);
						break;
					}
					case 3: {
						gg::Castle_GateOpenClose2(DDoorName3_1,0);
						gg::Castle_GateOpenClose2(DDoorName3_2,0);
						myself::ShowPage(talker,fnAfterOpenGate);
						break;
					}
					case 103: {
						gg::Castle_GateOpenClose2(DDoorName3_1,1);
						gg::Castle_GateOpenClose2(DDoorName3_2,1);
						myself::ShowPage(talker,fnAfterCloseGate);
						break;
					}
					case 4: {
						gg::Castle_GateOpenClose2(DDoorName4_1,0);
						gg::Castle_GateOpenClose2(DDoorName4_2,0);
						myself::ShowPage(talker,fnAfterOpenGate);
						break;
					}
					case 104: {
						gg::Castle_GateOpenClose2(DDoorName4_1,1);
						gg::Castle_GateOpenClose2(DDoorName4_2,1);
						myself::ShowPage(talker,fnAfterCloseGate);
						break;
					}
					case 5: {
						gg::Castle_GateOpenClose2(DDoorName5_1,0);
						gg::Castle_GateOpenClose2(DDoorName5_2,0);
						myself::ShowPage(talker,fnAfterOpenGate);
						break;
					}
					case 105: {
						gg::Castle_GateOpenClose2(DDoorName5_1,1);
						gg::Castle_GateOpenClose2(DDoorName5_2,1);
						myself::ShowPage(talker,fnAfterCloseGate);
						break;
					}
					case 6: {
						gg::Castle_GateOpenClose2(DDoorName6_1,0);
						gg::Castle_GateOpenClose2(DDoorName6_2,0);
						myself::ShowPage(talker,fnAfterOpenGate);
						break;
					}
					case 106: {
						gg::Castle_GateOpenClose2(DDoorName6_1,1);
						gg::Castle_GateOpenClose2(DDoorName6_2,1);
						myself::ShowPage(talker,fnAfterCloseGate);
						break;
					}
					case 11: {
						gg::Castle_GateOpenClose2(SDoorName1,0);
						myself::ShowPage(talker,fnAfterOpenGate);
						break;
					}
					case 111: {
						gg::Castle_GateOpenClose2(SDoorName1,1);
						myself::ShowPage(talker,fnAfterCloseGate);
						break;
					}
					case 12: {
						gg::Castle_GateOpenClose2(SDoorName2,0);
						myself::ShowPage(talker,fnAfterOpenGate);
						break;
					}
					case 112: {
						gg::Castle_GateOpenClose2(SDoorName2,1);
						myself::ShowPage(talker,fnAfterCloseGate);
						break;
					}
					case 13: {
						gg::Castle_GateOpenClose2(SDoorName3,0);
						myself::ShowPage(talker,fnAfterOpenGate);
						break;
					}
					case 113: {
						gg::Castle_GateOpenClose2(SDoorName3,1);
						myself::ShowPage(talker,fnAfterCloseGate);
						break;
					}
					case 14: {
						gg::Castle_GateOpenClose2(SDoorName4,0);
						myself::ShowPage(talker,fnAfterOpenGate);
						break;
					}
					case 114: {
						gg::Castle_GateOpenClose2(SDoorName4,1);
						myself::ShowPage(talker,fnAfterCloseGate);
						break;
					}
					case 15: {
						gg::Castle_GateOpenClose2(SDoorName5,0);
						myself::ShowPage(talker,fnAfterOpenGate);
						break;
					}
					case 115: {
						gg::Castle_GateOpenClose2(SDoorName5,1);
						myself::ShowPage(talker,fnAfterCloseGate);
						break;
					}
					case 99: {
						myself::Castle_GateOpenClose(0);
						myself::ShowPage(talker,fnAfterOpenGate);
						break;
					}
					case 199: {
						myself::Castle_GateOpenClose(1);
						myself::ShowPage(talker,fnAfterCloseGate);
						break;
					}
				}
			} else {
				myself::ShowPage(talker,fnNoAuthority);
			}
		} else if( ask == -204 ) {
			if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,23) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
				switch(reply) {
					case 1: {
						myself::ShowPage(talker,fnDoorStrengthen);
						break;
					}
					case 2: {
						myself::ShowPage(talker,fnSetSlowZone);
						break;
					}
				}
			} else {
				myself::ShowPage(talker,fnNoAuthority);
			}
		} else if( ask == -205 ) {
			myself::SetCookie(talker,"gate_num",reply);
			myself::ShowPage(talker,fnDoorLevel);
		} else if( ask == -206 ) {
			switch(reply) {
				case 1: {
					myself::SetCookie(talker,"gate_level",200);
					break;
				}
				case 2: {
					myself::SetCookie(talker,"gate_level",300);
					break;
				}
				case 3: {
					myself::SetCookie(talker,"gate_level",500);
					break;
				}
			}
			i0 = myself::GetCookie(talker,"gate_num");
			i1 = myself::GetCookie(talker,"gate_level");
			if( i0 == 1 && i1 == 200 ) {
				i2 = DDoorPrice1_1;
			}
			if( i0 == 1 && i1 == 300 ) {
				i2 = DDoorPrice1_2;
			}
			if( i0 == 1 && i1 == 500 ) {
				i2 = DDoorPrice1_3;
			}
			if( ( i0 == 2 || i0 == 3 ) && i1 == 200 ) {
				i2 = DDoorPrice2_1;
			}
			if( ( i0 == 2 || i0 == 3 ) && i1 == 300 ) {
				i2 = DDoorPrice2_2;
			}
			if( ( i0 == 2 || i0 == 3 ) && i1 == 500 ) {
				i2 = DDoorPrice2_3;
			}
			if( i0 == 4 && i1 == 200 ) {
				i2 = DDoorPrice4_1;
			}
			if( i0 == 4 && i1 == 300 ) {
				i2 = DDoorPrice4_2;
			}
			if( i0 == 4 && i1 == 500 ) {
				i2 = DDoorPrice4_3;
			}
			if( i0 == 21 && i1 == 200 ) {
				i2 = WallPrice1_1;
			}
			if( i0 == 21 && i1 == 300 ) {
				i2 = WallPrice1_2;
			}
			if( i0 == 21 && i1 == 500 ) {
				i2 = WallPrice1_3;
			}
			if( i0 == 22 && i1 == 200 ) {
				i2 = WallPrice1_1;
			}
			if( i0 == 22 && i1 == 300 ) {
				i2 = WallPrice1_2;
			}
			if( i0 == 22 && i1 == 500 ) {
				i2 = WallPrice1_3;
			}
			if( myself::GetSSQSealOwner(3) == 1 ) {
				i2 = gg::FloatToInt(( ( i2 * SSQ_DuskFactor_door ) / 100 ));
			} else if( myself::GetSSQSealOwner(3) == 2 ) {
				i2 = gg::FloatToInt(( ( i2 * SSQ_DawnFactor_door ) / 100 ));
			} else {
				i2 = gg::FloatToInt(( ( i2 * SSQ_DrawFactor_door ) / 100 ));
			}
			myself::SetCookie(talker,"gate_price",i2);
			myself::FHTML_SetFileName(fhtml0,fnDoorStrengthenConfirm);
			myself::FHTML_SetInt(fhtml0,"gate_price",i2);
			myself::ShowFHTML(talker,fhtml0);
		} else if( ask == -207 && reply == 1 ) {
			if( myself::Castle_IsUnderSiege() || gg::GetDominionWarState(dominion_id) == 5 ) {
				myself::ShowPage(talker,fnSiegeStoppedFunction);
			} else if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,23) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
				i0 = myself::GetCookie(talker,"gate_num");
				i1 = myself::GetCookie(talker,"gate_price");
				switch(i0) {
					case 1: {
						myself::GetDoorHpLevel(talker,DDoorName1_1);
						break;
					}
					case 2: {
						myself::GetDoorHpLevel(talker,DDoorName2_1);
						break;
					}
					case 3: {
						myself::GetDoorHpLevel(talker,DDoorName3_1);
						break;
					}
					case 4: {
						myself::GetDoorHpLevel(talker,DDoorName4_1);
						break;
					}
					case 21: {
						myself::GetDoorHpLevel(talker,WallName1);
						break;
					}
					case 22: {
						myself::GetDoorHpLevel(talker,WallName3);
						break;
					}
				}
			} else {
				myself::ShowPage(talker,fnNoAuthority);
			}
		} else if( ask == -208 ) {
			if( reply == 1 ) {
				myself::SetCookie(talker,"dmgzone_num",1);
			} else if( reply == 2 ) {
				myself::SetCookie(talker,"dmgzone_num",2);
			}
			myself::ShowPage(talker,fnSetDmgLevel);
		} else if( ask == -209 ) {
			myself::SetCookie(talker,"dmgzone_level",reply);
			switch(reply) {
				case 1: {
					i0 = dmgzoneprice1_1;
					break;
				}
				case 2: {
					i0 = dmgzoneprice1_2;
					break;
				}
				case 3: {
					i0 = dmgzoneprice1_3;
					break;
				}
				case 4: {
					i0 = dmgzoneprice1_4;
					break;
				}
			}
			if( myself::GetSSQSealOwner(3) == 1 ) {
				i0 = gg::FloatToInt(( ( i0 * SSQ_DuskFactor_dmg ) / 100 ));
			} else if( myself::GetSSQSealOwner(3) == 2 ) {
				i0 = gg::FloatToInt(( ( i0 * SSQ_DawnFactor_dmg ) / 100 ));
			} else {
				i0 = gg::FloatToInt(( ( i0 * SSQ_DrawFactor_dmg ) / 100 ));
			}
			myself::SetCookie(talker,"dmgzone_price",i0);
			myself::FHTML_SetFileName(fhtml0,fnDmgZoneConfirm);
			myself::FHTML_SetInt(fhtml0,"dmgzone_price",i0);
			myself::ShowFHTML(talker,fhtml0);
		} else if( ask == -210 && reply == 1 ) {
			if( myself::Castle_IsUnderSiege() || gg::GetDominionWarState(dominion_id) == 5 ) {
				myself::ShowPage(talker,fnSiegeStoppedFunction);
			} else if( myself::GetCookie(talker,"dmgzone_num") == 1 ) {
				myself::GetControlTowerLevel(talker,dmgzonename1);
			} else if( myself::GetCookie(talker,"dmgzone_num") == 2 ) {
				myself::GetControlTowerLevel(talker,dmgzonename2);
			}
		} else if( ask == -219 ) {
			if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,20) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
				if( myself::Castle_IsUnderSiege() || gg::GetDominionWarState(dominion_id) == 5 ) {
					myself::ShowPage(talker,fnSiegeStoppedFunction);
				} else {
					myself::Castle_BanishOthers();
					myself::ShowPage(talker,fnAfterBanish);
				}
			} else {
				myself::ShowPage(talker,fnNoAuthority);
			}
		} else if( ask == -240 ) {
			if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,21) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
				if( reply == 0 ) {
					myself::ShowPage(talker,fnHi);
				} else if( reply <= myself::Residence_GetTaxIncome() ) {
					myself::Residence_VaultTakeOutMoney(talker,reply);
					myself::ShowPage(talker,fnHi);
				} else {
					myself::FHTML_SetFileName(fhtml0,fnNotEnoughBalance);
					myself::FHTML_SetInt(fhtml0,"tax_income",myself::Residence_GetTaxIncome());
					myself::FHTML_SetInt(fhtml0,"withdraw_amount",reply);
					myself::ShowFHTML(talker,fhtml0);
				}
			} else {
				myself::ShowPage(talker,fnNoAuthority);
			}
		} else if( ask == -241 ) {
			if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,21) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
				myself::Residence_VaultSaveMoney(talker,reply);
				myself::ShowPage(talker,fnHi);
			} else {
				myself::ShowPage(talker,fnNoAuthority);
			}
		} else if( ask == -251 ) {
			if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,17) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
				if( reply == 3 ) {
					if( myself::IsMyLord(talker) ) {
						myself::FHTML_SetFileName(fhtml0,fnManageWarehouse2);
						myself::FHTML_SetInt(fhtml0,"tax_income",myself::Residence_GetTaxIncome());
						myself::ShowFHTML(talker,fhtml0);
					} else {
						myself::ShowPage(talker,fnNoAuthority);
					}
				} else {
					i0 = gg::FloatToInt(( reply / 10 ));
					myself::SetCookie(talker,"ManorId",i0);
					i1 = ( reply - ( i0 * 10 ) );
					if( i1 == 1 ) {
						if( state == 1 ) {
							myself::FHTML_SetFileName(fhtml0,"manormanage" + reply + ".htm");
							for(i2 = 1; i2 <= 25; i2++) {
								myself::FHTML_SetInt(fhtml0,"CurrentSeedCount" + i2,myself::GetCurrentSeedSellCountSet(i0,i2));
								myself::FHTML_SetInt(fhtml0,"MaxSell" + i2,myself::GetMaxSellableCount(i0,i2));
								myself::FHTML_SetInt(fhtml0,"CurrentSeedPrice" + i2,myself::GetCurrentSeedPrice(i0,i2));
								myself::FHTML_SetInt(fhtml0,"CurrentSeedRemain" + i2,myself::GetCurrentSeedRemainCount(i0,i2));
							}
							myself::ShowFHTML(talker,fhtml0);
						} else if( state == 2 ) {
							myself::FHTML_SetFileName(fhtml0,"im_manormanage" + reply + ".htm");
							for(i2 = 1; i2 <= 25; i2++) {
								myself::FHTML_SetInt(fhtml0,"CurrentSeedCount" + i2,myself::GetCurrentSeedSellCountSet(i0,i2));
								myself::FHTML_SetInt(fhtml0,"MaxSell" + i2,myself::GetMaxSellableCount(i0,i2));
								myself::FHTML_SetInt(fhtml0,"CurrentSeedPrice" + i2,myself::GetCurrentSeedPrice(i0,i2));
								myself::FHTML_SetInt(fhtml0,"CurrentSeedRemain" + i2,myself::GetCurrentSeedRemainCount(i0,i2));
							}
							myself::ShowFHTML(talker,fhtml0);
						}
					} else if( i1 == 2 ) {
						if( state == 1 ) {
							myself::FHTML_SetFileName(fhtml0,"manormanage" + reply + ".htm");
							for(i2 = 1; i2 <= 25; i2++) {
								myself::FHTML_SetInt(fhtml0,"CurrentCropProcureCount" + i2,myself::GetProcurementCount(i0,i2));
								myself::FHTML_SetInt(fhtml0,"RemainCropCount" + i2,myself::GetRemainProcureCropCount(i0,i2));
								myself::FHTML_SetInt(fhtml0,"CurrentCropPrice" + i2,myself::GetProcurementRate(i0,i2));
								myself::FHTML_SetInt(fhtml0,"CurrentProcureType" + i2,myself::GetProcurementType(i0,i2));
							}
							myself::ShowFHTML(talker,fhtml0);
						} else if( state == 2 ) {
							myself::FHTML_SetFileName(fhtml0,"im_manormanage" + reply + ".htm");
							for(i2 = 1; i2 <= 25; i2++) {
								myself::FHTML_SetInt(fhtml0,"CurrentCropProcureCount" + i2,myself::GetProcurementCount(i0,i2));
								myself::FHTML_SetInt(fhtml0,"RemainCropCount" + i2,myself::GetRemainProcureCropCount(i0,i2));
								myself::FHTML_SetInt(fhtml0,"CurrentCropPrice" + i2,myself::GetProcurementRate(i0,i2));
								myself::FHTML_SetInt(fhtml0,"CurrentProcureType" + i2,myself::GetProcurementType(i0,i2));
							}
							myself::ShowFHTML(talker,fhtml0);
						}
					} else if( i1 == 3 ) {
						if( state == 1 ) {
							myself::FHTML_SetFileName(fhtml0,"manormanage" + reply + ".htm");
							for(i2 = 1; i2 <= 25; i2++) {
								myself::FHTML_SetInt(fhtml0,"NextSeedCount" + i2,myself::GetNextSeedSellCountSet(i0,i2));
								myself::FHTML_SetInt(fhtml0,"NextSeedPrice" + i2,myself::GetNextSeedPrice(i0,i2));
							}
							myself::ShowFHTML(talker,fhtml0);
						} else if( state == 2 ) {
							myself::FHTML_SetFileName(fhtml0,"im_manormanage" + reply + ".htm");
							for(i2 = 1; i2 <= 25; i2++) {
								myself::FHTML_SetInt(fhtml0,"NextSeedCount" + i2,myself::GetNextSeedSellCountSet(i0,i2));
								myself::FHTML_SetInt(fhtml0,"NextSeedPrice" + i2,myself::GetNextSeedPrice(i0,i2));
							}
							myself::ShowFHTML(talker,fhtml0);
						}
					} else if( i1 == 4 ) {
						if( state == 1 ) {
							myself::FHTML_SetFileName(fhtml0,"manormanage" + reply + ".htm");
							i3 = 0;
							for(i2 = 1; i2 <= 25; i2++) {
								myself::FHTML_SetInt(fhtml0,"NextProcureCount" + i2,myself::GetNextProcurementCount(i0,i2));
								myself::FHTML_SetInt(fhtml0,"NextProcurePrice" + i2,myself::GetNextProcurementRate(i0,i2));
								i3 = ( i3 + ( myself::GetNextProcurementCount(i0,i2) * myself::GetNextProcurementRate(i0,i2) ) );
								myself::FHTML_SetInt(fhtml0,"NextProcureType" + i2,myself::GetNextProcurementType(i0,i2));
							}
							myself::FHTML_SetInt(fhtml0,"total_sum",i3);
							myself::ShowFHTML(talker,fhtml0);
						} else if( state == 2 ) {
							myself::FHTML_SetFileName(fhtml0,"im_manormanage" + reply + ".htm");
							i3 = 0;
							for(i2 = 1; i2 <= 25; i2++) {
								myself::FHTML_SetInt(fhtml0,"NextProcureCount" + i2,myself::GetNextProcurementCount(i0,i2));
								myself::FHTML_SetInt(fhtml0,"NextProcurePrice" + i2,myself::GetNextProcurementRate(i0,i2));
								i3 = ( i3 + ( myself::GetNextProcurementCount(i0,i2) * myself::GetNextProcurementRate(i0,i2) ) );
								myself::FHTML_SetInt(fhtml0,"NextProcureType" + i2,myself::GetNextProcurementType(i0,i2));
							}
							myself::FHTML_SetInt(fhtml0,"total_sum",i3);
							myself::ShowFHTML(talker,fhtml0);
						}
					} else if( i1 == 5 ) {
						if( state == 1 ) {
							myself::FHTML_SetFileName(fhtml0,"manormanage" + reply + ".htm");
							i3 = 0;
							for(i2 = 1; i2 <= 25; i2++) {
								myself::FHTML_SetInt(fhtml0,"NextSeedCount" + i2,myself::GetNextSeedSellCountSet(i0,i2));
								myself::FHTML_SetInt(fhtml0,"DefaultSeedPrice" + i2,myself::GetSeedDefaultPrice(i0,i2));
								i3 = ( i3 + ( myself::GetNextSeedSellCountSet(i0,i2) * myself::GetSeedDefaultPrice(i0,i2) ) );
								myself::FHTML_SetInt(fhtml0,"sum" + i2,( myself::GetNextSeedSellCountSet(i0,i2) * myself::GetSeedDefaultPrice(i0,i2) ));
							}
							myself::FHTML_SetInt(fhtml0,"total_sum",i3);
							myself::ShowFHTML(talker,fhtml0);
						} else if( state == 2 ) {
							myself::FHTML_SetFileName(fhtml0,"im_manormanage" + reply + ".htm");
							i3 = 0;
							for(i2 = 1; i2 <= 25; i2++) {
								myself::FHTML_SetInt(fhtml0,"NextSeedCount" + i2,myself::GetNextSeedSellCountSet(i0,i2));
								myself::FHTML_SetInt(fhtml0,"DefaultSeedPrice" + i2,myself::GetSeedDefaultPrice(i0,i2));
								i3 = ( i3 + ( myself::GetNextSeedSellCountSet(i0,i2) * myself::GetSeedDefaultPrice(i0,i2) ) );
								myself::FHTML_SetInt(fhtml0,"sum" + i2,( myself::GetNextSeedSellCountSet(i0,i2) * myself::GetSeedDefaultPrice(i0,i2) ));
							}
							myself::FHTML_SetInt(fhtml0,"total_sum",i3);
							myself::ShowFHTML(talker,fhtml0);
						}
					}
				}
			} else {
				myself::ShowPage(talker,fnNoAuthority);
			}
		} else if( ask == -252 && myself::IsManorSettingTime() == 1 ) {
			if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,17) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
				i0 = myself::GetCookie(talker,"ManorId");
				i1 = myself::GetCropClassidByOrderNum(i0,reply);
				if( state == 1 ) {
					myself::FHTML_SetFileName(fhtml0,"cropmanage.htm");
					s0 = gg::MakeFString(( ( i1 + 1200001 ) - 5065 ),"","","","","");
				} else if( state == 2 ) {
					myself::FHTML_SetFileName(fhtml0,"im_cropmanage.htm");
					s0 = gg::MakeFString(( ( i1 + 1200031 ) - 5818 ),"","","","","");
				}
				myself::FHTML_SetStr(fhtml0,"cropname",s0);
				myself::FHTML_SetInt(fhtml0,"CurrentSeedCount",myself::GetCurrentSeedSellCountSet(i0,reply));
				myself::FHTML_SetInt(fhtml0,"CurrentSeedPrice",myself::GetCurrentSeedPrice(i0,reply));
				myself::FHTML_SetInt(fhtml0,"CurrentCropProcureCount",myself::GetProcurementCount(i0,reply));
				myself::FHTML_SetInt(fhtml0,"CurrentCropPrice",myself::GetProcurementRate(i0,reply));
				myself::FHTML_SetInt(fhtml0,"CurrentProcureType",myself::GetProcurementType(i0,reply));
				myself::FHTML_SetInt(fhtml0,"NextSeedCount",myself::GetNextSeedSellCountSet(i0,reply));
				myself::FHTML_SetInt(fhtml0,"NextSeedPrice",myself::GetNextSeedPrice(i0,reply));
				myself::FHTML_SetInt(fhtml0,"NextProcureCount",myself::GetNextProcurementCount(i0,reply));
				myself::FHTML_SetInt(fhtml0,"NextProcurePrice",myself::GetNextProcurementRate(i0,reply));
				myself::FHTML_SetInt(fhtml0,"NextProcureType",myself::GetNextProcurementType(i0,reply));
				myself::FHTML_SetInt(fhtml0,"manorid",i0);
				myself::FHTML_SetInt(fhtml0,"cropid",reply);
				myself::ShowFHTML(talker,fhtml0);
			} else {
				myself::ShowPage(talker,fnNoAuthority);
			}
		} else if( ask == -252 && myself::IsManorSettingTime() == 0 ) {
			myself::FHTML_SetFileName(fhtml0,"manor_timeinfo_lord.htm");
			myself::ShowFHTML(talker,fhtml0);
		} else if( ask == -253 ) {
			if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,17) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
				i0 = myself::GetCookie(talker,"ManorId");
				i1 = ( ( i0 * 10 ) + reply );
				if( state == 1 ) {
					myself::FHTML_SetFileName(fhtml0,"manormanage" + i1 + ".htm");
					for(i2 = 1; i2 <= 25; i2++) {
						myself::FHTML_SetInt(fhtml0,"CurrentCropProcureCount" + i2,myself::GetProcurementCount(i0,i2));
						myself::FHTML_SetInt(fhtml0,"RemainCropCount" + i2,myself::GetRemainProcureCropCount(i0,i2));
						myself::FHTML_SetInt(fhtml0,"CurrentCropPrice" + i2,myself::GetProcurementRate(i0,i2));
						myself::FHTML_SetInt(fhtml0,"CurrentProcureType" + i2,myself::GetProcurementType(i0,i2));
					}
				} else if( state == 2 ) {
					myself::FHTML_SetFileName(fhtml0,"im_manormanage" + i1 + ".htm");
					for(i2 = 1; i2 <= 25; i2++) {
						myself::FHTML_SetInt(fhtml0,"CurrentCropProcureCount" + i2,myself::GetProcurementCount(i0,i2));
						myself::FHTML_SetInt(fhtml0,"RemainCropCount" + i2,myself::GetRemainProcureCropCount(i0,i2));
						myself::FHTML_SetInt(fhtml0,"CurrentCropPrice" + i2,myself::GetProcurementRate(i0,i2));
						myself::FHTML_SetInt(fhtml0,"CurrentProcureType" + i2,myself::GetProcurementType(i0,i2));
					}
				}
				myself::ShowFHTML(talker,fhtml0);
			} else {
				myself::ShowPage(talker,fnNoAuthority);
			}
		} else if( ask == -255 ) {
			if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,17) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
				i0 = reply;
				myself::FHTML_SetFileName(fhtml0,"manormanage" + reply + "3.htm");
				for(i2 = 1; i2 <= 25; i2++) {
					myself::FHTML_SetInt(fhtml0,"NextSeedCount" + i2,myself::GetNextSeedSellCountSet(i0,i2));
					myself::FHTML_SetInt(fhtml0,"NextSeedPrice" + i2,myself::GetNextSeedPrice(i0,i2));
				}
				myself::ShowFHTML(talker,fhtml0);
			} else {
				myself::ShowPage(talker,fnNoAuthority);
			}
		} else if( ask == -257 ) {
			if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,17) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
				i0 = reply;
				myself::FHTML_SetFileName(fhtml0,"im_manormanage" + reply + "3.htm");
				for(i2 = 1; i2 <= 25; i2++) {
					myself::FHTML_SetInt(fhtml0,"NextSeedCount" + i2,myself::GetNextSeedSellCountSet(i0,i2));
					myself::FHTML_SetInt(fhtml0,"NextSeedPrice" + i2,myself::GetNextSeedPrice(i0,i2));
				}
				myself::ShowFHTML(talker,fhtml0);
			} else {
				myself::ShowPage(talker,fnNoAuthority);
			}
		} else if( ask == -256 ) {
			if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,17) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
				i0 = reply;
				if( state == 1 ) {
					myself::FHTML_SetFileName(fhtml0,"manormanage" + reply + "3.htm");
				} else if( state == 2 ) {
					myself::FHTML_SetFileName(fhtml0,"im_manormanage" + reply + "3.htm");
				}
				for(i2 = 1; i2 <= 25; i2++) {
					myself::FHTML_SetInt(fhtml0,"NextSeedCount" + i2,myself::GetNextSeedSellCountSet(i0,i2));
					myself::FHTML_SetInt(fhtml0,"NextSeedPrice" + i2,myself::GetNextSeedPrice(i0,i2));
				}
				myself::ShowFHTML(talker,fhtml0);
			} else {
				myself::ShowPage(talker,fnNoAuthority);
			}
		} else if( ask == -260 ) {
			if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,19) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
				if( myself::Castle_IsUnderSiege() || gg::GetDominionWarState(dominion_id) == 5 ) {
					myself::ShowPage(talker,fnSiegeStoppedFunction);
				} else if( gg::GetSSQPart(talker) == 2 ) {
					if( myself::GetSSQStatus() == 1 ) {
						if( myself::GetTicketBuyCount(talker) < ( SSQ_DawnTicketQuantity / SSQ_DawnTicketBundle ) ) {
							if( gg::OwnItemCount(talker,57) >= ( SSQ_DawnTicketPrice * SSQ_DawnTicketBundle ) ) {
								myself::DeleteItem1(talker,57,( SSQ_DawnTicketPrice * SSQ_DawnTicketBundle ));
								myself::GiveItem1(talker,6388,SSQ_DawnTicketBundle);
								myself::SetTicketBuyCount(talker,( myself::GetTicketBuyCount(talker) + 1 ));
							} else {
								myself::ShowPage(talker,fnNotEnoughMoney);
							}
						} else {
							myself::ShowPage(talker,fnNotEnoughTicket);
						}
					} else {
						myself::ShowPage(talker,fnNotDawnOrEvent);
					}
				} else {
					myself::ShowPage(talker,fnNotDawnOrEvent);
				}
			} else {
				myself::ShowPage(talker,fnNoAuthority);
			}
		} else if( ask == -270 ) {
			if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,ppManage) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
				i0 = gg::FloatToInt(( reply / 1000 ));
				i1 = ( reply - ( i0 * 1000 ) );
				if( i1 == 0 ) {
					myself::FHTML_SetFileName(fhtml0,fnDecoReset);
					myself::FHTML_SetInt(fhtml0,"AgitDecoSubmit",reply);
				} else if( myself::Agit_GetDecoLevel(i0) == i1 ) {
					myself::FHTML_SetFileName(fhtml0,fnDecoAlreadySet);
				} else {
					myself::FHTML_SetFileName(fhtml0,"ol_mahum_" + fileSetName + "__" + gg::IntToStr(i0) + ".htm");
					myself::FHTML_SetStr(fhtml0,"AgitDecoCost",gg::MakeFString(6,gg::IntToStr(myself::Agit_GetDecoFee(i0,i1)),gg::IntToStr(myself::Agit_GetDecoDay(i0,i1)),"","",""));
					myself::FHTML_SetInt(fhtml0,"AgitDecoSubmit",reply);
				}
				if( i0 == decotype_hpregen ) {
					myself::FHTML_SetStr(fhtml0,"AgitDecoEffect",gg::MakeFString(fstr_percent,gg::IntToStr(( ( i1 - 10 ) * 20 )),"","","",""));
				} else if( i0 == decotype_mpregen ) {
					myself::FHTML_SetStr(fhtml0,"AgitDecoEffect",gg::MakeFString(fstr_percent,gg::IntToStr(( ( i1 - 10 ) * 5 )),"","","",""));
				} else if( i0 == decotype_xprestore ) {
					myself::FHTML_SetStr(fhtml0,"AgitDecoEffect",gg::MakeFString(fstr_percent,gg::IntToStr(( ( i1 - 10 ) * 5 )),"","","",""));
				} else {
					myself::FHTML_SetStr(fhtml0,"AgitDecoEffect",gg::MakeFString(fstr_stage_lv,gg::IntToStr(( i1 - 10 )),"","","",""));
				}
				myself::ShowFHTML(talker,fhtml0);
			} else {
				myself::ShowPage(talker,fnNoAuthority);
			}
		} else if( ask == -271 ) {
			if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,ppManage) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
				i0 = gg::FloatToInt(( reply / 1000 ));
				i1 = ( reply - ( i0 * 1000 ) );
				if( i1 == 0 ) {
					myself::Agit_ResetDeco(talker,i0);
				} else if( gg::OwnItemCount(talker,57) >= myself::Agit_GetDecoFee(i0,i1) ) {
					myself::SetCookie(talker,"AgitDecoFee",myself::Agit_GetDecoFee(i0,i1));
					if( i0 == decotype_buff ) {
						if( i1 > 0 ) {
							i2 = ( 286130177 + ( ( ( i1 - 10 ) * 256 ) * 256 ) );
							if( myself::Skill_GetConsumeMP(i2) < myself.sm.mp && myself::Skill_GetConsumeHP(i2) < myself.sm.hp && myself::Skill_InReuseDelay(i2) == 0 ) {
								myself::AddUseSkillDesire(myself.sm,i2,1,1,1000000);
							}
						} else if( myself::Skill_GetConsumeMP(286195713) < myself.sm.mp && myself::Skill_GetConsumeHP(286195713) < myself.sm.hp && myself::Skill_InReuseDelay(286195713) == 0 ) {
							myself::AddUseSkillDesire(myself.sm,286195713,1,1,1000000);
						}
					}
					myself::Agit_SetDeco(talker,i0,i1);
				} else {
					myself::ShowPage(talker,fnNotEnoughMoney);
				}
			} else {
				myself::ShowPage(talker,fnNoAuthority);
			}
		} else if( ask == -22208 ) {
			if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,ppDecoFunction) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
				if( myself::Skill_GetConsumeMP(reply) < myself.sm.mp ) {
					if( myself::Skill_GetConsumeHP(reply) < myself.sm.hp && myself::Skill_InReuseDelay(reply) == 0 ) {
						switch(reply) {
							case 284557313: {
							}
							case 284557314: {
							}
							case 284622849: {
							}
							case 284622850: {
							}
							case 284622851: {
							}
							case 284688385: {
							}
							case 284688386: {
							}
							case 284688387: {
							}
							case 284753921: {
							}
							case 284753922: {
							}
							case 284753923: {
							}
							case 284819457: {
							}
							case 284819458: {
							}
							case 284819459: {
							}
							case 284819460: {
							}
							case 284884993: {
							}
							case 284884994: {
							}
							case 284884995: {
							}
							case 284884996: {
							}
							case 284884997: {
							}
							case 284884998: {
							}
							case 284950529: {
							}
							case 284950530: {
							}
							case 284950531: {
							}
							case 284950532: {
							}
							case 284950533: {
							}
							case 284950534: {
							}
							case 285016065: {
							}
							case 285016066: {
							}
							case 285081601: {
							}
							case 285081602: {
							}
							case 285081603: {
							}
							case 285081604: {
							}
							case 285147137: {
							}
							case 285147138: {
							}
							case 285147139: {
							}
							case 285147140: {
							}
							case 285147141: {
							}
							case 285147142: {
							}
							case 285212673: {
							}
							case 285212674: {
							}
							case 285278209: {
							}
							case 285278210: {
							}
							case 285278211: {
							}
							case 285278212: {
							}
							case 285278213: {
							}
							case 285278214: {
							}
							case 285343745: {
							}
							case 285343746: {
							}
							case 285343747: {
							}
							case 285343748: {
							}
							case 285409281: {
							}
							case 285409282: {
							}
							case 285409283: {
							}
							case 285474817: {
							}
							case 285474818: {
							}
							case 285474819: {
							}
							case 285540353: {
							}
							case 285540354: {
							}
							case 285605889: {
							}
							case 285605890: {
							}
							case 285605891: {
							}
							case 285671425: {
							}
							case 285671426: {
							}
							case 285671427: {
							}
							case 285736961: {
							}
							case 285736962: {
							}
							case 285736963: {
								myself::CastBuffForAgitManager(talker,reply);
								myself::FHTML_SetFileName(fhtml0,fnAfterBuff);
								break;
							}
						}
					} else {
						myself::FHTML_SetFileName(fhtml0,fnNeedCoolTime);
					}
				} else {
					myself::FHTML_SetFileName(fhtml0,fnNotEnoughMP);
				}
			}
			myself::FHTML_SetInt(fhtml0,"MPLeft",gg::FloatToInt(myself.sm.mp));
			myself::ShowFHTML(talker,fhtml0);
		}
	}

	EventHandler DOOR_HP_LEVEL_INFORMED(talker,level,fhtml0,i0,i1,i2) {
		if( myself::Castle_IsUnderSiege() || gg::GetDominionWarState(dominion_id) == 5 ) {
			myself::ShowPage(talker,fnSiegeStoppedFunction);
		} else if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,23) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
			i0 = myself::GetCookie(talker,"gate_price");
			i1 = myself::GetCookie(talker,"gate_level");
			i2 = myself::GetCookie(talker,"gate_num");
			if( level >= i1 ) {
				myself::FHTML_SetFileName(fhtml0,fnCurrentDoorLevelHigher);
				myself::FHTML_SetInt(fhtml0,"doorlevel",level);
				myself::ShowFHTML(talker,fhtml0);
			} else if( gg::OwnItemCount(talker,57) >= i0 ) {
				myself::DeleteItem1(talker,57,i0);
				switch(i2) {
					case 1: {
						myself::SetDoorHpLevel(DDoorName1_1,i1);
						myself::SetDoorHpLevel(DDoorName1_2,i1);
						break;
					}
					case 2: {
						myself::SetDoorHpLevel(DDoorName2_1,i1);
						myself::SetDoorHpLevel(DDoorName2_2,i1);
						break;
					}
					case 3: {
						myself::SetDoorHpLevel(DDoorName3_1,i1);
						myself::SetDoorHpLevel(DDoorName3_2,i1);
						break;
					}
					case 4: {
						myself::SetDoorHpLevel(DDoorName4_1,i1);
						myself::SetDoorHpLevel(DDoorName4_2,i1);
						break;
					}
					case 21: {
						myself::SetDoorHpLevel(WallName1,i1);
						myself::SetDoorHpLevel(WallName2,i1);
						break;
					}
					case 22: {
						myself::SetDoorHpLevel(WallName3,i1);
						break;
					}
				}
				myself::ShowPage(talker,fnDoorHpLevelUp);
			} else {
				myself::ShowPage(talker,fnNotEnoughMoney);
			}
		} else {
			myself::ShowPage(talker,fnNoAuthority);
		}
	}

	EventHandler CONTROLTOWER_LEVEL_INFORMED(talker,level,fhtml0,i0,i1,i2) {
		if( myself::Castle_IsUnderSiege() || gg::GetDominionWarState(dominion_id) == 5 ) {
			myself::ShowPage(talker,fnSiegeStoppedFunction);
		} else if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,23) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
			i0 = myself::GetCookie(talker,"dmgzone_price");
			i1 = myself::GetCookie(talker,"dmgzone_level");
			i2 = myself::GetCookie(talker,"dmgzone_num");
			if( level >= ( 2 * i1 ) ) {
				myself::FHTML_SetFileName(fhtml0,fnCurrentDmgzoneLevelHigher);
				myself::FHTML_SetInt(fhtml0,"dmglevel",( level / 2 ));
				myself::ShowFHTML(talker,fhtml0);
			} else if( gg::OwnItemCount(talker,57) >= i0 ) {
				myself::DeleteItem1(talker,57,i0);
				switch(i2) {
					case 1: {
						myself::SetControlTowerLevel(dmgzonename1,( 2 * i1 ));
						break;
					}
					case 2: {
						myself::SetControlTowerLevel(dmgzonename2,( 2 * i1 ));
						break;
					}
				}
				myself::ShowPage(talker,fnDmgZoneLevelUp);
			} else {
				myself::ShowPage(talker,fnNotEnoughMoney);
			}
		} else {
			myself::ShowPage(talker,fnNoAuthority);
		}
	}

	EventHandler MANOR_MENU_SELECTED(talker,ask,state,time) {
		if( state == -1 ) {
			state = myself.sm.residence_id;
		}
		if( ask == 3 ) {
			myself::ShowSeedInfo(talker,state,time);
		} else if( ask == 4 ) {
			myself::ShowCropInfo(talker,state,time);
		} else if( ask == 5 ) {
			myself::ShowManorDefaultInfo(talker);
		} else if( ask == 7 ) {
			myself::ShowSeedSetting(talker,state);
		} else if( ask == 8 ) {
			myself::ShowCropSetting(talker,state);
		}
	}

	EventHandler TELEPORT_REQUESTED(talker) {
		if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,ppSetGate) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
			if( myself::Agit_GetDecoLevel(decotype_teleport) == 11 ) {
				myself::Teleport(talker,Position1,ShopName,"","","",57,"");
			} else if( myself::Agit_GetDecoLevel(decotype_teleport) == 12 ) {
				myself::Teleport(talker,Position2,ShopName,"","","",57,"");
			} else {
				myself::ShowPage(talker,fnFuncDisabled);
			}
		} else {
			myself::ShowPage(talker,fnNoAuthority);
		}
	}

	EventHandler SET_AGIT_DECO_RETURNED(talker,reply) {
		if( reply ) {
			if( gg::OwnItemCount(talker,57) >= myself::GetCookie(talker,"AgitDecoFee") ) {
				myself::DeleteItem1(talker,57,myself::GetCookie(talker,"AgitDecoFee"));
				myself::ShowPage(talker,fnAfterSetDeco);
			} else {
				myself::ShowPage(talker,fnNotEnoughMoney);
			}
		} else {
			myself::ShowPage(talker,fnFailtoSetDeco);
		}
	}

	EventHandler RESET_AGIT_DECO_RETURNED(talker,reply) {
		if( reply ) {
			myself::ShowPage(talker,fnAfterResetDeco);
		} else {
			myself::ShowPage(talker,fnFailtoResetDeco);
		}
	}

	EventHandler TIMER_FIRED_EX(timer_id,i0) {
		if( timer_id == 1077 ) {
			if( myself::Agit_GetDecoLevel(decotype_buff) > 0 ) {
				i0 = ( 286130177 + ( ( ( myself::Agit_GetDecoLevel(decotype_buff) - 10 ) * 256 ) * 256 ) );
				if( myself::Skill_GetConsumeMP(i0) < myself.sm.mp && myself::Skill_GetConsumeHP(i0) < myself.sm.hp && myself::Skill_InReuseDelay(i0) == 0 ) {
					myself::AddUseSkillDesire(myself.sm,i0,1,1,1000000);
				}
			} else if( myself::Skill_GetConsumeMP(286195713) < myself.sm.mp && myself::Skill_GetConsumeHP(286195713) < myself.sm.hp && myself::Skill_InReuseDelay(286195713) == 0 ) {
				myself::AddUseSkillDesire(myself.sm,286195713,1,1,1000000);
			}
			myself::AddTimerEx(1077,300000);
		}
		super;
	}

	EventHandler GET_RELATED_FORTRESS_LIST_RETURNED(talker,i0,i1,i2,i3,i4,i5,i6,i7,i8,fhtml0) {
		myself::FHTML_SetFileName(fhtml0,fnMyFortressStatus);
		if( i0 > 100 ) {
			i5 = gg::Fortress_GetContractStatus(i0);
			i6 = ( ( fortress_fstr + i0 ) - 101 );
			i7 = ( fortress_status + i5 );
			i8 = ( fortress_dependancy + myself::Fortress_IsInBoundary(i0) );
			myself::FHTML_SetStr(fhtml0,"name_fortress1",gg::MakeFString(i6,"","","","",""));
			myself::FHTML_SetStr(fhtml0,"status_fortress1",gg::MakeFString(i7,"","","","",""));
			myself::FHTML_SetStr(fhtml0,"boundary_fortress1",gg::MakeFString(i8,"","","","",""));
			i5 = 0;
			i6 = 0;
			i7 = 0;
			i8 = 0;
		}
		if( i1 > 100 ) {
			i5 = gg::Fortress_GetContractStatus(i1);
			i6 = ( ( fortress_fstr + i1 ) - 101 );
			i7 = ( fortress_status + i5 );
			i8 = ( fortress_dependancy + myself::Fortress_IsInBoundary(i1) );
			myself::FHTML_SetStr(fhtml0,"name_fortress2",gg::MakeFString(i6,"","","","",""));
			myself::FHTML_SetStr(fhtml0,"status_fortress2",gg::MakeFString(i7,"","","","",""));
			myself::FHTML_SetStr(fhtml0,"boundary_fortress2",gg::MakeFString(i8,"","","","",""));
			i5 = 0;
			i6 = 0;
			i7 = 0;
			i8 = 0;
		}
		if( i2 > 100 ) {
			i5 = gg::Fortress_GetContractStatus(i2);
			i6 = ( ( fortress_fstr + i2 ) - 101 );
			i7 = ( fortress_status + i5 );
			i8 = ( fortress_dependancy + myself::Fortress_IsInBoundary(i2) );
			myself::FHTML_SetStr(fhtml0,"name_fortress3",gg::MakeFString(i6,"","","","",""));
			myself::FHTML_SetStr(fhtml0,"status_fortress3",gg::MakeFString(i7,"","","","",""));
			myself::FHTML_SetStr(fhtml0,"boundary_fortress3",gg::MakeFString(i8,"","","","",""));
			i5 = 0;
			i6 = 0;
			i7 = 0;
			i8 = 0;
		}
		if( i3 > 100 ) {
			i5 = gg::Fortress_GetContractStatus(i3);
			i6 = ( ( fortress_fstr + i3 ) - 101 );
			i7 = ( fortress_status + i5 );
			i8 = ( fortress_dependancy + myself::Fortress_IsInBoundary(i3) );
			myself::FHTML_SetStr(fhtml0,"name_fortress4",gg::MakeFString(i6,"","","","",""));
			myself::FHTML_SetStr(fhtml0,"status_fortress4",gg::MakeFString(i7,"","","","",""));
			myself::FHTML_SetStr(fhtml0,"boundary_fortress4",gg::MakeFString(i8,"","","","",""));
			i5 = 0;
			i6 = 0;
			i7 = 0;
			i8 = 0;
		}
		if( i4 > 100 ) {
			i5 = gg::Fortress_GetContractStatus(i4);
			i6 = ( ( fortress_fstr + i4 ) - 101 );
			i7 = ( fortress_status + i5 );
			i8 = ( fortress_dependancy + myself::Fortress_IsInBoundary(i4) );
			myself::FHTML_SetStr(fhtml0,"name_fortress5",gg::MakeFString(i6,"","","","",""));
			myself::FHTML_SetStr(fhtml0,"status_fortress5",gg::MakeFString(i7,"","","","",""));
			myself::FHTML_SetStr(fhtml0,"boundary_fortress5",gg::MakeFString(i8,"","","","",""));
			i5 = 0;
			i6 = 0;
			i7 = 0;
			i8 = 0;
		}
		myself::ShowFHTML(talker,fhtml0);
	}

}
