From fa8b204a8fb600eae235c4015395943600efce5a Mon Sep 17 00:00:00 2001 From: Xurkon Date: Fri, 5 Jun 2026 19:13:16 -0500 Subject: [PATCH] fix: trace loot source gameobjects --- Modules/QuestieLearner.lua | 15 +++++++++++++++ Tests/AuditFindings_spec.lua | 2 ++ 2 files changed, 17 insertions(+) diff --git a/Modules/QuestieLearner.lua b/Modules/QuestieLearner.lua index 054b591..a21225f 100644 --- a/Modules/QuestieLearner.lua +++ b/Modules/QuestieLearner.lua @@ -2976,6 +2976,21 @@ function QuestieLearner:OnLootOpened() for i = 1, numItems do local _, lootName, _, _, lootQuality = GetLootSlotInfo(i) if lootName then + if GetLootSourceInfo then + local sources = { GetLootSourceInfo(i) } + local sourceCount = table.getn(sources) + for j = 1, sourceCount, 2 do + local sourceGuid = sources[j] + local sourceQty = sources[j + 1] + TraceLearnerEntity("loot_source", sourceGuid, nil, sourceQty, lootName) + if type(sourceGuid) == "string" then + local sourceId, sourceType = GetIdAndTypeFromGUID(sourceGuid) + if sourceType == "GameObject" and sourceId and sourceId > 0 then + self:LearnObject(sourceId, nil) + end + end + end + end local link = GetLootSlotLink(i) if link then local itemId = tonumber(string.match(link, "item:(%d+)")) diff --git a/Tests/AuditFindings_spec.lua b/Tests/AuditFindings_spec.lua index d9870ef..2190e7a 100644 --- a/Tests/AuditFindings_spec.lua +++ b/Tests/AuditFindings_spec.lua @@ -374,6 +374,8 @@ describe("Audit Pass 10 - additional performance findings (snapshot)", function( assert.is_true(has(learner, 'TraceLearnerEntity("mouseover", guid, unitType, entityId, name)')) assert.is_true(has(learner, 'TraceLearnerEntity("target", guid, unitType, entityId, name)')) assert.is_true(has(learner, 'TraceLearnerEntity("loot_target", targetGuid, targetType, targetId, UnitName("target"))')) + assert.is_true(has(learner, 'GetLootSourceInfo then')) + assert.is_true(has(learner, 'TraceLearnerEntity("loot_source", sourceGuid, nil, sourceQty, lootName)')) assert.is_true(has(learner, 'TraceLearnerEntity("gossip", npcGuid, unitType, id, name)')) assert.is_true(has(learner, 'self:LearnObject(entityId, name)')) assert.is_true(has(learner, 'if unitType == "GameObject" then'))