Skip to content

Commit

Permalink
Add export to APR custom route button
Browse files Browse the repository at this point in the history
  • Loading branch information
Neogeekmo committed May 8, 2024
1 parent d6f7b01 commit c86d1ef
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
3 changes: 1 addition & 2 deletions Commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ function AprRC.command:SlashCmd(input)
if AprRCData.CurrentRoute.name ~= "" then
AprRC:UpdateRouteByName(AprRCData.CurrentRoute.name, AprRCData.CurrentRoute)
end
APR.RouteQuestStepList[AprRCData.CurrentRoute.name] = AprRCData.CurrentRoute.steps
APR.RouteList.Custom[AprRCData.CurrentRoute.name] = AprRCData.CurrentRoute.name:match("%d+-(.*)")
AprRC.export:Hide()
AprRC.export.Show()
return
elseif inputText == "forcereset" or inputText == "fr" then
Expand Down
35 changes: 21 additions & 14 deletions frames/exportRoute.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ local L_APR = LibStub("AceLocale-3.0"):GetLocale("APR")

AprRC.export = AprRC:NewModule('Export')

local frame
function AprRC.export:Hide()
if frame then
AceGUI:Release(frame)
end
frame = nil
end

function AprRC.export:Show()
local refreshTimer
Expand Down Expand Up @@ -33,11 +40,11 @@ function AprRC.export:Show()
end
end

local frame = AceGUI:Create("Frame")
frame = AceGUI:Create("Frame")
frame:SetTitle("Export")
frame:SetLayout("Flow")
frame:SetStatusText(L_APR["COPY_HELPER"])
frame:SetHeight(750)
frame:SetHeight(775)

local dropdown = AceGUI:Create("Dropdown")
dropdown:SetLabel("Select Route")
Expand Down Expand Up @@ -77,6 +84,7 @@ function AprRC.export:Show()
btnExportELT:SetCallback("OnClick", function()
AprRC.exportExtraLineText.Show()
AceGUI:Release(frame)
frame = nil
end)
frame:AddChild(btnExportELT)

Expand All @@ -99,17 +107,16 @@ function AprRC.export:Show()
end)
frame:AddChild(btnSave)

-- local btnDelete = AceGUI:Create("Button")
-- btnDelete:SetText("Delete this route")
-- btnDelete:SetWidth(200)
-- btnDelete:SetCallback("OnClick", function()
-- routeList[defaultIndex] = nil
-- AprRCData.Routes[defaultIndex] = nil
-- dropdown:SetList(routeList)
-- dropdown:SetValue(1)
-- editbox:SetText(AprRC:RouteToString(AprRCData.Routes[1].steps))
-- end)
-- frame:AddChild(btnDelete)
local exportToAPRBtn = AceGUI:Create("Button")
exportToAPRBtn:SetText("Export this route into APR")
exportToAPRBtn:SetWidth(200)
exportToAPRBtn:SetCallback("OnClick", function()
local route = AprRC:FindRouteByName(selectedRouteName)
APRData.CustomRoute[route.name] = route.steps
APR.RouteQuestStepList[route.name] = route.steps
APR.RouteList.Custom[route.name] = route.name:match("%d+-(.*)")
end)
frame:AddChild(exportToAPRBtn)

local checkbox = AceGUI:Create("CheckBox")
checkbox:SetLabel("Enable Auto Refresh")
Expand All @@ -125,7 +132,6 @@ function AprRC.export:Show()
end)
frame:AddChild(checkbox)


if defaultIndex then
if AprRCData.Routes[defaultIndex].name == AprRCData.CurrentRoute.name then
checkbox:SetDisabled(false)
Expand All @@ -152,5 +158,6 @@ function AprRC.export:Show()
frame:SetCallback("OnClose", function(widget)
StopAutoRefresh()
AceGUI:Release(widget)
frame = nil
end)
end

0 comments on commit c86d1ef

Please sign in to comment.