Skip to content

Commit

Permalink
Restart the scan if the result has a quantity below the expected thre…
Browse files Browse the repository at this point in the history
…shold
  • Loading branch information
plusmouse committed Jan 10, 2024
1 parent 01230e8 commit 618919e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Source/Buy/Main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function PointBlankSniperBuyFrameMixin:OnLoad()
PointBlankSniper.Events.SnipeSearchStart,
PointBlankSniper.Events.OpenBuyView
})
Auctionator.EventBus:RegisterSource(self, "PointBlankSniperBuyFrameMixin")
end

function PointBlankSniperBuyFrameMixin:OnHide()
Expand Down Expand Up @@ -45,6 +46,7 @@ function PointBlankSniperBuyFrameMixin:OnEvent(eventName, ...)
self.resultInfo = nil

self.buyResultsCount = C_AuctionHouse.GetCommoditySearchResultsQuantity(itemID)
local displayedQuantity = 0
if C_AuctionHouse.GetCommoditySearchResultsQuantity(itemID) > 0 then
self.resultInfo = C_AuctionHouse.GetCommoditySearchResultInfo(itemID, 1)

Expand All @@ -56,6 +58,7 @@ function PointBlankSniperBuyFrameMixin:OnEvent(eventName, ...)
GetMoneyString(displayPrice, true) ..
Auctionator.Utilities.CreateCountString(self.resultInfo.quantity)
))
displayedQuantity = self.resultInfo.quantity
else
if PointBlankSniper.Config.Get(PointBlankSniper.Config.Options.ALLOW_GHOST_PURCHASES) then
self.ghostCount = ghostCount
Expand All @@ -64,8 +67,16 @@ function PointBlankSniperBuyFrameMixin:OnEvent(eventName, ...)
GetMoneyString(self.expectedPrice, true) ..
Auctionator.Utilities.CreateCountString(math.max(0, ghostCount))
))
displayedQuantity = math.max(0, ghostCount)
end
end

local quantityRequired = Auctionator.Search.SplitAdvancedSearch(self.rawSearchTermInfo.searchTerm).quantity
if quantityRequired and self.resultInfo and quantityRequired > displayedQuantity then
C_Timer.After(0, function()
Auctionator.EventBus:Fire(self, PointBlankSniper.Events.QuickStart)
end)
end
self:UpdateBuyState()

elseif eventName == "ITEM_SEARCH_RESULTS_UPDATED" then
Expand Down
1 change: 1 addition & 0 deletions Source/Events.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ PointBlankSniper.Events = {

OpenBuyView = "point_blank_sniper_open_buy_frame",
RemoveSearchTerm = "point_blank_sniper_remove_search_term",
QuickStart = "point_blank_sniper_quick_start",
}
3 changes: 3 additions & 0 deletions Source/Tab/Main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function PointBlankSniperTabFrameMixin:OnLoad()
PointBlankSniper.Events.SnipeSearchNewResults,
PointBlankSniper.Events.SnipeSearchComplete,
PointBlankSniper.Events.OpenBuyView,
PointBlankSniper.Events.QuickStart,
})
Auctionator.EventBus:RegisterSource(self, "PointBlankSniperTabFrame")

Expand Down Expand Up @@ -245,6 +246,8 @@ function PointBlankSniperTabFrameMixin:ReceiveEvent(eventName, ...)
})
end
end
elseif eventName == PointBlankSniper.Events.QuickStart then
self:Start()
elseif eventName == PointBlankSniper.Events.OpenBuyView then
self:Stop()
end
Expand Down

0 comments on commit 618919e

Please sign in to comment.