class CyberdeckTooltip extends AGenericTooltipController
{
	protected editable var m_itemNameText : inkTextRef;
	protected editable var m_nameTextContainer : inkWidgetRef;
	protected editable var m_nameForRecipeText : inkTextRef;
	protected editable var m_itemRarityText : inkTextRef;
	protected editable var m_rarityBars : inkWidgetRef;
	protected editable var m_categoriesWrapper : inkCompoundRef;
	protected editable var m_topContainer : inkCompoundRef;
	protected editable var m_headerContainer : inkCompoundRef;
	protected editable var m_statsContainer : inkCompoundRef;
	protected editable var m_hacksContainer : inkCompoundRef;
	protected editable var m_descriptionContainer : inkCompoundRef;
	protected editable var m_bottomContainer : inkCompoundRef;
	protected editable var m_statsList : inkCompoundRef;
	protected editable var m_priceContainer : inkCompoundRef;
	protected editable var m_descriptionText : inkTextRef;
	protected editable var m_priceText : inkTextRef;
	protected editable var m_equipedWrapper : inkWidgetRef;
	protected editable var m_itemTypeText : inkTextRef;
	protected editable var m_itemWeightWrapper : inkWidgetRef;
	protected editable var m_itemWeightText : inkTextRef;
	protected editable var m_cybderdeckBaseMemoryValue : inkTextRef;
	protected editable var m_cybderdeckBufferValue : inkTextRef;
	protected editable var m_cybderdeckSlotsValue : inkTextRef;
	protected editable var m_deviceHacksGrid : inkCompoundRef;
	protected editable var m_deviceHackHeader : inkTextRef;
	protected editable var m_namesTextContainer : inkWidgetRef;
	protected editable var m_deviceHackNamesText : inkTextRef;
	protected editable var m_textBG : inkWidgetRef;
	protected editable var m_namesTextContainer2 : inkWidgetRef;
	protected editable var m_deviceHackNamesText2 : inkTextRef;
	protected editable var m_textBG2 : inkWidgetRef;
	protected editable var m_namesTextContainer3 : inkWidgetRef;
	protected editable var m_deviceHackNamesText3 : inkTextRef;
	protected editable var m_textBG3 : inkWidgetRef;
	protected editable var m_namesTextContainer4 : inkWidgetRef;
	protected editable var m_deviceHackNamesText4 : inkTextRef;
	protected editable var m_textBG4 : inkWidgetRef;
	protected editable var m_itemIconImage : inkImageRef;
	protected editable var m_itemAttributeRequirementsWrapper : inkWidgetRef;
	protected editable var m_itemAttributeRequirements : inkWidgetRef;
	protected editable var m_itemAttributeRequirementsText : inkTextRef;
	protected editable var m_allocationCostsWrapper : inkCompoundRef;
	protected editable var m_iconicLines : inkImageRef;
	protected editable var m_equipedCorner : inkWidgetRef;
	protected editable var m_root : inkWidgetRef;
	protected editable var m_iconicBG : inkWidgetRef;
	protected editable var m_recipeWrapper : inkWidgetRef;
	protected editable var m_recipeBG : inkWidgetRef;
	protected editable var m_illegalBG : inkWidgetRef;
	protected editable var m_cyberwareUpgradeContainer : inkWidgetRef;
	protected editable var m_itemCWQuickHackMenuLinkContainer : inkWidgetRef;
	protected editable var m_additionalModulesLibraryRes : ResRef;
	default m_additionalModulesLibraryRes = R"base\gameplay\gui\common\tooltip\cyberware_tooltip_modules.inkwidget";
	protected editable var m_cyberwareUpgradeModuleName : CName;
	default m_cyberwareUpgradeModuleName = 'itemCyberwareUpgrade';
	protected var m_rarityBarsController : weak< LevelBarsController >;
	protected var m_data : InventoryTooltipData;
	private var m_itemDisplayContext : ItemDisplayContext;
	protected var m_player : weak< PlayerPuppet >;
	protected var m_cyberwareUpgradeController : weak< ItemTooltipCyberwareUpgradeController >;
	protected var m_hasVehiclePerk : Bool;
	protected var m_animProxy : inkAnimProxy;
	protected var m_settings : UserSettings;
	protected var m_settingsListener : CyberdeckTooltipSettingsListener;
	protected var m_groupPath : CName;
	default m_groupPath = '/accessibility/interface';
	protected editable var m_minWidth : inkWidgetRef;
	protected var m_bigFontEnabled : Bool;
	protected var m_itemData : weak< UIInventoryItem >;
	protected var m_displayContext : ItemDisplayContextData;
	protected var m_comparisonData : UIInventoryItemComparisonManager;
	protected var m_tooltipDisplayContext : InventoryTooltipDisplayContext;

	protected event OnInitialize()
	{
		super.OnInitialize();
		m_rarityBarsController = ( ( LevelBarsController )( inkWidgetRef.GetController( m_rarityBars ) ) );
	}

	public override function SetData( tooltipData : ATooltipData )
	{
		var tooltipWrapper : UIInventoryItemTooltipWrapper;
		m_settings = new UserSettings;
		m_settingsListener = new CyberdeckTooltipSettingsListener;
		m_settingsListener.RegisterController( this );
		m_settingsListener.Register( m_groupPath );
		UpdateTooltipSize();
		if( ( ( InventoryTooltipData )( tooltipData ) ) )
		{
			m_data = ( ( InventoryTooltipData )( tooltipData ) );
			m_player = m_data.GetManager().GetAttachedPlayer();
			m_hasVehiclePerk = m_data.cyberdeckData.vehicleHackUnlocked;
			UpdateLayout();
		}
		else if( ( ( UIInventoryItemTooltipWrapper )( tooltipData ) ) )
		{
			tooltipWrapper = ( ( UIInventoryItemTooltipWrapper )( tooltipData ) );
			m_itemData = tooltipWrapper.m_data;
			m_comparisonData = tooltipWrapper.m_comparisonData;
			m_player = tooltipWrapper.m_displayContext.GetPlayerAsPuppet();
			m_displayContext = tooltipWrapper.m_displayContext;
			m_hasVehiclePerk = PlayerDevelopmentSystem.GetData( m_player ).IsNewPerkBought( gamedataNewPerkType.Intelligence_Right_Milestone_1 );
			NEW_UpdateLayout();
		}
	}

	public override function Show()
	{
		super.Show();
		if( m_animProxy )
		{
			m_animProxy.Stop();
			m_animProxy = NULL;
		}
		m_animProxy = PlayLibraryAnimationOnAutoSelectedTargets( 'show_item_tooltip', GetRootWidget() );
		m_animProxy.RegisterToCallback( inkanimEventType.OnFinish, this, 'OnShowAnimationFinished' );
	}

