diff --git a/Omen.lua b/Omen.lua index 71d7d0f..8636408 100644 --- a/Omen.lua +++ b/Omen.lua @@ -21,8 +21,8 @@ LoadAddOn("LibDBIcon-1.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") +local LDB = LibStub("LibDataBroker-1.1", true) +local LDBIcon = LDB and LibStub("LibDBIcon-1.0", true) _G["Omen"] = Omen @@ -467,18 +467,22 @@ function Omen:PLAYER_LOGIN() self:UpdateGrips() self:UnregisterEvent("PLAYER_LOGIN") - 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"]) + if LDB then + 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, + 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, + }) + if LDBIcon then + LDBIcon:Register("Omen", OmenLauncher, db.MinimapIcon) + end end -- Optional launcher support for LFBP-3.0 if present, this code is placed here so