From f9fc015d0e3e74997b4fd3084626b5e34b51d6e8 Mon Sep 17 00:00:00 2001 From: andrew6180 <16847730+andrew6180@users.noreply.github.com> Date: Mon, 9 Sep 2024 14:11:43 -0700 Subject: [PATCH] misc fixes post patch --- ElvUI/Core/API.lua | 32 ++++++++++++++++++++++ ElvUI/Modules/Chat/Chat.lua | 38 +++++++++++++++++++++++++++ ElvUI/Modules/Skins/Blizzard/Misc.lua | 25 ------------------ 3 files changed, 70 insertions(+), 25 deletions(-) diff --git a/ElvUI/Core/API.lua b/ElvUI/Core/API.lua index c8c94ec..e69f68b 100644 --- a/ElvUI/Core/API.lua +++ b/ElvUI/Core/API.lua @@ -15,6 +15,37 @@ local IsInInstance = IsInInstance E.Role = "Melee" -- TODO: Save per specialization? +function E:ClassColor(class, usePriestColor) + if not class then return end + + local color = (_G.CUSTOM_CLASS_COLORS and _G.CUSTOM_CLASS_COLORS[class]) or _G.RAID_CLASS_COLORS[class] + if type(color) ~= 'table' then return end + + if not color.colorStr then + color.colorStr = E:RGBToHex(color.r, color.g, color.b, 'ff') + elseif strlen(color.colorStr) == 6 then + color.colorStr = 'ff'..color.colorStr + end + + if usePriestColor and class == 'PRIEST' and tonumber(color.colorStr, 16) > tonumber(E.PriestColors.colorStr, 16) then + return E.PriestColors + else + return color + end +end + +function E:InverseClassColor(class, usePriestColor, forceCap) + local color = E:CopyTable({}, E:ClassColor(class, usePriestColor)) + local capColor = class == 'PRIEST' or forceCap + + color.r = capColor and max(1-color.r,0.35) or (1-color.r) + color.g = capColor and max(1-color.g,0.35) or (1-color.g) + color.b = capColor and max(1-color.b,0.35) or (1-color.b) + color.colorStr = E:RGBToHex(color.r, color.g, color.b, 'ff') + + return color +end + do -- other non-english locales require this E.UnlocalizedClasses = {} for k, v in pairs(_G.LOCALIZED_CLASS_NAMES_MALE) do E.UnlocalizedClasses[v] = k end @@ -25,6 +56,7 @@ do -- other non-english locales require this end end + function E:ScanTooltipTextures(clean, grabTextures) local textures for i = 1, 10 do diff --git a/ElvUI/Modules/Chat/Chat.lua b/ElvUI/Modules/Chat/Chat.lua index c1e87c4..8ca3ece 100644 --- a/ElvUI/Modules/Chat/Chat.lua +++ b/ElvUI/Modules/Chat/Chat.lua @@ -1924,6 +1924,44 @@ function CH:FCFTab_UpdateColors(tab, selected) tab:GetFontString():SetTextColor(unpack(E.media.rgbvaluecolor)) end +function CH:GetPlayerInfoByGUID(guid) + local data = CH.GuidCache[guid] + if not data then + local ok, localizedClass, englishClass, localizedRace, englishRace, sex, name, realm = pcall(GetPlayerInfoByGUID, guid) + if not (ok and englishClass) then return end + + local nameWithRealm = name..'-'..GetRealmName() + + -- move em into a table + data = { + localizedClass = localizedClass, + englishClass = englishClass, + localizedRace = localizedRace, + englishRace = englishRace, + sex = sex, + name = name, + realm = realm, + nameWithRealm = nameWithRealm -- we use this to correct mobile to link with the realm as well + } + + -- add it to ClassNames + if name then + CH.ClassNames[strlower(name)] = englishClass + end + if nameWithRealm then + CH.ClassNames[strlower(nameWithRealm)] = englishClass + end + + -- push into the cache + CH.GuidCache[guid] = data + end + + -- we still need to recheck this each time because CUSTOM_CLASS_COLORS can change + if data then data.classColor = E:ClassColor(data.englishClass) end + + return data +end + function CH:ResetEditboxHistory() wipe(ElvCharacterDB.ChatEditHistory) end diff --git a/ElvUI/Modules/Skins/Blizzard/Misc.lua b/ElvUI/Modules/Skins/Blizzard/Misc.lua index d28a2c1..63a23df 100644 --- a/ElvUI/Modules/Skins/Blizzard/Misc.lua +++ b/ElvUI/Modules/Skins/Blizzard/Misc.lua @@ -258,29 +258,4 @@ S:AddCallback("Skin_Misc", function() _G["LanguageMenuButton"..i]:StyleButton() _G["VoiceMacroMenuButton"..i]:StyleButton() end - - local locale = GetLocale() - if locale == "koKR" then - S:HandleButton(GameMenuButtonRatings) - - RatingMenuFrame:SetTemplate("Transparent") - RatingMenuFrameHeader:Kill() - S:HandleButton(RatingMenuButtonOkay) - elseif locale == "ruRU" then - -- Declension Frame - DeclensionFrame:SetTemplate("Transparent") - - S:HandleNextPrevButton(DeclensionFrameSetPrev) - S:HandleNextPrevButton(DeclensionFrameSetNext) - S:HandleButton(DeclensionFrameOkayButton) - S:HandleButton(DeclensionFrameCancelButton) - - for i = 1, RUSSIAN_DECLENSION_PATTERNS do - local editBox = _G["DeclensionFrameDeclension"..i.."Edit"] - if editBox then - editBox:StripTextures() - S:HandleEditBox(editBox) - end - end - end end) \ No newline at end of file