enum QuickSlotActionType
{
	Undefined = 0,
	SelectItem = 1,
	HideWeapon = 2,
	OpenPhone = 3,
	SummonCar = 4,
	SummonBike = 5,
	ToggleRadio = 6,
	SelectRadioStation = 7,
	TurnOffRadio = 8,
	CycleTrackedQuest = 9,
	SummonVehicle = 10,
	SetActiveVehicle = 11,
	QuickHack = 12,
	ToggleSummonMode = 13,
	EquipFists = 14,
}

enum QuickSlotItemType
{
	Undefined = 0,
	Vehicle = 1,
	Gadget = 2,
	Consumable = 3,
	Cyberware = 4,
	Weapon = 5,
	Interaction = 6,
}

struct QuickSlotCommand
{
	var ActionType : QuickSlotActionType;
	default ActionType = QuickSlotActionType.Undefined;
	var IsSlotUnlocked : Bool;
	default IsSlotUnlocked = true;
	var IsLocked : Bool;
	var AtlasPath : CName;
	var IconName : CName;
	var MaxTier : Int32;
	var VehicleState : Int32;
	var ItemId : ItemID;
	var Title : String;
	var Type : String;
	var Description : String;
	var IsEquipped : Bool;
	var intData : Int32;
	var playerVehicleData : PlayerVehicle;
	var itemType : QuickSlotItemType;
	default itemType = QuickSlotItemType.Undefined;
	var equipType : gamedataEquipmentArea;
	var slotIndex : Int32;
	var interactiveAction : DeviceAction;
	var interactiveActionOwner : EntityID;

	public static function IsEmpty( const self : ref< QuickSlotCommand > ) : Bool
	{
		var empty : QuickSlotCommand;
		if( ( ( ( ( ( ( ( ( ( ( ( ( empty.ActionType == self.ActionType && empty.IsSlotUnlocked == self.IsSlotUnlocked ) && empty.IsLocked == self.IsLocked ) && empty.IsSlotUnlocked == self.IsSlotUnlocked ) && empty.AtlasPath == self.AtlasPath ) && empty.IconName == self.IconName ) && ( empty.MaxTier == self.MaxTier ) ) && ( empty.VehicleState == self.VehicleState ) ) && empty.Title == self.Title ) && empty.Type == self.Type ) && empty.Description == self.Description ) && empty.IsEquipped == self.IsEquipped ) && ( empty.intData == self.intData ) ) && ( empty.slotIndex == self.slotIndex ) )
		{
			return true;
		}
		return false;
	}

}

struct QuickSlotUIStructure
{
	var ItemIndex : Int32;
	var OperationResult : Bool;
}

struct QuickWheelStartUIStructure
{
	var WheelItems : array< QuickSlotCommand >;
	var dpadSlot : EDPadSlot;
}

struct QuickWheelEndUIStructure
{
	var ChosenItem : QuickSlotCommand;
	var WasUsed : Bool;
	var WasAssignedToSlot : Bool;
	var WheelDirection : EDPadSlot;
}

class QuickSlotCommandUsed extends Event
{
	var action : DeviceAction;
}

enum EDPadSlot
{
	Left = 0,
	Up = 1,
	Right = 2,
	Down = 3,
	LeftDouble = 4,
	UpDouble = 5,
	RightDouble = 6,
	DownDouble = 7,
	WeaponsWheel = 8,
	VehicleWheel = 9,
	GadgetWheel = 10,
	InteractionWheel = 11,
	Phone = 12,
	CallVehicle = 13,
	CycleObjective = 14,
	VehicleInsideWheel = 15,
	ConsumableWheel = 16,
	PocketRadio = 17,
	VehicleVisualCustomization = 18,
}

class QuickSlotsManagerPS extends GameComponentPS
{
	private persistent var m_activeVehicleType : gamedataVehicleType;
	default m_activeVehicleType = gamedataVehicleType.Car;

	public function SetActiveType( type : gamedataVehicleType )
	{
		m_activeVehicleType = type;
	}

	public function GetActiveType() : gamedataVehicleType
	{
		return m_activeVehicleType;
	}

}

class QuickSlotsManager extends ScriptableComponent
{
	private var m_Player : weak< PlayerPuppet >;
	private var m_QuickSlotsBB : weak< IBlackboard >;
	private var m_IsPlayerInCar : Bool;
	private var m_PlayerVehicleID : EntityID;
	private var m_QuickDpadCommands : array< QuickSlotCommand >;
	private var m_QuickDpadCommands_Vehicle : array< QuickSlotCommand >;
	private var m_DefaultHoldCommands : array< QuickSlotCommand >;
	private var m_DefaultHoldCommands_Vehicle : array< QuickSlotCommand >;
	private var m_NumberOfItemsPerWheel : Int32;
	default m_NumberOfItemsPerWheel = 8;
	private var m_QuickKeyboardCommands : array< QuickSlotCommand >;
	private var m_QuickKeyboardCommands_Vehicle : array< QuickSlotCommand >;
	private var m_lastPressAndHoldBtn : QuickSlotButtonHoldEndEvent;
	private var m_WheelList_Vehicles : array< QuickSlotCommand >;
	private var m_currentWheelItem : QuickSlotCommand;
	private var m_currentWeaponWheelItem : QuickSlotCommand;
	private var m_currentGadgetWheelConsumable : QuickSlotCommand;
	private var m_currentGadgetWheelGadget : QuickSlotCommand;
	private var m_currentVehicleWheelItem : QuickSlotCommand;
	private var m_currentGadgetWheelItem : QuickSlotCommand;
	private var m_currentInteractionWheelItem : QuickSlotCommand;
	private var m_OnVehPlayerStateDataChangedCallback : CallbackHandle;

	public export function OnGameAttach()
	{
		var vehBlackbord : IBlackboard;
		m_Player = ( ( PlayerPuppet )( GetOwner() ) );
		m_QuickSlotsBB = GameInstance.GetBlackboardSystem( m_Player.GetGame() ).Get( GetAllBlackboardDefs().UI_QuickSlotsData );
		vehBlackbord = GameInstance.GetBlackboardSystem( m_Player.GetGame() ).Get( GetAllBlackboardDefs().UI_ActiveVehicleData );
		m_OnVehPlayerStateDataChangedCallback = vehBlackbord.RegisterListenerVariant( GetAllBlackboardDefs().UI_ActiveVehicleData.VehPlayerStateData, this, 'OnVehPlayerStateDataChanged' );
		InitializeCommandsData();
	}

	private function OnVehPlayerStateDataChanged( vehPlayerStateData : Variant )
	{
		var vehData : VehEntityPlayerStateData;
		vehData = ( ( VehEntityPlayerStateData )vehPlayerStateData );
		m_PlayerVehicleID = vehData.entID;
		m_IsPlayerInCar = vehData.state > 0;
	}

	protected const override function GetPS() : QuickSlotsManagerPS
	{
		return ( ( QuickSlotsManagerPS )( GetBasePS() ) );
	}

	protected event OnQuickSlotButtonTap( evt : QuickSlotButtonTap )
	{
		var currentCommand : QuickSlotCommand;
		var success : Bool;
		var index : Int32;
		index = GetDPadIndex( evt.dPadItemDirection );
		if( !( m_IsPlayerInCar ) )
		{
			if( IsDPadActionAvaliable( index ) )
			{
				currentCommand = GetDPadCommandAtSlot( index );
				success = TryExecuteCommand( currentCommand );
				m_QuickSlotsBB.SetVariant( GetAllBlackboardDefs().UI_QuickSlotsData.DPadCommand, QuickSlotUIStructure( index, success ), true );
			}
		}
		else
		{
			if( IsDPadActionAvaliable( index ) )
			{
				currentCommand = GetDPadCommandAtSlot( index );
				success = TryExecuteCommand( currentCommand );
				m_QuickSlotsBB.SetVariant( GetAllBlackboardDefs().UI_QuickSlotsData.DPadCommand, QuickSlotUIStructure( index, success ), true );
			}
		}
	}

	protected event OnCallAction( evt : CallAction )
	{
		var command : QuickSlotCommand;
		command = CreateEmptyQuickSlotCommand();
		command.ActionType = evt.calledAction;
		ExecuteCommand( command );
	}

	protected event OnQuickSlotKeyboardTap( evt : QuickSlotKeyboardTap )
	{
		var currentCommand : QuickSlotCommand;
		var success : Bool;
		var index : Int32;
		index = evt.keyIndex;
		if( IsKeyboardActionAvaliable( index ) )
		{
			currentCommand = GetKeyboardCommandAtSlot( index );
			success = TryExecuteCommand( currentCommand );
			m_QuickSlotsBB.SetVariant( GetAllBlackboardDefs().UI_QuickSlotsData.KeyboardCommand, QuickSlotUIStructure( index, success ), true );
		}
	}

	protected event OnQuickSlotButtonHoldStartEvent( evt : QuickSlotButtonHoldStartEvent )
	{
		var wheelCommands : array< QuickSlotCommand >;
		if( evt.dPadItemDirection != EDPadSlot.CallVehicle )
		{
			return false;
		}
		if( !( m_IsPlayerInCar ) )
		{
			wheelCommands = GetWheelCommands( evt.dPadItemDirection );
		}
		else
		{
			wheelCommands = GetVehicleWheelCommands( evt.dPadItemDirection );
		}
		TimeDilationHelper.SetTimeDilationWithProfile( m_Player, "radialMenu", true, true );
		m_QuickSlotsBB.SetVariant( GetAllBlackboardDefs().UI_QuickSlotsData.WheelInteractionStarted, QuickWheelStartUIStructure( wheelCommands, evt.dPadItemDirection ), true );
	}

	public function SetWheelItem( const currentWheelItem : ref< QuickSlotCommand > )
	{
		switch( currentWheelItem.itemType )
		{
			case QuickSlotItemType.Vehicle:
				m_currentVehicleWheelItem = currentWheelItem;
			break;
			case QuickSlotItemType.Gadget:
				m_currentGadgetWheelGadget = currentWheelItem;
			m_currentGadgetWheelItem = currentWheelItem;
			break;
			case QuickSlotItemType.Cyberware:
				m_currentGadgetWheelGadget = currentWheelItem;
			m_currentGadgetWheelItem = currentWheelItem;
			break;
			case QuickSlotItemType.Consumable:
				m_currentGadgetWheelConsumable = currentWheelItem;
			m_currentGadgetWheelItem = currentWheelItem;
			break;
			case QuickSlotItemType.Weapon:
				m_currentWeaponWheelItem = currentWheelItem;
			break;
			case QuickSlotItemType.Interaction:
				m_currentInteractionWheelItem = currentWheelItem;
			break;
			default:
				m_currentWheelItem = currentWheelItem;
			break;
		}
	}

	public function GetWheelItem( const currentWheelItem : ref< QuickSlotCommand > ) : QuickSlotCommand
	{
		switch( currentWheelItem.itemType )
		{
			case QuickSlotItemType.Vehicle:
				return m_currentVehicleWheelItem;
			case QuickSlotItemType.Gadget:
				return m_currentGadgetWheelGadget;
			case QuickSlotItemType.Cyberware:
				return m_currentGadgetWheelGadget;
			case QuickSlotItemType.Consumable:
				return m_currentGadgetWheelConsumable;
			case QuickSlotItemType.Weapon:
				return m_currentWeaponWheelItem;
			case QuickSlotItemType.Interaction:
				return m_currentInteractionWheelItem;
			default:
				return m_currentWheelItem;
		}
	}

	public const function GetQuickSlotCommandByDpadSlot( wheelType : EDPadSlot ) : QuickSlotCommand
	{
		switch( wheelType )
		{
			case EDPadSlot.VehicleWheel:
				return m_currentVehicleWheelItem;
			case EDPadSlot.GadgetWheel:
				return m_currentGadgetWheelItem;
			case EDPadSlot.ConsumableWheel:
				return m_currentGadgetWheelConsumable;
			case EDPadSlot.WeaponsWheel:
				return m_currentWeaponWheelItem;
			case EDPadSlot.InteractionWheel:
				return m_currentInteractionWheelItem;
			default:
				return m_currentWheelItem;
		}
	}

	protected const function IsSelectingCombatItemPrevented() : Bool
	{
		return ( ( ( StatusEffectSystem.ObjectHasStatusEffectWithTag( m_Player, 'VehicleScene' ) || StatusEffectSystem.ObjectHasStatusEffectWithTag( m_Player, 'NoCombat' ) ) || StatusEffectSystem.ObjectHasStatusEffectWithTag( m_Player, 'FirearmsNoUnequip' ) ) || StatusEffectSystem.ObjectHasStatusEffectWithTag( m_Player, 'NoCombat' ) ) || StatusEffectSystem.ObjectHasStatusEffectWithTag( m_Player, 'FirearmsNoSwitch' );
	}

	protected const function IsSelectingCombatGadgetPrevented() : Bool
	{
		return ( StatusEffectSystem.ObjectHasStatusEffectWithTag( m_Player, 'Fists' ) || StatusEffectSystem.ObjectHasStatusEffectWithTag( m_Player, 'Melee' ) ) || StatusEffectSystem.ObjectHasStatusEffectWithTag( m_Player, 'Firearms' );
	}

	protected function GetDPadIndex( direction : EDPadSlot ) : Int32
	{
		switch( direction )
		{
			case EDPadSlot.Left:
				return 0;
			case EDPadSlot.LeftDouble:
				return 4;
			case EDPadSlot.Up:
				return 1;
			case EDPadSlot.UpDouble:
				return 5;
			case EDPadSlot.Right:
				return 2;
			case EDPadSlot.RightDouble:
				return 6;
			case EDPadSlot.Down:
				return 3;
			case EDPadSlot.DownDouble:
				return 7;
			case EDPadSlot.WeaponsWheel:
				return 8;
			default:
				return -1;
		}
	}

	protected function TryExecuteCommand( const currentCommand : ref< QuickSlotCommand > ) : Bool
	{
		if( m_Player && currentCommand.ActionType != QuickSlotActionType.Undefined )
		{
			ExecuteCommand( currentCommand );
			return true;
		}
		return false;
	}

	public function IsDPadActionAvaliable( direction : EDPadSlot ) : Bool
	{
		return IsDPadActionAvaliable( GetDPadIndex( direction ) );
	}

	public function IsDPadActionAvaliable( actionIndex : Int32 ) : Bool
	{
		var list : array< QuickSlotCommand >;
		list = ( ( m_IsPlayerInCar ) ? ( m_QuickDpadCommands_Vehicle ) : ( m_QuickDpadCommands ) );
		return ( ( actionIndex >= 0 ) && ( list.Size() > actionIndex ) ) && list[ actionIndex ].IsSlotUnlocked;
	}

	public function GetDPadCommandAtSlot( argIndex : Int32 ) : QuickSlotCommand
	{
		var list : array< QuickSlotCommand >;
		list = ( ( m_IsPlayerInCar ) ? ( m_QuickDpadCommands_Vehicle ) : ( m_QuickDpadCommands ) );
		return list[ argIndex ];
	}

	public constexpr static function GetMaxKeyboardItems() : Int32
	{
		return 8;
	}

	public const function GetNumberOfItemsPerWheel() : Int32
	{
		return m_NumberOfItemsPerWheel;
	}

	public function IsKeyboardActionAvaliable( actionIndex : Int32 ) : Bool
	{
		var list : array< QuickSlotCommand >;
		list = ( ( m_IsPlayerInCar ) ? ( m_QuickKeyboardCommands_Vehicle ) : ( m_QuickKeyboardCommands ) );
		return ( ( actionIndex >= 0 ) && ( list.Size() > actionIndex ) ) && list[ actionIndex ].IsSlotUnlocked;
	}

	public function GetKeyboardCommandAtSlot( argIndex : Int32 ) : QuickSlotCommand
	{
		var list : array< QuickSlotCommand >;
		list = ( ( m_IsPlayerInCar ) ? ( m_QuickKeyboardCommands_Vehicle ) : ( m_QuickKeyboardCommands ) );
		return list[ argIndex ];
	}

	private const function CreateQuickSlotCommand( actionType : QuickSlotActionType, imageAtlasPath : CName, actionName : CName, maxTier : Int32, vehicleState : Int32, isLocked : Bool, isSlotUnlocked : Bool, optional intData : Int32, optional argTitle : String, optional argType : String ) : QuickSlotCommand
	{
		var newItem : QuickSlotCommand;
		newItem.IsSlotUnlocked = isSlotUnlocked;
		newItem.ActionType = actionType;
		newItem.IconName = imageAtlasPath;
		newItem.MaxTier = maxTier;
		newItem.VehicleState = vehicleState;
		newItem.IsLocked = isLocked;
		newItem.intData = intData;
		newItem.Title = argTitle;
		newItem.Type = argType;
		if( actionName != '' )
		{
			newItem.ItemId = ItemID.FromTDBID( TDBID.Create( NameToString( actionName ) ) );
		}
		return newItem;
	}

	private const function CreateQuickSlotItemCommand( itemID : ItemID, argActionType : QuickSlotActionType, argIcon : CName, const argTitle : ref< String >, const argType : ref< String >, const argDesc : ref< String > ) : QuickSlotCommand
	{
		var currWheelItem : QuickSlotCommand;
		currWheelItem.IconName = argIcon;
		currWheelItem.Title = argTitle;
		currWheelItem.Type = argType;
		currWheelItem.Description = argDesc;
		currWheelItem.ActionType = argActionType;
		currWheelItem.IsLocked = false;
		if( itemID != ItemID.None() )
		{
			currWheelItem.ItemId = itemID;
		}
		return currWheelItem;
	}

	private const function GetActionData() : QuickSlotCommand
	{
		var ret : QuickSlotCommand;
		return ret;
	}

	private function InitializeCommandsData()
	{
		m_QuickDpadCommands.Clear();
		m_QuickDpadCommands.PushBack( CreateQuickSlotCommand( QuickSlotActionType.Undefined, '', '', 1, 0, false, true ) );
		m_QuickDpadCommands.PushBack( CreateQuickSlotCommand( QuickSlotActionType.Undefined, '', '', 1, 0, false, true ) );
		m_QuickDpadCommands.PushBack( CreateQuickSlotCommand( QuickSlotActionType.CycleTrackedQuest, '', '', 1, 0, true, true, , "Cycle Objective" ) );
		m_QuickDpadCommands_Vehicle.Clear();
		m_QuickDpadCommands_Vehicle.PushBack( CreateQuickSlotCommand( QuickSlotActionType.OpenPhone, 'temp_kiroshi', '', 1, 0, true, true ) );
		m_QuickDpadCommands_Vehicle.PushBack( CreateQuickSlotCommand( QuickSlotActionType.ToggleRadio, 'temp_car', '', 1, 0, true, true ) );
		m_QuickDpadCommands_Vehicle.PushBack( CreateQuickSlotCommand( QuickSlotActionType.CycleTrackedQuest, 'temp_katana', '', 1, 0, true, true, , "Cycle Objective" ) );
		m_QuickKeyboardCommands.Clear();
		m_QuickKeyboardCommands.PushBack( CreateQuickSlotCommand( QuickSlotActionType.OpenPhone, 'temp_kiroshi', '', 1, 0, false, true ) );
		m_QuickKeyboardCommands_Vehicle.Clear();
		m_QuickKeyboardCommands_Vehicle.PushBack( CreateQuickSlotCommand( QuickSlotActionType.OpenPhone, 'temp_kiroshi', '', 1, 0, false, true ) );
		m_DefaultHoldCommands.PushBack( CreateQuickSlotCommand( QuickSlotActionType.Undefined, '', '', 1, 0, false, false ) );
		m_DefaultHoldCommands.PushBack( CreateQuickSlotCommand( QuickSlotActionType.Undefined, '', '', 1, 0, false, false ) );
		m_DefaultHoldCommands.PushBack( CreateQuickSlotCommand( QuickSlotActionType.Undefined, '', '', 1, 0, false, false ) );
		m_DefaultHoldCommands.PushBack( CreateQuickSlotCommand( QuickSlotActionType.Undefined, '', '', 1, 0, false, false ) );
		m_DefaultHoldCommands_Vehicle.PushBack( CreateQuickSlotCommand( QuickSlotActionType.Undefined, '', '', 1, 0, false, false ) );
		m_DefaultHoldCommands_Vehicle.PushBack( CreateQuickSlotCommand( QuickSlotActionType.Undefined, '', '', 1, 0, false, false ) );
		m_DefaultHoldCommands_Vehicle.PushBack( CreateQuickSlotCommand( QuickSlotActionType.TurnOffRadio, 'temp_car', '', 1, 0, true, true, , "TURN OFF", "RADIO" ) );
		m_DefaultHoldCommands_Vehicle.PushBack( CreateQuickSlotCommand( QuickSlotActionType.Undefined, '', '', 1, 0, false, false ) );
	}

