fix: restore learner questgiver and item drop learning

This commit is contained in:
Xurkon
2026-06-06 07:56:29 -05:00
parent cccfa1e81b
commit 36668338f5
3 changed files with 48 additions and 39 deletions
+5 -17
View File
@@ -265,7 +265,7 @@ describe("QuestieLearner GUID and loot learning", function()
assert.equals("Creature", unitType)
end)
it("learns pending loot items once item info arrives even when class metadata is not quest-item shaped", function()
it("learns loot item drop sources even when class metadata is not quest-item shaped", function()
local learnedItemId = nil
local dropItemId = nil
local dropNpcId = nil
@@ -278,24 +278,12 @@ describe("QuestieLearner GUID and loot learning", function()
dropNpcId = npcId
end
_G.GetNumLootItems = function()
return 1
end
_G.GetLootSlotInfo = function(slot)
return nil, "Quest Token", nil, nil, 1
end
_G.GetLootSlotLink = function(slot)
return "item:20470"
end
_G.GetLootSourceInfo = function(slot)
return "Creature-0-0-0-0-15297-0000000000", 1
end
QuestieLearner:OnLootOpened()
QuestieLearner:LearnItem(20470, "Quest Token", 1, 1, 1, 0)
QuestieLearner:LearnItemDrop(20470, 15297)
assert.equals(20470, learnedItemId)
assert.is_nil(dropItemId)
assert.is_nil(dropNpcId)
assert.equals(20470, dropItemId)
assert.equals(15297, dropNpcId)
end)
end)
+29
View File
@@ -130,6 +130,35 @@ describe("QuestieLearner kill-path batching", function()
assert.equals(33.20, Questie.dbLearner.global.npcs[3001][7][44][1][2])
end)
it("keeps quest-tied fallback questgiver spawns from being stripped", function()
Questie.dbLearner.global.settings.dataSourceMode = "learner"
local originalGetPlayerCoords = _G.GetPlayerCoords
_G.GetPlayerCoords = function()
return 10.0, 20.0
end
QuestieLearner:LearnNPC(4001, "Quest Giver", nil, nil, nil, nil, nil, nil, 44)
QuestieLearner:LearnQuestGiver(6004, 4001, 1, true)
assert.equals("fallback", Questie.dbLearner.global.npcs[4001].spawnSource)
assert.is_table(Questie.dbLearner.global.npcs[4001][7])
assert.is_table(Questie.dbLearner.global.npcs[4001][7][44])
assert.is_true(table.getn(Questie.dbLearner.global.npcs[4001][7][44]) >= 1)
_G.GetPlayerCoords = originalGetPlayerCoords
end)
it("records item drop sources even when the item class is not available on first pass", function()
Questie.dbLearner.global.settings.dataSourceMode = "learner"
QuestieLearner:LearnItem(2301, "Quest Shard", 1, 1, 1, 0)
QuestieLearner:LearnItemDrop(2301, 7301)
assert.is_table(Questie.dbLearner.global.items[2301][2])
assert.equals(7301, Questie.dbLearner.global.items[2301][2][1])
assert.equals(7301, QuestieDB.itemDataOverrides[2301][2][1])
end)
it("force-flushes active quest pins within the NPC live-update flush (no second debounce)", function()
local updateCount = 0
local originalUpdateQuest = QuestieQuest.UpdateQuest