sell panel now remembers the selected entry as long as there is no refresh made
This commit is contained in:
@@ -3,7 +3,6 @@ auxSellEntries = {} -- persisted
|
|||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
local bestPriceOurStackSize
|
local bestPriceOurStackSize
|
||||||
local selectedAuxEntry
|
|
||||||
|
|
||||||
local currentAuctionItemName = nil
|
local currentAuctionItemName = nil
|
||||||
local currentAuctionItemTexture = nil
|
local currentAuctionItemTexture = nil
|
||||||
@@ -83,9 +82,7 @@ end
|
|||||||
|
|
||||||
function Aux_SelectAuxEntry()
|
function Aux_SelectAuxEntry()
|
||||||
|
|
||||||
if not currentAuctionItemName or not auxSellEntries[currentAuctionItemName] then
|
if currentAuctionItemName and auxSellEntries[currentAuctionItemName] and not auxSellEntries[currentAuctionItemName].selected then
|
||||||
selectedAuxEntry = nil
|
|
||||||
else
|
|
||||||
local bestPrice = {} -- a table with one entry per stacksize that is the cheapest auction for that particular stacksize
|
local bestPrice = {} -- a table with one entry per stacksize that is the cheapest auction for that particular stacksize
|
||||||
local absoluteBest -- the overall cheapest auction
|
local absoluteBest -- the overall cheapest auction
|
||||||
|
|
||||||
@@ -101,10 +98,10 @@ function Aux_SelectAuxEntry()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
selectedAuxEntry = absoluteBest
|
auxSellEntries[currentAuctionItemName].selected = absoluteBest
|
||||||
|
|
||||||
if bestPrice[currentAuctionItemStackSize] then
|
if bestPrice[currentAuctionItemStackSize] then
|
||||||
selectedAuxEntry = bestPrice[currentAuctionItemStackSize]
|
auxSellEntries[currentAuctionItemName].selected = bestPrice[currentAuctionItemStackSize]
|
||||||
bestPriceOurStackSize = bestPrice[currentAuctionItemStackSize]
|
bestPriceOurStackSize = bestPrice[currentAuctionItemStackSize]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -121,15 +118,15 @@ function Aux_UpdateRecommendation()
|
|||||||
else
|
else
|
||||||
AuxSellRefreshButton:Enable()
|
AuxSellRefreshButton:Enable()
|
||||||
|
|
||||||
if selectedAuxEntry then
|
if auxSellEntries[currentAuctionItemName] and auxSellEntries[currentAuctionItemName].selected then
|
||||||
if not auxSellEntries[currentAuctionItemName].created or GetTime() - auxSellEntries[currentAuctionItemName].created > 1800 then
|
if not auxSellEntries[currentAuctionItemName].created or GetTime() - auxSellEntries[currentAuctionItemName].created > 1800 then
|
||||||
AuxRecommendLastRefreshText:SetText("STALE DATA") -- data older than half an hour marked as stale
|
AuxRecommendLastRefreshText:SetText("STALE DATA") -- data older than half an hour marked as stale
|
||||||
AuxRecommendLastRefreshText:Show()
|
AuxRecommendLastRefreshText:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
local newBuyoutPrice = selectedAuxEntry.itemPrice * currentAuctionItemStackSize
|
local newBuyoutPrice = auxSellEntries[currentAuctionItemName].selected.itemPrice * currentAuctionItemStackSize
|
||||||
|
|
||||||
if selectedAuxEntry.numYours < selectedAuxEntry.count then
|
if auxSellEntries[currentAuctionItemName].selected.numYours < auxSellEntries[currentAuctionItemName].selected.count then
|
||||||
newBuyoutPrice = undercut(newBuyoutPrice)
|
newBuyoutPrice = undercut(newBuyoutPrice)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -159,9 +156,9 @@ function Aux_UpdateRecommendation()
|
|||||||
MoneyInputFrame_SetCopper(BuyoutPrice, newBuyoutPrice)
|
MoneyInputFrame_SetCopper(BuyoutPrice, newBuyoutPrice)
|
||||||
MoneyInputFrame_SetCopper(StartPrice, newStartPrice)
|
MoneyInputFrame_SetCopper(StartPrice, newStartPrice)
|
||||||
|
|
||||||
if selectedAuxEntry.stackSize == auxSellEntries[currentAuctionItemName][1].stackSize and selectedAuxEntry.buyoutPrice == auxSellEntries[currentAuctionItemName][1].buyoutPrice then
|
if auxSellEntries[currentAuctionItemName].selected.stackSize == auxSellEntries[currentAuctionItemName][1].stackSize and auxSellEntries[currentAuctionItemName].selected.buyoutPrice == auxSellEntries[currentAuctionItemName][1].buyoutPrice then
|
||||||
AuxRecommendBasisText:SetText("(based on cheapest)")
|
AuxRecommendBasisText:SetText("(based on cheapest)")
|
||||||
elseif bestPriceOurStackSize and selectedAuxEntry.stackSize == bestPriceOurStackSize.stackSize and selectedAuxEntry.buyoutPrice == bestPriceOurStackSize.buyoutPrice then
|
elseif bestPriceOurStackSize and auxSellEntries[currentAuctionItemName].selected.stackSize == bestPriceOurStackSize.stackSize and auxSellEntries[currentAuctionItemName].selected.buyoutPrice == bestPriceOurStackSize.buyoutPrice then
|
||||||
AuxRecommendBasisText:SetText("(based on cheapest stack of the same size)")
|
AuxRecommendBasisText:SetText("(based on cheapest stack of the same size)")
|
||||||
else
|
else
|
||||||
AuxRecommendBasisText:SetText("(based on auction selected below)")
|
AuxRecommendBasisText:SetText("(based on auction selected below)")
|
||||||
@@ -208,7 +205,6 @@ end
|
|||||||
|
|
||||||
function Aux_RefreshEntries()
|
function Aux_RefreshEntries()
|
||||||
auxSellEntries[currentAuctionItemName] = nil
|
auxSellEntries[currentAuctionItemName] = nil
|
||||||
selectedAuxEntry = nil
|
|
||||||
|
|
||||||
local sName, sLink, iRarity, iLevel, iMinLevel, sType, sSubType, iStackCount = GetItemInfo(currentAuctionItemName)
|
local sName, sLink, iRarity, iLevel, iMinLevel, sType, sSubType, iStackCount = GetItemInfo(currentAuctionItemName)
|
||||||
|
|
||||||
@@ -259,7 +255,7 @@ function Aux_ScrollbarUpdate()
|
|||||||
|
|
||||||
local entry = auxSellEntries[currentAuctionItemName][dataOffset]
|
local entry = auxSellEntries[currentAuctionItemName][dataOffset]
|
||||||
|
|
||||||
if selectedAuxEntry and entry.itemPrice == selectedAuxEntry.itemPrice and entry.stackSize == selectedAuxEntry.stackSize then
|
if auxSellEntries[currentAuctionItemName].selected and entry.itemPrice == auxSellEntries[currentAuctionItemName].selected.itemPrice and entry.stackSize == auxSellEntries[currentAuctionItemName].selected.stackSize then
|
||||||
lineEntry:LockHighlight()
|
lineEntry:LockHighlight()
|
||||||
else
|
else
|
||||||
lineEntry:UnlockHighlight()
|
lineEntry:UnlockHighlight()
|
||||||
@@ -312,7 +308,7 @@ end
|
|||||||
function AuxSellEntry_OnClick()
|
function AuxSellEntry_OnClick()
|
||||||
local entryIndex = this:GetID()
|
local entryIndex = this:GetID()
|
||||||
|
|
||||||
selectedAuxEntry = auxSellEntries[currentAuctionItemName][entryIndex]
|
auxSellEntries[currentAuctionItemName].selected = auxSellEntries[currentAuctionItemName][entryIndex]
|
||||||
|
|
||||||
Aux_UpdateRecommendation()
|
Aux_UpdateRecommendation()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user