diff --git a/AGENTS.md b/AGENTS.md index c857b3e..d538d0f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -17,3 +17,6 @@ Recent commit messages are short and action-focused (for example “add group sc ## Agent Notes When adding or renaming modules, update the `.toc` and matching `.lua` filenames together, and ensure any new files are listed in the `.toc` manifest. Keep changes scoped to the relevant module folder to avoid cross-module regressions. +Local Ascension client paths used in this workspace: +- AddOns: `/home/zalox/Games/ascension-wow/drive_c/Program Files/Ascension Launcher/resources/client/Interface/AddOns` +- SavedVariables: `/home/zalox/Games/ascension-wow/drive_c/Program Files/Ascension Launcher/resources/client/WTF/Account/omanfred/SavedVariables` diff --git a/TradeSkillMaster/Auction/AuctionScanning.lua b/TradeSkillMaster/Auction/AuctionScanning.lua index c32a040..c8c4daf 100644 --- a/TradeSkillMaster/Auction/AuctionScanning.lua +++ b/TradeSkillMaster/Auction/AuctionScanning.lua @@ -14,7 +14,7 @@ TSMAPI.AuctionScan = {} local RETRY_DELAY = 2 local MAX_RETRIES = 4 local BASE_DELAY = 0.10 -- time to delay for before trying to scan a page again when it isn't fully loaded -local private = { callbackHandler = nil, query = {}, options = {}, data = {}, isScanning = nil } +local private = { callbackHandler = nil, query = {}, options = {}, data = {}, isScanning = nil, isPaused = nil } TSMAPI:RegisterForTracing(private, "TradeSkillMaster.AuctionScanning_private") local scanCache = {} @@ -147,6 +147,7 @@ function TSMAPI.AuctionScan:RunQuery(query, callbackHandler, resolveSellers, max -- setup other stuff wipe(private.data) private.isScanning = true + private.isPaused = nil private.callbackHandler = callbackHandler private.resolveSellers = resolveSellers private.scanType = "query" @@ -179,6 +180,7 @@ function TSMAPI.AuctionScan:ScanLastPage(callbackHandler) -- setup other stuff wipe(private.data) private.isScanning = true + private.isPaused = nil private.callbackHandler = callbackHandler private.scanType = "lastPage" @@ -189,7 +191,7 @@ end -- sends a query to the AH frame once it is ready to be queried (uses frame as a delay) function private:SendQuery() - if not private.isScanning then return end + if not private.isScanning or private.isPaused then return end if CanSendAuctionQuery() then -- stop delay timer @@ -208,7 +210,7 @@ end --scans the currently shown page of auctions and collects all the data function private:ScanAuctions() - if not private.isScanning then return end + if not private.isScanning or private.isPaused then return end local shown, total = GetNumAuctionItems("list") local totalPages = ceil(total / NUM_AUCTION_ITEMS_PER_PAGE) @@ -303,6 +305,9 @@ function private:ScanAuctions() end -- query the next page and continue scanning + if private.isPaused then + return + end private:SendQuery() end @@ -363,6 +368,7 @@ function private:StopScanning() TSMAPI:CancelFrame("updateDelay") AuctionScanning:UnregisterEvent("AUCTION_ITEM_LIST_UPDATE") private.isScanning = nil + private.isPaused = nil private.pageTemp = nil end @@ -372,6 +378,26 @@ function TSMAPI.AuctionScan:StopScan() private:StopScanning() TSM:StopGeneratingQueries() end + +function TSMAPI.AuctionScan:PauseScan() + if not private.isScanning or private.isPaused then return false end + private.isPaused = true + TSMAPI:CancelFrame("queryDelay") + TSMAPI:CancelFrame("updateDelay") + AuctionScanning:UnregisterEvent("AUCTION_ITEM_LIST_UPDATE") + return true +end + +function TSMAPI.AuctionScan:ResumeScan() + if not private.isScanning or not private.isPaused then return false end + private.isPaused = nil + private:SendQuery() + return true +end + +function TSMAPI.AuctionScan:IsPaused() + return private.isPaused and true or false +end -- Gets the number of pages for a given query @@ -422,6 +448,7 @@ function TSMAPI.AuctionScan:GetNumPages(query, callbackHandler) -- setup other stuff wipe(private.data) private.isScanning = true + private.isPaused = nil private.callbackHandler = callbackHandler private.scanType = "numPages" @@ -625,4 +652,4 @@ function TSMAPI.AuctionScan:StopFindScan() findPrivate.isScanning = nil TSMAPI:CancelFrame("auctionFindQueryDelay") TSMAPI:CancelFrame("auctionFindScanDelay") -end \ No newline at end of file +end diff --git a/TradeSkillMaster_Auctioning/locale/enUS.lua b/TradeSkillMaster_Auctioning/locale/enUS.lua index 4712985..a4418bc 100644 --- a/TradeSkillMaster_Auctioning/locale/enUS.lua +++ b/TradeSkillMaster_Auctioning/locale/enUS.lua @@ -184,6 +184,7 @@ L["Operation"] = true L["Operations"] = true L["Options"] = true L["Other Auctioning Searches"] = true +L["Pause"] = true L["Percentage of the buyout as bid, if you set this to 90% then a 100g buyout will have a 90g bid."] = true L["Player name"] = true L["Play the selected sound when a post / cancel scan is complete and items are ready to be posted / canceled (the gray bar is all the way across).Select None to disable sounds"] = true @@ -217,13 +218,16 @@ L["Reset Scan Finished"] = true L["Reset Settings"] = true L["Reset"] = true L["Resetting enabled."] = true +L["Resume"] = true L["Restart"] = true L["Return to Summary"] = true L["Right-Click to add %s to your friends list."] = true L["Round Normal Price"] = true +L["Resuming Scan..."] = true L["Running Scan..."] = true L["Save New Price"] = true L["Scan Complete!"] = true +L["Scan Paused"] = true L["Scanning %d / %d (Page 1 / ?)"] = true L["Scanning %d / %d (Page %d / %d)"] = true L["Scanning %d / %d"] = true @@ -287,4 +291,4 @@ L["You do not have any players on your whitelist yet."] = true L["You've been undercut."] = true L["Your Buyout"] = true L["Your auction has not been undercut."] = true -L["auctions of|r %s"] = true \ No newline at end of file +L["auctions of|r %s"] = true diff --git a/TradeSkillMaster_Auctioning/modules/GUI.lua b/TradeSkillMaster_Auctioning/modules/GUI.lua index 6c4a9be..a3f7ea5 100644 --- a/TradeSkillMaster_Auctioning/modules/GUI.lua +++ b/TradeSkillMaster_Auctioning/modules/GUI.lua @@ -16,7 +16,7 @@ function private:CreateButtons(parent) local height = 24 local frame = CreateFrame("Frame", nil, parent) frame:SetHeight(height) - frame:SetWidth(210) + frame:SetWidth(265) frame:SetPoint("BOTTOMRIGHT", -92, 5) frame.Enable = function(self) @@ -26,6 +26,7 @@ function private:CreateButtons(parent) self.cancel:Enable() end self.skip:Enable() + self.pause:Disable() self.stop:Enable() end @@ -36,6 +37,7 @@ function private:CreateButtons(parent) self.cancel:Disable() end self.skip:Disable() + self.pause:Enable() end frame.UpdateMode = function(self) @@ -51,6 +53,11 @@ function private:CreateButtons(parent) self.stop:Enable() end + frame.SetPaused = function(self, isPaused) + self.pause:SetText(isPaused and L["Resume"] or L["Pause"]) + self.pause.isPaused = isPaused + end + local function OnClick(self) if self.which == "stop" and self.isDone then GUI:HideSelectionFrame() @@ -90,7 +97,16 @@ function private:CreateButtons(parent) local button = TSMAPI.GUI:CreateButton(frame, 18) button:SetPoint("TOPLEFT", frame.skip, "TOPRIGHT", 5, 0) - button:SetWidth(70) + button:SetWidth(60) + button:SetHeight(height) + button:SetText(L["Pause"]) + button.which = "pause" + button:SetScript("OnClick", OnClick) + frame.pause = button + + local button = TSMAPI.GUI:CreateButton(frame, 18) + button:SetPoint("TOPLEFT", frame.pause, "TOPRIGHT", 5, 0) + button:SetWidth(60) button:SetHeight(height) button:SetText(L["Stop"]) button.which = "stop" @@ -681,6 +697,7 @@ function private:Stopped(notDone) private.buttons:Disable(true) private.statusBar:UpdateStatus(100, 100) private.contentButtons.currAuctionsButton:Hide() + private.buttons.pause:Disable() if private.mode == "Post" then TSMAPI:CreateTimeDelay(0.5, SetGoldText) @@ -697,6 +714,7 @@ function private:Stopped(notDone) end private.buttons.stop:SetText(L["Restart"]) private.buttons.stop.isDone = true + private.buttons:SetPaused(false) end @@ -897,6 +915,8 @@ function GUI:StartScan(frame) private.buttons:Show() private.buttons:UpdateMode() private.buttons:Disable() + private.buttons:SetPaused(false) + private.buttons.pause:Enable() private.buttons.stop.isDone = nil private.buttons.stop:SetText(L["Stop"]) private.contentButtons:Show() @@ -955,4 +975,4 @@ function GUI:HideSelectionFrame() if private.scanFrame then private.scanFrame:Hide() end TSMAPI.AuctionScan:StopScan() TSM.Reset:Hide() -end \ No newline at end of file +end diff --git a/TradeSkillMaster_Auctioning/modules/manage.lua b/TradeSkillMaster_Auctioning/modules/manage.lua index f7e1606..3a240e0 100644 --- a/TradeSkillMaster_Auctioning/modules/manage.lua +++ b/TradeSkillMaster_Auctioning/modules/manage.lua @@ -72,9 +72,25 @@ function Manage:OnGUIEvent(event) end elseif event == "skip" then Util:SkipItem() + elseif event == "pause" then + if TSMAPI.AuctionScan:IsPaused() then + if TSMAPI.AuctionScan:ResumeScan() then + GUI.buttons:SetPaused(false) + GUI.statusBar:SetStatusText(L["Resuming Scan..."]) + GUI.infoText:SetInfo(L["Running Scan..."]) + end + else + if TSMAPI.AuctionScan:PauseScan() then + GUI.buttons:SetPaused(true) + GUI.statusBar:SetStatusText(L["Scan Paused"]) + GUI.infoText:SetInfo(L["Scan Paused"]) + end + end elseif event == "stop" then TSMAPI:CancelFrame("auctioningNoScanProcessing") TSMAPI.AuctionScan:StopScan() + GUI.buttons:SetPaused(false) + GUI.buttons.pause:Disable() Util:Stop() end TSMAPI:CreateTimeDelay("aucManageSTUpdate", 0.01, GUI.UpdateAuctionsSTData) @@ -88,6 +104,8 @@ function Manage:ProcessScannedItem(itemString, noUpdate) end function Manage:ScanComplete(interrupted) + GUI.buttons:SetPaused(false) + GUI.buttons.pause:Disable() if interrupted then -- If our scan has been interrupted by the Auction House closing, -- simply act as if the user clicked "Stop", but with an extra flag @@ -199,4 +217,4 @@ function Manage:SetInfoText(text) GUI:UpdateLogSTHighlight() end GUI.infoText:SetInfo(text) -end \ No newline at end of file +end