Merge branch 'master' into refactor
This commit is contained in:
@@ -82,29 +82,32 @@ function Aux_AuctionsCreateAuctionButton_OnClick()
|
|||||||
MoneyInputFrame_GetCopper(BuyoutPrice),
|
MoneyInputFrame_GetCopper(BuyoutPrice),
|
||||||
currentAuction.stackCount,
|
currentAuction.stackCount,
|
||||||
function(posted)
|
function(posted)
|
||||||
local entry
|
if posted > 0 and buyoutPrice > 0 then
|
||||||
for _, existingEntry in ipairs(auxSellEntries[name]) do
|
auxSellEntries[name] = auxSellEntries[name] or { created=GetTime() }
|
||||||
if existingEntry.buyoutPrice == buyoutPrice and existingEntry.stackSize == stackSize then
|
local entry
|
||||||
existingEntry.count = existingEntry.count + posted
|
for _, existingEntry in ipairs(auxSellEntries[name]) do
|
||||||
existingEntry.numYours = existingEntry.numYours + posted
|
if existingEntry.buyoutPrice == buyoutPrice and existingEntry.stackSize == stackSize then
|
||||||
existingEntry.maxTimeLeft = max(existingEntry.maxTimeLeft, duration)
|
existingEntry.count = existingEntry.count + posted
|
||||||
entry = existingEntry
|
existingEntry.numYours = existingEntry.numYours + posted
|
||||||
|
existingEntry.maxTimeLeft = max(existingEntry.maxTimeLeft, duration)
|
||||||
|
entry = existingEntry
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
if not entry then
|
||||||
|
entry = {
|
||||||
|
stackSize = stackSize,
|
||||||
|
buyoutPrice = buyoutPrice,
|
||||||
|
itemPrice = buyoutPrice / stackSize,
|
||||||
|
maxTimeLeft = duration,
|
||||||
|
count = posted,
|
||||||
|
numYours = posted,
|
||||||
|
}
|
||||||
|
tinsert(auxSellEntries[name], entry)
|
||||||
|
table.sort(auxSellEntries[name], function(a,b) return a.itemPrice < b.itemPrice end)
|
||||||
|
end
|
||||||
|
auxSellEntries[name].selected = entry
|
||||||
|
Aux_UpdateRecommendation()
|
||||||
end
|
end
|
||||||
if not entry then
|
|
||||||
entry = {
|
|
||||||
stackSize = stackSize,
|
|
||||||
buyoutPrice = buyoutPrice,
|
|
||||||
itemPrice = buyoutPrice / stackSize,
|
|
||||||
maxTimeLeft = duration,
|
|
||||||
count = posted,
|
|
||||||
numYours = posted,
|
|
||||||
}
|
|
||||||
tinsert(auxSellEntries[name], entry)
|
|
||||||
table.sort(auxSellEntries[name], function(a,b) return a.itemPrice < b.itemPrice end)
|
|
||||||
end
|
|
||||||
auxSellEntries[name].selected = entry
|
|
||||||
Aux_UpdateRecommendation()
|
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
@@ -183,7 +186,7 @@ function Aux_UpdateRecommendation()
|
|||||||
|
|
||||||
local newBuyoutPrice = auxSellEntries[currentAuction.name].selected.itemPrice * currentAuction.stackSize
|
local newBuyoutPrice = auxSellEntries[currentAuction.name].selected.itemPrice * currentAuction.stackSize
|
||||||
|
|
||||||
if auxSellEntries[currentAuction.name].selected.numYours < auxSellEntries[currentAuction.name].selected.count then
|
if auxSellEntries[currentAuction.name].selected.numYours == 0 then
|
||||||
newBuyoutPrice = undercut(newBuyoutPrice)
|
newBuyoutPrice = undercut(newBuyoutPrice)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user