	protected function UpdateLayout()
	{
		var itemRecord : weak< Item_Record >;
		var itemData : gameItemData;
		itemRecord = TDB.GetItemRecord( ItemID.GetTDBID( InventoryItemData.GetID( m_data.inventoryItemData ) ) );
		itemData = InventoryItemData.GetGameItemData( m_data.inventoryItemData );
		UpdateName();
		UpdateRarity();
		UpdateCyberdeckStats();
		UpdateAbilities( itemData, itemRecord );
		GetDeviceHackNames( itemData, itemRecord );
		UpdateDescription( m_data.description );
		UpdatePrice();
		UpdateWeight( itemData.GetStatValueByType( gamedataStatType.Weight ) );
		UpdateIcon();
		UpdateRequirements();
		UpdateAllocationStats();
		UpdateIconicBG( RPGManager.IsItemIconic( InventoryItemData.GetGameItemData( m_data.inventoryItemData ) ) );
		UpdateRecipeBG( m_data.parentItemData.HasTag( 'Recipe' ) && m_tooltipDisplayContext != InventoryTooltipDisplayContext.Crafting );
		UpdateIllegalBG( m_data.parentItemData.HasTag( 'IllegalItem' ) );
		UpdateCyberwareUpgradeModule();
		UpdateCyberwareQuickHackMenuLinkModule();
		inkWidgetRef.SetVisible( m_equipedWrapper, m_data.isEquipped );
		inkWidgetRef.SetVisible( m_equipedCorner, m_data.isEquipped );
		inkWidgetRef.SetVisible( m_recipeWrapper, m_data.parentItemData.HasTag( 'Recipe' ) && m_tooltipDisplayContext != InventoryTooltipDisplayContext.Crafting );
		if( m_data.isEquipped == true )
		{
			inkWidgetRef.SetState( m_root, 'Equipped' );
		}
		else
		{
			inkWidgetRef.SetState( m_root, 'Default' );
		}
		FixLines();
	}

	protected function NEW_UpdateLayout()
	{
		NEW_UpdateName();
		NEW_UpdateRarity();
		NEW_UpdateCyberdeckStats();
		UpdateAbilities( m_itemData.GetItemData(), m_itemData.GetItemRecord() );
		GetDeviceHackNames( m_itemData.GetItemData(), m_itemData.GetItemRecord() );
		UpdateDescription( m_itemData.GetDescription() );
		NEW_UpdatePrice();
		UpdateWeight( m_itemData.GetWeight() );
		NEW_UpdateIcon();
		UpdateRequirements();
		NEW_UpdateAttributeAllocationStats( m_itemData, m_displayContext.GetPlayerAsPuppet() );
		UpdateIconicBG( m_itemData.IsIconic() );
		UpdateRecipeBG( m_itemData.IsRecipe() && !( m_displayContext.IsCraftingItem() ) );
		UpdateIllegalBG( m_itemData.IsIllegal() );
		UpdateCyberwareUpgradeModule();
		NEW_UpdateCyberwareQuickHackMenuLinkModule();
		inkWidgetRef.SetVisible( m_equipedWrapper, m_itemData.IsEquipped() );
		inkWidgetRef.SetVisible( m_equipedCorner, m_itemData.IsEquipped() );
		inkWidgetRef.SetVisible( m_recipeWrapper, m_itemData.IsRecipe() && !( m_displayContext.IsCraftingItem() ) );
		if( m_itemData.IsEquipped() == true )
		{
			inkWidgetRef.SetState( m_root, 'Equipped' );
		}
		else
		{
			inkWidgetRef.SetState( m_root, 'Default' );
		}
		FixLines();
	}

	protected virtual function UpdateIconicBG( visible : Bool )
	{
		if( visible )
		{
			inkWidgetRef.SetVisible( m_iconicBG, true );
		}
		else
		{
			inkWidgetRef.SetVisible( m_iconicBG, false );
		}
	}

	protected virtual function UpdateRecipeBG( visible : Bool )
	{
		if( visible )
		{
			inkWidgetRef.SetVisible( m_recipeBG, true );
			inkTextRef.SetVisible( m_itemNameText, false );
			inkWidgetRef.SetVisible( m_nameTextContainer, false );
			inkTextRef.SetVisible( m_nameForRecipeText, true );
		}
		else
		{
			inkWidgetRef.SetVisible( m_recipeBG, false );
			inkTextRef.SetVisible( m_itemNameText, true );
			inkWidgetRef.SetVisible( m_nameTextContainer, true );
			inkTextRef.SetVisible( m_nameForRecipeText, false );
		}
	}

	protected virtual function UpdateIllegalBG( visible : Bool )
	{
		if( visible )
		{
			inkWidgetRef.SetVisible( m_illegalBG, true );
		}
		else
		{
			inkWidgetRef.SetVisible( m_illegalBG, false );
		}
	}

	protected function GetAbilities( itemData : gameItemData, itemRecord : weak< Item_Record > ) : array< InventoryItemAbility >
	{
		var i, limit : Int32;
		var GLPAbilities : array< weak< GameplayLogicPackage_Record > >;
		var ability : InventoryItemAbility;
		var uiData : weak< GameplayLogicPackageUIData_Record >;
		var abilities : array< InventoryItemAbility >;
		itemRecord.OnAttach( GLPAbilities );
		for( i = 0, limit = GLPAbilities.Size(); i < limit; i += 1 )
		{
			if( GLPAbilities[ i ] )
			{
				uiData = GLPAbilities[ i ].UIData();
				if( uiData )
				{
					ability = InventoryItemAbility( uiData.IconPath(), uiData.LocalizedName(), uiData.LocalizedDescription(), UILocalizationDataPackage.FromLogicUIDataPackage( uiData, itemData ) );
					abilities.PushBack( ability );
				}
			}
		}
		GLPAbilities.Clear();
		itemRecord.OnEquip( GLPAbilities );
		for( i = 0, limit = GLPAbilities.Size(); i < limit; i += 1 )
		{
			if( GLPAbilities[ i ] )
			{
				uiData = GLPAbilities[ i ].UIData();
				if( uiData )
				{
					ability = InventoryItemAbility( uiData.IconPath(), uiData.LocalizedName(), uiData.LocalizedDescription(), UILocalizationDataPackage.FromLogicUIDataPackage( uiData, itemData ) );
					abilities.PushBack( ability );
				}
			}
		}
		return abilities;
	}

