Plater Nameplates

Plater Nameplates

64M Downloads

Minor inconsistencies with interrupt behavior in castbar

linaori opened this issue ยท 0 comments

commented

I found a few minor issues with the interrupting and I have some fixes that could be done

Issue 1

In the following snippet the code to set the following information is skipped if the player name interrupting is disabled. This results in the following lines of code not being executed and thus not available in mods

castBar.IsInterrupted = true
castBar.InterruptSourceName = sourceName
castBar.InterruptSourceGUID = sourceGUID

Plater-Nameplates/Plater.lua

Lines 9459 to 9466 in 1bffeb0

SPELL_INTERRUPT = function (time, token, hidding, sourceGUID, sourceName, sourceFlag, sourceFlag2, targetGUID, targetName, targetFlag, targetFlag2, spellID, spellName, spellType, amount, overKill, school, resisted, blocked, absorbed, isCritical)
if (IS_IN_INSTANCE) then
PlaterDB.InterruptableSpells[spellID] = true
end
if (not Plater.db.profile.show_interrupt_author) then
return
end

Proposal

Move the if (not Plater.db.profile.show_interrupt_author) then check to wrap around the SetText(INTERRUPTED .. call only so that all other code is still executed. I suspect the early return also blocks the interrupt animation from playing if the interrupt name is not shown.


Issue 2

The snippet takes sourceName, and the translit happens only on name:

Plater-Nameplates/Plater.lua

Lines 9481 to 9487 in 1bffeb0

if DB_USE_NAME_TRANSLIT then
name = LibTranslit:Transliterate(name, TRANSLIT_MARK)
end
castBar.Text:SetText (INTERRUPTED .. " [" .. Plater.SetTextColorByClass (sourceGUID, name) .. "]")
castBar.IsInterrupted = true
castBar.InterruptSourceName = sourceName
castBar.InterruptSourceGUID = sourceGUID

Proposal

Set the interrupt source name to be the translit name so mods get this value instead of the original.

castBar.InterruptSourceName = name

Issue 3

In the DF unitframes lib IsInterrupted isn't set because the key is named interrupted there. I'm not sure if these 2 are supposed to work together, but both are available in mods

local castBar = unitFrame.castBar
print(castBar.IsInterrupted, castBar.interrupted)

image

UNIT_SPELLCAST_INTERRUPTED = function(self, unit, ...)
local unitID, castID, spellID = ...
if ((self.casting or self.channeling) and castID == self.castID and not self.fadeOut) then
self.casting = nil
self.channeling = nil
self.interrupted = true
self.finished = true
self.castID = nil
if (self.Settings.FillOnInterrupt) then
self:SetValue(self.maxValue or select(2, self:GetMinMaxValues()) or 1)
end
if (self.Settings.HideSparkOnInterrupt) then
self.Spark:Hide()
end
local castColor = self:GetCastColor()
self:SetColor(castColor) --SetColor handles with ParseColors()
self.percentText:Hide()
self.Text:SetText(INTERRUPTED) --auto locale within the global namespace
self:ScheduleToHide(1)
end
end,

Proposal

Plater could use the same keys as the DF lib. Always sync interrupted to IsInterrupted and replace this one by interrupted in the scripting panels. Alternatively DF lib could start using IsInterrupted instead of interrupted.

Another thing is that InterruptSourceName and InterruptSourceGUID could be moved to the lib if that's where the properties should go.