Remove enchant detection from gear collector
- Removed tooltip-based enchant parsing logic due to complexity and inconsistent results. - Simplified gear collection by discarding enchant-related data.
This commit is contained in:
@@ -51,59 +51,6 @@ local function resolve_gems(itemLink, gemIds)
|
||||
return arr
|
||||
end
|
||||
|
||||
local function read_enchant_from_tooltip(slot)
|
||||
-- Try to extract human-readable base enchant (not mystic) if present
|
||||
-- Enchantments appear as separate green lines, often between stats and durability
|
||||
GameTooltip:ClearLines()
|
||||
GameTooltip:SetOwner(UIParent, "ANCHOR_NONE")
|
||||
GameTooltip:SetInventoryItem("player", slot)
|
||||
|
||||
local enchantLine = nil
|
||||
local seenDurability = false
|
||||
|
||||
for i = 1, GameTooltip:NumLines() do
|
||||
local line = _G["GameTooltipTextLeft" .. i]
|
||||
if line then
|
||||
local txt = tostring(line:GetText() or "")
|
||||
if txt and txt ~= "" then
|
||||
local l = txt:lower()
|
||||
|
||||
-- Track if we've seen durability (enchants appear before this)
|
||||
if l:find("durability") then
|
||||
seenDurability = true
|
||||
end
|
||||
|
||||
-- If we haven't found an enchant yet and we're not past durability
|
||||
if not enchantLine and not seenDurability then
|
||||
-- Skip unwanted patterns
|
||||
if not l:find("disenchant") and not l:find("^equip:") and not l:find("^set:") and not l:find("^use:") then
|
||||
-- Skip mystic/mythic lines
|
||||
if not ((l:find("mystic") or l:find("mythic")) and (l:find("enchant") or l:find("rune"))) then
|
||||
-- Get text color
|
||||
local r, g, b = line:GetTextColor()
|
||||
local isGreen = (g and g > 0.8 and r and r < 0.5)
|
||||
|
||||
-- Enchant patterns:
|
||||
-- 1. Green text starting with +number
|
||||
-- 2. Exclude base item stats (stamina, intellect, spirit, strength, agility)
|
||||
if isGreen and l:match("^%+%d+") then
|
||||
local isBaseStat = l:find("stamina") or l:find("intellect") or l:find("spirit") or
|
||||
l:find("strength") or l:find("agility") or l:find("%(")
|
||||
if not isBaseStat then
|
||||
enchantLine = txt
|
||||
break -- Found enchant, stop looking
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
GameTooltip:Hide()
|
||||
return enchantLine
|
||||
end
|
||||
|
||||
function AE.CollectGear()
|
||||
local out = { slots = {} }
|
||||
for slot = 1, 19 do
|
||||
@@ -113,23 +60,6 @@ function AE.CollectGear()
|
||||
local itemId = parsed.itemId or 0
|
||||
local itemName, _, itemQuality, itemLevel, _, itemType, itemSubType, _, equipSlot, texture = GetItemInfo(itemLink)
|
||||
|
||||
local enchant = nil
|
||||
if parsed.enchantId and parsed.enchantId > 0 then
|
||||
-- We have an enchantId, try multiple ways to get the name
|
||||
local enchantName = read_enchant_from_tooltip(slot)
|
||||
|
||||
-- If tooltip parsing didn't work, try GetSpellInfo
|
||||
if not enchantName then
|
||||
local spellName = GetSpellInfo(parsed.enchantId)
|
||||
if spellName then
|
||||
enchantName = spellName
|
||||
end
|
||||
end
|
||||
|
||||
-- Fallback to "Unresolved"
|
||||
enchant = { id = parsed.enchantId, name = enchantName or "Unresolved" }
|
||||
end
|
||||
|
||||
local gems = resolve_gems(itemLink, parsed.gems or {})
|
||||
|
||||
table.insert(out.slots, {
|
||||
@@ -144,7 +74,6 @@ function AE.CollectGear()
|
||||
equipSlot = equipSlot or "",
|
||||
texture = texture or "",
|
||||
link = itemLink,
|
||||
enchant = enchant,
|
||||
gems = gems,
|
||||
})
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user