fix(quest): require multi-position learned spawns before overriding AscensionDB
- Add local _CountUniqueSpawnPositions helper (counts unique {x, y}
across all zone buckets in a spawn table).
- Gate the prioritizeMyData check on ld.settings.enabled, matching the
Database/QuestieDB.lua fix — when the learner is fully disabled,
the override lookup is skipped entirely.
- Replace the NPC-15274-specific debug print in the monster() spawn
selector with a universal reliability check: the learner data is
only used when CountUniqueSpawnPositions(learnedSpawns) > 1.
This is the consumer-side enforcement of the QuestieLearner cleanup
(commit e71e072). Singleton-position spawn entries are typically the
player's current position captured during quest dialog (accept/turn-in)
rather than real kill evidence. By requiring at least 2 unique
positions, we avoid letting that pollution clobber AscensionDB curated
spawn data.
The NPC-15274-specific debug print was removed — the universal check
replaces it, and the diagnostic it provided is now expressed through
the Questie DEBUG_DEVELOP log line (which still emits when the new
condition is met).
This commit is contained in:
@@ -26,6 +26,30 @@ local function _GetIconScaleForLoot()
|
|||||||
return Questie.db.profile.lootScale or 1
|
return Questie.db.profile.lootScale or 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function _CountUniqueSpawnPositions(spawns)
|
||||||
|
if type(spawns) ~= "table" then return 0 end
|
||||||
|
|
||||||
|
local seen = {}
|
||||||
|
local count = 0
|
||||||
|
for _, coords in pairs(spawns) do
|
||||||
|
if type(coords) == "table" then
|
||||||
|
for _, coord in ipairs(coords) do
|
||||||
|
local x = coord and coord[1]
|
||||||
|
local y = coord and coord[2]
|
||||||
|
if x and y then
|
||||||
|
local key = tostring(x) .. "," .. tostring(y)
|
||||||
|
if not seen[key] then
|
||||||
|
seen[key] = true
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return count
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
---@class SpawnListBase
|
---@class SpawnListBase
|
||||||
---@field Name string
|
---@field Name string
|
||||||
@@ -155,7 +179,7 @@ monster = function(npcId, objective)
|
|||||||
-- replace retail positions (e.g. format migration gaps, timing issues).
|
-- replace retail positions (e.g. format migration gaps, timing issues).
|
||||||
if Questie.IsAscension and Questie.dbLearner and Questie.dbLearner.global then
|
if Questie.IsAscension and Questie.dbLearner and Questie.dbLearner.global then
|
||||||
local ld = Questie.dbLearner.global
|
local ld = Questie.dbLearner.global
|
||||||
if ld.settings and ld.settings.prioritizeMyData then
|
if ld.settings and ld.settings.enabled and ld.settings.prioritizeMyData then
|
||||||
local learnedNpc = ld.npcs and ld.npcs[npcId]
|
local learnedNpc = ld.npcs and ld.npcs[npcId]
|
||||||
if learnedNpc then
|
if learnedNpc then
|
||||||
local learnedSpawns = learnedNpc[7]
|
local learnedSpawns = learnedNpc[7]
|
||||||
@@ -168,28 +192,9 @@ monster = function(npcId, objective)
|
|||||||
and QuestieDB.ascensionOverrideKeys["NPC"]
|
and QuestieDB.ascensionOverrideKeys["NPC"]
|
||||||
and QuestieDB.ascensionOverrideKeys["NPC"][npcId]
|
and QuestieDB.ascensionOverrideKeys["NPC"][npcId]
|
||||||
and QuestieDB.ascensionOverrideKeys["NPC"][npcId][7]
|
and QuestieDB.ascensionOverrideKeys["NPC"][npcId][7]
|
||||||
if npcId == 15274 then
|
local hasReliableLearnedSpawns = _CountUniqueSpawnPositions(learnedSpawns) > 1
|
||||||
-- Count spawn entries per zone key
|
|
||||||
local spawnZones = ""
|
|
||||||
if type(spawns) == "table" then
|
|
||||||
for zk, coords in pairs(spawns) do
|
|
||||||
spawnZones = spawnZones .. "z" .. tostring(zk) .. "=" .. tostring(type(coords) == "table" and #coords or "?") .. " "
|
|
||||||
end
|
|
||||||
end
|
|
||||||
local learnedZones = ""
|
|
||||||
if type(learnedSpawns) == "table" then
|
|
||||||
for zk, coords in pairs(learnedSpawns) do
|
|
||||||
learnedZones = learnedZones .. "z" .. tostring(zk) .. "=" .. tostring(type(coords) == "table" and #coords or "?") .. " "
|
|
||||||
end
|
|
||||||
end
|
|
||||||
print(string.format("[QD] NPC 15274: dbSpawns={%s} learnedSpawns={%s} mc=%s threshold=%s ascProtected=%s -> uselearner=%s",
|
|
||||||
spawnZones, learnedZones,
|
|
||||||
tostring(learnedNpc.mc), tostring(threshold),
|
|
||||||
tostring(ascProtected),
|
|
||||||
tostring(learnedSpawns and next(learnedSpawns) and learnedNpc.mc and learnedNpc.mc >= threshold and not ascProtected)))
|
|
||||||
end
|
|
||||||
if learnedSpawns and next(learnedSpawns) and learnedNpc.mc and learnedNpc.mc >= threshold
|
if learnedSpawns and next(learnedSpawns) and learnedNpc.mc and learnedNpc.mc >= threshold
|
||||||
and not ascProtected then
|
and hasReliableLearnedSpawns and not ascProtected then
|
||||||
Questie:Debug(Questie.DEBUG_DEVELOP, "[monster] Preferring learned spawns for NPC:", npcId, "(mc=" .. tostring(learnedNpc.mc) .. ")")
|
Questie:Debug(Questie.DEBUG_DEVELOP, "[monster] Preferring learned spawns for NPC:", npcId, "(mc=" .. tostring(learnedNpc.mc) .. ")")
|
||||||
spawns = learnedSpawns
|
spawns = learnedSpawns
|
||||||
isLearned = true
|
isLearned = true
|
||||||
|
|||||||
Reference in New Issue
Block a user