WoWInterface SVN Aloft

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /branches/option/Aloft/AloftCastWarning
    from Rev 2197 to Rev 2203
    Reverse comparison

Rev 2197 → Rev 2203

AloftCastWarningSpellProcess.lua
800,7 → 800,7
 
-- this is apparently obsolete,
function AloftCastWarning:OnUnitSpellmiss(event, originId, action)
ChatFrame7:AddMessage("AloftCastWarning:OnUnitSpellmiss(): " .. tostring(originId) .. "/" .. tostring(action))
-- ChatFrame7:AddMessage("AloftCastWarning:OnUnitSpellmiss(): " .. tostring(originId) .. "/" .. tostring(action))
-- local originGUId = AloftTargetTrackingData:GetUnitGUId(originId)
-- ChatFrame7:AddMessage("AloftCastWarning:OnUnitSpellmiss(): " .. tostring(originId) .. "/" .. tostring(originGUId) .. "/" .. tostring(spellName) .. "/" .. tostring(spellRank) .. "/" .. "UNIT_SPELLMISSED")
 
856,7 → 856,7
-----------------------------------------------------------------------------
 
function AloftCastWarning:StartActiveLogCast(timestamp, originGUId, originFlags, subtype, spellId, spell)
-- ChatFrame7:AddMessage("AloftCastWarning:StartActiveLogCast(): enter " .. tostring(originGUId) .. "/" .. tostring(originFlags) .. "/" .. tostring(spellId) .. "/" .. tostring(spell and spell.id) .. "/" .. tostring(spell and spell.name))
-- ChatFrame7:AddMessage("AloftCastWarning:StartActiveLogCast(): enter " .. tostring(subtype) .. "/" .. tostring(originGUId) .. "/" .. tostring(originFlags) .. "/" .. tostring(spellId) .. "/" .. tostring(spell and spell.id) .. "/" .. tostring(spell and spell.name))
 
if AloftTargetTrackingData:GetGUIdUnitid(originGUId) then
-- ChatFrame7:AddMessage("AloftCastWarning:StartActiveLogCast(): track UNIT_SPELLCAST_* " .. tostring(originGUId) .. "/" .. tostring(AloftTargetTrackingData:GetGUIdUnitid(originGUId)) .. "/" .. tostring(spellId) .. "/" .. tostring(spell and spell.name) .. "/" .. tostring(spell and spell.rank))
867,12 → 867,18
return -- could not identify spell
end
 
local now = GetTime()
local active = self:GetActiveCastByGUId(originGUId)
if active and active.id == spellId and active.endTime > timestamp then -- same spell, has not finished casting
-- ChatFrame7:AddMessage("AloftCastWarning:StartActiveLogCast(): already active " .. tostring(originGUId) .. "/" .. tostring(AloftTargetTrackingData:GetGUIdUnitid(originGUId)) .. "/" .. tostring(spellId) .. "/" .. tostring(spell and spell.name) .. "/" .. tostring(spell and spell.rank))
return -- stub out if the spell is already active; this allows us to ignore multiple events for the same spell
-- ChatFrame7:AddMessage("AloftCastWarning:StartActiveLogCast(): " .. tostring(subtype) .. "/" .. tostring(originGUId) .. "/" .. tostring(active) .. "/" .. tostring(spell and spell.id) .. "-" .. tostring(active and active.id) .. "/" .. tostring(spell and spell.name) .. "-" .. tostring(active and active.name) .. "/" .. tostring(active and active.rank) .. "/" .. tostring(active and active.noInterrupt) .. "/" .. tostring(active and active.startTime) .. "/" .. tostring(active and active.endTime) .. "/" .. tostring(now))
if active then
-- NOTE: comparing on the basis of (deprecated) name/rank because in certain cases the first tick of a channeled spell
-- has a different spellId than subsequent ticks (example, Warlock Rain of Fire: 5740>42223, as of 2011/04/27)
-- TODO: recheck for this, when possible
if active and spell and active.name == spell.name and active.rank == spell.rank and active.endTime > now then -- same (or functionally equivalent) spell, has not finished casting
-- ChatFrame7:AddMessage("AloftCastWarning:StartActiveLogCast(): already active " .. tostring(originGUId) .. "/" .. tostring(AloftTargetTrackingData:GetGUIdUnitid(originGUId)) .. "/" .. tostring(spellId) .. "/" .. tostring(spell and spell.name) .. "/" .. tostring(spell and spell.rank))
return nil -- stub out if the spell is already active; this allows us to ignore multiple events for the same spell
end
end
active = nil
 