	protected function UpdateAbilities( itemData : gameItemData, itemRecord : weak< Item_Record > )
	{
		var abilities : array< InventoryItemAbility >;
		var abilitiesSize, i : Int32;
		var controller : CyberdeckStatController;
		abilities = GetAbilities( itemData, itemRecord );
		abilitiesSize = abilities.Size();
		if( abilitiesSize > 0 )
		{
			while( inkCompoundRef.GetNumChildren( m_statsList ) > abilitiesSize )
			{
				inkCompoundRef.RemoveChildByIndex( m_statsList, 0 );
			}
			while( inkCompoundRef.GetNumChildren( m_statsList ) < abilitiesSize )
			{
				SpawnFromLocal( inkCompoundRef.Get( m_statsList ), 'cyberdeckStat' );
			}
			for( i = 0; i < abilitiesSize; i += 1 )
			{
				controller = ( ( CyberdeckStatController )( inkCompoundRef.GetWidgetByIndex( m_statsList, i ).GetController() ) );
				controller.Setup( abilities[ i ] );
			}
			inkCompoundRef.SetVisible( m_statsContainer, abilitiesSize > 0 );
		}
		else
		{
			inkCompoundRef.SetVisible( m_statsContainer, false );
		}
	}

	protected function UpdateCyberdeckStats()
	{
		var memoryValue, cyberdeckBufferValue : Float;
		var tweakRecord : weak< Item_Record >;
		var tweakID : TweakDBID;
		var onEquipList : array< weak< GameplayLogicPackage_Record > >;
		var statsList : array< weak< StatModifier_Record > >;
		var i, j, slots : Int32;
		var slots2 : array< SPartSlots >;
		var statType : weak< Stat_Record >;
		var stat : weak< ConstantStatModifier_Record >;
		tweakID = ItemID.GetTDBID( InventoryItemData.GetID( m_data.inventoryItemData ) );
		tweakRecord = TDB.GetItemRecord( tweakID );
		tweakRecord.OnEquip( onEquipList );
		for( i = 0; i < onEquipList.Size(); i += 1 )
		{
			onEquipList[ i ].Stats( statsList );
			for( j = 0; j < statsList.Size(); j += 1 )
			{
				statType = statsList[ j ].StatType();
				stat = ( ( weak< weak< ConstantStatModifier_Record > > )( statsList[ j ] ) );
				if( stat )
				{
					if( statType.StatType() == gamedataStatType.Memory )
					{
						memoryValue = stat.Value();
					}
					else if( statType.StatType() == gamedataStatType.BufferSize )
					{
						cyberdeckBufferValue = stat.Value();
					}
				}
			}
		}
		slots = InventoryItemData.GetAttachmentsSize( m_data.inventoryItemData );
		if( slots == 0 )
		{
			slots2 = ItemModificationSystem.GetSlotsForCyberdeckFromItemData( InventoryItemData.GetGameItemData( m_data.inventoryItemData ) );
			slots = slots2.Size();
		}
		inkTextRef.SetText( m_cybderdeckBaseMemoryValue, FloatToStringPrec( memoryValue, 0 ) );
		inkTextRef.SetText( m_cybderdeckBufferValue, FloatToStringPrec( cyberdeckBufferValue, 0 ) );
		inkTextRef.SetText( m_cybderdeckSlotsValue, IntToString( slots ) );
	}

	protected function NEW_UpdateCyberdeckStats()
	{
		var memoryValue, cyberdeckBufferValue : Float;
		var onEquipList : array< weak< GameplayLogicPackage_Record > >;
		var statsList : array< weak< StatModifier_Record > >;
		var i, j, slots : Int32;
		var slots2 : array< SPartSlots >;
		var statType : weak< Stat_Record >;
		var stat : weak< ConstantStatModifier_Record >;
		m_itemData.GetItemRecord().OnEquip( onEquipList );
		for( i = 0; i < onEquipList.Size(); i += 1 )
		{
			onEquipList[ i ].Stats( statsList );
			for( j = 0; j < statsList.Size(); j += 1 )
			{
				statType = statsList[ j ].StatType();
				stat = ( ( weak< weak< ConstantStatModifier_Record > > )( statsList[ j ] ) );
				if( stat )
				{
					if( statType.StatType() == gamedataStatType.Memory )
					{
						memoryValue = stat.Value();
					}
					else if( statType.StatType() == gamedataStatType.BufferSize )
					{
						cyberdeckBufferValue = stat.Value();
					}
				}
			}
		}
		slots = m_itemData.GetModsManager().GetAllSlotsSize();
		if( slots == 0 )
		{
			slots2 = ItemModificationSystem.GetSlotsForCyberdeckFromItemData( m_itemData.GetItemData() );
			slots = slots2.Size();
		}
		inkTextRef.SetText( m_cybderdeckBaseMemoryValue, FloatToStringPrec( memoryValue, 0 ) );
		inkTextRef.SetText( m_cybderdeckBufferValue, FloatToStringPrec( cyberdeckBufferValue, 0 ) );
		inkTextRef.SetText( m_cybderdeckSlotsValue, IntToString( slots ) );
	}

	protected function SetupDeviceHacks( itemRecord : weak< Item_Record > )
	{
		var hacks : array< CyberdeckDeviceQuickhackData >;
		var i : Int32;
		var widget : weak< inkWidget >;
		var controller : CyberdeckDeviceHackIcon;
		hacks = GetCyberdeckDeviceQuickhacks( itemRecord );
		inkCompoundRef.RemoveAllChildren( m_deviceHacksGrid );
		for( i = 0; i < hacks.Size(); i += 1 )
		{
			widget = SpawnFromLocal( inkCompoundRef.Get( m_deviceHacksGrid ), 'deviceHackIcon' );
			controller = ( ( CyberdeckDeviceHackIcon )( widget.GetController() ) );
			controller.Setup( hacks[ i ] );
		}
	}

