update Sort price

This commit is contained in:
Crum
2018-08-06 12:22:52 -05:00
parent 9c760be120
commit 9d77866577
2 changed files with 13 additions and 5 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local B = E:NewModule("Bags", "AceHook-3.0", "AceEvent-3.0", "AceTimer-3.0");
local Search = LibStub("LibItemSearch-1.2");
local LIP = LibStub("ItemPrice-1.1", true);
local LIP = LibStub("ItemPrice-1.1");
--Cache global variables
--Lua functions
+10 -2
View File
@@ -1,6 +1,7 @@
local E, L, V, P, G = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local B = E:GetModule("Bags");
local Search = LibStub("LibItemSearch-1.2");
local LIP = LibStub("ItemPrice-1.1");
--Cache global variables
--Lua functions
@@ -149,13 +150,20 @@ local function UpdateLocation(from, to)
end
local function PrimarySort(a, b)
local aName, _, _, aLvl = GetItemInfo(bagIDs[a])
local bName, _, _, bLvl = GetItemInfo(bagIDs[b])
local aName, aLink, _, aLvl = GetItemInfo(bagIDs[a])
local bName, bLink, _, bLvl = GetItemInfo(bagIDs[b])
local aPrice = LIP:GetSellValue(aLink)
local bPrice = LIP:GetSellValue(bLink)
if aLvl ~= bLvl and aLvl and bLvl then
return aLvl > bLvl
end
if aPrice ~= bPrice and aPrice and bPrice then
return aPrice > bPrice
end
if aName and bName then
return aName < bName
end