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

Renames #1881

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Renames #1881

wants to merge 7 commits into from

Conversation

nebularg
Copy link
Member

Adds the option to rename spells in the options. Renames are done using :SetSpellRename to set the value in the spells table, then the renaming happens in the CLEU handler. The module doesn't have to do anything special, ie, args.spellName will be the renamed text. This also means :SpellName returns the renamed value, with a new optional second arg (:SpellName(id, true)) to return the value from GetSpellInfo/EJ_GetSectionInfo directly.

The rename values are stored in a new Rename plugin with a simple getter/setter. Initial setup is done in the module's :SetupOptions, so on module enable or when opening the config. Setting a value in the Rename plugin will run :SetSpellRename in the associated module to handle user updates in the config.

Preset renames are set using the altNames table in :GetOptions. This can be the current [spellId] = L.string mapping or an indexed table for additional settings. The first table entry is always the rename string. Any tables entries that are a number will be treated as spell ids that should also get the same rename string. Any table entries that are a string will be treated as a key in the locale table to be overwritten with the rename string.

Example: TheBloodboundHorror.lua

local L = mod:GetLocale()
if L then
	L.bloodcurdle = "Spreads"
	L.bloodcurdle_singular = "Spread"
end

function mod:GetOptions()
	return {
		-- options
	},{
		-- headers
	},{
		-- altNames
		[452237] = {L.bloodcurdle, "bloodcurdle_singular"}, -- Bloodcurdle (Spreads)
	}
end

This results in :Log callbacks for spell id 452237 having args.spellName renamed to the value in L.bloodcurdle and any call to :SpellName(452237) returning the renamed value. In the options this will show up like it does currently with the name in parentheses next to the spell name. Including the bloodcurdle_singular locale key will also add that value to config as something you can rename. This is indicated in the config by including a "+X" value next to or inplace of the rename value to indicate there are additional strings you can rename. The locale table entry gets overwritten by the user-set value, so any usage of L.bloodcurdle_singular will reflect the user value.

image

Ability options:
image

The Reset button enables when the text isn't the default (module preset value or empty) and the Spell Name button enables when there is a module preset value to easily rename it back to the actual spell name. The Spell Name button is always there to keep the layout code simple, but it should probably not show if there isn't a module preset rename.

How the title of the locale strings shows in the config is unfinished. Right now it just title cases the string without underscores, but my idea was to use suffixes to show a localized generic title, ie, _singular -> "Singular Form (Target Message/Bar)".

Since this is all driven from the current altNames table, we'd need to rework how to show "labels" in the config, as LittleWigs uses the altName to show mythic only spells and such. An idea is to add a flag to the ability options like "MYTHIC" (that isn't an actual bit flag) to show the difficulty icon, and/or add a helper function to prepend the blue text "label" to the description text.

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

Successfully merging this pull request may close these issues.

3 participants