diff --git a/ElvUI/Locales/Chinese_UI.lua b/ElvUI/Locales/Chinese_UI.lua index 85200cf..997b146 100644 --- a/ElvUI/Locales/Chinese_UI.lua +++ b/ElvUI/Locales/Chinese_UI.lua @@ -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; diff --git a/ElvUI/Locales/English_UI.lua b/ElvUI/Locales/English_UI.lua index 27d1642..33592c8 100644 --- a/ElvUI/Locales/English_UI.lua +++ b/ElvUI/Locales/English_UI.lua @@ -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; diff --git a/ElvUI/Locales/French_UI.lua b/ElvUI/Locales/French_UI.lua index 00105eb..669fe45 100644 --- a/ElvUI/Locales/French_UI.lua +++ b/ElvUI/Locales/French_UI.lua @@ -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; diff --git a/ElvUI/Locales/German_UI.lua b/ElvUI/Locales/German_UI.lua index cb7ed63..30dc7f8 100644 --- a/ElvUI/Locales/German_UI.lua +++ b/ElvUI/Locales/German_UI.lua @@ -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; diff --git a/ElvUI/Locales/Korean_UI.lua b/ElvUI/Locales/Korean_UI.lua index 336c174..0f458eb 100644 --- a/ElvUI/Locales/Korean_UI.lua +++ b/ElvUI/Locales/Korean_UI.lua @@ -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; diff --git a/ElvUI/Locales/Portuguese_UI.lua b/ElvUI/Locales/Portuguese_UI.lua index 042ad3c..c98323f 100644 --- a/ElvUI/Locales/Portuguese_UI.lua +++ b/ElvUI/Locales/Portuguese_UI.lua @@ -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; diff --git a/ElvUI/Locales/Russian_UI.lua b/ElvUI/Locales/Russian_UI.lua index 7182766..9fb4968 100644 --- a/ElvUI/Locales/Russian_UI.lua +++ b/ElvUI/Locales/Russian_UI.lua @@ -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"] = "ПКМ: Сбросить использование процессора" diff --git a/ElvUI/Locales/Spanish_UI.lua b/ElvUI/Locales/Spanish_UI.lua index 98fe273..6f63ed6 100644 --- a/ElvUI/Locales/Spanish_UI.lua +++ b/ElvUI/Locales/Spanish_UI.lua @@ -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; diff --git a/ElvUI/Locales/Taiwanese_UI.lua b/ElvUI/Locales/Taiwanese_UI.lua index 458183b..9d90d4b 100644 --- a/ElvUI/Locales/Taiwanese_UI.lua +++ b/ElvUI/Locales/Taiwanese_UI.lua @@ -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; diff --git a/ElvUI/Modules/DataTexts/Time.lua b/ElvUI/Modules/DataTexts/Time.lua index 94e8af9..793ace9 100644 --- a/ElvUI/Modules/DataTexts/Time.lua +++ b/ElvUI/Modules/DataTexts/Time.lua @@ -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 - 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)"]) - DT.tooltip:AddLine(" ") - oneraid = true - end - if extended then - lockoutColor = lockoutColorExtended - else - lockoutColor = lockoutColorNormal - end + RequestRaidInfo() - DT.tooltip:AddDoubleLine(format(lockoutInfoFormatNoEnc, maxPlayers, difficultyInfo[difficultyId], name), SecondsToTime(reset, false, nil, 3), 1, 1, 1, lockoutColor.r, lockoutColor.g, lockoutColor.b) + local lockedInstances = {raids = {}} + local _, name, reset + + for i = 1, GetNumSavedInstances() do + name, _, reset = GetSavedInstanceInfo(i) + if name then + insert(lockedInstances["raids"], {name, reset}) end end - DT.tooltip:AddDoubleLine(TIMEMANAGER_TOOLTIP_REALMTIME, format(europeDisplayFormat_nocolor, GetGameTime()), 1, 1, 1, lockoutColorNormal.r, lockoutColorNormal.g, lockoutColorNormal.b) + if next(lockedInstances["raids"]) then + DT.tooltip:AddLine(" ") + 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:Show() + DT.tooltip:AddLine(" ") + end + + 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) \ No newline at end of file +DT:RegisterDatatext("Time", nil, nil, OnUpdate, OnClick, OnEnter, OnLeave) \ No newline at end of file