Refactor progress handling

probably some regressions
This commit is contained in:
NoM0Re
2025-01-22 03:37:10 +01:00
parent a643b275ba
commit 23c7da5ea6
29 changed files with 2037 additions and 1263 deletions
+76 -37
View File
@@ -1662,11 +1662,12 @@ Private.event_prototypes = {
test = "WeakAuras.UnitExistsFixed(unit, smart) and specificUnitCheck"
}
},
automaticrequired = true
automaticrequired = true,
progressType = "none"
},
["Experience"] = {
type = "unit",
canHaveDuration = false,
progressType = "static",
events = {
["events"] = {
"PLAYER_XP_UPDATE",
@@ -1704,6 +1705,7 @@ Private.event_prototypes = {
operator = "and",
limit = 2
},
progressTotal = "totalXP"
},
{
name = "totalXP",
@@ -1805,7 +1807,7 @@ Private.event_prototypes = {
["Health"] = {
type = "unit",
includePets = "true",
canHaveDuration = true,
progressType = "static",
events = function(trigger)
local unit = trigger.unit
local result = {}
@@ -1872,6 +1874,7 @@ Private.event_prototypes = {
operator = "and",
limit = 2
},
progressTotal = "maxhealth"
},
{
name = "value",
@@ -1917,6 +1920,7 @@ Private.event_prototypes = {
operator = "and",
limit = 2
},
progressTotal = "total"
},
{
name = "maxhealth",
@@ -2111,7 +2115,7 @@ Private.event_prototypes = {
},
["Power"] = {
type = "unit",
canHaveDuration = true,
progressType = "static",
events = function(trigger)
local unit = trigger.unit
local result = {}
@@ -2218,6 +2222,7 @@ Private.event_prototypes = {
operator = "and",
limit = 2
},
progressTotal = "total"
},
{
name = "value",
@@ -2270,6 +2275,7 @@ Private.event_prototypes = {
operator = "and",
limit = 2
},
progressTotal = "total"
},
{
name = "maxpower",
@@ -2899,12 +2905,13 @@ Private.event_prototypes = {
display = WeakAuras.newFeatureString .. L["Extra Spell Id"],
init = "arg",
enable = function(trigger)
return trigger.subeventSuffix and (trigger.subeventSuffix == "_INTERRUPT" or trigger.subeventSuffix == "_DISPEL" or trigger.subeventSuffix == "_DISPEL_FAILED" or trigger.subeventSuffix == "_STOLEN" or trigger.subeventSuffix == "_AURA_BROKEN_SPELL")
return trigger.subeventSuffix and (trigger.subeventSuffix == "_ABSORBED" or trigger.subeventSuffix == "_INTERRUPT" or trigger.subeventSuffix == "_DISPEL" or trigger.subeventSuffix == "_DISPEL_FAILED" or trigger.subeventSuffix == "_STOLEN" or trigger.subeventSuffix == "_AURA_BROKEN_SPELL")
end,
type = "spell",
showExactOption = false,
store = true,
conditionType = "number"
conditionType = "number",
noProgressSource = true
},
{
name = "extraSpellName",
@@ -3106,6 +3113,7 @@ Private.event_prototypes = {
countEvents = true,
delayEvents = true,
timedrequired = true,
progressType = "timed"
},
["Cooldown Progress (Spell)"] = {
type = "spell",
@@ -3206,7 +3214,7 @@ Private.event_prototypes = {
return ret;
end,
statesParameter = "one",
canHaveDuration = "timed",
progressType = "timed",
args = {
{
}, -- Ignore first argument (id)
@@ -3266,7 +3274,8 @@ Private.event_prototypes = {
display = L["Stacks"],
type = "number",
store = true,
conditionType = "number"
conditionType = "number",
progressTotal = "maxCharges"
},
{
name = "spellCount",
@@ -3451,7 +3460,8 @@ Private.event_prototypes = {
return icon;
end,
hasSpellID = true,
timedrequired = true
timedrequired = true,
progressType = "timed"
},
["Charges Changed"] = {
type = "spell",
@@ -3535,7 +3545,8 @@ Private.event_prototypes = {
return icon;
end,
hasSpellID = true,
timedrequired = true
timedrequired = true,
progressType = "timed"
},
["Cooldown Progress (Item)"] = {
type = "item",
@@ -3701,6 +3712,7 @@ Private.event_prototypes = {
end,
hasItemID = true,
automaticrequired = true,
progressType = "timed"
},
["Cooldown Progress (Equipment Slot)"] = {
type = "item",
@@ -3859,6 +3871,7 @@ Private.event_prototypes = {
return GetInventoryItemTexture("player", trigger.itemSlot or 0) or "Interface\\Icons\\INV_Misc_QuestionMark";
end,
automaticrequired = true,
progressType = "timed"
},
["Cooldown Ready (Item)"] = {
type = "item",
@@ -3896,7 +3909,8 @@ Private.event_prototypes = {
return icon;
end,
hasItemID = true,
timedrequired = true
timedrequired = true,
progressType = "timed"
},
["Cooldown Ready (Equipment Slot)"] = {
type = "item",
@@ -3927,7 +3941,8 @@ Private.event_prototypes = {
return GetInventoryItemTexture("player", trigger.itemSlot or 0) or "Interface\\Icons\\INV_Misc_QuestionMark";
end,
hasItemID = true,
timedrequired = true
timedrequired = true,
progressType = "timed"
},
["GTFO"] = {
type = "addons",
@@ -3947,7 +3962,8 @@ Private.event_prototypes = {
conditionType = "select"
},
},
timedrequired = true
timedrequired = true,
progressType = "timed"
},
["Global Cooldown"] = {
type = "spell",
@@ -3998,6 +4014,7 @@ Private.event_prototypes = {
end,
hasSpellID = true,
automaticrequired = true,
progressType = "timed"
},
["Swing Timer"] = {
type = "unit",
@@ -4096,7 +4113,7 @@ Private.event_prototypes = {
}
},
automaticrequired = true,
canHaveDuration = true,
progressType = "timed",
statesParameter = "one"
},
["Action Usable"] = {
@@ -4184,7 +4201,7 @@ Private.event_prototypes = {
type = "number",
enable = function(trigger) return not(trigger.use_inverse) end,
store = true,
conditionType = "number"
conditionType = "number",
},
{
name = "spellCount",
@@ -4192,7 +4209,7 @@ Private.event_prototypes = {
type = "number",
enable = function(trigger) return not(trigger.use_inverse) end,
store = true,
conditionType = "number"
conditionType = "number",
},
{
name = "inverse",
@@ -4245,7 +4262,8 @@ Private.event_prototypes = {
end
end,
hasSpellID = true,
automaticrequired = true
automaticrequired = true,
progressType = "none"
},
["Talent Known"] = {
type = "unit",
@@ -4351,6 +4369,7 @@ Private.event_prototypes = {
},
automaticrequired = true,
statesParameter = "one",
progressType = "none"
},
["Totem"] = {
type = "spell",
@@ -4366,7 +4385,7 @@ Private.event_prototypes = {
force_events = "PLAYER_ENTERING_WORLD",
name = L["Totem"],
statesParameter = "full",
canHaveDuration = "timed",
progressType = "timed",
triggerFunction = function(trigger)
local ret = [[return
function (states)
@@ -4633,7 +4652,6 @@ Private.event_prototypes = {
hidden = true,
store = true,
test = "true",
conditionType = "number"
},
{
name = "icon",
@@ -4652,7 +4670,8 @@ Private.event_prototypes = {
},
statesParameter = "one",
hasItemID = true,
automaticrequired = true
automaticrequired = true,
progressType = "static"
},
["Stance/Form/Aura"] = {
type = "unit",
@@ -4751,7 +4770,8 @@ Private.event_prototypes = {
end
return icon or "Interface\\Icons\\Spell_Nature_WispSplode"
end,
automaticrequired = true
automaticrequired = true,
progressType = "none"
},
["Weapon Enchant"] = {
type = "item",
@@ -4888,7 +4908,7 @@ Private.event_prototypes = {
}
},
automaticrequired = true,
canHaveDuration = true,
progressType = "timed",
statesParameter = "one"
},
["Chat Message"] = {
@@ -4993,7 +5013,8 @@ Private.event_prototypes = {
},
countEvents = true,
delayEvents = true,
timedrequired = true
timedrequired = true,
progressType = "timed"
},
-- fixing later
--[[["Spell Cast Succeeded"] = {
@@ -5061,7 +5082,8 @@ Private.event_prototypes = {
},
countEvents = true,
delayEvents = true,
timedrequired = true
timedrequired = true,
progressType = "timed"
},]]
["Ready Check"] = {
type = "event",
@@ -5072,7 +5094,8 @@ Private.event_prototypes = {
args = {},
statesParameter = "one",
delayEvents = true,
timedrequired = true
timedrequired = true,
progressType = "timed"
},
["Combat Events"] = {
type = "event",
@@ -5096,7 +5119,8 @@ Private.event_prototypes = {
statesParameter = "one",
countEvents = true,
delayEvents = true,
timedrequired = true
timedrequired = true,
progressType = "timed"
},
["Death Knight Rune"] = {
type = "unit",
@@ -5300,6 +5324,13 @@ Private.event_prototypes = {
end
end,
automaticrequired = true,
progressType = function(trigger)
if trigger.use_rune then
return "timed"
else
return "static"
end
end
},
["Item Equipped"] = {
type = "item",
@@ -5351,7 +5382,8 @@ Private.event_prototypes = {
return icon;
end,
hasItemID = true,
automaticrequired = true
automaticrequired = true,
progressType = "none"
},
["Equipment Set"] = {
type = "item",
@@ -5420,7 +5452,8 @@ Private.event_prototypes = {
return numEquipped, numItems, true;
end,
hasItemID = true,
automaticrequired = true
automaticrequired = true,
progressType = "static"
},
["Threat Situation"] = {
type = "unit",
@@ -5468,7 +5501,7 @@ Private.event_prototypes = {
]];
return ret .. unitHelperFunctions.SpecificUnitCheck(trigger);
end,
canHaveDuration = true,
progressType = "static",
statesParameter = "unit",
args = {
{
@@ -5667,7 +5700,7 @@ Private.event_prototypes = {
AddWatchedUnits(trigger.unit, includePets)
end,
force_events = unitHelperFunctions.UnitChangedForceEventsWithPets,
canHaveDuration = "timed",
progressType = "timed",
name = L["Cast"],
init = function(trigger)
trigger.unit = trigger.unit or "player";
@@ -6605,7 +6638,8 @@ Private.event_prototypes = {
},
},
},
automaticrequired = true
automaticrequired = true,
progressType = "none"
},
["Conditions"] = {
type = "unit",
@@ -6784,7 +6818,8 @@ Private.event_prototypes = {
init = "WeakAuras.InstanceDifficulty()"
},
},
automaticrequired = true
automaticrequired = true,
progressType = "none"
},
["Spell Known"] = {
@@ -6836,7 +6871,8 @@ Private.event_prototypes = {
local _, _, icon = GetSpellInfo(trigger.spellId or 0);
return icon;
end,
automaticrequired = true
automaticrequired = true,
progressType = "none"
},
["Pet Behavior"] = {
@@ -6910,7 +6946,8 @@ Private.event_prototypes = {
test = "true"
},
},
automaticrequired = true
automaticrequired = true,
progressType = "none"
},
["Queued Action"] = {
@@ -6951,7 +6988,8 @@ Private.event_prototypes = {
local _, _, icon = GetSpellInfo(trigger.spellName or 0);
return icon;
end,
automaticrequired = true
automaticrequired = true,
progressType = "none"
},
["Range Check"] = {
@@ -7031,12 +7069,13 @@ Private.event_prototypes = {
test = "UnitExists(unit)"
}
},
automaticrequired = true
automaticrequired = true,
progressType = "none"
},
--[[ Some day i will finish this, soonTM
["Currency"] = {
type = "unit",
canHaveDuration = false,
progressType = "static",
events = {
["events"] = {
"CURRENCY_DISPLAY_UPDATE",