-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFallenRelics_Exporter.lua
More file actions
69 lines (57 loc) · 2.64 KB
/
Copy pathFallenRelics_Exporter.lua
File metadata and controls
69 lines (57 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
-- Initial load message to verify the file is recognized
print("|cff00ff00[Fallen Relics]|r Exporter Loaded. Use /frexport or /frprofs")
function FallenRelics_RunExport()
-- Check if the trade skill window is actually ready and open
if not C_TradeSkillUI.IsTradeSkillReady() then
print("|cffff0000[Fallen Relics]|r Error: Please open a Profession window (like Alchemy) first!")
return
end
local recipeIDs = C_TradeSkillUI.GetAllRecipeIDs()
local charName = UnitName("player")
local realmName = GetRealmName():gsub("%s+", "")
-- Format: OWNER:Name-Realm;IDS:123,456,789,
local exportString = "OWNER:" .. charName .. "-" .. realmName .. ";IDS:"
local count = 0
for _, id in ipairs(recipeIDs) do
local info = C_TradeSkillUI.GetRecipeInfo(id)
if info and info.learned then
exportString = exportString .. id .. ","
count = count + 1
end
end
-- Create UI Frame if it doesn't exist
if not FallenRelics_ExportFrame then
local f = CreateFrame("Frame", "FallenRelics_ExportFrame", UIParent, "BasicFrameTemplateWithInset")
f:SetSize(450, 180)
f:SetPoint("CENTER")
f:SetMovable(true)
f:EnableMouse(true)
f:RegisterForDrag("LeftButton")
f:SetScript("OnDragStart", f.StartMoving)
f:SetScript("OnDragStop", f.StopMoving)
f:SetFrameStrata("DIALOG")
f.title = f:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
f.title:SetPoint("CENTER", f.TitleBg, "CENTER", 0, 0)
f.desc = f:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
f.desc:SetPoint("TOP", 0, -35)
f.desc:SetText("Press Ctrl+C to copy this data for the Roster Reporter.")
f.editBox = CreateFrame("EditBox", nil, f, "InputBoxTemplate")
f.editBox:SetSize(400, 30)
f.editBox:SetPoint("CENTER", 0, -10)
f.editBox:SetScript("OnEscapePressed", function() f:Hide() end)
-- Add to the global namespace for re-use
FallenRelics_ExportFrame = f
end
FallenRelics_ExportFrame.title:SetText("Fallen Relics Roster Data (" .. count .. " recipes)")
FallenRelics_ExportFrame.editBox:SetText(exportString)
FallenRelics_ExportFrame:Show()
FallenRelics_ExportFrame.editBox:HighlightText()
FallenRelics_ExportFrame.editBox:SetFocus()
print("|cff00ff00[Fallen Relics]|r Data ready for " .. charName .. "!")
end
-- Slash command mapping
SLASH_FREXPORT1 = "/frexport"
SLASH_FREXPORT2 = "/frprofs"
SlashCmdList["FREXPORT"] = function()
FallenRelics_RunExport()
end