mirror of
https://github.com/parnic/ice-hud.git
synced 2025-06-16 14:50:13 -05:00
add TargetCast support in Classic (#8)
This change adds support for using LibCasterCasterino to get your target's casting info to enable the TargetCast module. It's not as clean as the newer retail native calls but works well enough for most interrupts. Note: because LibCasterCasterino is using combat log events to get casting info if a spell cast starts and is immediately cancelled or interrupted the log may not get updated and the cast bar will zombie complete. LibCasterCasterino can be found at: https://github.com/rgd87/LibClassicCasterino
This commit is contained in:
@ -23,6 +23,19 @@ if IceHUD.WowClassic then
|
|||||||
UnitChannelInfo = ChannelInfo
|
UnitChannelInfo = ChannelInfo
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Fulzamoth 2019-09-27 : Use LibClassicCasterino if it's there so we can use TargetCast
|
||||||
|
-- module in Classic WoW
|
||||||
|
if IceHUD.WowClassic then
|
||||||
|
LibClassicCasterino = LibStub("LibClassicCasterino", true)
|
||||||
|
UnitCastingInfo = function(unit)
|
||||||
|
return LibClassicCasterino:UnitCastingInfo(unit)
|
||||||
|
end
|
||||||
|
UnitChannelInfo = function(unit)
|
||||||
|
return LibClassicCasterino:UnitChannelInfo(unit)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- end Fulzamoth change
|
||||||
|
|
||||||
local AuraIconWidth = 20
|
local AuraIconWidth = 20
|
||||||
local AuraIconHeight = 20
|
local AuraIconHeight = 20
|
||||||
|
|
||||||
@ -46,21 +59,55 @@ end
|
|||||||
function IceCastBar.prototype:Enable(core)
|
function IceCastBar.prototype:Enable(core)
|
||||||
IceCastBar.super.prototype.Enable(self, core)
|
IceCastBar.super.prototype.Enable(self, core)
|
||||||
|
|
||||||
self:RegisterEvent("UNIT_SPELLCAST_SENT", "SpellCastSent") -- "player", spell, rank, target
|
-- Fulzamoth 2019-09-27 : LibClassicCasterino support
|
||||||
self:RegisterEvent("CURRENT_SPELL_CAST_CHANGED", "SpellCastChanged")
|
-- Setup callback to the library, and route events to
|
||||||
self:RegisterEvent("UNIT_SPELLCAST_START", "SpellCastStart") -- unit, spell, rank
|
-- IceHUD's handler functions.
|
||||||
self:RegisterEvent("UNIT_SPELLCAST_STOP", "SpellCastStop") -- unit, spell, rank
|
if LibClassicCasterino then
|
||||||
|
local CastbarEventHandler = function(event, ...) -- unitTarget, castGUID, spellID
|
||||||
|
if (event == "UNIT_SPELLCAST_START") then
|
||||||
|
return IceCastBar.prototype.SpellCastStart(self, event, ...)
|
||||||
|
elseif (event == "UNIT_SPELLCAST_DELAYED") then
|
||||||
|
return IceCastBar.prototype.SpellCastDelayed(self, event, ...)
|
||||||
|
elseif (event == "UNIT_SPELLCAST_STOP") then
|
||||||
|
return IceCastBar.prototype.SpellCastStop(self, event, ...)
|
||||||
|
elseif (event == "UNIT_SPELLCAST_FAILED") then
|
||||||
|
return IceCastBar.prototype.SpellCastFailed(self, event, ...)
|
||||||
|
elseif (event == "UNIT_SPELLCAST_INTERRUPTED") then
|
||||||
|
return IceCastBar.prototype.SpellCastInterrupted(self, event, ...)
|
||||||
|
elseif (event == "UNIT_SPELLCAST_CHANNEL_START") then
|
||||||
|
return IceCastBar.prototype.SpellCastChannelStart(self, event, ...)
|
||||||
|
elseif (event == "UNIT_SPELLCAST_CHANNEL_UPDATE") then
|
||||||
|
return IceCastBar.prototype.SpellCastChannelUpdate(self, event, ...)
|
||||||
|
elseif (event == "UNIT_SPELLCAST_CHANNEL_STOP") then
|
||||||
|
return IceCastBar.prototype.SpellCastChannelStop(self, event, ...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
LibClassicCasterino.RegisterCallback(self,"UNIT_SPELLCAST_START", CastbarEventHandler)
|
||||||
|
LibClassicCasterino.RegisterCallback(self,"UNIT_SPELLCAST_DELAYED", CastbarEventHandler) -- only for player
|
||||||
|
LibClassicCasterino.RegisterCallback(self,"UNIT_SPELLCAST_STOP", CastbarEventHandler)
|
||||||
|
LibClassicCasterino.RegisterCallback(self,"UNIT_SPELLCAST_FAILED", CastbarEventHandler)
|
||||||
|
LibClassicCasterino.RegisterCallback(self,"UNIT_SPELLCAST_INTERRUPTED", CastbarEventHandler)
|
||||||
|
LibClassicCasterino.RegisterCallback(self,"UNIT_SPELLCAST_CHANNEL_START", CastbarEventHandler)
|
||||||
|
LibClassicCasterino.RegisterCallback(self,"UNIT_SPELLCAST_CHANNEL_UPDATE", CastbarEventHandler) -- only for player
|
||||||
|
LibClassicCasterino.RegisterCallback(self,"UNIT_SPELLCAST_CHANNEL_STOP", CastbarEventHandler)
|
||||||
|
else -- No LibClassicCasterino, or we're not on Classic, so use IceHUD's normal event handlers.
|
||||||
|
|
||||||
self:RegisterEvent("UNIT_SPELLCAST_FAILED", "SpellCastFailed") -- unit, spell, rank
|
self:RegisterEvent("UNIT_SPELLCAST_SENT", "SpellCastSent") -- "player", spell, rank, target
|
||||||
self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED", "SpellCastInterrupted") -- unit, spell, rank
|
self:RegisterEvent("CURRENT_SPELL_CAST_CHANGED", "SpellCastChanged")
|
||||||
|
self:RegisterEvent("UNIT_SPELLCAST_START", "SpellCastStart") -- unit, spell, rank
|
||||||
|
self:RegisterEvent("UNIT_SPELLCAST_STOP", "SpellCastStop") -- unit, spell, rank
|
||||||
|
|
||||||
self:RegisterEvent("UNIT_SPELLCAST_DELAYED", "SpellCastDelayed") -- unit, spell, rank
|
self:RegisterEvent("UNIT_SPELLCAST_FAILED", "SpellCastFailed") -- unit, spell, rank
|
||||||
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED", "SpellCastSucceeded") -- "player", spell, rank
|
self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED", "SpellCastInterrupted") -- unit, spell, rank
|
||||||
|
|
||||||
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START", "SpellCastChannelStart") -- unit, spell, rank
|
self:RegisterEvent("UNIT_SPELLCAST_DELAYED", "SpellCastDelayed") -- unit, spell, rank
|
||||||
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE", "SpellCastChannelUpdate") -- unit, spell, rank
|
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED", "SpellCastSucceeded") -- "player", spell, rank
|
||||||
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP", "SpellCastChannelStop") -- unit, spell, rank
|
|
||||||
|
|
||||||
|
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START", "SpellCastChannelStart") -- unit, spell, rank
|
||||||
|
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE", "SpellCastChannelUpdate") -- unit, spell, rank
|
||||||
|
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP", "SpellCastChannelStop") -- unit, spell, rank
|
||||||
|
|
||||||
|
end
|
||||||
self:Show(false)
|
self:Show(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -371,8 +418,11 @@ function IceCastBar.prototype:StartBar(action, message)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not spell then
|
-- Fulzamoth 2019-09-27 : LibClassicCasterino won't return spell info on target's failed or interrupted cast
|
||||||
return
|
if LibClassicCasterino and not spell then
|
||||||
|
self:StopBar()
|
||||||
|
elseif not spell then
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if icon ~= nil then
|
if icon ~= nil then
|
||||||
|
@ -65,7 +65,12 @@ function TargetCast.prototype:GetDefaultSettings()
|
|||||||
settings["side"] = IceCore.Side.Right
|
settings["side"] = IceCore.Side.Right
|
||||||
settings["offset"] = 3
|
settings["offset"] = 3
|
||||||
settings["flashInstants"] = "Never"
|
settings["flashInstants"] = "Never"
|
||||||
settings["flashFailures"] = "Never"
|
-- Fulzamoth 2019-09-27 : let the flash handler work if in Classic and LibClassicCasterino exists
|
||||||
|
if LibClassicCasterino then
|
||||||
|
settings["flashFailures"] = ""
|
||||||
|
else
|
||||||
|
settings["flashFailures"] = "Never"
|
||||||
|
end
|
||||||
settings["shouldAnimate"] = false
|
settings["shouldAnimate"] = false
|
||||||
settings["hideAnimationSettings"] = true
|
settings["hideAnimationSettings"] = true
|
||||||
settings["usesDogTagStrings"] = false
|
settings["usesDogTagStrings"] = false
|
||||||
@ -197,7 +202,8 @@ end
|
|||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
-- Fulzamoth 2019-09-27 : load in Classic if LibClassicCasterino exists
|
||||||
-- Load us up
|
-- Load us up
|
||||||
if not IceHUD.WowClassic then
|
if not IceHUD.WowClassic or LibClassicCasterino then
|
||||||
IceHUD.TargetCast = TargetCast:new()
|
IceHUD.TargetCast = TargetCast:new()
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user