BigWigs icon indicating copy to clipboard operation
BigWigs copied to clipboard

[Suggestion] Alternative spell names

Open nastye opened this issue 6 years ago • 2 comments

Allow users to give spells an alternative name, and show that name on bars instead.

AlternativeNames

nastye avatar Apr 25 '19 13:04 nastye

This would be a massive improvement.

fisken1991 avatar Jul 26 '19 13:07 fisken1991

It looks like this functionality is somewhat build into the API. If you go to /Addons/BigWigs_Core/BossPrototype.lua line 2382 (for me) see the following boss api function definition.

...
	--- Display a bar.
	-- @param key the option key
	-- @param length the bar duration in seconds, or a table containing {remaining duration, max duration}
	-- @param[opt] text the bar text (if nil, key is used)
	-- @param[opt] icon the bar icon (spell id or texture name)
	function boss:Bar(key, length, text, icon)
		local lengthType = type(length)
...

I believe when key is used, it's directly getting the spell name from the parsed combat log event - not 100% sure - but it is certainly just the "default spell name".

Then, in each boss file, for example /Addons/LittleWigs/Dragonflight/AlgetharAcademy/OvergrownAncient.lua Each event handler function uses the boss:CDBar api as follows for example:

function mod:Germinate(args)
    germinateCount = germinateCount + 1
    self:Message(args.spellId, "yellow")
    self:PlaySound(args.spellId, "long")
    self:Bar(args.spellId, germinateCount % 2 == 0 and 25.5 or 34)
end

As you can see, the self:Bar function takes additional optional parameters including custom bar text.

I found that if I changed the above function as shown below (adding "GERMINATE" to the bar call) and tested in game, it correctly overwrote the bar text.

function mod:Germinate(args)
    germinateCount = germinateCount + 1
    self:Message(args.spellId, "yellow")
    self:PlaySound(args.spellId, "long")
    self:Bar(args.spellId, germinateCount % 2 == 0 and 25.5 or 34, "GERMINATE")
end

I'm not sure how to implement this more broadly, I think it would require adding an entry box/log/variable to the addon and then passing an additional argument that defaults to nul for every single module event handler. I'm not really much of a developer so not sure a better way, but this work around actually makes this customization possible and a reality with some effort. If any more experienced devs were interested in helping me work on this I'd be happy to do so.

coup321 avatar Jan 07 '23 19:01 coup321