feat: add DEBUG_LEARNER and DEBUG_COMMS categories for targeted learner/comms debugging

This commit is contained in:
Xurkon
2026-03-16 22:33:31 -05:00
parent 6b0fdcf9b4
commit f0550fddee
4 changed files with 25 additions and 19 deletions
+11 -11
View File
@@ -221,7 +221,7 @@ end
-- Removes the quest from everyones external quest-log -- Removes the quest from everyones external quest-log
function _QuestieComms:BroadcastQuestRemove(questId) -- broadcast quest update to group or raid function _QuestieComms:BroadcastQuestRemove(questId) -- broadcast quest update to group or raid
local partyType = QuestiePlayer:GetGroupType() local partyType = QuestiePlayer:GetGroupType()
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieComms:BroadcastQuestRemove] QuestId:", questId, "partyType:", tostring(partyType)) Questie:Debug(Questie.DEBUG_COMMS, "[QuestieComms:BroadcastQuestRemove] QuestId:", questId, "partyType:", tostring(partyType))
if partyType then if partyType then
--Do we really need to make this? --Do we really need to make this?
local questPacket = _QuestieComms:CreatePacket(_QuestieComms.QC_ID_BROADCAST_QUEST_REMOVE); local questPacket = _QuestieComms:CreatePacket(_QuestieComms.QC_ID_BROADCAST_QUEST_REMOVE);
@@ -523,7 +523,7 @@ function _QuestieComms:BroadcastQuestLog(eventName, sendMode, targetPlayer) -- b
return return
end end
local partyType = QuestiePlayer:GetGroupType() local partyType = QuestiePlayer:GetGroupType()
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieComms] Message", eventName, "partyType:", tostring(partyType)) Questie:Debug(Questie.DEBUG_COMMS, "[QuestieComms] Message", eventName, "partyType:", tostring(partyType))
if partyType then if partyType then
local sorted = {} local sorted = {}
@@ -640,7 +640,7 @@ function _QuestieComms:BroadcastQuestLogV2(eventName, sendMode, targetPlayer) --
return return
end end
local partyType = QuestiePlayer:GetGroupType() local partyType = QuestiePlayer:GetGroupType()
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieComms] Message", eventName, "partyType:", tostring(partyType)) Questie:Debug(Questie.DEBUG_COMMS, "[QuestieComms] Message", eventName, "partyType:", tostring(partyType))
if partyType then if partyType then
local sorted = {} local sorted = {}
@@ -754,7 +754,7 @@ end
-- The "Hi" of questie, request others to send their questlog. -- The "Hi" of questie, request others to send their questlog.
function _QuestieComms:RequestQuestLog(eventName) -- broadcast quest update to group or raid function _QuestieComms:RequestQuestLog(eventName) -- broadcast quest update to group or raid
local partyType = QuestiePlayer:GetGroupType() local partyType = QuestiePlayer:GetGroupType()
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieComms] Message", eventName, "partyType:", tostring(partyType)) Questie:Debug(Questie.DEBUG_COMMS, "[QuestieComms] Message", eventName, "partyType:", tostring(partyType))
if partyType then if partyType then
--Do we really need to make this? --Do we really need to make this?
local questPacket = _QuestieComms:CreatePacket(_QuestieComms.QC_ID_REQUEST_FULL_QUESTLIST); local questPacket = _QuestieComms:CreatePacket(_QuestieComms.QC_ID_REQUEST_FULL_QUESTLIST);
@@ -867,7 +867,7 @@ _QuestieComms.packets = {
if not remoteQuestPacket then if not remoteQuestPacket then
Questie:Error("[QuestieComms] QC_ID_BROADCAST_QUEST_REMOVE no remoteQuestPacket") Questie:Error("[QuestieComms] QC_ID_BROADCAST_QUEST_REMOVE no remoteQuestPacket")
end end
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieComms] Received: QC_ID_BROADCAST_QUEST_REMOVE") Questie:Debug(Questie.DEBUG_COMMS, "[QuestieComms] Received: QC_ID_BROADCAST_QUEST_REMOVE")
local playerName = remoteQuestPacket.playerName; local playerName = remoteQuestPacket.playerName;
local questId = remoteQuestPacket.id; local questId = remoteQuestPacket.id;
@@ -985,11 +985,11 @@ function _QuestieComms:Broadcast(packet)
packet.writeMode = nil -- we dont need to include these in the packet data packet.writeMode = nil -- we dont need to include these in the packet data
if packetWriteMode == _QuestieComms.QC_WRITE_WHISPER then if packetWriteMode == _QuestieComms.QC_WRITE_WHISPER then
local compressedData = QuestieSerializer:Serialize(packet); local compressedData = QuestieSerializer:Serialize(packet);
Questie:Debug(Questie.DEBUG_DEVELOP,"send(|cFFFF2222", string.len(compressedData), "|r)") Questie:Debug(Questie.DEBUG_COMMS,"send(|cFFFF2222", string.len(compressedData), "|r)")
Questie:SendCommMessage(_QuestieComms.prefix, compressedData, packetWriteMode, packetTarget, packetPriority) Questie:SendCommMessage(_QuestieComms.prefix, compressedData, packetWriteMode, packetTarget, packetPriority)
elseif packetWriteMode == _QuestieComms.QC_WRITE_CHANNEL then elseif packetWriteMode == _QuestieComms.QC_WRITE_CHANNEL then
local compressedData = QuestieSerializer:Serialize(packet); local compressedData = QuestieSerializer:Serialize(packet);
Questie:Debug(Questie.DEBUG_DEVELOP,"send(|cFFFF2222", string.len(compressedData), "|r)") Questie:Debug(Questie.DEBUG_COMMS,"send(|cFFFF2222", string.len(compressedData), "|r)")
-- Always do channel messages as BULK priority -- Always do channel messages as BULK priority
Questie:SendCommMessage(_QuestieComms.prefix, compressedData, packetWriteMode, GetChannelName("questiecom"), "BULK") Questie:SendCommMessage(_QuestieComms.prefix, compressedData, packetWriteMode, GetChannelName("questiecom"), "BULK")
--OLD: C_ChatInfo.SendAddonMessage("questie", compressedData, "CHANNEL", GetChannelName("questiecom")) --OLD: C_ChatInfo.SendAddonMessage("questie", compressedData, "CHANNEL", GetChannelName("questiecom"))
@@ -1001,7 +1001,7 @@ function _QuestieComms:Broadcast(packet)
Questie:SendCommMessage(_QuestieComms.prefix, compressedData, packetWriteMode, "BULK") Questie:SendCommMessage(_QuestieComms.prefix, compressedData, packetWriteMode, "BULK")
else else
local compressedData = QuestieSerializer:Serialize(packet); local compressedData = QuestieSerializer:Serialize(packet);
Questie:Debug(Questie.DEBUG_DEVELOP, "send(|cFFFF2222", string.len(compressedData), "|r)") Questie:Debug(Questie.DEBUG_COMMS, "send(|cFFFF2222", string.len(compressedData), "|r)")
Questie:SendCommMessage(_QuestieComms.prefix, compressedData, packetWriteMode, nil, packetPriority) Questie:SendCommMessage(_QuestieComms.prefix, compressedData, packetWriteMode, nil, packetPriority)
--OLD: C_ChatInfo.SendAddonMessage("questie", compressedData, packet.writeMode) --OLD: C_ChatInfo.SendAddonMessage("questie", compressedData, packet.writeMode)
end end
@@ -1013,7 +1013,7 @@ end
function _QuestieComms:OnCommReceived_unsafe(message, distribution, sender) function _QuestieComms:OnCommReceived_unsafe(message, distribution, sender)
--print("[" .. distribution .."][" .. sender .. "] " .. message) --print("[" .. distribution .."][" .. sender .. "] " .. message)
Questie:Debug(Questie.DEBUG_DEVELOP, "|cFF22FF22", "sender:", "|r", sender, "distribution:", distribution, "Packet length:",string.len(message)) Questie:Debug(Questie.DEBUG_COMMS, "|cFF22FF22", "sender:", "|r", sender, "distribution:", distribution, "Packet length:",string.len(message))
if message and sender and sender ~= UnitName("player") then if message and sender and sender ~= UnitName("player") then
local decompressedData local decompressedData
if distribution == "YELL" then if distribution == "YELL" then
@@ -1027,7 +1027,7 @@ function _QuestieComms:OnCommReceived_unsafe(message, distribution, sender)
--Check if the message version is the same base value --Check if the message version is the same base value
if distribution == "YELL" and decompressedData.msgId and _QuestieComms.packets[decompressedData.msgId] then if distribution == "YELL" and decompressedData.msgId and _QuestieComms.packets[decompressedData.msgId] then
decompressedData.playerName = sender; decompressedData.playerName = sender;
Questie:Debug(Questie.DEBUG_DEVELOP, "Executing message ID: ", decompressedData.msgId, "From: ", sender) Questie:Debug(Questie.DEBUG_COMMS, "Executing message ID: ", decompressedData.msgId, "From: ", sender)
_QuestieComms.packets[decompressedData.msgId].read(decompressedData) _QuestieComms.packets[decompressedData.msgId].read(decompressedData)
elseif(decompressedData and decompressedData.msgVer and floor(decompressedData.msgVer) == floor(commMessageVersion)) then elseif(decompressedData and decompressedData.msgVer and floor(decompressedData.msgVer) == floor(commMessageVersion)) then
if(decompressedData and decompressedData.msgId and _QuestieComms.packets[decompressedData.msgId]) then if(decompressedData and decompressedData.msgId and _QuestieComms.packets[decompressedData.msgId]) then
@@ -1049,7 +1049,7 @@ function _QuestieComms:OnCommReceived_unsafe(message, distribution, sender)
end end
decompressedData.playerName = sender; decompressedData.playerName = sender;
Questie:Debug(Questie.DEBUG_DEVELOP, "Executing message ID: ", decompressedData.msgId, "From: ", sender, "MessageVersion:", decompressedData.msgVer) Questie:Debug(Questie.DEBUG_COMMS, "Executing message ID: ", decompressedData.msgId, "From: ", sender, "MessageVersion:", decompressedData.msgVer)
_QuestieComms.packets[decompressedData.msgId].read(decompressedData); _QuestieComms.packets[decompressedData.msgId].read(decompressedData);
else else
@@ -391,6 +391,8 @@ function QuestieOptions.tabs.advanced:Initialize()
[2] = "DEBUG_INFO", [2] = "DEBUG_INFO",
[3] = "DEBUG_DEVELOP", [3] = "DEBUG_DEVELOP",
[4] = "DEBUG_SPAM", [4] = "DEBUG_SPAM",
[5] = "DEBUG_LEARNER",
[6] = "DEBUG_COMMS",
}, },
order = 5.09, order = 5.09,
name = function() return l10n('Debug level to print'); end, name = function() return l10n('Debug level to print'); end,
+8 -8
View File
@@ -162,7 +162,7 @@ function QuestieLearner:LearnNPC(npcId, name, level, subName, npcFlags, factionS
existing.mc = (existing.mc or 0) + 1 existing.mc = (existing.mc or 0) + 1
if isNew then if isNew then
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieLearner] New NPC learned:", npcId, name or "?") Questie:Debug(Questie.DEBUG_LEARNER, "[QuestieLearner] New NPC learned:", npcId, name or "?")
end end
_Learner:BroadcastIfCommsAvailable("NPC", npcId, existing) _Learner:BroadcastIfCommsAvailable("NPC", npcId, existing)
end end
@@ -179,11 +179,11 @@ end
-- [17] details text [18] finishText [19] completedText -- [17] details text [18] finishText [19] completedText
function QuestieLearner:LearnQuest(questId, data) function QuestieLearner:LearnQuest(questId, data)
if not self:IsEnabled() then if not self:IsEnabled() then
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieLearner] LearnQuest blocked: learner not enabled") Questie:Debug(Questie.DEBUG_LEARNER, "[QuestieLearner] LearnQuest blocked: learner not enabled")
return return
end end
if not Questie.db.global.learnedData.settings.learnQuests then if not Questie.db.global.learnedData.settings.learnQuests then
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieLearner] LearnQuest blocked: learnQuests=", tostring(Questie.db.global.learnedData.settings.learnQuests)) Questie:Debug(Questie.DEBUG_LEARNER, "[QuestieLearner] LearnQuest blocked: learnQuests=", tostring(Questie.db.global.learnedData.settings.learnQuests))
return return
end end
if not questId or questId <= 0 then return end if not questId or questId <= 0 then return end
@@ -204,7 +204,7 @@ function QuestieLearner:LearnQuest(questId, data)
existing.mc = (existing.mc or 0) + 1 existing.mc = (existing.mc or 0) + 1
if isNew then if isNew then
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieLearner] New quest learned:", questId, existing[1] or "?") Questie:Debug(Questie.DEBUG_LEARNER, "[QuestieLearner] New quest learned:", questId, existing[1] or "?")
end end
_Learner:BroadcastIfCommsAvailable("QUEST", questId, existing) _Learner:BroadcastIfCommsAvailable("QUEST", questId, existing)
end end
@@ -259,7 +259,7 @@ function QuestieLearner:LearnItem(itemId, name, itemLevel, requiredLevel, itemCl
existing.mc = (existing.mc or 0) + 1 existing.mc = (existing.mc or 0) + 1
if isNew then if isNew then
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieLearner] New item learned:", itemId, name or "?") Questie:Debug(Questie.DEBUG_LEARNER, "[QuestieLearner] New item learned:", itemId, name or "?")
end end
_Learner:BroadcastIfCommsAvailable("ITEM", itemId, existing) _Learner:BroadcastIfCommsAvailable("ITEM", itemId, existing)
end end
@@ -313,7 +313,7 @@ function QuestieLearner:LearnObject(objectId, name)
existing.mc = (existing.mc or 0) + 1 existing.mc = (existing.mc or 0) + 1
if isNew then if isNew then
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieLearner] New object learned:", objectId, name or "?") Questie:Debug(Questie.DEBUG_LEARNER, "[QuestieLearner] New object learned:", objectId, name or "?")
end end
_Learner:BroadcastIfCommsAvailable("OBJECT", objectId, existing) _Learner:BroadcastIfCommsAvailable("OBJECT", objectId, existing)
end end
@@ -650,7 +650,7 @@ end
-- Fires after the player clicks Accept; questLogIndex and questId are available here -- Fires after the player clicks Accept; questLogIndex and questId are available here
function QuestieLearner:OnQuestAccepted(questLogIndex, questId) function QuestieLearner:OnQuestAccepted(questLogIndex, questId)
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieLearner] OnQuestAccepted: idx=" .. tostring(questLogIndex) .. " id=" .. tostring(questId)) Questie:Debug(Questie.DEBUG_LEARNER, "[QuestieLearner] OnQuestAccepted: idx=" .. tostring(questLogIndex) .. " id=" .. tostring(questId))
-- Resolve questId from log index if not provided -- Resolve questId from log index if not provided
if not questId or questId <= 0 then if not questId or questId <= 0 then
if questLogIndex then if questLogIndex then
@@ -881,7 +881,7 @@ function QuestieLearner:OnCombatLogEvent(...)
end end
end end
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieLearner] Kill recorded: NPC", npcId, destName) Questie:Debug(Questie.DEBUG_LEARNER, "[QuestieLearner] Kill recorded: NPC", npcId, destName)
self:LearnNPC(npcId, destName, nil, nil, nil, nil) self:LearnNPC(npcId, destName, nil, nil, nil, nil)
end end
+4
View File
@@ -139,6 +139,8 @@ Questie.DEBUG_ELEVATED = 2 ^ 1
Questie.DEBUG_INFO = 2 ^ 2 Questie.DEBUG_INFO = 2 ^ 2
Questie.DEBUG_DEVELOP = 2 ^ 3 Questie.DEBUG_DEVELOP = 2 ^ 3
Questie.DEBUG_SPAM = 2 ^ 4 Questie.DEBUG_SPAM = 2 ^ 4
Questie.DEBUG_LEARNER = 2 ^ 5
Questie.DEBUG_COMMS = 2 ^ 6
function Questie:Debug(msgDebugLevel, ...) function Questie:Debug(msgDebugLevel, ...)
if (Questie.db.profile.debugEnabled) then if (Questie.db.profile.debugEnabled) then
@@ -154,6 +156,8 @@ function Questie:Debug(msgDebugLevel, ...)
if (band(msgDebugLevel, Questie.DEBUG_INFO) ~= 0) then prefix = prefix .. "|cff00bc32[INFO]|r " end if (band(msgDebugLevel, Questie.DEBUG_INFO) ~= 0) then prefix = prefix .. "|cff00bc32[INFO]|r " end
if (band(msgDebugLevel, Questie.DEBUG_DEVELOP) ~= 0) then prefix = prefix .. "|cff7c83ff[DEVELOP]|r " end if (band(msgDebugLevel, Questie.DEBUG_DEVELOP) ~= 0) then prefix = prefix .. "|cff7c83ff[DEVELOP]|r " end
if (band(msgDebugLevel, Questie.DEBUG_SPAM) ~= 0) then prefix = prefix .. "|cffff8484[SPAM]|r " end if (band(msgDebugLevel, Questie.DEBUG_SPAM) ~= 0) then prefix = prefix .. "|cffff8484[SPAM]|r " end
if (band(msgDebugLevel, Questie.DEBUG_LEARNER) ~= 0) then prefix = prefix .. "|cff00e5ff[LEARNER]|r " end
if (band(msgDebugLevel, Questie.DEBUG_COMMS) ~= 0) then prefix = prefix .. "|cffff9f00[COMMS]|r " end
if orig_Print then if orig_Print then
orig_Print(Questie, prefix, ...) orig_Print(Questie, prefix, ...)