Hard embed LibDataBroker-1.1 and use it. Add LibDBIcon-1.0 external. Add minimap button option, default shown.

This commit is contained in:
Xinhuan
2008-10-31 08:35:26 +08:00
parent 908f14e013
commit 0ee193de54
10 changed files with 128 additions and 23 deletions
+1
View File
@@ -15,3 +15,4 @@ externals:
Libs/LibSharedMedia-3.0: svn://svn.wowace.com/wow/libsharedmedia-3-0/mainline/trunk/LibSharedMedia-3.0
Libs/AceGUI-3.0-SharedMediaWidgets: svn://svn.wowace.com/wow/ace-gui-3-0-shared-media-widgets/mainline/trunk/AceGUI-3.0-SharedMediaWidgets
Libs/LibSink-2.0: svn://svn.wowace.com/wow/libsink-2-0/mainline/trunk/LibSink-2.0
Libs/LibDBIcon-1.0: svn://svn.wowace.com/wow/libdbicon-1-0/mainline/trunk/LibDBIcon-1.0
@@ -0,0 +1,66 @@
assert(LibStub, "LibDataBroker-1.1 requires LibStub")
assert(LibStub:GetLibrary("CallbackHandler-1.0", true), "LibDataBroker-1.1 requires CallbackHandler-1.0")
local lib, oldminor = LibStub:NewLibrary("LibDataBroker-1.1", 3)
if not lib then return end
oldminor = oldminor or 0
lib.callbacks = lib.callbacks or LibStub:GetLibrary("CallbackHandler-1.0"):New(lib)
lib.attributestorage, lib.namestorage, lib.proxystorage = lib.attributestorage or {}, lib.namestorage or {}, lib.proxystorage or {}
local attributestorage, namestorage, callbacks = lib.attributestorage, lib.namestorage, lib.callbacks
if oldminor < 2 then
lib.domt = {
__metatable = "access denied",
__index = function(self, key) return attributestorage[self] and attributestorage[self][key] end,
}
end
if oldminor < 3 then
lib.domt.__newindex = function(self, key, value)
if not attributestorage[self] then attributestorage[self] = {} end
if attributestorage[self][key] == value then return end
attributestorage[self][key] = value
local name = namestorage[self]
if not name then return end
callbacks:Fire("LibDataBroker_AttributeChanged", name, key, value, self)
callbacks:Fire("LibDataBroker_AttributeChanged_"..name, name, key, value, self)
callbacks:Fire("LibDataBroker_AttributeChanged_"..name.."_"..key, name, key, value, self)
callbacks:Fire("LibDataBroker_AttributeChanged__"..key, name, key, value, self)
end
end
if oldminor < 2 then
function lib:NewDataObject(name, dataobj)
if self.proxystorage[name] then return end
if dataobj then
assert(type(dataobj) == "table", "Invalid dataobj, must be nil or a table")
self.attributestorage[dataobj] = {}
for i,v in pairs(dataobj) do
self.attributestorage[dataobj][i] = v
dataobj[i] = nil
end
end
dataobj = setmetatable(dataobj or {}, self.domt)
self.proxystorage[name], self.namestorage[dataobj] = dataobj, name
self.callbacks:Fire("LibDataBroker_DataObjectCreated", name, dataobj)
return dataobj
end
end
if oldminor < 1 then
function lib:DataObjectIterator()
return pairs(self.proxystorage)
end
function lib:GetDataObjectByName(dataobjectname)
return self.proxystorage[dataobjectname]
end
function lib:GetNameByDataObject(dataobject)
return self.namestorage[dataobject]
end
end
+5 -3
View File
@@ -33,12 +33,14 @@ L["Alpha"] = "Sichtbarkeit"
L["Controls the transparency of the main Omen window."] = "Kontrolliert die Sichtbarkeit des Omen Hauptfensters"
L["Scale"] = "Skalierung"
L["Controls the scaling of the main Omen window."] = "Kontrolliert die Skalierung des Omen Hauptfensters"
L["Tells Omen to additionally check your 'focus' and 'focustarget' before your 'target' and 'targettarget' in that order for threat display."] = true
L["Tells Omen to enter Test Mode so that you can configure Omen's display much more easily."] = true
L["Autocollapse"] = "Automatisches Zusammenklappen"
L["Tells Omen to additionally check your 'focus' and 'focustarget' before your 'target' and 'targettarget' in that order for threat display."] = "Lässt Omen zusätzlich den Fokus und das Fokusziel vor dem Ziel und dem Ziel des Ziels für die Bedrohungsanzeige überprüfen"
L["Tells Omen to enter Test Mode so that you can configure Omen's display much more easily."] = "Startet den Omen Testmodus um das Einstellen der Anzeige zu vereinfachen"
L["Collapse to show a minimum number of bars"] = "Zusammenklappen um nur eine minimale Anzahl an Balken zu zeigen"
L["Lock Omen"] = "Omen verankern"
L["Locks Omen in place and prevents it from being dragged or resized."] = "Verankert Omen um zu verhindern, dass es verschoben oder die Größe geändert wird."
L["Show minimap button"] = "Zeige Minimap Icon"
L["Show the Omen minimap button"] = "Zeige das Omen Minimap Icon"
L["Autocollapse"] = "Automatisches Zusammenklappen"
L["Autocollapse Options"] = "Optionen für das automatische Zusammenklappen"
L["Grow bars upwards"] = "Balken nach oben aufbauen"
L["Hide Omen on 0 bars"] = "Omen ausblenden wenn keine Balken vorhanden sind"
+3 -1
View File
@@ -35,10 +35,12 @@ L["Scale"] = true
L["Controls the scaling of the main Omen window."] = true
L["Tells Omen to additionally check your 'focus' and 'focustarget' before your 'target' and 'targettarget' in that order for threat display."] = true
L["Tells Omen to enter Test Mode so that you can configure Omen's display much more easily."] = true
L["Autocollapse"] = true
L["Collapse to show a minimum number of bars"] = true
L["Lock Omen"] = true
L["Locks Omen in place and prevents it from being dragged or resized."] = true
L["Show minimap button"] = true
L["Show the Omen minimap button"] = true
L["Autocollapse"] = true
L["Autocollapse Options"] = true
L["Grow bars upwards"] = true
L["Hide Omen on 0 bars"] = true
+3 -1
View File
@@ -35,10 +35,12 @@ L["Scale"] = "Échelle"
L["Controls the scaling of the main Omen window."] = "Contrôle l'échelle de la fenêtre principale de Omen."
L["Tells Omen to additionally check your 'focus' and 'focustarget' before your 'target' and 'targettarget' in that order for threat display."] = true
L["Tells Omen to enter Test Mode so that you can configure Omen's display much more easily."] = true
L["Autocollapse"] = "Réduire auto."
L["Collapse to show a minimum number of bars"] = "Réduit Omen afin de n'afficher qu'un nombre minimal de barres."
L["Lock Omen"] = "Verrouiller Omen"
L["Locks Omen in place and prevents it from being dragged or resized."] = "Verrouille Omen afin d'empêcher tout déplacement ou redimensionnement de la fenêtre."
L["Show minimap button"] = true
L["Show the Omen minimap button"] = true
L["Autocollapse"] = "Réduire auto."
L["Autocollapse Options"] = "Options de la réduction automatique"
L["Grow bars upwards"] = "Ajouter vers le haut"
L["Hide Omen on 0 bars"] = "Cacher si 0 barre"
+3 -1
View File
@@ -35,10 +35,12 @@ L["Scale"] = "크기"
L["Controls the scaling of the main Omen window."] = "Omen 창의 크기를 조절합니다."
L["Tells Omen to additionally check your 'focus' and 'focustarget' before your 'target' and 'targettarget' in that order for threat display."] = true
L["Tells Omen to enter Test Mode so that you can configure Omen's display much more easily."] = true
L["Autocollapse"] = "자동 접기"
L["Collapse to show a minimum number of bars"] = "최소한의 바를 표시하기 위해 접기를 합니다."
L["Lock Omen"] = "Omen 잠금"
L["Locks Omen in place and prevents it from being dragged or resized."] = "Omen의 위치나 크기를 조절하지 못하도록 잠급니다."
L["Show minimap button"] = true
L["Show the Omen minimap button"] = true
L["Autocollapse"] = "자동 접기"
L["Autocollapse Options"] = "자동 접기 옵션"
L["Grow bars upwards"] = "바 위로 확장"
L["Hide Omen on 0 bars"] = "바가 0일때 Omen 숨김"
+3 -1
View File
@@ -35,10 +35,12 @@ L["Scale"] = "缩放"
L["Controls the scaling of the main Omen window."] = "控制 Omen 主窗口的尺寸。"
L["Tells Omen to additionally check your 'focus' and 'focustarget' before your 'target' and 'targettarget' in that order for threat display."] = true
L["Tells Omen to enter Test Mode so that you can configure Omen's display much more easily."] = true
L["Autocollapse"] = "自动收起"
L["Collapse to show a minimum number of bars"] = "收起以显示最小数量的计量条"
L["Lock Omen"] = "锁定 Omen"
L["Locks Omen in place and prevents it from being dragged or resized."] = "锁定 Omen,使其无法移动或拉伸。"
L["Show minimap button"] = true
L["Show the Omen minimap button"] = true
L["Autocollapse"] = "自动收起"
L["Autocollapse Options"] = "自动收起选项"
L["Grow bars upwards"] = "计量条向上生长"
L["Hide Omen on 0 bars"] = "当没有计量条时隐藏 Omen"
+3 -1
View File
@@ -35,10 +35,12 @@ L["Scale"] = "縮放"
L["Controls the scaling of the main Omen window."] = "控制主視窗的尺寸"
L["Tells Omen to additionally check your 'focus' and 'focustarget' before your 'target' and 'targettarget' in that order for threat display."] = true
L["Tells Omen to enter Test Mode so that you can configure Omen's display much more easily."] = true
L["Autocollapse"] = "自動收起"
L["Collapse to show a minimum number of bars"] = "收起以顯示最小數量的計量條"
L["Lock Omen"] = "鎖定Omen"
L["Locks Omen in place and prevents it from being dragged or resized."] = "鎖定Omen, 使其無法移動或拉伸."
L["Show minimap button"] = true
L["Show the Omen minimap button"] = true
L["Autocollapse"] = "自動收起"
L["Autocollapse Options"] = "自動收起設定"
L["Grow bars upwards"] = "計量條向上成長"
L["Hide Omen on 0 bars"] = "當長條棒數量為零時隱藏Omen"
+36 -14
View File
@@ -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
+5 -1
View File
@@ -8,7 +8,7 @@
## Notes-zhTW: 一個輕量級、有彈性、可監視多個目標的仇恨統計插件。
## Notes-koKR: 다중-대상에 대한 위협수준 미터기로 보여줍니다.
## Author: Xinhuan
## OptionalDeps: Ace3, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, LibSink-2.0
## OptionalDeps: Ace3, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, LibSink-2.0, LibDBIcon-1.0
## X-Category: Combat
## SavedVariables: Omen3DB
@@ -28,6 +28,10 @@ Libs\LibSharedMedia-3.0\lib.xml
Libs\AceGUI-3.0-SharedMediaWidgets\widget.xml
Libs\LibSink-2.0\lib.xml
#@end-no-lib-strip@
Libs\LibDataBroker-1.1\LibDataBroker-1.1.lua
#@no-lib-strip@
Libs\LibDBIcon-1.0\LibDBIcon-1.0.lua
#@end-no-lib-strip@
Localization\enUS.lua
Localization\deDE.lua