diff --git a/AscensionExporter/Collectors/Enchants.lua b/AscensionExporter/Collectors/Enchants.lua
index 7eb81c2..5b597b6 100644
--- a/AscensionExporter/Collectors/Enchants.lua
+++ b/AscensionExporter/Collectors/Enchants.lua
@@ -1,64 +1,43 @@
--- AscensionExporter - Mystic Enchants collector (from equipped item tooltips)
+-- AscensionExporter - Mystic Enchants (Glyphs) collector
-- Ensure global addon table exists even if load order varies
AscensionExporter = _G.AscensionExporter or {}
_G.AscensionExporter = AscensionExporter
local AE = AscensionExporter
-local SLOT_NAMES = {
- [1] = "HEAD", [2] = "NECK", [3] = "SHOULDER", [4] = "SHIRT", [5] = "CHEST",
- [6] = "WAIST", [7] = "LEGS", [8] = "FEET", [9] = "WRIST", [10] = "HANDS",
- [11] = "FINGER1", [12] = "FINGER2", [13] = "TRINKET1", [14] = "TRINKET2",
- [15] = "BACK", [16] = "MAINHAND", [17] = "OFFHAND", [18] = "RANGED", [19] = "TABARD",
-}
+function AE.CollectMysticEnchants()
+ local enchants = {}
-local function extract_mystic_from_tooltip(slot)
- GameTooltip:ClearLines()
- GameTooltip:SetOwner(UIParent, "ANCHOR_NONE")
- GameTooltip:SetInventoryItem("player", slot)
- local found = nil
- 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()
- if (l:find("mystic") or l:find("mythic")) and (l:find("enchant") or l:find("rune")) then
- -- Try to pull the enchant name after a colon, else use the whole line
- local name = txt
- local after = txt:match("[::]%s*(.+)$")
- if after and after ~= "" then name = after end
- -- Trim color codes if any
- name = name:gsub("|c%x%x%x%x%x%x%x%x", ""):gsub("|r", "")
- found = name
- break
+ -- Ascension uses C_MysticEnchant API
+ if C_MysticEnchant and C_MysticEnchant.GetAppliedEnchant then
+ -- NUM_MYSTIC_ENCHANT_SLOTS is typically 12 on Ascension
+ local numSlots = NUM_MYSTIC_ENCHANT_SLOTS or 12
+ for i = 1, numSlots do
+ local spellID = C_MysticEnchant.GetAppliedEnchant("player", i)
+ if spellID and spellID > 0 then
+ local name, _, icon = GetSpellInfo(spellID)
+ if name then
+ -- Extract icon path from full texture path
+ -- Format: Interface\Icons\spell_name
+ local iconPath = ""
+ if icon then
+ iconPath = icon:match("Interface\\Icons\\(.+)") or ""
+ iconPath = iconPath:lower()
+ end
+
+ table.insert(enchants, {
+ slot = i,
+ name = name,
+ spellID = spellID,
+ icon = iconPath
+ })
end
end
end
end
- GameTooltip:Hide()
- return found
-end
-function AE.CollectMysticEnchants()
- local perSlot = {}
- local activeSet = {}
- for slot = 1, 19 do
- local link = GetInventoryItemLink("player", slot)
- if link then
- local name = extract_mystic_from_tooltip(slot)
- if name and name ~= "" then
- table.insert(perSlot, { slot = slot, slotName = SLOT_NAMES[slot] or tostring(slot), name = name })
- activeSet[name] = true
- end
- end
- end
- local active = {}
- for n, _ in pairs(activeSet) do
- table.insert(active, { name = n })
- end
- table.sort(active, function(a,b) return a.name < b.name end)
- return { perSlot = perSlot, active = active }
+ table.sort(enchants, function(a,b) return a.slot < b.slot end)
+ return { enchants = enchants }
end
-- Mark module as loaded for debug visibility
diff --git a/AscensionExporter/Core.lua b/AscensionExporter/Core.lua
index 4ad8751..b1feb72 100644
--- a/AscensionExporter/Core.lua
+++ b/AscensionExporter/Core.lua
@@ -266,6 +266,77 @@ function AE:GenerateMarkdownGear()
return table.concat(lines, "\n") .. "\n"
end
+-- Markdown mystic enchants table generator
+function AE:GenerateMarkdownEnchants()
+ local ench = self.CollectMysticEnchants and self.CollectMysticEnchants() or { enchants = {} }
+
+ local lines = {}
+ table.insert(lines, "## Mystic Enchants\n")
+
+ if #(ench.enchants or {}) == 0 then
+ table.insert(lines, "*No Mystic Enchants equipped.*\n")
+ return table.concat(lines, "\n")
+ end
+
+ -- Create single table with quality column
+ -- Ascension Mystic Enchant slots:
+ -- Slot 11-12: Artifact
+ -- Slot 1: Legendary
+ -- Slots 2-4: Epic
+ -- Slots 5-10: Rare
+
+ -- Determine quality and sort by quality then slot
+ local enchantRows = {}
+ for _, e in ipairs(ench.enchants or {}) do
+ local slot = e.slot or 0
+ local quality, qualityOrder
+
+ if slot >= 11 then
+ quality = 'Artifact'
+ qualityOrder = 1
+ elseif slot == 1 then
+ quality = 'Legendary'
+ qualityOrder = 2
+ elseif slot >= 2 and slot <= 4 then
+ quality = 'Epic'
+ qualityOrder = 3
+ else
+ quality = 'Rare'
+ qualityOrder = 4
+ end
+
+ local spellID = e.spellID or 0
+ local name = e.name or "Unknown"
+ local icon = e.icon or ""
+ local iconImg = icon ~= "" and string.format('
', icon) or ""
+ local link = spellID > 0 and string.format("[%s](https://db.ascension.gg/?spell=%d)", name, spellID) or name
+
+ table.insert(enchantRows, {
+ quality = quality,
+ qualityOrder = qualityOrder,
+ slot = slot,
+ text = string.format("| %s | %s**%s** |", quality, iconImg, link)
+ })
+ end
+
+ -- Sort by quality then slot
+ table.sort(enchantRows, function(a, b)
+ if a.qualityOrder ~= b.qualityOrder then
+ return a.qualityOrder < b.qualityOrder
+ end
+ return a.slot < b.slot
+ end)
+
+ -- Build table
+ table.insert(lines, "| Quality | Enchant |")
+ table.insert(lines, "|---------|---------|")
+ for _, row in ipairs(enchantRows) do
+ table.insert(lines, row.text)
+ end
+
+ return table.concat(lines, "\n")
+end
+
-- Slash command handling
SLASH_ASCX1 = "/ascx"
SLASH_ASCX2 = "/asxc" -- alias: both map to the same handler key "ASCX"
diff --git a/AscensionExporter/UI/ExportFrame.lua b/AscensionExporter/UI/ExportFrame.lua
index 7c952dc..e6ca930 100644
--- a/AscensionExporter/UI/ExportFrame.lua
+++ b/AscensionExporter/UI/ExportFrame.lua
@@ -54,6 +54,17 @@ local function CreateOrGetFrame()
end
end
end)
+ x = x + 95
+ makeBtn("MD Enchants", x, function()
+ if AscensionExporter and AscensionExporter.GenerateMarkdownEnchants then
+ local md = AscensionExporter:GenerateMarkdownEnchants() or ""
+ if AscensionExporter.ShowExport then
+ AscensionExporter:ShowExport(md, "Ascension Export - Markdown Enchants - Copy All (Ctrl+C)")
+ else
+ AscensionExporter_ShowExportFrame(md, "Ascension Export - Markdown Enchants - Copy All (Ctrl+C)")
+ end
+ end
+ end)
-- ScrollFrame + EditBox
local scrollFrame = CreateFrame("ScrollFrame", "AscensionExporterScrollFrame", frame, "UIPanelScrollFrameTemplate")