From a8d511382633f6df9f566737b47b5cd463869110 Mon Sep 17 00:00:00 2001 From: sarah Date: Sat, 28 Mar 2026 06:17:15 +0100 Subject: [PATCH] first commit --- LICENSE | 21 +++++++++++++++++++++ OnlyMyLoot.lua | 47 +++++++++++++++++++++++++++++++++++++++++++++++ OnlyMyLoot.toc | 7 +++++++ 3 files changed, 75 insertions(+) create mode 100644 LICENSE create mode 100644 OnlyMyLoot.lua create mode 100644 OnlyMyLoot.toc diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..edf339a --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Protuhj + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/OnlyMyLoot.lua b/OnlyMyLoot.lua new file mode 100644 index 0000000..8f3b8fa --- /dev/null +++ b/OnlyMyLoot.lua @@ -0,0 +1,47 @@ +-- OnlyMyLoot.lua +-- Checks the GUID from CHAT_MSG_LOOT events to see if it matches the local account's GUID. + +local addonName, addon = ... + +local enabled = true +local numberFiltered = 0 + +local function onlyMyLoot_OnEvent(self, event, ...) + -- If this is disabled, don't filter it + if (not enabled) then + return false + end + guid = select(12, ...) + -- If it's my loot, don't filter it, otherwise filter it. guid apparently can be nil + if (C_AccountInfo.IsGUIDRelatedToLocalAccount(guid or "")) then + return false, ... + else + numberFiltered = numberFiltered + 1 + return true, ... + end +end + +ChatFrame_AddMessageEventFilter("CHAT_MSG_LOOT", onlyMyLoot_OnEvent) + +local function handle(msg) + msg = msg or "" + if (msg == "stats" or msg == "?") then + print("OnlyMyLoot has filtered " .. tostring(numberFiltered) .. " since last interface load.") + else + enabled = not(enabled) + if (enabled) then + print("OnlyMyLoot enabled; hiding loot that isn't yours!") + else + print("OnlyMyLoot disabled.") + end + end +end + + +SLASH_ONLYMYLOOT1 = "/ONLYMYLOOT"; +SLASH_ONLYMYLOOT2 = "/OML"; + +SlashCmdList["ONLYMYLOOT"] = handle +SlashCmdList["OML"] = handle + +print("OnlyMyLoot is hiding others' loot!") \ No newline at end of file diff --git a/OnlyMyLoot.toc b/OnlyMyLoot.toc new file mode 100644 index 0000000..b92a898 --- /dev/null +++ b/OnlyMyLoot.toc @@ -0,0 +1,7 @@ +## Interface: 100207 +## Title: OnlyMyLoot +## Notes: Hides other users' loot messages from your chat. +## Author: Protuhj +## SavedVariables: addonConfig +## Version: 100207_03 +OnlyMyLoot.lua \ No newline at end of file