from retail

This commit is contained in:
NoM0Re
2025-01-23 22:04:34 +01:00
parent 10cc113802
commit df23f7238e
8 changed files with 303 additions and 200 deletions
+1 -1
View File
@@ -997,7 +997,7 @@ local function GetAllUnits(unit, allUnits, includePets)
elseif unit == "arena" then
max = 5
elseif unit == "nameplate" then
max = C_NamePlate and C_NamePlate.GetNamePlates and #C_NamePlate.GetNamePlates() or 40
max = 100
else
return function() end
end
+1 -2
View File
@@ -341,8 +341,7 @@ local function CreateTestForCondition(data, input, allConditionsTemplate, usedSt
local found = 0
local op = %q
local range = %s
local max = C_NamePlate and C_NamePlate.GetNamePlates and #C_NamePlate.GetNamePlates() or 40
for i = 1, max do
for i = 1, 100 do
local unit = "nameplate" .. i
if UnitExists(unit) and UnitCanAttack("player", unit) and WeakAuras.CheckRange(unit, range, op) then
found = found + 1
+234 -140
View File
@@ -706,7 +706,7 @@ local function RunTriggerFunc(allStates, data, id, triggernum, event, arg1, arg2
end
elseif (data.statesParameter == "unit") then
if arg1 then
if Private.multiUnitUnits[data.trigger.unit] or data.trigger.unit == "nameplate" then
if Private.multiUnitUnits[data.trigger.unit] then
unitForUnitTrigger = arg1
cloneIdForUnitTrigger = arg1
else
@@ -847,6 +847,16 @@ local function getGameEventFromComposedEvent(composedEvent)
return separatorPosition == nil and composedEvent or composedEvent:sub(1, separatorPosition - 1)
end
function Private.ScanEventsByID(event, id, ...)
if loaded_events[event] then
WeakAuras.ScanEvents(event, id, ...)
end
local eventWithID = event .. ":" .. id
if loaded_events[eventWithID] then
WeakAuras.ScanEvents(eventWithID, id, ...)
end
end
function WeakAuras.ScanEvents(event, arg1, arg2, ...)
local system = getGameEventFromComposedEvent(event)
Private.StartProfileSystem("generictrigger " .. system)
@@ -1142,8 +1152,8 @@ function HandleEvent(frame, event, arg1, arg2, ...)
end
if (event == "PLAYER_ENTERING_WORLD") then
timer:ScheduleTimer(function()
Private.StartProfileSystem("generictrigger WA_DELAYED_PLAYER_ENTERING_WORLD");
HandleEvent(frame, "WA_DELAYED_PLAYER_ENTERING_WORLD");
Private.StartProfileSystem("generictrigger WA_DELAYED_PLAYER_ENTERING_WORLD");
Private.ScanForLoads(nil, "WA_DELAYED_PLAYER_ENTERING_WORLD")
Private.CheckCooldownReady();
Private.StopProfileSystem("generictrigger WA_DELAYED_PLAYER_ENTERING_WORLD");
@@ -1260,7 +1270,7 @@ local function MultiUnitLoop(Func, unit, includePets, ...)
Func(unit..i, ...)
end
elseif unit == "nameplate" then
for i = 1, 400 do
for i = 1, 100 do
Func(unit..i, ...)
end
elseif unit == "group" then
@@ -1741,6 +1751,8 @@ function GenericTrigger.Add(data, region)
tinsert(trigger_subevents, subevent)
hasParam = true
end
elseif Private.InternalEventByIDList[trueEvent] then
tinsert(trigger_events, trueEvent..":"..i)
elseif trueEvent:match("^UNIT_") then
isUnitEvent = true
@@ -2476,14 +2488,14 @@ do
itemCdDurs[id] = nil;
itemCdExps[id] = nil;
itemCdEnabled[id] = 1;
WeakAuras.ScanEvents("ITEM_COOLDOWN_READY:" .. id, id);
Private.ScanEventsByID("ITEM_COOLDOWN_READY", id);
end
local function ItemSlotCooldownFinished(id)
itemSlotsCdHandles[id] = nil;
itemSlotsCdDurs[id] = nil;
itemSlotsCdExps[id] = nil;
WeakAuras.ScanEvents("ITEM_SLOT_COOLDOWN_READY:" .. id, id);
Private.ScanEventsByID("ITEM_SLOT_COOLDOWN_READY", id);
end
function Private.CheckRuneCooldown()
@@ -2584,7 +2596,7 @@ do
end
if changed and not WeakAuras.IsPaused() then
WeakAuras.ScanEvents("SPELL_COOLDOWN_CHANGED:" .. id, id)
Private.ScanEventsByID("SPELL_COOLDOWN_CHANGED", id)
end
end
end
@@ -2609,15 +2621,15 @@ do
if not WeakAuras.IsPaused() then
if nowReady then
WeakAuras.ScanEvents("SPELL_COOLDOWN_READY:" .. id, id)
Private.ScanEventsByID("SPELL_COOLDOWN_READY", id)
end
if changed or chargesChanged then
WeakAuras.ScanEvents("SPELL_COOLDOWN_CHANGED:" .. id, id)
Private.ScanEventsByID("SPELL_COOLDOWN_CHANGED", id)
end
if (chargesDifference ~= 0 ) then
WeakAuras.ScanEvents("SPELL_CHARGES_CHANGED:" .. id, id, chargesDifference, spellCount or 0);
Private.ScanEventsByID("SPELL_CHARGES_CHANGED", id, chargesDifference, spellCount or 0);
end
end
end
@@ -2656,7 +2668,7 @@ do
itemCdExps[id] = endTime;
itemCdHandles[id] = timer:ScheduleTimer(ItemCooldownFinished, endTime - time, id);
if not WeakAuras.IsPaused() then
WeakAuras.ScanEvents("ITEM_COOLDOWN_STARTED:" .. id, id)
Private.ScanEventsByID("ITEM_COOLDOWN_STARTED", id)
end
itemCdEnabledChanged = false;
elseif(itemCdExps[id] ~= endTime) then
@@ -2668,7 +2680,7 @@ do
itemCdExps[id] = endTime;
itemCdHandles[id] = timer:ScheduleTimer(ItemCooldownFinished, endTime - time, id);
if not WeakAuras.IsPaused() then
WeakAuras.ScanEvents("ITEM_COOLDOWN_CHANGED:" .. id, id)
Private.ScanEventsByID("ITEM_COOLDOWN_CHANGED", id)
end
itemCdEnabledChanged = false;
end
@@ -2686,7 +2698,7 @@ do
end
end
if (itemCdEnabledChanged and not WeakAuras.IsPaused()) then
WeakAuras.ScanEvents("ITEM_COOLDOWN_CHANGED:" .. id, id);
Private.ScanEventsByID("ITEM_COOLDOWN_CHANGED", id);
end
end
end
@@ -2711,7 +2723,7 @@ do
itemSlotsCdExps[id] = endTime;
itemSlotsCdHandles[id] = timer:ScheduleTimer(ItemSlotCooldownFinished, endTime - time, id);
if not WeakAuras.IsPaused() then
WeakAuras.ScanEvents("ITEM_SLOT_COOLDOWN_STARTED:" .. id, id)
Private.ScanEventsByID("ITEM_SLOT_COOLDOWN_STARTED", id)
end
elseif(itemSlotsCdExps[id] ~= endTime) then
-- Cooldown is now different
@@ -2722,7 +2734,7 @@ do
itemSlotsCdExps[id] = endTime;
itemSlotsCdHandles[id] = timer:ScheduleTimer(ItemSlotCooldownFinished, endTime - time, id);
if not WeakAuras.IsPaused() then
WeakAuras.ScanEvents("ITEM_SLOT_COOLDOWN_CHANGED:" .. id, id)
Private.ScanEventsByID("ITEM_SLOT_COOLDOWN_CHANGED", id)
end
end
elseif(duration > 0) then
@@ -2741,7 +2753,7 @@ do
local newItemId = GetInventoryItemID("player", id);
if (itemId ~= newItemId) then
if not WeakAuras.IsPaused() then
WeakAuras.ScanEvents("ITEM_SLOT_COOLDOWN_ITEM_CHANGED:" .. id, id)
Private.ScanEventsByID("ITEM_SLOT_COOLDOWN_ITEM_CHANGED", id)
end
itemSlots[id] = newItemId or 0;
end
@@ -2891,12 +2903,15 @@ function WeakAuras.WatchUnitChange(unit)
unit = string.lower(unit)
if not watchUnitChange then
watchUnitChange = CreateFrame("Frame");
watchUnitChange.unitChangeGUIDS = {}
watchUnitChange.trackedUnits = {}
watchUnitChange.unitIdToGUID = {}
watchUnitChange.GUIDToUnitIds = {}
watchUnitChange.unitRoles = {}
watchUnitChange.unitRaidRole = {}
watchUnitChange.inRaid = IsInRaid()
watchUnitChange.nameplateFaction = {}
watchUnitChange.raidmark = {}
watchUnitChange.unitIsUnit = {}
Private.frames["Unit Change Frame"] = watchUnitChange;
watchUnitChange:RegisterEvent("PLAYER_TARGET_CHANGED")
@@ -2915,115 +2930,200 @@ function WeakAuras.WatchUnitChange(unit)
watchUnitChange:RegisterEvent("UNIT_PET")
watchUnitChange:RegisterEvent("RAID_TARGET_UPDATE")
local function unitUpdate(unitA, eventsToSend)
local oldGUID = watchUnitChange.unitIdToGUID[unitA]
local newGUID = WeakAuras.UnitExistsFixed(unitA) and UnitGUID(unitA)
if oldGUID ~= newGUID then
eventsToSend["UNIT_CHANGED_" .. unitA] = unitA
if watchUnitChange.GUIDToUnitIds[oldGUID] then
for unitB in pairs(watchUnitChange.GUIDToUnitIds[oldGUID]) do
eventsToSend["UNIT_IS_UNIT_CHANGED_" .. unitA .. "_" .. unitB] = unitA
eventsToSend["UNIT_IS_UNIT_CHANGED_" .. unitB .. "_" .. unitA] = unitB
end
end
if watchUnitChange.GUIDToUnitIds[newGUID] then
for unitB in pairs(watchUnitChange.GUIDToUnitIds[newGUID]) do
eventsToSend["UNIT_IS_UNIT_CHANGED_" .. unitA .. "_" .. unitB] = unitA
eventsToSend["UNIT_IS_UNIT_CHANGED_" .. unitB .. "_" .. unitA] = unitB
end
end
end
-- update data
if oldGUID and watchUnitChange.GUIDToUnitIds[oldGUID] then
watchUnitChange.GUIDToUnitIds[oldGUID][unitA] = nil
if next(watchUnitChange.GUIDToUnitIds[oldGUID]) == nil then
watchUnitChange.GUIDToUnitIds[oldGUID] = nil
end
end
if newGUID then
watchUnitChange.GUIDToUnitIds[newGUID] = watchUnitChange.GUIDToUnitIds[newGUID] or {}
watchUnitChange.GUIDToUnitIds[newGUID][unitA] = true
end
watchUnitChange.unitIdToGUID[unitA] = newGUID
end
local function markerUpdate(unit, eventsToSend)
local oldMarker = watchUnitChange.raidmark[unit]
local newMarker = GetRaidTargetIndex(unit) or 0
if newMarker ~= oldMarker then
eventsToSend["UNIT_CHANGED_" .. unit] = unit
watchUnitChange.raidmark[unit] = newMarker
end
end
local function markerInit(unit)
watchUnitChange.raidmark[unit] = GetRaidTargetIndex(unit) or 0
end
local function markerClear(unit)
watchUnitChange.raidmark[unit] = nil
end
local function reactionUpdate(unit, eventsToSend)
local oldReaction = watchUnitChange.nameplateFaction[unit]
local newReaction = WeakAuras.GetPlayerReaction(unit)
if oldReaction ~= newReaction then
eventsToSend["UNIT_CHANGED_" .. unit] = unit
watchUnitChange.nameplateFaction[unit] = newReaction
end
end
local function reactionInit(unit)
watchUnitChange.nameplateFaction[unit] = WeakAuras.GetPlayerReaction(unit)
end
local function reactionClear(unit)
watchUnitChange.nameplateFaction[unit] = nil
end
local function roleUpdate(unit, eventsToSend)
local oldRaidRole = watchUnitChange.unitRaidRole[unit]
local newRaidRole = WeakAuras.UnitRaidRole(unit)
if oldRaidRole ~= newRaidRole then
eventsToSend["UNIT_ROLE_CHANGED_" .. unit] = unit
watchUnitChange.unitRaidRole[unit] = newRaidRole
end
end
watchUnitChange:SetScript("OnEvent", function(self, event, unit)
Private.StartProfileSystem("generictrigger unit change");
if event == "UNIT_PET" then
local pet = WeakAuras.unitToPetUnit[unit]
if pet then
WeakAuras.ScanEvents("UNIT_CHANGED_" .. pet, pet)
end
elseif event == "RAID_TARGET_UPDATE" then
for unit, marker in pairs(watchUnitChange.raidmark) do
local newMarker = GetRaidTargetIndex(unit) or 0
if marker ~= newMarker then
watchUnitChange.raidmark[unit] = newMarker
if unit:find("^nameplate%d+$") then
WeakAuras.ScanEvents("UNIT_CHANGED_nameplate", unit)
else
WeakAuras.ScanEvents("UNIT_CHANGED_" .. unit, unit)
end
end
local eventsToSend = {}
if event == "PLAYER_ENTERING_WORLD" then
for unit in pairs(watchUnitChange.unitIdToGUID) do
unitUpdate(unit, eventsToSend)
markerUpdate(unit, eventsToSend)
reactionUpdate(unit, eventsToSend)
end
elseif event == "NAME_PLATE_UNIT_ADDED" then
local oldGUID = watchUnitChange.unitChangeGUIDS[unit]
local newGUID = WeakAuras.UnitExistsFixed(unit) and UnitGUID(unit)
if oldGUID ~= newGUID then
WeakAuras.ScanEvents("UNIT_CHANGED_nameplate", unit)
if not watchUnitChange.trackedUnits[unit] then
Private.StopProfileSystem("generictrigger unit change");
return
end
watchUnitChange.unitChangeGUIDS[unit] = newGUID
watchUnitChange.raidmark[unit] = GetRaidTargetIndex(unit) or 0
watchUnitChange.nameplateFaction[unit] = WeakAuras.GetPlayerReaction(unit)
WeakAuras.ScanEvents("UNIT_CHANGED_nameplate", unit)
unitUpdate(unit, eventsToSend)
markerInit(unit)
reactionInit(unit)
elseif event == "NAME_PLATE_UNIT_REMOVED" then
local oldGUID = watchUnitChange.unitChangeGUIDS[unit]
local newGUID = WeakAuras.UnitExistsFixed(unit) and UnitGUID(unit)
if oldGUID ~= newGUID then
WeakAuras.ScanEvents("UNIT_CHANGED_nameplate", unit)
if not watchUnitChange.trackedUnits[unit] then
Private.StopProfileSystem("generictrigger unit change");
return
end
watchUnitChange.unitChangeGUIDS[unit] = newGUID
watchUnitChange.raidmark[unit] = nil
watchUnitChange.nameplateFaction[unit] = nil
WeakAuras.ScanEvents(event, unit)
elseif event == "UNIT_FACTION" then
local oldReaction = watchUnitChange.nameplateFaction[unit]
local newReaction = WeakAuras.GetPlayerReaction(unit)
if oldReaction ~= newReaction then
watchUnitChange.nameplateFaction[unit] = newReaction
if unit:find("^nameplate%d+$") then
WeakAuras.ScanEvents("UNIT_CHANGED_nameplate", unit)
else
WeakAuras.ScanEvents("UNIT_CHANGED_" .. unit, unit)
unitUpdate(unit, eventsToSend)
markerClear(unit)
reactionClear(unit)
elseif event == "INSTANCE_ENCOUNTER_ENGAGE_UNIT" then
for i = 1, 5 do
local unit = "boss" .. i
if watchUnitChange.trackedUnits[unit] then
unitUpdate(unit, eventsToSend)
markerInit(unit)
reactionInit(unit)
end
end
elseif event == "PLAYER_TARGET_CHANGED" then
if not watchUnitChange.trackedUnits["target"] then
Private.StopProfileSystem("generictrigger unit change");
return
end
unitUpdate("target", eventsToSend)
markerInit("target")
reactionInit("target")
elseif event == "PLAYER_FOCUS_CHANGED" then
if not watchUnitChange.trackedUnits["focus"] then
Private.StopProfileSystem("generictrigger unit change");
return
end
unitUpdate("focus", eventsToSend)
markerInit("focus")
reactionInit("focus")
elseif event == "RAID_TARGET_UPDATE" then
for unit in pairs(watchUnitChange.raidmark) do
markerUpdate(unit, eventsToSend)
end
elseif event == "UNIT_FACTION" then
if watchUnitChange.trackedUnits[unit] then
reactionUpdate(unit, eventsToSend)
end
elseif event == "UNIT_PET" then
local pet = WeakAuras.unitToPetUnit[unit]
if pet and watchUnitChange.trackedUnits[pet] then
eventsToSend["UNIT_CHANGED_" .. pet] = pet
end
elseif event == "PLAYER_ROLES_ASSIGNED" then
for unit in pairs(Private.multiUnitUnits.group) do
local oldRaidRole = watchUnitChange.unitRaidRole[unit]
local newRaidRole = WeakAuras.UnitRaidRole(unit)
if oldRaidRole ~= newRaidRole then
if unit:find("^nameplate%d+$") then
WeakAuras.ScanEvents("UNIT_ROLE_CHANGED_nameplate", unit)
else
WeakAuras.ScanEvents("UNIT_ROLE_CHANGED_" .. unit, unit)
end
watchUnitChange.unitRaidRole[unit] = newRaidRole
if watchUnitChange.trackedUnits[unit] then
roleUpdate(unit, eventsToSend)
end
end
elseif event == "UNIT_TARGET" then
local unitTarget = unit .. "target"
if not watchUnitChange.trackedUnits[unitTarget] then
Private.StopProfileSystem("generictrigger unit change");
return
end
unitUpdate(unitTarget, eventsToSend)
markerInit(unitTarget)
reactionInit(unitTarget)
elseif event == "PARTY_MEMBERS_CHANGED" or event == "RAID_ROSTER_UPDATE" then
for unit in pairs(Private.multiUnitUnits.group) do
if watchUnitChange.trackedUnits[unit] then
unitUpdate(unit, eventsToSend)
markerInit(unit, eventsToSend)
reactionInit(unit, eventsToSend)
end
end
else
local inRaid = IsInRaid()
local inRaidChanged = inRaid ~= watchUnitChange.inRaid
for unit, guid in pairs(watchUnitChange.unitChangeGUIDS) do
local newGuid = WeakAuras.UnitExistsFixed(unit) and UnitGUID(unit) or ""
local newMarker = GetRaidTargetIndex(unit) or 0
if guid ~= newGuid
or newMarker ~= watchUnitChange.raidmark[unit]
or event == "PLAYER_ENTERING_WORLD"
then
if unit:find("^nameplate%d+$") then
WeakAuras.ScanEvents("UNIT_CHANGED_nameplate", unit)
else
WeakAuras.ScanEvents("UNIT_CHANGED_" .. unit, unit)
end
watchUnitChange.unitChangeGUIDS[unit] = newGuid
watchUnitChange.raidmark[unit] = newMarker
local oldReaction = watchUnitChange.nameplateFaction[unit]
local newReaction = WeakAuras.GetPlayerReaction(unit)
if oldReaction ~= newReaction then
watchUnitChange.nameplateFaction[unit] = newReaction
if unit:find("^nameplate%d+$") then
WeakAuras.ScanEvents("UNIT_CHANGED_nameplate", unit)
else
WeakAuras.ScanEvents("UNIT_CHANGED_" .. unit, unit)
end
end
elseif Private.multiUnitUnits.group[unit] then
-- If in raid changed we send a UNIT_CHANGED for the group units
if inRaidChanged then
WeakAuras.ScanEvents("UNIT_CHANGED_" .. unit, unit)
if inRaidChanged then
for unit in pairs(Private.multiUnitUnits.group) do
if watchUnitChange.trackedUnits[unit] and watchUnitChange.unitIdToGUID[unit] then
eventsToSend["UNIT_CHANGED_" .. unit] = unit
end
end
watchUnitChange.inRaid = inRaid
end
watchUnitChange.inRaid = inRaid
end
-- send events
for event, unit in pairs(eventsToSend) do
WeakAuras.ScanEvents(event, unit)
end
Private.StopProfileSystem("generictrigger unit change");
end)
end
watchUnitChange.unitChangeGUIDS = watchUnitChange.unitChangeGUIDS or {}
watchUnitChange.unitChangeGUIDS[unit] = UnitGUID(unit) or ""
if watchUnitChange.trackedUnits[unit] then
return
end
local guid = UnitGUID(unit)
watchUnitChange.trackedUnits[unit] = true
watchUnitChange.unitIdToGUID[unit] = guid
if guid then
watchUnitChange.GUIDToUnitIds[guid] = watchUnitChange.GUIDToUnitIds[guid] or {}
watchUnitChange.GUIDToUnitIds[guid][unit] = true
end
watchUnitChange.raidmark = watchUnitChange.raidmark or {}
watchUnitChange.raidmark[unit] = GetRaidTargetIndex(unit) or 0
watchUnitChange.inRaid = IsInRaid()
end
local equipmentItemIDs, equipmentSetItemIDs = {}, {}
@@ -3264,46 +3364,44 @@ do
end
-- Nameplate Target
if WeakAuras.isAwesomeEnabled() then
do
local nameplateTargetFrame = nil
local nameplateTargets = {}
do
local nameplateTargetFrame = nil
local nameplateTargets = {}
local function nameplateTargetOnEvent(self, event, unit)
if event == "NAME_PLATE_UNIT_ADDED" then
nameplateTargets[unit] = UnitGUID(unit.."-target") or true
elseif event == "NAME_PLATE_UNIT_REMOVED" then
nameplateTargets[unit] = nil
end
local function nameplateTargetOnEvent(self, event, unit)
if event == "NAME_PLATE_UNIT_ADDED" then
nameplateTargets[unit] = UnitGUID(unit.."-target") or true
elseif event == "NAME_PLATE_UNIT_REMOVED" then
nameplateTargets[unit] = nil
end
end
local tick_throttle = 0.2
local throttle_update = tick_throttle
local function nameplateTargetOnUpdate(self, delta)
throttle_update = throttle_update - delta
if throttle_update < 0 then
for unit, targetGUID in pairs(nameplateTargets) do
local newTargetGUID = UnitGUID(unit.."-target")
if (newTargetGUID == nil and targetGUID ~= true)
or (newTargetGUID ~= nil and targetGUID ~= newTargetGUID)
then
nameplateTargets[unit] = newTargetGUID or true
WeakAuras.ScanEvents("WA_UNIT_TARGET_NAME_PLATE", unit)
end
local tick_throttle = 0.2
local throttle_update = tick_throttle
local function nameplateTargetOnUpdate(self, delta)
throttle_update = throttle_update - delta
if throttle_update < 0 then
for unit, targetGUID in pairs(nameplateTargets) do
local newTargetGUID = UnitGUID(unit.."-target")
if (newTargetGUID == nil and targetGUID ~= true)
or (newTargetGUID ~= nil and targetGUID ~= newTargetGUID)
then
nameplateTargets[unit] = newTargetGUID or true
WeakAuras.ScanEvents("WA_UNIT_TARGET_NAME_PLATE", unit)
end
throttle_update = tick_throttle
end
throttle_update = tick_throttle
end
end
Private.frames["Nameplate Target Handler"] = nameplateTargetFrame
function WeakAuras.WatchForNameplateTargetChange()
if not nameplateTargetFrame then
nameplateTargetFrame = CreateFrame("Frame")
nameplateTargetFrame:SetScript("OnUpdate", nameplateTargetOnUpdate)
nameplateTargetFrame:RegisterEvent("NAME_PLATE_UNIT_ADDED")
nameplateTargetFrame:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
nameplateTargetFrame:SetScript("OnEvent", nameplateTargetOnEvent)
end
Private.frames["Nameplate Target Handler"] = nameplateTargetFrame
function WeakAuras.WatchForNameplateTargetChange()
if not nameplateTargetFrame then
nameplateTargetFrame = CreateFrame("Frame")
nameplateTargetFrame:SetScript("OnUpdate", nameplateTargetOnUpdate)
nameplateTargetFrame:RegisterEvent("NAME_PLATE_UNIT_ADDED")
nameplateTargetFrame:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
nameplateTargetFrame:SetScript("OnEvent", nameplateTargetOnEvent)
end
end
end
@@ -3541,13 +3639,9 @@ do
local function doCastScan(firetime, unit)
scheduled_scans[unit][firetime] = nil;
if unit:find("^nameplate%d+$") then
WeakAuras.ScanEvents("CAST_REMAINING_CHECK_nameplate", unit);
else
WeakAuras.ScanEvents("CAST_REMAINING_CHECK_" .. string.lower(unit), unit);
end
WeakAuras.ScanEvents("CAST_REMAINING_CHECK_" .. string.lower(unit), unit);
end
function Private.ExecEnv.ScheduleCastCheck(fireTime, unit)
scheduled_scans[unit] = scheduled_scans[unit] or {}
if not(scheduled_scans[unit][fireTime]) then
+40 -38
View File
@@ -1156,7 +1156,7 @@ Private.load_prototype = {
}
};
local function AddUnitChangeInternalEvents(triggerUnit, t, includePets)
local function AddUnitChangeInternalEvents(triggerUnit, t, includePets, unitisunit)
if (triggerUnit == nil) then
return
end
@@ -1164,16 +1164,6 @@ local function AddUnitChangeInternalEvents(triggerUnit, t, includePets)
-- Handled by normal events"
elseif triggerUnit == "pet" then
tinsert(t, "PET_UPDATE")
elseif (triggerUnit == "nameplate") then
tinsert(t, "UNIT_CHANGED_nameplate")
local nameplates = C_NamePlate.GetNamePlates()
if nameplates then
for i, unitData in pairs(nameplates) do
if unitData then
WeakAuras.WatchUnitChange("nameplate" .. i)
end
end
end
else
if Private.multiUnitUnits[triggerUnit] then
local isPet
@@ -1181,17 +1171,21 @@ local function AddUnitChangeInternalEvents(triggerUnit, t, includePets)
isPet = WeakAuras.UnitIsPet(unit)
if (includePets ~= nil and isPet) or (includePets ~= "PetsOnly" and not isPet) then
tinsert(t, "UNIT_CHANGED_" .. string.lower(unit))
WeakAuras.WatchUnitChange(unit)
if unitisunit then
tinsert(t, "UNIT_IS_UNIT_CHANGED_" .. string.lower(unit) .. "_" .. string.lower(unitisunit))
end
end
end
else
tinsert(t, "UNIT_CHANGED_" .. string.lower(triggerUnit))
WeakAuras.WatchUnitChange(triggerUnit)
if unitisunit then
tinsert(t, "UNIT_IS_UNIT_CHANGED_" .. string.lower(triggerUnit) .. "_" .. string.lower(unitisunit))
end
end
end
end
local function AddWatchedUnits(triggerUnit, includePets)
local function AddWatchedUnits(triggerUnit, includePets, unitisunit)
if (triggerUnit == nil) then
return
end
@@ -1199,25 +1193,22 @@ local function AddWatchedUnits(triggerUnit, includePets)
-- Handled by normal events"
elseif triggerUnit == "pet" then
WeakAuras.WatchForPetDeath();
elseif (triggerUnit == "nameplate") then
local nameplates = C_NamePlate.GetNamePlates()
if nameplates then
for i, unitData in pairs(nameplates) do
if unitData then
WeakAuras.WatchUnitChange("nameplate" .. i)
end
end
end
else
if Private.multiUnitUnits[triggerUnit] then
local isPet
for unit in pairs(Private.multiUnitUnits[triggerUnit]) do
isPet = WeakAuras.UnitIsPet(unit)
if (includePets ~= nil and isPet) or (includePets ~= "PetsOnly" and not isPet) then
if unitisunit then
WeakAuras.WatchUnitChange(unitisunit)
end
WeakAuras.WatchUnitChange(unit)
end
end
else
if unitisunit then
WeakAuras.WatchUnitChange(unitisunit)
end
WeakAuras.WatchUnitChange(triggerUnit)
end
end
@@ -1284,8 +1275,6 @@ local unitHelperFunctions = {
tinsert(events, {"UNIT_CHANGED_" .. unit, unit})
end
end
elseif trigger.unit == "nameplate" then
tinsert(events, {"UNIT_CHANGED_" .. trigger.unit})
else
if trigger.unit then
tinsert(events, {"UNIT_CHANGED_" .. trigger.unit, trigger.unit})
@@ -1302,8 +1291,6 @@ local unitHelperFunctions = {
tinsert(events, {"UNIT_CHANGED_" .. unit, unit})
end
end
elseif trigger.unit == "nameplate" then
tinsert(events, {"UNIT_CHANGED_" .. trigger.unit})
else
if trigger.unit then
tinsert(events, {"UNIT_CHANGED_" .. trigger.unit, trigger.unit})
@@ -1403,15 +1390,12 @@ Private.event_prototypes = {
internal_events = function(trigger)
local unit = trigger.unit
local result = {}
AddUnitChangeInternalEvents(unit, result)
AddUnitChangeInternalEvents(unit, result, nil, trigger.use_unitisunit and trigger.unitisunit or nil)
AddUnitRoleChangeInternalEvents(unit, result)
if trigger.unitisunit then
AddUnitChangeInternalEvents(trigger.unitisunit, result)
end
return result
end,
loadFunc = function(trigger)
AddWatchedUnits(trigger.unit, nil)
AddWatchedUnits(trigger.unit, nil, trigger.use_unitisunit and trigger.unitisunit or nil)
end,
force_events = unitHelperFunctions.UnitChangedForceEvents,
name = L["Unit Characteristics"],
@@ -1439,19 +1423,23 @@ Private.event_prototypes = {
values = "actual_unit_types_cast",
desc = Private.actual_unit_types_cast_tooltip,
test = "true",
store = true
store = true,
reloadOptions = true,
},
{
name = "unitisunit",
display = L["Unit is Unit"],
type = "unit",
init = "UnitIsUnit(unit, extraUnit) == 1 and true or false",
values = "actual_unit_types_with_specific",
values = function(trigger)
if Private.multiUnitUnits[trigger.unit] then
return Private.actual_unit_types
else
return Private.actual_unit_types_with_specific
end
end,
test = "unitisunit",
store = true,
conditionType = "bool",
desc = function() return L["Can be used for e.g. checking if \"boss1target\" is the same as \"player\"."] end,
enable = function(trigger) return not Private.multiUnitUnits[trigger.unit] end
},
{
name = "name",
@@ -5519,7 +5507,7 @@ Private.event_prototypes = {
return result
end,
loadFunc = function(trigger)
local unit = trigger.threatUnit
local unit = trigger.unit
if unit and unit ~= "none" then
AddWatchedUnits(unit)
end
@@ -7507,3 +7495,17 @@ Private.dynamic_texts = {
end
}
};
Private.InternalEventByIDList = {
ITEM_COOLDOWN_STARTED = true,
ITEM_COOLDOWN_CHANGED = true,
ITEM_COOLDOWN_READY = true,
ITEM_SLOT_COOLDOWN_STARTED = true,
ITEM_SLOT_COOLDOWN_CHANGED = true,
ITEM_SLOT_COOLDOWN_READY = true,
ITEM_SLOT_COOLDOWN_ITEM_CHANGED = true,
SPELL_COOLDOWN_CHANGED = true,
SPELL_COOLDOWN_READY = true,
SPELL_CHARGES_CHANGED = true,
WA_UPDATE_OVERLAY_GLOW = true,
}
+15 -6
View File
@@ -789,12 +789,18 @@ if WeakAuras.isAwesomeEnabled() then
Private.unit_types_bufftrigger_2.nameplate = L["Nameplate"]
end
Private.actual_unit_types = {
player = L["Player"],
pet = L["Pet"],
target = L["Target"],
}
Private.actual_unit_types_with_specific = {
player = L["Player"],
target = L["Target"],
focus = L["Focus"],
pet = L["Pet"],
member = L["Specific Unit"]
member = L["Specific Unit"],
}
Private.actual_unit_types_cast = {
@@ -2870,9 +2876,9 @@ Private.multiUnitId = {
["partypetsonly"] = true,
["raid"] = true,
}
--if WeakAuras.isAwesomeEnabled() then
-- Private.multiUnitId["nameplate"] = true
--end
if WeakAuras.isAwesomeEnabled() then
Private.multiUnitId["nameplate"] = true
end
Private.multiUnitUnits = {
["boss"] = {},
@@ -2913,14 +2919,17 @@ end
for i = 1, 40 do
Private.baseUnitId["raid"..i] = true
Private.baseUnitId["raidpet"..i] = true
-- Private.baseUnitId["nameplate"..i] = true -- no need to restrict it, blizzard only allows 40 nameplates, we can get all.
-- Private.multiUnitUnits.nameplate["nameplate"..i] = true -- no need to restrict it, blizzard only allows 40 nameplates, we can get all.
Private.multiUnitUnits.group["raid"..i] = true
Private.multiUnitUnits.raid["raid"..i] = true
Private.multiUnitUnits.group["raidpet"..i] = true
Private.multiUnitUnits.raid["raidpet"..i] = true
end
for i = 1, 100 do
Private.baseUnitId["nameplate"..i] = true
Private.multiUnitUnits.nameplate["nameplate"..i] = true
end
Private.dbm_types = {
[1] = L["Add"],
[2] = L["AOE"],
+3 -2
View File
@@ -3171,7 +3171,8 @@ function Private.HandleGlowAction(actions, region)
if actions.glow_action
and (
(
(actions.glow_frame_type == "UNITFRAME" or (actions.glow_frame_type == "NAMEPLATE" and WeakAuras.isAwesomeEnabled()))
(actions.glow_frame_type == "UNITFRAME" or
actions.glow_frame_type == "NAMEPLATE")
and region.state.unit
)
or (actions.glow_frame_type == "FRAMESELECTOR" and actions.glow_frame)
@@ -5405,7 +5406,7 @@ do
end
function WeakAuras.UntrackableUnit(unit)
return not (trackableUnits[unit] or unit:find("^nameplate%d+$"))
return not trackableUnits[unit]
end
end
+6 -6
View File
@@ -801,7 +801,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Filter by Nameplate Type"],
order = 69.1,
hidden = function() return
not (trigger.type == "aura2" and (WeakAuras.isAwesomeEnabled() and trigger.unit == "nameplate"))
not (trigger.type == "aura2" and trigger.unit == "nameplate")
end
},
hostility = {
@@ -817,7 +817,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = "",
order = 69.3,
width = WeakAuras.normalWidth,
hidden = function() return not (trigger.type == "aura2" and (WeakAuras.isAwesomeEnabled() and trigger.unit == "nameplate") and not trigger.useHostility) end
hidden = function() return not (trigger.type == "aura2" and trigger.unit == "nameplate" and not trigger.useHostility) end
},
useNpcId = {
@@ -826,14 +826,14 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Filter by Npc ID"],
order = 69.31,
hidden = function() return
not (trigger.type == "aura2" and (WeakAuras.isAwesomeEnabled() and trigger.unit == "nameplate"))
not (trigger.type == "aura2" and trigger.unit == "nameplate")
end
},
npcId = {
type = "input",
width = WeakAuras.normalWidth,
name = L["Npc ID"],
hidden = function() return not (trigger.type == "aura2" and WeakAuras.isAwesomeEnabled() and trigger.unit == "nameplate" and trigger.useNpcId) end,
hidden = function() return not (trigger.type == "aura2" and trigger.unit == "nameplate" and trigger.useNpcId) end,
order = 69.32,
desc = L["Supports multiple entries, separated by commas"]
},
@@ -842,7 +842,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = "",
order = 69.33,
width = WeakAuras.normalWidth,
hidden = function() return not (trigger.type == "aura2" and WeakAuras.isAwesomeEnabled() and trigger.unit == "nameplate" and not trigger.useNpcId) end
hidden = function() return not (trigger.type == "aura2" and trigger.unit == "nameplate" and not trigger.useNpcId) end
},
ignoreSelf = {
@@ -850,7 +850,7 @@ local function GetBuffTriggerOptions(data, triggernum)
name = L["Ignore Self"],
order = 69.35,
width = WeakAuras.doubleWidth,
hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" or (WeakAuras.isAwesomeEnabled() and trigger.unit == "nameplate"))) end
hidden = function() return not (trigger.type == "aura2" and (trigger.unit == "group" or trigger.unit == "raid" or trigger.unit == "party" or trigger.unit == "nameplate")) end
},
ignoreDead = {
@@ -439,7 +439,7 @@ function OptionsPrivate.CreateFrame()
local awesomeWotlkButton
if not WeakAuras.isAwesomeEnabled() then
awesomeWotlkButton = addFooter("Awesome WotLK", [[Interface\AddOns\WeakAuras\Media\Textures\GitHub.tga]], "https://github.com/FrostAtom/awesome_wotlk",
L["Unlock Nameplate units in WeakAuras with awesome_wotlk binary patch!"])
L["Unlock Nameplate anchoring and units in WeakAuras with awesome_wotlk client patch!"])
awesomeWotlkButton:SetParent(tipFrame)
awesomeWotlkButton:SetPoint("LEFT", documentationButton, "RIGHT", 10, 0)
end
@@ -1386,10 +1386,8 @@ function OptionsPrivate.CreateFrame()
for _, id in ipairs(batchSelection) do
if not alreadySelected[id] then
if displayButtons[id].frame:IsVisible() then
displayButtons[id]:Pick()
tinsert(tempGroup.controlledChildren, id)
end
displayButtons[id]:Pick()
tinsert(tempGroup.controlledChildren, id)
end
end
frame:ClearOptions(tempGroup.id)