From 3cb2c703852d66294a0a64166ca0fbf0deb1de69 Mon Sep 17 00:00:00 2001 From: "Cameron Weaver (Clutch)" Date: Mon, 24 Jul 2023 07:13:05 -0400 Subject: [PATCH] chat: option to /who search unknown names --- api/config.lua | 1 + env/translations_deDE.lua | 1 + env/translations_enUS.lua | 1 + env/translations_esES.lua | 1 + env/translations_frFR.lua | 1 + env/translations_koKR.lua | 1 + env/translations_ruRU.lua | 1 + env/translations_zhCN.lua | 1 + env/translations_zhTW.lua | 1 + modules/chat.lua | 27 +++++++++++++++++++++++++++ modules/gui.lua | 1 + 11 files changed, 37 insertions(+) diff --git a/api/config.lua b/api/config.lua index 0c9a3e4a..24aeb35f 100644 --- a/api/config.lua +++ b/api/config.lua @@ -645,6 +645,7 @@ function pfUI:LoadConfig() pfUI:UpdateConfig("chat", "text", "playerlinks", "1") pfUI:UpdateConfig("chat", "text", "detecturl", "1") pfUI:UpdateConfig("chat", "text", "classcolor", "1") + pfUI:UpdateConfig("chat", "text", "whosearchunknown", "0") pfUI:UpdateConfig("chat", "left", "width", "380") pfUI:UpdateConfig("chat", "left", "height", "180") pfUI:UpdateConfig("chat", "right", "enable", "0") diff --git a/env/translations_deDE.lua b/env/translations_deDE.lua index af480c52..01cd82a8 100644 --- a/env/translations_deDE.lua +++ b/env/translations_deDE.lua @@ -770,6 +770,7 @@ pfUI_translation["deDE"] = { ["Website"] = nil, ["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcchttp://shagu.org|r to check for the latest version."] = nil, ["Whitelist"] = nil, + ["Who Search Unknown Classes"] = nil, ["Width"] = nil, ["Wobble Zoom"] = nil, ["Won"] = nil, diff --git a/env/translations_enUS.lua b/env/translations_enUS.lua index e387f775..b1a5d49a 100644 --- a/env/translations_enUS.lua +++ b/env/translations_enUS.lua @@ -770,6 +770,7 @@ pfUI_translation["enUS"] = { ["Website"] = nil, ["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcchttp://shagu.org|r to check for the latest version."] = nil, ["Whitelist"] = nil, + ["Who Search Unknown Classes"] = nil, ["Width"] = nil, ["Wobble Zoom"] = nil, ["Won"] = nil, diff --git a/env/translations_esES.lua b/env/translations_esES.lua index 945b2ef6..3f77b516 100644 --- a/env/translations_esES.lua +++ b/env/translations_esES.lua @@ -770,6 +770,7 @@ pfUI_translation["esES"] = { ["Website"] = "Sitio de web", ["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcchttp://shagu.org|r to check for the latest version."] = "¡Bienvenido a |cff33ffccpf|cffffffffUI|r!\n\nSoy el asistente de instalación que te guiará con la configuración básica. Si prefieres, puedes hacer clic el botón \"Predeterminado\" para cargar la configuración por defecto. Si quieres abrir este diálogo de nuevo, ve a la configuración y haz clic en el botón \"Reiniciar Primera vez\".\n\nVisita |cff33ffcchttp://shagu.org|r para descargar la última versión.", ["Whitelist"] = "Lista blanca", + ["Who Search Unknown Classes"] = nil, ["Width"] = "Ancho", ["Wobble Zoom"] = "Acerca tambalea", ["Won"] = "Ganado", diff --git a/env/translations_frFR.lua b/env/translations_frFR.lua index a2299062..e59c6458 100644 --- a/env/translations_frFR.lua +++ b/env/translations_frFR.lua @@ -770,6 +770,7 @@ pfUI_translation["frFR"] = { ["Website"] = "Site web", ["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcchttp://shagu.org|r to check for the latest version."] = "Bienvenue sur l'assistant d'installation de l'interface |cff33ffccpf|cffffffffUI|r!\n\nNous allons effectuer quelques configurations de base. Si vous n'avez pas la patience, cliquer sur le bouton \"Paramètres par défaut\". Si vous souhaitez relancer cette fenêtre de dialogue, allez dans les options et cliquez sur le bouton\"Réinitialiser l'assistant d'installation\" .\n\nAllez sur |cff33ffcchttp://shagu.org|r pour télécharger la dernière version.", ["Whitelist"] = "List blanche", + ["Who Search Unknown Classes"] = nil, ["Width"] = "Largeur", ["Wobble Zoom"] = "Zoom oscillant", ["Won"] = "A gagné", diff --git a/env/translations_koKR.lua b/env/translations_koKR.lua index 18db937a..34e1fb93 100644 --- a/env/translations_koKR.lua +++ b/env/translations_koKR.lua @@ -770,6 +770,7 @@ pfUI_translation["koKR"] = { ["Website"] = nil, ["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcchttp://shagu.org|r to check for the latest version."] = "|cff33ffccpf|cffffffffUI|r에 |cff33ffcc오신걸 환영합니다.|r \n\n저는 몇 가지 기본 구성을 안내 할 첫 번째 실행 위자드입니다. 모든 단계를 건너 뛰고 싶으시면 \"기본값 사용\" 버튼을 누르십시오. 이 대화 상자를 다시 실행하려면 추후 설정으로 이동하여 \"첫단계로 재설정\" 버튼을 누르십시오.\n\n최신버전 다운로드 사이트: |cff33ffcchttp://shagu.org|r", ["Whitelist"] = nil, + ["Who Search Unknown Classes"] = nil, ["Width"] = nil, ["Wobble Zoom"] = nil, ["Won"] = nil, diff --git a/env/translations_ruRU.lua b/env/translations_ruRU.lua index e4ad3e2e..2805eef3 100644 --- a/env/translations_ruRU.lua +++ b/env/translations_ruRU.lua @@ -770,6 +770,7 @@ pfUI_translation["ruRU"] = { ["Website"] = "Веб-сайт", ["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcchttp://shagu.org|r to check for the latest version."] = "Добро пожаловать в |cff33ffccpf|cffffffffUI|r!\n\nЯ мастер первого запуска, который проведет вас через некоторую базовую конфигурацию. Если вы ленитесь, не стесняйтесь нажать кнопку \"По умолчанию\". Если вы хотите снова запустить этот диалог, перейдите к настройкам и нажмите кнопку \"Первый запуск\".\n\nПосетите |cff33ffcchttp://shagu.org|r, чтобы проверить последнюю версию.", ["Whitelist"] = "\"Белый\" список", + ["Who Search Unknown Classes"] = nil, ["Width"] = "Ширина", ["Wobble Zoom"] = "Подпрыгивание", ["Won"] = "Победа", diff --git a/env/translations_zhCN.lua b/env/translations_zhCN.lua index f6c58a65..95c768f8 100644 --- a/env/translations_zhCN.lua +++ b/env/translations_zhCN.lua @@ -770,6 +770,7 @@ pfUI_translation["zhCN"] = { ["Website"] = "网站", ["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcchttp://shagu.org|r to check for the latest version."] = "欢迎使用 |cff33ffccpf|cffffffffUI|r! \n\n这是第一次运行向导,将引导您完成一些基本配置。 如果你想跳过所有步骤\"使用默认\"按钮。 如果您再次运行此对话框,请转到设置并点击 \"Reset Firstrun\" 按钮。\n\n访问 |cff33ffcchttp://shagu.org|r 检查最新版本。", ["Whitelist"] = "白名单", + ["Who Search Unknown Classes"] = nil, ["Width"] = nil, ["Wobble Zoom"] = "摆动变焦", ["Won"] = nil, diff --git a/env/translations_zhTW.lua b/env/translations_zhTW.lua index 19af113c..e8fa6161 100644 --- a/env/translations_zhTW.lua +++ b/env/translations_zhTW.lua @@ -770,6 +770,7 @@ pfUI_translation["zhTW"] = { ["Website"] = nil, ["Welcome to |cff33ffccpf|cffffffffUI|r!\n\nI'm the first run wizard that will guide you through some basic configuration. If you're lazy, feel free to hit the \"Defaults\" button. If you wish to run this dialog again, go to the settings and hit the \"Reset Firstrun\" button.\n\nVisit |cff33ffcchttp://shagu.org|r to check for the latest version."] = "歡迎使用 |cff33ffccpf|cffffffffUI|r! \n\n這是第一次運行嚮導,將引導您完成一些基本配置。 如果你想跳過所有步驟\"使用預設\"按鈕。 如果您再次運行此對話方塊,請轉到設置並點擊 \"Reset Firstrun\" 按鈕。\n\n訪問 |cff33ffcchttp://shagu.org|r 檢查最新版本。", ["Whitelist"] = "白名單", + ["Who Search Unknown Classes"] = nil, ["Width"] = nil, ["Wobble Zoom"] = nil, ["Won"] = nil, diff --git a/modules/chat.lua b/modules/chat.lua index 195dac65..97859e83 100644 --- a/modules/chat.lua +++ b/modules/chat.lua @@ -695,6 +695,31 @@ pfUI:RegisterModule("chat", "vanilla:tbc", function () local r,g,b = strsplit(",", C.chat.text.unknowncolor) local unknowncolorhex = rgbhex(r,g,b) + local nothing = function() return end + local original = FriendsFrame_OnEvent + + local who_query = CreateFrame("Frame") + who_query:RegisterEvent("WHO_LIST_UPDATE") + who_query:SetScript("OnEvent", function() + if this.pending then + -- restore everything once a query is received + _G.FriendsFrame_OnEvent = original + this.pending = nil + SetWhoToUI(0) + end + end) + + local function ScanWhoName(name) + -- abort if another query is ongoing + if who_query.pending then return end + who_query.pending = true + + -- prepare and send the who query + _G.FriendsFrame_OnEvent = nothing + SetWhoToUI(1) + SendWho("n-"..name) + end + local function AddMessage(frame, text, a1, a2, a3, a4, a5) if not text then return end @@ -731,6 +756,8 @@ pfUI:RegisterModule("chat", "vanilla:tbc", function () color = rgbhex(RAID_CLASS_COLORS[class]) match = true end + elseif C.chat.text.whosearchunknown == "1" then + ScanWhoName(name) end if C.chat.text.tintunknown == "1" or match then diff --git a/modules/gui.lua b/modules/gui.lua index a8684cde..67880832 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -2155,6 +2155,7 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function () CreateConfig(nil, T["Generate Playerlinks"], C.chat.text, "playerlinks", "checkbox") CreateConfig(nil, T["Enable URL Detection"], C.chat.text, "detecturl", "checkbox") CreateConfig(nil, T["Enable Class Colors"], C.chat.text, "classcolor", "checkbox") + CreateConfig(nil, T["Who Search Unknown Classes"], C.chat.text, "whosearchunknown", "checkbox") CreateConfig(nil, T["Colorize Unknown Classes"], C.chat.text, "tintunknown", "checkbox") CreateConfig(nil, T["Unknown Class Color"], C.chat.text, "unknowncolor", "color") CreateConfig(nil, T["Left Chat Width"], C.chat.left, "width")