mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-15 22:30:13 -05:00
- embedded libdatabroker and removed old fubar code
This commit is contained in:
@ -784,15 +784,6 @@ function IceHUD:InitLDB()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- fubar stuff
|
|
||||||
IceHUD.OnMenuRequest = IceHUD.options
|
|
||||||
IceHUD.hasIcon = "Interface\\Icons\\Spell_Frost_Frost"
|
|
||||||
IceHUD.hideWithoutStandby = true
|
|
||||||
IceHUD.independentProfile = true
|
|
||||||
function IceHUD.OnClick()
|
|
||||||
IceHUD:OpenConfig()
|
|
||||||
end
|
|
||||||
|
|
||||||
-- blizzard interface options
|
-- blizzard interface options
|
||||||
local blizOptionsPanel = CreateFrame("FRAME", "IceHUDConfigPanel", UIParent)
|
local blizOptionsPanel = CreateFrame("FRAME", "IceHUDConfigPanel", UIParent)
|
||||||
blizOptionsPanel.name = "IceHUD"
|
blizOptionsPanel.name = "IceHUD"
|
||||||
|
90
LibDataBroker-1.1.lua
Normal file
90
LibDataBroker-1.1.lua
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
|
||||||
|
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", 4)
|
||||||
|
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
|
||||||
|
|
||||||
|
if oldminor < 4 then
|
||||||
|
local next = pairs(attributestorage)
|
||||||
|
function lib:pairs(dataobject_or_name)
|
||||||
|
local t = type(dataobject_or_name)
|
||||||
|
assert(t == "string" or t == "table", "Usage: ldb:pairs('dataobjectname') or ldb:pairs(dataobject)")
|
||||||
|
|
||||||
|
local dataobj = self.proxystorage[dataobject_or_name] or dataobject_or_name
|
||||||
|
assert(attributestorage[dataobj], "Data object not found")
|
||||||
|
|
||||||
|
return next, attributestorage[dataobj], nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local ipairs_iter = ipairs(attributestorage)
|
||||||
|
function lib:ipairs(dataobject_or_name)
|
||||||
|
local t = type(dataobject_or_name)
|
||||||
|
assert(t == "string" or t == "table", "Usage: ldb:ipairs('dataobjectname') or ldb:ipairs(dataobject)")
|
||||||
|
|
||||||
|
local dataobj = self.proxystorage[dataobject_or_name] or dataobject_or_name
|
||||||
|
assert(attributestorage[dataobj], "Data object not found")
|
||||||
|
|
||||||
|
return ipairs_iter, attributestorage[dataobj], 0
|
||||||
|
end
|
||||||
|
end
|
@ -16,4 +16,5 @@
|
|||||||
<Script file="libs\LibRangeCheck-2.0\LibRangeCheck-2.0.lua"/>
|
<Script file="libs\LibRangeCheck-2.0\LibRangeCheck-2.0.lua"/>
|
||||||
<Include file="libs\LibSharedMedia-3.0\lib.xml"/>
|
<Include file="libs\LibSharedMedia-3.0\lib.xml"/>
|
||||||
<Script file="libs\Deformat-2.0\Deformat-2.0.lua"/>
|
<Script file="libs\Deformat-2.0\Deformat-2.0.lua"/>
|
||||||
|
<Script file="LibDataBroker-1.1.lua"/>
|
||||||
</Ui>
|
</Ui>
|
||||||
|
Reference in New Issue
Block a user