mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 16:34:45 +00:00
clean GetItemCount
This commit is contained in:
@@ -7,7 +7,7 @@ local select = select
|
||||
local tonumber = tonumber
|
||||
local type = type
|
||||
local unpack = unpack
|
||||
local format, gsub, lower, match, upper = string.format, string.gsub, string.lower, string.match, string.upper
|
||||
local find, format, gsub, lower, match, upper = string.find, string.format, string.gsub, string.lower, string.match, string.upper
|
||||
local getn = table.getn
|
||||
--WoW API
|
||||
local GetItemInfo = GetItemInfo
|
||||
@@ -403,16 +403,16 @@ end
|
||||
|
||||
function GetItemCount(itemName)
|
||||
local count = 0
|
||||
for bag = 4, 0, -1 do
|
||||
for bag = NUM_BAG_FRAMES, 0, -1 do
|
||||
for slot = 1, GetContainerNumSlots(bag) do
|
||||
local _, itemCount = GetContainerItemInfo(bag, slot)
|
||||
if itemCount then
|
||||
local itemLink = GetContainerItemLink(bag,slot)
|
||||
local _, _, itemParse = strfind(itemLink, "(%d+):")
|
||||
local itemLink = GetContainerItemLink(bag, slot)
|
||||
local _, _, itemParse = find(itemLink, "(%d+):")
|
||||
local queryName, _, _, _, _, _ = GetItemInfo(itemParse)
|
||||
if queryName and queryName ~= "" then
|
||||
if queryName == itemName then
|
||||
count = count + itemCount
|
||||
count = count + itemCount
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user