@LabelIndex 101399
@StringIndex 11672
class 0 extended_door_trap : auto_door_trap {
parameter:
	string	DoorName = "extended_door_trap_door_default_1";
	string	DoorName2 = "extended_door_trap_door_default_2";
	string	DoorName3 = "extended_door_trap_door_default_3";
	string	DoorName4 = "extended_door_trap_door_default_4";
	string	DoorName5 = "extended_door_trap_door_default_5";
	string	MeshName = "";
	int	IsDetected = 0;
	int	IsDefused = 0;
	int	IsItemCheck = 0;
	int	RemoveItem = 0;
	int	DoorItem = 0;
	int	DoorCloseTime = 0;
	string	areadata = "extended_door_trap_area_default";
	int	mesh_index = -1;
	int	targetable = 0;
	int	IsDespawn = 0;
	int	OpenMultipleDoor = 0;
	int	script_event_num = -1;
	int	script_event_door = 0;
	int	fortress_use = 0;
	int	fortress_id = -1;

handler:
	EventHandler CREATED() {
		myself.c_ai0 = gg::GetNullCreature();
		super;
	}

	EventHandler TRAP_STEP_IN(i0,i1,c0,i2) {
		c0 = gg::GetCreatureFromID(i0);
		if( IsItemCheck == 1 ) {
			if( gg::OwnItemCount(c0,DoorItem) >= 1 ) {
				if( gg::IsSameString(areadata,"extended_door_trap_area_default") == 0 ) {
					gg::Area_SetOnOffEx(areadata,1,myself::InstantZone_GetId());
				}
				if( mesh_index > -1 ) {
					myself::SetStaticMeshStatus(c0,MeshName,targetable,mesh_index);
					myself.c_ai0 = c0;
				}
				if( gg::IsSameString(DoorName,"extended_door_trap_door_default_1") == 0 ) {
					i2 = myself::InstantZone_GetId();
					gg::Castle_GateOpenCloseEx(DoorName,0,i2);
				}
				if( gg::IsSameString(DoorName2,"extended_door_trap_door_default_2") == 0 ) {
					i2 = myself::InstantZone_GetId();
					gg::Castle_GateOpenCloseEx(DoorName2,0,i2);
				}
				if( gg::IsSameString(DoorName3,"extended_door_trap_door_default_3") == 0 ) {
					i2 = myself::InstantZone_GetId();
					gg::Castle_GateOpenCloseEx(DoorName3,0,i2);
				}
				if( gg::IsSameString(DoorName4,"extended_door_trap_door_default_4") == 0 ) {
					i2 = myself::InstantZone_GetId();
					gg::Castle_GateOpenCloseEx(DoorName4,0,i2);
				}
				if( gg::IsSameString(DoorName5,"extended_door_trap_door_default_5") == 0 ) {
					i2 = myself::InstantZone_GetId();
					gg::Castle_GateOpenCloseEx(DoorName5,0,i2);
				}
				if( RemoveItem == 1 ) {
					myself::DeleteItem1(c0,DoorItem,1);
				}
				if( IsDespawn == 1 ) {
					myself::DefuseWorldTrapByClassId(myself.sm.id,myself.sm.class_id);
					if( timer > 0 ) {
						myself::AddTimerEx(1001,( timer * 1000 ));
					}
				}
				if( DoorCloseTime > 0 ) {
					myself::AddTimerEx(2001,( DoorCloseTime * 1000 ));
				}
			}
		} else if( OpenMultipleDoor == 1 ) {
			if( gg::IsSameString(areadata,"extended_door_trap_area_default") == 0 ) {
				gg::Area_SetOnOffEx(areadata,1,myself::InstantZone_GetId());
			}
			if( mesh_index > -1 ) {
				myself::SetStaticMeshStatus(c0,MeshName,targetable,mesh_index);
				myself.c_ai0 = c0;
			}
			if( gg::IsSameString(DoorName,"extended_door_trap_door_default_1") == 0 ) {
				i2 = myself::InstantZone_GetId();
				gg::Castle_GateOpenCloseEx(DoorName,0,i2);
			}
			if( gg::IsSameString(DoorName2,"extended_door_trap_door_default_2") == 0 ) {
				i2 = myself::InstantZone_GetId();
				gg::Castle_GateOpenCloseEx(DoorName2,0,i2);
			}
			if( gg::IsSameString(DoorName3,"extended_door_trap_door_default_3") == 0 ) {
				i2 = myself::InstantZone_GetId();
				gg::Castle_GateOpenCloseEx(DoorName3,0,i2);
			}
			if( gg::IsSameString(DoorName4,"extended_door_trap_door_default_4") == 0 ) {
				i2 = myself::InstantZone_GetId();
				gg::Castle_GateOpenCloseEx(DoorName4,0,i2);
			}
			if( gg::IsSameString(DoorName5,"extended_door_trap_door_default_5") == 0 ) {
				i2 = myself::InstantZone_GetId();
				gg::Castle_GateOpenCloseEx(DoorName5,0,i2);
			}
			if( IsDespawn == 1 ) {
				myself::DefuseWorldTrapByClassId(myself.sm.id,myself.sm.class_id);
				if( timer > 0 ) {
					myself::AddTimerEx(1001,( timer * 1000 ));
				}
			}
			if( DoorCloseTime > 0 ) {
				myself::AddTimerEx(2001,( DoorCloseTime * 1000 ));
			}
		}
	}

