mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 16:34:45 +00:00
update bag sort (needs more testing)
This commit is contained in:
+28
-25
@@ -152,15 +152,8 @@ local function UpdateLocation(from, to)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function PrimarySort(a, b)
|
local function PrimarySort(a, b)
|
||||||
local aName, _, _, aLvl, _, _, _, _, _, _, aPrice = GetItemInfo(bagIDs[a])
|
local aName = GetItemInfo(bagIDs[a])
|
||||||
local bName, _, _, bLvl, _, _, _, _, _, _, bPrice = GetItemInfo(bagIDs[b])
|
local bName = GetItemInfo(bagIDs[b])
|
||||||
|
|
||||||
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
|
if aName and bName then
|
||||||
return aName < bName
|
return aName < bName
|
||||||
@@ -185,8 +178,8 @@ local function DefaultSort(a, b)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local _, _, aRarity, _, _, aType, aSubType, _, aEquipLoc = GetItemInfo(aID)
|
local _, _, aRarity, _, aType, aSubType, _, aEquipLoc = GetItemInfo(aID)
|
||||||
local _, _, bRarity, _, _, bType, bSubType, _, bEquipLoc = GetItemInfo(bID)
|
local _, _, bRarity, _, bType, bSubType, _, bEquipLoc = GetItemInfo(bID)
|
||||||
|
|
||||||
aRarity = bagQualities[a]
|
aRarity = bagQualities[a]
|
||||||
bRarity = bagQualities[b]
|
bRarity = bagQualities[b]
|
||||||
@@ -368,19 +361,29 @@ function B:ScanBags()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TEMPORARY MAYBE UNTIL ALTERNATIVE FIX
|
local bagType = {
|
||||||
function B:GetItemFamily(bagType)
|
["Bag"] = 0,
|
||||||
local itemSubType = select(6, GetItemInfo(match(bagType, "item:(%d+)")))
|
["Quiver"] = 1,
|
||||||
|
["Ammo Pouch"] = 2,
|
||||||
|
["Soul Bag"] = 4,
|
||||||
|
}
|
||||||
|
|
||||||
if strupper(itemSubType) == "BAG" then
|
function B:GetItemFamily(bagID)
|
||||||
return 0
|
if bagID == KEYRING_CONTAINER then return KEYRING_CONTAINER end
|
||||||
elseif strupper(itemSubType) == "QUIVER" then
|
if bagID == 0 then return 0 end
|
||||||
return 1
|
|
||||||
elseif strupper(itemSubType) == "KEYRING" then
|
local _, _, id = strfind(GetInventoryItemLink("player", ContainerIDToInventoryID(bagID)) or "", "item:(%d+)")
|
||||||
return -2
|
if id then
|
||||||
else
|
local _, _, _, _, itemType, subType = GetItemInfo(id)
|
||||||
return nil
|
local bagSubType = bagType[subType]
|
||||||
|
|
||||||
|
if bagSubType == 0 then return 0 end -- based off https://wow.gamepedia.com/ItemFamily
|
||||||
|
if bagSubType == 1 then return 1 end
|
||||||
|
if bagSubType == 2 then return 2 end
|
||||||
|
if bagSubType == 4 then return 4 end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
function B:IsSpecialtyBag(bagID)
|
function B:IsSpecialtyBag(bagID)
|
||||||
@@ -392,8 +395,8 @@ function B:IsSpecialtyBag(bagID)
|
|||||||
local bag = GetInventoryItemLink("player", inventorySlot)
|
local bag = GetInventoryItemLink("player", inventorySlot)
|
||||||
if not bag then return false end
|
if not bag then return false end
|
||||||
|
|
||||||
local family = B:GetItemFamily(bag)
|
local family = B:GetItemFamily(bagID)
|
||||||
if family == 0 or family == nil then return false end
|
if family == 0 or family == nil then return false else return false end
|
||||||
|
|
||||||
return family
|
return family
|
||||||
end
|
end
|
||||||
@@ -402,7 +405,7 @@ function B:CanItemGoInBag(bag, slot, targetBag)
|
|||||||
local item = bagIDs[B:Encode_BagSlot(bag, slot)]
|
local item = bagIDs[B:Encode_BagSlot(bag, slot)]
|
||||||
local itemFamily = B:GetItemFamily(item)
|
local itemFamily = B:GetItemFamily(item)
|
||||||
if itemFamily and itemFamily > 0 then
|
if itemFamily and itemFamily > 0 then
|
||||||
local equipSlot = select(7, GetItemInfo(item))
|
local equipSlot = select(8, GetItemInfo(item))
|
||||||
if equipSlot == "INVTYPE_BAG" then
|
if equipSlot == "INVTYPE_BAG" then
|
||||||
itemFamily = 1
|
itemFamily = 1
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user