local nameplateId = AloftTargetTrackingData:GetGUIdNameplateId(originGUId)
-- ChatFrame7:AddMessage("AloftCastWarning:StartActiveLogCast(): nameplateId " .. tostring(originGUId) .. "/" .. tostring(nameplateId) .. "/" .. tostring(originFlags) .. "/" .. tostring(subtype) .. "/" .. tostring(spellId) .. "/" .. tostring(spell and spell.name) .. "/" .. tostring(spell and spell.rank))
884,6 → 890,7
if targetId then -- if we have a targetId
-- ChatFrame7:AddMessage("AloftCastWarning:StartActiveLogCast(): iterate targetId " .. tostring(originGUId) .. "/" .. tostring(nameplateId) .. "/" .. tostring(originFlags) .. "/" .. tostring(spellId) .. "/" .. tostring(spell and spell.name) .. "/" .. tostring(spell and spell.rank))
active = self:ProcessActiveCast(originGUId, targetId, spell)
-- ChatFrame7:AddMessage("AloftCastWarning:StartActiveLogCast(): targetId active " .. tostring(active))
-- ChatFrame7:AddMessage("AloftCastWarning:StartActiveLogCast(): active " .. tostring(nameplateId) .. "/" .. tostring(targetId) .. "/" .. tostring(originGUId) .. "/" .. tostring(originFlags) .. "/" .. tostring(active and active.id) .. "/" .. tostring(active and active.name) .. "/" .. tostring(active and active.rank))
else
-- ChatFrame7:AddMessage("AloftCastWarning:StartActiveLogCast(): NO targetId " .. tostring(nameplateId) .. "/" .. tostring(originGUId) .. "/" .. tostring(spellId) .. "/" .. tostring(spellName))
892,21 → 899,24
spell = AloftCastWarning:RecordSpellLogInfo(subtype, spellId, nil, originFlags, nil, false)
end
 
if spell and spell.castTime > 0.0 and (not active or timestamp > active.endTime) then
local now = GetTime()
-- NOTE: comparing on the basis of (deprecated) name/rank because in certain cases the first tick of a channeled spell
-- has a different spellId than subsequent ticks (example, Warlock Rain of Fire: 5740>42223, as of 2011/04/27)
-- TODO: recheck for this, when possible
if spell and spell.castTime > 0.0 and (not active or active.name ~= spell.name or active.rank ~= spell.rank or now > active.endTime) then
-- ChatFrame7:AddMessage("AloftCastWarning:StartActiveLogCast(): anonymous active " .. tostring(active) .. "/" .. tostring(spell.id) .. "/" .. tostring(active and active.id) .. "/" .. tostring(active and active.endTime) .. "/" .. tostring(now))
active = self:AcquireActive(now, now + spell.castTime, spell, nil)
else
-- ChatFrame7:AddMessage("AloftCastWarning:StartActiveLogCast(): failsafe " .. tostring(spellId) .. "/" .. tostring(spellName) .. "/" .. tostring(subtype))
-- ChatFrame7:AddMessage("AloftCastWarning:StartActiveLogCast(): failsafe ".. tostring(originGUId) .. "/" .. tostring(subtype) .. "/" .. tostring(spellId) .. "/" .. tostring(spellName) .. "/" .. tostring(subtype))
end
end
 
self:ReleaseActive(originGUId) -- always release any current active cast; we know either that there is no spell active, or we need to replace with a new one
if active and self.targetGUIdToActiveCast[originGUId] ~= active then
self:ReleaseActive(originGUId) -- if active has changed materially enough (we have a verified targetId, or active is a different spell), release the old one
self.targetGUIdToActiveCast[originGUId] = active
return true
end
end
return false
return nil
end
 
function AloftCastWarning:StartActiveUnitCast(timestamp, targetId, originGUId, subtype, spellName, spellRank, spell)
AloftCastWarning.lua
350,13 → 350,15
local nameplateId = AloftTargetTrackingData:GetNameplateId(aloftData)
local targetGUId = nameplateId and AloftTargetTrackingData:GetNameplateGUId(nameplateId)
local active = targetGUId and self.targetGUIdToActiveCast[targetGUId]
local now = GetTime()
 
