fix #60
This commit is contained in:
@@ -3145,6 +3145,22 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
-- Item Count
|
||||
local itemCountWatchFrame;
|
||||
function WeakAuras.RegisterItemCountWatch()
|
||||
if not(itemCountWatchFrame) then
|
||||
itemCountWatchFrame = CreateFrame("frame");
|
||||
itemCountWatchFrame:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED");
|
||||
itemCountWatchFrame:SetScript("OnEvent", function(_, _, unit)
|
||||
if unit ~= "player" then return end
|
||||
Private.StartProfileSystem("generictrigger");
|
||||
timer:ScheduleTimer(WeakAuras.ScanEvents, 0.2, "ITEM_COUNT_UPDATE");
|
||||
timer:ScheduleTimer(WeakAuras.ScanEvents, 0.5, "ITEM_COUNT_UPDATE");
|
||||
Private.StopProfileSystem("generictrigger");
|
||||
end);
|
||||
end
|
||||
end
|
||||
|
||||
-- Queued Action
|
||||
do
|
||||
local GetActionInfo, GetMacroSpell, GetSpellLink = GetActionInfo, GetMacroSpell, GetSpellLink
|
||||
|
||||
@@ -4124,15 +4124,23 @@ Private.event_prototypes = {
|
||||
"PLAYER_ENTERING_WORLD"
|
||||
}
|
||||
},
|
||||
internal_events = {
|
||||
"ITEM_COUNT_UPDATE",
|
||||
},
|
||||
force_events = "BAG_UPDATE",
|
||||
name = L["Item Count"],
|
||||
loadFunc = function(trigger)
|
||||
if(trigger.use_includeCharges) then
|
||||
WeakAuras.RegisterItemCountWatch();
|
||||
end
|
||||
end,
|
||||
init = function(trigger)
|
||||
trigger.itemName = trigger.itemName or 0;
|
||||
local itemName = type(trigger.itemName) == "number" and trigger.itemName or "[["..trigger.itemName.."]]";
|
||||
local ret = [[
|
||||
local count = GetItemCount(%s, %s);
|
||||
local count = GetItemCount(%s, %s, %s);
|
||||
]];
|
||||
return ret:format(itemName, trigger.use_includeBank and "true" or "nil");
|
||||
return ret:format(itemName, trigger.use_includeBank and "true" or "nil", trigger.use_includeCharges and "true" or "nil");
|
||||
end,
|
||||
args = {
|
||||
{
|
||||
@@ -4148,6 +4156,12 @@ Private.event_prototypes = {
|
||||
type = "toggle",
|
||||
test = "true"
|
||||
},
|
||||
{
|
||||
name = "includeCharges",
|
||||
display = L["Include Charges"],
|
||||
type = "toggle",
|
||||
test = "true"
|
||||
},
|
||||
{
|
||||
name = "count",
|
||||
display = L["Item Count"],
|
||||
@@ -4155,11 +4169,11 @@ Private.event_prototypes = {
|
||||
}
|
||||
},
|
||||
durationFunc = function(trigger)
|
||||
local count = GetItemCount(trigger.itemName, trigger.use_includeBank);
|
||||
local count = GetItemCount(trigger.itemName, trigger.use_includeBank, trigger.use_includeCharges);
|
||||
return count, 0, true;
|
||||
end,
|
||||
stacksFunc = function(trigger)
|
||||
local count = GetItemCount(trigger.itemName, trigger.use_includeBank);
|
||||
local count = GetItemCount(trigger.itemName, trigger.use_includeBank, trigger.use_includeCharges);
|
||||
return count, 0, true;
|
||||
end,
|
||||
nameFunc = function(trigger)
|
||||
|
||||
Reference in New Issue
Block a user