Fix issue with whoer getting stuck on queries because of return
This commit is contained in:
27
Whoer.lua
27
Whoer.lua
@@ -131,7 +131,10 @@ local lastQuery = nil
|
||||
---@return string?
|
||||
local function Notify(player)
|
||||
if not player then return string.format("Cannot notify for nil player %s", tostring(player)) end
|
||||
if not data.config.who.zoneNotifyFor[player.zone] then return string.format("Not notifying for zone %s", tostring(player.zone)) end
|
||||
if not data.config.who.zoneNotifyFor[player.zone] then
|
||||
return string.format("Not notifying for zone %s",
|
||||
tostring(player.zone))
|
||||
end
|
||||
|
||||
local text = player:NotifyMessage()
|
||||
---@type Message
|
||||
@@ -197,7 +200,10 @@ end
|
||||
---@return string?
|
||||
local function NotifyGone(player)
|
||||
if not player then return string.format("Cannot notify for nil player %s", tostring(player)) end
|
||||
if not data.config.who.zoneNotifyFor[player.zone] then return string.format("Not notifying for zone %s", tostring(player.zone)) end
|
||||
if not data.config.who.zoneNotifyFor[player.zone] then
|
||||
return string.format("Not notifying for zone %s",
|
||||
tostring(player.zone))
|
||||
end
|
||||
|
||||
local text = string.format("%s of class %s and guild %s left %s",
|
||||
player.name,
|
||||
@@ -231,10 +237,6 @@ end
|
||||
local frame = CreateFrame("Frame")
|
||||
frame:RegisterEvent("WHO_LIST_UPDATE")
|
||||
frame:SetScript("OnEvent", function(self, event, ...)
|
||||
for i = 1, GetNumWhoResults() do
|
||||
local name, guild, level, race, class, zone = GetWhoInfo(i)
|
||||
if data.who.ignored[name] then return end
|
||||
|
||||
---@type WHOQuery?
|
||||
local query = lastQuery
|
||||
if not query then
|
||||
@@ -242,14 +244,22 @@ frame:SetScript("OnEvent", function(self, event, ...)
|
||||
return
|
||||
end
|
||||
|
||||
for i = 1, GetNumWhoResults() do
|
||||
local name, guild, level, race, class, zone = GetWhoInfo(i)
|
||||
if data.who.ignored[name] then return end
|
||||
local continue = false
|
||||
|
||||
---@type WHOFilter[]
|
||||
local filters = query.filters
|
||||
for _, filter in pairs(filters) do
|
||||
if not filter(name, guild, level, race, class, zone) then
|
||||
return
|
||||
-- Mega scuffed, yes...
|
||||
-- But wow does not have gotos
|
||||
continue = true
|
||||
end
|
||||
end
|
||||
|
||||
if not continue then
|
||||
local timestamp = date("%Y-%m-%dT%H:%M:%S")
|
||||
local player = players[name]
|
||||
if not player then
|
||||
@@ -298,11 +308,12 @@ frame:SetScript("OnEvent", function(self, event, ...)
|
||||
if not Heimdall_Data.who.data then Heimdall_Data.who.data = {} end
|
||||
Heimdall_Data.who.data[name] = player
|
||||
end
|
||||
print("Done?")
|
||||
end
|
||||
-- Turns out WA cannot do this (
|
||||
-- aura_env.UpdateMacro()
|
||||
_G["FriendsFrameCloseButton"]:Click()
|
||||
queryPending = false
|
||||
print(queryPending)
|
||||
end)
|
||||
|
||||
if not data.who.updateTicker then
|
||||
|
Reference in New Issue
Block a user