Call as
addon:Widget_SpellWidget(spec, editbox, value, nametoid, isvalid, update)
Available directly through addon; no dependency is needed.
What it does
Create a spell input with suggestions, validation and spell-link support for custom condition widgets. The update callback owns saving a chosen value; add the returned widget to the callback parent.
Arguments
| Name | Type | What it does |
|---|---|---|
self | RMAddon | Rotation Master addon instance (implicit with colon calls). |
spec | number | Specialization scope used to resolve spell suggestions. |
editbox | string | Reference input kind, such as Spec_EditBox, used for spell suggestions. |
value | table | Condition value record containing spell, ranked and disabled fields; updated in place. |
nametoid | function | Resolver mapping a typed spell name to its ID. |
isvalid | function | Predicate that validates the proposed spell value. |
update | function | Callback receiving the committed spell value. |
Returns
| 1 | RMConditionGroup | Spell field group containing an action icon, reference input and optional rank control. |
|---|
Editions
Built In helpers are registered on every edition. What differs is the game API they read; where one is missing the helper falls back or returns nil with a reason.
- Not available on that edition (the reason is in the tooltip)
- Only while Blizzard's deprecation fallbacks are on
| Game API | |||||
|---|---|---|---|---|---|
GameTooltip |
How the addon calls it
- Any Spell Available (widget)
local spell_group = addon:Widget_SpellWidget(spec, "Spell_EditBox", value, - Any Spell Charges (widget)
local spell_group = addon:Widget_SpellWidget(spec, "Spell_EditBox", value, - Any Spell Cooldown (widget)
local spell_group = addon:Widget_SpellWidget(spec, "Spell_EditBox", value, - Any Spell In Range (widget)
local spell_group = addon:Widget_SpellWidget(spec, "Spell_EditBox", value, - Any Spell Recharge Time (widget)
local spell_group = addon:Widget_SpellWidget(spec, "Spell_EditBox", value, - Assisted Combat Rotation Spell (widget)
local spell_group = addon:Widget_SpellWidget(spec, "Spec_EditBox", value, - Assisted Combat Suggestion (widget)
local spell_group = addon:Widget_SpellWidget(spec, "Spec_EditBox", value, - Pet Spell Active or Pending (widget)
local spell_group = addon:Widget_SpellWidget((BOOKTYPE_PET or "pet"), "Spec_EditBox", value,
and 19 more: Pet Spell Available (widget), Pet Spell Charges (widget), Pet Spell Cooldown (widget), Pet Spell Cast History (widget), Pet Spell Cast History Time (widget), Pet Spell In Range (widget), Pet Spell Recharge Time (widget), Spell Active or Pending (widget), Spell Auto-Repeat Active (widget), Spell Available (widget), Spell Charges (widget), Spell Cooldown (widget), Spell Proc Glow (widget), Spell Cast History (widget), Spell Cast History Time (widget), Spell In Range (widget), Spell Recharge Time (widget), Specific Totem Present (widget), Specific Totem Time Remaining (widget)
Dependencies
RANK_TIP(builtin:Conditions/common.lua:RANK_TIP)SpellData(builtin:Conditions/common.lua:SpellData)
Source
Conditions/common.lua, line 82. Read only in game; Duplicate makes an editable copy.
Conditions.common.Widget_SpellWidget(self, spec, editbox, value, nametoid, isvalid, update)
local spell_group = addon:CreateConditionGroup()
spell_group:SetLayout('RM-SpellField')
local rankChoice
local spell = addon:CreateSpellEditBox(editbox,value.spell)
local initialSpell=type(value.spell)=="string" and SpellData:GetSpellId(value.spell) or value.spell
local spellIcon = addon:CreateSpellActionIcon(spec == (BOOKTYPE_PET or "pet") and "pet" or "spell",initialSpell,isvalid)
spellIcon:SetWidth(44)
spellIcon:SetHeight(44)
spellIcon:SetText(value.spell)
spellIcon:SetCallback("OnEnterPressed", function(_, _, v)
v = tonumber(v)
if v and isvalid(v) then
value.spell = v
spellIcon:SetText(v)
spell:SetText(SpellData:SpellName(value.spell, not value.ranked))
if GameTooltip:IsOwned(spellIcon.frame) and GameTooltip:IsVisible() then
GameTooltip:SetHyperlink("spell:" .. v)
end
else
value.spell = nil
spellIcon:SetText(nil)
spell:SetText(nil)
if GameTooltip:IsOwned(spellIcon.frame) and GameTooltip:IsVisible() then
GameTooltip:Hide()
end
end
update()
end)
spellIcon:SetCallback("OnEnter", function()
if value.spell then
GameTooltip:SetOwner(spellIcon.frame, "ANCHOR_BOTTOMRIGHT", 3)
GameTooltip:SetHyperlink("spell:" .. value.spell)
end
end)
spellIcon:SetCallback("OnLeave", function()
if GameTooltip:IsOwned(spellIcon.frame) then
GameTooltip:Hide()
end
end)
spellIcon:SetDisabled(value.disabled)
spell_group:AddChild(spellIcon)
if addon:ClientHasSpellRanks() and spec ~= (BOOKTYPE_PET or "pet") then
local nr_button = addon:CreateConditionCheckBox()
nr_button:SetLabel(L["Use this exact spell rank"])
nr_button.button.tooltip = RANK_TIP
nr_button:SetValue(value.ranked or false)
nr_button:SetCallback("OnValueChanged", function(_, _, val)
value.ranked = val
spell:SetUserData("norank", not val)
spell:SetText(value.spell and SpellData:SpellName(value.spell, not value.ranked))
update()
end)
nr_button:SetDisabled(value.disabled)
rankChoice=nr_button
end
spell:SetFullWidth(true)
spell:SetLabel('')
spell:SetText(value.spell and SpellData:SpellName(value.spell, not value.ranked))
spell:SetUserData("norank", not value.ranked)
spell:SetUserData("spec", spec)
spell:SetCallback("OnEnterPressed", function(_, _, v)
if not addon.isint(v) then
v = nametoid(v)
else
v = tonumber(v)
end
if isvalid(v) then
value.spell = v
spell:SetText(SpellData:SpellName(value.spell, not value.ranked))
else
value.spell = nil
spell:SetText(nil)
end
spellIcon:SetText(value.spell)
update()
end)
spell:SetDisabled(value.disabled)
spell_group:AddChild(spell)
if rankChoice then
rankChoice.frame.GetFontString=function() return rankChoice.button:GetFontString() end
spell_group:AddChild(rankChoice)
end
return spell_group




