mirror of
https://github.com/parnic/RepairBroker.git
synced 2025-06-16 17:40:13 -05:00
- removed libs dir/svn:externals and hard-embedded LDB at the root
- fixed up the toc for nolib builds git-svn-id: https://repos.wowace.com/wow/repairbroker/trunk@49 25fea357-c8a7-4792-97eb-cca2a7ef4644
This commit is contained in:
@ -1,66 +1,66 @@
|
|||||||
|
|
||||||
assert(LibStub, "LibDataBroker-1.1 requires LibStub")
|
assert(LibStub, "LibDataBroker-1.1 requires LibStub")
|
||||||
assert(LibStub:GetLibrary("CallbackHandler-1.0", true), "LibDataBroker-1.1 requires CallbackHandler-1.0")
|
assert(LibStub:GetLibrary("CallbackHandler-1.0", true), "LibDataBroker-1.1 requires CallbackHandler-1.0")
|
||||||
|
|
||||||
local lib, oldminor = LibStub:NewLibrary("LibDataBroker-1.1", 3)
|
local lib, oldminor = LibStub:NewLibrary("LibDataBroker-1.1", 3)
|
||||||
if not lib then return end
|
if not lib then return end
|
||||||
oldminor = oldminor or 0
|
oldminor = oldminor or 0
|
||||||
|
|
||||||
|
|
||||||
lib.callbacks = lib.callbacks or LibStub:GetLibrary("CallbackHandler-1.0"):New(lib)
|
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 {}
|
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
|
local attributestorage, namestorage, callbacks = lib.attributestorage, lib.namestorage, lib.callbacks
|
||||||
|
|
||||||
if oldminor < 2 then
|
if oldminor < 2 then
|
||||||
lib.domt = {
|
lib.domt = {
|
||||||
__metatable = "access denied",
|
__metatable = "access denied",
|
||||||
__index = function(self, key) return attributestorage[self] and attributestorage[self][key] end,
|
__index = function(self, key) return attributestorage[self] and attributestorage[self][key] end,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if oldminor < 3 then
|
if oldminor < 3 then
|
||||||
lib.domt.__newindex = function(self, key, value)
|
lib.domt.__newindex = function(self, key, value)
|
||||||
if not attributestorage[self] then attributestorage[self] = {} end
|
if not attributestorage[self] then attributestorage[self] = {} end
|
||||||
if attributestorage[self][key] == value then return end
|
if attributestorage[self][key] == value then return end
|
||||||
attributestorage[self][key] = value
|
attributestorage[self][key] = value
|
||||||
local name = namestorage[self]
|
local name = namestorage[self]
|
||||||
if not name then return end
|
if not name then return end
|
||||||
callbacks:Fire("LibDataBroker_AttributeChanged", name, key, value, self)
|
callbacks:Fire("LibDataBroker_AttributeChanged", name, key, value, self)
|
||||||
callbacks:Fire("LibDataBroker_AttributeChanged_"..name, 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_"..name.."_"..key, name, key, value, self)
|
||||||
callbacks:Fire("LibDataBroker_AttributeChanged__"..key, name, key, value, self)
|
callbacks:Fire("LibDataBroker_AttributeChanged__"..key, name, key, value, self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if oldminor < 2 then
|
if oldminor < 2 then
|
||||||
function lib:NewDataObject(name, dataobj)
|
function lib:NewDataObject(name, dataobj)
|
||||||
if self.proxystorage[name] then return end
|
if self.proxystorage[name] then return end
|
||||||
|
|
||||||
if dataobj then
|
if dataobj then
|
||||||
assert(type(dataobj) == "table", "Invalid dataobj, must be nil or a table")
|
assert(type(dataobj) == "table", "Invalid dataobj, must be nil or a table")
|
||||||
self.attributestorage[dataobj] = {}
|
self.attributestorage[dataobj] = {}
|
||||||
for i,v in pairs(dataobj) do
|
for i,v in pairs(dataobj) do
|
||||||
self.attributestorage[dataobj][i] = v
|
self.attributestorage[dataobj][i] = v
|
||||||
dataobj[i] = nil
|
dataobj[i] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
dataobj = setmetatable(dataobj or {}, self.domt)
|
dataobj = setmetatable(dataobj or {}, self.domt)
|
||||||
self.proxystorage[name], self.namestorage[dataobj] = dataobj, name
|
self.proxystorage[name], self.namestorage[dataobj] = dataobj, name
|
||||||
self.callbacks:Fire("LibDataBroker_DataObjectCreated", name, dataobj)
|
self.callbacks:Fire("LibDataBroker_DataObjectCreated", name, dataobj)
|
||||||
return dataobj
|
return dataobj
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if oldminor < 1 then
|
if oldminor < 1 then
|
||||||
function lib:DataObjectIterator()
|
function lib:DataObjectIterator()
|
||||||
return pairs(self.proxystorage)
|
return pairs(self.proxystorage)
|
||||||
end
|
end
|
||||||
|
|
||||||
function lib:GetDataObjectByName(dataobjectname)
|
function lib:GetDataObjectByName(dataobjectname)
|
||||||
return self.proxystorage[dataobjectname]
|
return self.proxystorage[dataobjectname]
|
||||||
end
|
end
|
||||||
|
|
||||||
function lib:GetNameByDataObject(dataobject)
|
function lib:GetNameByDataObject(dataobject)
|
||||||
return self.namestorage[dataobject]
|
return self.namestorage[dataobject]
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -7,11 +7,13 @@
|
|||||||
## DefaultState: enabled
|
## DefaultState: enabled
|
||||||
## SavedVariables: RepairBrokerDB
|
## SavedVariables: RepairBrokerDB
|
||||||
|
|
||||||
|
#@no-lib-strip@
|
||||||
libs\LibStub\LibStub.lua
|
libs\LibStub\LibStub.lua
|
||||||
libs\CallbackHandler-1.0\CallbackHandler-1.0.lua
|
libs\CallbackHandler-1.0\CallbackHandler-1.0.lua
|
||||||
libs\LibDataBroker-1.1\LibDataBroker-1.1.lua
|
|
||||||
libs\LibQTip-1.0\LibQTip-1.0.lua
|
libs\LibQTip-1.0\LibQTip-1.0.lua
|
||||||
libs\AceLocale-3.0\AceLocale-3.0.xml
|
libs\AceLocale-3.0\AceLocale-3.0.xml
|
||||||
|
#@end-no-lib-strip@
|
||||||
|
LibDataBroker-1.1.lua
|
||||||
|
|
||||||
Locales\enUS.lua
|
Locales\enUS.lua
|
||||||
Locales\zhCN.lua
|
Locales\zhCN.lua
|
||||||
|
Reference in New Issue
Block a user