From a0ec4490a3dceb5c0009b20d6f511bc08d716119 Mon Sep 17 00:00:00 2001 From: shagu Date: Sun, 24 Sep 2017 23:13:25 +0200 Subject: [PATCH] api: fix bagtype detection --- api/api.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/api/api.lua b/api/api.lua index dd7171f0..1ee91a42 100644 --- a/api/api.lua +++ b/api/api.lua @@ -131,19 +131,20 @@ end -- returns: [string] the type of the bag, e.g "QUIVER" function pfUI.api.GetBagFamily(bag) if bag == -2 then return "KEYRING" end + if bag == 0 then return "BAG" end local _, _, id = strfind(GetInventoryItemLink("player", ContainerIDToInventoryID(bag)) or "", "item:(%d+)") if id then local _, _, _, _, itemType, subType = GetItemInfo(id) - local bagtype = L["bagtypes"][itemType] local bagsubtype = L["bagtypes"][subType] + if bagsubtype == "DEFAULT" then return "BAG" end if bagsubtype == "SOULBAG" then return "SOULBAG" end if bagsubtype == "QUIVER" then return "QUIVER" end - if not bagtype and not bagsubtype then return "SPECIAL" end + if bagsubtype == nil then return "SPECIAL" end end - return "BAG" + return nil end -- [ Abbreviate ]