---------
---
--- GoldCounter (GoldCounter.lua) by Hexiatröhm
---
---------
local format = string.format
local gsub   = string.gsub
local floor  = math.floor
local abs    = math.abs
local sub	 = string.sub
local find   = string.find
local lower  = string.lower
local len 	 = string.len
local upper  = string.upper

local i, _ = nil, nil

--- Global Data
SLASH_GC1, SLASH_GC2 = "/gc", "/goldcounter"

GC_WOW_isRetail, GC_WOW_isVanilla, GC_WOW_isPANDARIA, GC_WOW_isBCAnniv = false, false, false, false
GC_Version = ""
GC_Flavor = ""
GC_LastLoginDate  = 0
GC_LastLoginTime  = ""
GC_LastLogoutDate = 0
GC_LastLogoutTime = ""
GC_PlayerName, GC_PlayerRealm, GC_PlayerNormName, GC_PlayerNormRealm = "", "", "", ""
GC_PlayerClass, GC_PlayerClassLocale, GC_PlayerClassIndex = "?", "?", 0
GC_PlayerFaction, GC_PlayerFactionLocale = "", ""
GC_PlayerLevel = 0
GC_PlayerItemLevel = 0
GC_MaxPlayerLevel = 120
GC_PlayerXP, GC_LastXP = 0, 0
GC_CharGender = 0

GC_LoginMoneyInit = 0
GC_CurrentFunds = 0
GC_PreviousMoney = 0
GC_MaxHistoryRec = 28 -- 4 weeks
GC_MinHistoryRec = 7 -- 1 week

GC_WarnVersionDone = false
GC_ProfileButtonChecked = 1
GC_ToggleSwitch = false
GC_Reset_EraseAllData_Checked, GC_Reset_EraseAllProfiles_Checked = false, false
GC_CurrentDate = 0
GC_CurrentTime = ""
GC_Roster_PlayersNum_Event = 0
GC_Beacon = false
GC_Beacon_LastName = ""

GC_Frame_Color = { BG = 0.7, Border= 0.8 }
GC_BorderColor1 = { }
GC_BorderColor2 = { }

--- Saved Variable
MySavedMoney = nil
MySavedMoneyHistory = { }
My_GC_Settings = { }
My_GC_Settings_Local = { }
My_GC_Profile = { }
My_GC_CharMoneyDB = { }
GC_MyDailyData = { }
---

GC_Events_Data = {
	IsMercOpen = false,
	BankFrame_Open = false,
	GuildBankFrame_Open = false,
	Auctioneer_Open = false,
	Inbox_Open = false,
	isLootOpenHasMoney = false,
	TransmoMerc_Open = false,
}

---------------------------------------------------
--- Data Tables
		
GC_MyMoney = {	
		["Gold"]		= "0",
		["Silver"]		= "00",
		["Copper"]		= "00",
		["Sign"]		= " ",
		["Color"]		= "|cffFFFFFF",
		["NoColor"]		= "|cffE0E0E0",
		["PosColor"]	= "|cff00ff00",
		["NegColor"]	= "|cffff0000",
}

GC_CounterFonts_List = {
		
		"MailFont_Large",
		"SystemFont_Outline",
		"Game13Font",
		"Game15Font",
		"Game18Font",
		"Game12Font_o1",
		"Game13Font_o1",
		"Game15Font_o1",
		"FriendsFont_Large",
		"NumberFont_Shadow_Med",
		"NumberFont_Outline_Med",
		"NumberFont_Outline_Large",
		"Fancy16Font",
		"Fancy18Font",
		"QuestFont_Shadow_Huge",
		"QuestFont_Outline_Huge",
		"Erika",
		"Erika_B",
		"SicretMono_Regular",
		"SicretMono_Medium",
		"Xanmono",
		"Hack",
		"Targa",
		"WhiteRabbit",
		"Makisupa",
		"JetBrains",
		}

---------------------------------------------------
--- Libraries Functions
GCLDB   = LibStub:GetLibrary("LibDataBroker-1.1")
GCLibDD = LibStub:GetLibrary("LibUIDropDownMenu-4.0")
GC_Icon = LibStub("LibDBIcon-1.0")

GC_Icon_DataObj = GCLDB:NewDataObject("GOLDCOUNTER", {
	type = "launcher",
	text = "GoldCounter",
	label = "GC_MiniMapButtonLabel",
	icon = "Interface\\Icons\\Inv_misc_coin_01",
	OnClick = function( self, button ) GC_MiniMapButton_OnClick( self, button ) end,
	OnEnter = function(self) GC_MiniMapButton_OnEnter(self) end,
	OnLeave = function() GC_MinimapButtonTooltip:Hide() end,
})

GC_Icon_DB = {
	profile = {
		minimap = {
			hide = false
		}
	}
}

---------------------------------------------------

--- Startup OnLoad
function GoldCounter_OnLoad()

	----------------------
	--- Register Event ---
	----------------------
	GoldCounter_MainFrame:RegisterEvent( "ADDON_LOADED" )
	GoldCounter_MainFrame:RegisterEvent( "PLAYER_ENTERING_WORLD" )
	GoldCounter_MainFrame:RegisterEvent( "PLAYER_LEAVING_WORLD" )
	GoldCounter_MainFrame:RegisterEvent( "PLAYER_MONEY" )
	GoldCounter_MainFrame:RegisterEvent( "PLAYER_LEVEL_UP" )
	GoldCounter_MainFrame:RegisterEvent( "CHAT_MSG_ADDON" )
	GoldCounter_MainFrame:RegisterEvent( "PLAYER_REGEN_ENABLED" )
	GoldCounter_MainFrame:RegisterEvent( "PLAYER_REGEN_DISABLED" )
	GoldCounter_MainFrame:RegisterEvent( "PLAYER_XP_UPDATE" )
	GoldCounter_MainFrame:RegisterEvent( "PLAYER_UPDATE_RESTING" )
	GoldCounter_MainFrame:RegisterEvent( "UPDATE_EXHAUSTION" )
	GoldCounter_MainFrame:RegisterEvent( "ZONE_CHANGED" )
	GoldCounter_MainFrame:RegisterEvent( "ZONE_CHANGED_INDOORS" )
	GoldCounter_MainFrame:RegisterEvent( "ZONE_CHANGED_NEW_AREA" )
	GoldCounter_MainFrame:RegisterEvent( "LOOT_OPENED" )
	GoldCounter_MainFrame:RegisterEvent( "GUILD_ROSTER_UPDATE" )
	GoldCounter_MainFrame:RegisterEvent( "GROUP_ROSTER_UPDATE" )
	GoldCounter_MainFrame:RegisterEvent( "PLAYER_INTERACTION_MANAGER_FRAME_SHOW" )
	GoldCounter_MainFrame:RegisterEvent( "PLAYER_INTERACTION_MANAGER_FRAME_HIDE" )
	GoldCounter_MainFrame:RegisterEvent( "QUEST_TURNED_IN" )
	GoldCounter_MainFrame:RegisterEvent( "SCENARIO_COMPLETED" )
	GoldCounter_MainFrame:RegisterEvent( "LFG_COMPLETION_REWARD")
	GoldCounter_MainFrame:RegisterEvent( "BOSS_KILL" )
	----------------------
end

--------------------------------------------------------------------------------------------------------------