	protected function GetDeviceHackNames( itemData : gameItemData, itemRecord : weak< Item_Record > )
	{
		var allHacks : array< CyberdeckDeviceQuickhackData >;
		var hacks : array< CyberdeckDeviceQuickhackData >;
		var currentHack : CyberdeckDeviceQuickhackData;
		var uniqueActionNames : array< CName >;
		var currentName : String;
		var i, nextIndex : Int32;
		var hackNamesTier1, hackNamesTier2, hackNamesTier3, hackNamesTier45 : String;
		var showTier1, showTier2, showTier3, showTier4 : Bool;
		var quality : gamedataQuality;
		quality = RPGManager.GetItemDataQuality( itemData );
		showTier1 = false;
		showTier2 = false;
		showTier3 = false;
		showTier4 = false;
		allHacks = GetCyberdeckDeviceQuickhacks( itemRecord );
		nextIndex = 0;
		for( i = 0; i < allHacks.Size(); i += 1 )
		{
			currentHack = allHacks[ i ];
			if( uniqueActionNames.Contains( currentHack.ObjectActionName ) )
			{
				continue;
			}
			uniqueActionNames.PushBack( currentHack.ObjectActionName );
			if( currentHack.ObjectActionType == gamedataObjectActionType.VehicleQuickHack && m_hasVehiclePerk )
			{
				hacks.PushBack( currentHack );
			}
			else if( currentHack.ObjectActionType == gamedataObjectActionType.DeviceQuickHack )
			{
				if( ( currentHack.ObjectActionName == 'TakeControlClassHack' || currentHack.ObjectActionName == 'TurretToggleStateClassHack' ) || currentHack.ObjectActionName == 'TurretOverloadClassHack' )
				{
					hacks.PushBack( currentHack );
				}
				else
				{
					hacks.Insert( nextIndex, currentHack );
					nextIndex += 1;
				}
			}
		}
		for( i = 0; i < hacks.Size(); i += 1 )
		{
			currentHack = hacks[ i ];
			currentName = GetLocalizedText( NameToString( currentHack.ObjectActionLocName ) );
			if( currentHack.ObjectActionTier == gamedataDeviceHackTier.Tier4DeviceHack || currentHack.ObjectActionTier == gamedataDeviceHackTier.Tier5DeviceHack )
			{
				if( currentHack.ObjectActionType == gamedataObjectActionType.VehicleQuickHack )
				{
					currentName = ( ( GetLocalizedText( NameToString( currentHack.ObjectActionLocName ) ) + " (" ) + GetLocalizedText( "LocKey#77971" ) ) + ")";
				}
				hackNamesTier45 += ( ( showTier4 ) ? ( ( ", " + currentName ) ) : ( ( "" + currentName ) ) );
				showTier4 = true;
			}
			if( currentHack.ObjectActionTier == gamedataDeviceHackTier.Tier3DeviceHack )
			{
				if( currentHack.ObjectActionType == gamedataObjectActionType.VehicleQuickHack )
				{
					currentName = ( ( GetLocalizedText( NameToString( currentHack.ObjectActionLocName ) ) + " (" ) + GetLocalizedText( "LocKey#77971" ) ) + ")";
				}
				hackNamesTier3 += ( ( showTier3 ) ? ( ( ", " + currentName ) ) : ( ( "" + currentName ) ) );
				showTier3 = true;
			}
			if( currentHack.ObjectActionTier == gamedataDeviceHackTier.Tier2DeviceHack )
			{
				if( currentHack.ObjectActionType == gamedataObjectActionType.VehicleQuickHack )
				{
					currentName = ( ( GetLocalizedText( NameToString( currentHack.ObjectActionLocName ) ) + " (" ) + GetLocalizedText( "LocKey#77971" ) ) + ")";
				}
				if( ( currentHack.ObjectActionName == 'TakeControlClassHack' || currentHack.ObjectActionName == 'TurretToggleStateClassHack' ) || currentHack.ObjectActionName == 'TurretOverloadClassHack' )
				{
					currentName = ( ( GetLocalizedText( NameToString( currentHack.ObjectActionLocName ) ) + " (" ) + GetLocalizedText( "LocKey#38436" ) ) + ")";
				}
				hackNamesTier2 += ( ( showTier2 ) ? ( ( ", " + currentName ) ) : ( ( "" + currentName ) ) );
				showTier2 = true;
			}
			if( currentHack.ObjectActionTier == gamedataDeviceHackTier.Tier1DeviceHack )
			{
				if( currentHack.ObjectActionType == gamedataObjectActionType.VehicleQuickHack )
				{
					currentName = ( ( GetLocalizedText( NameToString( currentHack.ObjectActionLocName ) ) + " (" ) + GetLocalizedText( "LocKey#77971" ) ) + ")";
				}
				if( currentHack.ObjectActionName == 'TurretToggleStateClassHack' || currentHack.ObjectActionName == 'TurretOverloadClassHack' )
				{
					currentName = ( ( GetLocalizedText( NameToString( currentHack.ObjectActionLocName ) ) + " (" ) + GetLocalizedText( "LocKey#38436" ) ) + ")";
				}
				hackNamesTier1 += ( ( showTier1 ) ? ( ( ", " + currentName ) ) : ( ( "" + currentName ) ) );
				showTier1 = true;
			}
		}
		inkWidgetRef.SetVisible( m_namesTextContainer, showTier1 );
		inkWidgetRef.SetVisible( m_namesTextContainer2, showTier2 );
		inkWidgetRef.SetVisible( m_namesTextContainer3, showTier3 );
		inkWidgetRef.SetVisible( m_namesTextContainer4, showTier4 );
		inkTextRef.SetText( m_deviceHackNamesText, hackNamesTier1 );
		inkTextRef.SetText( m_deviceHackNamesText2, hackNamesTier2 );
		inkTextRef.SetText( m_deviceHackNamesText3, hackNamesTier3 );
		inkTextRef.SetText( m_deviceHackNamesText4, hackNamesTier45 );
		if( quality == gamedataQuality.Epic || quality == gamedataQuality.Legendary )
		{
			inkWidgetRef.SetVisible( m_textBG, false );
			inkWidgetRef.SetVisible( m_textBG2, false );
			inkWidgetRef.SetVisible( m_textBG3, false );
			inkWidgetRef.SetVisible( m_textBG4, true );
		}
		if( quality == gamedataQuality.Rare )
		{
			inkWidgetRef.SetVisible( m_textBG, false );
			inkWidgetRef.SetVisible( m_textBG2, false );
			inkWidgetRef.SetVisible( m_textBG3, true );
			inkWidgetRef.SetVisible( m_textBG4, false );
		}
		if( quality == gamedataQuality.Uncommon )
		{
			inkWidgetRef.SetVisible( m_textBG, false );
			inkWidgetRef.SetVisible( m_textBG2, true );
			inkWidgetRef.SetVisible( m_textBG3, false );
			inkWidgetRef.SetVisible( m_textBG4, false );
		}
		if( quality == gamedataQuality.Common )
		{
			inkWidgetRef.SetVisible( m_textBG, true );
			inkWidgetRef.SetVisible( m_textBG2, false );
			inkWidgetRef.SetVisible( m_textBG3, false );
			inkWidgetRef.SetVisible( m_textBG4, false );
		}
		inkTextRef.SetText( m_deviceHackHeader, GetLocalizedText( ( ( m_hasVehiclePerk ) ? ( "LocKey#53490" ) : ( "LocKey#95038" ) ) ) );
	}

