Init
This commit is contained in:
commit
5bab60bf97
|
@ -0,0 +1,51 @@
|
|||
local lib = LibStub:NewLibrary("LibCombatLog_data", 1)
|
||||
if not lib then return end
|
||||
local isGUID = LibStub("LibCombatLog").isGUID
|
||||
local mixins = {'CreateDataObject'}
|
||||
local data_methods = data_methods or {}
|
||||
lib.mixinTargets = lib.mixinTargets or {}
|
||||
function lib:CreateDataObject(data, prefix, suffix)
|
||||
if(data) then
|
||||
if(not prefix or not suffix) then
|
||||
prefix, suffix = unpack(LibStub("LibCombatLog"):SplitCLEvent(data[3]))
|
||||
end
|
||||
data['prefix'] = prefix
|
||||
data['suffix'] = suffix
|
||||
for k, v in pairs(data_methods) do
|
||||
data[k] = v
|
||||
end
|
||||
end
|
||||
end
|
||||
function data_methods:HasSource()
|
||||
return isGUID(self[5])
|
||||
end
|
||||
function data_methods:HasDestination()
|
||||
return isGUID(self[9])
|
||||
end
|
||||
function data_methods:HasExtraSource()
|
||||
return isGUID(self[16])
|
||||
end
|
||||
function data_methods:GetSource()
|
||||
if(self:HasSource()) then
|
||||
return { data[5], data[6], data[7] }
|
||||
end
|
||||
end
|
||||
function data_methods:GetDestination()
|
||||
if(self:HasDestination()) then
|
||||
return { data[9], data[10], data[11] }
|
||||
end
|
||||
end
|
||||
function data_methods:GetExtraSource()
|
||||
if(self:HasExtraSource()) then
|
||||
return { data[16], data[17], data[18] }
|
||||
end
|
||||
end
|
||||
function lib:Embed(target)
|
||||
for _,name in pairs(mixins) do
|
||||
target[name] = lib[name]
|
||||
end
|
||||
lib.mixinTargets[target] = true
|
||||
end
|
||||
for target, _ in pairs(lib.mixinTargets) do
|
||||
lib:Embed(target)
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
## Interface: 90002
|
||||
## Name: LibCombatlog_data
|
||||
## Description: Manage combatlog events
|
||||
## OptionalDeps: LibCombatlog
|
||||
LibCombatlog_data.lua
|
Loading…
Reference in New Issue