mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
fix non-letter or number characters in item or spell names
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user