From 7aa5d50a6ce478d8c7f62a6514427082def8421e Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Mon, 27 Jan 2025 16:21:57 +0100 Subject: [PATCH] Fix zone notify for in commander --- Heimdall.lua | 4 ++-- Heimdall.toc | 2 +- Heimdall.zip | 4 ++-- Modules/Commander.lua | 11 ++++++++--- Modules/Whoer.lua | 8 ++++---- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Heimdall.lua b/Heimdall.lua index 42f8d97..ad32fac 100644 --- a/Heimdall.lua +++ b/Heimdall.lua @@ -2,7 +2,7 @@ local addonname, shared = ... ---@cast shared HeimdallShared ---@cast addonname string -local VERSION = "3.9.3" +local VERSION = "3.9.4" shared.VERSION = VERSION local function init() @@ -35,7 +35,7 @@ local function init() ---@field Memoize fun(f: function): function ---@field GetLocaleForChannel fun(channel: string): string ---@field WhoQueryService WhoQueryService - ---@field Whoer InitTable + ---@field Whoer InitTable|{ShouldNotifyForZone: fun(zone: string): boolean} ---@field Messenger InitTable ---@field Spotter InitTable ---@field DeathReporter InitTable diff --git a/Heimdall.toc b/Heimdall.toc index 9900f75..b2950bd 100644 --- a/Heimdall.toc +++ b/Heimdall.toc @@ -1,6 +1,6 @@ ## Interface: 70300 ## Title: Heimdall -## Version: 3.9.3 +## Version: 3.9.4 ## Notes: Watches over areas and alerts when hostiles spotted ## Author: Cyka ## SavedVariables: Heimdall_Data, Heimdall_Achievements diff --git a/Heimdall.zip b/Heimdall.zip index 9408358..e6b301e 100644 --- a/Heimdall.zip +++ b/Heimdall.zip @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1673ea32e692278a2c912ebcc55f743882eb1d86d85ec2c6452fd79c73c23a76 -size 999118 +oid sha256:9b0dc1a8726c9b997f6af08ced5c220ed52a0299a9dd288d6f605f870cdc2862 +size 999193 diff --git a/Modules/Commander.lua b/Modules/Commander.lua index e59c49a..bf7eba6 100644 --- a/Modules/Commander.lua +++ b/Modules/Commander.lua @@ -69,7 +69,7 @@ function shared.Commander.Init() local function Count(arr) local ret = {} for _, player in pairs(arr) do - if Heimdall_Data.config.who.zoneNotifyFor[player.zone] then + if shared.Whoer.ShouldNotifyForZone(player.zone) then ret[player.zone] = (ret[player.zone] or 0) + 1 end end @@ -94,7 +94,7 @@ function shared.Commander.Init() local function Who(arr) local ret = {} for _, player in pairs(arr) do - if Heimdall_Data.config.who.zoneNotifyFor[player.zone] then + if shared.Whoer.ShouldNotifyForZone(player.zone) then ret[#ret + 1] = string.format("%s/%s (%s) %s", player.name, player.class, player.zone, player.stinky and "(!!!!)" or "") end @@ -119,7 +119,7 @@ function shared.Commander.Init() local function CountClass(arr) local ret = {} for _, player in pairs(arr) do - if Heimdall_Data.config.who.zoneNotifyFor[player.zone] then + if shared.Whoer.ShouldNotifyForZone(player.zone) then ret[player.class] = (ret[player.class] or 0) + 1 end end @@ -157,6 +157,7 @@ function shared.Commander.Init() if Heimdall_Data.config.commander.debug then print(string.format("[%s] Executing: WhoPartitionedStinkies", ModuleName)) + shared.dumpTable(HeimdallStinkies) end local res = WhoPartitioned(HeimdallStinkies) if #res == 0 then @@ -322,6 +323,10 @@ function shared.Commander.Init() data = channelname, message = message } + if Heimdall_Data.config.commander.debug then + print(string.format("[%s] Queuing message", ModuleName)) + shared.dumpTable(msg) + end --table.insert(shared.messenger.queue, msg) table.insert(shared.networkMessenger.queue, msg) end diff --git a/Modules/Whoer.lua b/Modules/Whoer.lua index 56a670b..7a4741d 100644 --- a/Modules/Whoer.lua +++ b/Modules/Whoer.lua @@ -182,7 +182,7 @@ function shared.Whoer.Init() ---@param inputZone string ---@return boolean - local ShouldNotifyForZone = shared.Memoize(function(inputZone) + shared.Whoer.ShouldNotifyForZone = shared.Memoize(function(inputZone) if not Heimdall_Data.config.who.debug then print(string.format("[%s] ShouldNotifyForZone %s", ModuleName, inputZone)) end @@ -245,7 +245,7 @@ function shared.Whoer.Init() return string.format("Cannot notify for nil player %s", tostring(player)) end - if not ShouldNotifyForZone(player.zone) then + if not shared.Whoer.ShouldNotifyForZone(player.zone) then --if not Heimdall_Data.config.who.zoneNotifyFor[player.zone] then if Heimdall_Data.config.who.debug then print(string.format("[%s] Skipping notification - Zone '%s' not in notify list", ModuleName, player.zone)) @@ -306,7 +306,7 @@ function shared.Whoer.Init() if not player then return string.format("Cannot notify for nil player %s", tostring(player)) end --if not Heimdall_Data.config.who.zoneNotifyFor[zone] -- and not Heimdall_Data.config.who.zoneNotifyFor[player.zone] then - if not ShouldNotifyForZone(zone) and not ShouldNotifyForZone(player.zone) then + if not shared.Whoer.ShouldNotifyForZone(zone) and not shared.Whoer.ShouldNotifyForZone(player.zone) then return string.format("Not notifying for zones %s and %s", tostring(zone), tostring(player.zone)) end for _, channel in pairs(Heimdall_Data.config.who.channels) do @@ -354,7 +354,7 @@ function shared.Whoer.Init() if not Heimdall_Data.config.who.enabled then return end if not player then return string.format("Cannot notify for nil player %s", tostring(player)) end --if not Heimdall_Data.config.who.zoneNotifyFor[player.zone] then - if not ShouldNotifyForZone(player.zone) then + if not shared.Whoer.ShouldNotifyForZone(player.zone) then return string.format("Not notifying for zone %s", tostring(player.zone)) end