Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Location trigger #4917

Merged
merged 25 commits into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
93458f6
add Player Location trigger
jjholleman Mar 18, 2024
404b4bc
that should've been a string
jjholleman Mar 18, 2024
5f9ec6b
minor tweaks
jjholleman Mar 18, 2024
5130556
Merge branch 'main' into feature/location
jjholleman Mar 21, 2024
1502768
Only copy instance filters, don't delete them, instead show AuraWarni…
jjholleman Mar 21, 2024
805874d
Merge branch 'main' into feature/location
jjholleman Apr 4, 2024
80a7917
rename to "Location" trigger
jjholleman Apr 4, 2024
fb77aa2
remove migration
jjholleman Apr 4, 2024
9e61634
small tweaks and fix bugs
jjholleman Apr 4, 2024
f1bfeb1
Merge branch 'main' into feature/location
jjholleman Apr 4, 2024
d52086a
Merge branch 'main' into feature/location
jjholleman Apr 7, 2024
32897ab
always listen for events that are required by stored values
jjholleman Apr 7, 2024
3a369f7
bugfix: start = 1 if no match is found
jjholleman Apr 7, 2024
528f129
remove the optional recursive check: child filters are always recursive
jjholleman Apr 7, 2024
1ec1d90
overwrite multiselect desc if arg.desc is set
jjholleman Apr 7, 2024
fd53b76
remove instance filter aurawarning, instead show a guiding description
jjholleman Apr 7, 2024
4683051
remove mapType filter
jjholleman Apr 7, 2024
dabfbd8
make player location ID available as a condition
jjholleman Apr 7, 2024
208b591
remove conditionType since we can use Player Location Id. noProgressS…
jjholleman Apr 7, 2024
2f9684e
smoll 🪲-fix
jjholleman Apr 8, 2024
e1ab9a1
Merge branch 'main' into feature/location
jjholleman Apr 13, 2024
1026f5f
WA_DPEW and VEHICLE_UPDATE are not required
jjholleman Apr 13, 2024
cf6fe85
Tweak
InfusOnWoW Apr 16, 2024
c8ec339
Merge branch 'main' into feature/location
jjholleman Apr 19, 2024
9d3b412
Remove indoors option
jjholleman Apr 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion WeakAuras/GenericTrigger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1632,7 +1632,6 @@ function GenericTrigger.Add(data, region)
force_events = force_events(trigger, untrigger)
end


if prototype.includePets then
includePets = trigger.use_includePets == true and trigger.includePets or nil
end
Expand Down
156 changes: 148 additions & 8 deletions WeakAuras/Prototypes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ 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."],
}

if WeakAuras.IsClassicEraOrWrathOrCata() then
Expand Down Expand Up @@ -203,7 +204,7 @@ local function get_zoneId_list()
L["Parent Zone"], parentmap_name, currentmap_info.parentMapID)
end

