diff --git a/MainCharacterTag_OC.lua b/MainCharacterTag_OC.lua index 63c747d..ecbe1de 100644 --- a/MainCharacterTag_OC.lua +++ b/MainCharacterTag_OC.lua @@ -44,17 +44,22 @@ function SendChatMessage(msg, chatType, language, channel) end -- ============================================================ --- Filter achievement messages from guild and officer chat +-- Filter achievement and Shellcoin messages -- Hooks ChatFrame_OnEvent, the correct approach for 1.12.1 -- ============================================================ local origChatFrameOnEvent = ChatFrame_OnEvent function ChatFrame_OnEvent(event) - if (event == "CHAT_MSG_GUILD" or event == "CHAT_MSG_OFFICER") then + if event == "CHAT_MSG_GUILD" or event == "CHAT_MSG_OFFICER" then if MainCharacterTag_OCDB.filterAchievements and arg1 and string.find(string.lower(arg1), "has earned the achievement") then return end end + if event == "CHAT_MSG_SYSTEM" then + if MainCharacterTag_OCDB.filterShellcoin and arg1 and string.sub(arg1, 1, 15) == "Shellcoin price" then + return + end + end origChatFrameOnEvent(event) end @@ -63,7 +68,7 @@ end -- ============================================================ local optionsFrame = CreateFrame("Frame", "MainCharacterTag_OCOptions", UIParent) optionsFrame:SetWidth(360) -optionsFrame:SetHeight(240) +optionsFrame:SetHeight(280) optionsFrame:SetPoint("CENTER", UIParent, "CENTER") optionsFrame:SetBackdrop({ bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background", @@ -132,6 +137,20 @@ achieveCheck:SetScript("OnClick", function() MainCharacterTag_OCDB.filterAchievements = achieveCheck:GetChecked() and true or false end) +-- Shellcoin filter checkbox +local shellcoinCheck = CreateFrame("CheckButton", "MainCharacterTag_OCShellcoinCheck", optionsFrame, "UICheckButtonTemplate") +shellcoinCheck:SetPoint("TOPLEFT", optionsFrame, "TOPLEFT", 16, -162) +shellcoinCheck:SetWidth(24) +shellcoinCheck:SetHeight(24) + +local shellcoinLabel = optionsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") +shellcoinLabel:SetPoint("LEFT", shellcoinCheck, "RIGHT", 4, 0) +shellcoinLabel:SetText("Hide 'Shellcoin price' system messages") + +shellcoinCheck:SetScript("OnClick", function() + MainCharacterTag_OCDB.filterShellcoin = shellcoinCheck:GetChecked() and true or false +end) + -- Status text centered above buttons local statusLabel = optionsFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") statusLabel:SetPoint("BOTTOM", optionsFrame, "BOTTOM", 0, 50) @@ -169,6 +188,7 @@ optionsFrame:SetScript("OnShow", function() nameInput:SetText(GetMainName()) currentLabel:SetText("Logged in as: |cffffd700" .. (UnitName("player") or "Unknown") .. "|r") achieveCheck:SetChecked(MainCharacterTag_OCDB.filterAchievements and true or false) + shellcoinCheck:SetChecked(MainCharacterTag_OCDB.filterShellcoin and true or false) local main = GetMainName() if main == "" then statusLabel:SetText("|cffaaaaaa(No main set — prefix disabled)|r") @@ -204,6 +224,9 @@ eventFrame:SetScript("OnEvent", function() if MainCharacterTag_OCDB.filterAchievements == nil then MainCharacterTag_OCDB.filterAchievements = false end + if MainCharacterTag_OCDB.filterShellcoin == nil then + MainCharacterTag_OCDB.filterShellcoin = false + end DEFAULT_CHAT_FRAME:AddMessage("|cff00ff96MainCharacterTag_OC|r loaded. Type |cffffd700/mct|r to open options.") elseif event == "PLAYER_ENTERING_WORLD" then playerReady = true diff --git a/MainCharacterTag_OC.toc b/MainCharacterTag_OC.toc index 224fe5f..45e1d2e 100644 --- a/MainCharacterTag_OC.toc +++ b/MainCharacterTag_OC.toc @@ -1,7 +1,7 @@ ## Interface: 11200 ## Title: MainCharacterTag_OC ## Notes: Prefixes guild chat messages with your main character's name so guildies know who you are. -## Version: 1.5 +## Version: 1.7 ## Author: Olzon ## SavedVariables: MainCharacterTag_OCDB diff --git a/README.md b/README.md index 71caea6..48849d1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MainCharacterTag_OC -![Version](https://img.shields.io/badge/version-1.5-blue) ![Interface](https://img.shields.io/badge/OctoWoW_1.18-1.12.1-yellow) +![Version](https://img.shields.io/badge/version-1.7-blue) ![Interface](https://img.shields.io/badge/OctoWoW_1.18-1.12.1-yellow) A lightweight World of Warcraft addon for OctoWoW (1.18) or other 1.12.1 WoW clients that automatically tags your guild chat messages with your main character's name when playing on alts. @@ -9,7 +9,7 @@ A lightweight World of Warcraft addon for OctoWoW (1.18) or other 1.12.1 WoW cli When you chat in **Guild** or **Guild Officer** chat on an alt, your messages are automatically prefixed with your main's name so guildmates always know who they're talking to. **Example:** Playing on your alt `Shadowpoke` with main set to `Thunderbash`: -> **(Thunderbash): Hey all, it's me just on my alt!** +> **Shadowpoke (Thunderbash): Hey all, it's me just on my alt!** Messages sent from your main character are unaffected. @@ -42,12 +42,19 @@ Enter your main character's name and click **Save**. That's it. - Only affects **Guild** (`/g`) and **Guild Officer** (`/o`) chat - Messages starting with `.`, `/`, or `#` are never prefixed - Achievement spam filter is off by default and can be toggled in the options window +- Shellcoin price system message filter is off by default and can be toggled in the options window - Your main's name is saved between sessions per character - Works on any number of alts - No performance impact — only runs when you send a guild message ## Changelog +### 1.7 +- Changed Shellcoin filter to match messages starting with `Shellcoin price` instead of `Shellcoin` + +### 1.6 +- Added checkbox to hide `Shellcoin price` system messages (default: off) + ### 1.5 - Added checkbox in options to toggle filtering of `has earned the achievement` messages in guild and officer chat (default: off)