Commit 9f142ccc authored by Merathilis's avatar Merathilis

Add combat hide options for Minimap Buttons.

Change the combat hide on other elements aswell.
parent beaaff2b
......@@ -48,12 +48,10 @@ local GetSavedInstanceInfo = GetSavedInstanceInfo
local GetNumSavedWorldBosses = GetNumSavedWorldBosses
local GetSavedWorldBossInfo = GetSavedWorldBossInfo
local RequestRaidInfo = RequestRaidInfo
local RegisterStateDriver = RegisterStateDriver
local SecondsToTime = SecondsToTime
local GameTooltip = GameTooltip
local UnitLevel = UnitLevel
local InCombatLockdown = InCombatLockdown
--Global variables that we don't cache, list them here for the mikk's Find Globals script
-- GLOBALS:
local microBar
......@@ -952,18 +950,6 @@ function module:Toggle()
module:UNIT_AURA(nil, "player")
end
function module:PLAYER_REGEN_DISABLED()
if module.db.hideInCombat == true then
microBar:SetAlpha(0)
end
end
function module:PLAYER_REGEN_ENABLED()
if module.db.enable then
microBar:SetAlpha(1)
end
end
function module:UNIT_AURA(_, unit)
if unit ~= "player" then
return
......@@ -997,8 +983,10 @@ function module:Initialize()
self:ForUpdateAll()
self:RegisterEvent("PLAYER_REGEN_DISABLED")
self:RegisterEvent("PLAYER_REGEN_ENABLED")
if module.db.hideInCombat then
RegisterStateDriver(microBar, 'visibility', '[combat] hide;show')
end
self:RegisterEvent("UNIT_AURA")
end
......
......@@ -36,8 +36,7 @@ local C_GarrisonIsPlayerInGarrison = C_Garrison.IsPlayerInGarrison
local C_ToyBox = C_ToyBox
local UnitFactionGroup = UnitFactionGroup
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
--Global variables that we don't cache, list them here for the mikk's Find Globals script
local RegisterStateDriver = RegisterStateDriver
-- GLOBALS: HSplace, LE_GARRISON_TYPE_7_0, TUTORIAL_TITLE31
local loc_panel
......@@ -657,14 +656,6 @@ function module:CHAT_MSG_SKILL()
end
end
function module:PLAYER_REGEN_DISABLED()
if module.db.combathide then loc_panel:SetAlpha(0) end
end
function module:PLAYER_REGEN_ENABLED()
if module.db.enable then loc_panel:SetAlpha(1) end
end
function module:UNIT_AURA(_, unit)
if unit ~= "player" then return end
if module.db.enable and module.db.orderhallhide then
......@@ -702,8 +693,10 @@ function module:Initialize()
self:ForUpdateAll()
self:RegisterEvent("PLAYER_REGEN_DISABLED")
self:RegisterEvent("PLAYER_REGEN_ENABLED")
if module.db.combathide then
RegisterStateDriver(loc_panel, 'visibility', '[combat] hide;show')
end
self:RegisterEvent("UNIT_AURA")
self:RegisterEvent("CHAT_MSG_SKILL")
end
......
......@@ -15,7 +15,10 @@ local tContains,tinsert = tContains, table.insert
local CreateFrame = CreateFrame
local C_PetBattles_IsInBattle = C_PetBattles.IsInBattle
local InCombatLockdown = InCombatLockdown
--Global variables that we don't cache, list them here for mikk's FindGlobals script
local UIParent = UIParent
local UIFrameFadeIn = UIFrameFadeIn
local UIFrameFadeOut = UIFrameFadeOut
local RegisterStateDriver = RegisterStateDriver
-- GLOBALS:
module.Buttons = {}
......@@ -80,43 +83,43 @@ end
function module:HandleBlizzardButtons()
if not self.db['enable'] then return end
if self.db["moveTracker"] and not MiniMapTrackingButton.module then
MiniMapTracking.Show = nil
if self.db["moveTracker"] and not _G.MiniMapTrackingButton.module then
_G.MiniMapTracking.Show = nil
MiniMapTracking:Show()
_G.MiniMapTracking:Show()
MiniMapTracking:SetParent(self.Bar)
MiniMapTracking:SetSize(self.db['iconSize'], self.db['iconSize'])
_G.MiniMapTracking:SetParent(self.Bar)
_G.MiniMapTracking:SetSize(self.db['iconSize'], self.db['iconSize'])
MiniMapTrackingIcon:ClearAllPoints()
MiniMapTrackingIcon:SetPoint('CENTER')
_G.MiniMapTrackingIcon:ClearAllPoints()
_G.MiniMapTrackingIcon:SetPoint('CENTER')
MiniMapTrackingBackground:SetAlpha(0)
MiniMapTrackingIconOverlay:SetAlpha(0)
MiniMapTrackingButton:SetAlpha(0)
_G.MiniMapTrackingBackground:SetAlpha(0)
_G.MiniMapTrackingIconOverlay:SetAlpha(0)
_G.MiniMapTrackingButton:SetAlpha(0)
MiniMapTrackingButton:SetParent(MinimapTracking)
MiniMapTrackingButton:ClearAllPoints()
MiniMapTrackingButton:SetAllPoints(MiniMapTracking)
_G.MiniMapTrackingButton:SetParent(_G.MinimapTracking)
_G.MiniMapTrackingButton:ClearAllPoints()
_G.MiniMapTrackingButton:SetAllPoints(_G.MiniMapTracking)
MiniMapTrackingButton:SetScript('OnMouseDown', nil)
MiniMapTrackingButton:SetScript('OnMouseUp', nil)
_G.MiniMapTrackingButton:SetScript('OnMouseDown', nil)
_G.MiniMapTrackingButton:SetScript('OnMouseUp', nil)
MiniMapTrackingButton:HookScript('OnEnter', function(self)
_G.MiniMapTrackingButton:HookScript('OnEnter', function(self)
MiniMapTracking:SetBackdropBorderColor(unpack(E["media"].rgbvaluecolor))
if module.Bar:IsShown() then
UIFrameFadeIn(module.Bar, 0.2, module.Bar:GetAlpha(), 1)
end
end)
MiniMapTrackingButton:HookScript('OnLeave', function(self)
_G.MiniMapTrackingButton:HookScript('OnLeave', function(self)
MiniMapTracking:SetTemplate()
if module.Bar:IsShown() and module.db['barMouseOver'] then
UIFrameFadeOut(module.Bar, 0.2, module.Bar:GetAlpha(), 0)
end
end)
MiniMapTrackingButton.module = true
tinsert(self.Buttons, MiniMapTracking)
_G.MiniMapTrackingButton.module = true
tinsert(self.Buttons, _G.MiniMapTracking)
end
if self.db["moveQueue"] and not QueueStatusMinimapButton.module then
......@@ -359,6 +362,10 @@ function module:Initialize()
module:ScheduleRepeatingTimer('GrabMinimapButtons', 6)
module:ScheduleTimer('HandleBlizzardButtons', 7)
if module.db.hideInCombat then
RegisterStateDriver(module.Bar, 'visibility', '[combat] hide;show')
end
end
MER:RegisterModule(module:GetName())
......@@ -155,47 +155,54 @@ local function Minimap()
name = L["Bar Backdrop"],
disabled = function() return not E.db.mui.smb.enable end,
},
iconSize = {
hideInCombat = {
order = 5,
type = "toggle",
name = L["Hide In Combat"],
disabled = function() return not E.db.mui.smb.enable end,
set = function(info, value) E.db.mui.smb.hideInCombat = value; E:StaticPopup_Show("PRIVATE_RL"); end,
},
iconSize = {
order = 6,
type = "range",
name = L["Icon Size"],
min = 12, max = 48, step = 1,
disabled = function() return not E.db.mui.smb.enable end,
},
buttonSpacing = {
order = 6,
order = 7,
type = "range",
name = L["Button Spacing"],
min = 0, max = 10, step = 1,
disabled = function() return not E.db.mui.smb.enable end,
},
buttonsPerRow = {
order = 7,
order = 8,
type = "range",
name = L["Buttons Per Row"],
min = 1, max = 100, step = 1,
disabled = function() return not E.db.mui.smb.enable end,
},
reverseDirection = {
order = 8,
order = 9,
type = "toggle",
name = L["Reverse Direction"],
disabled = function() return not E.db.mui.smb.enable end,
},
blizzard = {
order = 9,
order = 10,
type = "group",
name = L["Blizzard"],
guiInline = true,
set = function(info, value) E.db.mui.smb[ info[#info] ] = value SMB:Update() SMB:HandleBlizzardButtons() end,
disabled = function() return not E.db.mui.smb.enable end,
args = {
moveTracker = {
moveTracker = {
order = 1,
type = "toggle",
name = L["Move Tracker Icon"],
},
moveQueue = {
moveQueue = {
order = 2,
type = "toggle",
name = L["Move Queue Status Icon"],
......
......@@ -373,6 +373,7 @@ MP.smb = {
enable = true,
barMouseOver = true,
backdrop = true,
hideInCombat = false,
iconSize = 22,
buttonsPerRow = 6,
buttonSpacing = 2,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment