From 166711367400b76c7dc067e03b34384606bcd884 Mon Sep 17 00:00:00 2001 From: Kiatra Date: Tue, 29 Mar 2022 21:08:26 +0200 Subject: [PATCH] Update CB_PlayedTime.lua use API UnitFullName() to get char name and realm as that API seems more reliable on first character load. --- modules/CB_PlayedTime.lua | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/modules/CB_PlayedTime.lua b/modules/CB_PlayedTime.lua index 378899e..f4baeea 100755 --- a/modules/CB_PlayedTime.lua +++ b/modules/CB_PlayedTime.lua @@ -58,11 +58,7 @@ function dataobj:OnTooltipShow() end local function getPlayerIdentifier() - local _, _, _, _, _, name, server = GetPlayerInfoByGUID(UnitGUID("player")) - if not server or server == "" then - server = GetNormalizedRealmName() or "" - end - --debug("getPlayerIdentifier", server,name) + local name, server = UnitFullName("player") return string.format("%s-%s", name, server) end @@ -97,13 +93,11 @@ local frame2 = CreateFrame("Frame") local function onEnteringWorld() db = CB_PlayedTime and CB_PlayedTime or {} CB_PlayedTime = db - --RequestTimePlayed() - acetimer:ScheduleTimer(function() - RequestTimePlayed() - acetimer:ScheduleRepeatingTimer(function() + RequestTimePlayed() + acetimer:ScheduleRepeatingTimer(function() updateText() - end, 3) - end, 2) + end, 5) + dataobj:RegisterOptions() frame2:UnregisterEvent("PLAYER_ENTERING_WORLD") end