function GoldCounter_OnEvent( self, event, arg1, arg2, arg3, arg4 )

	--- Addon Loaded ------------
	if event == "ADDON_LOADED" and arg1 == "GoldCounter" then

	-----------------------------------------------
	--- DATA INIT
	-----------------------------------------------

	GC_Version = C_AddOns.GetAddOnMetadata("GoldCounter", "Version")

	-----------------------------------------------
	--- Set localized texts
	GC_OptionsNameTitle:SetText( "GoldCounter "..GC_Version )
	GC_SetLocaleText()
	GC_SetOptionsPanelText()
	-----------------------------------------------

	--- Determine WOW Expansion
	if WOW_PROJECT_ID == 1 then

		GC_WOW_isRetail = true      -- Retail
		GC_Flavor = ""
		GC_MaxPlayerLevel = 90

	elseif WOW_PROJECT_ID == 19 then

		GC_WOW_isPANDARIA = true    -- Pandaria
		GC_Flavor = "( Pandaria )"
		GC_MaxPlayerLevel = 90

	elseif WOW_PROJECT_ID == 5 then

		GC_WOW_isBCAnniv = true    -- BC Anniversary
		GC_Flavor = "( Burning Crusade )"
		GC_MaxPlayerLevel = 70

	elseif WOW_PROJECT_ID == 2 then

		GC_WOW_isVanilla = true     -- Vanilla
		GC_Flavor = "( Vanilla )"
		GC_MaxPlayerLevel = 60
	else

	GC_WOW_isVanilla = true     -- Unknown ??
	GC_Flavor = "( ? )"
	GC_MaxPlayerLevel = 120
	end

	---  Is it connection or Reload ? ------------ (self, event, isLogin, isReload)
	elseif event == "PLAYER_ENTERING_WORLD" and ( arg1 or arg2 ) then 

	GC_ResetButton:SetMotionScriptsWhileDisabled( true ) --- Reset button always shows tooltip

	-------------------------------------------
	--- Minimap button register
	GC_Icon:Register( "GOLDCOUNTER", GC_Icon_DataObj , GC_Icon_DB.profile.minimap )
	--- Check and apply Addon Settings
	GC_SetAddonOptions()
	--- Create and Set DropdownList and menus defaults
	GC_Create_DDM()
	-------------------------------------------

	----------------------------
	--- Check if Version Update
	----------------------------
	if GC_CheckNewVersion( My_GC_Settings_Local.GC_Version, GC_Version ) then GC_UpdatedVersion()
	end

	DEFAULT_CHAT_FRAME:AddMessage( "|cffffff00GoldCounter|r "..GC_Version.." "..GC_Locale_Text.LOADED_MSG.."! "..GC_Flavor )
	My_GC_Settings_Local.GC_Version = GC_Version
	----------------------------

	-------------------------------------------
	--- Check Last Login Date and Time
	GC_CurrentDate = tonumber( date("%y%m%d") )
	GC_CurrentTime = date("%H:%M:%S")

	GC_LastLoginDate  = My_GC_Settings_Local.LastLoginDate
	GC_LastLoginTime  = My_GC_Settings_Local.LastLoginTime
	My_GC_Settings_Local.LastLoginDate = GC_CurrentDate
	My_GC_Settings_Local.LastLoginTime = GC_CurrentTime
	
	--- Logout date and time for commandline reference only
	GC_LastLogoutDate = My_GC_Settings_Local.LastLogoutDate
	GC_LastLogouTime  = My_GC_Settings_Local.LastLogoutTime
	
	-------------------------------------------
	--- Counter Init
	GC_CurrentFunds 	= GetMoney() -- Store current funds
	GC_LoginMoneyInit	= GC_CurrentFunds
	GC_PreviousMoney 	= GC_CurrentFunds
	-------------------------------------------

	----------------------------
	--- Global Login References
	----------------------------
	My_GC_Settings.Addon			= "GoldCounter"
	My_GC_Settings.Version			= GC_Version
	My_GC_Settings.LastDate			= GC_CurrentDate
	My_GC_Settings.LastTime			= GC_CurrentTime
	----------------------------

	-------------------------------------------
	--- If SaveVar doesn't exist - First time Init
	if not MySavedMoney then MySavedMoney = 0
	else

		GC_LoginMoneyInit = GC_LoginMoneyInit - MySavedMoney -- if saved value then modify balance
	end

	GC_TranslateMoney() -- Format from "MySavedMoney" and call GoldCounter_Update()
	-------------------------------------------

	-------------------------------------------
	--- Daily Reset -- Check for today
	if ( My_GC_Settings_Local.LastResetDate < GC_CurrentDate ) then 

		GC_MyDailyData.DailyCount = 0
		GC_MyDailyData.Instance_MoneyLoot = 0
		GC_MyDailyData.Money_Loot = 0
		GC_MyDailyData.Merchant_Money = 0
		GC_MyDailyData.Auctioneer = 0
		GC_MyDailyData.MailBoxIncome = 0
		GC_MyDailyData.QuestReward = 0
		GC_MyDailyData.QuestXP = 0
		GC_MyDailyData.Merchant_Transmo = 0
		GC_MyDailyData.TaxiCost = 0

		if ( My_GC_Settings_Local.DailyReset == true and MySavedMoney ~= 0 ) then
			GoldCounter_Reset( true ) --- AutoReset = true
		end
	end

	My_GC_Settings_Local.LastResetDate = GC_CurrentDate
	-------------------------------------------

	----------------------------------
	--- Get Character name and data --
	----------------------------------
	GC_PlayerName			= GetUnitName( "player" )
	GC_CharGender 			= UnitSex("player")
	GC_PlayerXP				= UnitXP("player") -- Base
	GC_PlayerLevel			= UnitLevel("player")
	GC_PlayerItemLevel		= GC_GetPlayerItemLevel() -- Get Initial ItemLevel
	GC_PlayerClassLocale, GC_PlayerClass, GC_PlayerClassIndex = UnitClass( "player" )
	GC_PlayerFaction, GC_PlayerFactionLocale = UnitFactionGroup( "player" )

	GC_PlayerRealm			= GetRealmName()
	GC_PlayerNormRealm		= GetNormalizedRealmName()
	GC_PlayerNormName = GC_PlayerName.."-"..GC_PlayerNormRealm
	------------------------------
	
	----------------------
	--- Update data in DB
	GC_BuildCharDB()
	----------------------

	-------------------------------------------
	--- Register Addon Messages system
	C_ChatInfo.RegisterAddonMessagePrefix( "GOLDCOUNTER" )
	-------------------------------------------

	-------------------------------------------
	--- Send Addon Version to Guild for checkup
	if IsInGuild() then
		C_ChatInfo.SendAddonMessage( "GOLDCOUNTER", "LOGIN1-"..GC_Version, "GUILD" )
	end
	-------------------------------------------

	-------------------------------------------
	--- First Start do action
	-------------------------------------------
	if not My_GC_Settings_Local.FirstStartDone then

		GC_FirstStart()
		--- To Do Tutorial Tooltips
		--- My_GC_Settings_Local.FirstStartDone = true
	end
	-------------------------------------------

	-------------------------------------------------------------
	--- Is it receiving addon message ?
	elseif event == "CHAT_MSG_ADDON" then

		GC_GetAddonMessage( arg1, arg2, arg3, arg4 )

	elseif event == "QUEST_TURNED_IN" then
	
		GC_MyDailyData.QuestReward = GC_MyDailyData.QuestReward + arg3
		GC_MyDailyData.QuestXP = GC_MyDailyData.QuestXP + arg2
		
	-------------------------------------------------------------
	--- Is it Interaction with NPC ?
	elseif event == "PLAYER_INTERACTION_MANAGER_FRAME_SHOW" then

		if arg1 == 5 or arg1 == 12 then

			--- Merchant
			GC_Events_Data.IsMercOpen = true

		elseif arg1 == 8 or arg1 == 68 then

			--- Bank
			GC_Events_Data.BankFrame_Open = true

		elseif arg1 == 10 then

			--- GuildBank
			GC_Events_Data.GuildBankFrame_Open = true

		elseif arg1 == 17 then

			--- Mail
			GC_Events_Data.Inbox_Open = true

		elseif arg1 == 24 then

			--- Transmo
			GC_Events_Data.TransmoMerc_Open = true

		elseif arg1 == 21 then

			--- Auctioneer
			GC_Events_Data.Auctioneer_Open = true

		end
	-------------------------------------------------------------
	elseif event == "PLAYER_INTERACTION_MANAGER_FRAME_HIDE" then

		if arg1 == 5 or arg1 == 12 then

			GC_Events_Data.IsMercOpen = false

		elseif arg1 == 8 or arg1 == 68 then

			GC_Events_Data.BankFrame_Open = false

		elseif arg1 == 10 then

			GC_Events_Data.GuildBankFrame_Open = false

		elseif arg1 == 17 then

			GC_Events_Data.Inbox_Open = false

		elseif arg1 == 24 then

			GC_Events_Data.TransmoMerc_Open = false

		elseif arg1 == 21 then

			GC_Events_Data.Auctioneer_Open = false

		end

	--- Check Item Level
	GC_PlayerItemLevel = GC_GetPlayerItemLevel()

	-------------------------------------------------------------
	--- Is delve/dungeon Over ?
	elseif event == "SCENARIO_COMPLETED" or event == "LFG_COMPLETION_REWARD" or event == "BOSS_KILL" then

		--- End of fighting not detected when delve/dungeon is done
		GC_CheckFighting()

	-------------------------------------------------------------
	--- Is lootbox open ?
	elseif event == "LOOT_OPENED" then

			GC_Events_Data.isLootOpenHasMoney = false

		--- Is there money in the lootbox
		for i = 1, GetNumLootItems() do

			if GetLootSlotType(i) == Enum.LootSlotType.Money then 

			GC_Events_Data.isLootOpenHasMoney = true

			end
		end

	-------------------------------------------------------------
	--- Is it money update ?
	elseif event == "PLAYER_MONEY" then

	local OneTimeMoneyLoot = 0
	
	------------------------
	--- Flash Icons --- Will process if My_GC_Settings_Local.IconsFlash == true
	--- Data = if true = Positive Lightgold Color or false = Negative Red Color
	local function FlashIcons()
		if (OneTimeMoneyLoot < 0) then
			FlashCoinIcons( false )
		else
			FlashCoinIcons( true )
		end
	end
	------------------------
	local inInstance, instanceType = IsInInstance()

		GC_CurrentFunds = GetMoney()
		OneTimeMoneyLoot = GC_CurrentFunds - GC_PreviousMoney --- Remember last income
		GC_PreviousMoney = GC_CurrentFunds

		------------------------
		--- Monitor Bank Transaction - Re-adding the fund if no monitoring
		if ( GC_Events_Data.BankFrame_Open or GC_Events_Data.GuildBankFrame_Open ) and not My_GC_Settings_Local.CheckBank then

			GC_LoginMoneyInit = GC_LoginMoneyInit + OneTimeMoneyLoot
		end
		------------------------

		--- Get last money modification
		MySavedMoney = ( GC_CurrentFunds - GC_LoginMoneyInit )
		GC_TranslateMoney()

		----------------------------------------
		--- Events to Store in separate Vars ---
		----------------------------------------

		------------------------
		--- Get Taxi cost
		if UnitOnTaxi("player") then
			GC_MyDailyData.TaxiCost = GC_MyDailyData.TaxiCost + OneTimeMoneyLoot
			FlashIcons()
			return
		end
		------------------------

		------------------------
		--- Get Vendor trade result
		if GC_Events_Data.IsMercOpen then 
			GC_MyDailyData.Merchant_Money = GC_MyDailyData.Merchant_Money + OneTimeMoneyLoot
			FlashIcons()
			return
		end
		------------------------

		------------------------
		--- Get Auctioneer trade result
		if GC_Events_Data.Auctioneer_Open then 
			GC_MyDailyData.Auctioneer = GC_MyDailyData.Auctioneer + OneTimeMoneyLoot
			FlashIcons()
			return
		end
		------------------------

		------------------------
		--- Get Transmo trade result
		if GC_Events_Data.TransmoMerc_Open then 
			GC_MyDailyData.Merchant_Transmo = GC_MyDailyData.Merchant_Transmo + OneTimeMoneyLoot
			FlashIcons()
			return
		end
		------------------------

		------------------------
		--- Get Mail money
		if GC_Events_Data.Inbox_Open then
			GC_MyDailyData.MailBoxIncome = GC_MyDailyData.MailBoxIncome + OneTimeMoneyLoot
			FlashIcons()
			return
		end
		------------------------

		------------------------
		--- Get Looted Money
		if GC_Events_Data.isLootOpenHasMoney and instanceType == "none" then
		
			GC_MyDailyData.Money_Loot = GC_MyDailyData.Money_Loot + OneTimeMoneyLoot
			GC_Events_Data.isLootOpenHasMoney = false
			FlashIcons()
			return
		end 
		------------------------

		------------------------
		--- Get Instance Money
		if instanceType ~= "none" and instanceType ~= "neighborhood" then
			GC_MyDailyData.Instance_MoneyLoot = GC_MyDailyData.Instance_MoneyLoot + OneTimeMoneyLoot
			FlashIcons()
			return
		end
		------------------------

	-------------------------------------------------------------
	elseif event == "GUILD_ROSTER_UPDATE" then

		--- Send Version to guild at login or when someone login in guild
		--- Event will trigger only if in guild
		C_ChatInfo.SendAddonMessage( "GOLDCOUNTER", "LOGIN1-"..GC_Version, "GUILD" )

	-------------------------------------------------------------
	elseif event == "GROUP_ROSTER_UPDATE" then

		local inInstance, instanceType = IsInInstance()
		local isParty = GetNumGroupMembers()

		if GC_Roster_PlayersNum_Event == isParty then return end

		if instanceType == "pvp" then

			C_ChatInfo.SendAddonMessage( "GOLDCOUNTER", "LOGIN1-"..GC_Version, "BATTLEGROUND" )
		
		elseif instanceType == "raid" then

			C_ChatInfo.SendAddonMessage( "GOLDCOUNTER", "LOGIN1-"..GC_Version, "RAID" )

		elseif isParty > 1 then
			local Result
			Result = C_ChatInfo.SendAddonMessage( "GOLDCOUNTER", "LOGIN1-"..GC_Version, "PARTY" )
				------------------------
				if GC_Beacon then print( "PARTY: "..Result ) end
				------------------------
			
			Result = C_ChatInfo.SendAddonMessage( "GOLDCOUNTER", "LOGIN1-"..GC_Version, "INSTANCE_CHAT" )
				------------------------
				if GC_Beacon then print( "INSTANCE_CHAT: "..Result ) end
				------------------------
		end

		--- If same number of players then no messages
		GC_Roster_PlayersNum_Event = isParty

	-------------------------------------------------------------
	--- Combat started
	elseif event == "PLAYER_REGEN_DISABLED" then

		if ( My_GC_Settings_Local.HideInCombat == true and GC_ToggleSwitch == false ) then

		GoldCounter_MainFrame:Hide()

		end

		--- Check if Fighting and start Animation
		StopLoop2()
		GC_CheckFighting()

	-------------------------------------------------------------
	--- Combat stopped
	elseif event == "PLAYER_REGEN_ENABLED" then

		--- Stop Animation
		StopLoop1()

		if ( My_GC_Settings_Local.HideInCombat == true and GC_ToggleSwitch == false ) then

			GoldCounter_MainFrame:Show()

		end

		--- Check if Resting and start Animation
		GC_CheckResting()

	-------------------------------------------------------------
	--- Rest points updated or enterring rest area
	elseif event == "UPDATE_EXHAUSTION" or event == "PLAYER_UPDATE_RESTING" then
	
		--- Check if Resting and start Animation
		GC_CheckResting()

		if ( GoldCounter_CharCard:IsShown() ) then
			GoldCounter_CharCard:Hide()
			GC_CardInit()
			GoldCounter_CharCard:Show()
		end

	-------------------------------------------------------------
	elseif event == "PLAYER_XP_UPDATE" then

		local CharXP = UnitXP("player")
		local WonXP = CharXP - GC_PlayerXP

		if ( WonXP > 0 ) then
			GC_LastXP = WonXP
			GC_PlayerXP = CharXP
		end

		if ( GoldCounter_CharCard:IsShown() ) then
			GoldCounter_CharCard:Hide()
			GC_CardInit()
			GoldCounter_CharCard:Show()
		end

	-------------------------------------------------------------
	elseif event == "ZONE_CHANGED" or event == "ZONE_CHANGED_INDOORS" or event == "ZONE_CHANGED_NEW_AREA" then

			--- Check Item Level
			GC_PlayerItemLevel = GC_GetPlayerItemLevel()

			--- Check if Resting or Fighting and start Animation
			GC_CheckResting()
			GC_CheckFighting()

	local inInstance, instanceType = IsInInstance()

	------------------------
	if GC_Beacon then print( inInstance, instanceType ) end
	------------------------
		

	-------------------------------------------------------------
	elseif event == "PLAYER_LEVEL_UP" then

		GC_PlayerLevel = arg1

	-------------------------------------------------------------
	--- Bye
	elseif event == "PLAYER_LEAVING_WORLD" then

		GC_BuildCharDB() --- Save and update recent data to DB
		
		My_GC_Settings_Local.LastLogoutDate = tonumber( date("%y%m%d") )
		My_GC_Settings_Local.LastLogoutTime = date("%H:%M:%S")

	end
 
