update Time datatext

This commit is contained in:
Crum
2018-07-17 17:13:20 -05:00
parent aa71a4f743
commit 4d5d5b22f0
10 changed files with 57 additions and 23 deletions
+1
View File
@@ -83,6 +83,7 @@ L["Miss Chance"] = true;
L["Mitigation By Level: "] = "等级减伤: "
L["No Guild"] = "没有公会"
L["Profit:"] = "利润:"
L["Realm time:"] = "服务器时间:"
L["Reload UI"] = true;
L["Reset Data: Hold Shift + Right Click"] = "重置数据: 按住 Shift + 右键点击"
L["Right Click: Reset CPU Usage"] = true;
+1
View File
@@ -83,6 +83,7 @@ L["Miss Chance"] = true;
L["Mitigation By Level: "] = true;
L["No Guild"] = true;
L["Profit:"] = true;
L["Realm time:"] = true;
L["Reload UI"] = true;
L["Reset Data: Hold Shift + Right Click"] = true;
L["Right Click: Reset CPU Usage"] = true;
+1
View File
@@ -83,6 +83,7 @@ L["Miss Chance"] = true;
L["Mitigation By Level: "] = "Réduction par niveau: "
L["No Guild"] = "Pas de Guilde"
L["Profit:"] = "Profit:"
L["Realm time:"] = "Heure du royaume :"
L["Reload UI"] = true;
L["Reset Data: Hold Shift + Right Click"] = "RAZ des données: MAJ + Clic droit"
L["Right Click: Reset CPU Usage"] = true;
+1
View File
@@ -83,6 +83,7 @@ L["Miss Chance"] = true;
L["Mitigation By Level: "] = "Milderung durch Stufe:"
L["No Guild"] = "Keine Gilde"
L["Profit:"] = "Gewinn:"
L["Realm time:"] = "Serverzeit:"
L["Reload UI"] = true;
L["Reset Data: Hold Shift + Right Click"] = "Daten zurücksetzen: Halte Shift + Rechtsklick"
L["Right Click: Reset CPU Usage"] = true;
+1
View File
@@ -83,6 +83,7 @@ L["Miss Chance"] = true;
L["Mitigation By Level: "] = "레벨별 데미지 경감률"
L["No Guild"] = "길드 없음"
L["Profit:"] = "이익:"
L["Realm time:"] = "서버 시간:"
L["Reload UI"] = true;
L["Reset Data: Hold Shift + Right Click"] = "기록 리셋: Shift + 우클릭"
L["Right Click: Reset CPU Usage"] = true;
+1
View File
@@ -83,6 +83,7 @@ L["Miss Chance"] = true;
L["Mitigation By Level: "] = "Mitigação por nível"
L["No Guild"] = "Sem Guilda"
L["Profit:"] = "Lucro:"
L["Realm time:"] = "Hora do reino:"
L["Reload UI"] = true;
L["Reset Data: Hold Shift + Right Click"] = "Redefinir Dados: Segurar Shifr + Clique Direito"
L["Right Click: Reset CPU Usage"] = true;
+1
View File
@@ -83,6 +83,7 @@ L["Miss Chance"] = "Вероятность промаха"
L["Mitigation By Level: "] = "Снижение на уровне: "
L["No Guild"] = "Нет гильдии"
L["Profit:"] = "Прибыль:"
L["Realm time:"] = "Серверное время:"
L["Reload UI"] = "Перезагрузка"
L["Reset Data: Hold Shift + Right Click"] = "Сбросить данные: Shift + ПКМ"
L["Right Click: Reset CPU Usage"] = "ПКМ: Сбросить использование процессора"
+1
View File
@@ -83,6 +83,7 @@ L["Miss Chance"] = true;
L["Mitigation By Level: "] = "Mitigación Por Nivel: "
L["No Guild"] = "Sin Hermandad"
L["Profit:"] = "Ganancia:"
L["Realm time:"] = "Hora del reino:"
L["Reload UI"] = true;
L["Reset Data: Hold Shift + Right Click"] = "Restablecer Datos: Mantén Shift + Clic Derecho"
L["Right Click: Reset CPU Usage"] = true;
+1
View File
@@ -83,6 +83,7 @@ L["Miss Chance"] = true;
L["Mitigation By Level: "] = "等級減傷: "
L["No Guild"] = "沒有公會"
L["Profit:"] = "利潤: "
L["Realm time:"] = "伺服器時間:"
L["Reload UI"] = true;
L["Reset Data: Hold Shift + Right Click"] = "重置數據: 按住 Shift + 右鍵點擊"
L["Right Click: Reset CPU Usage"] = true;
+47 -22
View File
@@ -3,22 +3,34 @@ local DT = E:GetModule("DataTexts");
--Cache global variables
--Lua functions
local time = time
local format, join = string.format, string.join
local next, unpack = next, unpack
local format, gsub, join = string.format, string.gsub, string.join
local abs = math.abs
local getn, insert = table.getn, table.insert
local time, utf8sub = time, string.utf8sub
--WoW API / Variables
local GetGameTime = GetGameTime
local GetNumSavedInstances = GetNumSavedInstances
local GetSavedInstanceInfo = GetSavedInstanceInfo
local IsAddOnLoaded = IsAddOnLoaded
local SecondsToTime = SecondsToTime
local TIMEMANAGER_TOOLTIP_REALMTIME = "Realm time:"
local timeDisplayFormat = ""
local dateDisplayFormat = ""
local europeDisplayFormat_nocolor = join("", "%02d", ":|r%02d")
local lockoutInfoFormatNoEnc = "%s%s |cffaaaaaa(%s)"
local difficultyInfo = {"N", "N", "H", "H"}
local lockoutInfoFormat = "|cffaaaaaa(%s)"
local lockoutColorExtended, lockoutColorNormal = {r = 0.3, g = 1, b = 0.3}, {r = .8, g = .8, b = .8}
local function OnClick()
if IsAddOnLoaded("TimeManager") then -- https://github.com/gashole/TimeManager
if arg1 == "RightButton" then
TimeManagerClockButton_OnClick()
else
GameTimeFrame_OnClick()
end
end
end
local function OnLeave()
DT.tooltip:Hide()
end
@@ -26,28 +38,33 @@ end
local function OnEnter(self)
DT:SetupTooltip(self)
local name, _, reset, difficultyId, locked, extended, isRaid, maxPlayers
local oneraid, lockoutColor
RequestRaidInfo()
local lockedInstances = {raids = {}}
local _, name, reset
for i = 1, GetNumSavedInstances() do
name, _, reset, difficultyId, locked, extended, _, isRaid, maxPlayers = GetSavedInstanceInfo(i)
if isRaid and (locked or extended) and name then
if not oneraid then
DT.tooltip:AddLine(L["Saved Raid(s)"])
name, _, reset = GetSavedInstanceInfo(i)
if name then
insert(lockedInstances["raids"], {name, reset})
end
end
if next(lockedInstances["raids"]) then
DT.tooltip:AddLine(" ")
oneraid = true
end
if extended then
lockoutColor = lockoutColorExtended
else
lockoutColor = lockoutColorNormal
DT.tooltip:AddLine(L["Saved Raid(s)"])
for i = 1, getn(lockedInstances["raids"]) do
name, reset = unpack(lockedInstances["raids"][i])
lockoutColor = extended and lockoutColorExtended or lockoutColorNormal
DT.tooltip:AddDoubleLine(format(lockoutInfoFormat, name), SecondsToTime(abs(reset), 1, 1, false), 1, 1, 1, lockoutColor.r, lockoutColor.g, lockoutColor.b)
end
DT.tooltip:AddDoubleLine(format(lockoutInfoFormatNoEnc, maxPlayers, difficultyInfo[difficultyId], name), SecondsToTime(reset, false, nil, 3), 1, 1, 1, lockoutColor.r, lockoutColor.g, lockoutColor.b)
end
DT.tooltip:Show()
DT.tooltip:AddLine(" ")
end
DT.tooltip:AddDoubleLine(TIMEMANAGER_TOOLTIP_REALMTIME, format(europeDisplayFormat_nocolor, GetGameTime()), 1, 1, 1, lockoutColorNormal.r, lockoutColorNormal.g, lockoutColorNormal.b)
DT.tooltip:AddDoubleLine(L["Realm time:"], format(europeDisplayFormat_nocolor, GetGameTime()), 1, 1, 1, lockoutColorNormal.r, lockoutColorNormal.g, lockoutColorNormal.b)
DT.tooltip:Show()
end
@@ -58,6 +75,14 @@ local function OnUpdate(self, t)
if int > 0 then return end
if IsAddOnLoaded("TimeManager") then -- https://github.com/gashole/TimeManager
if TimeManagerClockButton.alarmFiring then
-- E:Flash(self)
else
-- E:StopFlash(self)
end
end
self.text:SetText(gsub(gsub(BetterDate(E.db.datatexts.timeFormat.." "..E.db.datatexts.dateFormat, time()), ":", timeDisplayFormat), "%s", dateDisplayFormat))
lastPanel = self
@@ -74,4 +99,4 @@ local function ValueColorUpdate(hex)
end
E["valueColorUpdateFuncs"][ValueColorUpdate] = true
DT:RegisterDatatext("Time", nil, nil, OnUpdate, nil, OnEnter, OnLeave)
DT:RegisterDatatext("Time", nil, nil, OnUpdate, OnClick, OnEnter, OnLeave)