class RipperdocTokenManager
{
	var m_player : weak< PlayerPuppet >;
	var m_tokenBlackboard : weak< IBlackboard >;
	var m_gameInstance : GameInstance;

	public function Initialize( player : weak< PlayerPuppet > )
	{
		m_player = player;
		m_gameInstance = m_player.GetGame();
		m_tokenBlackboard = GameInstance.GetBlackboardSystem( m_player.GetGame() ).Get( GetAllBlackboardDefs().TokenUpgradedCyberwareBlackboard );
	}

	public function IfPlayerHasTokens() : Bool
	{
		return GameInstance.GetTransactionSystem( m_gameInstance ).HasItem( m_player, ItemID.CreateQuery( T"Items.StatsToken" ) );
	}

	public function GetTokensAmount() : Int32
	{
		var itemID : ItemID;
		itemID = ItemID.CreateQuery( T"Items.StatsToken" );
		return GameInstance.GetTransactionSystem( m_gameInstance ).GetItemQuantity( m_player, itemID );
	}

	public function IsItemUpgraded( cyberwareItem : ItemID ) : Bool
	{
		var cyberwareTypesList : array< CName >;
		var cyberwareType : CName;
		cyberwareTypesList = ( ( array< CName > )( m_tokenBlackboard.GetVariant( GetAllBlackboardDefs().TokenUpgradedCyberwareBlackboard.CyberwareTypes ) ) );
		cyberwareType = TweakDBInterface.GetCName( ItemID.GetTDBID( cyberwareItem ) + T".cyberwareType", '' );
		return cyberwareTypesList.Contains( cyberwareType );
	}

	public function ApplyToken( cyberwareItemID : ItemID )
	{
		var cyberwareTypesList : array< CName >;
		var cyberwareType : CName;
		cyberwareTypesList = ( ( array< CName > )( m_tokenBlackboard.GetVariant( GetAllBlackboardDefs().TokenUpgradedCyberwareBlackboard.CyberwareTypes ) ) );
		cyberwareType = TweakDBInterface.GetCName( ItemID.GetTDBID( cyberwareItemID ) + T".cyberwareType", '' );
		if( IsItemUpgraded( cyberwareItemID ) )
		{
		}
		else
		{
			cyberwareTypesList.PushBack( cyberwareType );
			m_tokenBlackboard.SetVariant( GetAllBlackboardDefs().TokenUpgradedCyberwareBlackboard.CyberwareTypes, cyberwareTypesList );
		}
	}

}

