importonly struct InputTriggerState
{
	public import static function GetValueRaw( state : InputTriggerState ) : Float;
	public import static function GetPressRaw( state : InputTriggerState ) : Bool;
	public import static function GetPressedRaw( state : InputTriggerState ) : Bool;
	public import static function GetReleaseRaw( state : InputTriggerState ) : Bool;
}

importonly abstract class gameIGameAudioSystem extends IGameSystem
{
}

import final class AudioSystem extends gameIGameAudioSystem
{
	private var m_enemyPingStimCount : Uint8;
	default m_enemyPingStimCount = 0;
	private var m_mixHasDetectedCombat : Bool;
	default m_mixHasDetectedCombat = false;

	public import function Play( eventName : CName, optional entityID : EntityID, optional emitterName : CName );
	public import function Stop( eventName : CName, optional entityID : EntityID, optional emitterName : CName );
	public import function Switch( switchName : CName, switchValue : CName, optional entityID : EntityID, optional emitterName : CName );
	public import function Parameter( parameterName : CName, parameterValue : Float, optional entityID : EntityID, optional emitterName : CName );
	public import function PlayImpact( impactContext : CName, position : Vector4, object : GameObject );
	public import function PlayOnEmitter( eventName : CName, entityID : EntityID, emitterName : CName );
	public import function State( stateGroup : String, state : String );
	public import function GlobalParameter( parameterName : CName, parameterValue : Float );
	public import function PlayShockwave( shockwaveType : CName, position : Vector4 );
	public import function OpenAcousticPortal( object : GameObject );
	public import function CloseAcousticPortal( object : GameObject );
	public import function NotifyGameTone( eventName : CName );
	public import function RequestSongOnRadioStation( stationName : CName, songName : CName );
	public import function RequestSongOnPlaylist( playlistName : CName, songName : CName );
	public import function GetPlaylistSongs( playlistName : CName ) : array< CName >;
	public import function GetPlaylistCurrentSong( playlistName : CName ) : CName;
	public import function SetInScanningMode( inScanningMode : Bool );
	public import function IsInScanningMode() : Bool;
	public import function SetTriggerEffectMode( effect : CName ) : Uint16;
	public import function ReplaceTriggerEffectMode( id : Uint16, effect : CName );
	public import function SetTriggerEffectModeTimed( effect : CName, time : Float ) : Uint16;
	public import function UnsetTriggerEffectMode( id : Uint16 );
	public import function GetLeftTriggerState() : InputTriggerState;
	public import function GetRightTriggerState() : InputTriggerState;
	public import function RegisterEnemyPingStim( enemyState : gamedataNPCHighLevelState, isPoliceman : Bool );
	public import function RegisterPreventionHeatStage( preventionHeatStage : Uint8 );
	public import function SetBDCameraListenerOverride( value : Bool );
	public import function VoIsPerceptible( entityId : EntityID ) : Bool;
	public import function TriggerFlyby( position : Vector4, direction : Vector4, startPosition : Vector4, object : GameObject );
	public import function AddTriggerEffect( effectName : CName, label : CName );
	public import function ReplaceTriggerEffect( effectName : CName, label : CName, optional createIfNotPresent : Bool );
	public import function RevertTriggerEffect( label : CName );
	public import function RemoveTriggerEffect( label : CName );
	public import function RemoveAllTriggerEffects();
	public import function EquipNewFootwearByPlayer( itemID : ItemID );
	public import function EquipNewOutfitByPlayer( itemID : ItemID );
	public import function UnequipOutfitByPlayer( itemID : ItemID );
	public import function GetMeleeChargedAttackMinimumValue( configName : CName ) : Float;

	public function PlayLootAllSound()
	{
		Play( 'ui_loot_take_all' );
	}

	public function PlayItemActionSound( action : CName, itemData : weak< gameItemData > )
	{
		if( action == 'Loot' )
		{
			PlayItemLootedSound( itemData );
		}
		else if( action == 'Eat' )
		{
			Play( 'ui_loot_eat' );
		}
		else if( action == 'Drink' )
		{
			Play( 'ui_loot_drink' );
		}
		else if( action == 'Consume' )
		{
			Play( 'ui_menu_item_consumable_generic' );
		}
	}

	private function PlayItemLootedSound( itemData : weak< gameItemData > )
	{
		var itemQuality : gamedataQuality;
		var itemType : gamedataItemType;
		var itemCategory : gamedataItemCategory;
		var itemIconic : Bool;
		var eventName : CName;
		itemQuality = RPGManager.GetItemDataQuality( itemData );
		itemCategory = RPGManager.GetItemCategory( itemData.GetID() );
		itemType = itemData.GetItemType();
		itemIconic = RPGManager.IsItemIconic( itemData );
		if( ( itemType == gamedataItemType.Invalid && itemCategory == gamedataItemCategory.Invalid ) && itemQuality == gamedataQuality.Invalid )
		{
			return;
		}
		if( itemType == gamedataItemType.Con_Ammo )
		{
			eventName = 'ui_loot_ammo';
		}
		else if( ( itemType == gamedataItemType.Gen_Readable || itemType == gamedataItemType.Con_Inhaler ) || itemType == gamedataItemType.Con_Injector )
		{
			eventName = 'ui_loot_additional';
		}
		else if( itemCategory == gamedataItemCategory.Cyberware || ( itemType == gamedataItemType.Prt_Fragment || itemCategory == gamedataItemCategory.WeaponMod ) )
		{
			eventName = 'ui_loot_cyberware';
		}
		else if( itemCategory == gamedataItemCategory.Weapon )
		{
			if( ( ( ( ( ( ( ( ( ( itemType == gamedataItemType.Wea_Melee || itemType == gamedataItemType.Wea_Hammer ) || itemType == gamedataItemType.Wea_Katana ) || itemType == gamedataItemType.Wea_Knife ) || itemType == gamedataItemType.Wea_LongBlade ) || itemType == gamedataItemType.Wea_OneHandedClub ) || itemType == gamedataItemType.Wea_TwoHandedClub ) || itemType == gamedataItemType.Wea_Axe ) || itemType == gamedataItemType.Wea_Chainsword ) || itemType == gamedataItemType.Wea_Machete ) || itemType == gamedataItemType.Wea_Sword )
			{
				eventName = 'ui_loot_melee';
			}
			else
			{
				eventName = 'ui_loot_gun';
			}
		}
		else if( itemCategory == gamedataItemCategory.Clothing )
		{
			if( itemType == gamedataItemType.Clo_Head || itemType == gamedataItemType.Clo_Face )
			{
				eventName = 'ui_loot_head';
			}
			else if( itemType == gamedataItemType.Clo_Legs || itemType == gamedataItemType.Clo_Feet )
			{
				eventName = 'ui_loot_lower_body';
			}
			else if( ( itemType == gamedataItemType.Clo_Outfit || itemType == gamedataItemType.Clo_OuterChest ) || itemType == gamedataItemType.Clo_InnerChest )
			{
				eventName = 'ui_loot_upper_body';
			}
		}
		else if( itemData.HasTag( 'Currency' ) || itemData.HasTag( 'MoneyShard' ) )
		{
			eventName = 'ui_loot_cash_picking';
		}
		else
		{
			eventName = 'ui_loot_generic';
		}
		Play( eventName );
		if( itemQuality == gamedataQuality.Legendary || itemIconic )
		{
			Play( 'ui_loot_rarity_legendary' );
		}
		else if( itemQuality == gamedataQuality.Epic )
		{
			Play( 'ui_loot_rarity_epic' );
		}
	}

	public function HandleDynamicMixAreaEnter( localPlayer : GameObject )
	{
		m_enemyPingStimCount += 1;
		if( m_enemyPingStimCount == 1 )
		{
			localPlayer.GetStimBroadcasterComponent().AddActiveStimuli( localPlayer, gamedataStimType.AudioEnemyPing, -1.0 );
		}
	}

	public function HandleDynamicMixAreaExit( localPlayer : GameObject )
	{
		if( m_enemyPingStimCount > 0 )
		{
			m_enemyPingStimCount -= 1;
			if( m_enemyPingStimCount == 0 )
			{
				localPlayer.GetStimBroadcasterComponent().RemoveActiveStimuliByName( localPlayer, gamedataStimType.AudioEnemyPing );
			}
		}
	}

	public function HandleCombatMix( localPlayer : GameObject )
	{
		m_mixHasDetectedCombat = true;
	}

	public function HandleOutOfCombatMix( localPlayer : GameObject )
	{
		if( m_mixHasDetectedCombat )
		{
			if( m_enemyPingStimCount > 0 )
			{
				localPlayer.GetStimBroadcasterComponent().AddActiveStimuli( localPlayer, gamedataStimType.AudioEnemyPing, -1.0 );
			}
			m_mixHasDetectedCombat = false;
		}
	}

	protected event OnGameEnd()
	{
		m_enemyPingStimCount = 0;
		m_mixHasDetectedCombat = false;
		RemoveAllTriggerEffects();
	}

	public function AddTriggerEffectIfPlayerNotInVehicleDriverSeat( playerObject : GameObject, triggerName : CName, triggerLabel : CName )
	{
		if( playerObject.IsPlayer() && IsPlayerInVehicleInDriverSeat( playerObject ) )
		{
			return;
		}
		AddTriggerEffect( triggerName, triggerLabel );
	}

	private function IsPlayerInVehicleInDriverSeat( playerObject : GameObject ) : Bool
	{
		var playerPuppet : PlayerPuppet;
		var isPlayerInVehicleInDriverSeat : Bool;
		playerPuppet = ( ( PlayerPuppet )( playerObject ) );
		if( !( playerPuppet ) )
		{
			return false;
		}
		isPlayerInVehicleInDriverSeat = playerPuppet.GetPlayerStateMachineBlackboard().GetBool( GetAllBlackboardDefs().PlayerStateMachine.MountedToVehicleInDriverSeat );
		return isPlayerInVehicleInDriverSeat;
	}

}

