diff --git a/.luacheckrc b/.luacheckrc index 7d8d6b85..529a8014 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -60,12 +60,14 @@ read_globals = { "GetCursorPosition", "GetCVarBool", "GetDetailedItemLevelInfo", + "GetDifficultyInfo", "GetFlyoutInfo", "GetFriendshipReputation", "GetGameTime", "GetGuildInfo", "GetInboxHeaderInfo", "GetInboxNumItems", + "GetInstanceInfo", "GetInventoryItemDurability", "GetInventoryItemLink", "GetInventoryItemTexture", @@ -109,6 +111,7 @@ read_globals = { "GetZonePVPInfo", "HasArtifactEquipped", "InCombatLockdown", + "InGuildParty", "IsAddOnLoaded", "IsAltKeyDown", "IsControlKeyDown", diff --git a/CHANGELOG.md b/CHANGELOG.md index 256a4a80..7432627c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,35 @@ # CHANGELOG +## Version 100000.03 + +### Action Bars + +- Fixed a bug where the extra action button would stay hidden despite being enabled. +- Fixed a bug where an action bar anchored to another frame would appear in a different spot from + its mover. I had to rework movers for DF, so there might be more of these, please, continue to + report them. + +### Minimap + +- Added custom difficulty flags. LFR, normal, heroic, mythic, and M+ difficulties will now have + unique flags. There's also an option to show the tooltip with the difficulty info, it's disabled + by default. + +### Unit Frames + +- Added an option to use Blizzard castbar. When you disable the player castbar, the new "Enable + Blizzard Castbar" option will appear next to it. + +### Known Issues + +- Spell flyouts don't work. It's not a bug in my UI, it's a Blizz bug that affects all addons. + I feel your pain, I have a mage alt, but for the time being either place frequently used spells + on your action bars or use them directly from your spellbook. +- Tooltips don't work. Just to reiterate, Blizz chose to delay the new tooltip system until 10.0.2, + the rewritten tooltip module relies on it to work, so I had to disable it for the time being. + +![Imgur](https://i.imgur.com/kYQnCzY.png) + ## Version 100000.02 ### Action Bars diff --git a/ls_UI/assets/minimap-flags.TGA b/ls_UI/assets/minimap-flags.TGA new file mode 100644 index 00000000..c2373c94 Binary files /dev/null and b/ls_UI/assets/minimap-flags.TGA differ diff --git a/ls_UI/assets/minimap-round-100.TGA b/ls_UI/assets/minimap-round-100.TGA index 009a6d34..1a0eefef 100644 Binary files a/ls_UI/assets/minimap-round-100.TGA and b/ls_UI/assets/minimap-round-100.TGA differ diff --git a/ls_UI/assets/minimap-square-100.TGA b/ls_UI/assets/minimap-square-100.TGA index 8e6fcb3b..58a1a79b 100644 Binary files a/ls_UI/assets/minimap-square-100.TGA and b/ls_UI/assets/minimap-square-100.TGA differ diff --git a/ls_UI/core/changelog.lua b/ls_UI/core/changelog.lua index 6a058cdf..3c9e4861 100644 --- a/ls_UI/core/changelog.lua +++ b/ls_UI/core/changelog.lua @@ -8,20 +8,21 @@ local _G = getfenv(0) E.CHANGELOG = [[ ### Action Bars -- Added mouseover casting to action bars. -- Added an option to scale the main action bar artwork. +- Fixed a bug where the extra action button would stay hidden despite being enabled. +- Fixed a bug where an action bar anchored to another frame would appear in a different spot from + its mover. I had to rework movers for DF, so there might be more of these, please, continue to + report them. -### Blizzard +### Minimap -- Fixed the option to hide the talking head. - -### Buffs and Debuffs - -- Fixed an issue where it's impossible to cancel an aura by right-clicking it. +- Added custom difficulty flags. LFR, normal, heroic, mythic, and M+ difficulties will now have + unique flags. There's also an option to show the tooltip with the difficulty info, it's disabled + by default. ### Unit Frames -- Fixed an issue where disabling the player castbar would result in an error. +- Added an option to use Blizzard castbar. When you disable the player castbar, the new "Enable + Blizzard Castbar" option will appear next to it. ### Known Issues diff --git a/ls_UI/core/defaults.lua b/ls_UI/core/defaults.lua index cb1362fd..1a2e44ca 100644 --- a/ls_UI/core/defaults.lua +++ b/ls_UI/core/defaults.lua @@ -621,6 +621,7 @@ D.profile = { }, castbar = { enabled = true, + blizz_enabled = false, latency = true, detached = true, width_override = 226, @@ -1874,6 +1875,10 @@ D.profile = { color = { border = false, }, + flag = { + enabled = true, + tooltip = false, + }, fade = { enabled = false, combat = false, diff --git a/ls_UI/locales/deDE.lua b/ls_UI/locales/deDE.lua index 6eff110a..6d2e18af 100644 --- a/ls_UI/locales/deDE.lua +++ b/ls_UI/locales/deDE.lua @@ -67,6 +67,7 @@ L["DEBUFF"] = "Schwächungszauber" L["DEBUFFS"] = "Debuffs" L["DIFFICULT"] = "Schwierig" L["DIFFICULTY"] = "Schwierigkeit" +L["DIFFICULTY_FLAG"] = "Schwierigskeitsflagge" L["DISABLE_MOUSE"] = "Maus deaktivieren" L["DISABLE_MOUSE_DESC"] = "Ignoriere Mausklicks." L["DISEASE"] = "Krankheit" diff --git a/ls_UI/locales/enUS.lua b/ls_UI/locales/enUS.lua index 43997300..27323337 100644 --- a/ls_UI/locales/enUS.lua +++ b/ls_UI/locales/enUS.lua @@ -196,6 +196,7 @@ L["DESCENDING"] = "Descending" L["DETACH_FROM_FRAME"] = "Detach from Frame" L["DIFFICULT"] = "Difficult" L["DIFFICULTY"] = "Difficulty" +L["DIFFICULTY_FLAG"] = "Difficulty Flag" L["DIGSITE_BAR"] = "Digsite Progress Bar" L["DISABLE_MOUSE"] = "Disable Mouse" L["DISABLE_MOUSE_DESC"] = "Ignore mouse events." @@ -210,6 +211,7 @@ L["DOWNLOADS"] = "Downloads" L["DRAG_KEY"] = "Drag Key" L["DUNGEONS_BUTTON_DESC"] = "Show 'Call to Arms' information." L["DURABILITY_FRAME"] = "Durability Frame" +L["ENABLE_BLIZZARD_CASTBAR"] = "Enable Blizzard Castbar" L["ENDCAPS"] = "Artwork" L["ENDCAPS_BOTH"] = "Both" L["ENDCAPS_LEFT"] = "Left" @@ -464,6 +466,7 @@ L["THREAT_GLOW"] = "Threat Glow" L["TIME"] = "Time" L["TOF_FRAME"] = "Target of Focus Frame" L["TOGGLE_ANCHORS"] = "Toggle Anchors" +L["TOOLTIP"] = "Tooltip" L["TOOLTIP_IDS"] = "Spell and Item IDs" L["TOOLTIPS"] = "Tooltips" L["TOP_INSET_SIZE"] = "Top Inset Size" diff --git a/ls_UI/locales/esES.lua b/ls_UI/locales/esES.lua index c6292ccb..32203d30 100644 --- a/ls_UI/locales/esES.lua +++ b/ls_UI/locales/esES.lua @@ -99,6 +99,7 @@ L["DESCENDING"] = "Descendiente" L["DETACH_FROM_FRAME"] = "Despegar del cuadro." L["DIFFICULT"] = "Difícil" L["DIFFICULTY"] = "Dificultad" +L["DIFFICULTY_FLAG"] = "Bandera de dificultad" L["DIGSITE_BAR"] = "Barra de progreso de excavaciones" L["DISABLE_MOUSE"] = "Desactivar ratón" L["DISABLE_MOUSE_DESC"] = "Ignorar eventos de ratón." diff --git a/ls_UI/locales/frFR.lua b/ls_UI/locales/frFR.lua index 541bcf29..9f79c3fb 100644 --- a/ls_UI/locales/frFR.lua +++ b/ls_UI/locales/frFR.lua @@ -98,6 +98,7 @@ L["DESCENDING"] = "Descendant" L["DETACH_FROM_FRAME"] = "Détacher du cadre" L["DIFFICULT"] = "Difficile" L["DIFFICULTY"] = "Difficulté" +L["DIFFICULTY_FLAG"] = "Drapeau de difficulté" L["DIGSITE_BAR"] = "Barre de progression de la fouille" L["DISABLE_MOUSE"] = "Désactiver la souris" L["DISABLE_MOUSE_DESC"] = "Ignorer les évènements de souris." diff --git a/ls_UI/locales/ruRU.lua b/ls_UI/locales/ruRU.lua index afb0b697..c975b2bd 100644 --- a/ls_UI/locales/ruRU.lua +++ b/ls_UI/locales/ruRU.lua @@ -109,6 +109,7 @@ L["DESCENDING"] = "По убыванию" L["DETACH_FROM_FRAME"] = "Отсоединить от рамки" L["DIFFICULT"] = "Сложный" L["DIFFICULTY"] = "Сложность" +L["DIFFICULTY_FLAG"] = "Флаг режима сложности" L["DIGSITE_BAR"] = "Полоса прогресса раскопок" L["DISABLE_MOUSE"] = "Отключить мышь" L["DISABLE_MOUSE_DESC"] = "Игнорировать мышь." @@ -123,6 +124,7 @@ L["DOWNLOADS"] = "Загрузки" L["DRAG_KEY"] = "Кнопка для перетаскивания" L["DUNGEONS_BUTTON_DESC"] = "Показывать информацию о 'Призыве к оружию'." L["DURABILITY_FRAME"] = "Рамка прочности" +L["ENABLE_BLIZZARD_CASTBAR"] = "Включить полосу заклинаний от Blizzard" L["ENDCAPS"] = "Текстуры" L["ENDCAPS_BOTH"] = "Обе" L["ENDCAPS_LEFT"] = "Левая" @@ -377,6 +379,7 @@ L["THREAT_GLOW"] = "Подсветка уровня угрозы" L["TIME"] = "Время" L["TOF_FRAME"] = "Рамка цели фокуса" L["TOGGLE_ANCHORS"] = "Показать/скрыть фреймы крепления" +L["TOOLTIP"] = "Подсказка" L["TOOLTIP_IDS"] = "ID способностей и предметов" L["TOOLTIPS"] = "Подсказки" L["TOP_INSET_SIZE"] = "Размер верхней вставки" diff --git a/ls_UI/locales/zhCN.lua b/ls_UI/locales/zhCN.lua index 172bc2a8..bde15933 100644 --- a/ls_UI/locales/zhCN.lua +++ b/ls_UI/locales/zhCN.lua @@ -126,6 +126,7 @@ L["DESCENDING"] = "降序" L["DETACH_FROM_FRAME"] = "从框架脱离" L["DIFFICULT"] = "困难" L["DIFFICULTY"] = "难度" +L["DIFFICULTY_FLAG"] = "难度标记" L["DIGSITE_BAR"] = "考古进度条" L["DISABLE_MOUSE"] = "禁用鼠标" L["DISABLE_MOUSE_DESC"] = "忽略鼠标事件" diff --git a/ls_UI/ls_UI.toc b/ls_UI/ls_UI.toc index d5d8b3d1..90ec654e 100644 --- a/ls_UI/ls_UI.toc +++ b/ls_UI/ls_UI.toc @@ -1,6 +1,6 @@ ## Interface: 100000 ## Author: lightspark -## Version: 100000.02 +## Version: 100000.03 ## Title: LS: |cff1a9fc0UI|r ## Notes: Yet another UI, but this one is a bit special... ## SavedVariables: LS_UI_GLOBAL_CONFIG, LS_UI_PRIVATE_CONFIG diff --git a/ls_UI/modules/auras/auras.lua b/ls_UI/modules/auras/auras.lua index 8371dc35..df57de24 100644 --- a/ls_UI/modules/auras/auras.lua +++ b/ls_UI/modules/auras/auras.lua @@ -98,7 +98,6 @@ do function button_proto:OnEnter() local p, rP, x, y = E:GetTooltipPoint(self) - GameTooltip:SetOwner(self, "ANCHOR_NONE") GameTooltip:SetPoint(p, self, rP, x, y) GameTooltip:SetFrameLevel(self:GetFrameLevel() + 2) diff --git a/ls_UI/modules/bars/core.lua b/ls_UI/modules/bars/core.lua index ff22c9db..be94835d 100644 --- a/ls_UI/modules/bars/core.lua +++ b/ls_UI/modules/bars/core.lua @@ -92,6 +92,7 @@ end function MODULE:Create(id, name, isInsecure) local bar = Mixin(CreateFrame("Frame", name, UIParent, isInsecure and nil or "SecureHandlerStateTemplate"), bar_proto) + bar:SetSize(0, 0) bar._id = id bar._buttons = {} bars[id] = bar diff --git a/ls_UI/modules/bars/extra.lua b/ls_UI/modules/bars/extra.lua index c9843671..674e27fa 100644 --- a/ls_UI/modules/bars/extra.lua +++ b/ls_UI/modules/bars/extra.lua @@ -4,6 +4,7 @@ local MODULE = P:GetModule("Bars") -- Lua local _G = getfenv(0) +local hooksecurefunc = _G.hooksecurefunc local unpack = _G.unpack -- Mine @@ -80,6 +81,12 @@ function MODULE:CreateExtraButton() ExtraActionBarFrame:SetParent(bar) ExtraActionBarFrame.ignoreInLayout = true + hooksecurefunc(ExtraActionBarFrame, "SetParent", function(self, parent) + if parent ~= bar then + self:SetParent(bar) + end + end) + -- ExtraAbilityContainer.ignoreFramePositionManager = true -- ExtraAbilityContainer:SetScript("OnShow", nil) -- ExtraAbilityContainer:SetScript("OnHide", nil) diff --git a/ls_UI/modules/minimap/minimap.lua b/ls_UI/modules/minimap/minimap.lua index 1f9f6609..3f600498 100644 --- a/ls_UI/modules/minimap/minimap.lua +++ b/ls_UI/modules/minimap/minimap.lua @@ -13,136 +13,268 @@ local unpack = _G.unpack -- Mine local isInit = false -local zoneTypeToColor = { - ["arena"] = "hostile", - ["combat"] = "hostile", - ["contested"] = "contested", - ["friendly"] = "friendly", - ["hostile"] = "hostile", - ["sanctuary"] = "sanctuary", -} - local minimap_proto = {} -function minimap_proto:UpdateBorderColor() - if self._config.color.border then - self.Border:SetVertexColor((C.db.global.colors.zone[zoneTypeToColor[GetZonePVPInfo() or "contested"]]):GetRGB()) - else - self.Border:SetVertexColor(1, 1, 1) +do + local zoneTypeToColor = { + ["arena"] = "hostile", + ["combat"] = "hostile", + ["contested"] = "contested", + ["friendly"] = "friendly", + ["hostile"] = "hostile", + ["sanctuary"] = "sanctuary", + } + + function minimap_proto:UpdateBorderColor() + if self._config.color.border then + self.Border:SetVertexColor((C.db.global.colors.zone[zoneTypeToColor[GetZonePVPInfo() or "contested"]]):GetRGB()) + else + self.Border:SetVertexColor(1, 1, 1) + end end -end -function minimap_proto:OnEventHook(event) - if event == "ZONE_CHANGED" or event == "ZONE_CHANGED_INDOORS" or event == "ZONE_CHANGED_NEW_AREA" then - self:UpdateBorderColor() + function minimap_proto:OnEventHook(event) + if event == "ZONE_CHANGED" or event == "ZONE_CHANGED_INDOORS" or event == "ZONE_CHANGED_NEW_AREA" then + self:UpdateBorderColor() + end end -end -local function updateHybridMinimap() - if C.db.profile.minimap.shape == "square" then - HybridMinimap.CircleMask:SetTexture("Interface\\BUTTONS\\WHITE8X8", "CLAMPTOBLACKADDITIVE", "CLAMPTOBLACKADDITIVE") - else - HybridMinimap.CircleMask:SetTexture("Interface\\CHARACTERFRAME\\TempPortraitAlphaMask", "CLAMPTOBLACKADDITIVE", "CLAMPTOBLACKADDITIVE") + function minimap_proto:UpdateHybridMinimap() + if C.db.profile.minimap.shape == "square" then + HybridMinimap.CircleMask:SetTexture("Interface\\BUTTONS\\WHITE8X8", "CLAMPTOBLACKADDITIVE", "CLAMPTOBLACKADDITIVE") + else + HybridMinimap.CircleMask:SetTexture("Interface\\CHARACTERFRAME\\TempPortraitAlphaMask", "CLAMPTOBLACKADDITIVE", "CLAMPTOBLACKADDITIVE") + end + + HybridMinimap.MapCanvas:SetMaskTexture(HybridMinimap.CircleMask) end - HybridMinimap.MapCanvas:SetMaskTexture(HybridMinimap.CircleMask) -end + function minimap_proto:UpdateConfig() + self._config = E:CopyTable(C.db.profile.minimap, self._config) -function minimap_proto:UpdateConfig() - self._config = E:CopyTable(C.db.profile.minimap, self._config) + MinimapCluster._config = t_wipe(MinimapCluster._config or {}) + MinimapCluster._config.fade = self._config.fade + end - MinimapCluster._config = t_wipe(MinimapCluster._config or {}) - MinimapCluster._config.fade = self._config.fade -end + local borderInfo = { + [100] = { + {1 / 1024, 433 / 1024, 1 / 512, 433 / 512}, -- outer + {434 / 1024, 866 / 1024, 1 / 512, 433 / 512}, -- inner + 432 / 2, + }, + } + + local flagBorderInfo = { + ["round"] = {97 / 512, 193 / 512, 1 / 256, 97 / 256}, + ["square"] = {1 / 512, 97 / 512, 1 / 256, 97 / 256}, + } + + -- At odds with the fierce looking face... + local function theBodyIsRound() + return "ROUND" + end -local borderInfo = { - [100] = { - {1 / 1024, 433 / 1024, 1 / 512, 433 / 512}, -- outer - {434 / 1024, 866 / 1024, 1 / 512, 433 / 512}, -- inner - 432 / 2, - }, -} + local function theBodyIsSquare() + return "SQUARE" + end --- At odds with the fierce looking face... -local function theBodyIsRound() - return "ROUND" -end + function minimap_proto:UpdateLayout() + local scale = self._config.scale + local shape = self._config.shape + local info = borderInfo[scale] or borderInfo[100] -local function theBodyIsSquare() - return "SQUARE" -end + self.Border:SetTexture("Interface\\AddOns\\ls_UI\\assets\\minimap-" .. shape .. "-" .. scale) + self.Border:SetTexCoord(unpack(info[1])) + self.Border:SetSize(info[3], info[3]) -function minimap_proto:UpdateLayout() - local scale = self._config.scale - local shape = self._config.shape - local info = borderInfo[scale] or borderInfo[100] + self.Foreground:SetTexture("Interface\\AddOns\\ls_UI\\assets\\minimap-" .. shape .. "-" .. scale) + self.Foreground:SetTexCoord(unpack(info[2])) + self.Foreground:SetSize(info[3], info[3]) - self.Border:SetTexture("Interface\\AddOns\\ls_UI\\assets\\minimap-" .. shape .. "-" .. scale) - self.Border:SetTexCoord(unpack(info[1])) - self.Border:SetSize(info[3], info[3]) + self.DifficultyFlag.Border:SetTexCoord(unpack(flagBorderInfo[shape])) - self.Foreground:SetTexture("Interface\\AddOns\\ls_UI\\assets\\minimap-" .. shape .. "-" .. scale) - self.Foreground:SetTexCoord(unpack(info[2])) - self.Foreground:SetSize(info[3], info[3]) + if shape == "round" then + self:SetArchBlobRingScalar(1) + self:SetQuestBlobRingScalar(1) + self:SetTaskBlobRingScalar(1) + self:SetMaskTexture("Interface\\CHARACTERFRAME\\TempPortraitAlphaMask") - if shape == "round" then - self:SetArchBlobRingScalar(1) - self:SetQuestBlobRingScalar(1) - self:SetTaskBlobRingScalar(1) - self:SetMaskTexture("Interface\\CHARACTERFRAME\\TempPortraitAlphaMask") + self.Background:Hide() - self.Background:Hide() + -- for LDBIcon-1.0 + GetMinimapShape = theBodyIsRound + else + self:SetArchBlobRingScalar(0) + self:SetQuestBlobRingScalar(0) + self:SetTaskBlobRingScalar(0) + self:SetMaskTexture("Interface\\BUTTONS\\WHITE8X8") - -- for LDBIcon-1.0 - GetMinimapShape = theBodyIsRound - else - self:SetArchBlobRingScalar(0) - self:SetQuestBlobRingScalar(0) - self:SetTaskBlobRingScalar(0) - self:SetMaskTexture("Interface\\BUTTONS\\WHITE8X8") + Minimap.Background:Show() - Minimap.Background:Show() + -- for LDBIcon-1.0 + GetMinimapShape = theBodyIsSquare + end - -- for LDBIcon-1.0 - GetMinimapShape = theBodyIsSquare - end + MinimapCluster:SetSize(info[3] + 24, info[3] + 24) + E.Movers:Get(MinimapCluster):UpdateSize() - MinimapCluster:SetSize(info[3] + 24, info[3] + 24) - E.Movers:Get(MinimapCluster):UpdateSize() + self:SetSize(info[3] - 22, info[3] - 22) + self:ClearAllPoints() - self:SetSize(info[3] - 22, info[3] - 22) - self:ClearAllPoints() + MinimapCluster.BorderTop:ClearAllPoints() + MinimapCluster.BorderTop:SetPoint("LEFT", "Minimap", "LEFT", 1, 0) + MinimapCluster.BorderTop:SetPoint("RIGHT", "Minimap", "RIGHT", -1, 0) - MinimapCluster.BorderTop:ClearAllPoints() - MinimapCluster.BorderTop:SetPoint("LEFT", "Minimap", "LEFT", 1, 0) - MinimapCluster.BorderTop:SetPoint("RIGHT", "Minimap", "RIGHT", -1, 0) + if self._config.flip then + self:SetPoint("CENTER", "MinimapCluster", "CENTER", 0, 8, true) - MinimapCluster.InstanceDifficulty:ClearAllPoints() - MinimapCluster.InstanceDifficulty:SetPoint("TOPRIGHT", MinimapCluster, "TOPRIGHT", -2, -24) + MinimapCluster.BorderTop:SetPoint("BOTTOM", "MinimapCluster", "BOTTOM", 0, 1) - if self._config.flip then - self:SetPoint("CENTER", "MinimapCluster", "CENTER", 0, 8, true) + MinimapCluster.MailFrame:ClearAllPoints() + MinimapCluster.MailFrame:SetPoint("BOTTOMLEFT", MinimapCluster.Tracking, "TOPLEFT", -1, 2) + else + self:SetPoint("CENTER", "MinimapCluster", "CENTER", 0, -8, true) - MinimapCluster.BorderTop:SetPoint("BOTTOM", "MinimapCluster", "BOTTOM", 0, 1) + MinimapCluster.BorderTop:SetPoint("TOP", "MinimapCluster", "TOP", 0, -1) - MinimapCluster.MailFrame:ClearAllPoints() - MinimapCluster.MailFrame:SetPoint("BOTTOMLEFT", MinimapCluster.Tracking, "TOPLEFT", -1, 2) - else - self:SetPoint("CENTER", "MinimapCluster", "CENTER", 0, -8, true) + MinimapCluster.MailFrame:ClearAllPoints() + MinimapCluster.MailFrame:SetPoint("TOPLEFT", MinimapCluster.Tracking, "BOTTOMLEFT", -1, -2) + end - MinimapCluster.BorderTop:SetPoint("TOP", "MinimapCluster", "TOP", 0, -1) + if HybridMinimap then + self:UpdateHybridMinimap() + end + end - MinimapCluster.MailFrame:ClearAllPoints() - MinimapCluster.MailFrame:SetPoint("TOPLEFT", MinimapCluster.Tracking, "BOTTOMLEFT", -1, -2) + function minimap_proto:UpdateRotation() + SetCVar("rotateMinimap", self._config.rotate) end - if HybridMinimap then - updateHybridMinimap() + function minimap_proto:UpdateDifficultyFlag() + if self._config.flag.enabled then + self.DifficultyFlag:RegisterForEvents() + self.DifficultyFlag:UpdateMouseScripts(self._config.flag.tooltip) + self.DifficultyFlag:Update() + else + self.DifficultyFlag:UnregisterAllEvents() + self.DifficultyFlag:Hide() + end end end -function minimap_proto:UpdateRotation() - SetCVar("rotateMinimap", self._config.rotate) +local flag_proto = { + ["events"] = { + "GROUP_ROSTER_UPDATE", + "INSTANCE_GROUP_SIZE_CHANGED", + "PARTY_MEMBER_DISABLE", + "PARTY_MEMBER_ENABLE", + "PLAYER_DIFFICULTY_CHANGED", + "UPDATE_INSTANCE_INFO", + }, +} + +do + local GUILD_ACHIEVEMENTS_ELIGIBLE = _G.GUILD_ACHIEVEMENTS_ELIGIBLE:gsub("(%%.-[sd])", "|cffffffff%1|r") + + local flagInfo = { + ["lfr"] = {193 / 512, 257 / 512, 1 / 256, 65 / 256}, + ["normal"] = {257 / 512, 321 / 512, 1 / 256, 65 / 256}, + ["heroic"] = {321 / 512, 385 / 512, 1 / 256, 65 / 256}, + ["mythic"] = {385 / 512, 449 / 512, 1 / 256, 65 / 256}, + ["challenge"] = {193 / 512, 257 / 512, 65 / 256, 129 / 256}, + } + + function flag_proto:RegisterForEvents() + for _, event in next, self.events do + self:RegisterEvent(event) + end + end + + function flag_proto:UpdateMouseScripts(enabled) + self:SetScript("OnEnter", enabled and self.OnEnter or nil) + self:SetScript("OnLeave", enabled and self.OnLeave or nil) + self:SetMouseClickEnabled(false) + end + + function flag_proto:OnEvent() + self:Update() + end + + function flag_proto:OnEnter() + if self.instanceName then + local p, rP, x, y = E:GetTooltipPoint(self) + if p == "TOPRIGHT" then + x, y = 24, 24 + end + + GameTooltip:SetOwner(self, "ANCHOR_NONE") + GameTooltip:SetPoint(p, self, rP, x, y) + GameTooltip:SetText(self.instanceName, 1, 1, 1) + GameTooltip:AddLine(self.difficultyName) + + local inGroup, _, numGuildRequired = InGuildParty() + if inGroup then + GameTooltip:AddLine(" ") + GameTooltip:AddLine(GUILD_ACHIEVEMENTS_ELIGIBLE:format(numGuildRequired, self.maxPlayers, GetGuildInfo()), nil, nil, nil, true) + + end + + GameTooltip:Show() + end + end + + function flag_proto:OnLeave() + GameTooltip:Hide() + end + + function flag_proto:UpdateFlag(t) + self.Icon:SetTexCoord(unpack(flagInfo[t])) + end + + function flag_proto:Update() + self.instanceName = nil + self.difficultyName = nil + self.maxPlayers = nil + self:Hide() + + local instanceName, instanceType, difficultyID, _, maxPlayers = GetInstanceInfo() + if instanceType == "raid" or instanceType == "party" then + local difficultyName, _, isHeroic, isChallengeMode, displayHeroic, displayMythic, _, isLFR = GetDifficultyInfo(difficultyID) + + self.instanceName = instanceName + self.difficultyName = difficultyName + self.maxPlayers = maxPlayers + + if isChallengeMode then + self:UpdateFlag("challenge") + elseif isLFR then + self:UpdateFlag("lfr") + elseif displayMythic then + self:UpdateFlag("mythic") + elseif isHeroic or displayHeroic then + self:UpdateFlag("heroic") + else + self:UpdateFlag("normal") + end + + self:Show() + elseif instanceType == "scenario" then + local difficultyName, _, isHeroic, _, displayHeroic, displayMythic = GetDifficultyInfo(difficultyID) + if not (isHeroic or displayHeroic or displayMythic) then return end + + self.instanceName = instanceName + self.difficultyName = difficultyName + self.maxPlayers = maxPlayers + + if displayMythic then + self:UpdateFlag("mythic") + elseif isHeroic or displayHeroic then + self:UpdateFlag("heroic") + end + + self:Show() + end + end end function MODULE:IsInit() @@ -217,6 +349,7 @@ function MODULE:Init() local indicator = MinimapCluster.BorderTop:CreateTexture(nil, "BACKGROUND", nil, 1) indicator:SetTexture("Interface\\Minimap\\HumanUITile-TimeIndicator", true) + indicator:SetVertexColor(0.85, 0.85, 0.85, 1) indicator:SetPoint("TOPRIGHT", -1, -1) indicator:SetPoint("BOTTOMLEFT", MinimapCluster.BorderTop, "BOTTOMRIGHT", -65, 2) indicator:AddMaskTexture(mask) @@ -227,7 +360,26 @@ function MODULE:Init() scrollTexture(indicator, (mult + 1) * DELAY - s, STEP * mult) - -- E:ForceShow(MinimapCluster.InstanceDifficulty) + E:ForceHide(MinimapCluster.InstanceDifficulty) + + local difficultyFlag = Mixin(CreateFrame("Frame", nil, MinimapCluster), flag_proto) + difficultyFlag:SetFrameLevel(Minimap:GetFrameLevel() + 2) + difficultyFlag:SetScript("OnEvent", difficultyFlag.OnEvent) + difficultyFlag:SetPoint("TOPRIGHT", Minimap, "TOPRIGHT", -0, -1) + difficultyFlag:SetSize(48, 48) + difficultyFlag:Hide() + Minimap.DifficultyFlag = difficultyFlag + + local flagBorder = difficultyFlag:CreateTexture(nil, "OVERLAY") + flagBorder:SetAllPoints() + flagBorder:SetTexture("Interface\\AddOns\\ls_UI\\assets\\minimap-flags") + difficultyFlag.Border = flagBorder + + local flagIcon = difficultyFlag:CreateTexture(nil, "BACKGROUND") + flagIcon:SetPoint("TOPRIGHT", -5, -4) + flagIcon:SetSize(32, 32) + flagIcon:SetTexture("Interface\\AddOns\\ls_UI\\assets\\minimap-flags") + difficultyFlag.Icon = flagIcon hooksecurefunc(MinimapCluster, "SetHeaderUnderneath", function() Minimap:UpdateConfig() @@ -260,23 +412,24 @@ function MODULE:Init() MinimapCluster.ZoneTextButton:SetPoint("TOPLEFT", MinimapCluster.BorderTop, "TOPLEFT", 4, 0) MinimapCluster.ZoneTextButton:SetPoint("TOPRIGHT", MinimapCluster.BorderTop, "TOPRIGHT", -48, 0) - MinimapZoneText:SetSize(0, 16) + MinimapZoneText:SetSize(0, 0) MinimapZoneText:ClearAllPoints() - MinimapZoneText:SetPoint("LEFT", 2, 1) - MinimapZoneText:SetPoint("RIGHT", -2, 1) + MinimapZoneText:SetPoint("TOPLEFT", 2, 0) + MinimapZoneText:SetPoint("BOTTOMRIGHT", -2, 0) MinimapZoneText:SetJustifyH("LEFT") MinimapZoneText:SetJustifyV("MIDDLE") TimeManagerClockButton:ClearAllPoints() TimeManagerClockButton:SetPoint("TOPRIGHT", MinimapCluster.BorderTop, "TOPRIGHT", -4, 0) + TimeManagerClockTicker:SetSize(0, 0) + TimeManagerClockTicker:ClearAllPoints() + TimeManagerClockTicker:SetPoint("TOPRIGHT", 0, 0) + TimeManagerClockTicker:SetPoint("BOTTOMLEFT", 0, 0) + TimeManagerClockTicker:SetFontObject("GameFontNormal") TimeManagerClockTicker:SetJustifyH("RIGHT") TimeManagerClockTicker:SetJustifyV("MIDDLE") - TimeManagerClockTicker:SetFontObject("GameFontNormal") TimeManagerClockTicker:SetTextColor(1, 1, 1) - TimeManagerClockTicker:SetSize(40, 16) - TimeManagerClockTicker:ClearAllPoints() - TimeManagerClockTicker:SetPoint("CENTER", 0, 1) GameTimeFrame:ClearAllPoints() GameTimeFrame:SetPoint("TOPLEFT", MinimapCluster.BorderTop, "TOPRIGHT", 4, 0) @@ -290,7 +443,7 @@ function MODULE:Init() end if not HybridMinimap then - E:AddOnLoadTask("Blizzard_HybridMinimap", updateHybridMinimap) + E:AddOnLoadTask("Blizzard_HybridMinimap", self.UpdateHybridMinimap) end E:SetUpFading(MinimapCluster) @@ -306,6 +459,7 @@ function MODULE:Update() Minimap:UpdateConfig() Minimap:UpdateLayout() Minimap:UpdateBorderColor() + Minimap:UpdateDifficultyFlag() MinimapCluster:UpdateFading() end end diff --git a/ls_UI/modules/unitframes/core.lua b/ls_UI/modules/unitframes/core.lua index 10b186f6..403e2af9 100644 --- a/ls_UI/modules/unitframes/core.lua +++ b/ls_UI/modules/unitframes/core.lua @@ -122,6 +122,16 @@ function UF:UpdateTags() end end +function UF:UpdateBlizzCastbars() + if not C.db.profile.units.player.castbar.enabled and C.db.profile.units.player.castbar.blizz_enabled then + PlayerCastingBarFrame:OnLoad() + PetCastingBarFrame:PetCastingBar_OnLoad() + else + PlayerCastingBarFrame:SetUnit(nil) + PetCastingBarFrame:SetUnit(nil) + end +end + local eventlessUnits = { ["boss6"] = true, ["boss7"] = true, diff --git a/ls_UI/modules/unitframes/elements/castbar.lua b/ls_UI/modules/unitframes/elements/castbar.lua index bc57b4bc..9b5995b0 100644 --- a/ls_UI/modules/unitframes/elements/castbar.lua +++ b/ls_UI/modules/unitframes/elements/castbar.lua @@ -200,7 +200,7 @@ function frame_proto:UpdateCastbar() self:DisableElement("Castbar") element.Holder:Hide() - if self.__unit == "player" then + if self.__unit == "player" and not element._config.blizz_enabled then PlayerCastingBarFrame:SetUnit(nil) PetCastingBarFrame:SetUnit(nil) end diff --git a/ls_UI_Options/minimap.lua b/ls_UI_Options/minimap.lua index 13f857c6..b19bfe2f 100644 --- a/ls_UI_Options/minimap.lua +++ b/ls_UI_Options/minimap.lua @@ -92,6 +92,7 @@ function CONFIG:CreateMinimapOptions(order) Minimap:UpdateLayout() end end, + disabled = isModuleDisabled, }, flip = { order = inc(1), @@ -106,6 +107,7 @@ function CONFIG:CreateMinimapOptions(order) Minimap:UpdateConfig() Minimap:UpdateLayout() end, + disabled = isModuleDisabled, }, rotate = { order = inc(1), @@ -120,6 +122,7 @@ function CONFIG:CreateMinimapOptions(order) Minimap:UpdateConfig() Minimap:UpdateRotation() end, + disabled = isModuleDisabled, }, spacer_2 = { order = inc(1), @@ -154,6 +157,42 @@ function CONFIG:CreateMinimapOptions(order) type = "description", name = " ", }, + flag = { + order = inc(1), + type = "group", + name = L["DIFFICULTY_FLAG"], + inline = true, + get = function(info) + return C.db.profile.minimap.flag[info[#info]] + end, + set = function(info, value) + C.db.profile.minimap.flag[info[#info]] = value + + Minimap:UpdateConfig() + Minimap:UpdateDifficultyFlag() + end, + disabled = isModuleDisabled, + args = { + enabled = { + order = reset(2), + type = "toggle", + name = L["ENABLE"], + }, + tooltip = { + order = inc(2), + type = "toggle", + name = L["TOOLTIP"], + disabled = function() + return isModuleDisabled() or not C.db.profile.minimap.flag.enabled + end + }, + }, + }, + spacer_7 = { + order = inc(1), + type = "description", + name = " ", + }, fading = { order = inc(1), type = "group", diff --git a/ls_UI_Options/unitframes/castbar.lua b/ls_UI_Options/unitframes/castbar.lua index 76cc617b..a982e1ac 100644 --- a/ls_UI_Options/unitframes/castbar.lua +++ b/ls_UI_Options/unitframes/castbar.lua @@ -42,9 +42,25 @@ function CONFIG:CreateUnitFrameCastbarOptions(order, unit) end end, args = { - enabled = { + blizz_enabled = { order = reset(1), type = "toggle", + name = L["ENABLE_BLIZZARD_CASTBAR"], + get = function() + return C.db.profile.units[unit].castbar.blizz_enabled + end, + set = function(_, value) + C.db.profile.units[unit].castbar.blizz_enabled = value + + UNITFRAMES:UpdateBlizzCastbars() + end, + hidden = function() + return C.db.profile.units[unit].castbar.enabled + end, + }, + enabled = { + order = inc(1), + type = "toggle", name = L["ENABLE"], }, reset = { @@ -161,6 +177,7 @@ function CONFIG:CreateUnitFrameCastbarOptions(order, unit) } if unit ~= "player" then + temp.args.blizz_enabled = nil temp.args.latency = nil temp.args.spacer_2 = nil end diff --git a/ls_UI_Options/unitframes/core.lua b/ls_UI_Options/unitframes/core.lua index cea14358..8ff858f8 100644 --- a/ls_UI_Options/unitframes/core.lua +++ b/ls_UI_Options/unitframes/core.lua @@ -63,7 +63,7 @@ local function getUnitFrameOptions(order, unit, name) end, get = function() end, set = function(_, value) - CONFIG:CopySettings(C.db.profile.units[value], C.db.profile.units[unit]) + CONFIG:CopySettings(C.db.profile.units[value], C.db.profile.units[unit], {["blizz_enabled"] = true}) UNITFRAMES:For(unit, "Update") end, }, -- 2