small refactorings, small bugfix and shift click linking item names now always inserts a name without suffix (would otherwise not work anyway)

This commit is contained in:
Manuel Simon Hirsig
2015-09-27 02:20:37 +02:00
parent 60a4f1bf61
commit 3ab03468b2
4 changed files with 31 additions and 20 deletions
+2 -2
View File
@@ -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
+7 -8
View File
@@ -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
+5
View File
@@ -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)
+17 -10
View File
@@ -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,