fix non-letter or number characters in item or spell names

This commit is contained in:
Jrc13245
2025-10-26 12:48:29 -04:00
parent 6db708f40b
commit 18f7828c26
3 changed files with 40 additions and 4 deletions
+12 -1
View File
@@ -744,7 +744,7 @@ function CleveRoids.ParseMacro(name)
_, texture, body = GetMacroInfo(macroID)
end
-- Fallback: SuperMacro “Super” tab
-- Fallback: SuperMacro "Super" tab
if (not body) and GetSuperMacroInfo then
_, texture, body = GetSuperMacroInfo(name)
end
@@ -761,6 +761,9 @@ function CleveRoids.ParseMacro(name)
macro.actions.list = {}
-- build a list of testable actions for the macro
local hasShowTooltip = false
local showTooltipHasArg = false
for i, line in ipairs(CleveRoids.splitString(body, "\n")) do
line = CleveRoids.Trim(line)
local cmd, args = CleveRoids.SplitCommandAndArgs(line)
@@ -773,10 +776,13 @@ function CleveRoids.ParseMacro(name)
if not st then
break
end
hasShowTooltip = true
tt = CleveRoids.Trim(tt)
-- #showtooltip and item/spell/macro specified, only use this tooltip
if st and tt ~= "" then
showTooltipHasArg = true
for _, arg in ipairs(CleveRoids.splitStringIgnoringQuotes(tt)) do
macro.actions.tooltip = CleveRoids.CreateActionInfo(arg)
local action = CleveRoids.CreateActionInfo(CleveRoids.GetParsedMsg(arg))
@@ -803,6 +809,11 @@ function CleveRoids.ParseMacro(name)
action.args = arg
action.isReactive = CleveRoids.reactiveSpells[action.action]
table.insert(macro.actions.list, action)
-- NEW FIX: If #showtooltip with no args, use first action as tooltip
if hasShowTooltip and not showTooltipHasArg and not macro.actions.tooltip then
macro.actions.tooltip = action
end
end
end
end
+26 -2
View File
@@ -136,6 +136,8 @@ function CleveRoids.IndexItems()
slotsIndex = 1,
}
items[itemID] = name
-- ADDED: Also index by lowercase name for case-insensitive lookup
items[string.lower(name)] = name
else
items[name].count = (items[name].count or 0) + (count or 0)
table.insert(items[name].bagSlots, {bagID, slot})
@@ -162,6 +164,8 @@ function CleveRoids.IndexItems()
link = link,
}
items[itemID] = name
-- ADDED: Also index by lowercase name for case-insensitive lookup
items[string.lower(name)] = name
else
items[name].inventoryID = inventoryID
items[name].count = (items[name].count or 0) + (count or 0)
@@ -249,7 +253,17 @@ end
function CleveRoids.GetItem(text)
if not text or text == "" then return end
-- IMPROVED: Try exact match first, then lowercase match
local item = CleveRoids.Items[text] or CleveRoids.Items[tostring(text)]
if not item then
-- Try lowercase lookup
local lowerText = string.lower(text)
local canonicalName = CleveRoids.Items[lowerText]
if canonicalName and type(canonicalName) == "string" then
item = CleveRoids.Items[canonicalName]
end
end
if item then
if type(item) == "table" then
return item
@@ -277,7 +291,11 @@ function CleveRoids.GetItem(text)
link = link,
count = count
}
if name then CleveRoids.Items[name] = it end
if name then
CleveRoids.Items[name] = it
-- ADDED: Also cache by lowercase
CleveRoids.Items[string.lower(name)] = name
end
if itemID then CleveRoids.Items[itemID] = name end
return it
end
@@ -310,7 +328,11 @@ function CleveRoids.GetItem(text)
bagSlots = { { bagID, slot } },
slotsIndex = 1
}
if name then CleveRoids.Items[name] = it end
if name then
CleveRoids.Items[name] = it
-- ADDED: Also cache by lowercase
CleveRoids.Items[string.lower(name)] = name
end
if itemID then CleveRoids.Items[itemID] = name end
return it
end
@@ -374,6 +396,8 @@ function CleveRoids.GetItem(text)
if not name then return end
local fallback = { id = text, name = name, link = link, texture = texture }
CleveRoids.Items[name] = fallback
-- ADDED: Also cache by lowercase
CleveRoids.Items[string.lower(name)] = name
return fallback
end
+2 -1
View File
@@ -12,8 +12,9 @@ Check slash command and all conditional lists for new usages!
2. Unzip the file and place the folder into your `Interface/Addons` folder.
3. Rename the `SuperCleveRoidMacros-main` folder to `SuperCleveRoidMacros`
4. Check that it is enabled in your addon list in-game.
5. Make sure you don't have other macro addons that may interfere. SuperMacro should be compatible.
5. Make sure you don't have other macro addons that may interfere.
6. SUPERWOW and NAMPOWER are REQUIRED!
7. Disable Macrotweak module in pfui, and disable macrotweak in shagutweaks!
* [SuperWoW](https://github.com/balakethelock/SuperWoW) dll mod is required