Skip to content

Commit 34b29a5

Browse files
authored
Merge pull request #1987 from LarryThiessen/fix-1986-icon-stealth-and-branch-menu
#1986 Icon system: filter stealth states; list all conditional branches in Select Icon
2 parents c1b9484 + fbc57f4 commit 34b29a5

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

GSE_GUI/Editor.lua

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,12 @@ local FORM_SPELL_IDS = {
941941
[40120] = true, -- Swift Flight Form
942942
[114282] = true, -- Treant Form
943943
[165961] = true, -- Stag Form
944+
-- Stealth states: sit on the stance bar exactly like stances/forms do.
945+
-- A management line like "/cast [nostealth] Stealth; [stealth,nocombat]
946+
-- Sprint" resolves to "Stealth" when unstealthed and stole the block
947+
-- icon from the real ability below it.
948+
[1784] = true, -- Stealth (Rogue)
949+
[5215] = true, -- Prowl (Druid)
944950
-- Pet summoning slots: treated the same as forms/stances. A line like
945951
-- /cast Call Pet 1 should not steal the action icon unless it is the
946952
-- only valid candidate in the macro block.
@@ -967,6 +973,7 @@ local function isFormSpellCandidate(value)
967973

968974
local lowerCandidate = strlower(candidate)
969975
return lowerCandidate == "ghost wolf" or lowerCandidate == "tree of life" or
976+
lowerCandidate == "stealth" or lowerCandidate == "prowl" or
970977
lowerCandidate:match("%f[%a]form%f[%A]") ~= nil or
971978
lowerCandidate:match("%f[%a]stance%f[%A]") ~= nil or
972979
-- "Call Pet", "Call Pet 1" ... "Call Pet 5"
@@ -1813,6 +1820,33 @@ end
18131820
-- GSE.SaveAllSequenceActionIcons) through the GSE.* namespace.
18141821

18151822

1823+
-- Menu-only candidate source: enumerate EVERY conditional branch of a cast
1824+
-- line, ignoring whether its conditionals are true right now. The live
1825+
-- resolver (SecureCmdOptionParse) intentionally drops branches whose
1826+
-- conditionals currently fail, so out of combat a "/cast [combat] Shuriken
1827+
-- Storm" contributed nothing and the Select Icon menu never offered it —
1828+
-- while castsequence lines (enumerated element-wise) offered everything.
1829+
-- The auto-icon keeps using the live resolver; this is just for the menu.
1830+
local function getAllConditionalBranchSpells(line)
1831+
local cmd, etc = string.match(line or "", "^%s*/(%w+)%s+([^\n]+)")
1832+
if not cmd or not etc then return nil end
1833+
cmd = strlower(cmd)
1834+
if not Statics.CastCmds[cmd] or cmd == "castsequence" then return nil end
1835+
1836+
local candidates = {}
1837+
for _, clause in ipairs(GSE.split(etc, ";")) do
1838+
local _, _, body = GSE.GetConditionalsFromString(clause)
1839+
body = trimIconCandidate(body or "")
1840+
if body ~= "" and not tonumber(body) then
1841+
local ok, info = pcall(GSE.GetSpellInfo, body)
1842+
if ok and type(info) == "table" and info.iconID then
1843+
table.insert(candidates, info)
1844+
end
1845+
end
1846+
end
1847+
if #candidates > 0 then return candidates end
1848+
end
1849+
18161850
function GSE.CreateIconControl(action, version, keyPath, sequence, frame)
18171851
local iconSize = 28
18181852
local lbl = UI:Create("Icon")
@@ -1876,6 +1910,7 @@ function GSE.CreateIconControl(action, version, keyPath, sequence, frame)
18761910
local lines = GSE.SplitMeIntoLines(macro)
18771911
for _, v in ipairs(lines) do
18781912
addIconMenuCandidates(spellinfolist, GSE.GetSpellsFromString(v, true))
1913+
addIconMenuCandidates(spellinfolist, getAllConditionalBranchSpells(v))
18791914
addIconMenuCandidates(spellinfolist, getMacroLineFallbackIconInfo(v))
18801915
end
18811916
else

0 commit comments

Comments
 (0)