update bags

This commit is contained in:
Bunny67
2018-07-08 10:49:19 +03:00
parent 9f756d4098
commit d8539f81fe
3 changed files with 11 additions and 8 deletions
+7
View File
@@ -279,6 +279,13 @@ local bagTypes = {
} }
function GetItemFamily(id) function GetItemFamily(id)
if not id then return end
if type(id) == "table" or type(id) == "function" then return end
if type(id) == "string" then
id = match(id, "item:(%d+)")
end
local _, _, _, _, _, itemType = GetItemInfo(id) local _, _, _, _, _, itemType = GetItemInfo(id)
return bagTypes[itemType] return bagTypes[itemType]
end end
+1 -5
View File
@@ -449,11 +449,7 @@ function B:Layout(isBank)
end end
f.Bags[bagID].numSlots = numSlots f.Bags[bagID].numSlots = numSlots
local link = GetInventoryItemLink("player", ContainerIDToInventoryID(bagID)) f.Bags[bagID].type = GetItemFamily(GetInventoryItemLink("player", ContainerIDToInventoryID(bagID)))
if link then
local _, _, id = strfind(link, "item:(%d+)")
f.Bags[bagID].type = GetItemFamily(id)
end
--Hide unused slots --Hide unused slots
for i = 1, MAX_CONTAINER_ITEMS do for i = 1, MAX_CONTAINER_ITEMS do
+3 -3
View File
@@ -371,7 +371,7 @@ 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 = GetItemFamily(match(bag, "item:(%d+)")) local family = GetItemFamily(bag)
if family == 0 or family == nil then return false end if family == 0 or family == nil then return false end
return family return family
@@ -379,14 +379,14 @@ end
function B:CanItemGoInBag(bag, slot, targetBag) function B:CanItemGoInBag(bag, slot, targetBag)
local item = bagIDs[B:Encode_BagSlot(bag, slot)] local item = bagIDs[B:Encode_BagSlot(bag, slot)]
local itemFamily = GetItemFamily(match(item, "item:(%d+)")) local itemFamily = GetItemFamily(item)
if itemFamily then if itemFamily then
local equipSlot = select(8, GetItemInfo(item)) local equipSlot = select(8, GetItemInfo(item))
if equipSlot == "INVTYPE_BAG" then if equipSlot == "INVTYPE_BAG" then
itemFamily = 1 itemFamily = 1
end end
end end
local bagFamily = GetItemFamily(match(targetBag, "item:(%d+)")) local bagFamily = GetItemFamily(targetBag)
if itemFamily then if itemFamily then
return (bagFamily == 0) or band(itemFamily, bagFamily) > 0 return (bagFamily == 0) or band(itemFamily, bagFamily) > 0
else else