-- local layoutFrame = aloftData.layoutFrame
-- local castFrame = AloftCastBar:GetCastFrame()
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): " .. tostring(aloftData.name) .. "/" .. tostring(aloftData.type) .. "/" .. tostring(self.db.profile.players) .. "/" .. tostring(self.db.profile.friendly))
if (not self.db.profile.enable)
or (aloftData.invisible) -- TODO: check aloftData.alphaOverride?
or (aloftData.isTarget or aloftData:IsTarget())
-- or (active and active.endTime <= now)
-- or (aloftData.isTarget or aloftData:IsTarget())
or (not self.db.profile.players and (aloftData.type == "friendlyPlayer" or aloftData.type == "hostilePlayer")) -- TODO: use isPlayer for this? TODO: add a final check for nameplate (class) color (to catch transient color changes)?
or (not self.db.profile.friendly and (aloftData.type == "friendlyPlayer" or aloftData.type == "friendlyNPC")) -- TODO: add a final check for nameplate color (to catch transient color changes)?
-- or (castFrame and layoutFrame and castFrame:GetParent() == layoutFrame and castFrame:IsVisible()) then -- the target cast bar is visible on the current nameplate; disabled for now, redundant: nameplate isTarget check subsumes this
364,13 → 366,14
-- somewhat complex here; IF (any of):
-- > module is disabled (quick check)
-- > the nameplate is invisible (quick check)
-- > we have the current target nameplate (one visible nameplate is almost always guaranteed to be a target, and usually a quick check)
-- <disabled> the associated active spell cast has expired
-- <disabled> we have the current target nameplate (one visible nameplate is almost always guaranteed to be a target, and usually a quick check)
-- > we are not tracking players, but we have a player
-- we check for friendly players first, assuming a PvE application in which most players are friendly (a PvP application would track players and fall through to the friendly check)
-- we check for friendly players first, assuming a PvE application in which most players are friendly (a PvP application would track players and fall through to the friendly check)
-- > we are not tracking friendlies, but we have a friendly (player/NPC)
-- we check for friendly players first, assuming applications in which there will be comparatively few NPCs (presumably no application would track friendlies)
-- we treat neutral NPCs as "hostile" for these purposes, since they are generally attackable NPCs
-- THEN: clear any associated/residual cast warning
-- we check for friendly players first, assuming applications in which there will be comparatively few NPCs (presumably no application would track friendlies)
-- we treat neutral NPCs as "hostile" for these purposes, since they are generally attackable NPCs
-- THEN: cancel any associated active cast warning
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): disable warning " .. tostring(aloftData.name))
if active then
active.disabled = true -- flag this active spell cast as disabled
391,81 → 394,90
 
local targetId
 
if nameplateId then
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): targetGUId " .. tostring(aloftData.name) .. "/" .. tostring(targetGUId))
if targetGUId then
local now = GetTime()
active = self.targetGUIdToActiveCast[targetGUId]
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): spellId " .. tostring(aloftData.name) .. "/" .. tostring(active and active.id) .. "/" .. tostring(active and active.name) .. "/" .. tostring(active and active.rank))
if active and active.startTime and (not aloftData.castWarningFrame or not aloftData.castWarningEndTime or active.startTime >= aloftData.castWarningEndTime) then
local castWarningFrame = self:AcquireCastWarning(aloftData, active.noInterrupt) -- may redundantly return a pre-existing cast bar
self:StopCastEvent(castWarningFrame) -- stop whatever event may be on a pre-existing cast bar
-- at this point, we are interested in a cast warning bar on any identifiable nameplate that is not the current target for any active spell that has not expired
local currentTarget = aloftData.isTarget or aloftData:IsTarget()
if not currentTarget then
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): not current target " .. tostring(aloftData.name))
if nameplateId then
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): nameplateId " .. tostring(aloftData.name) .. "/" .. tostring(nameplateId))
if targetGUId then
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): targetGUId " .. tostring(aloftData.name) .. "/" .. tostring(targetGUId))
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): active " .. tostring(aloftData.name) .. "/" .. tostring(active and active.id) .. "/" .. tostring(aloftData.castWarningFrame) .. "/" .. tostring(aloftData.castWarningEndTime) .. "/" .. tostring(active and active.startTime) .. "/" .. tostring(active and active.endTime) .. "/" .. tostring(now))
if active and active.startTime and (not aloftData.castWarningFrame or not aloftData.castWarningEndTime or active.startTime >= aloftData.castWarningEndTime) and active.endTime > now then
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): start/resume warning " .. tostring(aloftData.name) .. "/" .. tostring(active and active.name))
local castWarningFrame = self:AcquireCastWarning(aloftData, active.noInterrupt) -- may redundantly return a pre-existing cast bar
self:StopCastEvent(castWarningFrame) -- stop whatever event may be on a pre-existing cast bar
 
-- determine the color for the cast warning bar
local color = SPELL_COLOR_NONE
if active.school and active.school > 0 then
for i=1,SCHOOL_COLOR_ORDER_COUNT do
local desc = SCHOOL_COLOR_ORDER[i]
local mask = bit_band(active.school, desc.school)
if mask > 0 then
color = desc.color
break
-- determine the color for the cast warning bar
local color = SPELL_COLOR_NONE
if active.school and active.school > 0 then
for i=1,SCHOOL_COLOR_ORDER_COUNT do
local desc = SCHOOL_COLOR_ORDER[i]
local mask = bit_band(active.school, desc.school)
if mask > 0 then
color = desc.color
break
end
end
end
end
if castWarningFrame.castRegion then castWarningFrame.castRegion:SetVertexColor(unpack(color)) end
if castWarningFrame.castRegion then castWarningFrame.castRegion:SetVertexColor(unpack(color)) end
 
-- assign values
castWarningFrame.nameplateId = nameplateId
castWarningFrame.targetGUId = targetGUId
castWarningFrame.lastVerify = now -- mark last verification as "now", if we are starting a cast warning bar for the first time
-- assign values
castWarningFrame.nameplateId = nameplateId
castWarningFrame.targetGUId = targetGUId
castWarningFrame.lastVerify = now -- mark last verification as "now", if we are starting a cast warning bar for the first time
 
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): show cast warning " .. tostring(aloftData.name) .. "/" .. tostring(castWarningFrame.nameplateId) .. "/" .. tostring(self:GetNameplateTargetId(castWarningFrame.nameplateId)) .. "/" .. tostring(castWarningFrame.targetGUId) .. "/" .. tostring(active.id) .. "/" .. tostring(active.name) .. "/" .. tostring(active.rank) .. "/" .. tostring(active.startTime) .. "/" .. tostring(active.endTime) .. "/" .. tostring(castWarningFrame.event))
self:ShowCastWarning(aloftData)
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): show cast warning " .. tostring(aloftData.name) .. "/" .. tostring(castWarningFrame.nameplateId) .. "/" .. tostring(self:GetNameplateTargetId(castWarningFrame.nameplateId)) .. "/" .. tostring(castWarningFrame.targetGUId) .. "/" .. tostring(active.id) .. "/" .. tostring(active.name) .. "/" .. tostring(active.rank) .. "/" .. tostring(active.startTime) .. "/" .. tostring(active.endTime) .. "/" .. tostring(castWarningFrame.event))
self:ShowCastWarning(aloftData)
 
-- TODO: make this interval a user-controlled option, rather than 20 times a second?
if self.db.profile.animate then
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): animate cast bar " .. tostring(aloftData.name) .. "/" .. tostring(active and active.name))
castWarningFrame.event = self:ScheduleRepeatingTimer(function(aloftData) AloftCastWarning:AnimateActiveCast(aloftData) end, ANIMATE_INTERVAL, aloftData)
else
self:AnimateActiveCast(aloftData) -- this drives one "iteration" of the animate, to configure/display the cast warning
-- TODO: make this interval a user-controlled option, rather than 20 times a second?
if self.db.profile.animate then
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): animate cast bar " .. tostring(aloftData.name) .. "/" .. tostring(active and active.name))
castWarningFrame.event = self:ScheduleRepeatingTimer(function(aloftData) AloftCastWarning:AnimateActiveCast(aloftData) end, ANIMATE_INTERVAL, aloftData)
else
self:AnimateActiveCast(aloftData) -- this drives one "iteration" of the animate, to configure/display the cast warning
 
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): schedule release cast bar " .. tostring(aloftData.name) .. "/" .. tostring(active and active.name))
castWarningFrame.event = nil
self:ScheduleTimer(function(aloftData) AloftCastWarning:ReleaseCastWarning(aloftData) end, ((active.endTime > now) and (active.endTime - now)) or 0.0, aloftData)
end
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): schedule release cast bar " .. tostring(aloftData.name) .. "/" .. tostring(active and active.name))
castWarningFrame.event = nil
self:ScheduleTimer(function(aloftData) AloftCastWarning:ReleaseCastWarning(aloftData) end, ((active.endTime > now) and (active.endTime - now)) or 0.0, aloftData)
end
 
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): notify start " .. tostring(castWarningFrame) .. "/" .. tostring(castWarningFrame.targetGUId) .. "/" .. tostring(active.startTime) .. "/" .. tostring(active.Time) .. "/" .. tostring(castWarningFrame.event))
self:SendMessage("AloftCastWarning:OnCastWarningDataChanged", aloftData, targetGUId, active)
aloftData.castWarningLastUpdateTime = now
aloftData.castWarningEndTime = active.endTime
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): notify start " .. tostring(castWarningFrame) .. "/" .. tostring(castWarningFrame.targetGUId) .. "/" .. tostring(active.startTime) .. "/" .. tostring(active.Time) .. "/" .. tostring(castWarningFrame.event))
self:SendMessage("AloftCastWarning:OnCastWarningDataChanged", aloftData, targetGUId, active)
aloftData.castWarningLastUpdateTime = now
aloftData.castWarningEndTime = active.endTime
 
return -- we have enabled a cast warning bar, we should stub out here
elseif active and ((active.fadeEndTime and ((self.db.profile.animate and active.fadeEndTime > aloftData.castWarningLastUpdateTime) or (not self.db.profile.animate and active.fadeEndTime > aloftData.castWarningLastUpdateTime))) or (active.endTime and active.endTime > aloftData.castWarningLastUpdateTime)) then
-- still fading or not ended yet; so, animation presumably already in progress, just trigger a data change event, to switch to fade text, and continue
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): notify fade " .. tostring(aloftData.name) .. "/" .. tostring(active and active.name))
self:SendMessage("AloftCastWarning:OnCastWarningDataChanged", aloftData, targetGUId, active)
aloftData.castWarningLastUpdateTime = now
return -- we have enabled a cast warning bar, we should stub out here
elseif active and ((active.fadeEndTime and ((self.db.profile.animate and active.fadeEndTime > aloftData.castWarningLastUpdateTime) or (not self.db.profile.animate and active.fadeEndTime > aloftData.castWarningLastUpdateTime))) or (active.endTime and active.endTime > aloftData.castWarningLastUpdateTime)) then
-- still fading or not ended yet; so, animation presumably already in progress, just trigger a data change event, to switch to fade text, and continue
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): notify fade " .. tostring(aloftData.name) .. "/" .. tostring(active and active.name))
self:SendMessage("AloftCastWarning:OnCastWarningDataChanged", aloftData, targetGUId, active)
aloftData.castWarningLastUpdateTime = now
 
return -- we have updated the cast warning bar, we should stub out here
return -- we have updated the cast warning bar, we should stub out here
else
-- animation/fade presumably finished; trigger a data change event and release the cast warning
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): notify finished " .. tostring(aloftData.name) .. "/" .. tostring(active and active.name))
self:SendMessage("AloftCastWarning:OnCastWarningDataChanged", aloftData, targetGUId, active)
 
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): release cast bar")
self:ReleaseCastWarning(aloftData)
return -- we have released the cast warning bar, we should stub out here
end
else
-- animation/fade presumably finished; trigger a data change event and release the cast warning
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): notify finished " .. tostring(aloftData.name) .. "/" .. tostring(active and active.name))
self:SendMessage("AloftCastWarning:OnCastWarningDataChanged", aloftData, targetGUId, active)
 
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): release cast bar")
self:ReleaseCastWarning(aloftData)
return -- we have released the cast warning bar, we should stub out here
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): no targetId " .. tostring(aloftData.name) .. "/" .. tostring(targetGUId))
end
else
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): no targetId " .. tostring(aloftData.name) .. "/" .. tostring(targetGUId))
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): no nameplateId " .. tostring(aloftData.name) .. "/" .. tostring(targetGUId))
end
else
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): no nameplateId " .. tostring(aloftData.name) .. "/" .. tostring(targetGUId))
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): current target " .. tostring(aloftData.name) .. "/" .. tostring(targetGUId))
end
 
-- fall through to here: if we have no nameplate id and/or no tracked targetGUId and/or no active cast spellId, then disable any cast warning bar that is showing and/or animation that is in progress
if not (nameplateId and targetGUId and active) then
-- fall through to here: if we have no nameplate id and/or no tracked targetGUId and/or no active cast spellId,
-- or this (via fall through from above) is the current target nameplate, then disable any cast warning bar that
-- is showing and/or animation that is in progress
if not (nameplateId and targetGUId and active) or currentTarget then
-- ChatFrame7:AddMessage("AloftCastWarning:Update(): handle non-spell " .. tostring(aloftData.name))
local castWarningFrame = aloftData.castWarningFrame
if castWarningFrame then
528,6 → 540,7
-- if not (castFrame and layoutFrame and castFrame:GetParent() == layoutFrame and castFrame:IsVisible()) then -- the target cast bar has become visible
-- ChatFrame7:AddMessage("AloftCastWarning:UpdateTargetData(): target cast bar NOT present/visible " .. tostring(aloftData.name))
-- end
-- ChatFrame7:AddMessage("AloftCastWarning:UpdateTargetData(): ----- TARGET CHANGE ----- " .. tostring(aloftData.name))
self:Update("AloftCastWarning:UpdateTargetData", aloftData)
end
 
772,17 → 785,21
-- ChatFrame7:AddMessage("AloftCastWarning:AnimateActiveCast(): show cast warning " .. tostring(aloftData.name) .. "/" .. tostring(castWarningFrame.targetGUId) .. "/" .. tostring(active) .. "/" .. tostring(active.startTime) .. "<" .. tostring(active.endTime) .. "/" .. tostring(castWarningFrame.event))
local layoutFrame = aloftData.layoutFrame
local castFrame = AloftCastBar:GetCastFrame()
if active.disabled
or (aloftData.isTarget or aloftData:IsTarget()) -- in the middle of animating an actual cast, we want to preemptively drop the cast warning only if the current target nameplate
if active.disabled then
-- cast is over, release the active cast
self:StopActiveCast(aloftData, castWarningFrame, targetGUId, nil)
active = nil
elseif aloftData.isTarget or aloftData:IsTarget()
-- or (castFrame and layoutFrame and castFrame:GetParent() == layoutFrame and castFrame:IsVisible()) -- if target cast bar is actually visible and associated with this nameplate; subsumed by the target check
then
-- in the middle of animating an actual cast, we want to preemptively drop the cast warning BAR when we have the current target nameplate, but leave the active cast in place
-- ChatFrame7:AddMessage("AloftCastWarning:AnimateActiveCast(): disable " .. tostring(aloftData.name))
self:StopActiveCast(aloftData, castWarningFrame, targetGUId)
self:StopActiveCast(aloftData, castWarningFrame, targetGUId, true)
active = nil
elseif active.fadeEndTime then -- are we already fading
if now >= active.fadeEndTime then -- we are done "fading"
-- ChatFrame7:AddMessage("AloftCastWarning:AnimateActiveCast(): fade done " .. tostring(aloftData.name) .. "/" .. tostring(castWarningFrame.targetGUId) .. "/" .. tostring(active.id) .. "/" .. tostring(active.name) .. "/" .. tostring(active.rank) .. "|" .. tostring(active.startTime) .. "<" .. tostring(now) .. "<" .. tostring(active.endTime) .. "|" .. tostring(castWarningFrame.event))
self:StopActiveCast(aloftData, castWarningFrame, targetGUId)
self:StopActiveCast(aloftData, castWarningFrame, targetGUId, nil)
active = nil
end
else -- we are mot already fading
820,7 → 837,7
local val = (active.fadeStartTime and ((active.isChanneled and 0.00000001) or (active.endTime - active.startTime)))
or (active.isChanneled and (active.endTime - active.startTime - (now - active.startTime))) or (now - active.startTime)
local alpha = (self.db.profile.animate and active.fadeEndTime and self.db.profile.fadeDuration > 0.0 and active.fadeEndTime > now and (1.0 - (now - active.fadeStartTime) / self.db.profile.fadeDuration)) or 1.0
-- ChatFrame7:AddMessage("AloftCastWarning:AnimateActiveCast(): animate bar " .. tostring(aloftData.name) .. "/" .. tostring(castWarningFrame.targetGUId) .. "/" .. tostring(active.id) .. "/" .. tostring(active.name) .. "/" .. tostring(active.rank) .. "/" .. tostring(castWarningFrame.event) .. "|" .. tostring(now) .. "-" .. tostring(active.startTime) .. "<" .. tostring(active.endTime) .. "|" .. tostring(mnv) .. "<" .. tostring(value) .. "<" .. tostring(mxv) .. "|" .. tostring(alpha) .. "/" .. tostring(trigger))
-- ChatFrame7:AddMessage("AloftCastWarning:AnimateActiveCast(): animate bar " .. tostring(aloftData.name) .. "/" .. tostring(castWarningFrame.targetGUId) .. "/" .. tostring(active) .. "/" .. tostring(active.id) .. "/" .. tostring(active.name) .. "/" .. tostring(active.rank) .. "/" .. tostring(castWarningFrame.event) .. "|" .. tostring(now) .. "-" .. tostring(active.startTime) .. "<" .. tostring(active.endTime) .. "|" .. tostring(mnv) .. "<" .. tostring(value) .. "<" .. tostring(mxv) .. "|" .. tostring(alpha) .. "/" .. tostring(trigger))
 
castWarningFrame.value = val
 
837,9 → 854,11
end
end
 
function AloftCastWarning:StopActiveCast(aloftData, castWarningFrame, targetGUId)
function AloftCastWarning:StopActiveCast(aloftData, castWarningFrame, targetGUId, hideOnly)
self:StopCastEvent(castWarningFrame)
self:ReleaseActive(targetGUId) -- clear the current spell
if not hideOnly then
self:ReleaseActive(targetGUId) -- clear the current spell, unless we are only hiding
end
self:Update("AloftCastWarning:StopActiveCast", aloftData)
end
 
910,8 → 929,8
active.castTime = spell.castTime
active.isChanneled = spell.isChanneled
active.noInterrupt = noInterrupt
-- ChatFrame7:AddMessage("AloftCastWarning:AcquireActive(): " .. tostring(active.id) .. "/" .. tostring(active.name) .. "/" .. tostring(active.rank) .. "/" .. tostring(active.noInterrupt))
-- ChatFrame7:AddMessage("AloftCastWarning:AcquireActive(): " .. debugstack())
-- ChatFrame7:AddMessage("AloftCastWarning:AcquireActive(): " .. tostring(active) .. "/" .. tostring(active.id) .. "/" .. tostring(active.name) .. "/" .. tostring(active.rank) .. "/" .. tostring(active.noInterrupt) .. "/" .. tostring(active.startTime) .. "/" .. tostring(active.endTime))
-- ChatFrame7:AddMessage("AloftCastWarning:AcquireActive(): " .. debugstack(1, 4, 3))
 
-- make certain these extraneous things are gone
active.fadeStartTime = nil
926,7 → 945,8
if targetGUId then
local active = self.targetGUIdToActiveCast[targetGUId]
if active then
-- ChatFrame7:AddMessage("AloftCastWarning:ReleaseActive(): active " .. tostring(targetGUId) .. "/" .. tostring(active.id) .. "/" .. tostring(active.name) .. "/" .. tostring(active.rank))
-- ChatFrame7:AddMessage("AloftCastWarning:ReleaseActive(): active " .. tostring(targetGUId) .. "/" .. tostring(active) .. "/" .. tostring(active.id) .. "/" .. tostring(active.name) .. "/" .. tostring(active.rank) .. "/" .. tostring(active.noInterrupt) .. "/" .. tostring(active.startTime) .. "/" .. tostring(active.endTime))
-- ChatFrame7:AddMessage("AloftCastWarning:AcquireActive(): " .. debugstack(1, 4, 3))
 
-- invalidate, but return the active record to the pool
self.targetGUIdToActiveCast[targetGUId] = nil