/
http://wow.curseforge.com/addons/libresinfo/ |
------------------------------------------------------------------------ |
TODO: |
* Handle Reincarnation |
* Handle Reincarnation with some guesswork? |
----------------------------------------------------------------------]] |
local DEBUG_LEVEL = GetAddOnMetadata("LibResInfo-1.0", "Version") and 1 or 0 |
------------------------------------------------------------------------ |
local MAJOR, MINOR = "LibResInfo-1.0", 18 |
local MAJOR, MINOR = "LibResInfo-1.0", 19 |
assert(LibStub, MAJOR.." requires LibStub") |
assert(LibStub("CallbackHandler-1.0"), MAJOR.." requires CallbackHandler-1.0") |
local lib, oldminor = LibStub:NewLibrary(MAJOR, MINOR) |
wipe(guidFromUnit) |
wipe(nameFromGUID) |
wipe(unitFromGUID) |
for caster, data in pairs(castingSingle) do |
castingSingle[caster] = remTable(data) |
end |
wipe(castingMass) |
wipe(hasPending) |
wipe(hasSoulstone) |
wipe(isDead) |
wipe(isGhost) |
for caster, data in pairs(castingSingle) do |
castingSingle[caster] = remTable(data) |
end |
end |
end |
lib.RegisterCallback(handler, "LibResInfo_MassResStarted", method) |
lib.RegisterCallback(handler, "LibResInfo_MassResCancelled", method) |
lib.RegisterCallback(handler, "LibResInfo_MassResFinished", method) |
lib.RegisterCallback(handler, "LibResInfo_UnitUpdate", method) |
end |
lib.RegisterCallback(handler, "LibResInfo_ResPending", method) |
debug(1, ">> ResExpired", nameFromGUID[guid], "(released)") |
callbacks:Fire("LibResInfo_ResExpired", unit, guid) |
end |
-- No need to check next(castingMass) and fire a UnitUpdate here |
-- since Mass Resurrection will still hit units who released. |
end |
end |
hasPending[guid] = nil |
debug(1, ">> ResExpired", nameFromGUID[guid], "(offline)") |
callbacks:Fire("LibResInfo_ResExpired", unit, guid) |
elseif next(castingMass) then |
for caster, data in pairs(castingSingle) do |
if data.target == guid then |
return |
end |
end |
debug(1, ">> UnitUpdate", nameFromGUID[guid], "(offline)") |
callbacks:Fire("LibResInfo_UnitUpdate", unit, guid) |
end |
end |
hasPending[guid] = endTime |
debug(1, ">> ResPending", nameFromGUID[guid], SOULSTONE) |
callbacks:Fire("LibResInfo_ResPending", unit, guid, endTime, true) |
elseif next(castingMass) then |
debug(1, ">> UnitUpdate", nameFromGUID[guid], "(dead)") |
callbacks:Fire("LibResInfo_UnitUpdate", unit, guid) |
end |
elseif isDead[guid] and not dead then |
hasPending[guid] = nil |
debug(1, ">> ResUsed", nameFromGUID[guid]) |
callbacks:Fire("LibResInfo_ResUsed", unit, guid) |
elseif next(castingMass) then |
for caster, data in pairs(castingSingle) do |
if data.target == guid then |
return |
end |
end |
debug(1, ">> UnitUpdate", nameFromGUID[guid], "(alive)") |
callbacks:Fire("LibResInfo_UnitUpdate", unit, guid) |
end |
end |
end |
LibResInfo detects resurrection spell casts and identifies who they are |
being cast on, and provides that information to addons through callbacks |
and API functions. |
and API functions. It also supports Mass Resurrection and Soulstone. |
LibResInfo was written to replace LibResComm. It works locally without |
the need for addon communication, so it is not necessary for anyone else |
## Interface: 50400 |
## Version: 18 |
## Version: 19 |
## Title: Lib: ResInfo-1.0 |
## Notes: Library to provide information about resurrections. |