	protected function GetCyberdeckDeviceQuickhacks( itemRecord : weak< Item_Record > ) : array< CyberdeckDeviceQuickhackData >
	{
		var i : Int32;
		var objectActions : array< weak< ObjectAction_Record > >;
		var objectActionType : ObjectActionType_Record;
		var deviceHacks : array< weak< ObjectAction_Record > >;
		var uiAction : weak< InteractionBase_Record >;
		var data : CyberdeckDeviceQuickhackData;
		var result : array< CyberdeckDeviceQuickhackData >;
		itemRecord.ObjectActions( objectActions );
		for( i = 0; i < objectActions.Size(); i += 1 )
		{
			objectActionType = objectActions[ i ].ObjectActionType();
			if( objectActionType )
			{
				if( objectActionType.Type() == gamedataObjectActionType.DeviceQuickHack || objectActionType.Type() == gamedataObjectActionType.VehicleQuickHack )
				{
					deviceHacks.PushBack( objectActions[ i ] );
				}
			}
		}
		for( i = 0; i < deviceHacks.Size(); i += 1 )
		{
			uiAction = deviceHacks[ i ].ObjectActionUI();
			data.UIIcon = uiAction.CaptionIcon().TexturePartID();
			data.ObjectActionRecord = deviceHacks[ i ];
			data.ObjectActionLocName = StringToName( LocKeyToString( uiAction.Caption() ) );
			data.ObjectActionName = deviceHacks[ i ].ActionName();
			data.ObjectActionTier = deviceHacks[ i ].HackTier().Type();
			data.ObjectActionCategory = deviceHacks[ i ].DeviceHackCategory().Type();
			data.ObjectActionType = deviceHacks[ i ].ObjectActionType().Type();
			data.Priority = deviceHacks[ i ].Priority();
			result.PushBack( data );
		}
		return result;
	}

	protected function UpdateName()
	{
		var finalItemName : String;
		var quantity : Int32;
		quantity = InventoryItemData.GetQuantity( m_data.inventoryItemData );
		finalItemName = UIItemsHelper.GetTooltipItemName( m_data );
		if( quantity > 1 )
		{
			finalItemName += ( ( " [" + IntToString( quantity ) ) + "]" );
		}
		inkTextRef.SetText( m_itemNameText, finalItemName );
		inkTextRef.SetText( m_nameForRecipeText, finalItemName );
	}

	protected function NEW_UpdateName()
	{
		var finalItemName : String;
		var quantity : Int32;
		quantity = m_itemData.GetQuantity();
		finalItemName = m_itemData.GetName();
		if( quantity > 1 )
		{
			finalItemName += ( ( " [" + IntToString( quantity ) ) + "]" );
		}
		inkTextRef.SetText( m_itemNameText, finalItemName );
		inkTextRef.SetText( m_nameForRecipeText, finalItemName );
	}

	protected function UpdateRarity()
	{
		var quality : gamedataQuality;
		var rarityLabel, iconicLabel, plusLabel : String;
		var isIconic : Bool;
		var minimalItemTooltipData : MinimalItemTooltipData;
		minimalItemTooltipData = MinimalItemTooltipData.FromInventoryTooltipData( m_data );
		if( m_data.overrideRarity )
		{
			quality = UIItemsHelper.QualityNameToEnum( StringToName( m_data.quality ) );
		}
		else
		{
			quality = RPGManager.GetItemDataQuality( InventoryItemData.GetGameItemData( m_data.inventoryItemData ) );
		}
		iconicLabel = GetLocalizedText( UIItemsHelper.QualityToDefaultString( gamedataQuality.Iconic, RarityItemType.Cyberdeck ) );
		rarityLabel = GetLocalizedText( UIItemsHelper.QualityToTierString( quality ) );
		isIconic = RPGManager.IsItemIconic( InventoryItemData.GetGameItemData( m_data.inventoryItemData ) );
		plusLabel = rarityLabel;
		if( minimalItemTooltipData.isPlus >= 2.0 )
		{
			plusLabel += "++";
		}
		else if( minimalItemTooltipData.isPlus >= 1.0 )
		{
			plusLabel += "+";
		}
		if( minimalItemTooltipData.isIconic )
		{
			plusLabel += ( " / " + iconicLabel );
		}
		inkTextRef.SetState( m_itemNameText, UIItemsHelper.QualityEnumToName( quality ) );
		inkTextRef.SetState( m_itemRarityText, UIItemsHelper.QualityEnumToName( quality ) );
		inkTextRef.SetText( m_itemRarityText, plusLabel );
		m_rarityBarsController.Update( UIItemsHelper.QualityToInt( quality ) );
		inkImageRef.SetVisible( m_iconicLines, isIconic );
	}

	protected function NEW_UpdateRarity()
	{
		var quality : gamedataQuality;
		quality = m_itemData.GetQuality();
		inkTextRef.SetState( m_itemNameText, UIItemsHelper.QualityEnumToName( quality ) );
		inkTextRef.SetState( m_itemRarityText, UIItemsHelper.QualityEnumToName( quality ) );
		inkTextRef.SetText( m_itemRarityText, m_itemData.GetQualityText( RarityItemType.Cyberdeck ) );
		m_rarityBarsController.Update( UIItemsHelper.QualityToInt( quality ) );
		inkImageRef.SetVisible( m_iconicLines, m_itemData.IsIconic() );
	}

	protected function UpdateDescription( const description : ref< String > )
	{
		if( m_data.description != "" )
		{
			inkTextRef.SetText( m_descriptionText, m_data.description );
			inkCompoundRef.SetVisible( m_descriptionContainer, true );
		}
		else
		{
			inkCompoundRef.SetVisible( m_descriptionContainer, false );
		}
	}

	protected function UpdateWeight( weight : Float )
	{
		inkTextRef.SetText( m_itemWeightText, FloatToStringPrec( weight, 2 ) );
		if( weight == 0.0 )
		{
			inkWidgetRef.SetVisible( m_itemWeightWrapper, false );
		}
	}

