This commit is contained in:
Andrew6810
2023-03-30 12:32:45 -07:00
parent f3e579cb57
commit d6aaac97af
53 changed files with 2930 additions and 1307 deletions
@@ -115,6 +115,7 @@ L["Reset Filters"] = true
L["Right-Click to favorite this recent search."] = true
L["Right-Click to remove from favorite searches."] = true
L["Saved Searches"] = true
L["Scanning %d / %d (Page 1 / ?)"] = true
L["Scanning %d / %d (Page %d / %d)"] = true
L["Search Filter:"] = true
L["Select the groups which you would like to include in the search."] = true
@@ -110,6 +110,7 @@ L["Reset Filters"] = "필터 리셋" -- Needs review
L["Right-Click to favorite this recent search."] = "Right-Click으로 이 검색을 즐겨찾기에 등록합니다." -- Needs review
L["Right-Click to remove from favorite searches."] = "Right-Click으로 츨겨찾기 검색에서 제거합니다." -- Needs review
L["Saved Searches"] = "저장된 검색"
L["Scanning %d / %d (Page 1 / ?)"] = "검색 중 %d / %d (페이지 1 / ?)" -- Needs review
L["Scanning %d / %d (Page %d / %d)"] = "검색 중 %d / %d (페이지 %d / %d)" -- Needs review
L["Search Filter:"] = "검색 필터:" -- Needs review
L["Select the groups which you would like to include in the search."] = "검색에 포함할 그룹을 선택하세요." -- Needs review
+2 -1
View File
@@ -111,7 +111,8 @@ L["Recent Searches"] = "Недавние поиски" -- Needs review
-- L["Right-Click to favorite this recent search."] = ""
-- L["Right-Click to remove from favorite searches."] = ""
L["Saved Searches"] = "Сохраненные поиски" -- Needs review
-- L["Scanning %d / %d (Page %d / %d)"] = ""
L["Scanning %d / %d (Page 1 / ?)"] = "Скан %d / %d (стр 1 / ?)"
L["Scanning %d / %d (Page %d / %d)"] = "Скан %d / %d (стр %d / %d)"
-- L["Search Filter:"] = ""
-- L["Select the groups which you would like to include in the search."] = ""
L["'%s' has a Shopping operation of '%s' which no longer exists. Shopping will ignore this group until this is fixed."] = "\"% s \" имеет Торговые операции '%s', которая больше не существует. Торговые будете игнорировать эту группу до тех пор, пока это будет Исправлено." -- Needs review
@@ -112,6 +112,7 @@ L["Reset Filters"] = "重置筛选器"
L["Right-Click to favorite this recent search."] = "右键点击 保存到最喜欢的搜索"
L["Right-Click to remove from favorite searches."] = "右键点击 从最喜欢的搜索里移除"
L["Saved Searches"] = "保存搜索"
L["Scanning %d / %d (Page 1 / ?)"] = "扫描 %d / %d(页面 1 / ?)"
L["Scanning %d / %d (Page %d / %d)"] = "扫描 %d / %d(页面 %d / %d)"
L["Search Filter:"] = "搜索筛选器:"
L["Select the groups which you would like to include in the search."] = "选择你想搜索的分组"
+80 -25
View File
@@ -202,17 +202,29 @@ function private:PrepareForScan(callback, isLastPageScan)
TSM.moduleAPICallback = nil
end
local scanStatus, pageStatus
function private.ScanCallback(event, ...)
if event == "QUERY_COMPLETE" then
private.filterList = ...
private.numFilters = #private.filterList
private:ScanNextFilter()
elseif event == "QUERY_UPDATE" then
local arg1, arg2 = ...
private:UpdateStatus("query", arg1, arg2)
local current, total, skipped = ...
private:UpdateStatus("query", current, total)
elseif event == "SCAN_PAGE_UPDATE" then
-- Simply forward the "currently received" and "total" page counts
-- for the current item we're scanning.
-- NOTE: Private servers sometimes give totally insane "total page counts"
-- on the first response, such as "page 1/142", but those server errors
-- always correct themselves to "page 2/REAL" when the scan has reached
-- page 2. There's nothing we can do to avoid that rare page-count issue
-- (which happens on many popular private servers, such as Warmane).
private:UpdateStatus("page", ...)
elseif event == "SCAN_INTERRUPTED" or event == "INTERRUPTED" then
-- We've been interrupted by the Auction House closing.
-- NOTE: "SCAN_INTERRUPTED" is from LibAuctionScan-1.0, which isn't used
-- by TSM anymore, and "INTERRUPTED" is from "TSM/Auction/AuctionScanning.lua",
-- which is what this scanner uses nowadays.
private:ScanComplete(true)
elseif event == "SCAN_TIMEOUT" then
tremove(private.filterList, 1)
private:ScanNextFilter()
@@ -288,14 +300,25 @@ function private.ScanCallback(event, ...)
end
function private:ScanNextFilter()
-- We must reset the page counter, otherwise the next scan will keep the
-- page count of the previous item until we receive "SCAN_PAGE_UPDATE".
-- NOTE: The "nil" signals that we don't know the item's page count yet.
-- NOTE: The recipient may want to ignore "page" events that have nil values
-- and not update their status bars based on those, since we send these empty
-- page events before we start each new scan!
private:UpdateStatus("page", nil, nil)
-- Now update the scan counter.
-- NOTE: Our scan progress counter below starts counting from 0 as the first item.
if #private.filterList == 0 then
private:UpdateStatus("scan", private.numFilters, private.numFilters)
return private:ScanComplete()
end
pageStatus = {0, 1}
private:UpdateStatus("scan", private.numFilters-#private.filterList+1, private.numFilters)
private:UpdateStatus("scan", private.numFilters-#private.filterList, private.numFilters)
TSMAPI.AuctionScan:RunQuery(private.filterList[1], private.ScanCallback, true, private.callback("filter", private.filterList[1]), true)
end
local scanStatus, pageStatus
function private:UpdateStatus(statusType, ...)
if statusType == "query" then
private.searchFrame.statusBar:SetStatusText(format(L["Preparing Filter %d / %d"], ...))
@@ -305,31 +328,63 @@ function private:UpdateStatus(statusType, ...)
scanStatus = {...}
elseif statusType == "page" then
pageStatus = {...}
-- Ignore the empty "reset page count" events that happen before every new
-- scan. We've reset the page counts, which is the only thing that matters.
if pageStatus[1] == nil and pageStatus[2] == nil then
return
end
end
private.searchFrame.statusBar:SetStatusText(format(L["Scanning %d / %d (Page %d / %d)"], scanStatus[1], scanStatus[2], pageStatus[1]+1, pageStatus[2]))
private.searchFrame.statusBar:UpdateStatus(100*(scanStatus[1]-1)/scanStatus[2], 100*pageStatus[1]/pageStatus[2])
-- NOTE: We don't do +1 for the item-scan or page-status counters below,
-- since we want our progress bar to show FULLY RECEIVED/FINISHED items
-- and pages, and not fill up until we've fully received each item/page.
local progress_bar_items = min(100*(scanStatus[1]/scanStatus[2]), 100) -- Calculate "total items" progress bar from 0-100%.
local progress_bar_pages = 0
-- NOTE: In the status text label, we count the items starting at 1,
-- to say "Scanning 1 / 2" (instead of "Scanning 0 / 2"). For pages,
-- we show which page we're waiting for (so if we have received 2/4 pages,
-- the label will say 3/4, meaning "we're waiting for page 3...").
if pageStatus[1] ~= nil and pageStatus[2] ~= nil then
-- We have received the page counter ("current page / total pages") for the current item.
-- NOTE: We add "+1" to the page counter, to indicate that we've received that page and are working on the next page.
private.searchFrame.statusBar:SetStatusText(format(L["Scanning %d / %d (Page %d / %d)"], scanStatus[1] + 1, scanStatus[2], min(pageStatus[1] + 1, pageStatus[2]), pageStatus[2]))
progress_bar_pages = min(100*(pageStatus[1]/pageStatus[2]), 100) -- Calculate "total pages of current item" progress bar from 0-100%.
else
-- We have started a new item scan but haven't received the page count yet.
-- NOTE: If we don't initialize the page-progress to 0%, we'd get a "jumpy"
-- progress bar that goes from 100% at page 1/? to "real%" after page 1.
private.searchFrame.statusBar:SetStatusText(format(L["Scanning %d / %d (Page 1 / ?)"], scanStatus[1] + 1, scanStatus[2]))
progress_bar_pages = 0 -- Begin at 0% for the gray page-counter bar of the current item.
end
private.searchFrame.statusBar:UpdateStatus(progress_bar_items, progress_bar_pages)
end
end
function private:ScanComplete()
if not private.callback then return end
private.searchFrame.statusBar:SetStatusText(L["Done Scanning"])
private.searchFrame.statusBar:UpdateStatus(100, 100)
private.searchFrame.rt:SetDisabled(false)
if #private.searchFrame.rt.auctionData == 1 then
private.searchFrame.rt:SetExpanded(private.searchFrame.rt.auctionData[1]:GetItemString(), true)
private.searchFrame.rt.rows[1].cols[1]:Click()
elseif #private.searchFrame.rt.auctionData == 0 and private.searchItem and private:HasInBags(TSMAPI:GetBaseItemString(private.searchItem)) then
private.controlButtons.post:Enable()
local postPrice = TSM:GetMaxPrice(TSM.db.global.normalPostPrice, private.searchItem) or 0
TSMAPI.AuctionControl:SetNoResultItem(private.searchItem, postPrice)
function private:ScanComplete(interrupted)
if interrupted then
-- If our scan has been interrupted by the Auction House closing,
-- simply act as if the user clicked "Stop".
Util:StopScan()
else
if not private.callback then return end
private.searchFrame.statusBar:SetStatusText(L["Done Scanning"])
private.searchFrame.statusBar:UpdateStatus(100, 100)
private.searchFrame.rt:SetDisabled(false)
if #private.searchFrame.rt.auctionData == 1 then
private.searchFrame.rt:SetExpanded(private.searchFrame.rt.auctionData[1]:GetItemString(), true)
private.searchFrame.rt.rows[1].cols[1]:Click()
elseif #private.searchFrame.rt.auctionData == 0 and private.searchItem and private:HasInBags(TSMAPI:GetBaseItemString(private.searchItem)) then
private.controlButtons.post:Enable()
local postPrice = TSM:GetMaxPrice(TSM.db.global.normalPostPrice, private.searchItem) or 0
TSMAPI.AuctionControl:SetNoResultItem(private.searchItem, postPrice)
end
if #private.searchFrame.rt.auctionData == 0 and TSM.moduleAPICallback then
TSM.moduleAPICallback()
end
private.callback("done", private.auctions)
TSMAPI:FireEvent("SHOPPING:SEARCH:SCANDONE", #private.searchFrame.rt.auctionData)
end
if #private.searchFrame.rt.auctionData == 0 and TSM.moduleAPICallback then
TSM.moduleAPICallback()
end
private.callback("done", private.auctions)
TSMAPI:FireEvent("SHOPPING:SEARCH:SCANDONE", #private.searchFrame.rt.auctionData)
end
-- processes scan data for a specific item