API description

Getting a library reference

local ResComm = LibStub:GetLibrary("LibResComm-1.0");

Registering a callback

function MyAddon:OnEnable()
    	ResComm.RegisterCallback(self, "ResComm_ResStart");
	ResComm.RegisterCallback(self, "ResComm_CanRes");
end

function MyAddon:ResComm_ResStart(event, resser, endTime, target)
    	SendChatMessage(resser .. " is ressing "..target);
end


function MyAddon:ResComm_CanRes(event, name, typeToken, typeString)
	if typeToken == "SS" then
		SendChatMessage(name.." has been Soulstoned!");
	elseif typeToken == "TN" then
		SendChatMessage(name.." is the proud owner of the Twisting Nether Darkmoon Faire card");
	elseif typeToken == "RE" then
		SendChatMessage(name.." is a Shaman");
	end
	-- if you don't care how the player can self-res
		SendChatMessage(name.." can res themself");
end

Events

ResComm_ResStart(event, resser, endTime, resser)

Note: Messages coming from oRA2 will not have a reliable endTime.

ResComm_ResEnd(event, resser, target, complete)

Fired when a resurrection cast ended. This can either mean it has failed or completed. Use ResComm_Ressed to check if someone actually ressed. complete is true if the cast finished.

ResComm_Ressed(event, name)

Fired when someone actually sees the accept resurrection box.

ResComm_CanRes(event, name, typeToken, typeString)

Fired when someone can use a Soulstone, Ankh, or Twisting Nether. Note: typeString needs localizing within the Lib. Returns "Soulstone", "Twisting Nether", or "Reincarnate" translated for locale.

Phanx's note: Note that for ResComm_CanRes callbacks, both typeToken and typeString will be nil if the sender is running CTRA or oRA2 instead of LibResComm-1.0, so addons wanting to display the type of self-res available should be aware of this and have some fallback in case it's not specified.

ResComm_ResExpired(event, name)

Fired when the accept resurrection box disappears/is declined.

Functions

IsUnitBeingRessed(unit)
-- Boolean, returns resser
if ResComm:IsUnitBeingRessed(unit) then
    print(unit.." is being ressed by "..resser)
end

Comments

  • To post a comment, please or register a new account.
Posts Quoted:
Reply
Clear All Quotes