03c369e10e
- Implemented `GenerateMarkdownEnchants()` to export Mystic Enchants in Markdown format, sorted by quality and slot. - Replaced tooltip-based enchant detection with `C_MysticEnchant` API for more reliable data collection. - Added UI button to trigger Mystic Enchant Markdown export.
45 lines
1.5 KiB
Lua
45 lines
1.5 KiB
Lua
-- 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
|
|
|
|
function AE.CollectMysticEnchants()
|
|
local enchants = {}
|
|
|
|
-- 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
|
|
|
|
table.sort(enchants, function(a,b) return a.slot < b.slot end)
|
|
return { enchants = enchants }
|
|
end
|
|
|
|
-- Mark module as loaded for debug visibility
|
|
AE._loadedEnchants = true
|