diff --git a/buy.lua b/buy.lua index ae27877..320b3c4 100644 --- a/buy.lua +++ b/buy.lua @@ -32,7 +32,7 @@ function AuxBuySearchButton_OnClick() end, on_read_auction = function(i) local auction_item = Aux.info.auction_item(i) - local stack_size = auction_item.charges and auction_item.charges or auction_item.count + local stack_size = auction_item.charges or auction_item.count record_auction(auction_item.name, stack_size, auction_item.buyout_price, auction_item.quality, auction_item.owner, auction_item.itemlink) end, on_complete = function() @@ -104,7 +104,7 @@ function AuxBuyBuySelectedButton_OnClick() order[key] = nil end else - local stack_size = auction_item.charges and auction_item.charges or auction_item.count + local stack_size = auction_item.charges or auction_item.count record_auction(auction_item.name, stack_size, auction_item.charges, auction_item.buyout_price, auction_item.quality, auction_item.owner, auction_item.itemlink) end end diff --git a/core.lua b/core.lua index 660dffc..49b3fb9 100644 --- a/core.lua +++ b/core.lua @@ -414,9 +414,9 @@ function Aux_BrowseButton_OnMouseDown() SetSelectedAuctionItem("list", index) - local _, _, _, _, _, _, _, _, buyoutPrice = GetAuctionItemInfo("list", index) - if buyoutPrice > 0 then - PlaceAuctionBid("list", index, buyoutPrice) + local auction_item = Aux.info.auction_item(index) + if auction_item.buyout_price > 0 then + PlaceAuctionBid("list", index, auction_item.buyout_price) end AuctionFrameBrowse_Update() @@ -449,13 +449,12 @@ function Aux_ContainerFrameItemButton_OnClick(button) and AuctionFrame:IsVisible() and (PanelTemplates_GetSelectedTab(AuctionFrame) == 1 or PanelTemplates_GetSelectedTab(AuctionFrame) == Aux.tabs.buy.index) then - local itemLink = GetContainerItemLink(this:GetParent():GetID(), this:GetID()) - if itemLink then - local itemName = string.gsub(itemLink, "^.-%[(.*)%].*", "%1") + local container_item = Aux.info.container_item(this:GetParent():GetID(), this:GetID()) + if container_item then if PanelTemplates_GetSelectedTab(AuctionFrame) == 1 then - BrowseName:SetText(itemName) + BrowseName:SetText(container_item.name) elseif PanelTemplates_GetSelectedTab(AuctionFrame) == Aux.tabs.buy.index then - AuxBuySearchBox:SetText(itemName) + AuxBuySearchBox:SetText(container_item.name) end end else diff --git a/info.lua b/info.lua index 356a9b3..57374fd 100644 --- a/info.lua +++ b/info.lua @@ -4,6 +4,11 @@ local itemlink_item, item_id, item_charges function Aux.info.container_item(bag, slot) local itemlink = GetContainerItemLink(bag, slot) + + if not itemlink then + return + end + local container_item = itemlink_item(itemlink) local texture, count, locked, quality, readable, lootable, itemlink = GetContainerItemInfo(bag, slot) diff --git a/sell.lua b/sell.lua index 97498f8..a1a60af 100644 --- a/sell.lua +++ b/sell.lua @@ -262,11 +262,12 @@ function Aux_OnNewAuctionUpdate() end local auctionItemName, auctionItemTexture, auctionItemStackSize = GetAuctionSellItemInfo() + local auction_sell_item = Aux.info.auction_sell_item() - currentAuction = auctionItemName and { - name = auctionItemName, - texture = auctionItemTexture, - stackSize = Aux.info.auction_sell_item().charges or auctionItemStackSize, + currentAuction = auction_sell_item.name and { + name = auction_sell_item.name, + texture = auction_sell_item.texture, + stackSize = auction_sell_item.charges or auction_sell_item.count, stackCount = 1, } @@ -282,17 +283,19 @@ end function Aux_RefreshEntries() if currentAuction then - auxSellEntries[currentAuction.name] = nil + local name = currentAuction.name - local _, _, _, _, _, sType, sSubType = GetItemInfo(currentAuction.name) + auxSellEntries[name] = nil + + local _, _, _, _, _, sType, sSubType = GetItemInfo(name) local currentAuctionClass = ItemType2AuctionClass(sType) local currentAuctionSubclass = nil -- SubType2AuctionSubclass(currentAuctionClass, sSubType) - + Aux.sell.set_message('Scanning auctions ...') Aux.scan.start{ query = Aux.scan.create_query{ - name = currentAuction.name, + name = name, classIndex = currentAuctionClass, subclassIndex = currentAuctionSubclass }, @@ -301,12 +304,16 @@ function Aux_RefreshEntries() end, on_read_auction = function(i) local auction_item = Aux.info.auction_item(i) - if auction_item.name == currentAuction.name then - local stack_size = auction_item.charges and auction_item.charges or auction_item.count + if auction_item.name == name then + local stack_size = auction_item.charges or auction_item.count record_auction(auction_item.name, stack_size, auction_item.buyout_price, auction_item.duration, auction_item.owner) end end, + on_abort = function() + auxSellEntries[name] = nil + end, on_complete = function() + auxSellEntries[name] = auxSellEntries[name] or { created = GetTime() } Aux_SelectAuxEntry() Aux_UpdateRecommendation() end,