	protected virtual function UpdateIcon()
	{
		var iconName : String;
		var emptyIcon : CName;
		var iconsNameResolver : IconsNameResolver;
		iconsNameResolver = IconsNameResolver.GetIconsNameResolver();
		if( m_data )
		{
			if( IsStringValid( InventoryItemData.GetIconPath( m_data.inventoryItemData ) ) )
			{
				iconName = InventoryItemData.GetIconPath( m_data.inventoryItemData );
			}
			else
			{
				iconName = NameToString( iconsNameResolver.TranslateItemToIconName( ItemID.GetTDBID( InventoryItemData.GetID( m_data.inventoryItemData ) ), InventoryItemData.GetIconGender( m_data.inventoryItemData ) == ItemIconGender.Male ) );
			}
			if( iconName != "None" && iconName != "" )
			{
				inkImageRef.SetScale( m_itemIconImage, ( ( InventoryItemData.GetEquipmentArea( m_data.inventoryItemData ) == gamedataEquipmentArea.Outfit ) ? ( Vector2( 0.5, 0.5 ) ) : ( Vector2( 1.0, 1.0 ) ) ) );
				InkImageUtils.RequestSetImage( this, m_itemIconImage, "UIIcon." + iconName, 'OnIconCallback' );
			}
			else
			{
				emptyIcon = UIItemsHelper.GetSlotShadowIcon( TDBID.None(), InventoryItemData.GetItemType( m_data.inventoryItemData ), InventoryItemData.GetEquipmentArea( m_data.inventoryItemData ) );
				InkImageUtils.RequestSetImage( this, m_itemIconImage, emptyIcon );
			}
		}
	}

	protected virtual function NEW_UpdateIcon()
	{
		var iconPath : String;
		var emptyIcon : CName;
		if( m_itemData != NULL )
		{
			iconPath = m_itemData.GetIconPath();
			if( IsStringValid( iconPath ) )
			{
				InkImageUtils.RequestSetImage( this, m_itemIconImage, iconPath, 'OnIconCallback' );
			}
			else
			{
				emptyIcon = UIItemsHelper.GetSlotShadowIcon( TDBID.None(), m_itemData.GetItemType(), m_itemData.GetEquipmentArea() );
				InkImageUtils.RequestSetImage( this, m_itemIconImage, emptyIcon );
			}
		}
	}

	protected function UpdatePrice()
	{
		if( m_data.isVendorItem )
		{
			inkTextRef.SetText( m_priceText, FloatToStringPrec( m_data.buyPrice, 0 ) );
		}
		else
		{
			inkTextRef.SetText( m_priceText, FloatToStringPrec( m_data.price, 0 ) );
		}
		inkCompoundRef.SetVisible( m_priceContainer, true );
	}

	protected function NEW_UpdatePrice()
	{
		if( m_displayContext.IsVendorItem() )
		{
			inkTextRef.SetText( m_priceText, FloatToStringPrec( m_itemData.GetBuyPrice(), 0 ) );
		}
		else
		{
			inkTextRef.SetText( m_priceText, FloatToStringPrec( m_itemData.GetSellPrice(), 0 ) );
		}
		inkCompoundRef.SetVisible( m_priceContainer, true );
	}

	protected function UpdateRequirements()
	{
		var textParams : inkTextParams;
		var statRecord : Stat_Record;
		var requirement : SItemStackRequirementData;
		var equipRequirements : array< SItemStackRequirementData >;
		inkWidgetRef.SetVisible( m_itemAttributeRequirementsWrapper, false );
		inkCompoundRef.SetState( m_statsContainer, 'Default' );
		inkCompoundRef.SetState( m_hacksContainer, 'Default' );
		inkCompoundRef.SetState( m_descriptionContainer, 'Default' );
		inkCompoundRef.SetState( m_allocationCostsWrapper, 'Default' );
		if( !( InventoryItemData.IsEmpty( m_data.inventoryItemData ) ) )
		{
			requirement = InventoryItemData.GetRequirement( m_data.inventoryItemData );
			if( requirement.statType != gamedataStatType.Invalid && !( InventoryItemData.IsRequirementMet( m_data.inventoryItemData ) ) )
			{
				inkWidgetRef.SetVisible( m_itemAttributeRequirementsWrapper, true );
				inkWidgetRef.SetVisible( m_itemAttributeRequirements, true );
				textParams = new inkTextParams;
				textParams.AddNumber( "value", RoundF( requirement.requiredValue ) );
				statRecord = RPGManager.GetStatRecord( requirement.statType );
				textParams.AddString( "statName", GetLocalizedText( UILocalizationHelper.GetStatNameLockey( statRecord ) ) );
				textParams.AddString( "statColor", "StatTypeColor." + EnumValueToString( "gamedataStatType", ( ( Int32 )( requirement.statType ) ) ) );
				inkTextRef.SetLocalizedTextScript( m_itemAttributeRequirementsText, "LocKey#49215", textParams );
			}
			equipRequirements = InventoryItemData.GetEquipRequirements( m_data.inventoryItemData );
			if( equipRequirements.Size() > 0 )
			{
				if( !( InventoryItemData.IsEquippable( m_data.inventoryItemData ) ) )
				{
					inkWidgetRef.SetVisible( m_itemAttributeRequirementsWrapper, true );
					inkWidgetRef.SetVisible( m_itemAttributeRequirements, true );
					textParams = new inkTextParams;
					textParams.AddNumber( "value", RoundF( equipRequirements[ 0 ].requiredValue ) );
					statRecord = RPGManager.GetStatRecord( equipRequirements[ 0 ].statType );
					textParams.AddString( "statName", GetLocalizedText( UILocalizationHelper.GetStatNameLockey( statRecord ) ) );
					textParams.AddString( "statColor", "StatTypeColor." + EnumValueToString( "gamedataStatType", ( ( Int32 )( equipRequirements[ 0 ].statType ) ) ) );
					if( MinimalItemTooltipData.IsAttributeAllocationStat( equipRequirements[ 0 ].statType ) )
					{
						inkTextRef.SetLocalizedTextScript( m_itemAttributeRequirementsText, "LocKey#80932", textParams );
					}
					else
					{
						inkTextRef.SetLocalizedTextScript( m_itemAttributeRequirementsText, "LocKey#77652", textParams );
					}
					if( equipRequirements[ 0 ].statType == gamedataStatType.HumanityAvailable )
					{
						inkCompoundRef.SetState( m_allocationCostsWrapper, 'lowCapacity' );
					}
				}
				else if( MinimalItemTooltipData.IsAttributeAllocationStat( equipRequirements[ 0 ].statType ) )
				{
					inkWidgetRef.SetVisible( m_itemAttributeRequirementsWrapper, true );
					inkWidgetRef.SetVisible( m_itemAttributeRequirements, false );
				}
				inkCompoundRef.SetState( m_statsContainer, 'ReqNotMet' );
				inkCompoundRef.SetState( m_hacksContainer, 'ReqNotMet' );
				inkCompoundRef.SetState( m_descriptionContainer, 'ReqNotMet' );
			}
		}
	}

	protected function UpdateAllocationStats()
	{
		var minimalItemTooltipData : MinimalItemTooltipData;
		inkCompoundRef.SetVisible( m_allocationCostsWrapper, true );
		minimalItemTooltipData = MinimalItemTooltipData.FromInventoryTooltipData( m_data );
		UpdateAttributeAllocationStats( minimalItemTooltipData );
	}

	private function UpdateAttributeAllocationStats( data : MinimalItemTooltipData )
	{
		var i, allocationCostsSize : Int32;
		var controller : ItemTooltipStatController;
		inkCompoundRef.SetVisible( m_allocationCostsWrapper, true );
		allocationCostsSize = data.attributeAllocationStats.Size();
		while( inkCompoundRef.GetNumChildren( m_allocationCostsWrapper ) > allocationCostsSize )
		{
			inkCompoundRef.RemoveChildByIndex( m_allocationCostsWrapper, 0 );
		}
		while( inkCompoundRef.GetNumChildren( m_allocationCostsWrapper ) < allocationCostsSize )
		{
			SpawnFromLocal( inkCompoundRef.Get( m_allocationCostsWrapper ), 'allocationCosts' );
		}
		for( i = 0; i < allocationCostsSize; i += 1 )
		{
			controller = ( ( ItemTooltipStatController )( inkCompoundRef.GetWidgetByIndex( m_allocationCostsWrapper, i ).GetController() ) );
			controller.SetData( data.attributeAllocationStats[ i ] );
		}
		if( allocationCostsSize == 0 )
		{
			SpawnFromLocal( inkCompoundRef.Get( m_allocationCostsWrapper ), 'allocationCosts' );
			controller = ( ( ItemTooltipStatController )( inkCompoundRef.GetWidgetByIndex( m_allocationCostsWrapper, i ).GetController() ) );
			controller.SetZeroData();
		}
	}

	private function NEW_UpdateAttributeAllocationStats( data : weak< UIInventoryItem >, player : weak< PlayerPuppet > )
	{
		var i, allocationCostsSize : Int32;
		var controller : ItemTooltipStatController;
		var statsManger : weak< UIInventoryItemStatsManager >;
		statsManger = data.GetStatsManager();
		inkCompoundRef.SetVisible( m_allocationCostsWrapper, true );
		allocationCostsSize = statsManger.SizeAttributeAllocationStats();
		while( inkCompoundRef.GetNumChildren( m_allocationCostsWrapper ) > allocationCostsSize )
		{
			inkCompoundRef.RemoveChildByIndex( m_allocationCostsWrapper, 0 );
		}
		while( inkCompoundRef.GetNumChildren( m_allocationCostsWrapper ) < allocationCostsSize )
		{
			SpawnFromLocal( inkCompoundRef.Get( m_allocationCostsWrapper ), 'allocationCosts' );
		}
		for( i = 0; i < allocationCostsSize; i += 1 )
		{
			controller = ( ( ItemTooltipStatController )( inkCompoundRef.GetWidgetByIndex( m_allocationCostsWrapper, i ).GetController() ) );
			controller.SetData( statsManger.GetAttributeAllocationStats( i ) );
		}
		if( allocationCostsSize == 0 )
		{
			SpawnFromLocal( inkCompoundRef.Get( m_allocationCostsWrapper ), 'allocationCosts' );
			controller = ( ( ItemTooltipStatController )( inkCompoundRef.GetWidgetByIndex( m_allocationCostsWrapper, i ).GetController() ) );
			controller.SetZeroData();
		}
	}

	private function UpdateCyberwareUpgradeModule()
	{
		var isCyberware, hasValidData : Bool;
		if( m_itemData != NULL )
		{
			isCyberware = m_itemData.IsCyberware();
			hasValidData = ( !( m_displayContext.HasTag( 'CyberwareUpgrade' ) ) && m_itemData.IsEquipped() ) && m_itemData.GetCyberwareUpgradeData( m_player ).IsValid();
		}
		else
		{
			isCyberware = UIInventoryItemsManager.IsItemTypeCyberware( m_data.itemType );
			hasValidData = m_data.cyberwareUpgradeData && m_data.cyberwareUpgradeData.IsValid();
		}
		if( isCyberware && hasValidData )
		{
			if( !( m_cyberwareUpgradeController ) )
			{
				AsyncSpawnFromExternal( inkWidgetRef.Get( m_cyberwareUpgradeContainer ), m_additionalModulesLibraryRes, m_cyberwareUpgradeModuleName, this, 'OnCyberwareUpgradeModuleSpawned' );
				return;
			}
			if( m_itemData != NULL )
			{
				m_cyberwareUpgradeController.NEW_Update( m_itemData, m_displayContext.GetPlayerAsPuppet() );
			}
			else
			{
				m_cyberwareUpgradeController.Update( m_data );
			}
			inkWidgetRef.SetVisible( m_cyberwareUpgradeContainer, m_cyberwareUpgradeController.IsVisible() );
		}
		else
		{
			inkWidgetRef.SetVisible( m_cyberwareUpgradeContainer, false );
		}
	}

	private function UpdateCyberwareQuickHackMenuLinkModule()
	{
		inkWidgetRef.SetVisible( m_itemCWQuickHackMenuLinkContainer, m_data.cyberdeckData.viewingTooltipFromCyberwareMenu && m_data.isEquipped );
	}

	private function NEW_UpdateCyberwareQuickHackMenuLinkModule()
	{
		inkWidgetRef.SetVisible( m_itemCWQuickHackMenuLinkContainer, m_displayContext.HasTag( 'AllowProgramLink' ) && m_itemData.IsEquipped() );
	}

	protected event OnCyberwareUpgradeModuleSpawned( widget : inkWidget, userData : IScriptable )
	{
		m_cyberwareUpgradeController = ( ( ItemTooltipCyberwareUpgradeController )( widget.GetController() ) );
		m_cyberwareUpgradeController.SetDisplayContext( m_itemDisplayContext, m_tooltipDisplayContext, m_displayContext );
		UpdateCyberwareUpgradeModule();
	}