	public function GetWheelCommands( direction : EDPadSlot ) : array< QuickSlotCommand >
	{
		var currentWheelCommands : array< QuickSlotCommand >;
		switch( direction )
		{
			case EDPadSlot.VehicleWheel:
			{
				if( StatusEffectSystem.ObjectHasStatusEffectWithTag( m_Player, 'VehicleNoInteraction' ) )
				{
					GetEmptyWheel( currentWheelCommands );
					return currentWheelCommands;
				}
				else
				{
					GetVehicleWheel( currentWheelCommands );
				}
				return currentWheelCommands;
			}
			case EDPadSlot.GadgetWheel:
			{
				if( IsSelectingCombatItemPrevented() || IsSelectingCombatGadgetPrevented() )
				{
					GetEmptyWheel( currentWheelCommands );
					return currentWheelCommands;
				}
				else
				{
					GetRPGWheel( currentWheelCommands );
				}
				return currentWheelCommands;
			}
			case EDPadSlot.WeaponsWheel:
			{
				if( IsSelectingCombatItemPrevented() )
				{
					GetEmptyWheel( currentWheelCommands );
					return currentWheelCommands;
				}
				else
				{
					ChooseWeaponsWheel( currentWheelCommands );
				}
				return currentWheelCommands;
			}
			case EDPadSlot.ConsumableWheel:
			{
				GetConsumablesWheel( currentWheelCommands );
				return currentWheelCommands;
			}
			default:
			{
				return currentWheelCommands;
			}
		}
	}

	public function GetVehicleWheelCommands( direction : EDPadSlot ) : array< QuickSlotCommand >
	{
		var currentWheelCommands : array< QuickSlotCommand >;
		switch( direction )
		{
			case EDPadSlot.VehicleInsideWheel:
			{
				GetVehicleInsideWheel( currentWheelCommands );
				return currentWheelCommands;
			}
			case EDPadSlot.GadgetWheel:
			{
				if( IsSelectingCombatItemPrevented() )
				{
					GetEmptyWheel( currentWheelCommands );
					return currentWheelCommands;
				}
				else
				{
					GetRPGWheel( currentWheelCommands );
				}
				return currentWheelCommands;
			}
			case EDPadSlot.WeaponsWheel:
			{
				ChooseWeaponsWheel( currentWheelCommands );
				return currentWheelCommands;
			}
			case EDPadSlot.ConsumableWheel:
			{
				GetConsumablesWheel( currentWheelCommands );
				return currentWheelCommands;
			}
			default:
			{
				return currentWheelCommands;
			}
		}
	}

	private const function GetVehicleObject() : VehicleObject
	{
		var mountInfo : MountingInfo;
		var entity : Entity;
		var vehicleEntity : VehicleObject;
		mountInfo = GameInstance.GetMountingFacility( m_Player.GetGame() ).GetMountingInfoSingleWithIds( m_Player.GetEntityID() );
		entity = GameInstance.FindEntityByID( m_Player.GetGame(), mountInfo.parentId );
		vehicleEntity = ( ( VehicleObject )( entity ) );
		return vehicleEntity;
	}

	public const function GetVehicleInsideWheel( wheel : ref< array< QuickSlotCommand > > )
	{
		var isRadioActive : Bool;
		isRadioActive = GetVehicleObject().GetBlackboard().GetBool( GetAllBlackboardDefs().Vehicle.VehRadioState );
		wheel.PushBack( CreateQuickSlotCommand( QuickSlotActionType.ToggleRadio, 'temp_car', '', 1, 0, true, true, , "NEXT STATION", "RADIO" ) );
		if( isRadioActive )
		{
			wheel.PushBack( CreateQuickSlotCommand( QuickSlotActionType.TurnOffRadio, 'temp_car', '', 1, 0, true, true, , "TURN OFF", "RADIO" ) );
		}
	}

	public const function GetRPGWheel( rpgWheel : ref< array< QuickSlotCommand > > )
	{
		GetQuickWheel( rpgWheel );
	}

	public const function GetConsumablesWheel( wheel : ref< array< QuickSlotCommand > > )
	{
		PushBackCommands( gamedataEquipmentArea.Consumable, wheel );
	}

	public const function GetCyberwareWheel( wheel : ref< array< QuickSlotCommand > > )
	{
		GetLauncher( wheel );
		PushBackCommands( gamedataEquipmentArea.CyberwareWheel, wheel );
	}

	public const function GetGadgetsWheel( wheel : ref< array< QuickSlotCommand > > )
	{
		PushBackCommands( gamedataEquipmentArea.QuickSlot, wheel );
	}

	public const function GetQuickWheel( wheel : ref< array< QuickSlotCommand > > )
	{
		PushBackCommands( gamedataEquipmentArea.QuickWheel, wheel );
	}

	public const function GetLauncher( wheel : ref< array< QuickSlotCommand > > )
	{
		var item : ItemID;
		var record : Item_Record;
		item = EquipmentSystem.GetData( m_Player ).GetActiveItem( gamedataEquipmentArea.ArmsCW );
		if( ItemID.IsValid( item ) )
		{
			record = TweakDBInterface.GetItemRecord( ItemID.GetTDBID( item ) );
			if( record.ItemType().Type() == gamedataItemType.Cyb_Launcher )
			{
				PushBackCommands( gamedataEquipmentArea.ArmsCW, wheel );
			}
		}
	}

