Skip to content

Commit

Permalink
Update CB_PlayedTime.lua
Browse files Browse the repository at this point in the history
use API UnitFullName() to get char name and realm as that API seems more reliable on first character load.
Kiatra committed Mar 29, 2022
1 parent 99343d3 commit 1667113
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions modules/CB_PlayedTime.lua
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1667113

Please sign in to comment.