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