	EventHandler TIMER_FIRED_EX(timer_id,i2) {
		if( timer_id == 2001 ) {
			if( gg::IsSameString(areadata,"extended_door_trap_area_default") == 0 ) {
				gg::Area_SetOnOffEx(areadata,0,myself::InstantZone_GetId());
			}
			if( mesh_index > -1 ) {
				myself::SetStaticMeshStatus(myself.c_ai0,MeshName,targetable,0);
			}
			if( gg::IsSameString(DoorName,"extended_door_trap_door_default_1") == 0 ) {
				i2 = myself::InstantZone_GetId();
				gg::Castle_GateOpenCloseEx(DoorName,1,i2);
			}
			if( gg::IsSameString(DoorName2,"extended_door_trap_door_default_2") == 0 ) {
				i2 = myself::InstantZone_GetId();
				gg::Castle_GateOpenCloseEx(DoorName2,1,i2);
			}
			if( gg::IsSameString(DoorName3,"extended_door_trap_door_default_3") == 0 ) {
				i2 = myself::InstantZone_GetId();
				gg::Castle_GateOpenCloseEx(DoorName3,1,i2);
			}
			if( gg::IsSameString(DoorName4,"extended_door_trap_door_default_4") == 0 ) {
				i2 = myself::InstantZone_GetId();
				gg::Castle_GateOpenCloseEx(DoorName4,1,i2);
			}
			if( gg::IsSameString(DoorName5,"extended_door_trap_door_default_5") == 0 ) {
				i2 = myself::InstantZone_GetId();
				gg::Castle_GateOpenCloseEx(DoorName5,1,i2);
			}
			if( IsDespawn == 2 ) {
				myself::DefuseWorldTrapByClassId(myself.sm.id,myself.sm.class_id);
				if( timer > 0 ) {
					myself::AddTimerEx(1001,( timer * 1000 ));
				}
			}
		}
		super;
	}

	EventHandler SCRIPT_EVENT(script_event_arg1,script_event_arg2,i2) {
		if( fortress_use == 1 && fortress_id > -1 ) {
			if( gg::Fortress_GetOwnerPledgeId(fortress_id) > 0 ) {
				return;
			}
		}
		if( script_event_arg1 == script_event_num ) {
			if( gg::IsSameString(DoorName,"extended_door_trap_door_default_1") == 0 ) {
				i2 = myself::InstantZone_GetId();
				gg::Castle_GateOpenCloseEx(DoorName,script_event_door,i2);
			}
			if( gg::IsSameString(DoorName2,"extended_door_trap_door_default_2") == 0 ) {
				i2 = myself::InstantZone_GetId();
				gg::Castle_GateOpenCloseEx(DoorName2,script_event_door,i2);
			}
			if( gg::IsSameString(DoorName3,"extended_door_trap_door_default_3") == 0 ) {
				i2 = myself::InstantZone_GetId();
				gg::Castle_GateOpenCloseEx(DoorName3,script_event_door,i2);
			}
			if( gg::IsSameString(DoorName4,"extended_door_trap_door_default_4") == 0 ) {
				i2 = myself::InstantZone_GetId();
				gg::Castle_GateOpenCloseEx(DoorName4,script_event_door,i2);
			}
			if( gg::IsSameString(DoorName5,"extended_door_trap_door_default_5") == 0 ) {
				i2 = myself::InstantZone_GetId();
				gg::Castle_GateOpenCloseEx(DoorName5,script_event_door,i2);
			}
		}
	}

}
