|
]]-- |
|
local ZT = { |
Version = GetAddOnMetadata("ZoneTimer", "Version"); |
Revision = tonumber(strsub("$Rev$", 7, strlen("$Rev$") - 2)); |
Time = 0.01; |
} |
ZoneTimer = { |
|
function ZoneTimer_OnEvent() |
if ( event == "PLAYER_ENTERING_WORLD" ) then |
local t = GetTime() - ZT.Time |
local c = "00cc00" |
Setting = { |
Version = GetAddOnMetadata("ZoneTimer", "Version"); |
Revision = tonumber(strsub("$Rev$", 7, strlen("$Rev$") - 2)); |
Time = 0.01; |
}, |
|
if ( t > 10 ) then |
c = "ff0000" |
elseif ( t > 5 ) then |
c = "ffff00" |
end |
OnEvent = function () |
if ( event == "PLAYER_ENTERING_WORLD" ) then |
local t = GetTime() - ZoneTimer.Setting.Time |
local c = "00cc00" |
|
if ( t > .01 ) then |
DEFAULT_CHAT_FRAME:AddMessage(string.format("|cffffd100ZoneTimer:|r |cff"..c.."%.3f Seconds|r", t)) |
end |
elseif ( event == "PLAYER_LEAVING_WORLD" ) then |
ZT.Time = GetTime() |
this:RegisterEvent("PLAYER_ENTERING_WORLD") |
end |
end |
if ( t > 10 ) then |
c = "ff0000" |
elseif ( t > 5 ) then |
c = "ffff00" |
end |
|
if ( t > .01 ) then |
DEFAULT_CHAT_FRAME:AddMessage(string.format("|cffffd100ZoneTimer:|r |cff"..c.."%.3f Seconds|r", t)) |
end |
elseif ( event == "PLAYER_LEAVING_WORLD" ) then |
ZoneTimer.Setting.Time = GetTime() |
this:RegisterEvent("PLAYER_ENTERING_WORLD") |
end |
end, |
|
} |
|
if (not ZoneTimerFrame) then |
CreateFrame("Frame", "ZoneTimerFrame") |
end |
ZoneTimerFrame:Hide() |
ZoneTimerFrame:SetScript("OnEvent", ZoneTimer_OnEvent) |
ZoneTimerFrame:RegisterEvent("PLAYER_LEAVING_WORLD") |