Hard embed LibDataBroker-1.1 and use it. Add LibDBIcon-1.0 external. Add minimap button option, default shown.
This commit is contained in:
@@ -12,6 +12,8 @@ LoadAddOn("AceGUI-3.0-SharedMediaWidgets")
|
||||
LoadAddOn("LibSink-2.0")
|
||||
LoadAddOn("LibRock-1.0")
|
||||
LoadAddOn("FuBarPlugin-3.0")
|
||||
LoadAddOn("LibDataBroker-1.1")
|
||||
LoadAddOn("LibDBIcon-1.0")
|
||||
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
@@ -19,6 +21,8 @@ LoadAddOn("FuBarPlugin-3.0")
|
||||
local Omen = LibStub("AceAddon-3.0"):NewAddon("Omen", "AceConsole-3.0", "AceEvent-3.0", "AceTimer-3.0", "LibSink-2.0")
|
||||
local L = LibStub("AceLocale-3.0"):GetLocale("Omen", false)
|
||||
local LSM = LibStub("LibSharedMedia-3.0")
|
||||
local LDB = LibStub("LibDataBroker-1.1")
|
||||
local LDBIcon = LibStub("LibDBIcon-1.0")
|
||||
_G["Omen"] = Omen
|
||||
|
||||
|
||||
@@ -156,6 +160,11 @@ local defaults = {
|
||||
SoundFile = "Fel Nova",
|
||||
DisableWhileTanking = true,
|
||||
},
|
||||
MinimapIcon = {
|
||||
hide = false,
|
||||
minimapPos = 220,
|
||||
radius = 80,
|
||||
},
|
||||
},
|
||||
}
|
||||
local guidNameLookup = {} -- Format: guidNameLookup[guid] = "Unit Name"
|
||||
@@ -451,17 +460,18 @@ function Omen:PLAYER_LOGIN()
|
||||
self:UpdateGrips()
|
||||
self:UnregisterEvent("PLAYER_LOGIN")
|
||||
|
||||
-- Optional launcher support for LDB-1.1 if present, this code is placed here so
|
||||
-- that it runs after all other addons have loaded since we don't embed LDB-1.1
|
||||
if LibStub("LibDataBroker-1.1", true) and not IsAddOnLoaded("Broker2FuBar") then
|
||||
local LDB = LibStub("LibDataBroker-1.1", true)
|
||||
local launcher = LDB:NewDataObject("Omen", {
|
||||
type = "launcher",
|
||||
icon = "Interface\\AddOns\\Omen\\icon",
|
||||
OnClick = function(clickedframe, button)
|
||||
if button == "RightButton" then Omen:ShowConfig() else Omen:Toggle() end
|
||||
end,
|
||||
})
|
||||
OmenLauncher = LDB:NewDataObject("Omen", {
|
||||
type = "launcher",
|
||||
icon = "Interface\\AddOns\\Omen\\icon",
|
||||
OnClick = function(clickedframe, button)
|
||||
if button == "RightButton" then Omen:ShowConfig() else Omen:Toggle() end
|
||||
end,
|
||||
})
|
||||
LDBIcon:Register("Omen", OmenLauncher, db.MinimapIcon)
|
||||
OmenLauncher.OnTooltipShow = function(tt)
|
||||
tt:AddLine(self.defaultTitle)
|
||||
tt:AddLine("|cffffff00" .. L["Click|r to toggle the Omen window"])
|
||||
tt:AddLine("|cffffff00" .. L["Right-click|r to open the options menu"])
|
||||
end
|
||||
|
||||
-- Optional launcher support for LFBP-3.0 if present, this code is placed here so
|
||||
@@ -481,6 +491,7 @@ function Omen:PLAYER_LOGIN()
|
||||
self:SetFuBarOption("tooltipHiddenWhenEmpty", true)
|
||||
LFBP:OnEmbedInitialize(self)
|
||||
function Omen:OnUpdateFuBarTooltip()
|
||||
GameTooltip:AddLine(self.defaultTitle)
|
||||
GameTooltip:AddLine("|cffffff00" .. L["Click|r to toggle the Omen window"])
|
||||
GameTooltip:AddLine("|cffffff00" .. L["Right-click|r to open the options menu"])
|
||||
end
|
||||
@@ -1686,11 +1697,22 @@ local options = {
|
||||
Omen:UpdateBars()
|
||||
end,
|
||||
},
|
||||
MinimapIcon = {
|
||||
type = "toggle",
|
||||
name = L["Show minimap button"],
|
||||
desc = L["Show the Omen minimap button"],
|
||||
order = 10,
|
||||
get = function(info) return not db.MinimapIcon.hide end,
|
||||
set = function(info, value)
|
||||
db.MinimapIcon.hide = not value
|
||||
if value then LDBIcon:Show("Omen") else LDBIcon:Hide("Omen") end
|
||||
end,
|
||||
},
|
||||
Autocollapse = {
|
||||
type = "toggle",
|
||||
name = L["Autocollapse"],
|
||||
desc = L["Collapse to show a minimum number of bars"],
|
||||
order = 10,
|
||||
order = 20,
|
||||
set = function(info, value)
|
||||
db.Autocollapse = value
|
||||
Omen.Anchor:SetHeight(6*db.Bar.Height + 5*db.Bar.Spacing + Omen.Title:GetHeight() + 2*db.Background.BarInset)
|
||||
@@ -1704,7 +1726,7 @@ local options = {
|
||||
type = "group",
|
||||
name = L["Autocollapse Options"],
|
||||
guiInline = true,
|
||||
order = 11,
|
||||
order = 21,
|
||||
disabled = function() return not db.Autocollapse end,
|
||||
set = function(info, value)
|
||||
db[ info[#info] ] = value
|
||||
@@ -1741,7 +1763,7 @@ local options = {
|
||||
type = "group",
|
||||
name = L["Background Options"],
|
||||
guiInline = true,
|
||||
order = 21,
|
||||
order = 31,
|
||||
get = function(info) return db.Background[ info[#info] ] end,
|
||||
set = function(info, value)
|
||||
db.Background[ info[#info] ] = value
|
||||
|
||||
Reference in New Issue
Block a user