Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor inconsistencies with interrupt behavior in castbar #251

Open
linaori opened this issue Nov 15, 2024 · 0 comments
Open

Minor inconsistencies with interrupt behavior in castbar #251

linaori opened this issue Nov 15, 2024 · 0 comments

Comments

@linaori
Copy link
Contributor

linaori commented Nov 15, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant