Modules: Fixed AH purchasing; now goes bottom up and also clears on API search query instead of update event
This commit is contained in:
parent
c59d191263
commit
53701ad4df
1 changed files with 8 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
|||
local core = LibStub("AceAddon-3.0"):GetAddon("AllTheLittleThings")
|
||||
local mod = core:NewModule("Macros", "AceTimer-3.0", "AceEvent-3.0")
|
||||
local mod = core:NewModule("Macros", "AceTimer-3.0", "AceEvent-3.0", "AceHook-3.0")
|
||||
local db
|
||||
|
||||
local defaults = {
|
||||
|
@ -21,7 +21,7 @@ function mod:OnInitialize()
|
|||
self:RegisterSlashCommand("Countdown", "cd", "countdown")
|
||||
self:RegisterSlashCommand("RosterCheck", "rc", "rostercheck")
|
||||
self:RegisterSlashCommand("AuctionHouseBuyout", "ahbo")
|
||||
self:RegisterEvent("AUCTION_ITEM_LIST_UPDATE")
|
||||
self:Hook("QueryAuctionItems", true)
|
||||
end
|
||||
|
||||
function mod:DisbandRaid()
|
||||
|
@ -172,11 +172,11 @@ function mod:AuctionHouseBuyout()
|
|||
local selected = GetSelectedAuctionItem("list")
|
||||
if selected>0 then
|
||||
local name,_,count,_,_,_,_,_,price = GetAuctionItemInfo("list", selected)
|
||||
for j=1,50 do
|
||||
for j=50,1,-1 do
|
||||
if not bought[j] and selected ~= j then
|
||||
local t_name,_,t_count,_,_,_,_,_,t_price = GetAuctionItemInfo("list", j)
|
||||
-- must be same item name and equal or less price per unit
|
||||
if (t_name == name) and (t_price>0) and (t_price/t_count <= price/count) then
|
||||
if not bought[j] and selected ~= j then
|
||||
--self:Print("Buying",j,"at",t_price)
|
||||
PlaceAuctionBid("list", j, t_price)
|
||||
bought[j] = true
|
||||
|
@ -191,7 +191,7 @@ function mod:AuctionHouseBuyout()
|
|||
end
|
||||
end
|
||||
|
||||
function mod:AUCTION_ITEM_LIST_UPDATE()
|
||||
function mod:QueryAuctionItems()
|
||||
wipe(bought)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue