mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-03 20:20:01 +00:00
GetItemCount via C_Item, reagents via C_Spell.GetSpellReagents
Drops the legacy pfUI.api.GetItemCount wrapper (name-based bag walk +
GetItemInfo per slot) entirely — both call sites switch to direct
C_Item.GetItemCount(itemID) calls.
actionbar reagent counter: drops the SPELL_REAGENTS tooltip-scan +
libtipscan dependency. UpdateSlot now does GetActionInfo(slot) →
spellID → C_Spell.GetSpellReagents → reagent itemID, stored per slot.
Counts update via C_Item.GetItemCount(itemID). reagent_counts is
keyed by itemID instead of localized name string. Multi-reagent
spells now resolve cleanly (only first reagent counted, matching old
single-name behavior). Macro and bag-item actions skip cleanly.
questitem: switches to hooksecurefunc("SetItemRef", ...) + the
modern GameTooltip:HasItem / :GetItem pair instead of monkey-patching
_G.SetItemRef and string.find-parsing the "item:NNN" out of the link.
Drops the libtooltip indirection for the regular tooltip path —
GameTooltip:GetItem returns name + itemID directly. AddTooltip
extended to accept the itemID (both callers already had it and were
discarding it).
This commit is contained in:
-25
@@ -406,31 +406,6 @@ function pfUI.api.GetItemLinkByName(name)
|
||||
end
|
||||
end
|
||||
|
||||
-- [ GetItemCount ]
|
||||
-- Returns information about how many of a given item the player has.
|
||||
-- 'itemName' [string] name of the item
|
||||
-- returns: [int] the number of the given item
|
||||
function pfUI.api.GetItemCount(itemName)
|
||||
local count = 0
|
||||
for bag = 4, 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 queryName = GetItemInfo(itemParse)
|
||||
if queryName and queryName ~= "" then
|
||||
if queryName == itemName then
|
||||
count = count + itemCount
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return count
|
||||
end
|
||||
|
||||
-- [ FindItem ]
|
||||
-- Returns the bag and slot position of an item based on the name.
|
||||
-- 'item' [string] name of the item
|
||||
|
||||
Reference in New Issue
Block a user