fix: prefer loot source for item drops
This commit is contained in:
@@ -218,6 +218,10 @@ describe("QuestieLearner GUID and loot learning", function()
|
||||
local originalGetItemInfo
|
||||
local originalLearnItem
|
||||
local originalLearnItemDrop
|
||||
local originalGetLootSourceInfo
|
||||
local originalGetNumLootItems
|
||||
local originalGetLootSlotInfo
|
||||
local originalGetLootSlotLink
|
||||
|
||||
before_each(function()
|
||||
dofile("Tests/wow_api_mock.lua")
|
||||
@@ -240,10 +244,26 @@ describe("QuestieLearner GUID and loot learning", function()
|
||||
originalGetItemInfo = _G.GetItemInfo
|
||||
_G.GetItemInfo = function(link)
|
||||
if link == "item:20470" then
|
||||
return "Quest Token", nil, nil, 1, 1, 3, 1, nil, nil, nil, nil, 3, 1
|
||||
return "Quest Token", nil, nil, 1, 1, 3, 1, nil, nil, nil, nil, 1, 0
|
||||
end
|
||||
return nil
|
||||
end
|
||||
originalGetLootSourceInfo = _G.GetLootSourceInfo
|
||||
_G.GetLootSourceInfo = function()
|
||||
return "Creature-0-0-0-0-15297-0000000000", 1
|
||||
end
|
||||
originalGetNumLootItems = _G.GetNumLootItems
|
||||
_G.GetNumLootItems = function()
|
||||
return 1
|
||||
end
|
||||
originalGetLootSlotInfo = _G.GetLootSlotInfo
|
||||
_G.GetLootSlotInfo = function()
|
||||
return nil, "Quest Token", nil, nil, 1
|
||||
end
|
||||
originalGetLootSlotLink = _G.GetLootSlotLink
|
||||
_G.GetLootSlotLink = function()
|
||||
return "item:20470"
|
||||
end
|
||||
dofile("Modules/QuestieLearner.lua")
|
||||
QuestieLearner = _G.QuestieLearner
|
||||
originalLearnItem = QuestieLearner.LearnItem
|
||||
@@ -253,6 +273,10 @@ describe("QuestieLearner GUID and loot learning", function()
|
||||
after_each(function()
|
||||
QuestieDB.GetNPC = originalGetNPC
|
||||
_G.GetItemInfo = originalGetItemInfo
|
||||
_G.GetLootSourceInfo = originalGetLootSourceInfo
|
||||
_G.GetNumLootItems = originalGetNumLootItems
|
||||
_G.GetLootSlotInfo = originalGetLootSlotInfo
|
||||
_G.GetLootSlotLink = originalGetLootSlotLink
|
||||
if QuestieLearner then
|
||||
QuestieLearner.LearnItem = originalLearnItem
|
||||
QuestieLearner.LearnItemDrop = originalLearnItemDrop
|
||||
@@ -278,8 +302,7 @@ describe("QuestieLearner GUID and loot learning", function()
|
||||
dropNpcId = npcId
|
||||
end
|
||||
|
||||
QuestieLearner:LearnItem(20470, "Quest Token", 1, 1, 1, 0)
|
||||
QuestieLearner:LearnItemDrop(20470, 15297)
|
||||
QuestieLearner:OnLootOpened()
|
||||
|
||||
assert.equals(20470, learnedItemId)
|
||||
assert.equals(20470, dropItemId)
|
||||
|
||||
@@ -132,20 +132,13 @@ describe("QuestieLearner kill-path batching", function()
|
||||
|
||||
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:LearnNPC(4001, "Quest Giver", nil, nil, nil, nil, 10.0, 20.0, 44)
|
||||
QuestieLearner:LearnQuestGiver(6004, 4001, 1, true)
|
||||
|
||||
assert.equals("fallback", Questie.dbLearner.global.npcs[4001].spawnSource)
|
||||
assert.equals("explicit", 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
|
||||
assert.equals(1, table.getn(Questie.dbLearner.global.npcs[4001][7][44]))
|
||||
end)
|
||||
|
||||
it("records item drop sources even when the item class is not available on first pass", function()
|
||||
|
||||
Reference in New Issue
Block a user