	public const function ChooseWeaponsWheel( out weaponsWheel : array< QuickSlotCommand > )
	{
		if( IsSelectingCombatItemPrevented() )
		{
			GetEmptyWheel( weaponsWheel );
		}
		else if( StatusEffectSystem.ObjectHasStatusEffectWithTag( m_Player, 'Fists' ) )
		{
			GetFistFightOnlyWeaponsWheel( weaponsWheel );
		}
		else if( StatusEffectSystem.ObjectHasStatusEffectWithTag( m_Player, 'Melee' ) )
		{
			GetMeleeOnlyWeaponsWheel( weaponsWheel );
		}
		else if( StatusEffectSystem.ObjectHasStatusEffectWithTag( m_Player, 'NoArmsCW' ) )
		{
			GetNoArmsCWWeaponsWheel( weaponsWheel );
		}
		else if( StatusEffectSystem.ObjectHasStatusEffectWithTag( m_Player, 'OneHandedFirearms' ) )
		{
			GetOneHandedOnlyOnlyWeaponsWheel( weaponsWheel );
		}
		else if( StatusEffectSystem.ObjectHasStatusEffectWithTag( m_Player, 'DriverCombatFirearms' ) )
		{
			GetDriverCombatOnlyWeaponsWheel( weaponsWheel );
		}
		else if( StatusEffectSystem.ObjectHasStatusEffectWithTag( m_Player, 'DriverCombatBikeWeapons' ) )
		{
			GetDriverCombatBikeOnlyWeaponsWheel( weaponsWheel );
		}
		else if( StatusEffectSystem.ObjectHasStatusEffectWithTag( m_Player, 'Firearms' ) )
		{
			GetFirearmsOnlyWeaponsWheel( weaponsWheel );
		}
		else
		{
			GetRegularWeaponsWheel( weaponsWheel );
		}
	}

	public const function GetRegularWeaponsWheel( weaponsWheel : ref< array< QuickSlotCommand > > )
	{
		var allowedItemTypes : array< gamedataItemType >;
		GetWeaponsWheel( weaponsWheel, allowedItemTypes );
	}

	public const function GetEmptyWheel( weaponsWheel : ref< array< QuickSlotCommand > > )
	{
		var allowedItemTypes : array< gamedataItemType >;
		allowedItemTypes.PushBack( gamedataItemType.Invalid );
		GetWeaponsWheel( weaponsWheel, allowedItemTypes );
	}

	public const function GetFistFightOnlyWeaponsWheel( weaponsWheel : ref< array< QuickSlotCommand > > )
	{
		var allowedItemTypes : array< gamedataItemType >;
		allowedItemTypes.PushBack( gamedataItemType.Wea_Fists );
		allowedItemTypes.PushBack( gamedataItemType.Cyb_StrongArms );
		GetWeaponsWheel( weaponsWheel, allowedItemTypes );
	}

