v9.8.9: Badlands Trophy quest, 7:XT NPC data, fix AreaId CRITICAL spam

This commit is contained in:
Xurkon
2026-03-02 21:11:30 -06:00
parent 50101a8e8e
commit b13833935a
20 changed files with 4112 additions and 3155 deletions
+45 -41
View File
@@ -89,13 +89,10 @@ function QuestEventHandler:RegisterEvents()
end
for questLogIndex = 1, 75 do
local title, _, _, isHeader, _, _, _, questId = GetQuestLogTitle(questLogIndex)
local title, level, questTag, isHeader, isCollapsed, isComplete, isDaily, questId = GetQuestLogTitle(
questLogIndex)
if (not title) then
break
end
if (not isHeader) then
if title and questId and (not isHeader) then
quest = QuestieDB.GetQuest(questId)
if quest then
@@ -107,7 +104,8 @@ function QuestEventHandler:RegisterEvents()
sourceItemId = quest.sourceItemId
if sourceItemId then
soureItemName, _, _, _, _, sourceItemType, _, _, _, _, _, soureClassID = GetItemInfo(sourceItemId)
soureItemName, _, _, _, _, sourceItemType, _, _, _, _, _, soureClassID = GetItemInfo(
sourceItemId)
end
end
@@ -115,7 +113,8 @@ function QuestEventHandler:RegisterEvents()
reqSourceItemId = quest.requiredSourceItems[1]
if reqSourceItemId then
reqSoureItemName, _, _, _, _, reqSourceItemType, _, _, _, _, _, reqSoureClassID = GetItemInfo(reqSourceItemId)
reqSoureItemName, _, _, _, _, reqSourceItemType, _, _, _, _, _, reqSoureClassID =
GetItemInfo(reqSourceItemId)
end
end
@@ -154,14 +153,16 @@ function QuestEventHandler:RegisterEvents()
end
if frame ~= nil and text ~= nil then
local updateText = l10n("Quest Item %%s might be needed for the quest %%s. \n\nAre you sure you want to delete this?")
local updateText = l10n(
"Quest Item %%s might be needed for the quest %%s. \n\nAre you sure you want to delete this?")
text:SetFormattedText(updateText, text_arg1, questName)
text.text_arg1 = updateText
StaticPopup_Resize(frame, which)
deletedQuestItem = true
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieQuest] StaticPopup_Show: Quest Item Detected. Updating Static Popup.")
Questie:Debug(Questie.DEBUG_DEVELOP,
"[QuestieQuest] StaticPopup_Show: Quest Item Detected. Updating Static Popup.")
end
end
end
@@ -170,12 +171,13 @@ function QuestEventHandler:RegisterEvents()
hooksecurefunc("DeleteCursorItem", function()
-- Hook DeleteCursorItem so we know when the player clicks the Accept button
if deletedQuestItem then
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieQuest] DeleteCursorItem: Quest Item deleted. Update all quests.")
Questie:Debug(Questie.DEBUG_DEVELOP,
"[QuestieQuest] DeleteCursorItem: Quest Item deleted. Update all quests.")
C_Timer.After(0.25, function()
_QuestEventHandler:UpdateAllQuests()
deletedQuestItem = false
end)
_QuestEventHandler:UpdateAllQuests()
deletedQuestItem = false
end)
end
end)
@@ -187,9 +189,9 @@ function _QuestEventHandler:InitQuestLog()
-- Fill the QuestLogCache for first time
local cacheMiss, changes = QuestLogCache.CheckForChanges(nil)
-- if cacheMiss then
-- TODO actually can happen in rare edge case if player accepts new quest during questie init. *cough*
-- or if someone managed to overflow game cache already at this point.
--Questie:Error("Did you accept a quest during InitQuestLog? Please report on Github or Discord. Game's quest log cache is not ok. This shouldn't happen. Questie may malfunction.")
-- TODO actually can happen in rare edge case if player accepts new quest during questie init. *cough*
-- or if someone managed to overflow game cache already at this point.
--Questie:Error("Did you accept a quest during InitQuestLog? Please report on Github or Discord. Game's quest log cache is not ok. This shouldn't happen. Questie may malfunction.")
-- end
for questId, _ in pairs(changes) do
@@ -231,7 +233,7 @@ function _QuestEventHandler:QuestAccepted(questLogIndex, questId)
QuestieCombatQueue:Queue(function()
QuestieLib:CacheItemNames(questId)
_QuestEventHandler:HandleQuestAccepted(questId)
QuestieTracker:Update()
QuestieTracker:Update()
end)
Questie:Debug(Questie.DEBUG_DEVELOP, "[Quest Event] QUEST_ACCEPTED - skipNextUQLCEvent - ", skipNextUQLCEvent)
@@ -240,13 +242,13 @@ end
---@param questId number
---@return boolean true @if the function was successful, false otherwise
function _QuestEventHandler:HandleQuestAccepted(questId)
local idx = QuestieCompat.GetQuestLogIndexByID(questId)
if not idx then
_QuestLogUpdateQueue:Insert(function()
return _QuestEventHandler:HandleQuestAccepted(questId)
end)
return false
end
local idx = QuestieCompat.GetQuestLogIndexByID(questId)
if not idx then
_QuestLogUpdateQueue:Insert(function()
return _QuestEventHandler:HandleQuestAccepted(questId)
end)
return false
end
-- We first check the quest objectives and retry in the next QLU event if they are not correct yet
local cacheMiss, changes = QuestLogCache.CheckForChanges({ [questId] = true })
if cacheMiss then
@@ -272,9 +274,9 @@ function _QuestEventHandler:HandleQuestAccepted(questId)
else
QuestieQuest:AcceptQuest(questId)
end
QuestieCompat.C_Timer.After(0.2, function()
QuestieTracker:Update()
end)
QuestieCompat.C_Timer.After(0.2, function()
QuestieTracker:Update()
end)
return true
end
@@ -301,7 +303,7 @@ function _QuestEventHandler:QuestTurnedIn(questId, xpReward, moneyReward)
-- is empty
questLog[questId].state = QUEST_LOG_STATES.QUEST_TURNED_IN
elseif QuestieCompat.Is335 then
questLog[questId] = {state = QUEST_LOG_STATES.QUEST_TURNED_IN}
questLog[questId] = { state = QUEST_LOG_STATES.QUEST_TURNED_IN }
end
local parentQuest = QuestieDB.QueryQuestSingle(questId, "parentQuest")
@@ -316,7 +318,8 @@ function _QuestEventHandler:QuestTurnedIn(questId, xpReward, moneyReward)
local itemName, _, _, quality, _, itemID = GetQuestLogRewardInfo(GetNumQuestLogRewards(questId), questId)
if (itemID ~= nil or itemName ~= nil) and quality == 1 then
Questie:Debug(Questie.DEBUG_DEVELOP, "Quest:", questId, "Recieved a possible Quest Item - do a full Quest Log check")
Questie:Debug(Questie.DEBUG_DEVELOP, "Quest:", questId,
"Recieved a possible Quest Item - do a full Quest Log check")
doFullQuestLogScan = true
skipNextUQLCEvent = false
else
@@ -331,11 +334,11 @@ function _QuestEventHandler:QuestTurnedIn(questId, xpReward, moneyReward)
-- QuestieQuest:CompleteQuest(questId)
-- QuestieJourney:CompleteQuest(questId)
-- QuestieAnnounce:CompletedQuest(questId)
-- questLog[questId] = nil
-- questLog[questId] = nil
QuestieCombatQueue:Queue(function()
QuestieTracker:Update()
end)
QuestieCombatQueue:Queue(function()
QuestieTracker:Update()
end)
end
--- Fires when a quest is removed from the quest log. This includes turning it in and abandoning it.
@@ -386,7 +389,8 @@ function _QuestEventHandler:MarkQuestAsAbandoned(questId)
-- so we don't attempt to index a nil value.
if (not questEntry) then
Questie:Debug(Questie.DEBUG_DEVELOP, "QuestEventHandler:MarkQuestAsAbandoned - questLog entry missing for", questId)
Questie:Debug(Questie.DEBUG_DEVELOP, "QuestEventHandler:MarkQuestAsAbandoned - questLog entry missing for",
questId)
return
end
@@ -406,8 +410,8 @@ function _QuestEventHandler:MarkQuestAsAbandoned(questId)
if (not objectivesWereComplete) and desc and type(desc) == "string" then
if string.find(desc, "automatically rewarded") then
Questie:Debug(Questie.DEBUG_INFO, "Quest:", questId, "detected as auto-complete by description")
objectivesWereComplete = true
Questie:Debug(Questie.DEBUG_INFO, "Quest:", questId, "detected as auto-complete by description")
objectivesWereComplete = true
end
end
end
@@ -415,7 +419,8 @@ function _QuestEventHandler:MarkQuestAsAbandoned(questId)
if objectivesWereComplete then
-- Objectives were complete, so this was likely an auto-complete quest.
-- Mark as complete instead of abandoned so objective pins get hidden.
Questie:Debug(Questie.DEBUG_INFO, "Quest:", questId, "objectives were complete - treating as completed (auto-complete quest)")
Questie:Debug(Questie.DEBUG_INFO, "Quest:", questId,
"objectives were complete - treating as completed (auto-complete quest)")
questEntry.state = QUEST_LOG_STATES.QUEST_TURNED_IN
QuestLogCache.RemoveQuest(questId)
@@ -502,14 +507,13 @@ function _QuestEventHandler:UnitQuestLogChanged(unitTarget)
skipNextUQLCEvent = false
end
-- Fallback cleanup: some servers remove quests without firing QUEST_REMOVED reliably.
-- This compares Questie's currentQuestlog vs the game's quest log and removes stale quests.
function _QuestEventHandler:CleanupRemovedQuestsFallback()
local gameQuestIds = {}
local numEntries = select(1, GetNumQuestLogEntries()) or 0
for questLogIndex = 1, numEntries do
local title, _, _, isHeader, _, _, _, qid = GetQuestLogTitle(questLogIndex)
local title, level, questTag, isHeader, isCollapsed, isComplete, isDaily, qid = GetQuestLogTitle(questLogIndex)
if title and qid and qid > 0 and (not isHeader) then
gameQuestIds[qid] = true
end
@@ -651,7 +655,7 @@ function _QuestEventHandler:ZoneChangedNewArea()
end
end)
-- We only want this to fire outside of an instance if the player isn't dead and we need to reset the Tracker
-- We only want this to fire outside of an instance if the player isn't dead and we need to reset the Tracker
elseif (not Questie.db.char.isTrackerExpanded and not UnitIsGhost("player")) and trackerMinimizedByDungeon == true then
C_Timer.After(8, function()
Questie:Debug(Questie.DEBUG_DEVELOP, "[EVENT] ZONE_CHANGED_NEW_AREA: Exiting Instance")
+37 -35
View File
@@ -10,7 +10,7 @@ local Sounds = QuestieLoader:ImportModule("Sounds")
--- COMPATIBILITY ---
local GetQuestLogTitle = QuestieCompat.GetQuestLogTitle
local C_QuestLog_GetQuestObjectives = QuestieCompat.C_QuestLog.GetQuestObjectives
local C_QuestLog_GetQuestObjectives = QuestieCompat.C_QuestLog.GetQuestObjectives
local HaveQuestData = QuestieCompat.HaveQuestData
local stringByte = string.byte
@@ -53,7 +53,7 @@ local cache = {
},
[questId2] = ....,
}
]]--
]] --
---@class QuestLogCacheObjectiveData
@@ -85,10 +85,10 @@ QuestLogCache.questLog_DO_NOT_MODIFY = cache
---@return table? newObjectives, ObjectiveIndex[] changedObjIds @nil == cache miss in both addon and game caches. table {} == no objectives.
local function GetNewObjectives(questId, oldObjectives, questLogIndex)
local newObjectives = {} -- creating a fresh one to be able revert to old easily in case of missing data
local changedObjIds -- not assigning {} for easier nil when nothing changed
local changedObjIds -- not assigning {} for easier nil when nothing changed
local objectives = C_QuestLog_GetQuestObjectives(questId, questLogIndex)
for objIndex=1, #objectives do -- iterate manually to be sure getting those in order
for objIndex = 1, #objectives do -- iterate manually to be sure getting those in order
local oldObj = oldObjectives[objIndex]
local newObj = objectives[objIndex]
-- Check if objective.text is in game's cache
@@ -102,7 +102,7 @@ local function GetNewObjectives(questId, oldObjectives, questLogIndex)
if (not changedObjIds) then
changedObjIds = { objIndex }
else
changedObjIds[#changedObjIds+1] = objIndex
changedObjIds[#changedObjIds + 1] = objIndex
end
if oldObj and newObj and oldObj.numRequired ~= oldObj.numFulfilled and newObj.numRequired == newObj.numFulfilled then
@@ -120,18 +120,22 @@ local function GetNewObjectives(questId, oldObjectives, questLogIndex)
type = newObj.type,
numRequired = newObj.numRequired,
text = QuestieLib.TrimObjectiveText(newObj.text, newObj.type),
finished = newObj.finished, -- gets overwritten with correct value later if quest isComplete
finished = newObj.finished, -- gets overwritten with correct value later if quest isComplete
numFulfilled = newObj.numFulfilled, -- gets overwritten with correct value later if quest isComplete
}
end
else -- objective text not in game's cache
if oldObj then
Questie:Debug(Questie.DEBUG_INFO, "[GetNewObjectives] objective not in game's cache. Using addon's cache. questID, objIndex:", questId, objIndex)
Questie:Debug(Questie.DEBUG_INFO,
"[GetNewObjectives] objective not in game's cache. Using addon's cache. questID, objIndex:", questId,
objIndex)
-- Extremely unlikely that the objective has changed from cached version as a change SHOULD trigger fetching data into game cache.
-- Possible bug point if there comes desync issues.
newObjectives[objIndex] = oldObj
else
Questie:Debug(Questie.DEBUG_INFO, "[GetNewObjectives] \"WARNING\" objective not in game's cache nor addon's cache. questID, objIndex:", questId, objIndex)
Questie:Debug(Questie.DEBUG_INFO,
"[GetNewObjectives] \"WARNING\" objective not in game's cache nor addon's cache. questID, objIndex:",
questId, objIndex)
-- Objective has been never cached
-- Tell to function caller that we couldn't get all required data from game's cache
-- Don't loop rest of objectives as we won't anyway save those into cache[] and C_QuestLog.GetQuestObjectives() call already triggered game to initiate caching those into game's cache.
@@ -158,7 +162,8 @@ function QuestLogCache.CheckForChanges(questIdsToCheck)
local numEntries = select(1, GetNumQuestLogEntries()) or 0
for questLogIndex = 1, numEntries do
local title, _, questTag, isHeader, _, isComplete, _, questId = GetQuestLogTitle(questLogIndex)
local title, level, questTag, isHeader, isCollapsed, isComplete, isDaily, questId = GetQuestLogTitle(
questLogIndex)
-- Skip weird/header entries / questId=0 (these happen a lot on your server)
if title and questId and questId > 0 and (not isHeader) then
@@ -173,8 +178,7 @@ function QuestLogCache.CheckForChanges(questIdsToCheck)
if newObjectives then
if (not cachedQuest) or (#cachedObjectives == #newObjectives and #cachedObjectives > 0 and
(cachedQuest.title ~= title or cachedQuest.questTag ~= questTag or cachedQuest.isComplete ~= isComplete)) then
(cachedQuest.title ~= title or cachedQuest.questTag ~= questTag or cachedQuest.isComplete ~= isComplete)) then
changedObjIds = {}
for i = 1, #newObjectives do
changedObjIds[i] = i
@@ -206,7 +210,9 @@ function QuestLogCache.CheckForChanges(questIdsToCheck)
cacheMiss = true
end
else
Questie:Debug(Questie.DEBUG_CRITICAL, "[QuestLogCache.CheckForChanges] HaveQuestData() == false. questId, index:", questId, questLogIndex)
Questie:Debug(Questie.DEBUG_CRITICAL,
"[QuestLogCache.CheckForChanges] HaveQuestData() == false. questId, index:", questId,
questLogIndex)
C_QuestLog_GetQuestObjectives(questId, questLogIndex)
cacheMiss = true
end
@@ -226,29 +232,24 @@ function QuestLogCache.CheckForChanges(questIdsToCheck)
return cacheMiss, changes
end
function QuestLogCache.RemoveQuest(questId)
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestLogCache.RemoveQuest] remove questId:", questId)
cache[questId] = nil
end
--- Tests if game client's cache has all quest log quests and objectives cached.
--- Avoid using this function if possible.
---@return boolean gameCacheOK
function QuestLogCache.TestGameCache()
local gameCacheOK = true
for questLogIndex = 1, MAX_QUEST_LOG_INDEX do
local title, _, _, isHeader, _, _, _, questId = GetQuestLogTitle(questLogIndex)
if (not title) then
break -- We exceeded the valid quest log entries
end
if (not isHeader) then
local title, level, questTag, isHeader, isCollapsed, isComplete, isDaily, questId = GetQuestLogTitle(
questLogIndex)
if title and questId and (not isHeader) then
if HaveQuestData(questId) then
local objectives = C_QuestLog_GetQuestObjectives(questId, questLogIndex)
for objIndex=1, #objectives do
for objIndex = 1, #objectives do
local text = objectives[objIndex].text
-- Check if objective.text is not in game's cache
if (not text) or (stringByte(text, 1) == 32) then
@@ -261,11 +262,11 @@ function QuestLogCache.TestGameCache()
end
end
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestLogCache.TestGameCache]", (gameCacheOK and "Cache ok." or "Cache missing data."))
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestLogCache.TestGameCache]",
(gameCacheOK and "Cache ok." or "Cache missing data."))
return gameCacheOK
end
--- A wrapper function to add error check instead using exposed table directly.
---@param questId QuestId
---@return QuestLogCacheData? @NEVER EVER MODIFY THE RETURNED TABLE
@@ -292,23 +293,21 @@ function QuestLogCache.GetQuestObjectives(questId)
return cache[questId].objectives
end
---@param q table @quest
---@param i number @index of the objective
---@param o table @objective
local function DebugPrintObjective(q, i, o)
if (o.raw_numFulfilled == o.numFulfilled) and (o.raw_finished == o.finished) then
print(" ", i.."/"..#q.objectives..":",
o.numFulfilled.."/"..o.numRequired.."="..tostring(o.finished),
print(" ", i .. "/" .. #q.objectives .. ":",
o.numFulfilled .. "/" .. o.numRequired .. "=" .. tostring(o.finished),
o.type,
"\""..o.raw_text.."\" \""..o.text.."\"")
"\"" .. o.raw_text .. "\" \"" .. o.text .. "\"")
else
print(" ", i.."/"..#q.objectives..":",
o.raw_numFulfilled.."/"..o.numRequired.."="..tostring(o.raw_finished),
"FIX:", o.numFulfilled.."/"..o.numRequired.."="..tostring(o.finished),
print(" ", i .. "/" .. #q.objectives .. ":",
o.raw_numFulfilled .. "/" .. o.numRequired .. "=" .. tostring(o.raw_finished),
"FIX:", o.numFulfilled .. "/" .. o.numRequired .. "=" .. tostring(o.finished),
o.type,
"\""..o.raw_text.."\" \""..o.text.."\"")
"\"" .. o.raw_text .. "\" \"" .. o.text .. "\"")
end
end
@@ -318,7 +317,8 @@ function QuestLogCache.DebugPrintCache()
local count = 0
for questId, q in pairs(cache) do
count = count + 1
print("Quest: ("..questId..") \""..q.title.."\" questTag="..tostring(q.questTag) ,"isComplete="..tostring(q.isComplete))
print("Quest: (" .. questId .. ") \"" .. q.title .. "\" questTag=" .. tostring(q.questTag),
"isComplete=" .. tostring(q.isComplete))
if not next(q.objectives) then
print(" no objectives")
else
@@ -332,12 +332,14 @@ end
--- Debug function, prints changes
function QuestLogCache.DebugPrintCacheChanges(cacheMiss, changes)
local highlight = ((not cacheMiss) and (not next(changes))) or (cacheMiss and next(changes)) -- highlight untypical cases. they are okey, but sometimes interesting.
local highlight = ((not cacheMiss) and (not next(changes))) or
(cacheMiss and next(changes)) -- highlight untypical cases. they are okey, but sometimes interesting.
print("DebugPrintCacheChanges", GetTime(), (highlight and "\124cffFF4444CacheMiss:\124r" or "CacheMiss"), cacheMiss)
for questId, objIndexes in pairs(changes) do
local q = cache[questId]
print("Quest: ("..questId..") \""..q.title.."\" questTag="..tostring(q.questTag) ,"isComplete="..tostring(q.isComplete))
print("Quest: (" .. questId .. ") \"" .. q.title .. "\" questTag=" .. tostring(q.questTag),
"isComplete=" .. tostring(q.isComplete))
if not next(objIndexes) then
print(" no objectives changed (or quest doesn't have objectives)")
else
+132 -73
View File
@@ -17,7 +17,7 @@ local QuestieCorrections = QuestieLoader:ImportModule("QuestieCorrections")
local l10n = QuestieLoader:ImportModule("l10n")
local DebugInformation = {} -- stores text of debug data dump per session
local debugIndex = 0 -- current debug index, used so we can still retrieve info from previous offers
local debugIndex = 0 -- current debug index, used so we can still retrieve info from previous offers
local openDebugWindows = {} -- determines if existing debug window is already open, prevents duplicates
local GetBestMapForUnit = C_Map.GetBestMapForUnit
@@ -249,15 +249,15 @@ local itemWhitelist = {
}
local itemTripCodes = {
['ItemWhitelisted'] = 0, -- itemID is whitelisted; we want all its data anyway
['ItemMissingFromDB'] = 1, -- error when itemID is missing from DB entirely
['StartQuestIDMismatch'] = 2, -- error when item quest start ID does not match Questie ItemDB
['MissingDropFromNPC'] = 3, -- error when item dropped from npc (corpses) not matching ItemDB
['MissingDropFromObject'] = 4, -- error when item dropped from object (chests in world) not matching ItemDB
['MissingDropFromItem'] = 5, -- error when item dropped from item (lockboxes in inventory) not matching ItemDB
['ContainerMissingFromNPCDB'] = 6, -- error when item's container is missing from NpcDB
['ItemWhitelisted'] = 0, -- itemID is whitelisted; we want all its data anyway
['ItemMissingFromDB'] = 1, -- error when itemID is missing from DB entirely
['StartQuestIDMismatch'] = 2, -- error when item quest start ID does not match Questie ItemDB
['MissingDropFromNPC'] = 3, -- error when item dropped from npc (corpses) not matching ItemDB
['MissingDropFromObject'] = 4, -- error when item dropped from object (chests in world) not matching ItemDB
['MissingDropFromItem'] = 5, -- error when item dropped from item (lockboxes in inventory) not matching ItemDB
['ContainerMissingFromNPCDB'] = 6, -- error when item's container is missing from NpcDB
['ContainerMissingFromObjectDB'] = 7, -- error when item's container is missing from ObjectDB
['ContainerMissingFromItemDB'] = 8, -- error when item's container is missing from ItemDB
['ContainerMissingFromItemDB'] = 8, -- error when item's container is missing from ItemDB
}
-- determines whether to offer a debug offer for a looted item
@@ -274,16 +274,20 @@ local function filterItem(itemID, itemInfo, containerGUID)
-- OG chronoboon displacer was 184937 so safe to say any SoD items are higher than 190000
return nil
else
if tContains(itemWhitelist, itemID) then -- if item is in our whitelist, we want it no matter what
if tContains(itemWhitelist, itemID) then -- if item is in our whitelist, we want it no matter what
return itemTripCodes.ItemWhitelisted
elseif tContains(itemBlacklist, itemID) then -- if item is in our blacklist, ignore it
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieDebugOffer] - ItemFilter - Item " .. itemID .. " is in debug offer item blacklist, ignoring")
Questie:Debug(Questie.DEBUG_DEVELOP,
"[QuestieDebugOffer] - ItemFilter - Item " .. itemID .. " is in debug offer item blacklist, ignoring")
return nil
elseif UnitLevel(player) < minLevelForDebugOffers then -- if player level is below our threshold, ignore it
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieDebugOffer] - ItemFilter - Player does not meet level threshold for debug offers, ignoring")
Questie:Debug(Questie.DEBUG_DEVELOP,
"[QuestieDebugOffer] - ItemFilter - Player does not meet level threshold for debug offers, ignoring")
return nil
elseif QuestieCorrections.questItemBlacklist[itemID] then
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieDebugOffer] - ItemFilter - Item " .. itemID .. " is in QuestieCorrections item blacklist, ignoring")
Questie:Debug(Questie.DEBUG_DEVELOP,
"[QuestieDebugOffer] - ItemFilter - Item " ..
itemID .. " is in QuestieCorrections item blacklist, ignoring")
return nil
end
@@ -312,7 +316,8 @@ local function filterItem(itemID, itemInfo, containerGUID)
if questID ~= QuestieDB.QueryItemSingle(itemID, "startQuest") then
return itemTripCodes.StartQuestIDMismatch
else
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieDebugOffer] - ItemFilter - QuestID for " .. itemID .. " present but matches DB, ignoring")
Questie:Debug(Questie.DEBUG_DEVELOP,
"[QuestieDebugOffer] - ItemFilter - QuestID for " .. itemID .. " present but matches DB, ignoring")
end
else
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieDebugOffer] - ItemFilter - QuestID value not present, ignoring")
@@ -330,7 +335,8 @@ local function filterItem(itemID, itemInfo, containerGUID)
if not lootTable or tContains(lootTable, containerID) == false then
return itemTripCodes.MissingDropFromNPC
else
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieDebugOffer] - ItemFilter - NPC drop data for item " .. itemID .. " OK, ignoring")
Questie:Debug(Questie.DEBUG_DEVELOP,
"[QuestieDebugOffer] - ItemFilter - NPC drop data for item " .. itemID .. " OK, ignoring")
end
elseif containerType == "GameObject" then -- if container is an object
-- first check if object is even in our DB
@@ -344,7 +350,8 @@ local function filterItem(itemID, itemInfo, containerGUID)
if tContains(lootTable, containerID) == false then
return itemTripCodes.MissingDropFromObject
else
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieDebugOffer] - ItemFilter - Object drop data for item " .. itemID .. " OK, ignoring")
Questie:Debug(Questie.DEBUG_DEVELOP,
"[QuestieDebugOffer] - ItemFilter - Object drop data for item " .. itemID .. " OK, ignoring")
end
end
elseif containerType == "Item" and containerID > 0 then -- if container is an item and there is an containerID for it
@@ -360,12 +367,14 @@ local function filterItem(itemID, itemInfo, containerGUID)
if tContains(lootTable, containerID) == false then
return itemTripCodes.MissingDropFromItem
else
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieDebugOffer] - ItemFilter - ItemSource drop data for item " .. itemID .. " OK, ignoring")
Questie:Debug(Questie.DEBUG_DEVELOP,
"[QuestieDebugOffer] - ItemFilter - ItemSource drop data for item " .. itemID .. " OK, ignoring")
end
end
end
end
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieDebugOffer] - ItemFilter - No data mismatches found for " .. itemID .. ", ignoring")
Questie:Debug(Questie.DEBUG_DEVELOP,
"[QuestieDebugOffer] - ItemFilter - No data mismatches found for " .. itemID .. ", ignoring")
return nil -- if no exceptions raised, we don't need to create a debug offer
end
@@ -378,13 +387,14 @@ local npcBlacklist = {
local function _AppendUniversalText(input)
local text = tostring(input)
text = text .. "\n|cFFAAAAAACharacter:|r Lvl " .. UnitLevel(player) .. " " .. string.upper(playerRace) .. " " .. playerClass
text = text ..
"\n|cFFAAAAAACharacter:|r Lvl " .. UnitLevel(player) .. " " .. string.upper(playerRace) .. " " .. playerClass
local mapID = GetBestMapForUnit(player)
local pos = GetPlayerMapPosition(mapID, player);
PosX = pos.x * 100
PosY = pos.y * 100
text = text .. "\n|cFFAAAAAAPlayer Coords:|r [" .. mapID .. "] " .. format("(%.3f, %.3f)", PosX, PosY)
PosX = pos and (pos.x * 100) or 0
PosY = pos and (pos.y * 100) or 0
text = text .. "\n|cFFAAAAAAPlayer Coords:|r [" .. tostring(mapID) .. "] " .. format("(%.3f, %.3f)", PosX, PosY)
local questLog = ""
for k in pairs(QuestLogCache.questLog_DO_NOT_MODIFY) do questLog = k .. ", " .. questLog end
@@ -403,11 +413,12 @@ function QuestieDebugOffer.LootWindow()
local debugContainer, _ = GetLootSourceInfo(1) -- happens early in case the rest of the code is so slow that the container closes before we're ready
local inInstance, _ = IsInInstance()
if inInstance == true then
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieDebugOffer] - ItemLoot - Player looting item is in instance, ignoring")
Questie:Debug(Questie.DEBUG_DEVELOP,
"[QuestieDebugOffer] - ItemLoot - Player looting item is in instance, ignoring")
return -- temporary for SoD to reduce new raid loot triggering debug spam
end
for i=1, #lootInfo do
for i = 1, #lootInfo do
local itemInfo = lootInfo[i]
local itemLink = GetLootSlotLink(i)
local itemID = 0
@@ -420,7 +431,8 @@ function QuestieDebugOffer.LootWindow()
local tripCode = filterItem(itemID, itemInfo, debugContainer)
if tripCode then
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieDebugOffer] - ItemLoot - Creating debug offer for item " .. itemID .. " reason " .. tripCode)
Questie:Debug(Questie.DEBUG_DEVELOP,
"[QuestieDebugOffer] - ItemLoot - Creating debug offer for item " .. itemID .. " reason " .. tripCode)
debugIndex = debugIndex + 1
if tripCode == itemTripCodes.ItemWhitelisted then
DebugInformation[debugIndex] = "ItemDB is missing some data about this item!"
@@ -443,13 +455,20 @@ function QuestieDebugOffer.LootWindow()
else
DebugInformation[debugIndex] = "General data mismatch for item!"
end
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n\n|cFFAAAAAAItem ID:|r " .. tostring(itemID)
DebugInformation[debugIndex] = DebugInformation[debugIndex] ..
"\n\n|cFFAAAAAAItem ID:|r " .. tostring(itemID)
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n|cFFAAAAAAItem Name:|r " .. itemLink
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n|cFFAAAAAAQuest Item:|r " .. tostring(itemInfo.isQuestItem)
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n|cFFAAAAAAQuest ID:|r " .. tostring(itemInfo.questId)
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n|cFFAAAAAAContainer:|r " .. tostring(debugContainer)
DebugInformation[debugIndex] = DebugInformation[debugIndex] ..
"\n|cFFAAAAAAQuest Item:|r " .. tostring(itemInfo.isQuestItem)
DebugInformation[debugIndex] = DebugInformation[debugIndex] ..
"\n|cFFAAAAAAQuest ID:|r " .. tostring(itemInfo.questId)
DebugInformation[debugIndex] = DebugInformation[debugIndex] ..
"\n|cFFAAAAAAContainer:|r " .. tostring(debugContainer)
DebugInformation[debugIndex] = _AppendUniversalText(DebugInformation[debugIndex])
Questie:Print(l10n("An item you just encountered has data missing from the Questie database.") .. " " .. l10n("Would you like to help us fix it?") .. " |cff71d5ff|Haddon:questie:offer:" .. debugIndex .. "|h[" .. l10n("More Info") .. "]|h|r")
Questie:Print(l10n("An item you just encountered has data missing from the Questie database.") ..
" " ..
l10n("Would you like to help us fix it?") ..
" |cff71d5ff|Haddon:questie:offer:" .. debugIndex .. "|h[" .. l10n("More Info") .. "]|h|r")
return -- we only want to show one debug offer per interaction, so break on the first one
end
end
@@ -460,10 +479,11 @@ function QuestieDebugOffer.QuestDialog()
local questID = GetQuestID() -- obtain quest ID from dialog
if questID <= 0 or questID == nil then
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieDebugOffer] - QuestDialog - Invalid quest ID from API, ignoring")
return -- invalid data from API, abandon offer attempt
return -- invalid data from API, abandon offer attempt
end
if UnitLevel(player) < minLevelForDebugOffers then -- if player level is below our threshold, ignore it
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieDebugOffer] - QuestDialog - Player does not meet level threshold for debug offers, ignoring")
Questie:Debug(Questie.DEBUG_DEVELOP,
"[QuestieDebugOffer] - QuestDialog - Player does not meet level threshold for debug offers, ignoring")
return
end
if QuestieDB.QueryQuestSingle(questID, "name") == nil then -- if ID not in our DB
@@ -474,77 +494,100 @@ function QuestieDebugOffer.QuestDialog()
local rewardText = GetRewardText()
local rewardXP = GetRewardXP()
if questText then questText = questText:gsub(GetUnitName(player), "<playername>") end -- strip out player name from quest text
if questText then questText = questText:gsub(GetUnitName(player), "<playername>") end -- strip out player name from quest text
if objectiveText then objectiveText = objectiveText:gsub(GetUnitName(player), "<playername>") end -- strip out player name from objective text
if rewardText then rewardText = rewardText:gsub(GetUnitName(player), "<playername>") end -- strip out player name from reward text
if rewardText then rewardText = rewardText:gsub(GetUnitName(player), "<playername>") end -- strip out player name from reward text
DebugInformation[debugIndex] = "Quest in dialog not present in QuestDB!"
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n\n|cFFAAAAAAQuest ID:|r " .. tostring(questID)
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n|cFFAAAAAAQuest Name:|r " .. tostring(questTitle)
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n|cFFAAAAAAQuest Text:|r " .. tostring(questText)
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n|cFFAAAAAAObjective Text:|r " .. tostring(objectiveText)
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n|cFFAAAAAAReward Text:|r " .. tostring(rewardText)
DebugInformation[debugIndex] = DebugInformation[debugIndex] ..
"\n|cFFAAAAAAQuest Name:|r " .. tostring(questTitle)
DebugInformation[debugIndex] = DebugInformation[debugIndex] ..
"\n|cFFAAAAAAQuest Text:|r " .. tostring(questText)
DebugInformation[debugIndex] = DebugInformation[debugIndex] ..
"\n|cFFAAAAAAObjective Text:|r " .. tostring(objectiveText)
DebugInformation[debugIndex] = DebugInformation[debugIndex] ..
"\n|cFFAAAAAAReward Text:|r " .. tostring(rewardText)
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n|cFFAAAAAAReward XP:|r " .. tostring(rewardXP)
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n|cFFAAAAAAQuestgiver:|r " .. tostring(UnitGUID(questnpc))
DebugInformation[debugIndex] = DebugInformation[debugIndex] ..
"\n|cFFAAAAAAQuestgiver:|r " .. tostring(UnitGUID(questnpc))
DebugInformation[debugIndex] = _AppendUniversalText(DebugInformation[debugIndex])
Questie:Print(l10n("A quest you just encountered is missing from the Questie database.") .. " " .. l10n("Would you like to help us fix it?") .. " |cff71d5ff|Haddon:questie:offer:" .. debugIndex .. "|h[" .. l10n("More Info") .. "]|h|r")
Questie:Print(l10n("A quest you just encountered is missing from the Questie database.") ..
" " ..
l10n("Would you like to help us fix it?") ..
" |cff71d5ff|Haddon:questie:offer:" .. debugIndex .. "|h[" .. l10n("More Info") .. "]|h|r")
end
end
-- Missing questID when tracking
---@param questID number
function QuestieDebugOffer.QuestTracking(questID) -- ID supplied by tracker during update
function QuestieDebugOffer.QuestTracking(questID) -- ID supplied by tracker during update
if UnitLevel(player) < minLevelForDebugOffers then -- if player level is below our threshold, ignore it
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieDebugOffer] - QuestTracking - Player does not meet level threshold for debug offers, ignoring")
Questie:Debug(Questie.DEBUG_DEVELOP,
"[QuestieDebugOffer] - QuestTracking - Player does not meet level threshold for debug offers, ignoring")
return
end
if QuestieDB.QueryQuestSingle(questID, "name") == nil then -- if ID not in our DB
for i=1, GetNumQuestLogEntries() do
local questTitle, questLevel, suggestedGroup, _, _, _, frequency, questLogId = GetQuestLogTitle(i)
for i = 1, GetNumQuestLogEntries() do
local questTitle, questLevel, questTag, suggestedGroup, isHeader, isCollapsed, isComplete, isDaily, questLogId =
GetQuestLogTitle(i)
local questText, objectiveText = GetQuestLogQuestText(i)
if questText then questText = questText:gsub(GetUnitName(player), "<playername>") end -- strip out player name from quest text
if questText then questText = questText:gsub(GetUnitName(player), "<playername>") end -- strip out player name from quest text
if objectiveText then objectiveText = objectiveText:gsub(GetUnitName(player), "<playername>") end -- strip out player name from objective text
if questID == questLogId then
debugIndex = debugIndex + 1
DebugInformation[debugIndex] = "Quest in tracker not present in QuestDB!"
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n\n|cFFAAAAAAQuest ID:|r " .. tostring(questLogId)
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n|cFFAAAAAAQuest Name:|r " .. tostring(questTitle)
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n|cFFAAAAAAQuest Text:|r " .. tostring(questText)
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n|cFFAAAAAAObjective Text:|r " .. tostring(objectiveText)
DebugInformation[debugIndex] = DebugInformation[debugIndex] ..
"\n\n|cFFAAAAAAQuest ID:|r " .. tostring(questLogId)
DebugInformation[debugIndex] = DebugInformation[debugIndex] ..
"\n|cFFAAAAAAQuest Name:|r " .. tostring(questTitle)
DebugInformation[debugIndex] = DebugInformation[debugIndex] ..
"\n|cFFAAAAAAQuest Text:|r " .. tostring(questText)
DebugInformation[debugIndex] = DebugInformation[debugIndex] ..
"\n|cFFAAAAAAObjective Text:|r " .. tostring(objectiveText)
DebugInformation[debugIndex] = _AppendUniversalText(DebugInformation[debugIndex])
Questie:Print(l10n("A quest in your quest log is missing from the Questie database and can't be tracked.") .. " " .. l10n("Would you like to help us fix it?") .. " |cff71d5ff|Haddon:questie:offer:" .. debugIndex .. "|h[" .. l10n("More Info") .. "]|h|r")
Questie:Print(l10n(
"A quest in your quest log is missing from the Questie database and can't be tracked.") ..
" " ..
l10n("Would you like to help us fix it?") ..
" |cff71d5ff|Haddon:questie:offer:" .. debugIndex .. "|h[" .. l10n("More Info") .. "]|h|r")
--print(tostring(QuestieDB.IsSoDRuneQuest(questlogid)))
end
end
end
end
local targetTimeout = {} -- store timeouts per-ID so we don't cause lag or spam chat if a player clicks on an unknown NPC often
local targetTimeout = {} -- store timeouts per-ID so we don't cause lag or spam chat if a player clicks on an unknown NPC often
local timeoutDurationOverworld = 120 -- how many seconds to ignore re-passes outside of instances
local timeoutDurationInstance = 600 -- how many seconds to ignore re-passes outside of instances
local timeoutDurationInstance = 600 -- how many seconds to ignore re-passes outside of instances
-- Missing NPC ID when targeting
function QuestieDebugOffer.NPCTarget()
if UnitLevel(player) < minLevelForDebugOffers then -- if player level is below our threshold, ignore it
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieDebugOffer] - NPCTarget - Player does not meet level threshold for debug offers, ignoring")
Questie:Debug(Questie.DEBUG_DEVELOP,
"[QuestieDebugOffer] - NPCTarget - Player does not meet level threshold for debug offers, ignoring")
return
end
local inInstance, _ = IsInInstance()
if inInstance == true then -- temporary override for SoD launch to not prompt NPC debug offers inside instances at all, to prevent BFD spam
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieDebugOffer] - NPCTarget - Player targeting NPC is in instance, ignoring")
Questie:Debug(Questie.DEBUG_DEVELOP,
"[QuestieDebugOffer] - NPCTarget - Player targeting NPC is in instance, ignoring")
return
end
local targetGUID = UnitGUID(target)
local unit_type = strsplit("-", tostring(targetGUID)) -- determine target type
if unit_type == "Creature" then -- if target is an NPC
local unit_type = strsplit("-", tostring(targetGUID)) -- determine target type
if unit_type == "Creature" then -- if target is an NPC
local npcID = tonumber(targetGUID:match("-(%d+)-%x+$"), 10) -- obtain NPC ID
if targetTimeout[npcID] == true then -- if target was already targeted recently
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieDebugOffer] - NPCTarget - Targeted NPC was targeted recently, ignoring")
if not npcID then return end
if targetTimeout[npcID] == true then -- if target was already targeted recently
Questie:Debug(Questie.DEBUG_DEVELOP,
"[QuestieDebugOffer] - NPCTarget - Targeted NPC was targeted recently, ignoring")
return
else -- if target was NOT targeted recently
else -- if target was NOT targeted recently
if tContains(npcBlacklist, npcID) then -- if NPC is in our blacklist, ignore it
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieDebugOffer] - NPCTarget - Targeted NPC is in NPC blacklist, ignoring")
Questie:Debug(Questie.DEBUG_DEVELOP,
"[QuestieDebugOffer] - NPCTarget - Targeted NPC is in NPC blacklist, ignoring")
return
end
targetTimeout[npcID] = true
@@ -565,18 +608,26 @@ function QuestieDebugOffer.NPCTarget()
elseif npcFriendly == false then
npcStatus = "Neutral"
end
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n\n|cFFAAAAAANPC ID:|r " .. tostring(npcID)
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n|cFFAAAAAANPC Name:|r " .. tostring(npcName)
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n|cFFAAAAAANPC Level:|r " .. tostring(npcLevel)
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n|cFFAAAAAANPC Health, Max:|r " .. tostring(npcHealth) .. ", " .. tostring(npcHealthMax)
DebugInformation[debugIndex] = DebugInformation[debugIndex] .. "\n|cFFAAAAAANPC Allegiance:|r " .. tostring(npcStatus)
DebugInformation[debugIndex] = DebugInformation[debugIndex] ..
"\n\n|cFFAAAAAANPC ID:|r " .. tostring(npcID)
DebugInformation[debugIndex] = DebugInformation[debugIndex] ..
"\n|cFFAAAAAANPC Name:|r " .. tostring(npcName)
DebugInformation[debugIndex] = DebugInformation[debugIndex] ..
"\n|cFFAAAAAANPC Level:|r " .. tostring(npcLevel)
DebugInformation[debugIndex] = DebugInformation[debugIndex] ..
"\n|cFFAAAAAANPC Health, Max:|r " .. tostring(npcHealth) .. ", " .. tostring(npcHealthMax)
DebugInformation[debugIndex] = DebugInformation[debugIndex] ..
"\n|cFFAAAAAANPC Allegiance:|r " .. tostring(npcStatus)
DebugInformation[debugIndex] = _AppendUniversalText(DebugInformation[debugIndex])
Questie:Print(l10n("The NPC you just targeted is missing from the Questie database.") .. " " .. l10n("Would you like to help us fix it?") .. " |cff71d5ff|Haddon:questie:offer:" .. debugIndex .. "|h[" .. l10n("More Info") .. "]|h|r")
Questie:Print(l10n("The NPC you just targeted is missing from the Questie database.") ..
" " ..
l10n("Would you like to help us fix it?") ..
" |cff71d5ff|Haddon:questie:offer:" .. debugIndex .. "|h[" .. l10n("More Info") .. "]|h|r")
end
if inInstance == false then
C_Timer.NewTimer (timeoutDurationOverworld, function() targetTimeout[npcID] = false end)
C_Timer.NewTimer(timeoutDurationOverworld, function() targetTimeout[npcID] = false end)
else
C_Timer.NewTimer (timeoutDurationInstance, function() targetTimeout[npcID] = false end)
C_Timer.NewTimer(timeoutDurationInstance, function() targetTimeout[npcID] = false end)
end
end
else
@@ -606,7 +657,8 @@ local function _CreateOfferFrame(popupText, discordURL, index)
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieDebugOffer] - An offer is already open, not creating new frame")
return
end
local debugFrame = CreateFrame("Frame", "QuestieDebugOfferFrame", UIParent, BackdropTemplateMixin and "BackdropTemplate")
local debugFrame = CreateFrame("Frame", "QuestieDebugOfferFrame", UIParent,
BackdropTemplateMixin and "BackdropTemplate")
debugFrame:SetPoint("CENTER")
debugFrame:SetMovable(true)
debugFrame:EnableMouse(true)
@@ -623,7 +675,8 @@ local function _CreateOfferFrame(popupText, discordURL, index)
debugFrame.title = debugFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
debugFrame.title:SetPoint("TOP", 0, -15)
debugFrame.title:SetText("|TInterface\\Addons\\Questie\\Icons\\startendstart.tga:16|t |cFFFED218" .. l10n("Questie Debug Info") .. "|r |TInterface\\Addons\\Questie\\Icons\\startendstart.tga:16|t")
debugFrame.title:SetText("|TInterface\\Addons\\Questie\\Icons\\startendstart.tga:16|t |cFFFED218" ..
l10n("Questie Debug Info") .. "|r |TInterface\\Addons\\Questie\\Icons\\startendstart.tga:16|t")
-- Create a single large edit box with no background
debugFrame.dataEditBox = CreateFrame("EditBox", nil, debugFrame)
@@ -646,7 +699,10 @@ local function _CreateOfferFrame(popupText, discordURL, index)
debugFrame.discordText = debugFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlight")
debugFrame.discordText:SetPoint("TOP", debugFrame.dataEditBox, "BOTTOM", 0, -15)
debugFrame.discordText:SetText("|cFFAAAAAA" .. l10n("Please share this info with us on") .. " |TInterface\\Addons\\Questie\\Icons\\discord.blp:16|t |cFF5765ECDiscord|r\n" .. "(" .. l10n("You can copy the data above") .. ")")
debugFrame.discordText:SetText("|cFFAAAAAA" ..
l10n("Please share this info with us on") ..
" |TInterface\\Addons\\Questie\\Icons\\discord.blp:16|t |cFF5765ECDiscord|r\n" ..
"(" .. l10n("You can copy the data above") .. ")")
debugFrame.discordLinkEditBox = CreateFrame("EditBox", nil, debugFrame, "InputBoxTemplate")
debugFrame.discordLinkEditBox:SetSize(200, 20)
@@ -666,7 +722,9 @@ local function _CreateOfferFrame(popupText, discordURL, index)
debugFrame:SetBackdrop({
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
tile = true, tileSize = 32, edgeSize = 32,
tile = true,
tileSize = 32,
edgeSize = 32,
insets = { left = 8, right = 8, top = 8, bottom = 8 }
})
@@ -680,7 +738,8 @@ end
function QuestieDebugOffer.ShowOffer(link)
-- We also have access to the questie.dev domain (purchased by Logon)
local discordURL = "https://discord.gg/Q6j4qByndw" -- redirect to #bug-redirect
local i = tonumber(string.sub(link,21))
local i = tonumber(string.sub(link, 21))
if not i then return end
local popupText = DebugInformation[i]
_CreateOfferFrame(popupText, discordURL, i)
+16 -8
View File
@@ -91,7 +91,7 @@ function QuestieLearner:LearnNPC(npcId, name, level, subName, npcFlags, factionS
end
end
if not found then
table.insert(existing[7][zoneId], {x, y})
table.insert(existing[7][zoneId], { x, y })
end
end
@@ -117,7 +117,7 @@ function QuestieLearner:LearnQuest(questId, name, questLevel, requiredLevel, zon
if type(objectives) == "table" then
existing[8] = objectives
elseif type(objectives) == "string" then
existing[8] = {objectives}
existing[8] = { objectives }
end
end
@@ -140,7 +140,9 @@ function QuestieLearner:LearnQuestGiver(questId, npcId, isStart)
existing[2][1] = existing[2][1] or {}
local found = false
for _, id in ipairs(existing[2][1]) do
if id == npcId then found = true; break end
if id == npcId then
found = true; break
end
end
if not found then table.insert(existing[2][1], npcId) end
else
@@ -148,7 +150,9 @@ function QuestieLearner:LearnQuestGiver(questId, npcId, isStart)
existing[3][1] = existing[3][1] or {}
local found = false
for _, id in ipairs(existing[3][1]) do
if id == npcId then found = true; break end
if id == npcId then
found = true; break
end
end
if not found then table.insert(existing[3][1], npcId) end
end
@@ -188,7 +192,9 @@ function QuestieLearner:LearnItemDrop(itemId, npcId)
existing[2] = existing[2] or {}
local found = false
for _, id in ipairs(existing[2]) do
if id == npcId then found = true; break end
if id == npcId then
found = true; break
end
end
if not found then table.insert(existing[2], npcId) end
end
@@ -221,7 +227,7 @@ function QuestieLearner:LearnObject(objectId, name)
end
end
if not found then
table.insert(existing[4][zoneId], {x, y})
table.insert(existing[4][zoneId], { x, y })
end
end
@@ -513,13 +519,15 @@ function QuestieLearner:OnLootOpened()
local numItems = GetNumLootItems()
for i = 1, numItems do
local lootIcon, lootName, lootQuantity, currencyID, lootQuality, locked, isQuestItem, questId, isActive = GetLootSlotInfo(i)
local lootIcon, lootName, lootQuantity, currencyID, lootQuality, locked, isQuestItem, questId, isActive =
GetLootSlotInfo(i)
if lootName then
local link = GetLootSlotLink(i)
if link then
local itemId = tonumber(string.match(link, "item:(%d+)"))
if itemId then
local _, _, _, itemLevel, requiredLevel, itemType, itemSubType, _, _, _, _, itemClassId, itemSubClassId = GetItemInfo(link)
local _, _, _, itemLevel, requiredLevel, itemType, itemSubType, _, _, _, _, itemClassId, itemSubClassId =
GetItemInfo(link)
self:LearnItem(itemId, lootName, itemLevel, requiredLevel, itemClassId, itemSubClassId)
if npcId then
+21 -17
View File
@@ -6,7 +6,7 @@ Flow:
----> Game cache should have all quests in it, data of each quest may be invalid.
If data is invalid, Wait for next QUEST_LOG_UPDATE and check again.
-----> Game Cache ok. Call possible callback functions.
]]--
]] --
---@class QuestieValidateGameCache
local QuestieValidateGameCache = QuestieLoader:CreateModule("QuestieValidateGameCache")
@@ -22,7 +22,7 @@ local GetQuestObjectives = QuestieCompat.C_QuestLog.GetQuestObjectives
local HaveQuestData = QuestieCompat.HaveQuestData
local stringByte, tremove = string.byte, table.remove
local tpack = QuestieLib.tpack
local tpack = QuestieLib.tpack
local tunpack = QuestieLib.tunpack
-- 3 * (Max possible number of quests in game quest log)
@@ -50,11 +50,10 @@ function QuestieValidateGameCache.AddCallback(func, ...)
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieValidateGameCache] Calling a callback function imediately.")
func(...)
else
callbacks[#callbacks+1] = {func, tpack(...)}
callbacks[#callbacks + 1] = { func, tpack(...) }
end
end
local function DestroyEventFrame()
if eventFrame then
eventFrame:UnregisterAllEvents()
@@ -72,7 +71,9 @@ local function OnQuestLogUpdate()
-- This is to wait until cache has atleast some refreshed data from a game server.
if numberOfQuestLogUpdatesToSkip > 0 then
numberOfQuestLogUpdatesToSkip = numberOfQuestLogUpdatesToSkip - 1
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieValidateGameCache] Skipping a QUEST_LOG_UPDATE event. Quest log has entries, quests:", numEntries, numQuests)
Questie:Debug(Questie.DEBUG_DEVELOP,
"[QuestieValidateGameCache] Skipping a QUEST_LOG_UPDATE event. Quest log has entries, quests:", numEntries,
numQuests)
return
end
@@ -80,11 +81,8 @@ local function OnQuestLogUpdate()
local goodQuestsCount = 0 -- for debug stats
for i = 1, MAX_QUEST_LOG_INDEX do
local title, _, _, isHeader, _, _, _, questId = GetQuestLogTitle(i)
if (not title) then
break -- We exceeded the data in the quest log
end
if (not isHeader) then
local title, level, questTag, isHeader, isCollapsed, isComplete, isDaily, questId = GetQuestLogTitle(i)
if title and questId and (not isHeader) then
if (not HaveQuestData(questId)) then
isQuestLogGood = false
else
@@ -95,11 +93,13 @@ local function OnQuestLogUpdate()
-- On WotLK private servers, GetQuestObjectives can return nil for quests with
-- no trackable objectives. This is not a broken cache state; treat it as an
-- empty (valid) objective list so goodQuestsCount increments correctly.
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieValidateGameCache] GetQuestObjectives returned non-table for questId:", questId, "- treating as empty objectives")
Questie:Debug(Questie.DEBUG_DEVELOP,
"[QuestieValidateGameCache] GetQuestObjectives returned non-table for questId:", questId,
"- treating as empty objectives")
objectiveList = {}
end
for _, objective in pairs(objectiveList) do -- objectiveList may be {}, which is also a valid cached quest in quest log
for _, objective in pairs(objectiveList) do -- objectiveList may be {}, which is also a valid cached quest in quest log
if (not objective.text) or (stringByte(objective.text, 1) == 32) then -- if (text starts with a space " ") then
-- Game hasn't cached the quest fully yet
isQuestLogGood = false
@@ -117,7 +117,8 @@ local function OnQuestLogUpdate()
end
if not isQuestLogGood then
Questie:Debug(Questie.DEBUG_INFO, "[QuestieValidateGameCache] Quest log is NOT yet okey. Good quest:", goodQuestsCount.."/"..numQuests )
Questie:Debug(Questie.DEBUG_INFO, "[QuestieValidateGameCache] Quest log is NOT yet okey. Good quest:",
goodQuestsCount .. "/" .. numQuests)
return
end
@@ -125,12 +126,15 @@ local function OnQuestLogUpdate()
-- This count mismatch can occur on WotLK private servers where GetNumQuestLogEntries
-- returns a different value than objectives-loop counted. The cache is valid because
-- isQuestLogGood already passed above. Log at debug level only.
Questie:Debug(Questie.DEBUG_INFO, "[QuestieValidateGameCache] Quest count mismatch (expected "..tostring(numQuests)..", validated "..tostring(goodQuestsCount).."). Cache is still valid.")
Questie:Debug(Questie.DEBUG_INFO,
"[QuestieValidateGameCache] Quest count mismatch (expected " ..
tostring(numQuests) .. ", validated " .. tostring(goodQuestsCount) .. "). Cache is still valid.")
end
DestroyEventFrame()
Questie:Debug(Questie.DEBUG_CRITICAL, "[QuestieValidateGameCache] Quest log is ok. Good quest:", goodQuestsCount.."/"..numQuests )
Questie:Debug(Questie.DEBUG_CRITICAL, "[QuestieValidateGameCache] Quest log is ok. Good quest:",
goodQuestsCount .. "/" .. numQuests)
isCacheGood = true
@@ -148,7 +152,7 @@ local function OnPlayerEnteringWorld(_, _, isInitialLogin, isReloadingUi)
if QuestieCompat.Is335 then
isInitialLogin, isReloadingUi = false, true -- 335 Not skipping for now
end
assert(isInitialLogin or isReloadingUi) -- We should get to here only at login or at /reload.
assert(isInitialLogin or isReloadingUi) -- We should get to here only at login or at /reload.
-- Game's quest log has still old cached data on the first QUEST_LOG_UPDATE after PLAYER_ENTERING_WORLD during login.
-- So we need to skip that event.
@@ -167,4 +171,4 @@ function QuestieValidateGameCache.StartCheck()
eventFrame = CreateFrame("Frame")
eventFrame:SetScript("OnEvent", OnPlayerEnteringWorld)
eventFrame:RegisterEvent("PLAYER_ENTERING_WORLD")
end
end
+67 -35
View File
@@ -42,7 +42,7 @@ local function _Questie_SilentGetQuestLogIndexByID(questId)
local n = (GetNumQuestLogEntries and select(1, GetNumQuestLogEntries())) or 0
if n > 0 and GetQuestLogTitle then
for i = 1, n do
local _, _, _, _, isHeader, _, _, _, qid = GetQuestLogTitle(i)
local _, _, _, isHeader, _, _, _, qid = GetQuestLogTitle(i)
qid = tonumber(qid)
if (not isHeader) and qid and qid == questId then
return i
@@ -133,7 +133,8 @@ function MapIconTooltip:Show()
local iconData = icon.data
if not iconData then
Questie:Error("[MapIconTooltip:Show] handleMapIcon - iconData is nil! self.data.Id =", self.data.Id, "- Aborting!")
Questie:Error("[MapIconTooltip:Show] handleMapIcon - iconData is nil! self.data.Id =", self.data.Id,
"- Aborting!")
return
end
@@ -166,14 +167,14 @@ function MapIconTooltip:Show()
end
local orderedTooltips = {}
local _qid = tonumber(iconData.Id)
if _qid and _Questie_SilentGetQuestLogIndexByID(_qid) <= 0 then
return
end
local _ok = pcall(iconData.ObjectiveData.Update, iconData.ObjectiveData)
if not _ok then
return
end
local _qid = tonumber(iconData.Id)
if _qid and _Questie_SilentGetQuestLogIndexByID(_qid) <= 0 then
return
end
local _ok = pcall(iconData.ObjectiveData.Update, iconData.ObjectiveData)
if not _ok then
return
end
if iconData.Type == "event" then
local tip = _MapIconTooltip:GetEventObjectiveTooltip(icon.data)
@@ -257,26 +258,33 @@ end
local quest = QuestieDB.GetQuest(questData.questId)
local rewardString = ""
if (quest and shift) then
local xpReward = QuestXP:GetQuestLogRewardXP(questData.questId, Questie.db.profile.showQuestXpAtMaxLevel)
local xpReward = QuestXP:GetQuestLogRewardXP(questData.questId,
Questie.db.profile.showQuestXpAtMaxLevel)
if xpReward > 0 then
rewardString = QuestieLib:PrintDifficultyColor(quest.level, "(" .. FormatLargeNumber(xpReward) .. xpString .. ") ", QuestieDB.IsRepeatable(questData.questId), QuestieDB.IsActiveEventQuest(questData.questId), QuestieDB.IsPvPQuest(questData.questId))
rewardString = QuestieLib:PrintDifficultyColor(quest.level,
"(" .. FormatLargeNumber(xpReward) .. xpString .. ") ",
QuestieDB.IsRepeatable(questData.questId),
QuestieDB.IsActiveEventQuest(questData.questId), QuestieDB.IsPvPQuest(questData.questId))
end
local moneyReward = QuestXP.GetQuestRewardMoney(questData.questId)
if moneyReward > 0 then
rewardString = rewardString .. Questie:Colorize("(" .. GetCoinTextureString(moneyReward) .. ") ", "white")
rewardString = rewardString ..
Questie:Colorize("(" .. GetCoinTextureString(moneyReward) .. ") ", "white")
end
end
rewardString = rewardString .. questData.type
if (not shift) and reputationReward and next(reputationReward) then
self:AddDoubleLine(REPUTATION_ICON_TEXTURE .. " " .. questData.title, rewardString, 1, 1, 1, 1, 1, 0);
self:AddDoubleLine(REPUTATION_ICON_TEXTURE .. " " .. questData.title, rewardString, 1, 1, 1, 1, 1,
0);
else
if shift then
self:AddDoubleLine(questData.title, rewardString, 1, 1, 1, 1, 1, 0);
else
-- We use a transparent icon because this eases setting the correct margin
self:AddDoubleLine(TRANSPARENT_ICON_TEXTURE .. " " .. questData.title, rewardString, 1, 1, 1, 1, 1, 0);
self:AddDoubleLine(TRANSPARENT_ICON_TEXTURE .. " " .. questData.title, rewardString, 1, 1, 1,
1, 1, 0);
end
end
end
@@ -284,13 +292,15 @@ end
local dataType = type(questData.subData)
if dataType == "table" then
for _, rawLine in pairs(questData.subData) do
local lines = QuestieLib:TextWrap(rawLine, " ", false, math.max(375, Tooltip:GetWidth()), questData.questId) --275 is the default questlog width
local lines = QuestieLib:TextWrap(rawLine, " ", false, math.max(375, Tooltip:GetWidth()),
questData.questId) --275 is the default questlog width
for _, line in pairs(lines) do
self:AddLine(line, 0.86, 0.86, 0.86);
end
end
elseif dataType == "string" then
local lines = QuestieLib:TextWrap(questData.subData, " ", false, math.max(375, Tooltip:GetWidth())) --275 is the default questlog width
local lines = QuestieLib:TextWrap(questData.subData, " ", false,
math.max(375, Tooltip:GetWidth())) --275 is the default questlog width
for _, line in pairs(lines) do
self:AddLine(line, 0.86, 0.86, 0.86);
end
@@ -303,19 +313,21 @@ end
local nextQuest = QuestieDB.GetQuest(nextQuestInChain)
local firstInChain = true;
while nextQuest ~= nil do
local nextQuestTitleString;
local nextQuestXpRewardString = "";
local nextQuestMoneyRewardString = "";
local nextQuestIdString = "";
local nextQuestTagString = "";
if firstInChain then
self:AddLine(" |T" .. QuestieLib.AddonPath .. "Icons\\nextquest.blp:16|t " .. l10n("Next in chain:"), 0.86, 0.86, 0.86)
self:AddLine(
" |T" .. QuestieLib.AddonPath .. "Icons\\nextquest.blp:16|t " .. l10n("Next in chain:"),
0.86, 0.86, 0.86)
firstInChain = false;
end
if Questie.db.profile.enableTooltipsQuestLevel then
nextQuestTitleString = string.format("%s", QuestieLib:GetLevelString(nextQuest.Id, "", nextQuest.level, true) .. nextQuest.name)
nextQuestTitleString = string.format("%s",
QuestieLib:GetLevelString(nextQuest.Id, "", nextQuest.level, true) .. nextQuest.name)
else
nextQuestTitleString = string.format("%s", nextQuest.name)
end
@@ -324,14 +336,17 @@ end
nextQuestIdString = string.format(" (%d)", nextQuest.Id)
end
local nextQuestXpReward = QuestXP:GetQuestLogRewardXP(nextQuest.Id, Questie.db.profile.showQuestXpAtMaxLevel);
local nextQuestXpReward = QuestXP:GetQuestLogRewardXP(nextQuest.Id,
Questie.db.profile.showQuestXpAtMaxLevel);
if nextQuestXpReward > 0 then
nextQuestXpRewardString = string.format(" (%s%s)", FormatLargeNumber(nextQuestXpReward), xpString);
nextQuestXpRewardString = string.format(" (%s%s)", FormatLargeNumber(nextQuestXpReward),
xpString);
end
local nextQuestMoneyReward = QuestXP:GetQuestRewardMoney(nextQuest.Id);
if nextQuestMoneyReward > 0 then
nextQuestMoneyRewardString = Questie:Colorize(string.format(" (%s)", GetCoinTextureString(nextQuestMoneyReward)), "white");
nextQuestMoneyRewardString = Questie:Colorize(
string.format(" (%s)", GetCoinTextureString(nextQuestMoneyReward)), "white");
end
if (QuestieDB.IsGroupQuest(nextQuest.Id) or QuestieDB.IsDungeonQuest(nextQuest.Id) or QuestieDB.IsRaidQuest(nextQuest.Id)) then
@@ -339,8 +354,12 @@ end
nextQuestTagString = Questie:Colorize(string.format(" (%s)", nextQuestTag), "yellow")
end
local nextQuestString = string.format(" %s%s%s%s%s", nextQuestTitleString, nextQuestIdString, nextQuestXpRewardString, nextQuestMoneyRewardString, nextQuestTagString); -- we need an offset to align with description
self:AddLine(QuestieLib:PrintDifficultyColor(nextQuest.level, nextQuestString, QuestieDB.IsRepeatable(nextQuest.Id), QuestieDB.IsActiveEventQuest(nextQuest.Id), QuestieDB.IsPvPQuest(nextQuest.Id)), 1, 1, 1);
local nextQuestString = string.format(" %s%s%s%s%s", nextQuestTitleString, nextQuestIdString,
nextQuestXpRewardString, nextQuestMoneyRewardString, nextQuestTagString); -- we need an offset to align with description
self:AddLine(
QuestieLib:PrintDifficultyColor(nextQuest.level, nextQuestString,
QuestieDB.IsRepeatable(nextQuest.Id), QuestieDB.IsActiveEventQuest(nextQuest.Id),
QuestieDB.IsPvPQuest(nextQuest.Id)), 1, 1, 1);
nextQuest = QuestieDB.GetQuest(nextQuest.nextQuestInChain)
end
end
@@ -374,7 +393,8 @@ end
aldorPenalty = 0 - math.floor(rewardValue * 1.1)
end
rewardTable[#rewardTable + 1] = (rewardValue > 0 and "+" or "") .. rewardValue .. " " .. factionName
rewardTable[#rewardTable + 1] = (rewardValue > 0 and "+" or "") ..
rewardValue .. " " .. factionName
end
end
@@ -386,7 +406,9 @@ end
rewardTable[#rewardTable + 1] = scryersPenalty .. " " .. factionName
end
self:AddLine(REPUTATION_ICON_TEXTURE .. " " .. Questie:Colorize(table.concat(rewardTable, " / "), "reputationBlue"), 1, 1, 1, 1, 1, 0)
self:AddLine(
REPUTATION_ICON_TEXTURE ..
" " .. Questie:Colorize(table.concat(rewardTable, " / "), "reputationBlue"), 1, 1, 1, 1, 1, 0)
end
end
end
@@ -396,13 +418,16 @@ end
for questId, textList in pairs(self.questOrder) do -- this logic really needs to be improved
---@type Quest
local quest = QuestieDB.GetQuest(questId);
local questTitle = QuestieLib:GetColoredQuestName(questId, Questie.db.profile.enableTooltipsQuestLevel, true, true);
local questTitle = QuestieLib:GetColoredQuestName(questId, Questie.db.profile.enableTooltipsQuestLevel, true,
true);
local xpReward = QuestXP:GetQuestLogRewardXP(questId, Questie.db.profile.showQuestXpAtMaxLevel);
r, g, b = QuestieLib:GetDifficultyColorPercent(quest.level);
if haveGiver then
if shift and xpReward then
self:AddLine(" ");
self:AddDoubleLine(questTitle, "(" .. FormatLargeNumber(xpReward) .. xpString .. ") (" .. l10n("Active") .. ")", 0.2, 1, 0.2, 1, 1, 0);
self:AddDoubleLine(questTitle,
"(" .. FormatLargeNumber(xpReward) .. xpString .. ") (" .. l10n("Active") .. ")", 0.2, 1, 0.2, 1,
1, 0);
haveGiver = false -- looks better when only the first one shows (active)
else
self:AddLine(" ");
@@ -411,7 +436,8 @@ end
end
else
if (quest and shift and xpReward > 0) then
self:AddDoubleLine(questTitle, "(" .. FormatLargeNumber(xpReward) .. xpString .. ")", 0.2, 1, 0.2, r, g, b);
self:AddDoubleLine(questTitle, "(" .. FormatLargeNumber(xpReward) .. xpString .. ")", 0.2, 1, 0.2, r,
g, b);
firstLine = false;
elseif (firstLine and not shift) then
self:AddDoubleLine(questTitle, "(" .. l10n('Hold Shift') .. ")", 0.2, 1, 0.2, 0.43, 0.43, 0.43); --"(Shift+click)"
@@ -592,9 +618,12 @@ function _MapIconTooltip:GetObjectiveTooltip(icon)
local color = QuestieLib:GetRGBForObjective(iconData.ObjectiveData)
if iconData.ObjectiveData.Needed then
if iconData.ObjectiveData.Type == "spell" and iconData.ObjectiveData.spawnList[iconData.ObjectiveTargetId].ItemId then
text = color .. tostring(QuestieDB.QueryItemSingle(iconData.ObjectiveData.spawnList[iconData.ObjectiveTargetId].ItemId, "name"))
text = color ..
tostring(QuestieDB.QueryItemSingle(iconData.ObjectiveData.spawnList[iconData.ObjectiveTargetId].ItemId,
"name"))
else
text = color .. tostring(iconData.ObjectiveData.Collected) .. "/" .. tostring(iconData.ObjectiveData.Needed) .. " " .. text
text = color ..
tostring(iconData.ObjectiveData.Collected) .. "/" .. tostring(iconData.ObjectiveData.Needed) .. " " .. text
end
end
if QuestieComms then
@@ -617,17 +646,20 @@ function _MapIconTooltip:GetObjectiveTooltip(icon)
if playerColor then
local objectiveEntry = objectiveData[iconData.ObjectiveIndex]
if not objectiveEntry then
Questie:Debug(Questie.DEBUG_DEVELOP, "[_MapIconTooltip:GetObjectiveTooltip] No objective data for quest", quest.Id)
Questie:Debug(Questie.DEBUG_DEVELOP,
"[_MapIconTooltip:GetObjectiveTooltip] No objective data for quest", quest.Id)
objectiveEntry = {} -- This will make "GetRGBForObjective" return default color
end
local remoteColor = QuestieLib:GetRGBForObjective(objectiveEntry)
local colorizedPlayerName = " (" .. playerColor .. playerName .. "|r" .. remoteColor .. ")|r" .. playerType
local colorizedPlayerName = " (" ..
playerColor .. playerName .. "|r" .. remoteColor .. ")|r" .. playerType
local remoteText = iconData.ObjectiveData.Description
if objectiveEntry and objectiveEntry.fulfilled and objectiveEntry.required then
local fulfilled = objectiveEntry.fulfilled;
local required = objectiveEntry.required;
remoteText = remoteColor .. tostring(fulfilled) .. "/" .. tostring(required) .. " " .. remoteText .. colorizedPlayerName;
remoteText = remoteColor ..
tostring(fulfilled) .. "/" .. tostring(required) .. " " .. remoteText .. colorizedPlayerName;
else
remoteText = remoteColor .. remoteText .. colorizedPlayerName;
end
+20 -18
View File
@@ -259,12 +259,12 @@ function _QuestieTooltips:AddUnitDataToTooltip()
local type, _, _, _, _, npcId, _ = strsplit("-", guid or "");
if name and (type == "Creature" or type == "Vehicle") and (
name ~= QuestieTooltips.lastGametooltipUnit or
(not QuestieTooltips.lastGametooltipCount) or
_QuestieTooltips:CountTooltip() < QuestieTooltips.lastGametooltipCount or
QuestieTooltips.lastGametooltipType ~= "monster" or
lastGuid ~= guid
) then
name ~= QuestieTooltips.lastGametooltipUnit or
(not QuestieTooltips.lastGametooltipCount) or
_QuestieTooltips:CountTooltip() < QuestieTooltips.lastGametooltipCount or
QuestieTooltips.lastGametooltipType ~= "monster" or
lastGuid ~= guid
) then
QuestieTooltips.lastGametooltipUnit = name
local tooltipData = QuestieTooltips:GetTooltip("m_" .. npcId);
@@ -273,7 +273,7 @@ function _QuestieTooltips:AddUnitDataToTooltip()
if Questie.db.profile.enableTooltipsNPCID == true then
GameTooltip:AddDoubleLine("NPC ID", "|cFFFFFFFF" .. npcId .. "|r")
end
for _, v in pairs (tooltipData) do
for _, v in pairs(tooltipData) do
GameTooltip:AddLine(v)
end
else
@@ -307,23 +307,25 @@ function _QuestieTooltips:AddItemDataToTooltip()
local name, link = self:GetItem()
local itemId
if link then
itemId = select(3, string.match(link, "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*):?(%d*):?(%-?%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?"))
itemId = select(3,
string.match(link,
"|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*):?(%d*):?(%-?%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?"))
end
if name and itemId and (
name ~= QuestieTooltips.lastGametooltipItem or
(not QuestieTooltips.lastGametooltipCount) or
_QuestieTooltips:CountTooltip() < QuestieTooltips.lastGametooltipCount or
QuestieTooltips.lastGametooltipType ~= "item" or
lastItemId ~= itemId or
QuestieTooltips.lastFrameName ~= self:GetName()
) then
name ~= QuestieTooltips.lastGametooltipItem or
(not QuestieTooltips.lastGametooltipCount) or
_QuestieTooltips:CountTooltip() < QuestieTooltips.lastGametooltipCount or
QuestieTooltips.lastGametooltipType ~= "item" or
lastItemId ~= itemId or
QuestieTooltips.lastFrameName ~= self:GetName()
) then
QuestieTooltips.lastGametooltipItem = name
local tooltipData = QuestieTooltips:GetTooltip("i_" .. (itemId or 0));
if tooltipData then
if Questie.db.profile.enableTooltipsItemID == true then
GameTooltip:AddDoubleLine("Item ID", "|cFFFFFFFF" .. itemId .. "|r")
end
for _, v in pairs (tooltipData) do
for _, v in pairs(tooltipData) do
self:AddLine(v)
end
end
@@ -363,7 +365,7 @@ function _QuestieTooltips:AddObjectDataToTooltip(name)
if tooltipData[2] then
-- Quest has objectives
for index, line in pairs (tooltipData) do
for index, line in pairs(tooltipData) do
if index > 1 and (not alreadyAddedObjectiveLines[line]) then -- skip the first entry, it's the title
local _, _, acquired, needed = string.find(line, "(%d+)/(%d+)")
-- We need "tonumber", because acquired can contain parts of the color string
@@ -386,7 +388,7 @@ end
function _QuestieTooltips:CountTooltip()
local tooltipCount = 0
for i = 1, GameTooltip:NumLines() do
local frame = _G["GameTooltipTextLeft"..i]
local frame = _G["GameTooltipTextLeft" .. i]
if frame and frame:GetText() then
tooltipCount = tooltipCount + 1
else
-1
View File
@@ -2278,7 +2278,6 @@ function QuestieTracker.RemoveQuestWatch(index, isQuestie)
QuestieTracker:UntrackQuestId(questId)
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieTracker.RemoveQuestWatch] - by Blizzard", questId)
end
end
else
Questie:Debug(Questie.DEBUG_DEVELOP, "[QuestieTracker.RemoveQuestWatch] - by Questie")
+18 -15
View File
@@ -70,7 +70,8 @@ local bindTruthTable = {
['disabled'] = function() return false end,
}
local _QuestLogScrollBar = QuestLogScrollFrameScrollBar or QuestLogListScrollFrame.ScrollBar or QuestLogListScrollFrameScrollBar
local _QuestLogScrollBar = QuestLogScrollFrameScrollBar or QuestLogListScrollFrame.ScrollBar or
QuestLogListScrollFrameScrollBar
---@param quest table The table provided by QuestieDB.GetQuest(questId)
function TrackerUtils:ShowQuestLog(quest)
@@ -107,7 +108,6 @@ function TrackerUtils:ShowQuestLog(quest)
QuestLog_Update()
end
---@param title string The name of the WayPoint
---@param zone number The zone ID number
---@param x number X coordinate
@@ -670,7 +670,8 @@ local function _GetZoneName(zoneOrSort, questId)
else
-- The quest has no explicit zone or category. Fallback to "Unknown Zone"
zoneName = "Unknown Zone"
Questie:Debug(Questie.DEBUG_CRITICAL, "[TrackerUtils:_GetZoneName] zoneOrSort", zoneOrSort, "of quest", questId, "is not in the Database!")
Questie:Debug(Questie.DEBUG_CRITICAL, "[TrackerUtils:_GetZoneName] zoneOrSort", zoneOrSort, "of quest",
questId, "is not in the Database!")
end
else
-- Let's create custom Zones based on Sorting type.
@@ -890,15 +891,18 @@ function TrackerUtils:GetSortedQuestIds()
local playerPosition
questZoneProximityTimer = C_Timer.NewTicker(5.0, function()
if IsInInstance() and questZoneProximityTimer then
Questie:Debug(Questie.DEBUG_DEVELOP, "[TrackerUtils:GetSortedQuestIds] - Zone Proximity Timer Stoped!")
Questie:Debug(Questie.DEBUG_DEVELOP,
"[TrackerUtils:GetSortedQuestIds] - Zone Proximity Timer Stoped!")
questZoneProximityTimer:Cancel()
questZoneProximityTimer = nil
else
local position = _GetWorldPlayerPosition()
if position then
local distance = playerPosition and _GetDistance(position.x, position.y, playerPosition.x, playerPosition.y)
local distance = playerPosition and
_GetDistance(position.x, position.y, playerPosition.x, playerPosition.y)
if not distance or distance > 0.01 then -- Position has changed
Questie:Debug(Questie.DEBUG_SPAM, "[TrackerUtils:GetSortedQuestIds] - Zone Proximity Timer Updated!")
Questie:Debug(Questie.DEBUG_SPAM,
"[TrackerUtils:GetSortedQuestIds] - Zone Proximity Timer Updated!")
playerPosition = position
local orderCopy = {}
@@ -1006,9 +1010,11 @@ function TrackerUtils:GetSortedQuestIds()
else
local position = _GetWorldPlayerPosition()
if position then
local distance = playerPosition and _GetDistance(position.x, position.y, playerPosition.x, playerPosition.y)
local distance = playerPosition and
_GetDistance(position.x, position.y, playerPosition.x, playerPosition.y)
if not distance or distance > 0.01 then -- Position has changed
Questie:Debug(Questie.DEBUG_SPAM, "[TrackerUtils:GetSortedQuestIds] - Proximity Timer Updated!")
Questie:Debug(Questie.DEBUG_SPAM,
"[TrackerUtils:GetSortedQuestIds] - Proximity Timer Updated!")
playerPosition = position
local orderCopy = {}
@@ -1119,16 +1125,13 @@ function TrackerUtils:UpdateVoiceOverPlayButtons()
end
for i = 1, 75 do
local title, _, _, isHeader, _, _, _, questId = GetQuestLogTitle(i)
local title, level, questTag, isHeader, isCollapsed, isComplete, isDaily, questId = GetQuestLogTitle(i)
if not (title and questId) then
break
end
if not isHeader then
if title and questId and (not isHeader) then
if not VoiceOver.QuestOverlayUI.questPlayButtons[questId] then
VoiceOver.QuestOverlayUI:CreatePlayButton(questId)
table.insert(VoiceOver.QuestOverlayUI.displayedButtons, VoiceOver.QuestOverlayUI.questPlayButtons[questId])
table.insert(VoiceOver.QuestOverlayUI.displayedButtons,
VoiceOver.QuestOverlayUI.questPlayButtons[questId])
end
end
end