end

function GC_BuildCharDB()

	---------------------------------
	--- Update Characters Database
	---------------------------------

		local fordoTag = false

		--- Is there already a DB
		if #My_GC_CharMoneyDB > 0 then

			--- Update Existing Character
			for i = 1, #My_GC_CharMoneyDB do

				--- Update Character Data
				if My_GC_CharMoneyDB[i].NormName == GC_PlayerNormName then
				
					My_GC_CharMoneyDB[i].Balance       = MySavedMoney
					My_GC_CharMoneyDB[i].Funds         = GC_CurrentFunds
					My_GC_CharMoneyDB[i].Class         = GC_PlayerClass
					My_GC_CharMoneyDB[i].ClassLocale   = GC_PlayerClassLocale
					My_GC_CharMoneyDB[i].ClassIndex    = GC_PlayerClassIndex
					My_GC_CharMoneyDB[i].Level         = GC_PlayerLevel
					My_GC_CharMoneyDB[i].Faction       = GC_PlayerFaction
					My_GC_CharMoneyDB[i].FactionLocale = GC_PlayerFactionLocale
					My_GC_CharMoneyDB[i].ItemLevel     = GC_PlayerItemLevel

					fordoTag = true
				end

			end

			--- DB exists but Character unknown
			if fordoTag == false then

				--- Add New character
				My_GC_CharMoneyDB[#My_GC_CharMoneyDB+1] = {

						["NormName"]        = GC_PlayerNormName,
						["Name"]            = GC_PlayerName,
						["Realm"]           = GC_PlayerRealm,
						["Balance"]         = MySavedMoney,
						["Funds"]           = GC_CurrentFunds,
						["Class"]           = GC_PlayerClass,
						["ClassLocale"]     = GC_PlayerClassLocale,
						["ClassIndex"]      = GC_PlayerClassIndex,
						["Level"]           = GC_PlayerLevel,
						["Faction"]         = GC_PlayerFaction,
						["FactionLocale"]   = GC_PlayerFactionLocale,
						["ItemLevel"]       = GC_PlayerItemLevel,
						}
			end

		else
		--- No DB, create new one
		My_GC_CharMoneyDB = { 
					   {    
						["NormName"]        = GC_PlayerNormName,
						["Name"]            = GC_PlayerName,
						["Realm"]           = GC_PlayerRealm,
						["Balance"]         = MySavedMoney,
						["Funds"]           = GC_CurrentFunds,
						["Class"]           = GC_PlayerClass,
						["ClassLocale"]     = GC_PlayerClassLocale,
						["ClassIndex"]      = GC_PlayerClassIndex,
						["Level"]           = GC_PlayerLevel,
					    ["Faction"]         = GC_PlayerFaction,
					    ["FactionLocale"]   = GC_PlayerFactionLocale,
						["ItemLevel"]       = GC_PlayerItemLevel,
				           },
				   }
		end
		
		return true
end
--------------------------------------------------------------------------------------------------------------

function GC_ClearSelectCharDB()

	local i = GC_CharIndexToDelete
	local LastName

	if i ~= -1 then
	
		if My_GC_CharMoneyDB[i] then

			LastName = My_GC_CharMoneyDB[i].NormName

			if ( #My_GC_CharMoneyDB > GC_CharIndexToDelete ) then

				--- Copy rest of the table decrementially
				while ( My_GC_CharMoneyDB[i+1] ) do

						My_GC_CharMoneyDB[i].NormName		= My_GC_CharMoneyDB[i+1].NormName
						My_GC_CharMoneyDB[i].Name			= My_GC_CharMoneyDB[i+1].Name
						My_GC_CharMoneyDB[i].Realm			= My_GC_CharMoneyDB[i+1].Realm
						My_GC_CharMoneyDB[i].Balance		= My_GC_CharMoneyDB[i+1].Balance
						My_GC_CharMoneyDB[i].Funds			= My_GC_CharMoneyDB[i+1].Funds
						My_GC_CharMoneyDB[i].Class			= My_GC_CharMoneyDB[i+1].Class
						My_GC_CharMoneyDB[i].ClassLocale	= My_GC_CharMoneyDB[i+1].ClassLocale
						My_GC_CharMoneyDB[i].ClassIndex		= My_GC_CharMoneyDB[i+1].ClassIndex
						My_GC_CharMoneyDB[i].Level			= My_GC_CharMoneyDB[i+1].Level
						My_GC_CharMoneyDB[i].Faction		= My_GC_CharMoneyDB[i+1].Faction
						My_GC_CharMoneyDB[i].FactionLocale	= My_GC_CharMoneyDB[i+1].FactionLocale
						My_GC_CharMoneyDB[i].ItemLevel		= My_GC_CharMoneyDB[i+1].ItemLevel
				i = i + 1
				end

			end
		
			--- Erase last entry
			My_GC_CharMoneyDB[#My_GC_CharMoneyDB] = nil

			DEFAULT_CHAT_FRAME:AddMessage( "|cffffff00GoldCounter|r |cff00FFFF"..LastName.."|r "..GC_Locale_Text.CHAT_DB_SELECTERASED )

			GC_PlaySFX( 3 )

		end

	else
	
		GC_ClearCharDB()
	end

	GCLibDD:UIDropDownMenu_SetText( GC_CharDB_DropDownList, GC_Locale_Text.OPTIONSPANELTXT_CHOOSECHAR )
	GC_Options_ClearDB_Button:Disable()

	--- Close menus on Classics
	if not GC_WOW_isRetail then

		if L_UIDROPDOWNMENU_OPEN_MENU then
			GCLibDD:ToggleDropDownMenu( nil, nil, GC_CharDB_DropDownList )
		end

	end

end

function GC_ClearCharDB()

	My_GC_CharMoneyDB = { }

	DEFAULT_CHAT_FRAME:AddMessage( "|cffffff00GoldCounter|r "..GC_Locale_Text.CHAT_DB_ERASED )

	GC_BuildCharDB()

	GC_PlaySFX( 3 )

end

function GoldCounter_SetHistoryList()

	---------
	--- Coded for Vanilla compatibility
	---------

	--- Init
	
	GoldCounter_Custom_Tooltip:Hide()
	GoldCounter_Custom_Tooltip:SetOwner( _G["GC_ResetButton"], "ANCHOR_TOPLEFT" )
	GoldCounter_Custom_Tooltip:ClearLines()

	--- Title ---
	GoldCounter_Custom_TooltipTextLeft1:SetFontObject( Fancy12Font )
	GoldCounter_Custom_Tooltip:AddLine( GC_Locale_Text.TOOLTIP_INFOS_HISTORY.." - "..GC_PlayerName, nil, nil, nil, false )

	--- Add space ---
	GoldCounter_Custom_Tooltip:AddLine( " ", 0, 0, 0, false )

	--- Local vars
	local amount = 0
	local amountNum = 0
	local sign = " "
	local FundString = ""
	local Balance = 0
	local HistListIndex = 2
	local CustDate = ""
	local WeekGain = 0
	local Data1, Data2, Str = "", "", ""
	---

	if My_GC_Settings_Local.MaxHistoryRec > 1 then
	
		------------------------------------------------
		--- Write Data from Max to before first entry
		for i = My_GC_Settings_Local.MaxHistoryRec, 2, -1 do
		
			if ( MySavedMoneyHistory[i].date and MySavedMoneyHistory[i].date ~= "*" ) then

				amount = MySavedMoneyHistory[i].amount
				sign = MySavedMoneyHistory[i].sign

				--- Compatibility with older version
				if type(amount) == "string" then amount = tonumber(amount) or 0 sign = " " end
				---

					Data1 = sign 
					Data2 = tostring(amount)
					Str = Data1..Data2
					amountNum = tonumber( Str )
					Balance = Balance + amountNum

				FundString = GC_MoneyCoinsTextures( sign, amount, false )

				HistListIndex = HistListIndex + 1
				_G["GoldCounter_Custom_TooltipTextLeft"..HistListIndex]:SetFontObject( GameFontWhiteTiny ) 
				_G["GoldCounter_Custom_TooltipTextRight"..HistListIndex]:SetFont("Interface\\AddOns\\GoldCounter\\Fonts\\JetBrainsMonoNL-SemiBold.ttf", 10, "")

				CustDate = GC_TranslateDate( MySavedMoneyHistory[i].date )
				GoldCounter_Custom_Tooltip:AddDoubleLine( CustDate, FundString, 1, 1, 1, false )
			end
		end
		------------------------------------------------
	end

	if ( MySavedMoneyHistory[1] and MySavedMoneyHistory[1].date and MySavedMoneyHistory[1].date ~= "*" ) then

			amount = MySavedMoneyHistory[1].amount
			sign = MySavedMoneyHistory[1].sign
 
				--- Compatibility with older version
				if type(amount) == "string" then amount = tonumber(amount) or 0 end

					Data1 = sign 
					Data2 = tostring(amount)
					Str = Data1..Data2
					amountNum = tonumber( Str )
					Balance = Balance + amountNum

			FundString = GC_MoneyCoinsTextures( sign, amount, false )

		HistListIndex = HistListIndex + 1
		_G["GoldCounter_Custom_TooltipTextLeft"..HistListIndex]:SetFontObject( GameFontWhiteTiny )
		_G["GoldCounter_Custom_TooltipTextRight"..HistListIndex]:SetFont("Interface\\AddOns\\GoldCounter\\Fonts\\JetBrainsMonoNL-SemiBold.ttf", 10, "")

		CustDate = GC_TranslateDate( MySavedMoneyHistory[1].date )
		GoldCounter_Custom_Tooltip:AddDoubleLine( CustDate, FundString, 1, 1, 0, false )

		--- Add space ---
		HistListIndex = HistListIndex + 1
		GoldCounter_Custom_Tooltip:AddLine( " ", 0, 0, 0, false )

			--- Calculate by week
			for i = 1, 7, 1 do

				if MySavedMoneyHistory[i] and MySavedMoneyHistory[i].amount and MySavedMoneyHistory[i].amount ~= "*" then
					Data1 = MySavedMoneyHistory[i].sign 
					Data2 = MySavedMoneyHistory[i].amount
					Str = Data1..Data2
					amountNum = tonumber( Str )
					WeekGain = WeekGain + amountNum
				end

			end

			local WeekGain_TextureString = GC_MoneyCoinsTextures( nil, WeekGain, false )
			local TOTAL = GC_MoneyCoinsTextures( nil, Balance, false )
			------------

		HistListIndex = HistListIndex + 1
		_G["GoldCounter_Custom_TooltipTextLeft"..HistListIndex]:SetFontObject( GameFontWhiteTiny, 1, 1, 1 )
		_G["GoldCounter_Custom_TooltipTextRight"..HistListIndex]:SetFont("Interface\\AddOns\\GoldCounter\\Fonts\\JetBrainsMonoNL-SemiBold.ttf", 10, "")
		GoldCounter_Custom_Tooltip:AddDoubleLine( GC_Locale_Text.TOOLTIP_INFOS_WEEKLY, WeekGain_TextureString, nil, nil, nil, false )

		HistListIndex = HistListIndex + 1
		_G["GoldCounter_Custom_TooltipTextLeft"..HistListIndex]:SetFontObject( GameFontWhiteTiny )
		_G["GoldCounter_Custom_TooltipTextRight"..HistListIndex]:SetFont("Interface\\AddOns\\GoldCounter\\Fonts\\JetBrainsMonoNL-SemiBold.ttf", 10, "")
		GoldCounter_Custom_Tooltip:AddDoubleLine( GC_Locale_Text.TOOLTIP_INFOS_TOTAL, TOTAL, nil, nil, nil, false )

	else
		HistListIndex = HistListIndex + 1
		_G["GoldCounter_Custom_TooltipTextLeft"..HistListIndex]:SetFontObject( GameFontWhiteTiny )
		GoldCounter_Custom_Tooltip:AddLine( GC_Locale_Text.TOOLTIP_INFOS_NOHIST, 0.4, 0.4, 0.4, false )
	end

	if ( GC_ResetButton:IsEnabled() ) then

	--- Add space ---
	HistListIndex = HistListIndex + 1
	GoldCounter_Custom_Tooltip:AddLine( " ", 0, 0, 0, false )

	--- Click Reset Message ---
	HistListIndex = HistListIndex + 1
	_G["GoldCounter_Custom_TooltipTextLeft".. HistListIndex]:SetFontObject( GameFontWhiteTiny )
	GoldCounter_Custom_Tooltip:AddLine( GC_Locale_Text.TOOLTIP_RESET, 1, 1, 1, false )
	end

end

function GC_SaveProfile()

	My_GC_Profile[GC_ProfileButtonChecked] = { }  --- Création

	My_GC_Profile[GC_ProfileButtonChecked].Scale				= My_GC_Settings_Local.Scale
	My_GC_Profile[GC_ProfileButtonChecked].TransView			= My_GC_Settings_Local.TransView
	My_GC_Profile[GC_ProfileButtonChecked].TransView_SW			= My_GC_Settings_Local.TransView_SW
	My_GC_Profile[GC_ProfileButtonChecked].ShowGoldOnly			= My_GC_Settings_Local.ShowGoldOnly
	My_GC_Profile[GC_ProfileButtonChecked].ShowGoldOnly_SW		= My_GC_Settings_Local.ShowGoldOnly_SW
	My_GC_Profile[GC_ProfileButtonChecked].UseShiftToDrag		= My_GC_Settings_Local.UseShiftToDrag
	My_GC_Profile[GC_ProfileButtonChecked].UseShiftToDrag_SW	= My_GC_Settings_Local.UseShiftToDrag_SW
	My_GC_Profile[GC_ProfileButtonChecked].DailyReset			= My_GC_Settings_Local.DailyReset
	My_GC_Profile[GC_ProfileButtonChecked].DailyReset_SW		= My_GC_Settings_Local.DailyReset_SW
	My_GC_Profile[GC_ProfileButtonChecked].HideInCombat			= My_GC_Settings_Local.HideInCombat
	My_GC_Profile[GC_ProfileButtonChecked].HideInCombat_SW		= My_GC_Settings_Local.HideInCombat_SW
	My_GC_Profile[GC_ProfileButtonChecked].MaxHistoryRec		= My_GC_Settings_Local.MaxHistoryRec
	My_GC_Profile[GC_ProfileButtonChecked].Font					= My_GC_Settings_Local.Font
	My_GC_Profile[GC_ProfileButtonChecked].UserDateFormat		= My_GC_Settings_Local.UserDateFormat
	My_GC_Profile[GC_ProfileButtonChecked].Thousand_Delimiter	= My_GC_Settings_Local.Thousand_Delimiter
	My_GC_Profile[GC_ProfileButtonChecked].MinimapButtonUse		= My_GC_Settings_Local.MinimapButtonUse
	My_GC_Profile[GC_ProfileButtonChecked].MinimapButtonUse_SW	= My_GC_Settings_Local.MinimapButtonUse_SW
	My_GC_Profile[GC_ProfileButtonChecked].MinimapButtonPos		= GC_Icon_DB.profile.minimap.minimapPos
	My_GC_Profile[GC_ProfileButtonChecked].IconsFlash			= My_GC_Settings_Local.IconsFlash
	My_GC_Profile[GC_ProfileButtonChecked].IconsFlash_SW		= My_GC_Settings_Local.IconsFlash_SW
	My_GC_Profile[GC_ProfileButtonChecked].CheckBank			= My_GC_Settings_Local.CheckBank
	My_GC_Profile[GC_ProfileButtonChecked].CheckBank_SW			= My_GC_Settings_Local.CheckBank_SW

	My_GC_Profile[GC_ProfileButtonChecked].Name					= GC_PlayerName
	My_GC_Profile[GC_ProfileButtonChecked].Realm				= GC_PlayerRealm
	My_GC_Profile[GC_ProfileButtonChecked].NormName				= GC_PlayerNormName
	My_GC_Profile[GC_ProfileButtonChecked].Class				= GC_PlayerClass


	My_GC_Profile[GC_ProfileButtonChecked].GC_Point, _, My_GC_Profile[GC_ProfileButtonChecked].GC_RelaPoint, 
	My_GC_Profile[GC_ProfileButtonChecked].GC_Xpos,
	My_GC_Profile[GC_ProfileButtonChecked].GC_Ypos = GoldCounter_MainFrame:GetPoint(1)

	DEFAULT_CHAT_FRAME:AddMessage( "|cffffff00GoldCounter|r "..GC_Locale_Text.PROFILE_SAVED.." ("..GC_ProfileButtonChecked..")" )

	--- Set Profile Name on option panel
	local name = GC_GetClassColor( My_GC_Profile[GC_ProfileButtonChecked].Name, My_GC_Profile[GC_ProfileButtonChecked].Class )

	_G["GC_Profile"..GC_ProfileButtonChecked.."_ButtonDefText"]:SetText( name )

	GC_PlaySFX( 1 )
end

function GC_LoadProfile( Index )

	if ( not Index ) then Index = GC_ProfileButtonChecked --- Check if it's from Quick Menu
	end

	if ( not My_GC_Profile[Index] ) then

		DEFAULT_CHAT_FRAME:AddMessage( "|cffffff00GoldCounter|r "..GC_Locale_Text.PROFILE_NOPROFILE.." ("..Index..")" )
		PlaySound( SOUNDKIT.IG_QUEST_LOG_ABANDON_QUEST )
	return
	else
	
		DEFAULT_CHAT_FRAME:AddMessage( "|cffffff00GoldCounter|r "..GC_Locale_Text.PROFILE_LOADED..
		" ("..Index..")".." (|cff3FC7EB"..My_GC_Profile[Index].NormName.."|r)" )
	end

	My_GC_Settings_Local.Scale					= My_GC_Profile[Index].Scale
	My_GC_Settings_Local.TransView				= My_GC_Profile[Index].TransView
	My_GC_Settings_Local.TransView_SW       	= My_GC_Profile[Index].TransView_SW
	My_GC_Settings_Local.ShowGoldOnly       	= My_GC_Profile[Index].ShowGoldOnly
	My_GC_Settings_Local.ShowGoldOnly_SW    	= My_GC_Profile[Index].ShowGoldOnly_SW
	My_GC_Settings_Local.UseShiftToDrag     	= My_GC_Profile[Index].UseShiftToDrag
	My_GC_Settings_Local.UseShiftToDrag_SW  	= My_GC_Profile[Index].UseShiftToDrag_SW
	My_GC_Settings_Local.DailyReset         	= My_GC_Profile[Index].DailyReset
	My_GC_Settings_Local.DailyReset_SW      	= My_GC_Profile[Index].DailyReset_SW
	My_GC_Settings_Local.HideInCombat       	= My_GC_Profile[Index].HideInCombat
	My_GC_Settings_Local.HideInCombat_SW    	= My_GC_Profile[Index].HideInCombat_SW
	My_GC_Settings_Local.MaxHistoryRec      	= My_GC_Profile[Index].MaxHistoryRec
	My_GC_Settings_Local.Font               	= My_GC_Profile[Index].Font
	My_GC_Settings_Local.UserDateFormat     	= My_GC_Profile[Index].UserDateFormat
	My_GC_Settings_Local.Thousand_Delimiter 	= My_GC_Profile[Index].Thousand_Delimiter
	My_GC_Settings_Local.MinimapButtonUse		= My_GC_Profile[Index].MinimapButtonUse
	My_GC_Settings_Local.MinimapButtonUse_SW	= My_GC_Profile[Index].MinimapButtonUse_SW
	My_GC_Settings_Local.IconsFlash				= My_GC_Profile[Index].IconsFlash
	My_GC_Settings_Local.IconsFlash_SW    		= My_GC_Profile[Index].IconsFlash_SW
	My_GC_Settings_Local.CheckBank				= My_GC_Profile[Index].CheckBank
	My_GC_Settings_Local.CheckBank_SW			= My_GC_Profile[Index].CheckBank_SW

	My_GC_Settings_Local.LastResetDate = tonumber( date("%y%m%d") )

	GoldCounter_MainFrame:ClearAllPoints()
	GoldCounter_MainFrame:SetPoint(My_GC_Profile[Index].GC_Point, UIParent,
	My_GC_Profile[Index].GC_RelaPoint, My_GC_Profile[Index].GC_Xpos,
	My_GC_Profile[Index].GC_Ypos)
	GoldCounter_MainFrame:SetUserPlaced(true)

	GC_Icon_DB.profile.minimap.minimapPos = My_GC_Profile[Index].MinimapButtonPos
	GC_Icon:Refresh("GOLDCOUNTER", GC_Icon_DB.profile.minimap)
	
	GC_SetAddonOptions()

	--- DropDown Texts
	GC_FontDropDownList_OnClick( nil, My_GC_Settings_Local.Font )
	GC_ThouSeparator_DropDownList_OnClick( nil, My_GC_Settings_Local.Thousand_Delimiter )
	GC_DateFormat_DropDownList_OnClick( nil, My_GC_Settings_Local.UserDateFormat )

	GC_PlaySFX( 2 )
end

function GC_ClearProfile()

	if not My_GC_Profile[GC_ProfileButtonChecked] then

		DEFAULT_CHAT_FRAME:AddMessage( "|cffffff00GoldCounter|r "..GC_Locale_Text.PROFILE_NOPROFILE.." ("..GC_ProfileButtonChecked..")" )
		PlaySound( SOUNDKIT.IG_QUEST_LOG_ABANDON_QUEST )
	else
	
		DEFAULT_CHAT_FRAME:AddMessage( "|cffffff00GoldCounter|r "..GC_Locale_Text.PROFILE_DELETED..
		" ("..GC_ProfileButtonChecked..")".." (|cff3FC7EB"..My_GC_Profile[GC_ProfileButtonChecked].NormName.."|r)" )

		My_GC_Profile[GC_ProfileButtonChecked] = nil
		_G["GC_Profile"..GC_ProfileButtonChecked.."_ButtonDefText"]:SetText( GC_Locale_Text.OPTIONSPANEL_PROFILE_TEXT.." "..GC_ProfileButtonChecked )

	GC_PlaySFX( 3 )

	end

end

	local GC_RACE_ICON_TEXTURES = {
		HUMAN_MALE     	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Human-male.png",
		HUMAN_FEMALE   	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Human-female.png",
		DWARF_MALE     	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Dwarf-male.png",
		DWARF_FEMALE   	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Dwarf-female.png",
		NIGHTELF_MALE	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Nightelf-male.png",
		NIGHTELF_FEMALE	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Nightelf-female.png",
		GNOME_MALE   	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Gnome-male.png",
		GNOME_FEMALE   	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Gnome-female.png",
		TAUREN_MALE  	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Tauren-male.png",
		TAUREN_FEMALE  	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Tauren-female.png",
		UNDEAD_MALE  	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Undead-male.png",
		UNDEAD_FEMALE  	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Undead-female.png",
		SCOURGE_MALE  	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Undead-male.png",
		SCOURGE_FEMALE  = "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Undead-female.png",
		ORC_MALE		= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Orc-male.png",
		ORC_FEMALE		= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Orc-female.png",
		TROLL_MALE     	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Troll-male.png",
		TROLL_FEMALE   	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Troll-female.png",

		BLOODELF_MALE	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Bloodelf-male.png",
		BLOODELF_FEMALE	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Bloodelf-female.png",
		DRAENEI_MALE	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Draenei-male.png",
		DRAENEI_FEMALE	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Draenei-female.png",

		GOBLIN_MALE		= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Goblin-male.png",
		GOBLIN_FEMALE	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Goblin-female.png",
		WORGEN_MALE		= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Worgen-male.png",
		WORGEN_FEMALE	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Worgen-female.png",

		PANDAREN_MALE	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Pandaren-male.png",
		PANDAREN_FEMALE	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Pandaren-female.png",

		NIGHTBORNE_MALE				= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Nightborne-male.png",
		NIGHTBORNE_FEMALE			= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Nightborne-female.png",
		HIGHMOUNTAINTAUREN_MALE		= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Highmountain-male.png",
		HIGHMOUNTAINTAUREN_FEMALE	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Highmountain-female.png",
		VOIDELF_MALE				= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Voidelf-male.png",
		VOIDELF_FEMALE				= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Voidelf-female.png",
		LIGHTFORGEDDRAENEI_MALE		= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Lightforged-male.png",
		LIGHTFORGEDDRAENEI_FEMALE	= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Lightforged-female.png",
		ZANDALARITROLL_MALE			= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\ZandalariTroll-male.png",
		ZANDALARITROLL_FEMALE		= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\ZandalariTroll-female.png",
		KULTIRAN_MALE				= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Kultiranhuman-male.png",
		KULTIRAN_FEMALE				= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Kultiranhuman-female.png",
		DARKIRONDWARF_MALE			= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Darkirondwarf-male.png",
		DARKIRONDWARF_FEMALE		= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Darkirondwarf-female.png",
		VULPERA_MALE				= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Vulpera-male.png",
		VULPERA_FEMALE				= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Vulpera-female.png",
		MAGHARORC_MALE				= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Maghar-male.png",
		MAGHARORC_FEMALE			= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Maghar-female.png",
		MECHAGNOME_MALE				= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Mechagnome-male.png",
		MECHAGNOME_FEMALE			= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Mechagnome-female.png",
		DRACTHYR_MALE				= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Dracthyr-male.png",
		DRACTHYR_FEMALE				= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Dracthyr-female.png",
		EARTHENDWARF_MALE			= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Earthen-male.png",
		EARTHENDWARF_FEMALE			= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Earthen-female.png",

		HARRONIR_MALE				= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Harronir_male.png",
		HARRONIR_FEMALE				= "Interface\\AddOns\\GoldCounter\\Icons\\Races\\Harronir_female.png",
		
	}

function GC_CardInit()

		--- Portrait Texture
		GC_CharPortraitRoundTexture:SetTexture( "interface/tradeskillframe/capacitanceuigeneral" )
		GC_CharPortraitRoundTexture:SetTexCoord( "0.2421875", "0.47265625", "0.34375", "0.828125" )
		SetPortraitTexture( GC_CharPortraitTexture, "player" )

		--- Name, Level, Realm
		GC_Card_PlayerName:SetFontObject( "PlayerCardTitleName" )
		GC_Card_PlayerName:SetText( GC_PlayerName.." ("..GC_PlayerLevel..")" )
		GC_Card_Realm:SetFontObject( "CardInit_ServerFont" )
		GC_Card_Realm:SetText( GC_PlayerRealm )

		--- Class Icon and locale class text and specialization
		GC_ClassIconTexture:SetTexture("Interface\\GLUES\\CHARACTERCREATE\\UI-CHARACTERCREATE-CLASSES")
		local coords = CLASS_ICON_TCOORDS[GC_PlayerClass]
		GC_ClassIconTexture:SetTexCoord( unpack(coords) )

		GC_Card_Class:SetFontObject( "CardInit_ClassFont" )
		local fClass = GC_GetClassColor( GC_PlayerClassLocale, GC_PlayerClass )
		GC_Card_Class:SetText( fClass )

		--- Race Icon
		local GC_CharGender = UnitSex("player")
		local Male, Female = 2, 3
		local PlayerRaceLocalized, PlayerRaceEN = UnitRace("player")

		GC_Card_PlayerRace:SetText( PlayerRaceLocalized )

		PlayerRaceEN = upper(PlayerRaceEN)

				if GC_CharGender < 2 and GC_CharGender > 3 then GC_CharGender = 2 end

				if PlayerRaceEN == "HUMAN" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.HUMAN_MALE)
				elseif PlayerRaceEN == "HUMAN" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.HUMAN_FEMALE)

				elseif PlayerRaceEN == "DWARF" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.DWARF_MALE)
				elseif PlayerRaceEN == "DWARF" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.DWARF_FEMALE)

				elseif PlayerRaceEN == "NIGHTELF" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.NIGHTELF_MALE)
				elseif PlayerRaceEN == "NIGHTELF" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.NIGHTELF_FEMALE)

				elseif PlayerRaceEN == "GNOME" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.GNOME_MALE)
				elseif PlayerRaceEN == "GNOME" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.GNOME_FEMALE)

				elseif PlayerRaceEN == "TAUREN" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.TAUREN_MALE)
				elseif PlayerRaceEN == "TAUREN" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.TAUREN_FEMALE)

				elseif ( PlayerRaceEN == "UNDEAD" or PlayerRaceEN == "SCOURGE" ) and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.UNDEAD_MALE)
				elseif ( PlayerRaceEN == "UNDEAD" or PlayerRaceEN == "SCOURGE" ) and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.UNDEAD_FEMALE)

				elseif PlayerRaceEN == "ORC" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.ORC_MALE)
				elseif PlayerRaceEN == "ORC" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.ORC_FEMALE)

				elseif PlayerRaceEN == "TROLL" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.TROLL_MALE)
				elseif PlayerRaceEN == "TROLL" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.TROLL_FEMALE)

				elseif PlayerRaceEN == "BLOODELF" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.BLOODELF_MALE)
				elseif PlayerRaceEN == "BLOODELF" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.BLOODELF_FEMALE)

				elseif PlayerRaceEN == "DRAENEI" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.DRAENEI_MALE)
				elseif PlayerRaceEN == "DRAENEI" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.DRAENEI_FEMALE)

				elseif PlayerRaceEN == "GOBLIN" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.GOBLIN_MALE)
				elseif PlayerRaceEN == "GOBLIN" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.GOBLIN_FEMALE)

				elseif PlayerRaceEN == "WORGEN" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.WORGEN_MALE)
				elseif PlayerRaceEN == "WORGEN" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.WORGEN_FEMALE)

				elseif PlayerRaceEN == "PANDAREN" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.PANDAREN_MALE)
				elseif PlayerRaceEN == "PANDAREN" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.PANDAREN_FEMALE)

				elseif PlayerRaceEN == "NIGHTBORNE" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.NIGHTBORNE_MALE)
				elseif PlayerRaceEN == "NIGHTBORNE" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.NIGHTBORNE_FEMALE)

				elseif PlayerRaceEN == "HIGHMOUNTAINTAUREN" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.HIGHMOUNTAINTAUREN_MALE)
				elseif PlayerRaceEN == "HIGHMOUNTAINTAUREN" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.HIGHMOUNTAINTAUREN_FEMALE)

				elseif PlayerRaceEN == "VOIDELF" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.VOIDELF_MALE)
				elseif PlayerRaceEN == "VOIDELF" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.VOIDELF_FEMALE)

				elseif PlayerRaceEN == "LIGHTFORGEDDRAENEI" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.LIGHTFORGEDDRAENEI_MALE)
				elseif PlayerRaceEN == "LIGHTFORGEDDRAENEI" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.LIGHTFORGEDDRAENEI_FEMALE)

				elseif PlayerRaceEN == "ZANDALARITROLL" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.ZANDALARITROLL_MALE)
				elseif PlayerRaceEN == "ZANDALARITROLL" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.ZANDALARITROLL_FEMALE)

				elseif PlayerRaceEN == "KULTIRAN" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.KULTIRAN_MALE)
				elseif PlayerRaceEN == "KULTIRAN" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.KULTIRAN_FEMALE)

				elseif PlayerRaceEN == "DARKIRONDWARF" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.DARKIRONDWARF_MALE)
				elseif PlayerRaceEN == "DARKIRONDWARF" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.DARKIRONDWARF_FEMALE)

				elseif PlayerRaceEN == "VULPERA" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.VULPERA_MALE)
				elseif PlayerRaceEN == "VULPERA" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.VULPERA_FEMALE)

				elseif PlayerRaceEN == "MAGHARORC" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.MAGHARORC_MALE)
				elseif PlayerRaceEN == "MAGHARORC" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.MAGHARORC_FEMALE)

				elseif PlayerRaceEN == "MECHAGNOME" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.MECHAGNOME_MALE)
				elseif PlayerRaceEN == "MECHAGNOME" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.MECHAGNOME_FEMALE)

				elseif PlayerRaceEN == "DRACTHYR" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.DRACTHYR_MALE)
				elseif PlayerRaceEN == "DRACTHYR" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.DRACTHYR_FEMALE)

				elseif PlayerRaceEN == "EARTHENDWARF" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.EARTHENDWARF_MALE)
				elseif PlayerRaceEN == "EARTHENDWARF" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.EARTHENDWARF_FEMALE)

				elseif PlayerRaceEN == "HARRONIR" and GC_CharGender == Male then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.HARRONIR_MALE)
				elseif PlayerRaceEN == "HARRONIR" and GC_CharGender == Female then
						GC_RaceIconTexture:SetTexture(GC_RACE_ICON_TEXTURES.HARRONIR_FEMALE)

				end
			
		------------------------------------------------------------
		if GC_WOW_isRetail == true then --- Get Spec only in Retail
			local currentSpec = GetSpecialization()
				if currentSpec then
					local _, currentSpecName = GetSpecializationInfo( currentSpec )
					GC_Card_ClassSpe:SetFontObject( "SystemFont_Large" )
					GC_Card_ClassSpe:SetText( "|cffffff00[|r"..currentSpecName.."|cffffff00]|r" )
				end
		else
					GC_Card_ClassSpe:SetFontObject( "SystemFont_Large" )
					GC_Card_ClassSpe:SetText( "|cffffff00[|r?|cffffff00]|r" )
		end
		------------------------------------------------------------

					GC_Card_PlayerRace:SetFontObject( "SystemFont_Large" )
					GC_Card_PlayerRace:SetText( "|cffffff00[|r"..PlayerRaceLocalized.."|cffffff00]|r" )

			--- Faction Texture
			if GC_PlayerFaction == "Alliance"  then GC_FactionTexture:SetTexture( GC_FactionIconAllianceART )
			elseif GC_PlayerFaction == "Horde" then GC_FactionTexture:SetTexture( GC_FactionIconHordeART )
			else GC_FactionTexture:SetTexture( GC_FactionIconNeutralART )
			end

		------------
		--- Check Equipped Weapons Durability
		local GC_Gear_Durability = { 
		["Equipped_Stuff"]     = "??",
		["Equipped_Weapons"]   = "??",
		["Color_State_LOW"]    = "|cfff00000",
		["Color_State_MEDIUM"] = "|cfff0f000",
		["Color_State_GOOD"]   = "|cff00f000",
		}

		GC_PlayerItemLevel = GC_GetPlayerItemLevel()
		GC_Card_iLevel:SetText( GC_PlayerItemLevel )

		local WEPS_currentDura, WEPS_maxDura
		
		local WEP1_currentDura, WEP1_maximumDura = GetInventoryItemDurability( INVSLOT_MAINHAND )
		local WEP2_currentDura, WEP2_maximumDura = GetInventoryItemDurability( INVSLOT_OFFHAND )
		local WEP3_currentDura, WEP3_maximumDura = GetInventoryItemDurability( INVSLOT_RANGED )

		if not WEP1_maximumDura and not WEP2_maximumDura and not WEP3_maximumDura then
		
			GC_Gear_Weapons_None:Show()
			GC_Card_WeaponsDura:Hide()
		else
			GC_Gear_Weapons_None:Hide()
			GC_Card_WeaponsDura:Show()

			--- Weapon 1
			if WEP1_maximumDura and WEP1_maximumDura > 0 then
				WEPS_maxDura = WEP1_maximumDura
				WEPS_currentDura = WEP1_currentDura
			else
				WEPS_maxDura = 0
				WEPS_currentDura = 0
			end

			--- Weapon 2
			if WEP2_maximumDura and WEP2_maximumDura > 0 then
				WEPS_maxDura = WEPS_maxDura + WEP2_maximumDura
				WEPS_currentDura = WEPS_currentDura + WEP2_currentDura
			end

			--- Weapon 3 ( Ranged )
			if WEP3_maximumDura and WEP3_maximumDura > 0 then
				WEPS_maxDura = WEPS_maxDura + WEP3_maximumDura
				WEPS_currentDura = WEPS_currentDura + WEP3_currentDura
			end

			local Total_WEP_Dura_Perc = floor( ( WEPS_currentDura / WEPS_maxDura ) * 100 )
			
			if Total_WEP_Dura_Perc > 70 then
			
				GC_Gear_Durability.Equipped_Weapons = GC_Gear_Durability.Color_State_GOOD..Total_WEP_Dura_Perc.. "%|r"
				
			elseif Total_WEP_Dura_Perc > 30 then

				GC_Gear_Durability.Equipped_Weapons = GC_Gear_Durability.Color_State_MEDIUM..Total_WEP_Dura_Perc.. "%|r"
			
			else
				GC_Gear_Durability.Equipped_Weapons = GC_Gear_Durability.Color_State_LOW..Total_WEP_Dura_Perc.. "%|r"
			end

			GC_Card_WeaponsDura:SetText( GC_Gear_Durability.Equipped_Weapons )
			
		end
		
		--- Check Equipped Gear Durability
		local Gear_Table = { }
		local Gear_Max_Dura, Gear_Current_Dura = 0, 0
		
		Gear_Table[1], Gear_Table[2]   = GetInventoryItemDurability( INVSLOT_HEAD )
		Gear_Table[3], Gear_Table[4]   = GetInventoryItemDurability( INVSLOT_SHOULDER )
		Gear_Table[5], Gear_Table[6]   = GetInventoryItemDurability( INVSLOT_CHEST )
		Gear_Table[7], Gear_Table[8]   = GetInventoryItemDurability( INVSLOT_WAIST )
		Gear_Table[9], Gear_Table[10]  = GetInventoryItemDurability( INVSLOT_LEGS )
		Gear_Table[11], Gear_Table[12] = GetInventoryItemDurability( INVSLOT_FEET )
		Gear_Table[13], Gear_Table[14] = GetInventoryItemDurability( INVSLOT_WRIST )
		Gear_Table[15], Gear_Table[16] = GetInventoryItemDurability( INVSLOT_HAND )
		
		for index = 1, 15, 2 do
			if Gear_Table[index] then Gear_Current_Dura = Gear_Current_Dura + Gear_Table[index] end
			if Gear_Table[index+1] then Gear_Max_Dura = Gear_Max_Dura + Gear_Table[index+1] end
		end

		if not Gear_Max_Dura or Gear_Max_Dura == 0 then -- Nothing Equipped
		
			GC_Gear_Armor_None:Show()
			GC_Card_GearDura:Hide()
			
		else
		
			GC_Gear_Armor_None:Hide()
			GC_Card_GearDura:Show()

			local Total_Equip_Dura_Perc = floor( ( Gear_Current_Dura / Gear_Max_Dura ) * 100 )
			
			if Total_Equip_Dura_Perc > 70 then
			
				GC_Gear_Durability.Equipped_Stuff = GC_Gear_Durability.Color_State_GOOD..Total_Equip_Dura_Perc.. "%|r"
				
			elseif Total_Equip_Dura_Perc > 30 then

				GC_Gear_Durability.Equipped_Stuff = GC_Gear_Durability.Color_State_MEDIUM..Total_Equip_Dura_Perc.. "%|r"
			
			else
				GC_Gear_Durability.Equipped_Stuff = GC_Gear_Durability.Color_State_LOW..Total_Equip_Dura_Perc.. "%|r"
			end

			GC_Card_GearDura:SetText( GC_Gear_Durability.Equipped_Stuff )
		end

			GC_Card_Dura:SetFontObject( "CardInit_Durability" )
			GC_Card_Dura:SetText( GC_Locale_Text.TOOLTIP_INFOS_DURABILITY )

				----------------------
				--- XP Informations
				----------------------
				