	public const function GetMeleeOnlyWeaponsWheel( weaponsWheel : ref< array< QuickSlotCommand > > )
	{
		var allowedItemTypes : array< gamedataItemType >;
		allowedItemTypes.PushBack( gamedataItemType.Cyb_MantisBlades );
		allowedItemTypes.PushBack( gamedataItemType.Cyb_NanoWires );
		allowedItemTypes.PushBack( gamedataItemType.Cyb_StrongArms );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Fists );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Hammer );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Katana );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Sword );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Knife );
		allowedItemTypes.PushBack( gamedataItemType.Wea_LongBlade );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Melee );
		allowedItemTypes.PushBack( gamedataItemType.Wea_OneHandedClub );
		allowedItemTypes.PushBack( gamedataItemType.Wea_ShortBlade );
		allowedItemTypes.PushBack( gamedataItemType.Wea_TwoHandedClub );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Axe );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Chainsword );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Machete );
		GetWeaponsWheel( weaponsWheel, allowedItemTypes, WeaponObject.GetMeleeWeaponTag() );
	}

	public const function GetOneHandedOnlyOnlyWeaponsWheel( weaponsWheel : ref< array< QuickSlotCommand > > )
	{
		var allowedItemTypes : array< gamedataItemType >;
		allowedItemTypes.PushBack( gamedataItemType.Wea_Handgun );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Revolver );
		GetWeaponsWheel( weaponsWheel, allowedItemTypes, WeaponObject.GetOneHandedRangedWeaponTag() );
	}

	public const function GetDriverCombatOnlyWeaponsWheel( weaponsWheel : ref< array< QuickSlotCommand > > )
	{
		var allowedItemTypes : array< gamedataItemType >;
		allowedItemTypes.PushBack( gamedataItemType.Wea_Handgun );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Revolver );
		allowedItemTypes.PushBack( gamedataItemType.Wea_SubmachineGun );
		GetWeaponsWheel( weaponsWheel, allowedItemTypes, WeaponObject.GetDriverCombatRangedWeaponTag() );
	}

	public const function GetDriverCombatBikeOnlyWeaponsWheel( weaponsWheel : ref< array< QuickSlotCommand > > )
	{
		var allowedItemTypes : array< gamedataItemType >;
		allowedItemTypes.PushBack( gamedataItemType.Wea_Handgun );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Revolver );
		allowedItemTypes.PushBack( gamedataItemType.Wea_SubmachineGun );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Katana );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Sword );
		allowedItemTypes.PushBack( gamedataItemType.Wea_OneHandedClub );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Machete );
		allowedItemTypes.PushBack( gamedataItemType.Wea_LongBlade );
		allowedItemTypes.PushBack( gamedataItemType.Wea_ShortBlade );
		allowedItemTypes.PushBack( gamedataItemType.Wea_TwoHandedClub );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Chainsword );
		GetWeaponsWheel( weaponsWheel, allowedItemTypes, WeaponObject.GetDriverCombatRangedWeaponTag() );
	}

	public const function GetFirearmsOnlyWeaponsWheel( weaponsWheel : ref< array< QuickSlotCommand > > )
	{
		var allowedItemTypes : array< gamedataItemType >;
		allowedItemTypes.PushBack( gamedataItemType.Wea_AssaultRifle );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Handgun );
		allowedItemTypes.PushBack( gamedataItemType.Wea_HeavyMachineGun );
		allowedItemTypes.PushBack( gamedataItemType.Wea_LightMachineGun );
		allowedItemTypes.PushBack( gamedataItemType.Wea_PrecisionRifle );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Revolver );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Rifle );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Shotgun );
		allowedItemTypes.PushBack( gamedataItemType.Wea_ShotgunDual );
		allowedItemTypes.PushBack( gamedataItemType.Wea_SniperRifle );
		allowedItemTypes.PushBack( gamedataItemType.Wea_SubmachineGun );
		GetWeaponsWheel( weaponsWheel, allowedItemTypes, WeaponObject.GetRangedWeaponTag() );
	}

	public const function GetNoArmsCWWeaponsWheel( weaponsWheel : ref< array< QuickSlotCommand > > )
	{
		var allowedItemTypes : array< gamedataItemType >;
		allowedItemTypes.PushBack( gamedataItemType.Cyb_StrongArms );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Fists );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Hammer );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Katana );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Sword );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Knife );
		allowedItemTypes.PushBack( gamedataItemType.Wea_LongBlade );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Melee );
		allowedItemTypes.PushBack( gamedataItemType.Wea_OneHandedClub );
		allowedItemTypes.PushBack( gamedataItemType.Wea_ShortBlade );
		allowedItemTypes.PushBack( gamedataItemType.Wea_TwoHandedClub );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Axe );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Chainsword );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Machete );
		allowedItemTypes.PushBack( gamedataItemType.Wea_AssaultRifle );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Handgun );
		allowedItemTypes.PushBack( gamedataItemType.Wea_HeavyMachineGun );
		allowedItemTypes.PushBack( gamedataItemType.Wea_LightMachineGun );
		allowedItemTypes.PushBack( gamedataItemType.Wea_PrecisionRifle );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Revolver );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Rifle );
		allowedItemTypes.PushBack( gamedataItemType.Wea_Shotgun );
		allowedItemTypes.PushBack( gamedataItemType.Wea_ShotgunDual );
		allowedItemTypes.PushBack( gamedataItemType.Wea_SniperRifle );
		allowedItemTypes.PushBack( gamedataItemType.Wea_SubmachineGun );
		GetWeaponsWheel( weaponsWheel, allowedItemTypes, WeaponObject.GetRangedWeaponTag() );
	}

	private const function GetWeaponsWheel( weaponsWheel : ref< array< QuickSlotCommand > >, optional const allowedItemTypes : array< gamedataItemType >, optional const allowedTag : CName )
	{
		var holsterCommand : QuickSlotCommand;
		var equipFistsCommand : QuickSlotCommand;
		holsterCommand = CreateQuickSlotCommand( QuickSlotActionType.HideWeapon, 'temp_switchweapon', 'HOLSTER WEAPON', 1, 0, false, false );
		holsterCommand.itemType = QuickSlotItemType.Weapon;
		equipFistsCommand = CreateQuickSlotCommand( QuickSlotActionType.EquipFists, 'fist', 'FISTS', 1, 0, false, false );
		equipFistsCommand.itemType = QuickSlotItemType.Weapon;
		weaponsWheel.PushBack( holsterCommand );
		PushBackCommands( gamedataEquipmentArea.WeaponWheel, weaponsWheel, allowedItemTypes, allowedTag );
		if( ( ( allowedItemTypes.Size() == 0 ) || allowedItemTypes.Contains( gamedataItemType.Wea_Fists ) ) && !( ItemID.IsValid( EquipmentSystem.GetData( m_Player ).GetActiveMeleeWare() ) ) )
		{
			weaponsWheel.PushBack( equipFistsCommand );
		}
	}

	public const function GetVehicleWheel( vehicleWheel : ref< array< QuickSlotCommand > > )
	{
		var i : Int32;
		var iconPath : CName;
		var title : String;
		var type : String;
		var itemRecord : Vehicle_Record;
		var vehicles : array< PlayerVehicle >;
		var quickSlotCommand : QuickSlotCommand;
		var gmplSettingBB : IBlackboard;
		var summonToggleEnabled : Bool;
		GameInstance.GetVehicleSystem( m_Player.GetGame() ).GetPlayerUnlockedVehicles( vehicles );
		for( i = 0; i < vehicles.Size(); i += 1 )
		{
			if( TDBID.IsValid( vehicles[ i ].recordID ) )
			{
				itemRecord = TweakDBInterface.GetVehicleRecord( vehicles[ i ].recordID );
				iconPath = FindTempVehicleIcon( vehicles[ i ] );
				title = itemRecord.Model().EnumName();
				type = itemRecord.Type().EnumName();
				quickSlotCommand = CreateQuickSlotItemCommand( ItemID.None(), QuickSlotActionType.SetActiveVehicle, iconPath, title, type, "" );
				quickSlotCommand.playerVehicleData = vehicles[ i ];
				quickSlotCommand.itemType = QuickSlotItemType.Vehicle;
				vehicleWheel.PushBack( quickSlotCommand );
			}
		}
		gmplSettingBB = GameInstance.GetBlackboardSystem( m_Player.GetGame() ).Get( GetAllBlackboardDefs().GameplaySettings );
		summonToggleEnabled = gmplSettingBB.GetBool( GetAllBlackboardDefs().GameplaySettings.EnableVehicleToggleSummonMode );
		if( summonToggleEnabled )
		{
			title = "Toggle summon mode";
			quickSlotCommand = CreateQuickSlotItemCommand( ItemID.None(), QuickSlotActionType.ToggleSummonMode, '', title, "", "" );
			quickSlotCommand.itemType = QuickSlotItemType.Vehicle;
			vehicleWheel.PushBack( quickSlotCommand );
		}
	}

	private const function FindTempVehicleIcon( vehicle : PlayerVehicle ) : CName
	{
		switch( vehicle.vehicleType )
		{
			case gamedataVehicleType.Car:
				return 'temp_car';
			case gamedataVehicleType.Bike:
				return 'temp_bike';
			default:
				return '';
		}
	}

	protected const function PushBackCommands( area : gamedataEquipmentArea, commandList : ref< array< QuickSlotCommand > >, optional const allowedItemTypes : array< gamedataItemType >, optional const allowedTag : CName )
	{
		var areaCommandList : array< QuickSlotCommand >;
		var i : Int32;
		areaCommandList = GetEquipAreaCommands( area, allowedItemTypes, allowedTag );
		for( i = 0; i < areaCommandList.Size(); i += 1 )
		{
			commandList.PushBack( areaCommandList[ i ] );
		}
	}

	public const function GetEquipAreaCommands( const equipArea : gamedataEquipmentArea, optional const allowedItemTypes : array< gamedataItemType >, optional const allowedTag : CName ) : array< QuickSlotCommand >
	{
		var quickSlotCommands : array< QuickSlotCommand >;
		var quickSlotCommand : QuickSlotCommand;
		var i : Int32;
		var iconPath : CName;
		var title : String;
		var type : String;
		var ammoCount : String;
		var itemRecord : Item_Record;
		var itemTags : array< CName >;
		var numSlots : Int32;
		var equipData : EquipmentSystemPlayerData;
		var itemID : ItemID;
		equipData = EquipmentSystem.GetData( m_Player );
		numSlots = equipData.GetNumberOfSlots( equipArea );
		for( i = 0; i < numSlots; i += 1 )
		{
			itemID = equipData.GetItemInEquipSlot( equipArea, i );
			quickSlotCommand.equipType = equipArea;
			quickSlotCommand.slotIndex = i;
			if( itemID == ItemID.None() )
			{
				quickSlotCommand = CreateBlankWheelCommand();
				quickSlotCommands.PushBack( quickSlotCommand );
				continue;
			}
			itemRecord = TweakDBInterface.GetItemRecord( ItemID.GetTDBID( itemID ) );
			if( ( allowedItemTypes.Size() > 0 ) && !( allowedItemTypes.Contains( itemRecord.ItemType().Type() ) ) )
			{
				quickSlotCommand = CreateBlankWheelCommand();
				quickSlotCommands.PushBack( quickSlotCommand );
				continue;
			}
			if( IsNameValid( allowedTag ) )
			{
				itemTags = itemRecord.Tags();
				if( !( itemTags.Contains( allowedTag ) ) )
				{
					quickSlotCommand = CreateBlankWheelCommand();
					quickSlotCommands.PushBack( quickSlotCommand );
					continue;
				}
			}
			iconPath = StringToName( itemRecord.IconPath() );
			title = NameToString( itemRecord.DisplayName() );
			type = LocKeyToString( itemRecord.ItemType().LocalizedType() );
			ammoCount = ( ( String )( RPGManager.GetAmmoCount( m_Player, itemID ) ) );
			quickSlotCommand = CreateQuickSlotItemCommand( itemID, QuickSlotActionType.SelectItem, iconPath, title, type, ammoCount );
			quickSlotCommand.itemType = GetQuickSlotItemTypeByEquipArea( equipArea );
			quickSlotCommands.PushBack( quickSlotCommand );
		}
		return quickSlotCommands;
	}

	protected const function GetQuickSlotItemTypeByEquipArea( eqArea : gamedataEquipmentArea ) : QuickSlotItemType
	{
		switch( eqArea )
		{
			case gamedataEquipmentArea.Consumable:
				return QuickSlotItemType.Consumable;
			case gamedataEquipmentArea.QuickSlot:
				return QuickSlotItemType.Gadget;
			case gamedataEquipmentArea.QuickWheel:
				return QuickSlotItemType.Gadget;
			case gamedataEquipmentArea.WeaponWheel:
				return QuickSlotItemType.Weapon;
			case gamedataEquipmentArea.CyberwareWheel:
				return QuickSlotItemType.Cyberware;
			case gamedataEquipmentArea.ArmsCW:
				return QuickSlotItemType.Cyberware;
			default:
				return QuickSlotItemType.Undefined;
		}
	}

	private function ChooseWheelItem( direction : EDPadSlot, const wheelItem : ref< QuickSlotCommand > ) : Bool
	{
		var success : Bool;
		success = TryExecuteCommand( wheelItem );
		return success;
	}

	public static function CreateBlankWheelCommand() : QuickSlotCommand
	{
		var wheelCommand : QuickSlotCommand;
		wheelCommand.ActionType = QuickSlotActionType.Undefined;
		wheelCommand.IconName = 'temp_x';
		wheelCommand.Type = "";
		wheelCommand.Title = "";
		wheelCommand.Description = "";
		return wheelCommand;
	}

	protected function ExecuteCommand( const command : ref< QuickSlotCommand > )
	{
		switch( command.ActionType )
		{
			case QuickSlotActionType.SelectItem:
				SelectItem( command );
			break;
			case QuickSlotActionType.HideWeapon:
				HideWeapon();
			break;
			case QuickSlotActionType.EquipFists:
				RequestEquipFists();
			break;
			case QuickSlotActionType.OpenPhone:
				UsePhone();
			break;
			case QuickSlotActionType.ToggleRadio:
				SendRadioEvent( true, false, 0 );
			break;
			case QuickSlotActionType.SelectRadioStation:
				SendRadioEvent( true, true, command.intData );
			break;
			case QuickSlotActionType.TurnOffRadio:
				SendRadioEvent( false, false, -1 );
			break;
			case QuickSlotActionType.SetActiveVehicle:
				SetActiveVehicle( command.playerVehicleData );
			break;
			case QuickSlotActionType.SummonVehicle:
				SummonVehicle( false );
			break;
			case QuickSlotActionType.QuickHack:
				ApplyQuickHack( command );
			break;
			case QuickSlotActionType.ToggleSummonMode:
				ToggleSummonMode();
			break;
		}
	}

	public function SelectItem( const command : ref< QuickSlotCommand > )
	{
		if( command.itemType == QuickSlotItemType.Weapon )
		{
			RequestWeaponEquip( command.ItemId );
		}
		else
		{
			AssignItem( command.ItemId );
		}
	}

	private function ToggleFireMode()
	{
		m_Player.GetPlayerStateMachineBlackboard().SetBool( GetAllBlackboardDefs().PlayerStateMachine.ToggleFireMode, true );
	}

	private function HideWeapon()
	{
		var equipmentManipulationRequest : EquipmentSystemWeaponManipulationRequest;
		var eqSystem : weak< EquipmentSystem >;
		equipmentManipulationRequest = new EquipmentSystemWeaponManipulationRequest;
		eqSystem = ( ( EquipmentSystem )( GameInstance.GetScriptableSystemsContainer( m_Player.GetGame() ).Get( 'EquipmentSystem' ) ) );
		equipmentManipulationRequest.requestType = EquipmentManipulationAction.UnequipWeapon;
		equipmentManipulationRequest.owner = m_Player;
		eqSystem.QueueRequest( equipmentManipulationRequest );
	}

	private function UsePhone()
	{
		GameInstance.GetScriptableSystemsContainer( m_Player.GetGame() ).Get( 'PhoneSystem' ).QueueRequest( new UsePhoneRequest );
	}

	public function GetActiveVehicleType() : gamedataVehicleType
	{
		return GetPS().GetActiveType();
	}

	public function SetActiveVehicle( vehicleData : PlayerVehicle )
	{
		if( TDBID.IsValid( vehicleData.recordID ) )
		{
			GameInstance.GetVehicleSystem( m_Player.GetGame() ).TogglePlayerActiveVehicle( vehicleData.recordID, vehicleData.vehicleType, true );
			GetPS().SetActiveType( vehicleData.vehicleType );
		}
	}

	public function SummonVehicle( force : Bool )
	{
		var dpadAction : DPADActionPerformed;
		var canSummonVehicle : Bool;
		canSummonVehicle = force || !( GameInstance.GetVehicleSystem( m_Player.GetGame() ).IsActivePlayerVehicleOnCooldown( GetActiveVehicleType() ) );
		if( !( canSummonVehicle ) )
		{
			return;
		}
		dpadAction = new DPADActionPerformed;
		dpadAction.action = EHotkey.DPAD_RIGHT;
		dpadAction.state = EUIActionState.COMPLETED;
		dpadAction.successful = true;
		GameInstance.GetVehicleSystem( m_Player.GetGame() ).SpawnPlayerVehicle( GetActiveVehicleType() );
		GameInstance.GetUISystem( m_Player.GetGame() ).QueueEvent( dpadAction );
	}

	private function ApplyQuickHack( const command : ref< QuickSlotCommand > )
	{
		var commandUsed : QuickSlotCommandUsed;
		commandUsed = new QuickSlotCommandUsed;
		commandUsed.action = command.interactiveAction;
		m_Player.QueueEventForEntityID( command.interactiveActionOwner, commandUsed );
	}

	private function ToggleSummonMode()
	{
		GameInstance.GetVehicleSystem( m_Player.GetGame() ).ToggleSummonMode();
	}

	public function SendRadioEvent( toggle : Bool, setStation : Bool, stationIndex : Int32 )
	{
		var vehRadioEvent : VehicleRadioEvent;
		vehRadioEvent = new VehicleRadioEvent;
		vehRadioEvent.toggle = toggle;
		vehRadioEvent.setStation = setStation;
		vehRadioEvent.station = ( ( stationIndex >= 0 ) ? ( ( ( Int32 )( RadioStationDataProvider.GetRadioStationByUIIndex( stationIndex ) ) ) ) : ( -1 ) );
		if( m_IsPlayerInCar )
		{
			m_Player.QueueEventForEntityID( m_PlayerVehicleID, vehRadioEvent );
		}
		m_Player.QueueEvent( vehRadioEvent );
	}

	public function RequestWeaponEquip( itemId : ItemID )
	{
		var setActiveItemRequest : SetActiveItemInEquipmentArea;
		var equipmentManipulationRequest : EquipmentSystemWeaponManipulationRequest;
		var eqSystem : weak< EquipmentSystem >;
		setActiveItemRequest = new SetActiveItemInEquipmentArea;
		equipmentManipulationRequest = new EquipmentSystemWeaponManipulationRequest;
		eqSystem = ( ( EquipmentSystem )( GameInstance.GetScriptableSystemsContainer( m_Player.GetGame() ).Get( 'EquipmentSystem' ) ) );
		setActiveItemRequest.itemID = itemId;
		setActiveItemRequest.owner = m_Player;
		eqSystem.QueueRequest( setActiveItemRequest );
		equipmentManipulationRequest.requestType = EquipmentManipulationAction.RequestActiveWeapon;
		equipmentManipulationRequest.owner = m_Player;
		eqSystem.QueueRequest( equipmentManipulationRequest );
	}

	public function RequestEquipFists()
	{
		var equipmentManipulationRequest : EquipmentSystemWeaponManipulationRequest;
		var eqSystem : weak< EquipmentSystem >;
		equipmentManipulationRequest = new EquipmentSystemWeaponManipulationRequest;
		eqSystem = ( ( EquipmentSystem )( GameInstance.GetScriptableSystemsContainer( m_Player.GetGame() ).Get( 'EquipmentSystem' ) ) );
		equipmentManipulationRequest.requestType = EquipmentManipulationAction.RequestFists;
		equipmentManipulationRequest.owner = m_Player;
		eqSystem.QueueRequest( equipmentManipulationRequest );
	}

	public function AssignItem( itemId : ItemID )
	{
		var setActiveItemRequest : SetActiveItemInEquipmentArea;
		var eqSystem : weak< EquipmentSystem >;
		setActiveItemRequest = new SetActiveItemInEquipmentArea;
		eqSystem = ( ( EquipmentSystem )( GameInstance.GetScriptableSystemsContainer( m_Player.GetGame() ).Get( 'EquipmentSystem' ) ) );
		setActiveItemRequest.itemID = itemId;
		setActiveItemRequest.owner = m_Player;
		eqSystem.QueueRequest( setActiveItemRequest );
	}

	public function AssignItemToCyberwareSlot( itemId : ItemID, slotIndex : Int32 )
	{
		var request : AssignToCyberwareWheelRequest;
		var eqSystem : weak< EquipmentSystem >;
		eqSystem = ( ( EquipmentSystem )( GameInstance.GetScriptableSystemsContainer( m_Player.GetGame() ).Get( 'EquipmentSystem' ) ) );
		request = new AssignToCyberwareWheelRequest;
		request.owner = m_Player;
		request.itemID = itemId;
		request.slotIndex = slotIndex;
		eqSystem.QueueRequest( request );
	}

	private function IsPhoneAvailable() : Bool
	{
		var journalMgr : JournalManager;
		var context : JournalRequestContext;
		var entries : array< weak< JournalEntry > >;
		context.stateFilter.active = true;
		journalMgr = GameInstance.GetJournalManager( m_Player.GetGame() );
		journalMgr.GetContacts( context, entries );
		return ( entries.Size() > 0 ) && ( ( PhoneSystem )( GameInstance.GetScriptableSystemsContainer( m_Player.GetGame() ).Get( 'PhoneSystem' ) ) ).IsPhoneAvailable();
	}

	public function GetAssignedQuickSlotCommand( itemType : QuickSlotItemType ) : QuickSlotCommand
	{
		var item : ItemID;
		var quickSlots : array< QuickSlotCommand >;
		var i : Int32;
		item = GetAssignedItemIDByType( itemType );
		if( itemType == QuickSlotItemType.Vehicle )
		{
		}
		if( !( ItemID.IsValid( item ) ) )
		{
			return CreateEmptyQuickSlotCommand();
		}
		PushBackCommands( GetGamedataEquipmentAreaFromItemType( itemType ), quickSlots );
		for( i = 0; i < quickSlots.Size(); i += 1 )
		{
			if( item == quickSlots[ i ].ItemId )
			{
				return quickSlots[ i ];
			}
		}
		return CreateEmptyQuickSlotCommand();
	}

	private function GetAssignedItemIDByType( itemType : QuickSlotItemType ) : ItemID
	{
		switch( itemType )
		{
			case QuickSlotItemType.Weapon:
				return EquipmentSystem.GetData( m_Player ).GetActiveItem( gamedataEquipmentArea.WeaponWheel );
			case QuickSlotItemType.Consumable:
				return EquipmentSystem.GetData( m_Player ).GetActiveConsumable();
			case QuickSlotItemType.Gadget:
				return EquipmentSystem.GetData( m_Player ).GetActiveGadget();
			default:
				return ItemID.None();
		}
	}

	private function GetGamedataEquipmentAreaFromItemType( itemType : QuickSlotItemType ) : gamedataEquipmentArea
	{
		switch( itemType )
		{
			case QuickSlotItemType.Weapon:
				return gamedataEquipmentArea.WeaponWheel;
			case QuickSlotItemType.Consumable:
				return gamedataEquipmentArea.Consumable;
			case QuickSlotItemType.Gadget:
				return gamedataEquipmentArea.QuickWheel;
			default:
				return gamedataEquipmentArea.Invalid;
		}
	}

	protected function CreateEmptyQuickSlotCommand() : QuickSlotCommand
	{
		return CreateQuickSlotItemCommand( ItemID.None(), QuickSlotActionType.Undefined, '', "", "", "" );
	}

}