	protected function FixLines()
	{
		var i : Int32;
		var container : weak< inkCompoundWidget >;
		var lineWidget : weak< inkWidget >;
		var firstHidden : Bool;
		firstHidden = false;
		for( i = 0; i < inkCompoundRef.GetNumChildren( m_categoriesWrapper ); i += 1 )
		{
			container = ( ( inkCompoundWidget )( inkCompoundRef.GetWidgetByIndex( m_categoriesWrapper, i ) ) );
			if( container )
			{
				if( container.IsVisible() )
				{
					lineWidget = container.GetWidgetByPath( inkWidgetPath.Build( 'line' ) );
					if( lineWidget )
					{
						lineWidget.SetVisible( firstHidden );
						firstHidden = true;
					}
				}
			}
		}
	}

	public function OnVarModified( groupPath : CName, varName : CName, varType : ConfigVarType, reason : ConfigChangeReason )
	{
		switch( varName )
		{
			case 'BigFont':
				UpdateTooltipSize();
			break;
			default:
				break;
		}
	}

	private function UpdateTooltipSize()
	{
		var configVar : ConfigVarBool;
		configVar = ( ( ConfigVarBool )( m_settings.GetVar( m_groupPath, 'BigFont' ) ) );
		SetTooltipSize( configVar.GetValue() );
	}

	protected virtual function SetTooltipSize( value : Bool )
	{
		if( value == true )
		{
			inkWidgetRef.SetSize( m_minWidth, 800.0, 0.0 );
			inkTextRef.SetWrappingAtPosition( m_itemNameText, 754.0 );
			inkTextRef.SetWrappingAtPosition( m_itemRarityText, 754.0 );
			inkTextRef.SetWrappingAtPosition( m_itemTypeText, 754.0 );
			inkTextRef.SetWrappingAtPosition( m_itemAttributeRequirementsText, 700.0 );
			inkTextRef.SetWrappingAtPosition( m_deviceHackNamesText, 710.0 );
			inkTextRef.SetWrappingAtPosition( m_deviceHackNamesText2, 710.0 );
			inkTextRef.SetWrappingAtPosition( m_deviceHackNamesText3, 710.0 );
			inkTextRef.SetWrappingAtPosition( m_deviceHackNamesText4, 710.0 );
			m_bigFontEnabled = true;
		}
		else
		{
			inkWidgetRef.SetSize( m_minWidth, 700.0, 0.0 );
			inkTextRef.SetWrappingAtPosition( m_itemNameText, 654.0 );
			inkTextRef.SetWrappingAtPosition( m_itemRarityText, 654.0 );
			inkTextRef.SetWrappingAtPosition( m_itemTypeText, 654.0 );
			inkTextRef.SetWrappingAtPosition( m_itemAttributeRequirementsText, 600.0 );
			inkTextRef.SetWrappingAtPosition( m_deviceHackNamesText, 610.0 );
			inkTextRef.SetWrappingAtPosition( m_deviceHackNamesText2, 610.0 );
			inkTextRef.SetWrappingAtPosition( m_deviceHackNamesText3, 610.0 );
			inkTextRef.SetWrappingAtPosition( m_deviceHackNamesText4, 610.0 );
			m_bigFontEnabled = false;
		}
	}

}

class CyberdeckTooltipSettingsListener extends ConfigVarListener
{
	private var m_ctrl : weak< CyberdeckTooltip >;
	private var m_statctrl : weak< CyberdeckStatController >;

	public function RegisterController( ctrl : CyberdeckTooltip )
	{
		m_ctrl = ctrl;
	}

	public function RegisterStatController( ctrl : CyberdeckStatController )
	{
		m_statctrl = ctrl;
	}

	public export override function OnVarModified( groupPath : CName, varName : CName, varType : ConfigVarType, reason : ConfigChangeReason )
	{
		m_ctrl.OnVarModified( groupPath, varName, varType, reason );
		m_statctrl.OnVarModified( groupPath, varName, varType, reason );
	}

}

class CyberdeckDeviceHackIcon extends inkLogicController
{
	protected editable var m_image : inkImageRef;

	public function Setup( data : CyberdeckDeviceQuickhackData )
	{
		inkImageRef.SetAtlasResource( m_image, data.UIIcon.AtlasResourcePath() );
		inkImageRef.SetTexturePart( m_image, data.UIIcon.AtlasPartName() );
	}

}

struct CyberdeckDeviceQuickhackData
{
	var UIIcon : weak< UIIcon_Record >;
	var ObjectActionRecord : weak< ObjectAction_Record >;
	var ObjectActionName : CName;
	var ObjectActionLocName : CName;
	var ObjectActionTier : gamedataDeviceHackTier;
	var ObjectActionCategory : gamedataDeviceHackCategory;
	var ObjectActionType : gamedataObjectActionType;
	var Priority : Float;
}

class CyberdeckStatController extends inkLogicController
{
	protected editable var m_label : inkTextRef;
	protected var m_settings : UserSettings;
	protected var m_settingsListener : CyberdeckTooltipSettingsListener;
	protected var m_groupPath : CName;
	default m_groupPath = '/accessibility/interface';
	protected editable var m_minWidth : inkWidgetRef;
	protected var m_bigFontEnabled : Bool;

	public function Setup( const ability : ref< InventoryItemAbility > )
	{
		m_settings = new UserSettings;
		m_settingsListener = new CyberdeckTooltipSettingsListener;
		m_settingsListener.RegisterStatController( this );
		m_settingsListener.Register( m_groupPath );
		UpdateTooltipSize();
		if( ability.Description != "" )
		{
			inkTextRef.SetText( m_label, ability.Description );
			if( ability.LocalizationDataPackage.GetParamsCount() > 0 )
			{
				inkTextRef.SetTextParameters( m_label, ability.LocalizationDataPackage.GetTextParams() );
			}
		}
		else
		{
			inkTextRef.SetText( m_label, GetLocalizedText( "UI-Labels-EmptySlot" ) );
		}
	}

	public function OnVarModified( groupPath : CName, varName : CName, varType : ConfigVarType, reason : ConfigChangeReason )
	{
		switch( varName )
		{
			case 'BigFont':
				UpdateTooltipSize();
			break;
			default:
				break;
		}
	}

	private function UpdateTooltipSize()
	{
		var configVar : ConfigVarBool;
		configVar = ( ( ConfigVarBool )( m_settings.GetVar( m_groupPath, 'BigFont' ) ) );
		SetTooltipSize( configVar.GetValue() );
	}

	protected virtual function SetTooltipSize( value : Bool )
	{
		if( value == true )
		{
			inkTextRef.SetWrappingAtPosition( m_label, 700.0 );
			m_bigFontEnabled = true;
		}
		else
		{
			inkTextRef.SetWrappingAtPosition( m_label, 600.0 );
			m_bigFontEnabled = false;
		}
	}

}

