diff --git a/Heimdall.lua b/Heimdall.lua index a20b8bf..e570a6d 100644 --- a/Heimdall.lua +++ b/Heimdall.lua @@ -5,6 +5,7 @@ local addonname, data = ... local function init() ---@class Heimdall_Data ---@field who { data: table } + ---@field stinkies table if not Heimdall_Data then Heimdall_Data = {} end if not Heimdall_Data.config then Heimdall_Data.config = {} end @@ -16,7 +17,6 @@ local function init() ---@field config HeimdallConfig ---@field raceMap table ---@field classColors table - ---@field stinkies table ---@field messenger HeimdallMessengerData ---@field who HeimdallWhoData ---@field dumpTable fun(table: any, depth?: number): nil @@ -35,6 +35,7 @@ local function init() ---@field messenger HeimdallMessengerConfig ---@field deathReporter HeimdallDeathReporterConfig ---@field whisperNotify table + ---@field stinkies table ---@class HeimdallSpotterConfig ---@field enabled boolean @@ -154,6 +155,7 @@ local function init() "Shootleta", "Stableta" }), + stinkies = data.GetOrDefault(Heimdall_Data, { "config", "stinkies" }, {}), } data.raceMap = { @@ -195,8 +197,6 @@ local function init() ["Demon Hunter"] = "A330C9" } - data.stinkies = {} - ---@param input string ---@return number data.utf8len = function(input) @@ -253,3 +253,20 @@ loadedFrame:SetScript("OnEvent", function(self, event, addonName) init() end end) + +local logoutFrame = CreateFrame("Frame") +logoutFrame:RegisterEvent("PLAYER_LOGOUT") +logoutFrame:SetScript("OnEvent", function(self, event) + Heimdall_Data.config.stinkies = data.config.stinkies +end) + +SlashCmdList["HEIMDALL_TOGGLE_STINKY"] = function(input) + print("Toggling stinky: " .. tostring(input)) + if data.config.stinkies[input] then + data.config.stinkies[input] = nil + else + data.config.stinkies[input] = true + end + print(data.config.stinkies[input]) +end +SLASH_HEIMDALL_TOGGLE_STINKY1 = "/has" diff --git a/Spotter.lua b/Spotter.lua index 8b47f44..638430b 100644 --- a/Spotter.lua +++ b/Spotter.lua @@ -28,7 +28,7 @@ function data.Spotter.Init() ---@return string? error local function ShouldNotify(unit, name, faction, hostile) if data.config.spotter.stinky then - if data.stinkies[name] then return true end + if data.config.stinkies[name] then return true end end if data.config.spotter.alliance then if faction == "Alliance" then return true end @@ -78,8 +78,10 @@ function data.Spotter.Init() location = string.format("%s (%s)", zone, subzone) end - local text = string.format("I see (%s) %s of race %s (%s) with health %s/%s at %s", + local stinky = data.config.stinkies[name] or false + local text = string.format("I see (%s) %s %s of race %s (%s) with health %s/%s at %s", hostile and "Hostile" or "Friendly", + stinky and string.format("(%s)", "!!!!") or "", name, race, faction, diff --git a/Whoer.lua b/Whoer.lua index 65faa82..9271c48 100644 --- a/Whoer.lua +++ b/Whoer.lua @@ -278,7 +278,7 @@ function data.Whoer.Init() player.firstSeen = timestamp end - local stinky = data.stinkies[name] + local stinky = data.config.stinkies[name] if stinky then PlaySoundFile("Interface\\Sounds\\Domination.ogg", "Master") else