--				if GC_PlayerLevel < GC_MaxPlayerLevel then
				GC_PlayerXP = UnitXP("player") or 0 -- In case just level up
				local MaxXP = UnitXPMax("player") or 0

				local xpLeft = MaxXP - GC_PlayerXP
				local xpProgressPercent = (GC_PlayerXP / MaxXP) * 100
				local StringXP = format("%.2f%%", xpProgressPercent )

				local RestedXP = GetXPExhaustion() or 0
			    RestedXP = (RestedXP / xpLeft) * 100
				
					if ( RestedXP > 100 ) then RestedXP = 100 end --- Not counting extra rest point of next level (DISABLED)

					RestedXP = format("%.2f%%", RestedXP )

				local StringXP_Recent = ""
						if ( GC_LastXP > 0 ) then

						local XpToLevelUp
						XpToLevelUp = floor( xpLeft / GC_LastXP ) + 1
						StringXP_Recent = ( " (x"..XpToLevelUp..")" )
						
						else
						
						GC_XP_RecentData:SetText( GC_LastXP )
						end

				----------------------------
				--- Set results to panel ---

				local Str_LastXP = GC_reformatInt( GC_LastXP )
				local Str_QuestXP = GC_reformatInt( GC_MyDailyData.QuestXP )

				GC_Card_XP:SetFontObject( "CardInit_Durability" )
				GC_Card_XP:SetText( GC_Locale_Text.TOOLTIP_INFOS_EXP )

				GC_XP_Progress:SetText( GC_Locale_Text.TOOLTIP_INFOS_PROGRESSXP )
				GC_XP_Rest:SetText( GC_Locale_Text.TOOLTIP_INFOS_REST )
				GC_XP_Recent:SetText( GC_Locale_Text.TOOLTIP_INFOS_LASTXP )
				GC_XP_QuestXP:SetText( GC_Locale_Text.PLAYER_INCOMES_QUESTREWARD )

				GC_XP_ProgressData:SetText( StringXP )
				GC_XP_RestData:SetText( RestedXP )
				GC_XP_RecentData:SetText( Str_LastXP.." XP "..StringXP_Recent )
				GC_XP_QuestXPData:SetText( Str_QuestXP.." XP" )
				
				--- If not MaxLevel Last line to hide
				GC_XP_Data:Hide()
				GC_XP_NewData:Hide()

				----------------------

