This commit is contained in:
NoM0Re
2025-04-03 21:03:11 +02:00
committed by GitHub
parent 875da9fb0e
commit 6cdfcac1b1
124 changed files with 1886 additions and 284 deletions
+34 -20
View File
@@ -1,4 +1,5 @@
local AddonName, Private = ...
local AddonName = ...
local Private = select(2, ...)
local internalVersion = 84
@@ -8,8 +9,8 @@ local insert = table.insert
-- WoW APIs
local IsAddOnLoaded, LoadAddOn
= IsAddOnLoaded, LoadAddOn
local UnitName, GetRealmName, UnitRace, UnitFactionGroup, UnitClass
= UnitName, GetRealmName, UnitRace, UnitFactionGroup, UnitClass
local UnitName, GetRealmName, GetGuildInfo, UnitRace, UnitFactionGroup, UnitClass
= UnitName, GetRealmName, GetGuildInfo, UnitRace, UnitFactionGroup, UnitClass
local IsInRaid, UnitIsPartyLeader, UnitIsRaidOfficer, GetRaidRosterInfo, UnitInRaid, UnitInParty
= IsInRaid, UnitIsPartyLeader, UnitIsRaidOfficer, GetRaidRosterInfo, UnitInRaid, UnitInParty
local InCombatLockdown, UnitAffectingCombat, GetInstanceInfo, IsInInstance
@@ -704,7 +705,7 @@ local function singleTest(arg, trigger, use, name, value, operator, use_exact, c
return name;
end
end
elseif (arg.type == "spell") then
elseif arg.type == "spell" or arg.type == "item" then
if arg.showExactOption then
return "("..arg.test:format(value, tostring(use_exact) or "false") ..")";
else
@@ -1415,6 +1416,7 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...)
end
local player, realm, zone, subzone = UnitName("player"), GetRealmName(), GetRealZoneText(), GetSubZoneText();
local guild = GetGuildInfo("player")
local _, race = UnitRace("player")
local faction = UnitFactionGroup("player")
local zoneId = GetCurrentMapAreaID()
@@ -1457,8 +1459,8 @@ local function scanForLoadsImpl(toCheck, event, arg1, ...)
if (data and not data.controlledChildren) then
local loadFunc = loadFuncs[id];
local loadOpt = loadFuncsForOptions[id];
shouldBeLoaded = loadFunc and loadFunc("ScanForLoads_Auras", inCombat, alive, pvp, vehicle, vehicleUi, mounted, player, realm, class, race, faction, playerLevel, role, role, raidRole, group, groupSize, raidMemberType, zone, zoneId, subzone, size, difficulty);
couldBeLoaded = loadOpt and loadOpt("ScanForLoads_Auras", inCombat, alive, pvp, vehicle, vehicleUi, mounted, player, realm, class, race, faction, playerLevel, role, role, raidRole, group, groupSize, raidMemberType, zone, zoneId, subzone, size, difficulty);
shouldBeLoaded = loadFunc and loadFunc("ScanForLoads_Auras", inCombat, alive, pvp, vehicle, vehicleUi, mounted, player, realm, guild, class, race, faction, playerLevel, role, role, raidRole, group, groupSize, raidMemberType, zone, zoneId, subzone, size, difficulty);
couldBeLoaded = loadOpt and loadOpt("ScanForLoads_Auras", inCombat, alive, pvp, vehicle, vehicleUi, mounted, player, realm, guild, class, race, faction, playerLevel, role, role, raidRole, group, groupSize, raidMemberType, zone, zoneId, subzone, size, difficulty);
if(shouldBeLoaded and not loaded[id]) then
changed = changed + 1;
@@ -1557,6 +1559,7 @@ loadFrame:RegisterEvent("PLAYER_ALIVE")
loadFrame:RegisterEvent("PLAYER_UNGHOST")
loadFrame:RegisterEvent("PLAYER_FLAGS_CHANGED")
loadFrame:RegisterEvent("PARTY_LEADER_CHANGED")
loadFrame:RegisterEvent("GUILD_ROSTER_UPDATE")
local unitLoadFrame = CreateFrame("Frame");
Private.frames["Display Load Handling 2"] = unitLoadFrame;
@@ -1654,9 +1657,9 @@ function Private.LoadDisplays(toLoad, ...)
local uid = WeakAuras.GetData(id).uid
Private.RegisterForGlobalConditions(uid);
triggerState[id].triggers = {};
triggerState[id].activationTime = {}
triggerState[id].triggerCount = 0;
triggerState[id].show = false;
triggerState[id].activeTrigger = nil;
triggerState[id].activatedConditions = {};
if Private.DebugLog.IsEnabled(uid) then
WeakAuras.prettyPrint(L["Debug Logging enabled for '%s'"]:format(id))
@@ -1681,7 +1684,6 @@ function Private.UnloadDisplays(toUnload, ...)
end
end
triggerState[id].show = nil;
triggerState[id].activeTrigger = nil;
if (timers[id]) then
for _, trigger in pairs(timers[id]) do
@@ -2845,6 +2847,7 @@ function pAdd(data, simpleChange)
activeTriggerMode = data.triggers.activeTriggerMode or Private.trigger_modes.first_active,
triggerLogicFunc = triggerLogicFunc,
triggers = {},
activationTime = {},
triggerCount = 0,
activatedConditions = {},
};
@@ -3643,6 +3646,24 @@ function Private.GetTriggerConditions(data)
return (state and state.id and triggerState[state.id].triggers[i] or false) == (needle == 1);
end
}
conditions[i].activationTime = {
display = L["Since Active"],
type = "elapsedTimer",
operator_types = "without_equal",
test = function(state, needle, op)
if state and state.id and triggerState[state.id] and triggerState[state.id].activationTime[i] then
local activationTime = triggerState[state.id].activationTime[i]
return (GetTime() <= activationTime + needle) == (op == "<=")
end
end,
recheckTime = function(state, needle)
if state and state.id and triggerState[state.id] and triggerState[state.id].activationTime[i] then
return triggerState[state.id].activationTime[i] + needle
end
end,
}
end
end
return conditions;
@@ -3660,6 +3681,7 @@ local function CreateFallbackState(id, triggernum)
local triggerSystem = GetTriggerSystem(data, triggernum);
if (triggerSystem) then
triggerSystem.CreateFallbackState(data, triggernum, state)
state.id = id
state.trigger = data.triggers[triggernum].trigger
state.triggernum = triggernum
else
@@ -4263,12 +4285,12 @@ local function applyToTriggerStateTriggers(stateShown, id, triggernum)
if (stateShown and not triggerState[id].triggers[triggernum]) then
triggerState[id].triggers[triggernum] = true;
triggerState[id].triggerCount = triggerState[id].triggerCount + 1;
triggerState[id].activationTime[triggernum] = GetTime()
return true;
elseif (not stateShown and triggerState[id].triggers[triggernum]) then
triggerState[id].triggers[triggernum] = false;
triggerState[id].triggerCount = triggerState[id].triggerCount - 1;
triggerState[id].activationTime[triggernum] = nil
return true;
end
@@ -4420,7 +4442,6 @@ function Private.UpdatedTriggerState(id)
end
local oldShow = triggerState[id].show;
triggerState[id].activeTrigger = newActiveTrigger;
triggerState[id].show = show;
triggerState[id].fallbackStates = nil
@@ -4707,16 +4728,15 @@ local function ValueForSymbol(symbol, region, customFunc, regionState, regionSta
if(useHiddenStates or regionState.show) then
local value = regionState[symbol]
if formatters[symbol] then
return tostring(formatters[symbol](value, regionState, triggerState[regionState.id].activeTrigger) or "") or ""
return tostring(formatters[symbol](value, regionState, regionState.triggernum) or "") or ""
else
return tostring(value) or ""
end
end
return ""
else
local activeTrigger = triggerState[regionState.id].activeTrigger
local value = (useHiddenStates or regionState.show)
and ReplaceValuePlaceHolders(symbol, region, customFunc, regionState, formatters[symbol], activeTrigger)
and ReplaceValuePlaceHolders(symbol, region, customFunc, regionState, formatters[symbol], regionState.triggernum)
return value or ""
end
end
@@ -4909,12 +4929,6 @@ function WeakAuras.IsAuraActive(id)
return active and active.show
end
function Private.ActiveTrigger(uid)
local id = Private.UIDtoID(uid)
return triggerState[id] and triggerState[id].activeTrigger
end
-- Attach to Cursor/Frames code
-- Very simple function to convert a hsv angle to a color with
-- value hardcoded to 1 and saturation hardcoded to 0.75