Fix cast logic

This commit is contained in:
Andrew Scott
2021-04-24 12:41:02 -07:00
parent f845e20c05
commit cb84320fed

View File

@ -46,7 +46,22 @@ DogTag:AddEventHandler("Unit", "EventRequested", function(_, event)
local spell, rank, displayName, icon, startTime, endTime
local channeling = false
if CastingInfo then
if UnitCastingInfo then
if cast_api_has_ranks then
spell, rank, displayName, icon, startTime, endTime = UnitCastingInfo(unit)
if not spell then
spell, rank, displayName, icon, startTime, endTime = UnitChannelInfo(unit)
channeling = true
end
else
spell, displayName, icon, startTime, endTime = UnitCastingInfo(unit)
rank = nil
if not spell then
spell, displayName, icon, startTime, endTime = UnitChannelInfo(unit)
channeling = true
end
end
elseif CastingInfo then
-- Classic only has an API for player spellcasts. No API for arbitrary units.
if unit == "player" then
spell, displayName, icon, startTime, endTime = CastingInfo()
@ -56,19 +71,6 @@ DogTag:AddEventHandler("Unit", "EventRequested", function(_, event)
channeling = true
end
end
elseif cast_api_has_ranks then
spell, rank, displayName, icon, startTime, endTime = UnitCastingInfo(unit)
if not spell then
spell, rank, displayName, icon, startTime, endTime = UnitChannelInfo(unit)
channeling = true
end
else
spell, displayName, icon, startTime, endTime = UnitCastingInfo(unit)
rank = nil
if not spell then
spell, displayName, icon, startTime, endTime = UnitChannelInfo(unit)
channeling = true
end
end
if spell then