import class worldScriptedAudioSignpostTrigger extends IScriptable
{

	protected event OnPlayerEnter( localPlayer : GameObject )
	{
		GameInstance.GetAudioSystem( localPlayer.GetGame() ).HandleDynamicMixAreaEnter( localPlayer );
	}

	protected event OnPlayerExit( localPlayer : GameObject )
	{
		GameInstance.GetAudioSystem( localPlayer.GetGame() ).HandleDynamicMixAreaExit( localPlayer );
	}

}

import enum audioEventActionType
{
	Play,
	SetParameter,
	StopSound,
	SetSwitch,
	StopTagged,
	Tag,
	Untag,
}

import enum audioAudioEventFlags
{
	NoEventFlags,
	SloMoOnly,
	Music,
	Metadata,
	Unique,
}

importonly final class AudioEvent extends Event
{
	import var eventName : CName;
	import var nameData : CName;
	import var floatData : Float;
	import var eventType : audioEventActionType;
	import var eventFlags : audioAudioEventFlags;
}

importonly final class SoundPlayEvent extends Event
{
	import var soundName : CName;
}

importonly final class SoundStopEvent extends Event
{
	import var soundName : CName;
}

importonly final class SoundSwitchEvent extends Event
{
	import var switchName : CName;
	import var switchValue : CName;
}

