@LabelIndex 111578
@StringIndex 0
class 0 npc_bridge_controller : default_npc {
parameter:
	string	second_door1 = "darion_raid_b_001";
	string	second_door2 = "darion_raid_b_002";
	string	third_door1 = "darion_raid_c_001";
	string	third_door2 = "darion_raid_c_002";
	string	bridge_a = "darion_raid_c_003";
	string	bridge_b = "darion_raid_b_003";
	string	secret_a = "darion_raid_b_004";
	string	secret_b = "darion_raid_c_004";

handler:
	EventHandler CREATED(i0) {
		myself.i_ai0 = 0;
		i0 = myself::GetGlobalMap(12);
		if( i0 == -1 ) {
			if( myself.i_ai0 == 0 ) {
				gg::Castle_GateOpenClose2(second_door1,0);
				gg::Castle_GateOpenClose2(second_door2,0);
				myself::AddTimerEx(2000,1000);
				myself.i_ai0 = 1;
			} else {
			}
		} else if( myself.i_ai0 == 0 ) {
		} else {
			gg::Castle_GateOpenClose2(secret_a,1);
			gg::Castle_GateOpenClose2(secret_b,1);
			myself::AddTimerEx(3001,2000);
			myself.i_ai0 = 0;
		}
	}

	EventHandler TIMER_FIRED_EX(timer_id,i0) {
		if( timer_id == 2000 ) {
			gg::Castle_GateOpenClose2(third_door1,0);
			gg::Castle_GateOpenClose2(third_door2,0);
			myself::AddTimerEx(2001,1000);
		}
		if( timer_id == 2001 ) {
			gg::Castle_GateOpenClose2(bridge_a,1);
			myself::AddTimerEx(2002,3000);
		}
		if( timer_id == 2002 ) {
			gg::Castle_GateOpenClose2(bridge_b,1);
			myself::AddTimerEx(2003,5000);
		}
		if( timer_id == 2003 ) {
			gg::Castle_GateOpenClose2(secret_a,0);
			gg::Castle_GateOpenClose2(secret_b,0);
		}
		if( timer_id == 3001 ) {
			myself::InstantTeleportInMyTerritory(17259,244334,11616,100);
			myself::AddTimerEx(3002,50);
		}
		if( timer_id == 3002 ) {
			gg::Castle_GateOpenClose2(bridge_a,0);
			gg::Castle_GateOpenClose2(bridge_b,0);
			myself::AddTimerEx(3003,3000);
		}
		if( timer_id == 3003 ) {
			gg::Castle_GateOpenClose2(second_door1,1);
			gg::Castle_GateOpenClose2(second_door2,1);
			gg::Castle_GateOpenClose2(third_door1,1);
			gg::Castle_GateOpenClose2(third_door2,1);
		}
	}

	EventHandler SCRIPT_EVENT(script_event_arg1,script_event_arg2) {
		if( script_event_arg1 == 0 ) {
			gg::Castle_GateOpenClose2(secret_a,1);
			gg::Castle_GateOpenClose2(secret_b,1);
			myself::AddTimerEx(3001,1000);
		} else if( script_event_arg1 == 1 ) {
			gg::Castle_GateOpenClose2(second_door1,0);
			gg::Castle_GateOpenClose2(second_door2,0);
			myself::AddTimerEx(2000,2000);
		}
		super;
	}

}