--			else

				----------------------
				--- if Max Level ... ?
				----------------------

			
				--- If Max level SHow all lines
--				GC_XP_Data:Show()
--				GC_XP_NewData:Show()

--				local DonjonMoney = GC_MoneyCoinsTextures( nil, GC_MyDailyData.Instance_MoneyLoot, false)
--				local LootMoney = GC_MoneyCoinsTextures( nil, GC_MyDailyData.Money_Loot, false )
--				local MerchantMoney = GC_MoneyCoinsTextures( nil, GC_MyDailyData.Merchant_Money, false )
--				local Auctioneer = GC_MoneyCoinsTextures( nil, GC_MyDailyData.Auctioneer, false )
--				local MailBoxIncome = GC_MoneyCoinsTextures( nil, GC_MyDailyData.MailBoxIncome, false )

--				GC_Card_XP:SetText( GC_Locale_Text.PLAYERCARD_INCOMES )

--				GC_XP_Progress:SetText( GC_Locale_Text.PLAYER_INCOMES_DUNGEON )
--				GC_XP_Rest:SetText( GC_Locale_Text.PLAYER_INCOMES_MONEYLOOT )
--				GC_XP_Recent:SetText( GC_Locale_Text.PLAYER_INCOMES_TRADER )
--				GC_XP_QuestXP:SetText( GC_Locale_Text.PLAYER_INCOMES_AUCTIONEER )
--				GC_XP_Data:SetText( GC_Locale_Text.PLAYER_INCOMES_MAILBOX )

--				GC_XP_ProgressData:SetText( DonjonMoney )
--				GC_XP_RestData:SetText( LootMoney )
--				GC_XP_RecentData:SetText( MerchantMoney )
--				GC_XP_QuestXPData:SetText( Auctioneer )
--				GC_XP_NewData:SetText( MailBoxIncome )

--			end
			-----------------------------------------
end
---
