@LabelIndex 12218
@StringIndex 0
class 0 agit_doorkeeper : doorkeeper {
handler:
	EventHandler TALKED(talker) {
		if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,11) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
			if( myself::Castle_IsUnderSiege() ) {
				myself::ShowPage(talker,fnUnderSiege);
			} else {
				myself::ShowPage(talker,fnHi);
			}
		} else {
			myself::ShowPage(talker,fnNotMyLord);
		}
	}

	EventHandler MENU_SELECTED(talker,ask,reply,fhtml0) {
		if( ask == -201 ) {
			if( myself::IsMyLord(talker) || ( myself::HavePledgePower(talker,11) && myself::Castle_GetPledgeId() == talker.pledge_id && talker.pledge_id != 0 ) ) {
				if( myself::Castle_IsUnderSiege() ) {
					myself::ShowPage(talker,fnUnderSiege);
				} else {
					switch(reply) {
						case 1: {
							gg::Castle_GateOpenClose2(DoorName1,0);
							gg::Castle_GateOpenClose2(DoorName2,0);
							break;
						}
						case 2: {
							gg::Castle_GateOpenClose2(DoorName1,1);
							gg::Castle_GateOpenClose2(DoorName2,1);
							break;
						}
					}
				}
			} else {
				myself::ShowPage(talker,fnNotMyLord);
			}
		}
	}

}
