diff --git a/ElvUI/Core/General/API.lua b/ElvUI/Core/General/API.lua index dc3006b0fb..bce5c57f0c 100644 --- a/ElvUI/Core/General/API.lua +++ b/ElvUI/Core/General/API.lua @@ -7,6 +7,7 @@ local ElvUF = E.oUF local _G = _G local setmetatable = setmetatable +local issecrettable = issecrettable local hooksecurefunc = hooksecurefunc local type, pairs, unpack, strmatch = type, pairs, unpack, strmatch local wipe, max, next, tinsert, date, time = wipe, max, next, tinsert, date, time @@ -53,7 +54,6 @@ local GetWatchedFactionData = C_Reputation.GetWatchedFactionData local GetColorDataForItemQuality = ColorManager and ColorManager.GetColorDataForItemQuality local GetAuraDataByIndex = C_UnitAuras.GetAuraDataByIndex -local UnpackAuraData = AuraUtil.UnpackAuraData local GetSpecialization = C_SpecializationInfo.GetSpecialization or GetSpecialization local GetSpecializationInfo = C_SpecializationInfo.GetSpecializationInfo or GetSpecializationInfo @@ -517,8 +517,20 @@ do -- Spell renaming provided by BigWigs end do + function E:UnpackAuraData(data) + local name, icon, applications, dispelName, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod = data.name, data.icon, data.applications, data.dispelName, data.duration, data.expirationTime, data.sourceUnit, data.isStealable, data.nameplateShowPersonal, data.spellId, data.canApplyAura, data.isBossAura, data.isFromPlayerOrPlayerPet, data.nameplateShowAll, data.timeMod + if issecrettable and issecrettable(data.points) then + return name, icon, applications, dispelName, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod + else + return name, icon, applications, dispelName, duration, expirationTime, sourceUnit, isStealable, nameplateShowPersonal, spellId, canApplyAura, isBossAura, isFromPlayerOrPlayerPet, nameplateShowAll, timeMod, unpack(data.points) + end + end + function E:GetAuraData(unitToken, index, filter) - return UnpackAuraData(GetAuraDataByIndex(unitToken, index, filter)) + local data = GetAuraDataByIndex(unitToken, index, filter) + if not data then return end + + return E:UnpackAuraData(data) end local function FindAura(key, value, unit, index, filter, ...) diff --git a/ElvUI/Core/Modules/ActionBars/ActionBars.lua b/ElvUI/Core/Modules/ActionBars/ActionBars.lua index e68f5b395e..8e000ce5d9 100644 --- a/ElvUI/Core/Modules/ActionBars/ActionBars.lua +++ b/ElvUI/Core/Modules/ActionBars/ActionBars.lua @@ -389,9 +389,12 @@ function AB:CreateBar(id) local button = LAB:CreateButton(i, format('%sButton%d', barName, i), bar) button.AuraCooldown.targetAura = true - E:RegisterCooldown(button.AuraCooldown, 'actionbar') - if E.Retail then + if not E.Midnight then + E:RegisterCooldown(button.AuraCooldown, 'actionbar') + end + + if E.Retail and not E.Midnight then button.ProfessionQualityOverlayFrame = CreateFrame('Frame', nil, button, 'ActionButtonProfessionOverlayTemplate') end @@ -737,7 +740,10 @@ function AB:StyleButton(button, noBackdrop, useMasque, ignoreNormal) end if not AB.handledbuttons[button] then - E:RegisterCooldown(button.cooldown, 'actionbar') + if not E.Midnight then + E:RegisterCooldown(button.cooldown, 'actionbar') + end + AB.handledbuttons[button] = true end @@ -899,7 +905,7 @@ do if (E.Retail and (canGlide or CanGlide() or IsPossessBarVisible() or HasOverrideActionBar())) or UnitCastingInfo('player') or UnitChannelInfo('player') or UnitExists('target') or UnitExists('focus') - or UnitExists('vehicle') or UnitAffectingCombat('player') or (UnitHealth('player') ~= UnitHealthMax('player')) then + or UnitExists('vehicle') or UnitAffectingCombat('player') or (not E.Midnight and (UnitHealth('player') ~= UnitHealthMax('player'))) then self.mouseLock = true E:UIFrameFadeIn(self, 0.2, self:GetAlpha(), 1) AB:FadeBlings(1) @@ -1123,6 +1129,7 @@ do MicroButtonAndBagsBar = true, OverrideActionBar = true, MainMenuBar = true, + MainActionBar = E.Midnight or nil, [E.Retail and 'StanceBar' or 'StanceBarFrame'] = true, [E.Retail and 'PetActionBar' or 'PetActionBarFrame'] = true, [E.Retail and 'PossessActionBar' or 'PossessBarFrame'] = true @@ -1644,7 +1651,8 @@ function AB:UpdateAuraCooldown(button, duration) if not cd then return end local oldstate = cd.hideText - cd.hideText = (not E.db.cooldown.targetAura) or (button.chargeCooldown and not button.chargeCooldown.hideText) or (button.cooldown and button.cooldown.currentCooldownType == COOLDOWN_TYPE_LOSS_OF_CONTROL) or (duration and duration > 1.5) or nil + cd.hideText = (not E.db.cooldown.targetAura) or (button.chargeCooldown and not button.chargeCooldown.hideText) or (button.cooldown and button.cooldown.currentCooldownType == COOLDOWN_TYPE_LOSS_OF_CONTROL) or (not E.Midnight and duration and duration > 1.5) or nil + if cd.timer and (oldstate ~= cd.hideText) then E:ToggleBlizzardCooldownText(cd, cd.timer) E:Cooldown_TimerUpdate(cd.timer) @@ -1718,7 +1726,9 @@ function AB:LAB_FlyoutCreated(btn) end function AB:LAB_ChargeCreated(_, cd) - E:RegisterCooldown(cd, 'actionbar') + if not E.Midnight then + E:RegisterCooldown(cd, 'actionbar') + end end function AB:LAB_MouseUp() diff --git a/ElvUI/Core/Modules/ActionBars/MicroBar.lua b/ElvUI/Core/Modules/ActionBars/MicroBar.lua index a90deb9071..8e4ae8a7fa 100644 --- a/ElvUI/Core/Modules/ActionBars/MicroBar.lua +++ b/ElvUI/Core/Modules/ActionBars/MicroBar.lua @@ -473,8 +473,9 @@ function AB:SetupMicroBar() if _G.ResetMicroMenuPosition then _G.ResetMicroMenuPosition() - else + elseif _G.UpdateMicroButtonsParent then _G.UpdateMicroButtonsParent(microBar) + AB:SecureHook('UpdateMicroButtonsParent') end diff --git a/ElvUI/Core/Modules/Auras/Auras.lua b/ElvUI/Core/Modules/Auras/Auras.lua index 1d2781a720..4d4c684860 100644 --- a/ElvUI/Core/Modules/Auras/Auras.lua +++ b/ElvUI/Core/Modules/Auras/Auras.lua @@ -304,21 +304,20 @@ function A:UpdateAura(button, index) local db = A.db[button.auraType] button.text:SetShown(db.showDuration) button.statusBar:SetShown((db.barShow and duration > 0) or (db.barShow and db.barNoDuration and duration == 0)) - button.count:SetText(not count or count <= 1 and '' or count) button.texture:SetTexture(icon) - local dtype = debuffType or 'none' - if button.debuffType ~= dtype then - local color = (button.filter == 'HARMFUL' and A.db.colorDebuffs and DebuffColors[dtype]) or E.db.general.bordercolor - button:SetBackdropBorderColor(color.r, color.g, color.b) - button.statusBar.backdrop:SetBackdropBorderColor(color.r, color.g, color.b) - button.debuffType = dtype - end + button.count:SetText(not count and '' or (not E.Midnight and count <= 1 and '') or count) - if duration > 0 and expiration then - A:SetAuraTime(button, expiration, duration, modRate) - else - A:ClearAuraTime(button) + local color = (button.filter == 'HARMFUL' and A.db.colorDebuffs and DebuffColors[debuffType or 'none']) or E.db.general.bordercolor + button:SetBackdropBorderColor(color.r, color.g, color.b) + button.statusBar.backdrop:SetBackdropBorderColor(color.r, color.g, color.b) + + if not E.Midnight then + if duration > 0 and expiration then + A:SetAuraTime(button, expiration, duration, modRate) + else + A:ClearAuraTime(button) + end end end @@ -336,9 +335,11 @@ function A:UpdateTempEnchant(button, index, expiration) button:SetBackdropBorderColor(r, g, b) button.statusBar.backdrop:SetBackdropBorderColor(r, g, b) - local remaining = (expiration * 0.001) or 0 - A:SetAuraTime(button, remaining + GetTime(), (remaining <= 3600 and remaining > 1800) and 3600 or (remaining <= 1800 and remaining > 600) and 1800 or 600) - else + if not E.Midnight then + local remaining = (expiration * 0.001) or 0 + A:SetAuraTime(button, remaining + GetTime(), (remaining <= 3600 and remaining > 1800) and 3600 or (remaining <= 1800 and remaining > 600) and 1800 or 600) + end + elseif not E.Midnight then A:ClearAuraTime(button) end end diff --git a/ElvUI/Core/Modules/Chat/Chat.lua b/ElvUI/Core/Modules/Chat/Chat.lua index 4625c1c9db..3b319208a0 100644 --- a/ElvUI/Core/Modules/Chat/Chat.lua +++ b/ElvUI/Core/Modules/Chat/Chat.lua @@ -5,6 +5,7 @@ local S = E:GetModule('Skins') local LSM = E.Libs.LSM local _G = _G +local issecretvalue = issecretvalue local issecurevariable = issecurevariable local gsub, strfind, gmatch, format = gsub, strfind, gmatch, format local ipairs, sort, wipe, time, difftime = ipairs, sort, wipe, time, difftime @@ -19,7 +20,6 @@ local BNGetNumFriends = BNGetNumFriends local CreateFrame = CreateFrame local FlashClientIcon = FlashClientIcon local GetBNPlayerCommunityLink = GetBNPlayerCommunityLink -local GetBNPlayerLink = GetBNPlayerLink local GetChannelName = GetChannelName local GetChatWindowInfo = GetChatWindowInfo local GetCursorPosition = GetCursorPosition @@ -28,7 +28,6 @@ local GetInstanceInfo = GetInstanceInfo local GetNumGroupMembers = GetNumGroupMembers local GetPlayerCommunityLink = GetPlayerCommunityLink local GetPlayerInfoByGUID = GetPlayerInfoByGUID -local GetPlayerLink = GetPlayerLink local GetRaidRosterInfo = GetRaidRosterInfo local GMChatFrame_IsGM = GMChatFrame_IsGM local GMError = GMError @@ -60,7 +59,6 @@ local C_VoiceChat_GetMemberName = C_VoiceChat.GetMemberName local C_VoiceChat_SetPortraitTexture = C_VoiceChat.SetPortraitTexture local PanelTemplates_TabResize = PanelTemplates_TabResize - local BNET_CLIENT_WOW = BNET_CLIENT_WOW local LFG_LIST_AND_MORE = LFG_LIST_AND_MORE local UNKNOWN = UNKNOWN @@ -173,11 +171,82 @@ local historyTypes = { -- most of these events are set in FindURL_Events, this i CHAT_MSG_EMOTE = 'EMOTE' -- this never worked, check it sometime } +do + local accessIndex = 1 + local accessInfo = {} -- keyed by token + local accessType = {} -- indexed + local accessTarget = {} -- indexed + local accessSender = {} -- indexed + + local function GetToken(chatType, chatTarget, chanSender) -- ChatHistory_GetToken + local target = chatTarget and strlower(chatTarget) or '' + local sender = (not issecretvalue or not issecretvalue(chanSender)) and chanSender and strlower(chanSender) or '' + + return format('%s;;%s;;%s', strlower(chatType), target, sender) + end + + function CH:GetAccessID(chatType, chatTarget, chanSender) -- ChatHistory_GetAccessID + local token = GetToken(chatType, chatTarget, chanSender) + if not accessInfo[token] then + accessInfo[token] = accessIndex + + accessType[accessIndex] = chatType + accessTarget[accessIndex] = chatTarget + accessSender[accessIndex] = chanSender + + accessIndex = accessIndex + 1 + end + + return accessInfo[token] + end + + function CH:GetAccessType(accessID) -- ChatHistory_GetChatType + return accessType[accessID], accessTarget[accessID], accessSender[accessID] + end + + function CH:GetAllAccessIDsByChanSender(chanSender) -- ChatHistory_GetAllAccessIDsByChanSender + local senders = {} + + for accessID, sender in next, accessSender do + if strlower(sender) == strlower(chanSender) then + senders[#senders + 1] = accessID + end + end + + return senders + end +end + +do + local function GetLink(linkType, displayText, ...) + local text = '' + for i, value in next, { ... } do + text = text .. (i == 1 and format('|H%s:', linkType) or ':') .. value + end + + return text .. (displayText and format('|h%s|h', displayText) or '|h') + end + + function CH:GetPlayerLink(characterName, displayText, lineID, chatType, chatTarget) + if lineID or chatType or chatTarget then + return GetLink(_G.LinkTypes.Player, displayText, characterName, lineID or 0, chatType or 0, (not issecretvalue or not issecretvalue(chatTarget)) and chatTarget or '') + else + return GetLink(_G.LinkTypes.Player, displayText, characterName) + end + end + + function CH:GetBNPlayerLink(name, displayText, bnetIDAccount, lineID, chatType, chatTarget) + return GetLink(_G.LinkTypes.BNPlayer, displayText, name, bnetIDAccount, lineID or 0, chatType, chatTarget) + end +end + local canChangeMessage = function(arg1, id) if id and arg1 == '' then return id end end function CH:MessageIsProtected(message) + if issecretvalue and issecretvalue(message) then return true end + return message and (message ~= gsub(message, '(:?|?)|K(.-)|k', canChangeMessage)) end @@ -259,7 +328,11 @@ do --this can save some main file locals specialChatIcons = z local portal = GetCVar('portal') - if portal == 'US' then + if portal == 'test' then + if E.Midnight then + z['Player-970-00D0DE2E'] = itsSimpy + end + elseif portal == 'US' then if E.Classic then -- Simpy Seasonal (5813: Wild Growth) z['Player-5813-0301DEC1'] = itsSimpy -- Warlock: Yubi @@ -746,6 +819,32 @@ do -- this fixes a taint when you push tab on editbox which blocks secure comman end end +function CH:ChatEdit_UpdateHeader(editbox) + local chatType = editbox:GetAttribute('chatType') + if not chatType then return end + + local ChatTypeInfo = _G.ChatTypeInfo + local info = ChatTypeInfo[chatType] + local chanTarget = editbox:GetAttribute('channelTarget') + local chanIndex = chanTarget and GetChannelName(chanTarget) + + --Increase inset on right side to make room for character count text + local insetLeft, insetRight, insetTop, insetBottom = editbox:GetTextInsets() + editbox:SetTextInsets(insetLeft, insetRight + 30, insetTop, insetBottom) + editbox:SetTemplate(nil, true) + + if chanIndex and (chatType == 'CHANNEL') then + if chanIndex == 0 then + editbox:SetBackdropBorderColor(unpack(E.media.bordercolor)) + else + info = ChatTypeInfo[chatType..chanIndex] + editbox:SetBackdropBorderColor(info.r, info.g, info.b) + end + else + editbox:SetBackdropBorderColor(info.r, info.g, info.b) + end +end + function CH:EditBoxOnKeyDown(key) --Work around broken SetAltArrowKeyMode API. Code from Prat and modified by Simpy if (not self.historyLines) or #self.historyLines == 0 then @@ -907,11 +1006,10 @@ function CH:StyleChat(frame) tab.conversationIcon:Point('RIGHT', tab.Text, 'LEFT', -1, 0) end - if E.Retail then -- wtf is this lol - local a, b, c = select(6, editbox:GetRegions()) - a:Kill() - b:Kill() - c:Kill() + if E.Retail then + editbox.focusLeft:SetAlpha(0) + editbox.focusRight:SetAlpha(0) + editbox.focusMid:SetAlpha(0) end -- stuff to hide @@ -956,7 +1054,25 @@ function CH:StyleChat(frame) editbox:AddHistoryLine(text) end]] - CH:SecureHook(editbox, 'AddHistoryLine', 'ChatEdit_AddHistory') + if editbox.AddHistoryLine then + CH:SecureHook(editbox, 'AddHistoryLine', 'ChatEdit_AddHistory') + end + + if editbox.OnEnterPressed then + CH:SecureHook(editbox, 'OnEnterPressed', 'ChatEdit_OnEnterPressed') + end + + if editbox.UpdateHeader then + CH:SecureHook(editbox, 'UpdateHeader', 'ChatEdit_UpdateHeader') + end + + if editbox.OnShow then + CH:SecureHook(editbox, 'OnShow', 'ChatEdit_PleaseUntaint') + end + + if editbox.OnHide then + CH:SecureHook(editbox, 'OnHide', 'ChatEdit_PleaseRetaint') + end --copy chat button local copyButton = CreateFrame('Frame', format('ElvUI_CopyChatButton%d', id), frame) @@ -981,30 +1097,33 @@ function CH:StyleChat(frame) end function CH:AddMessageEdits(frame, msg, isHistory, historyTime) - if not strmatch(msg, '^%s*$') and not strmatch(msg, '^|Helvtime|h') and not strmatch(msg, '^|Hcpl:') then - local historyTimestamp -- we need to extend the arguments on AddMessage so we can properly handle times without overriding - if isHistory == 'ElvUI_ChatHistory' then historyTimestamp = historyTime end - - if CH.db.timeStampFormat and CH.db.timeStampFormat ~= 'NONE' then - local timeStamp = BetterDate(CH.db.timeStampFormat, historyTimestamp or E:GetDateTime(CH.db.timeStampLocalTime, true)) - timeStamp = gsub(timeStamp, ' ', '') - timeStamp = gsub(timeStamp, 'AM', ' AM') - timeStamp = gsub(timeStamp, 'PM', ' PM') - - if CH.db.useCustomTimeColor then - local color = CH.db.customTimeColor - local hexColor = E:RGBToHex(color.r, color.g, color.b) - msg = format('|Helvtime|h%s[%s]|r|h %s', hexColor, timeStamp, msg) - else - msg = format('|Helvtime|h[%s]|h %s', timeStamp, msg) - end - end + local isProtected = CH:MessageIsProtected(msg) + if not isProtected and (strmatch(msg, '^%s*$') or strmatch(msg, '^|Helvtime|h') or strmatch(msg, '^|Hcpl:')) then + return msg + end + + local historyTimestamp -- we need to extend the arguments on AddMessage so we can properly handle times without overriding + if isHistory == 'ElvUI_ChatHistory' then historyTimestamp = historyTime end - if CH.db.copyChatLines then - msg = format('|Hcpl:%s|h%s|h %s', frame:GetID(), E:TextureString(E.Media.Textures.ArrowRight, ':14'), msg) + if CH.db.timeStampFormat and CH.db.timeStampFormat ~= 'NONE' then + local timeStamp = BetterDate(CH.db.timeStampFormat, historyTimestamp or E:GetDateTime(CH.db.timeStampLocalTime, true)) + timeStamp = gsub(timeStamp, ' ', '') + timeStamp = gsub(timeStamp, 'AM', ' AM') + timeStamp = gsub(timeStamp, 'PM', ' PM') + + if CH.db.useCustomTimeColor then + local color = CH.db.customTimeColor + local hexColor = E:RGBToHex(color.r, color.g, color.b) + msg = format('|Helvtime|h%s[%s]|r|h %s', hexColor, timeStamp, msg) + else + msg = format('|Helvtime|h[%s]|h %s', timeStamp, msg) end end + if CH.db.copyChatLines then + msg = format('|Hcpl:%s|h%s|h %s', frame:GetID(), E:TextureString(E.Media.Textures.ArrowRight, ':14'), msg) + end + return msg end @@ -1711,6 +1830,7 @@ function CH:HandleShortChannels(msg, hide) msg = gsub(msg, '<'.._G.AFK..'>', '[|cffFF9900'..L["AFK"]..'|r] ') msg = gsub(msg, '<'.._G.DND..'>', '[|cffFF3333'..L["DND"]..'|r] ') msg = gsub(msg, '^%['.._G.RAID_WARNING..'%]', '['..L["RW"]..']') + return msg end @@ -1779,6 +1899,10 @@ end function CH:GetColoredName(event, _, arg2, _, _, _, _, _, arg8, _, _, _, arg12) if not arg2 then return end -- guild deaths is called here with no arg2 + if issecretvalue and issecretvalue(arg2) then + return arg2 + end + local chatType = strsub(event, 10) local subType = strsub(chatType, 1, 7) if subType == 'WHISPER' then @@ -1791,9 +1915,9 @@ function CH:GetColoredName(event, _, arg2, _, _, _, _, _, arg8, _, _, _, arg12) local name = Ambiguate(arg2, (chatType == 'GUILD' and 'guild') or 'none') -- handle the class color + local ShouldColorChatByClass = _G.ChatFrameUtil and _G.ChatFrameUtil.ShouldColorChatByClass or _G.Chat_ShouldColorChatByClass local info = name and arg12 and _G.ChatTypeInfo[chatType] - local v = E.Midnight and ChatFrameUtil.ShouldColorChatByClass(info) or _G.Chat_ShouldColorChatByClass(info) - if info and v then + if info and ShouldColorChatByClass(info) then local data = CH:GetPlayerInfoByGUID(arg12) local color = data and data.classColor if color then @@ -1860,7 +1984,7 @@ function CH:GetPFlag(specialFlag, zoneChannelID, unitGUID) end end - if E.Retail and unitGUID then + if E.Retail and unitGUID and (not issecretvalue or not issecretvalue(unitGUID)) then if CH.db.timerunningIcon and IsTimerunningPlayer(unitGUID) then flag = flag .. TIMERUNNING_SMALL end @@ -1903,11 +2027,7 @@ function CH:FCFManager_GetChatTarget(chatGroup, playerTarget, channelTarget) if chatGroup == 'CHANNEL' then chatTarget = tostring(channelTarget) elseif chatGroup == 'WHISPER' or chatGroup == 'BN_WHISPER' then - if strsub(playerTarget, 1, 2) ~= '|K' then - chatTarget = strupper(playerTarget) - else - chatTarget = playerTarget - end + chatTarget = (not issecretvalue or not issecretvalue(playerTarget)) and strsub(playerTarget, 1, 2) ~= '|K' and strupper(playerTarget) or playerTarget end return chatTarget @@ -1930,24 +2050,28 @@ function CH:MessageFormatter(frame, info, chatType, chatGroup, chatTarget, chann return end - local showLink = 1 + local linkSender = true + local isProtected = CH:MessageIsProtected(arg1) local bossMonster = strsub(chatType, 1, 9) == 'RAID_BOSS' or strsub(chatType, 1, 7) == 'MONSTER' if bossMonster then - showLink = nil + linkSender = nil -- fix blizzard formatting errors from localization strings - arg1 = gsub(arg1, '(%d%s?%%)([^%%%a])', '%1%%%2') -- escape percentages that need it [broken since SL?] - arg1 = gsub(arg1, '(%d%s?%%)$', '%1%%') -- escape percentages on the end - arg1 = gsub(arg1, '^%%o', '%%s') -- replace %o to %s [broken in cata classic?]: "%o gular zila amanare rukadare." from "Cabal Zealot" - else + if not isProtected then + arg1 = gsub(arg1, '(%d%s?%%)([^%%%a])', '%1%%%2') -- escape percentages that need it [broken since SL?] + arg1 = gsub(arg1, '(%d%s?%%)$', '%1%%') -- escape percentages on the end + arg1 = gsub(arg1, '^%%o', '%%s') -- replace %o to %s [broken in cata classic?]: "%o gular zila amanare rukadare." from "Cabal Zealot" + end + elseif not isProtected then arg1 = gsub(arg1, '%%', '%%%%') -- escape any % characters, as it may otherwise cause an 'invalid option in format' error end - --Remove groups of many spaces - arg1 = RemoveExtraSpaces(arg1) + if not isProtected then + arg1 = RemoveExtraSpaces(arg1) -- Remove groups of many spaces - -- Search for icon links and replace them with texture links. - arg1 = CH:ChatFrame_ReplaceIconAndGroupExpressions(arg1, arg17, not _G.ChatFrame_CanChatGroupPerformExpressionExpansion(chatGroup)) -- If arg17 is true, don't convert to raid icons + -- Search for icon links and replace them with texture links. + arg1 = CH:ChatFrame_ReplaceIconAndGroupExpressions(arg1, arg17, not _G.ChatFrame_CanChatGroupPerformExpressionExpansion(chatGroup)) -- If arg17 is true, don't convert to raid icons + end -- ElvUI: Get class colored name for BattleNet friend if chatType == 'BN_WHISPER' or chatType == 'BN_WHISPER_INFORM' then @@ -1991,24 +2115,22 @@ function CH:MessageFormatter(frame, info, chatType, chatGroup, chatTarget, chann playerLink = playerLinkDisplayText end elseif chatType == 'BN_WHISPER' or chatType == 'BN_WHISPER_INFORM' then - playerLink = GetBNPlayerLink(playerName, playerLinkDisplayText, bnetIDAccount, lineID, chatGroup, chatTarget) + playerLink = CH:GetBNPlayerLink(playerName, playerLinkDisplayText, bnetIDAccount, lineID, chatGroup, chatTarget) else - playerLink = GetPlayerLink(playerName, playerLinkDisplayText, lineID, chatGroup, chatTarget) + playerLink = CH:GetPlayerLink(playerName, playerLinkDisplayText, lineID, chatGroup, chatTarget) end - local message = arg1 - if arg14 then --isMobile - message = _G.ChatFrame_GetMobileEmbeddedTexture(info.r, info.g, info.b)..message - end + local isMobile = arg14 and _G.ChatFrame_GetMobileEmbeddedTexture(info.r, info.g, info.b) + local message = format('%s%s', isMobile or '', arg1) -- Player Flags local pflag = CH:GetPFlag(arg6, arg7, arg12) - if not bossMonster then + if not bossMonster and (not issecretvalue or not issecretvalue(arg12)) then local chatIcon, pluginChatIcon = specialChatIcons[arg12] or specialChatIcons[playerName], CH:GetPluginIcon(arg12, playerName) if type(chatIcon) == 'function' then local icon, prettify, var1, var2, var3 = chatIcon() - if prettify and chatType ~= 'GUILD_ITEM_LOOTED' and not CH:MessageIsProtected(message) then - if chatType == 'TEXT_EMOTE' and not usingDifferentLanguage and (showLink and arg2 ~= '') then + if prettify and chatType ~= 'GUILD_ITEM_LOOTED' and not isProtected then + if chatType == 'TEXT_EMOTE' and not usingDifferentLanguage and (linkSender and arg2 ~= '') then var1, var2, var3 = strmatch(message, '^(.-)('..arg2..(realm and '%-'..realm or '')..')(.-)$') end @@ -2040,37 +2162,18 @@ function CH:MessageFormatter(frame, info, chatType, chatGroup, chatTarget, chann end end + local senderLink = linkSender and playerLink or arg2 if usingDifferentLanguage then - local languageHeader = '['..arg3..'] ' - if showLink and arg2 ~= '' then - body = format(_G['CHAT_'..chatType..'_GET']..languageHeader..message, pflag..playerLink) - else - body = format(_G['CHAT_'..chatType..'_GET']..languageHeader..message, pflag..arg2) - end + body = format(_G['CHAT_'..chatType..'_GET']..'[%s] %s', pflag..senderLink, arg3, message) -- arg3 is language header + elseif not isProtected and chatType == 'GUILD_ITEM_LOOTED' then + body = gsub(message, '$s', senderLink, 1) + elseif not isProtected and realm and chatType == 'TEXT_EMOTE' then + local classLink = playerLink and (info.colorNameByClass and gsub(playerLink, '(|h|c.-)|r|h$','%1-'..realm..'|r|h') or gsub(playerLink, '(|h.-)|h$','%1-'..realm..'|h')) + body = classLink and gsub(message, arg2..'%-'..realm, pflag..classLink, 1) or message + elseif chatType == 'TEXT_EMOTE' then + body = ((not issecretvalue or not issecretvalue(arg2)) and arg2 ~= senderLink) and gsub(message, arg2, senderLink, 1) or message else - if not showLink or arg2 == '' then - if chatType == 'TEXT_EMOTE' then - body = message - else - body = format(_G['CHAT_'..chatType..'_GET']..message, pflag..arg2, arg2) - end - else - if chatType == 'EMOTE' then - body = format(_G['CHAT_'..chatType..'_GET']..message, pflag..playerLink) - elseif chatType == 'TEXT_EMOTE' and realm then - if info.colorNameByClass then - body = gsub(message, arg2..'%-'..realm, pflag..gsub(playerLink, '(|h|c.-)|r|h$','%1-'..realm..'|r|h'), 1) - else - body = gsub(message, arg2..'%-'..realm, pflag..gsub(playerLink, '(|h.-)|h$','%1-'..realm..'|h'), 1) - end - elseif chatType == 'TEXT_EMOTE' then - body = gsub(message, arg2, pflag..playerLink, 1) - elseif chatType == 'GUILD_ITEM_LOOTED' then - body = gsub(message, '$s', pflag..playerLink, 1) - else - body = format(_G['CHAT_'..chatType..'_GET']..message, pflag..playerLink) - end - end + body = format(_G['CHAT_'..chatType..'_GET'] .. '%s', senderLink, message) end -- Add Channel @@ -2078,7 +2181,7 @@ function CH:MessageFormatter(frame, info, chatType, chatGroup, chatTarget, chann body = '|Hchannel:channel:'..arg8..'|h['.._G.ChatFrame_ResolvePrefixedChannelName(arg4)..']|h '..body end - if (chatType ~= 'EMOTE' and chatType ~= 'TEXT_EMOTE') and (CH.db.shortChannels or CH.db.hideChannels) then + if not isProtected and (chatType ~= 'EMOTE' and chatType ~= 'TEXT_EMOTE') and (CH.db.shortChannels or CH.db.hideChannels) then body = CH:HandleShortChannels(body, CH.db.hideChannels) end @@ -2101,6 +2204,8 @@ function CH:ChatFrame_MessageEventHandler(frame, event, arg1, arg2, arg3, arg4, notChatHistory = true end + local isProtected = issecretvalue and issecretvalue(arg2) + if _G.TextToSpeechFrame_MessageEventHandler and notChatHistory then _G.TextToSpeechFrame_MessageEventHandler(frame, event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17) end @@ -2116,14 +2221,23 @@ function CH:ChatFrame_MessageEventHandler(frame, event, arg1, arg2, arg3, arg4, return end - local chatFilters = E.Midnight and ChatFrameUtil.GetMessageEventFilters(event) or _G.ChatFrame_GetMessageEventFilters(event) - if chatFilters then - for _, filterFunc in next, chatFilters do - local filter, new1, new2, new3, new4, new5, new6, new7, new8, new9, new10, new11, new12, new13, new14, new15, new16, new17 = filterFunc(frame, event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17) - if filter then - return true - elseif new1 then - arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17 = new1, new2, new3, new4, new5, new6, new7, new8, new9, new10, new11, new12, new13, new14, new15, new16, new17 + if _G.ChatFrameUtil and _G.ChatFrameUtil.ProcessMessageEventFilters then + local filtered, new1, new2, new3, new4, new5, new6, new7, new8, new9, new10, new11, new12, new13, new14, new15, new16, new17 = _G.ChatFrameUtil.ProcessMessageEventFilters(frame, event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17) + if filtered then + return true + else + arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17 = new1, new2, new3, new4, new5, new6, new7, new8, new9, new10, new11, new12, new13, new14, new15, new16, new17 + end + else + local chatFilters = _G.ChatFrame_GetMessageEventFilters(event) + if chatFilters then + for _, filterFunc in next, chatFilters do + local filtered, new1, new2, new3, new4, new5, new6, new7, new8, new9, new10, new11, new12, new13, new14, new15, new16, new17 = filterFunc(frame, event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17) + if filtered then + return true + elseif new1 then + arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17 = new1, new2, new3, new4, new5, new6, new7, new8, new9, new10, new11, new12, new13, new14, new15, new16, new17 + end end end end @@ -2171,7 +2285,9 @@ function CH:ChatFrame_MessageEventHandler(frame, event, arg1, arg2, arg3, arg4, end end - local chatGroup = E.Midnight and ChatFrameUtil.GetChatCategory(chatType) or _G.Chat_GetChatCategory(chatType) + local GetChatCategory = _G.ChatFrameUtil and _G.ChatFrameUtil.GetChatCategory or _G.Chat_GetChatCategory + + local chatGroup = GetChatCategory(chatType) local chatTarget = CH:FCFManager_GetChatTarget(chatGroup, arg2, arg8) if _G.FCFManager_ShouldSuppressMessage(frame, chatGroup, chatTarget) then @@ -2225,9 +2341,9 @@ function CH:ChatFrame_MessageEventHandler(frame, event, arg1, arg2, arg3, arg4, frame:AddMessage(arg1, info.r, info.g, info.b, info.id, nil, nil, nil, nil, nil, isHistory, historyTime) elseif strsub(chatType,1,11) == 'ACHIEVEMENT' then -- Append [Share] hyperlink - frame:AddMessage(format(arg1, GetPlayerLink(arg2, format('[%s]', coloredName))), info.r, info.g, info.b, info.id, nil, nil, nil, nil, nil, isHistory, historyTime) + frame:AddMessage(format(arg1, CH:GetPlayerLink(arg2, format('[%s]', coloredName))), info.r, info.g, info.b, info.id, nil, nil, nil, nil, nil, isHistory, historyTime) elseif strsub(chatType,1,18) == 'GUILD_ACHIEVEMENT' then - frame:AddMessage(format(arg1, GetPlayerLink(arg2, format('[%s]', coloredName))), info.r, info.g, info.b, info.id, nil, nil, nil, nil, nil, isHistory, historyTime) + frame:AddMessage(format(arg1, CH:GetPlayerLink(arg2, format('[%s]', coloredName))), info.r, info.g, info.b, info.id, nil, nil, nil, nil, nil, isHistory, historyTime) elseif chatType == 'PING' then frame:AddMessage(arg1, info.r, info.g, info.b, info.id, nil, nil, nil, nil, nil, isHistory, historyTime) elseif chatType == 'IGNORED' then @@ -2263,8 +2379,8 @@ function CH:ChatFrame_MessageEventHandler(frame, event, arg1, arg2, arg3, arg4, frame:AddMessage(_G.CHAT_MSG_BLOCK_CHAT_CHANNEL_INVITE, info.r, info.g, info.b, info.id, nil, nil, nil, nil, nil, isHistory, historyTime) end elseif chatType == 'CHANNEL_NOTICE' then - local accessID = _G.ChatHistory_GetAccessID(chatGroup, arg8) - local typeID = _G.ChatHistory_GetAccessID(infoType, arg8, arg12) + local accessID = CH:GetAccessID(chatGroup, arg8) + local typeID = CH:GetAccessID(infoType, arg8, arg12) if E.Retail and arg1 == 'YOU_CHANGED' and GetChannelRuleset(arg8) == CHATCHANNELRULESET_MENTOR then _G.ChatFrame_UpdateDefaultChatTarget(frame) @@ -2313,7 +2429,7 @@ function CH:ChatFrame_MessageEventHandler(frame, event, arg1, arg2, arg3, arg4, if success then local charName = _G.BNet_GetValidatedCharacterNameWithClientEmbeddedTexture(gameInfo.characterName, accountInfo.battleTag, texture, 32, 32, 10) local linkDisplayText = format('[%s] (%s)', arg2, charName) - local playerLink = GetBNPlayerLink(arg2, linkDisplayText, arg13, arg11, chatGroup, 0) + local playerLink = CH:GetBNPlayerLink(arg2, linkDisplayText, arg13, arg11, chatGroup, 0) frame:AddMessage(format(globalstring, playerLink), info.r, info.g, info.b, info.id, nil, nil, nil, nil, nil, isHistory, historyTime) if notChatHistory then @@ -2327,17 +2443,17 @@ function CH:ChatFrame_MessageEventHandler(frame, event, arg1, arg2, arg3, arg4, local clientTexture = GetClientTexture(gameInfo.clientProgram, 14) local charName = _G.BNet_GetValidatedCharacterName(gameInfo.characterName, accountInfo.battleTag, gameInfo.clientProgram) or '' local linkDisplayText = format('[%s] (%s%s)', arg2, clientTexture, charName) - local playerLink = GetBNPlayerLink(arg2, linkDisplayText, arg13, arg11, chatGroup, 0) + local playerLink = CH:GetBNPlayerLink(arg2, linkDisplayText, arg13, arg11, chatGroup, 0) message = format(globalstring, playerLink) end else local linkDisplayText = format('[%s]', arg2) - local playerLink = GetBNPlayerLink(arg2, linkDisplayText, arg13, arg11, chatGroup, 0) + local playerLink = CH:GetBNPlayerLink(arg2, linkDisplayText, arg13, arg11, chatGroup, 0) message = format(globalstring, playerLink) end else local linkDisplayText = format('[%s]', arg2) - local playerLink = GetBNPlayerLink(arg2, linkDisplayText, arg13, arg11, chatGroup, 0) + local playerLink = CH:GetBNPlayerLink(arg2, linkDisplayText, arg13, arg11, chatGroup, 0) message = format(globalstring, playerLink) end @@ -2346,7 +2462,7 @@ function CH:ChatFrame_MessageEventHandler(frame, event, arg1, arg2, arg3, arg4, if arg1 ~= '' then arg1 = RemoveNewlines(RemoveExtraSpaces(arg1)) local linkDisplayText = format('[%s]', arg2) - local playerLink = GetBNPlayerLink(arg2, linkDisplayText, arg13, arg11, chatGroup, 0) + local playerLink = CH:GetBNPlayerLink(arg2, linkDisplayText, arg13, arg11, chatGroup, 0) frame:AddMessage(format(_G.BN_INLINE_TOAST_BROADCAST, playerLink, arg1), info.r, info.g, info.b, info.id, nil, nil, nil, nil, nil, isHistory, historyTime) end elseif chatType == 'BN_INLINE_TOAST_BROADCAST_INFORM' then @@ -2357,9 +2473,10 @@ function CH:ChatFrame_MessageEventHandler(frame, event, arg1, arg2, arg3, arg4, -- The message formatter is captured so that the original message can be reformatted when a censored message -- is approved to be shown. We only need to pack the event args if the line was censored, as the message transformation -- step is the only code that needs these arguments. See ItemRef.lua "censoredmessage". - local isChatLineCensored, eventArgs, msgFormatter = IsChatLineCensored + local isChatLineCensored, eventArgs, msgFormatter = IsChatLineCensored and IsChatLineCensored(arg11) -- arg11: lineID if isChatLineCensored then eventArgs = _G.SafePack(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17) + msgFormatter = function(msg) -- to translate the message on click [Show Message] local body = CH:MessageFormatter(frame, info, chatType, chatGroup, chatTarget, channelLength, coloredName, historySavedName, msg, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, isHistory, historyTime, historyName, historyBTag) return CH:AddMessageEdits(frame, body, isHistory, historyTime) @@ -2368,22 +2485,28 @@ function CH:ChatFrame_MessageEventHandler(frame, event, arg1, arg2, arg3, arg4, -- beep boops local historyType = notChatHistory and not CH.SoundTimer and not strfind(event, '_INFORM') and historyTypes[event] + local alertAllow = isProtected or arg2 ~= PLAYER_NAME local alertType = (historyType ~= 'CHANNEL' and CH.db.channelAlerts[historyType]) or (historyType == 'CHANNEL' and CH.db.channelAlerts.CHANNEL[arg9]) - if alertType and alertType ~= 'None' and arg2 ~= PLAYER_NAME and (not CH.db.noAlertInCombat or not InCombatLockdown()) then + if alertType and alertType ~= 'None' and alertAllow and (not CH.db.noAlertInCombat or not InCombatLockdown()) then CH.SoundTimer = E:Delay(5, CH.ThrottleSound) PlaySoundFile(LSM:Fetch('sound', alertType), 'Master') end - local accessID = _G.ChatHistory_GetAccessID(chatGroup, chatTarget) - local typeID = _G.ChatHistory_GetAccessID(infoType, chatTarget, arg12 or arg13) + local accessID = CH:GetAccessID(chatGroup, chatTarget) + local typeID = CH:GetAccessID(infoType, chatTarget, arg12 or arg13) local body = isChatLineCensored and arg1 or CH:MessageFormatter(frame, info, chatType, chatGroup, chatTarget, channelLength, coloredName, historySavedName, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, isHistory, historyTime, historyName, historyBTag) frame:AddMessage(body, info.r, info.g, info.b, info.id, accessID, typeID, event, eventArgs, msgFormatter, isHistory, historyTime) end if notChatHistory and (chatType == 'WHISPER' or chatType == 'BN_WHISPER') then - _G.ChatEdit_SetLastTellTarget(arg2, chatType) - if CH.db.flashClientIcon then FlashClientIcon() end + if not isProtected then + _G.ChatEdit_SetLastTellTarget(arg2, chatType) + end + + if CH.db.flashClientIcon then + FlashClientIcon() + end end if notChatHistory then @@ -2401,28 +2524,28 @@ function CH:ChatFrame_MessageEventHandler(frame, event, arg1, arg2, arg3, arg4, end end -local ConfigEventHandler = E.Midnight and ChatFrameMixin.ConfigEventHandler or ConfigEventHandler function CH:ChatFrame_ConfigEventHandler(...) + local ConfigEventHandler = _G.ChatFrameMixin and _G.ChatFrameMixin.ConfigEventHandler or _G.ChatFrame_ConfigEventHandler return ConfigEventHandler(...) end -local SystemEventHandler = E.Midnight and ChatFrameMixin.SystemEventHandler or SystemEventHandler -function CH:ChatFrame_SystemEventHandler(frame, event, message, ...) - return SystemEventHandler(frame, event, message, ...) +function CH:ChatFrame_SystemEventHandler(...) + local SystemEventHandler = _G.ChatFrameMixin and _G.ChatFrameMixin.SystemEventHandler or _G.ChatFrame_SystemEventHandler + return SystemEventHandler(...) end -function CH:ChatFrame_OnEvent(frame, event, ...) - if frame.customEventHandler and frame.customEventHandler(frame, event, ...) then return end - if CH:ChatFrame_ConfigEventHandler(frame, event, ...) then return end - if CH:ChatFrame_SystemEventHandler(frame, event, ...) then return end - if CH:ChatFrame_MessageEventHandler(frame, event, ...) then return end +function CH:ChatFrame_OnEvent(frame, ...) + if frame.customEventHandler and frame:customEventHandler(...) then return end + + if CH:ChatFrame_ConfigEventHandler(frame, ...) then return end + if CH:ChatFrame_SystemEventHandler(frame, ...) then return end + if CH:ChatFrame_MessageEventHandler(frame, ...) then return end end function CH:FloatingChatFrame_OnEvent(...) - if E.Midnight then - ChatFrameMixin.OnEvent(...) - else - CH:ChatFrame_OnEvent(...) + CH:ChatFrame_OnEvent(...) + + if _G.FloatingChatFrame_OnEvent then _G.FloatingChatFrame_OnEvent(...) end end @@ -2557,30 +2680,32 @@ function CH:SetupChat() end local function PrepareMessage(author, message) - if author and author ~= '' and message and message ~= '' then + if issecretvalue and (issecretvalue(author) or issecretvalue(message)) then return end + + if author and author ~= '' and author ~= PLAYER_NAME and message and message ~= '' then return strupper(author) .. message end end function CH:ChatThrottleHandler(arg1, arg2, when) local msg = PrepareMessage(arg1, arg2) - if msg then - for message, object in pairs(throttle) do - if difftime(when, object.time) >= CH.db.throttleInterval then - throttle[message] = nil - end - end + if not msg then return end - if not throttle[msg] then - throttle[msg] = {time = time(), count = 1} - else - throttle[msg].count = throttle[msg].count + 1 + for message, object in pairs(throttle) do + if difftime(when, object.time) >= CH.db.throttleInterval then + throttle[message] = nil end end + + if not throttle[msg] then + throttle[msg] = { time = time(), count = 1 } + else + throttle[msg].count = throttle[msg].count + 1 + end end function CH:ChatThrottleBlockFlag(author, message, when) - local msg = (author ~= PLAYER_NAME) and (CH.db.throttleInterval ~= 0) and PrepareMessage(author, message) + local msg = CH.db.throttleInterval ~= 0 and PrepareMessage(author, message) local object = msg and throttle[msg] return object and object.time and object.count and object.count > 1 and (difftime(when, object.time) <= CH.db.throttleInterval), object @@ -3664,6 +3789,8 @@ function CH:SetChatHeadOrientation(position) end function CH:GetPlayerInfoByGUID(guid) + if issecretvalue and issecretvalue(guid) then return end + local data = CH.GuidCache[guid] if not data then local ok, localizedClass, englishClass, localizedRace, englishRace, sex, name, realm = pcall(GetPlayerInfoByGUID, guid) @@ -3858,7 +3985,6 @@ function CH:Initialize() CH:SecureHook('ChatEdit_ActivateChat') CH:SecureHook('ChatEdit_DeactivateChat') - CH:SecureHook('ChatEdit_OnEnterPressed') CH:SecureHook('ChatEdit_SetLastActiveWindow') CH:SecureHook('FCFTab_UpdateColors') CH:SecureHook('FCFDock_SelectWindow') @@ -3872,12 +3998,26 @@ function CH:Initialize() CH:SecureHook('FCF_SetChatWindowFontSize', 'SetChatFont') CH:SecureHook('FCF_UnDockFrame', 'SnappingChanged') CH:SecureHook('RedockChatWindows', 'ClearSnapping') - CH:SecureHook('ChatEdit_OnShow', 'ChatEdit_PleaseUntaint') - CH:SecureHook('ChatEdit_OnHide', 'ChatEdit_PleaseRetaint') CH:SecureHook('FCFDockOverflowButton_UpdatePulseState') CH:SecureHook('UIDropDownMenu_AddButton') CH:SecureHook('GetPlayerInfoByGUID') + if _G.ChatEdit_OnEnterPressed then + CH:SecureHook('ChatEdit_OnEnterPressed') + end + + if _G.ChatEdit_OnShow then + CH:SecureHook('ChatEdit_OnShow', 'ChatEdit_PleaseUntaint') + end + + if _G.ChatEdit_OnHide then + CH:SecureHook('ChatEdit_OnHide', 'ChatEdit_PleaseRetaint') + end + + if _G.ChatEdit_UpdateHeader then + CH:SecureHook('ChatEdit_UpdateHeader', 'ChatEdit_UpdateHeader') + end + CH:RegisterEvent('UPDATE_CHAT_WINDOWS', 'SetupChat') CH:RegisterEvent('UPDATE_FLOATING_CHAT_WINDOWS', 'SetupChat') CH:RegisterEvent('GROUP_ROSTER_UPDATE', 'CheckLFGRoles') @@ -3920,33 +4060,6 @@ function CH:Initialize() if CH.db.chatHistory then CH:DisplayChatHistory() end - -- Editbox Backdrop Color - hooksecurefunc('ChatEdit_UpdateHeader', function(editbox) - local chatType = editbox:GetAttribute('chatType') - if not chatType then return end - - local ChatTypeInfo = _G.ChatTypeInfo - local info = ChatTypeInfo[chatType] - local chanTarget = editbox:GetAttribute('channelTarget') - local chanIndex = chanTarget and GetChannelName(chanTarget) - - --Increase inset on right side to make room for character count text - local insetLeft, insetRight, insetTop, insetBottom = editbox:GetTextInsets() - editbox:SetTextInsets(insetLeft, insetRight + 30, insetTop, insetBottom) - editbox:SetTemplate(nil, true) - - if chanIndex and (chatType == 'CHANNEL') then - if chanIndex == 0 then - editbox:SetBackdropBorderColor(unpack(E.media.bordercolor)) - else - info = ChatTypeInfo[chatType..chanIndex] - editbox:SetBackdropBorderColor(info.r, info.g, info.b) - end - else - editbox:SetBackdropBorderColor(info.r, info.g, info.b) - end - end) - --Chat Heads Frame CH.ChatHeadFrame = CreateFrame('Frame', 'ElvUIChatHeadFrame', E.UIParent) CH.ChatHeadFrame:Point('TOPLEFT', E.UIParent, 'TOPLEFT', 368, -210) diff --git a/ElvUI/Core/Modules/DataTexts/Friends.lua b/ElvUI/Core/Modules/DataTexts/Friends.lua index ad90dbfd10..26b86e9435 100644 --- a/ElvUI/Core/Modules/DataTexts/Friends.lua +++ b/ElvUI/Core/Modules/DataTexts/Friends.lua @@ -2,6 +2,7 @@ local E, L, V, P, G = unpack(ElvUI) local DT = E:GetModule('DataTexts') local _G = _G +local issecretvalue = issecretvalue local ipairs, pairs, select = ipairs, pairs, select local sort, next, wipe, tremove, tinsert = sort, next, wipe, tremove, tinsert local format, gsub, strfind, strjoin, strmatch = format, gsub, strfind, strjoin, strmatch @@ -520,17 +521,18 @@ local function OnEnter() DT.tooltip:Show() end -local function OnEvent(self, event, message) +local function OnEvent(self, event, arg1) local onlineFriends = C_FriendList_GetNumOnlineFriends() local _, numBNetOnline = BNGetNumFriends() isBNOnline = BNConnected() - -- special handler to detect friend coming online or going offline - -- when this is the case, we invalidate our buffered table and update the - -- datatext information + -- special handler to detect friend coming online or going offline when this is the case, + -- we invalidate our buffered table and update the datatext information if event == 'CHAT_MSG_SYSTEM' then - if not (strfind(message, friendOnline) or strfind(message, friendOffline)) then return end + local isSecret = issecretvalue and issecretvalue(arg1) + if isSecret or (not strfind(arg1, friendOnline) and not strfind(arg1, friendOffline)) then return end end + -- force update when showing tooltip dataValid = false diff --git a/ElvUI/Core/Modules/DataTexts/Guild.lua b/ElvUI/Core/Modules/DataTexts/Guild.lua index db6bdb79c9..9f7102b741 100644 --- a/ElvUI/Core/Modules/DataTexts/Guild.lua +++ b/ElvUI/Core/Modules/DataTexts/Guild.lua @@ -2,6 +2,7 @@ local E, L, V, P, G = unpack(ElvUI) local DT = E:GetModule('DataTexts') local _G = _G +local issecretvalue = issecretvalue local ipairs, select, next, sort, unpack, wipe, ceil = ipairs, select, next, sort, unpack, wipe, ceil local format, strfind, strjoin, strsplit, strmatch = format, strfind, strjoin, strsplit, strmatch @@ -161,7 +162,10 @@ local resendRequest = false local eventHandlers = { PLAYER_GUILD_UPDATE = C_GuildInfo_GuildRoster, CHAT_MSG_SYSTEM = function(_, arg1) - if FRIEND_ONLINE ~= nil and arg1 and strfind(arg1, FRIEND_ONLINE) then + if not FRIEND_ONLINE or not arg1 then return end + + local isSecret = issecretvalue and issecretvalue(arg1) + if not isSecret and strfind(arg1, FRIEND_ONLINE) then resendRequest = true end end, diff --git a/ElvUI/Core/Modules/Maps/Minimap.lua b/ElvUI/Core/Modules/Maps/Minimap.lua index 967aa31128..23f78aa635 100644 --- a/ElvUI/Core/Modules/Maps/Minimap.lua +++ b/ElvUI/Core/Modules/Maps/Minimap.lua @@ -747,13 +747,6 @@ function M:Initialize() if E.Retail then MinimapCluster:KillEditMode() - -- Prevents saveLayout in EditMode, TODO - --[[ - if MinimapCluster.systemInfo then -- fix an error when the cluster is moved to the lower part of screen - MinimapCluster.systemInfo.isInDefaultPosition = nil - end - ]] - local clusterHolder = CreateFrame('Frame', 'ElvUI_MinimapClusterHolder', MinimapCluster) clusterHolder.savedWidth, clusterHolder.savedHeight = MinimapCluster:GetSize() clusterHolder:Point('TOPRIGHT', E.UIParent, -3, -3) diff --git a/ElvUI/Core/Modules/Misc/AFK.lua b/ElvUI/Core/Modules/Misc/AFK.lua index 057ce569ab..dc34016aa7 100644 --- a/ElvUI/Core/Modules/Misc/AFK.lua +++ b/ElvUI/Core/Modules/Misc/AFK.lua @@ -4,9 +4,10 @@ local CH = E:GetModule('Chat') local _G = _G local floor = floor -local unpack = unpack local tostring, pcall = tostring, pcall +local unpack, strupper = unpack, strupper local format, strsub, gsub = format, strsub, gsub +local issecretvalue = issecretvalue local CloseAllWindows = CloseAllWindows local CreateFrame = CreateFrame @@ -25,17 +26,8 @@ local UIParent = UIParent local UnitCastingInfo = UnitCastingInfo local UnitIsAFK = UnitIsAFK -local Chat_GetChatCategory = E.Midnight and ChatFrameUtil.GetChatCategory or _G.Chat_GetChatCategory -local ChatHistory_GetAccessID = ChatHistory_GetAccessID -local ChatFrame_GetMobileEmbeddedTexture = ChatFrame_GetMobileEmbeddedTexture - local C_PetBattles_IsInBattle = C_PetBattles and C_PetBattles.IsInBattle -local CinematicFrame = _G.CinematicFrame -local MovieFrame = _G.MovieFrame -local DNDstr = _G.DND -local AFKstr = _G.AFK - local CAMERA_SPEED = 0.035 local DEFAULT_ANIMATION = 'dance' @@ -168,7 +160,7 @@ function AFK:OnEvent(event, arg1) end return - elseif (not E.db.general.afk) or (event == 'PLAYER_FLAGS_CHANGED' and arg1 ~= 'player') or (InCombatLockdown() or CinematicFrame:IsShown() or MovieFrame:IsShown()) then + elseif (not E.db.general.afk) or (event == 'PLAYER_FLAGS_CHANGED' and arg1 ~= 'player') or (InCombatLockdown() or _G.CinematicFrame:IsShown() or _G.MovieFrame:IsShown()) then return elseif UnitCastingInfo('player') then AFK:ScheduleTimer('OnEvent', 30) @@ -194,64 +186,60 @@ function AFK:Chat_OnMouseWheel(delta) end end +function AFK:HandleShortChannels(msg) + msg = gsub(msg, '|Hchannel:(.-)|h%[(.-)%]|h', CH.ShortChannel) + msg = gsub(msg, '^(.-|h) '..L["whispers"], '%1') + msg = gsub(msg, '<'.._G.AFK..'>', '[|cffFF9900'..L["AFK"]..'|r] ') + msg = gsub(msg, '<'.._G.DND..'>', '[|cffFF3333'..L["DND"]..'|r] ') + msg = gsub(msg, '^%['.._G.RAID_WARNING..'%]', '['..L["RW"]..']') + msg = gsub(msg, '%[BN_CONVERSATION:', '%[') + + return msg +end + function AFK:Chat_OnEvent(event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14) - local chatType = strsub(event, 10) - local info = _G.ChatTypeInfo[chatType] + local infoType = strsub(event, 10) + local info = _G.ChatTypeInfo[infoType] - local coloredName - if event == 'CHAT_MSG_BN_WHISPER' then - coloredName = CH:GetBNFriendColor(arg2, arg13) - else - coloredName = CH:GetColoredName(event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14) - end + local GetChatCategory = _G.ChatFrameUtil and _G.ChatFrameUtil.GetChatCategory or _G.Chat_GetChatCategory local chatTarget - local chatGroup = Chat_GetChatCategory(chatType) + local chatGroup = GetChatCategory(infoType) if chatGroup == 'BN_CONVERSATION' then chatTarget = tostring(arg8) elseif chatGroup == 'WHISPER' or chatGroup == 'BN_WHISPER' then - if not(strsub(arg2, 1, 2) == '|K') then - chatTarget = arg2:upper() - else - chatTarget = arg2 - end + chatTarget = (not issecretvalue or not issecretvalue(arg2)) and strsub(arg2, 1, 2) ~= '|K' and strupper(arg2) or arg2 end local playerLink - if chatType ~= 'BN_WHISPER' and chatType ~= 'BN_CONVERSATION' then - playerLink = '|Hplayer:'..arg2..':'..arg11..':'..chatGroup..(chatTarget and ':'..chatTarget or '')..'|h' + local linkTarget = chatTarget and (':'..chatTarget) or '' + if infoType ~= 'BN_WHISPER' and infoType ~= 'BN_CONVERSATION' then + playerLink = format('|Hplayer:%s:%s:%s%s|h', arg2, arg11, chatGroup, linkTarget) else - playerLink = '|HBNplayer:'..arg2..':'..arg13..':'..arg11..':'..chatGroup..(chatTarget and ':'..chatTarget or '')..'|h' + playerLink = format('|HBNplayer:%s:%s:%s:%s%s|h', arg2, arg13, arg11, chatGroup, linkTarget) end - --Escape any % characters, as it may otherwise cause an 'invalid option in format' error - arg1 = gsub(arg1, '%%', '%%%%') - - --Remove groups of many spaces - arg1 = RemoveExtraSpaces(arg1) - - -- isMobile - if arg14 then - arg1 = ChatFrame_GetMobileEmbeddedTexture(info.r, info.g, info.b)..arg1 + local isProtected = CH:MessageIsProtected(arg1) + if not isProtected then + arg1 = gsub(arg1, '%%', '%%%%') -- Escape any % characters, as it may otherwise cause an 'invalid option in format' error + arg1 = RemoveExtraSpaces(arg1) -- Remove groups of many spaces end - local success, body = pcall(format, _G['CHAT_'..chatType..'_GET']..arg1, playerLink..'['..coloredName..']'..'|h') - if not success then - E:Print('An error happened in the AFK Chat module. Please screenshot this message and report it. Info:', chatType, arg1, _G['CHAT_'..chatType..'_GET']) - return - end + local isMobile = arg14 and _G.ChatFrame_GetMobileEmbeddedTexture(info.r, info.g, info.b) + local message = format('%s%s', isMobile or '', arg1) + + local coloredName = (infoType == 'BN_WHISPER' and CH:GetBNFriendColor(arg2, arg13)) or CH:GetColoredName(event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14) + local senderLink = format('%s[%s]|h', playerLink, coloredName) + local success, msg = pcall(format, _G['CHAT_'..infoType..'_GET']..'%s', senderLink, message) + if not success then return end - if CH.db.shortChannels then - body = body:gsub('|Hchannel:(.-)|h%[(.-)%]|h', CH.ShortChannel) - body = body:gsub('^(.-|h) '..L["whispers"], '%1') - body = body:gsub('<'..AFKstr..'>', '[|cffFF9900'..L["AFK"]..'|r] ') - body = body:gsub('<'..DNDstr..'>', '[|cffFF3333'..L["DND"]..'|r] ') - body = body:gsub('%[BN_CONVERSATION:', '%['..'') + if not isProtected and CH.db.shortChannels then + msg = AFK:HandleShortChannels(msg) end - local accessID = ChatHistory_GetAccessID(chatGroup, chatTarget) - local typeID = ChatHistory_GetAccessID(chatType, chatTarget, arg12 == '' and arg13 or arg12) - self:AddMessage(body, info.r, info.g, info.b, info.id, false, accessID, typeID) + local accessID = CH:GetAccessID(chatGroup, chatTarget) + local typeID = CH:GetAccessID(infoType, chatTarget, arg12 or arg13) + self:AddMessage(msg, info.r, info.g, info.b, info.id, false, accessID, typeID) end function AFK:Toggle() diff --git a/ElvUI/Core/Modules/Misc/Loot.lua b/ElvUI/Core/Modules/Misc/Loot.lua index 87a2d1e244..9e13a0cab8 100644 --- a/ElvUI/Core/Modules/Misc/Loot.lua +++ b/ElvUI/Core/Modules/Misc/Loot.lua @@ -333,7 +333,7 @@ function M:LOOT_OPENED(_, autoloot) local r, g, b = E:GetItemQualityColor(max_quality) lootFrame:SetBackdropBorderColor(r, g, b, 0.8) - lootFrame:Width(max(max_width + 60, lootFrame.title:GetStringWidth() + 5)) + lootFrame:Width(max_width + 60) end function M:OPEN_MASTER_LOOT_LIST() @@ -361,10 +361,13 @@ function M:LoadLoot() lootFrame:SetTemplate('Transparent') lootFrame:SetFrameStrata(_G.LootFrame:GetFrameStrata()) lootFrame:SetToplevel(true) + lootFrame.title = lootFrame:CreateFontString(nil, 'OVERLAY') lootFrame.title:FontTemplate(nil, nil, 'OUTLINE') lootFrame.title:Point('BOTTOMLEFT', lootFrame, 'TOPLEFT', 0, 1) + lootFrame.slots = {} + lootFrame:SetScript('OnHide', FrameHide) -- mimic LootFrame_OnHide, mostly E.frames[lootFrame] = nil @@ -377,6 +380,7 @@ function M:LoadLoot() E:CreateMover(lootFrameHolder, 'LootFrameMover', L["Loot Frame"], nil, nil, nil, nil, nil, 'general,blizzardImprovements') _G.LootFrame:UnregisterAllEvents() + tinsert(_G.UISpecialFrames, 'ElvLootFrame') -- fix blizzard setpoint connection bs diff --git a/ElvUI/Core/Modules/Misc/Misc.lua b/ElvUI/Core/Modules/Misc/Misc.lua index c4e8118b7c..c361a3ce19 100644 --- a/ElvUI/Core/Modules/Misc/Misc.lua +++ b/ElvUI/Core/Modules/Misc/Misc.lua @@ -401,11 +401,14 @@ function M:Initialize() M:LoadRaidMarker() M:LoadLootRoll() M:LoadChatBubbles() - M:LoadLoot() M:ToggleItemLevelInfo(true) M:ZoneTextToggle() M:ToggleInterrupt() + if not E.Midnight then + M:LoadLoot() -- tooltip crash out + end + if not E.ClassicAnniv then -- it uses Blizzard_GroupFinder_VanillaStyle M:LoadQueueStatus() end diff --git a/ElvUI/Core/Modules/Misc/TotemTracker.lua b/ElvUI/Core/Modules/Misc/TotemTracker.lua index 8ff4f996b4..417e121bbb 100644 --- a/ElvUI/Core/Modules/Misc/TotemTracker.lua +++ b/ElvUI/Core/Modules/Misc/TotemTracker.lua @@ -9,15 +9,15 @@ local CreateFrame = CreateFrame local GetTotemInfo = GetTotemInfo local MAX_TOTEMS = MAX_TOTEMS -local classic = { [1]=2, [2]=1, [3]=4, [4]=3 } -- we need to swap 1/2 and 3/4 on era +local classic = { 2, 1, 4, 3 } -- we need to swap 1/2 and 3/4 on era function TM:UpdateButton(button, totem) if not (button and totem) then return end - local haveTotem, _, startTime, duration, icon = GetTotemInfo(E.Classic and totem or totem.slot) - button:SetShown(haveTotem and duration > 0) + local _, _, startTime, duration, icon = GetTotemInfo(E.Classic and totem or totem.slot) + button:SetShown(startTime and (E.Midnight or duration > 0)) - if haveTotem then + if startTime then button.icon:SetTexture(icon) button.cooldown:SetCooldown(startTime, duration) @@ -132,7 +132,9 @@ function TM:Initialize() button.cooldown:SetReverse(true) button.cooldown:SetInside() - E:RegisterCooldown(button.cooldown) + if not E.Midnight then + E:RegisterCooldown(button.cooldown) + end TM.bar[i] = button end diff --git a/ElvUI/Core/Modules/Nameplates/Nameplates.lua b/ElvUI/Core/Modules/Nameplates/Nameplates.lua index 89d2c93a46..7833b87835 100644 --- a/ElvUI/Core/Modules/Nameplates/Nameplates.lua +++ b/ElvUI/Core/Modules/Nameplates/Nameplates.lua @@ -653,10 +653,13 @@ function NP:ConfigureAll(init) if not E.private.nameplates.enable then return end NP:StyleFilterConfigure() -- keep this at the top - NP:SetNamePlateClickThrough() - if E.Retail then - NP:SetNamePlateSizes() + if not E.Midnight then + NP:SetNamePlateClickThrough() + + if E.Retail then + NP:SetNamePlateSizes() + end end NP:PLAYER_REGEN_ENABLED() @@ -988,7 +991,11 @@ function NP:Initialize() if E.Retail then NP.SetupClassNameplateBars(_G.NamePlateDriverFrame) - hooksecurefunc(_G.NamePlateDriverFrame, 'UpdateNamePlateOptions', NP.SetNamePlateSizes) + + if not E.Midnight then + hooksecurefunc(_G.NamePlateDriverFrame, 'UpdateNamePlateOptions', NP.SetNamePlateSizes) + end + hooksecurefunc(_G.NamePlateDriverFrame, 'SetupClassNameplateBars', NP.SetupClassNameplateBars) end diff --git a/ElvUI/Core/Modules/Tooltip/Tooltip.lua b/ElvUI/Core/Modules/Tooltip/Tooltip.lua index 2f45e43f64..4eadd3c924 100644 --- a/ElvUI/Core/Modules/Tooltip/Tooltip.lua +++ b/ElvUI/Core/Modules/Tooltip/Tooltip.lua @@ -9,9 +9,10 @@ local AuraInfo = ElvUF.AuraInfo local AuraFiltered = ElvUF.AuraFiltered local _G = _G +local issecretvalue = issecretvalue local unpack, ipairs = unpack, ipairs +local tonumber, strlower = tonumber, strlower local wipe, next, tinsert, tconcat = wipe, next, tinsert, table.concat -local floor, tonumber, strlower = floor, tonumber, strlower local strfind, format, strmatch, gmatch, gsub = strfind, format, strmatch, gmatch, gsub local CanInspect = CanInspect @@ -36,7 +37,6 @@ local IsInRaid = IsInRaid local IsModifierKeyDown = IsModifierKeyDown local IsShiftKeyDown = IsShiftKeyDown local NotifyInspect = NotifyInspect -local SetTooltipMoney = SetTooltipMoney local UIParent = UIParent local UnitBattlePetLevel = UnitBattlePetLevel local UnitBattlePetType = UnitBattlePetType @@ -105,38 +105,36 @@ function TT:IsModKeyDown(db) end function TT:SetCompareItems(tt, value) - if E.Retail and tt == GameTooltip then - tt.supportsItemComparison = value - end + if E.Midnight or not E.Retail or tt ~= GameTooltip then return end + + tt.supportsItemComparison = value end function TT:GameTooltip_SetDefaultAnchor(tt, parent) if not E.private.tooltip.enable or not TT.db.visibility or tt:IsForbidden() or tt:GetAnchorType() ~= 'ANCHOR_NONE' then return elseif (InCombatLockdown() and not TT:IsModKeyDown(TT.db.visibility.combatOverride)) or (not AB.KeyBinder.active and not TT:IsModKeyDown(TT.db.visibility.actionbars) and AB.handledbuttons[tt:GetOwner()]) then - TT:SetCompareItems(tt, false) + TT:SetCompareItems(tt, nil) + tt:Hide() -- during kb mode this will trigger AB.ShowBinds return end TT:SetCompareItems(tt, true) - local statusBar = tt.StatusBar - if statusBar and not E.Midnight then + if GameTooltipStatusBar then local spacing = E.Spacing * 3 local position = TT.db.healthBar.statusPosition - statusBar:SetAlpha(position == 'DISABLED' and 0 or 1) - - if position == 'BOTTOM' and statusBar.anchoredToTop then - statusBar:ClearAllPoints() - statusBar:Point('TOPLEFT', tt, 'BOTTOMLEFT', E.Border, -spacing) - statusBar:Point('TOPRIGHT', tt, 'BOTTOMRIGHT', -E.Border, -spacing) - statusBar.anchoredToTop = nil - elseif position == 'TOP' and not statusBar.anchoredToTop then - statusBar:ClearAllPoints() - statusBar:Point('BOTTOMLEFT', tt, 'TOPLEFT', E.Border, spacing) - statusBar:Point('BOTTOMRIGHT', tt, 'TOPRIGHT', -E.Border, spacing) - statusBar.anchoredToTop = true + GameTooltipStatusBar:SetAlpha(position == 'DISABLED' and 0 or 1) + + if position == 'BOTTOM' then + GameTooltipStatusBar:ClearAllPoints() + GameTooltipStatusBar:Point('TOPLEFT', tt, 'BOTTOMLEFT', E.Border, -spacing) + GameTooltipStatusBar:Point('TOPRIGHT', tt, 'BOTTOMRIGHT', -E.Border, -spacing) + elseif position == 'TOP' then + GameTooltipStatusBar:ClearAllPoints() + GameTooltipStatusBar:Point('BOTTOMLEFT', tt, 'TOPLEFT', E.Border, spacing) + GameTooltipStatusBar:Point('BOTTOMRIGHT', tt, 'TOPRIGHT', -E.Border, spacing) end end @@ -602,24 +600,15 @@ function TT:GameTooltip_OnTooltipSetUnit(data) end end - local statusBar = self.StatusBar if color then - statusBar:SetStatusBarColor(color.r, color.g, color.b) + GameTooltipStatusBar:SetStatusBarColor(color.r, color.g, color.b) else - statusBar:SetStatusBarColor(0.6, 0.6, 0.6) - end - - if statusBar.text then - local textWidth = statusBar.text:GetStringWidth() - if textWidth then - self:SetMinimumWidth(textWidth) - end + GameTooltipStatusBar:SetStatusBarColor(0.6, 0.6, 0.6) end end -function TT:GameTooltipStatusBar_OnValueChanged(tt, value) - if E.Midnight then return end -- TODO - if tt:IsForbidden() or not value or not tt.text or not TT.db.healthBar.text then return end +function TT:GameTooltipStatusBar_OnValueChanged(tt, current) + if tt:IsForbidden() or not current or not tt.text or not TT.db.healthBar.text then return end -- try to get ahold of the unit token local _, unit = tt:GetParent():GetUnit() @@ -631,22 +620,17 @@ function TT:GameTooltipStatusBar_OnValueChanged(tt, value) end -- check if dead - if value == 0 or (unit and UnitIsDeadOrGhost(unit)) then + if unit and UnitIsDeadOrGhost(unit) then tt.text:SetText(_G.DEAD) else - local MAX, _ + local maximum, _ if unit then -- try to get the real health values if possible - value, MAX = UnitHealth(unit), UnitHealthMax(unit) + current, maximum = UnitHealth(unit), UnitHealthMax(unit) else - _, MAX = tt:GetMinMaxValues() + _, maximum = tt:GetMinMaxValues() end - -- return what we got - if value > 0 and MAX == 1 then - tt.text:SetFormattedText('%d%%', floor(value * 100)) - else - tt.text:SetText(E:ShortValue(value)..' / '..E:ShortValue(MAX)) - end + tt.text:SetFormattedText('%d / %d', current or 1, maximum or 1) end end @@ -661,11 +645,7 @@ function TT:GameTooltip_OnTooltipCleared(tt) r, g, b = unpack(E.media.bordercolor) end - if tt.NineSlice then - tt.NineSlice:SetBorderColor(r, g, b) - else - tt:SetBackdropBorderColor(r, g, b) - end + tt:SetBackdropBorderColor(r, g, b) end tt.ItemLevelShown = nil @@ -725,11 +705,8 @@ function TT:GameTooltip_OnTooltipSetItem(data) local quality = GetItemQualityByID(link) if quality and quality > 1 then local r, g, b = E:GetItemQualityColor(quality) - if self.NineSlice then - self.NineSlice:SetBorderColor(r, g, b) - else - self:SetBackdropBorderColor(r, g, b) - end + + self:SetBackdropBorderColor(r, g, b) self.qualityChanged = true end @@ -820,13 +797,19 @@ function TT:GameTooltip_ShowStatusBar(tt) end function TT:SetStyle(tt, _, isEmbedded) - if not tt or (tt == E.ScanTooltip or isEmbedded or tt.IsEmbedded or not tt.NineSlice) or tt:IsForbidden() then return end + if not tt or (tt == E.ScanTooltip or isEmbedded or tt.IsEmbedded) or tt:IsForbidden() then return end if tt.Delimiter1 then tt.Delimiter1:SetTexture() end if tt.Delimiter2 then tt.Delimiter2:SetTexture() end - - tt.NineSlice.customBackdropAlpha = TT.db.colorAlpha - tt.NineSlice:SetTemplate('Transparent') + if tt.NineSlice then tt.NineSlice:SetAlpha(0) end + + -- Blizzard_SharedXML/Backdrop.lua: secrets cause backdrop system to crash out + -- Blizzard_MoneyFrame/Mainline/MoneyFrame.lua: secrets cause `MoneyFrame_Update` to crash out via `GameTooltip:SetLootItem(id)` + -- Blizzard_SharedXML/Tooltip/TooltipComparisonManager.lua: secrets cause comparison system to crash out. use `alwaysCompareItems 0` + if not issecretvalue or not issecretvalue(tt:GetWidth()) then + tt.customBackdropAlpha = TT.db.colorAlpha + tt:SetTemplate('Transparent') + end end function TT:MODIFIER_STATE_CHANGED() @@ -1041,9 +1024,8 @@ end function TT:GameTooltip_Hide() if GameTooltip:IsForbidden() then return end - local statusBar = GameTooltip.StatusBar - if statusBar and statusBar:IsShown() then - statusBar:Hide() + if GameTooltipStatusBar:IsShown() then + GameTooltipStatusBar:Hide() end end @@ -1065,33 +1047,19 @@ function TT:Initialize() if not E.private.tooltip.enable then return end TT.Initialized = true - if not E.Midnight then - local statusBar = GameTooltipStatusBar - statusBar:Height(TT.db.healthBar.height) - statusBar:SetScript('OnValueChanged', nil) -- Do we need to unset this? + GameTooltipStatusBar:Height(TT.db.healthBar.height) - GameTooltip.StatusBar = statusBar + TT:SetTooltipFonts() - local statusText = statusBar:CreateFontString(nil, 'OVERLAY') - statusText:FontTemplate(LSM:Fetch('font', TT.db.healthBar.font), TT.db.healthBar.fontSize, TT.db.healthBar.fontOutline) - statusText:Point('CENTER', statusBar) - statusBar.text = statusText - end + local TooltipAnchor = CreateFrame('Frame', 'ElvUI_TooltipAnchor', E.UIParent) + if TooltipAnchor then + TooltipAnchor:Point('BOTTOMRIGHT', _G.RightChatToggleButton, 'BOTTOMRIGHT') + TooltipAnchor:Size(130, 20) + TooltipAnchor:OffsetFrameLevel(400) - if not GameTooltip.hasMoney then -- Force creation of the money lines, so we can set font for it - SetTooltipMoney(GameTooltip, 1, nil, '', '') - SetTooltipMoney(GameTooltip, 1, nil, '', '') - GameTooltip_ClearMoney(GameTooltip) + E:CreateMover(TooltipAnchor, 'TooltipMover', L["Tooltip"], nil, nil, nil, nil, nil, 'tooltip') end - TT:SetTooltipFonts() - - local GameTooltipAnchor = CreateFrame('Frame', 'GameTooltipAnchor', E.UIParent) - GameTooltipAnchor:Point('BOTTOMRIGHT', _G.RightChatToggleButton, 'BOTTOMRIGHT') - GameTooltipAnchor:Size(130, 20) - GameTooltipAnchor:OffsetFrameLevel(400) - E:CreateMover(GameTooltipAnchor, 'TooltipMover', L["Tooltip"], nil, nil, nil, nil, nil, 'tooltip') - TT:RegisterEvent('MODIFIER_STATE_CHANGED') TT:SecureHook('SetItemRef') @@ -1103,7 +1071,6 @@ function TT:Initialize() TT:SecureHook(GameTooltip, 'SetUnitBuff', 'SetUnitAura') TT:SecureHook(GameTooltip, 'SetUnitDebuff', 'SetUnitAura') TT:SecureHookScript(GameTooltip, 'OnTooltipCleared', 'GameTooltip_OnTooltipCleared') - TT:SecureHookScript(GameTooltip.StatusBar, 'OnValueChanged', 'GameTooltipStatusBar_OnValueChanged') if GameTooltip.SetUnitBuffByAuraInstanceID then -- not yet on Era or Mists TT:SecureHook(GameTooltip, 'SetUnitBuffByAuraInstanceID', 'SetUnitAuraByAuraInstanceID') @@ -1113,8 +1080,11 @@ function TT:Initialize() if AddTooltipPostCall and not E.Mists then -- exists but doesn't work atm on Cata AddTooltipPostCall(TooltipDataType.Spell, TT.GameTooltip_OnTooltipSetSpell) AddTooltipPostCall(TooltipDataType.Macro, TT.GameTooltip_OnTooltipSetSpell) - AddTooltipPostCall(TooltipDataType.Item, TT.GameTooltip_OnTooltipSetItem) - AddTooltipPostCall(TooltipDataType.Unit, TT.GameTooltip_OnTooltipSetUnit) + + if not E.Midnight then -- TODO: secrets cause tooltip processor crashes out + AddTooltipPostCall(TooltipDataType.Item, TT.GameTooltip_OnTooltipSetItem) -- prevents items displaying (compare code) + AddTooltipPostCall(TooltipDataType.Unit, TT.GameTooltip_OnTooltipSetUnit) -- unitname is secrets so it breaks something + end TT:SecureHook(GameTooltip, 'Hide', 'GameTooltip_Hide') -- dont use OnHide use Hide directly else diff --git a/ElvUI/Core/Modules/UnitFrames/UnitFrames.lua b/ElvUI/Core/Modules/UnitFrames/UnitFrames.lua index ad912c3991..7ff0952fcf 100644 --- a/ElvUI/Core/Modules/UnitFrames/UnitFrames.lua +++ b/ElvUI/Core/Modules/UnitFrames/UnitFrames.lua @@ -1583,13 +1583,13 @@ do local SetFrameHidden = {} local DisabledElements = {} local AllowedFuncs = { - [_G.DefaultCompactUnitFrameSetup] = true, - [_G.DefaultCompactNamePlateEnemyFrameSetup] = true, - [_G.DefaultCompactNamePlateFriendlyFrameSetup] = true + [_G.DefaultCompactUnitFrameSetup] = true } - if E.Retail then + if E.Retail and not E.Midnight then AllowedFuncs[_G.DefaultCompactNamePlatePlayerFrameSetup] = true + AllowedFuncs[_G.DefaultCompactNamePlateEnemyFrameSetup] = true + AllowedFuncs[_G.DefaultCompactNamePlateFriendlyFrameSetup] = true end local function FrameShown(frame, shown) @@ -2191,7 +2191,6 @@ function UF:Initialize() UF:RegisterEvent('SOUNDKIT_FINISHED') UF:RegisterEvent('SPELLS_CHANGED', 'UpdateRangeSpells') - UF:RegisterEvent('LEARNED_SPELL_IN_TAB', 'UpdateRangeSpells') UF:RegisterEvent('CHARACTER_POINTS_CHANGED', 'UpdateRangeSpells') if E.Retail or E.Mists then diff --git a/ElvUI/Mainline/Modules/Skins/Collectables.lua b/ElvUI/Mainline/Modules/Skins/Collectables.lua index f9fe39da58..9fdb450b29 100644 --- a/ElvUI/Mainline/Modules/Skins/Collectables.lua +++ b/ElvUI/Mainline/Modules/Skins/Collectables.lua @@ -662,10 +662,10 @@ local function SkinTransmogFrames() local WardrobeTransmogFrame = _G.WardrobeTransmogFrame WardrobeTransmogFrame:StripTextures() - S:HandleButton(WardrobeTransmogFrame.OutfitDropdown.SaveButton) - S:HandleDropDownBox(WardrobeTransmogFrame.OutfitDropdown, 200) - WardrobeTransmogFrame.OutfitDropdown.SaveButton:ClearAllPoints() - WardrobeTransmogFrame.OutfitDropdown.SaveButton:Point('LEFT', WardrobeTransmogFrame.OutfitDropdown, 'RIGHT', 2, 0) + S:HandleButton(WardrobeTransmogFrame.CustomSetDropdown.SaveButton) + S:HandleDropDownBox(WardrobeTransmogFrame.CustomSetDropdown, 200) + WardrobeTransmogFrame.CustomSetDropdown.SaveButton:ClearAllPoints() + WardrobeTransmogFrame.CustomSetDropdown.SaveButton:Point('LEFT', WardrobeTransmogFrame.CustomSetDropdown, 'RIGHT', 2, 0) for i = 1, #WardrobeTransmogFrame.SlotButtons do local slotButton = WardrobeTransmogFrame.SlotButtons[i] @@ -723,15 +723,6 @@ local function SkinTransmogFrames() WardrobeCollectionFrame.SetsTransmogFrame:SetTemplate('Transparent') S:HandleNextPrevButton(WardrobeCollectionFrame.SetsTransmogFrame.PagingFrame.NextPageButton) S:HandleNextPrevButton(WardrobeCollectionFrame.SetsTransmogFrame.PagingFrame.PrevPageButton) - - local WardrobeOutfitEditFrame = _G.WardrobeOutfitEditFrame - WardrobeOutfitEditFrame:StripTextures() - WardrobeOutfitEditFrame:SetTemplate('Transparent') - WardrobeOutfitEditFrame.EditBox:StripTextures() - S:HandleEditBox(WardrobeOutfitEditFrame.EditBox) - S:HandleButton(WardrobeOutfitEditFrame.AcceptButton) - S:HandleButton(WardrobeOutfitEditFrame.CancelButton) - S:HandleButton(WardrobeOutfitEditFrame.DeleteButton) end local function HandleTabs() diff --git a/ElvUI/Mainline/Modules/Skins/DressingRoom.lua b/ElvUI/Mainline/Modules/Skins/DressingRoom.lua index 4e761f72f6..ad90a09299 100644 --- a/ElvUI/Mainline/Modules/Skins/DressingRoom.lua +++ b/ElvUI/Mainline/Modules/Skins/DressingRoom.lua @@ -38,12 +38,18 @@ local function DetailsPanelRefresh(panel) end local function DressUpConfigureSize(frame, isMinimized) - frame.OutfitDetailsPanel:ClearAllPoints() - frame.OutfitDetailsPanel:Point('TOPLEFT', frame, 'TOPRIGHT', 4, 0) + local CustomSetDetailsPanel = frame.CustomSetDetailsPanel + if CustomSetDetailsPanel then + CustomSetDetailsPanel:ClearAllPoints() + CustomSetDetailsPanel:Point('TOPLEFT', frame, 'TOPRIGHT', 4, 0) + end - frame.OutfitDropdown:ClearAllPoints() - frame.OutfitDropdown:Point('TOP', -(isMinimized and 42 or 28), -32) - frame.OutfitDropdown:Width(isMinimized and 140 or 190) + local OutfitDropdown = frame.OutfitDropdown + if OutfitDropdown then + OutfitDropdown:ClearAllPoints() + OutfitDropdown:Point('TOP', -(isMinimized and 42 or 28), -32) + OutfitDropdown:Width(isMinimized and 140 or 190) + end end local function HandleSetButtons(button) @@ -72,8 +78,9 @@ function S:DressUpFrame() S:HandleButton(_G.DressUpFrameCancelButton) S:HandleButton(DressUpFrame.LinkButton) S:HandleModelSceneControlButtons(DressUpFrame.ModelScene.ControlFrame) - S:HandleButton(DressUpFrame.ToggleOutfitDetailsButton) - SetToggleIcon(DressUpFrame.ToggleOutfitDetailsButton, 1392954) + + S:HandleButton(DressUpFrame.ToggleCustomSetDetailsButton) + SetToggleIcon(DressUpFrame.ToggleCustomSetDetailsButton, 1392954) local SetSelection = DressUpFrame.SetSelectionPanel if SetSelection then @@ -92,29 +99,24 @@ function S:DressUpFrame() _G.DressUpFrameCancelButton:Point('BOTTOMRIGHT', -4, 4) _G.DressUpFrameResetButton:Point('RIGHT', _G.DressUpFrameCancelButton, 'LEFT', -3, 0) - local OutfitDropDown = DressUpFrame.OutfitDropdown - S:HandleDropDownBox(OutfitDropDown) - S:HandleButton(OutfitDropDown.SaveButton) + local CustomSetDropdown = DressUpFrame.CustomSetDropdown + if CustomSetDropdown then + S:HandleDropDownBox(CustomSetDropdown) + S:HandleButton(CustomSetDropdown.SaveButton) + end -- Dont use StripTextures on the DetailsPanel, plx - DressUpFrame.OutfitDetailsPanel:DisableDrawLayer('BACKGROUND') - DressUpFrame.OutfitDetailsPanel:DisableDrawLayer('OVERLAY') -- to keep Artwork on the frame - DressUpFrame.OutfitDetailsPanel:CreateBackdrop('Transparent') - DressUpFrame.OutfitDetailsPanel.ClassBackground:SetAllPoints() + local CustomSetDetailsPanel = DressUpFrame.CustomSetDetailsPanel + if CustomSetDetailsPanel then + CustomSetDetailsPanel:DisableDrawLayer('BACKGROUND') + CustomSetDetailsPanel:DisableDrawLayer('OVERLAY') -- to keep Artwork on the frame + CustomSetDetailsPanel:CreateBackdrop('Transparent') + CustomSetDetailsPanel.ClassBackground:SetAllPoints() + + hooksecurefunc(CustomSetDetailsPanel, 'Refresh', DetailsPanelRefresh) + end - hooksecurefunc(DressUpFrame.OutfitDetailsPanel, 'Refresh', DetailsPanelRefresh) hooksecurefunc(DressUpFrame, 'ConfigureSize', DressUpConfigureSize) - - local WardrobeOutfitEditFrame = _G.WardrobeOutfitEditFrame - WardrobeOutfitEditFrame:StripTextures(true) - WardrobeOutfitEditFrame:SetTemplate('Transparent') - WardrobeOutfitEditFrame.EditBox:StripTextures() - S:HandleEditBox(WardrobeOutfitEditFrame.EditBox) - WardrobeOutfitEditFrame.EditBox.backdrop:Point('TOPLEFT', WardrobeOutfitEditFrame.EditBox, 'TOPLEFT', -5, -5) - WardrobeOutfitEditFrame.EditBox.backdrop:Point('BOTTOMRIGHT', WardrobeOutfitEditFrame.EditBox, 'BOTTOMRIGHT', 0, 5) - S:HandleButton(WardrobeOutfitEditFrame.AcceptButton) - S:HandleButton(WardrobeOutfitEditFrame.CancelButton) - S:HandleButton(WardrobeOutfitEditFrame.DeleteButton) end S:AddCallback('DressUpFrame') diff --git a/ElvUI/Mainline/Modules/Skins/EncounterJournal.lua b/ElvUI/Mainline/Modules/Skins/EncounterJournal.lua index 35f2f4143c..54e562f7f3 100644 --- a/ElvUI/Mainline/Modules/Skins/EncounterJournal.lua +++ b/ElvUI/Mainline/Modules/Skins/EncounterJournal.lua @@ -615,8 +615,7 @@ function S:Blizzard_EncounterJournal() hooksecurefunc(ItemSetsFrame.ScrollBox, 'Update', HandleItemSetsElements) end - -- Tutorials page - -- TODO: Strip Parchment (unnamed region) + -- Tutorials page | TODO: Strip Parchment (unnamed region) S:HandleButton(_G.EncounterJournal.TutorialsFrame.Contents.StartButton) end diff --git a/ElvUI/Mainline/Modules/Skins/HousingDashboard.lua b/ElvUI/Mainline/Modules/Skins/HousingDashboard.lua index 387f7ef3b7..0068a92066 100644 --- a/ElvUI/Mainline/Modules/Skins/HousingDashboard.lua +++ b/ElvUI/Mainline/Modules/Skins/HousingDashboard.lua @@ -6,10 +6,9 @@ local _G = _G function S:Blizzard_HousingDashboard() if not (E.private.skins.blizzard.enable and E.private.skins.blizzard.housingDashboard) then return end - local HD = _G.HousingDashboardFrame - S:HandlePortraitFrame(HD) - - S:HandleButton(HD.DashboardNoHousesFrame.NoHouseButton) + local HousingDashboard = _G.HousingDashboardFrame + S:HandlePortraitFrame(HousingDashboard) + S:HandleButton(HousingDashboard.DashboardNoHousesFrame.NoHouseButton) end S:AddCallbackForAddon('Blizzard_HousingDashboard') diff --git a/ElvUI_Libraries/Core/Ace3-ElvUI/AceGUIWidget-EditBox-ElvUI.lua b/ElvUI_Libraries/Core/Ace3-ElvUI/AceGUIWidget-EditBox-ElvUI.lua index 46f24ee054..b53b9a8e55 100644 --- a/ElvUI_Libraries/Core/Ace3-ElvUI/AceGUIWidget-EditBox-ElvUI.lua +++ b/ElvUI_Libraries/Core/Ace3-ElvUI/AceGUIWidget-EditBox-ElvUI.lua @@ -1,7 +1,7 @@ --[[----------------------------------------------------------------------------- EditBox Widget -------------------------------------------------------------------------------]] -local Type, Version = "EditBox-ElvUI", 33 +local Type, Version = "EditBox-ElvUI", 34 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end @@ -21,7 +21,6 @@ local _G = _G Support functions -------------------------------------------------------------------------------]] if not AceGUIEditBoxInsertLinkElvUI then - -- upgradeable hook if ChatFrameUtil and ChatFrameUtil.InsertLink then hooksecurefunc(ChatFrameUtil, "InsertLink", function(...) return _G.AceGUIEditBoxInsertLinkElvUI(...) end) elseif ChatEdit_InsertLink then diff --git a/ElvUI_Libraries/Core/Ace3-ElvUI/AceGUIWidget-MultiLineEditBox-ElvUI.lua b/ElvUI_Libraries/Core/Ace3-ElvUI/AceGUIWidget-MultiLineEditBox-ElvUI.lua index e87d164f44..0c189fa4bf 100644 --- a/ElvUI_Libraries/Core/Ace3-ElvUI/AceGUIWidget-MultiLineEditBox-ElvUI.lua +++ b/ElvUI_Libraries/Core/Ace3-ElvUI/AceGUIWidget-MultiLineEditBox-ElvUI.lua @@ -1,7 +1,7 @@ --[[----------------------------------------------------------------------------- MultiLineEditBox Widget (Modified to add Syntax highlighting from FAIAP) -------------------------------------------------------------------------------]] -local Type, Version = "MultiLineEditBox-ElvUI", 37 +local Type, Version = "MultiLineEditBox-ElvUI", 38 local AceGUI = LibStub and LibStub("AceGUI-3.0", true) if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end @@ -17,9 +17,7 @@ local ACCEPT = ACCEPT --[[----------------------------------------------------------------------------- Support functions -------------------------------------------------------------------------------]] - if not AceGUIMultiLineEditBoxInsertLinkElvUI then - -- upgradeable hook if ChatFrameUtil and ChatFrameUtil.InsertLink then hooksecurefunc(ChatFrameUtil, "InsertLink", function(...) return _G.AceGUIMultiLineEditBoxInsertLinkElvUI(...) end) elseif ChatEdit_InsertLink then diff --git a/ElvUI_Libraries/Core/Ace3/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua b/ElvUI_Libraries/Core/Ace3/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua index 340f190dec..0318369b47 100644 --- a/ElvUI_Libraries/Core/Ace3/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua +++ b/ElvUI_Libraries/Core/Ace3/AceConfig-3.0/AceConfigDialog-3.0/AceConfigDialog-3.0.lua @@ -7,7 +7,7 @@ local LibStub = LibStub local gui = LibStub("AceGUI-3.0") local reg = LibStub("AceConfigRegistry-3.0-ElvUI") -local MAJOR, MINOR = "AceConfigDialog-3.0-ElvUI", 93 -- based off 87 +local MAJOR, MINOR = "AceConfigDialog-3.0-ElvUI", 94 -- based off 89 local AceConfigDialog, oldminor = LibStub:NewLibrary(MAJOR, MINOR) if not AceConfigDialog then return end @@ -551,7 +551,7 @@ local function OptionOnMouseOver(widget, event) tooltip:Show() elseif descText or usageText or userText or softText or bigText then tooltip:SetOwner(widget.frame, "ANCHOR_TOPRIGHT") - tooltip:SetText(name, 1, .82, 0, true) + tooltip:SetText(name, 1, .82, 0, 1, true) if userText then tooltip:AddLine(user.text, 0.5, 0.5, 0.8, true) @@ -560,7 +560,7 @@ local function OptionOnMouseOver(widget, event) tooltip:AddLine(desc, 1, 1, 1, true) end if usageText then - tooltip:AddLine("Usage: "..usage, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, true) + tooltip:AddLine(usage, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, true) end if bigText or softText then tooltip:AddLine(" ") @@ -1638,7 +1638,7 @@ local function TreeOnButtonEnter(widget, event, uniquevalue, button) tooltip:SetPoint("LEFT",button,"RIGHT") end - tooltip:SetText(name, 1, .82, 0, true) + tooltip:SetText(name, 1, .82, 0, 1, true) tooltip:AddLine(desc, 1, 1, 1, true) diff --git a/ElvUI_Libraries/Core/LibActionButton-1.0/LibActionButton-1.0.lua b/ElvUI_Libraries/Core/LibActionButton-1.0/LibActionButton-1.0.lua index 6562220799..b463804ed0 100644 --- a/ElvUI_Libraries/Core/LibActionButton-1.0/LibActionButton-1.0.lua +++ b/ElvUI_Libraries/Core/LibActionButton-1.0/LibActionButton-1.0.lua @@ -1,7 +1,7 @@ -- License: LICENSE.txt local MAJOR_VERSION = "LibActionButton-1.0-ElvUI" -local MINOR_VERSION = 67 -- the real minor version is 133 (no Spell Cast VFX yet) +local MINOR_VERSION = 68 -- the real minor version is 133 (no Spell Cast VFX yet) local LibStub = LibStub if not LibStub then error(MAJOR_VERSION .. " requires LibStub.") end @@ -14,12 +14,14 @@ local type, error, tostring, tonumber, assert, select = type, error, tostring, t local setmetatable, wipe, unpack, pairs, ipairs, next, pcall = setmetatable, wipe, unpack, pairs, ipairs, next, pcall local hooksecurefunc, strmatch, format, tinsert, tremove = hooksecurefunc, strmatch, format, tinsert, tremove +local _, _, _, wowtoc = GetBuildInfo() local WoWRetail = (WOW_PROJECT_ID == WOW_PROJECT_MAINLINE) local WoWClassic = (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC) local WoWBCC = (WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC) local WoWWrath = (WOW_PROJECT_ID == WOW_PROJECT_WRATH_CLASSIC) local WoWCata = (WOW_PROJECT_ID == WOW_PROJECT_CATACLYSM_CLASSIC) local WoWMists = (WOW_PROJECT_ID == WOW_PROJECT_MISTS_CLASSIC) +local WoWMidnight = wowtoc >= 120000 -- GLOBALS: C_Item, C_Spell @@ -653,7 +655,7 @@ end -- prevent pickup calling spells ~Simpy function Generic:OnButtonEvent(event, key, down, spellID) if event == "UNIT_SPELLCAST_RETICLE_TARGET" then - if (self.abilityID == spellID) and not self.TargetReticleAnimFrame:IsShown() then + if not WoWMidnight and (self.abilityID == spellID) and not self.TargetReticleAnimFrame:IsShown() then self.TargetReticleAnimFrame.HighlightAnim:Play() self.TargetReticleAnimFrame:Show() end @@ -1533,7 +1535,6 @@ function InitializeEventHandler() lib.eventFrame:RegisterEvent("PLAYER_LEAVE_COMBAT") lib.eventFrame:RegisterEvent("START_AUTOREPEAT_SPELL") lib.eventFrame:RegisterEvent("STOP_AUTOREPEAT_SPELL") - lib.eventFrame:RegisterEvent("LEARNED_SPELL_IN_TAB") lib.eventFrame:RegisterEvent("PET_STABLE_UPDATE") lib.eventFrame:RegisterEvent("PET_STABLE_SHOW") lib.eventFrame:RegisterEvent("SPELL_UPDATE_CHARGES") @@ -1605,7 +1606,7 @@ function OnEvent(_, event, arg1, arg2, ...) if TARGETAURA_ENABLED then UpdateTargetAuras(event) end - elseif event == "UNIT_INVENTORY_CHANGED" or event == "LEARNED_SPELL_IN_TAB" then + elseif event == "UNIT_INVENTORY_CHANGED" then local tooltipOwner = GameTooltip_GetOwnerForbidden() if tooltipOwner and ButtonRegistry[tooltipOwner] then tooltipOwner:SetTooltip() @@ -1985,7 +1986,7 @@ function lib:SetTargetAuraDuration(value) end function lib:SetTargetAuraCooldowns(enabled) - TARGETAURA_ENABLED = enabled + TARGETAURA_ENABLED = not WoWMidnight and enabled UpdateTargetAuras('SetTargetAuraCooldowns', not enabled) end @@ -2325,7 +2326,7 @@ function UpdateCount(self) end if self:IsConsumableOrStackable() then local count = self:GetCount() - if count > (self.maxDisplayCount or 9999) then + if not WoWMidnight and (count > (self.maxDisplayCount or 9999)) then self.Count:SetText("*") else self.Count:SetText(count) @@ -2414,7 +2415,7 @@ end function UpdateCooldown(self) local locStart, locDuration - local start, duration, enable, modRate, auraData + local start, duration, modRate, auraData local charges, maxCharges, chargeStart, chargeDuration, chargeModRate local passiveCooldownSpellID = self:GetPassiveCooldownSpellID() @@ -2437,18 +2438,17 @@ function UpdateCooldown(self) chargeStart = currentTime * 0.001 chargeDuration = duration * 0.001 chargeModRate = modRate - enable = 1 else locStart, locDuration = self:GetLossOfControlCooldown() - start, duration, enable, modRate = self:GetCooldown() + start, duration, _, modRate = self:GetCooldown() charges, maxCharges, chargeStart, chargeDuration, chargeModRate = self:GetCharges() end self.cooldown:SetDrawBling(self.config.useDrawBling and (self:GetEffectiveAlpha() > 0.5)) - local hasLocCooldown = locStart and locDuration and locStart > 0 and locDuration > 0 - local hasCooldown = (enable and enable ~= 0) and (start and duration and start > 0 and duration > 0) - if hasLocCooldown and (not hasCooldown or ((locStart + locDuration) > (start + duration))) then + local hasLocCooldown = locStart and locDuration + local hasCooldown = start and duration + if hasLocCooldown and not hasCooldown then if self.cooldown.currentCooldownType ~= COOLDOWN_TYPE_LOSS_OF_CONTROL then self.cooldown:SetEdgeTexture("Interface\\Cooldown\\edge-LoC") self.cooldown:SetSwipeColor(0.2, 0, 0) @@ -2477,12 +2477,14 @@ function UpdateCooldown(self) self.cooldown:Clear() end - if charges and maxCharges and maxCharges > 1 and charges < maxCharges then - StartChargeCooldown(self, chargeStart, chargeDuration, chargeModRate) + if self.chargeCooldown then + if charges and maxCharges then + StartChargeCooldown(self, chargeStart, chargeDuration, chargeModRate) - self.chargeCooldown:SetDrawSwipe(self.config.useDrawSwipeOnCharges) - elseif self.chargeCooldown then - EndChargeCooldown(self.chargeCooldown) + self.chargeCooldown:SetDrawSwipe(self.config.useDrawSwipeOnCharges) + else + EndChargeCooldown(self.chargeCooldown) + end end end @@ -2875,7 +2877,7 @@ Action.IsEquipped = function(self) return IsEquippedAction(self._st Action.IsCurrentlyActive = function(self) return IsCurrentAction(self._state_action) end Action.IsAutoRepeat = function(self) return IsAutoRepeatAction(self._state_action) end Action.IsUsable = function(self) return IsUsableAction(self._state_action) end -Action.IsConsumableOrStackable = function(self) return IsConsumableAction(self._state_action) or IsStackableAction(self._state_action) or (not IsItemAction(self._state_action) and GetActionCount(self._state_action) > 0) end +Action.IsConsumableOrStackable = function(self) return IsConsumableAction(self._state_action) or IsStackableAction(self._state_action) or (not IsItemAction(self._state_action) and (WoWMidnight or GetActionCount(self._state_action) > 0)) end Action.IsUnitInRange = function(self, unit) return IsActionInRange(self._state_action, unit) end Action.SetTooltip = function(self) return GameTooltip:SetAction(self._state_action) end Action.GetSpellId = function(self) diff --git a/ElvUI_Options/Core/UnitFrames.lua b/ElvUI_Options/Core/UnitFrames.lua index 52088b99de..60ed61cbbb 100644 --- a/ElvUI_Options/Core/UnitFrames.lua +++ b/ElvUI_Options/Core/UnitFrames.lua @@ -1450,7 +1450,7 @@ Colors.classResourceGroup.args.DRUID = ACH:Group(L["Eclipse Power"], nil, 40, ni Colors.classResourceGroup.args.DRUID.inline = true do - local name = { [1] = L["BALANCE_ENERGY_LUNAR"], [2] = L["BALANCE_ENERGY_SOLAR"] } + local name = { L["BALANCE_ENERGY_LUNAR"], L["BALANCE_ENERGY_SOLAR"] } for i = 1, 2 do Colors.classResourceGroup.args.DRUID.args[''..i] = ACH:Color(name[i], nil, i, nil, nil, function(info) local x = tonumber(info[#info]); local t, d = E.db.unitframe.colors.classResources.DRUID[x], P.unitframe.colors.classResources.DRUID[x] return t.r, t.g, t.b, t.a, d.r, d.g, d.b end, function(info, r, g, b) local t = E.db.unitframe.colors.classResources.DRUID[tonumber(info[#info])] t.r, t.g, t.b = r, g, b UF:Update_AllFrames() end) Colors.classResourceGroup.args.DRUID.args[''..i] = ACH:Color(name[i], nil, i, nil, nil, function(info) local x = tonumber(info[#info]); local t, d = E.db.unitframe.colors.classResources.DRUID[x], P.unitframe.colors.classResources.DRUID[x] return t.r, t.g, t.b, t.a, d.r, d.g, d.b end, function(info, r, g, b) local t = E.db.unitframe.colors.classResources.DRUID[tonumber(info[#info])] t.r, t.g, t.b = r, g, b UF:Update_AllFrames() end)