return ("%s|cffffd200%s|r\n%s: %d\n\n%s%s|cffffd200%s|r\n%s: %d\n\n%s"):format(
return ("%s|cffffd200%s|r\n%s: %d\n\n%s%s|cffffd200%s|r\n%s: i%d\n\n%s"):format(
Private.get_zoneId_list(),
L["Current Zone"],
currentmap_name,
Expand Down Expand Up @@ -10113,7 +10114,6 @@ Private.event_prototypes = {
if trigger.use_ingroup ~= nil then
tinsert(events, "GROUP_ROSTER_UPDATE")
end

if trigger.use_instance_difficulty ~= nil
or trigger.use_instance_type ~= nil
or trigger.use_instance_size ~= nil
Expand All @@ -10137,9 +10137,9 @@ Private.event_prototypes = {
end

if trigger.use_instance_difficulty ~= nil
or trigger.use_instance_type ~= nil
or trigger.use_instance_size ~= nil
or trigger.use_pvpflagged ~= nil
or trigger.use_instance_type ~= nil
or trigger.use_instance_size ~= nil
or trigger.use_pvpflagged ~= nil
then
tinsert(events, "WA_DELAYED_PLAYER_ENTERING_WORLD")
end
Expand Down Expand Up @@ -10232,15 +10232,17 @@ Private.event_prototypes = {
},
{
name = "instance_size",
display = L["Instance Size Type"],
display = L["Instance Size Type"].." "..L["|cffff0000deprecated|r"],
InfusOnWoW marked this conversation as resolved.
Show resolved Hide resolved
desc = constants.instanceFilterDeprecated,
type = "multiselect",
values = "instance_types",
sorted = true,
init = "WeakAuras.InstanceType()",
},
{
name = "instance_difficulty",
display = L["Instance Difficulty"],
display = L["Instance Difficulty"].." "..L["|cffff0000deprecated|r"],
desc = constants.instanceFilterDeprecated,
type = "multiselect",
values = "difficulty_types",
init = "WeakAuras.InstanceDifficulty()",
Expand All @@ -10249,7 +10251,8 @@ Private.event_prototypes = {
},
{
name = "instance_type",
display = L["Instance Type"],
display = L["Instance Type"].." "..L["|cffff0000deprecated|r"],
desc = constants.instanceFilterDeprecated,
type = "multiselect",
values = "instance_difficulty_types",
init = "WeakAuras.InstanceTypeRaw()",
Expand Down Expand Up @@ -10764,6 +10767,143 @@ Private.event_prototypes = {
end,
automaticrequired = true
},
["Location"] = {
type = "unit",
events = {
["events"] = {
"ZONE_CHANGED",
"ZONE_CHANGED_INDOORS",
"ZONE_CHANGED_NEW_AREA",
"PLAYER_DIFFICULTY_CHANGED",
}
},
internal_events = {"INSTANCE_LOCATION_CHECK"},
force_events = "INSTANCE_LOCATION_CHECK",
name = WeakAuras.newFeatureString..L["Location"],
init = function(trigger)
local ret = [=[
local uiMapId = C_Map.GetBestMapForUnit("player")
local zonegroupId = uiMapId and C_Map.GetMapGroupID(uiMapId)
local instanceName, _, _, _, _, _, _, instanceId = GetInstanceInfo()
local minimapZoneText = GetMinimapZoneText()
local zoneText = GetZoneText()
]=]
return ret
end,
statesParameter = "one",
args = {
{
name = "zoneIds",
display = L["Player Location ID(s)"],
type = "string",
multiline = true,
desc = get_zoneId_list,
preamble = "local zoneChecker = Private.ExecEnv.ParseZoneCheck(%q)",
test = "zoneChecker:Check(uiMapId, zonegroupId, instanceId, minimapZoneText)",
conditionType = "string",
conditionPreamble = function(input)
return Private.ExecEnv.ParseZoneCheck(input)
end,
conditionTest = function(state, needle, op, preamble)
return preamble:Check(state.zoneId, state.zonegroupId, state.instanceId, state.subzone)
end,
operator_types = "none",
},
{
name = "zoneId",
display = L["Zone ID"],
init = "uiMapId",
store = true,
hidden = true,
test = "true",
},
{
name = "zonegroupId",
display = L["Zone Group ID"],
init = "zonegroupId",
store = true,
hidden = true,
test = "true",
},
{
name = "zone",
display = L["Zone Name"],
type = "string",
conditionType = "string",
store = true,
InfusOnWoW marked this conversation as resolved.
Show resolved Hide resolved
init = "zoneText",
multiEntry = {
operator = "or",
}
},
{
name = "subzone",
display = L["Subzone Name"],
desc = L["Name of the (sub-)zone currently shown above the minimap."],
type = "string",
conditionType = "string",
store = true,
init = "minimapZoneText",
multiEntry = {
operator = "or",
},
},
{
name = "instanceTitle",
display = L["Instance Filters"],
type = "description",
},
{
name = "instanceId",
display = L["Instance ID"],
init = "instanceId",
store = true,
hidden = true,
test = "true",
},
{
name = "instance",
display = L["Instance Name"],
test = "true",
hidden = "true",
store = true,
},
{
name = "instanceSize",
display = L["Instance Size Type"],
type = "multiselect",
values = "instance_types",
sorted = true,
init = "WeakAuras.InstanceType()",
conditionType = "select",
store = true,
},
{
name = "instanceDifficulty",
display = L["Instance Difficulty"],
type = "multiselect",
values = "difficulty_types",
init = "WeakAuras.InstanceDifficulty()",
conditionType = "select",
store = true,
enable = WeakAuras.IsRetail(),
hidden = not WeakAuras.IsRetail(),
},
{
name = "instanceType",
display = L["Instance Type"],
type = "multiselect",
values = "instance_difficulty_types",
init = "WeakAuras.InstanceTypeRaw()",
conditionType = "select",
store = true,
enable = WeakAuras.IsRetail(),
hidden = not WeakAuras.IsRetail(),
},
},
automaticrequired = true,
progressType = "none"
},
};

if WeakAuras.IsClassicEraOrWrathOrCata() then
Expand Down
31 changes: 19 additions & 12 deletions WeakAuras/WeakAuras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6138,11 +6138,16 @@ function Private.ExecEnv.ParseZoneCheck(input)
elseif prevChar == 'c' or prevChar == 'C' then
self.zoneIds[id] = true
local info = C_Map.GetMapChildrenInfo(id, nil, true)
for _,childInfo in pairs(info) do
self.zoneIds[childInfo.mapID] = true
if info then
for _,childInfo in pairs(info) do
self.zoneIds[childInfo.mapID] = true
end
end
elseif prevChar == 'a' or prevChar == 'A' then
self.areaNames[C_Map.GetAreaInfo(id)] = true
local areaName = C_Map.GetAreaInfo(id)
if areaName then
self.areaNames[areaName] = true
end
elseif prevChar == 'i' or prevChar == 'I' then
self.instanceIds[id] = true
else
Expand All @@ -6153,19 +6158,21 @@ function Private.ExecEnv.ParseZoneCheck(input)
zoneIds = {},
zoneGroupIds = {},
instanceIds = {},
areaNames = {}
areaNames = {},
}

local start = input:find('%d', 1)
local last = input:find('%D', start)
while (last) do
matcher:AddId(input, start, last - 1)
start = input:find('%d', last + 1)
last = input:find('%D', start)
end
if start then
local last = input:find('%D', start)
while (last) do
matcher:AddId(input, start, last - 1)
start = input:find('%d', last + 1) or #input + 1
last = input:find('%D', start)
end

last = #input
matcher:AddId(input, start, last)
last = #input
matcher:AddId(input, start, last)
end
return matcher
end

Expand Down
2 changes: 1 addition & 1 deletion WeakAurasOptions/LoadOptions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ function OptionsPrivate.ConstructOptions(prototype, data, startorder, triggernum
width = WeakAuras.normalWidth,
name = arg.display,
desc = function()
if arg.multiNoSingle then return arg.desc end
if arg.multiNoSingle or arg.desc then return arg.desc end
local v = trigger["use_"..realname];
if(v == true) then
return L["Multiselect single tooltip"];
Expand Down