@LabelIndex 9540
@StringIndex 1988
class 0 mass_teleporter : delayed_teleporter {
parameter:
	string	fnBrokenCtrlTower = "thi.htm";
	string	fnTeleportDelayed = "CastleTeleportDelayed.htm";
	int	pos_x1 = 1;
	int	pos_y1 = 1;
	int	pos_z1 = 1;

handler:
	EventHandler CREATED() {
		myself.i_ai0 = 0;
	}

	EventHandler TALKED(talker) {
		if( myself.i_ai0 == 0 ) {
			if( myself::Castle_IsUnderSiege() && myself::Castle_GetLifeControlLevel() == 0 ) {
				myself::ShowPage(talker,fnBrokenCtrlTower);
			} else {
				myself::ShowPage(talker,fnHi);
			}
		} else {
			myself::ShowPage(talker,fnTeleportDelayed);
		}
	}

	EventHandler TELEPORT_REQUESTED(talker) {
		if( myself.i_ai0 == 0 ) {
			if( myself::Castle_IsUnderSiege() && myself::Castle_GetLifeControlLevel() == 0 ) {
				myself::AddTimerEx(1001,480000);
			} else {
				myself::AddTimerEx(1001,30000);
			}
			myself.i_ai0 = 1;
		}
		myself::ShowPage(talker,fnTeleportDelayed);
	}

	EventHandler TIMER_FIRED_EX(timer_id) {
		if( timer_id == 1001 ) {
			myself.i_ai0 = 0;
			myself::InstantTeleportInMyTerritory(pos_x1,pos_y1,pos_z1,200);
			myself::Shout(gg::MakeFString(1000443,gg::MakeFString(( 1001000 + myself.sm.residence_id ),"","","","",""),"","","",""));
		}
	}

}
