/trunk
------------------------------------------------------------------------ |
TODO: |
* Handle Reincarnation with some guesswork? |
* Clear data when releasing spirit |
----------------------------------------------------------------------]] |
local DEBUG_LEVEL = GetAddOnMetadata("LibResInfo-1.0", "Version") and 1 or 0 |
------------------------------------------------------------------------ |
local MAJOR, MINOR = "LibResInfo-1.0", 20 |
local MAJOR, MINOR = "LibResInfo-1.0", 21 |
assert(LibStub, MAJOR.." requires LibStub") |
assert(LibStub("CallbackHandler-1.0"), MAJOR.." requires CallbackHandler-1.0") |
local lib, oldminor = LibStub:NewLibrary(MAJOR, MINOR) |
function lib:UnitHasIncomingRes(unit) |
if type(unit) ~= "string" then return end |
local guid |
if strmatch(unit, "^0x") then |
if strmatch(unit, "^Player%-") then |
guid = unit |
unit = unitFromGUID[guid] |
else |
end |
if hasPending[guid] then |
local state = hasSoulstone[guid] and "SELFRES" or "PENDING" |
--debug(2, "UnitHasIncomingRes", nameFromGUID[guid], state) |
debug(2, "UnitHasIncomingRes", nameFromGUID[guid], state) |
return state, hasPending[guid] |
end |
end |
end |
if state and firstCaster and firstEnd then |
--debug(2, "UnitHasIncomingRes", nameFromGUID[guid], state, nameFromGUID[firstCaster]) |
debug(2, "UnitHasIncomingRes", nameFromGUID[guid], state, nameFromGUID[firstCaster]) |
return state, firstEnd, unitFromGUID[firstCaster], firstCaster |
end |
--debug(3, "UnitHasIncomingRes", nameFromGUID[guid], "nil") |
function lib:UnitIsCastingRes(unit) |
if type(unit) ~= "string" then return end |
local guid |
if strmatch(unit, "^0x") then |
if strmatch(unit, "^Player%-") then |
guid = unit |
unit = unitFromGUID[guid] |
else |
break |
end |
end |
--debug(2, "UnitIsCastingRes", nameFromGUID[guid], "casting on", nameFromGUID[casting.target], isFirst and "(first)" or "(duplicate)") |
debug(2, "UnitIsCastingRes", nameFromGUID[guid], "casting on", nameFromGUID[casting.target], isFirst and "(first)" or "(duplicate)") |
return endTime, unitFromGUID[casting.target], casting.target, isFirst |
end |
break |
end |
end |
--debug(2, "UnitIsCastingRes", nameFromGUID[guid], "casting Mass Res", isFirst and "(first)" or "(duplicate)") |
debug(2, "UnitIsCastingRes", nameFromGUID[guid], "casting Mass Res", isFirst and "(first)" or "(duplicate)") |
return endTime, nil, nil, isFirst |
end |
LibResInfo-1.0 |
================= |
Library to provide information about resurrections cast in your group. |
LibResInfo detects resurrection spell casts and identifies who they are |
being cast on, and provides that information to addons through callbacks |
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 |
in your group to have it installed. |
Requires [LibStub] [1] and [CallbackHandler-1.0] [2]. |
[1]: http://www.wowace.com/addons/libstub/ |
[2]: http://www.wowace.com/addons/callbackhandler/ |
Downloads |
------------ |
* [WoWInterface](http://www.wowinterface.com/downloads/info21467-LibResInfo-1.0.html) |
* [CurseForge](http://wow.curseforge.com/addons/libresinfo/) |
API Documentation |
-------------------- |
Information about the callbacks and functions LibResInfo provides are |
available on the [CurseForge project page] [3]. |
[3]: http://wow.curseforge.com/addons/librescomm/pages/api/ |
Feedback |
----------- |
Please direct all bug reports, suggestions, questions and comments to |
the [WoWInterface forum thread] [4]. |
[4]: http://www.wowinterface.com/forums/showthread.php?t=43933 |
If you are reporting a bug, please include directions I can follow to |
reproduce the bug, whether it still happens when all other addons are |
disabled, and the exact text of the related error message (if any) from |
[Bugger](http://www.wowinterface.com/downloads/info23144-Bugger.html). |
If you need to contact me privately, you can send me a private message |
on either download site, or email me at <addons@phanx.net>. |
License |
---------- |
Copyright (c) 2012-2014 Phanx. All rights reserved. |
See the accompanying LICENSE file for information about the conditions |
under which redistribution and modification may be allowed. |
## Interface: 60000 |
## Version: 20 |
## Version: 21 |
## Title: Lib: ResInfo-1.0 |
## Notes: Library to provide information about resurrections in your group. |
Copyright (c) 2012-2014 Phanx. All rights reserved. |
Permission is granted for anyone to use, read, or otherwise interpret |
this software for any purpose, without any restrictions. |
Permission is granted for anyone to embed or include this software in |
another work not derived from this software that makes use of the |
interface provided by this software for the purpose of creating a |
package of the work and its required libraries, and to distribute such |
packages as long as the software is not modified in any way, including |
by modifying or removing any files. |
Permission is granted for anyone to modify this software or sample from |
it, and to distribute such modified versions or derivative works as long |
as neither the names of this software nor its authors are used in the |
name or title of the work or in any other way that may cause it to be |
confused with or interfere with the simultaneous use of this software. |
This software may not be distributed standalone or in any other way, in |
whole or in part, modified or unmodified, without specific prior written |
permission from the authors of this software. |
The names of this software and/or its authors may not be used to |
promote or endorse works derived from this software without specific |
prior written permission from the authors of this software. |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
OTHER DEALINGS IN THE SOFTWARE. |