importonly final class SoundParameterEvent extends Event
{
	import var parameterName : CName;
	import var parameterValue : Float;
}

importonly final class SoundPlayVo extends Event
{
	import var voContext : CName;
	import var isQuest : Bool;
	import var ignoreFrustumCheck : Bool;
	import var ignoreDistanceCheck : Bool;
	import var debugInitialContext : CName;
	import var answeringEntityId : EntityID;
}

importonly final class StopWeaponFireSoundEvent extends Event
{
}

importonly final class LocalizationStringComponent extends IComponent
{
	public import function GetString( key : CName ) : LocalizationString;
	public import function GetString_DemoOnly( key : CName ) : String;
}

import enum gameaudioeventsSurfaceDirection
{
	Normal,
	WallLeft,
	WallRight,
}

importonly final class NotifySurfaceDirectionChangedEvent extends Event
{
	import var surfaceDirection : gameaudioeventsSurfaceDirection;
}

importonly final class AudioNotifyItemEquippedEvent extends Event
{
	import var itemName : CName;
}

importonly final class AudioNotifyItemUnequippedEvent extends Event
{
	import var itemName : CName;
}

importonly final class WeaponPreFireEvent extends Event
{
}

importonly final class ToggleAimDownSightsEvent extends Event
{
	import var toggleOn : Bool;
}

importonly final class PickUpBodyBreathingEvent extends Event
{
}

importonly final class DropBodyBreathingEvent extends Event
{
}

import enum vehicleAudioEventAction
{
	OnPlayerDriving,
	OnPlayerPassenger,
	OnPlayerEnterCombat,
	OnPlayerExitCombat,
	OnPlayerExitVehicle,
}

import enum audioTrafficVehicleAudioAction
{
	StartEngine,
	StopEngine,
	StartWheel,
	StopWheel,
	StartRainLoop,
	StopRainLoop,
	Horn,
	HornForced,
	DisableAbilityToPlayRadio,
}

importonly final class VehicleAudioEvent extends Event
{
	import var action : vehicleAudioEventAction;
}

importonly final class TrafficAudioEvent extends Event
{
	import var audioAction : audioTrafficVehicleAudioAction;
}

