diff --git a/pMinimap/pMinimap.lua b/pMinimap/pMinimap.lua index b65c47e..001c40a 100644 --- a/pMinimap/pMinimap.lua +++ b/pMinimap/pMinimap.lua @@ -55,6 +55,7 @@ local frames = { } function addon.PLAYER_LOGIN(self) + local db = _G.pMinimapDB Minimap:EnableMouseWheel(true) Minimap:SetScript('OnMouseWheel', function(self, dir) if(dir > 0) then @@ -91,7 +92,7 @@ function addon.PLAYER_LOGIN(self) MiniMapMailText:SetTextColor(1, 1, 1) MinimapNorthTag:SetAlpha(0) - DurabilityFrame:SetAlpha(0) + MiniMapMeetingStoneFrame:SetAlpha(0) Minimap:SetMaskTexture('Interface\\ChatFrame\\ChatFrameBackground') Minimap:SetFrameStrata('LOW') @@ -99,7 +100,15 @@ function addon.PLAYER_LOGIN(self) self:SetFrameStrata('BACKGROUND') self:SetAllPoints(Minimap) self:SetBackdrop({bgFile = 'Interface\\ChatFrame\\ChatFrameBackground', insets = {top = -1, left = -1, bottom = -1, right = -1}}) - self:SetBackdropColor(0, 0, 0) + self:SetBackdropColor(0, 0, 0, 0) + + if(db.backdrop) then + self:SetBackdropColor(0, 0, 0, 1) + if(db.durability) then + self:RegisterEvent('UPDATE_INVENTORY_ALERTS') + DurabilityFrame:SetAlpha(0) + end + end for x,obj in pairs(frames) do obj:Hide() end end @@ -115,12 +124,11 @@ function addon.UPDATE_INVENTORY_ALERTS(self) local color = INVENTORY_ALERT_COLORS[maxStatus] if(color) then - self:SetBackdropColor(color.r, color.g, color.b) + self:SetBackdropColor(color.r, color.g, color.b, 1) else - self:SetBackdropColor(0, 0, 0) + self:SetBackdropColor(0, 0, 0, 1) end end addon:SetScript('OnEvent', function(self, event, ...) self[event](self) end) -addon:RegisterEvent('UPDATE_INVENTORY_ALERTS') addon:RegisterEvent('PLAYER_LOGIN') \ No newline at end of file diff --git a/pMinimap/pMinimapConfig.lua b/pMinimap/pMinimapConfig.lua index 754f29f..f8922f7 100644 --- a/pMinimap/pMinimapConfig.lua +++ b/pMinimap/pMinimapConfig.lua @@ -68,25 +68,53 @@ local function Options(self, anchor, db) 'default', true, 'current', db.durability, 'setFunc', function(value) + self:Refresh() db.durability = value + if(db.backdrop) then + if(value) then + pMinimap:RegisterEvent('UPDATE_INVENTORY_ALERTS') + pMinimap.UPDATE_INVENTORY_ALERTS(pMinimap) + DurabilityFrame:SetAlpha(0) + else + pMinimap:UnregisterEvent('UPDATE_INVENTORY_ALERTS') + pMinimap:SetBackdropColor(0, 0, 0, 1) + DurabilityFrame:SetAlpha(1) + end + end + end) + dura:SetPoint('TOPLEFT', scale, 'BOTTOMLEFT', 0, -8) + + local bg = self:MakeToggle( + 'name', 'Toggle Backdrop', + 'description', 'Set whether backdrop is shown or not\nAlso forces durability recoloring', + 'default', true, + 'current', db.backdrop, + 'setFunc', function(value) + self:Refresh() + db.backdrop = value if(value) then - pMinimap:RegisterEvent('UPDATE_INVENTORY_ALERTS') - pMinimap.UPDATE_INVENTORY_ALERTS(pMinimap) - DurabilityFrame:SetAlpha(0) + pMinimap:SetBackdropColor(0, 0, 0, 1) + if(db.durability) then + pMinimap:RegisterEvent('UPDATE_INVENTORY_ALERTS') + pMinimap.UPDATE_INVENTORY_ALERTS(pMinimap) + DurabilityFrame:SetAlpha(0) + end else - pMinimap:UnregisterEvent('UPDATE_INVENTORY_ALERTS') - pMinimap:SetBackdropColor(0, 0, 0) - DurabilityFrame:SetAlpha(1) + pMinimap:SetBackdropColor(0, 0, 0, 0) + if(db.durability) then + pMinimap:UnregisterEvent('UPDATE_INVENTORY_ALERTS') + DurabilityFrame:SetAlpha(1) + end end end) - dura:SetPoint('TOPLEFT', scale, 'BOTTOMLEFT', 0, -8) + bg:SetPoint('TOPLEFT', dura, 'BOTTOMLEFT', 0, -8) end local function OnEvent(self, name) if(name == 'pMinimap') then local db = _G.pMinimapDB if(not db) then - db = { p1 = 'TOPRIGHT', p2 = 'TOPRIGHT', x = -15, y = -15, scale = 0.9, locked = true, durability = true } + db = { p1 = 'TOPRIGHT', p2 = 'TOPRIGHT', x = -15, y = -15, scale = 0.9, locked = true, durability = true, backdrop = true } _G.pMinimapDB = db end