(feat/Encounter): Implement Encounter Trigger/Load Options via DBM, also fire ENCOUNTER_START/END and DBM Callback Events for Custom Triggers (#73)

This commit is contained in:
NoM0Re
2025-10-04 23:39:33 +02:00
committed by GitHub
parent 517f15c7bd
commit 6c6cb73fdd
10 changed files with 2143 additions and 8 deletions
+102 -1
View File
@@ -88,7 +88,8 @@ end
local constants = {
nameRealmFilterDesc = L[" Filter formats: 'Name', 'Name-Realm', '-Realm'. \n\nSupports multiple entries, separated by commas\nCan use \\ to escape -."],
instanceFilterDeprecated = L["This filter has been moved to the Location trigger. Change your aura to use the new Location trigger or join the WeakAuras Discord server for help."],
guildFilterDesc = L["Supports multiple entries, separated by commas. Escape with \\. Prefix with '-' for negation."]
guildFilterDesc = L["Supports multiple entries, separated by commas. Escape with \\. Prefix with '-' for negation."],
encounterDBMDesc = (WeakAuras.IsDBMRegistered() and "" or "|cFFFF0000") .. L["Requires Deadly Boss Mods (DBM) to detect encounters."] .. (WeakAuras.IsDBMRegistered() and "" or "|r")
}
WeakAuras.UnitRaidRole = function(unit)
@@ -969,6 +970,16 @@ Private.load_prototype = {
optional = true,
events = {"PLAYER_DEAD", "PLAYER_ALIVE", "PLAYER_UNGHOST"}
},
{
name = "encounter",
display = WeakAuras.newFeatureString .. L["In Encounter"],
desc = constants.encounterDBMDesc,
type = "tristate",
width = WeakAuras.normalWidth,
init = "arg",
optional = true,
events = {"ENCOUNTER_START", "ENCOUNTER_END"}
},
{
name = "pvpmode",
display = L["PvP Mode Active"],
@@ -1304,6 +1315,17 @@ Private.load_prototype = {
end,
optional = true,
},
{
name = "encounterid",
display = WeakAuras.newFeatureString .. L["Encounter ID(s)"],
type = "string",
init = "arg",
multiline = true,
desc = Private.get_encounters_list,
test = "WeakAuras.CheckNumericIds(%q, encounterid)",
events = {"ENCOUNTER_START", "ENCOUNTER_END"},
optional = true,
},
{
name = "size",
display = L["Instance Size Type"],
@@ -6204,6 +6226,85 @@ Private.event_prototypes = {
timedrequired = true,
progressType = "timed"
},
["Encounter Events"] = {
type = "event",
events = {
["events"] = {
"ENCOUNTER_START",
"ENCOUNTER_END"
}
},
name = WeakAuras.newFeatureString..L["Entering/Leaving Encounter"],
args = {
{
name = "note",
type = "description",
display = "",
text = constants.encounterDBMDesc
},
{
name = "eventtype",
required = true,
display = L["Type"],
type = "select",
values = "encounter_event_type",
test = "event == %q",
reloadOptions = true
},
{
name = "encounterId",
display = L["Id"],
type = "string",
desc = Private.get_encounters_list,
validate = WeakAuras.ValidateNumeric,
conditionType = "number",
store = true,
init = "arg"
},
{
name = "encounterName",
display = L["Name"],
type = "string",
conditionType = "string",
store = true,
init = "arg"
},
{
name = "difficulty",
display = L["Difficulty"],
type = "select",
values = "difficulty_types",
test = "%q == WeakAuras.InstanceDifficulty()",
conditionType = "select",
conditionTest = function(state, needle)
return WeakAuras.InstanceDifficulty() == needle
end,
store = true,
init = "arg"
},
{},
{
name = "success",
display = L["Success"],
type = "toggle",
conditionType = "bool",
enable = function(trigger)
return trigger.eventtype == "ENCOUNTER_END"
end,
store = true,
test = "success == 1",
conditionTest = function(state, needle)
return state and (state.success == needle)
end,
init = "arg"
}
},
statesParameter = "one",
countEvents = true,
delayEvents = true,
timedrequired = true,
progressType = "timed"
},
["Death Knight Rune"] = {
type = "unit",
events = {