Add files via upload
This commit is contained in:
@@ -81,10 +81,16 @@ end
|
||||
-- ---------------------------------------------------------------
|
||||
function RA:ScanQuestLog()
|
||||
if not GetNumQuestLogEntries then return end
|
||||
-- Rebuild transient quest states from the live log so that abandoning a
|
||||
-- quest reverts its step colour. "turnedin" is authoritative and preserved.
|
||||
-- Snapshot previous transient states so we can detect a turn-in on clients
|
||||
-- that don't fire QUEST_TURNED_IN (stock 1.12). A quest that was
|
||||
-- "complete" (ready to hand in) and is now missing from the log is
|
||||
-- almost certainly turned in -- abandoning a quest requires it to be
|
||||
-- accepted-but-not-complete. This is what actually credits MC's
|
||||
-- "Attunement to the Core" (7487), BWL, Naxx, and any other
|
||||
-- quest-only final step.
|
||||
local prev = RelationshipsAttuneCharDB.quests or {}
|
||||
local kept = {}
|
||||
for qid, st in pairs(RelationshipsAttuneCharDB.quests) do
|
||||
for qid, st in pairs(prev) do
|
||||
if st == "turnedin" then kept[qid] = "turnedin" end
|
||||
end
|
||||
RelationshipsAttuneCharDB.quests = kept
|
||||
@@ -92,6 +98,7 @@ function RA:ScanQuestLog()
|
||||
RA:BuildNameIndex()
|
||||
local qNameMap = RA._questNameToId or {}
|
||||
|
||||
local seenThisScan = {}
|
||||
local numEntries = GetNumQuestLogEntries()
|
||||
for i = 1, numEntries do
|
||||
local ok, title, level, tag, isHeader, _, isComplete, _, questId =
|
||||
@@ -104,17 +111,29 @@ function RA:ScanQuestLog()
|
||||
if (not qid) and title then
|
||||
qid = qNameMap[string.lower(title)]
|
||||
end
|
||||
if qid and RelationshipsAttuneCharDB.quests[qid] ~= "turnedin" then
|
||||
if isComplete and isComplete == 1 then
|
||||
RelationshipsAttuneCharDB.quests[qid] = "complete"
|
||||
else
|
||||
RelationshipsAttuneCharDB.quests[qid] = "inlog"
|
||||
if qid then
|
||||
seenThisScan[qid] = true
|
||||
if RelationshipsAttuneCharDB.quests[qid] ~= "turnedin" then
|
||||
if isComplete and isComplete == 1 then
|
||||
RelationshipsAttuneCharDB.quests[qid] = "complete"
|
||||
else
|
||||
RelationshipsAttuneCharDB.quests[qid] = "inlog"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Retroactive turn-in detection: any quest we tracked as "complete" last
|
||||
-- scan that isn't in the log any more got handed in.
|
||||
for qid, st in pairs(prev) do
|
||||
if st == "complete" and not seenThisScan[qid] then
|
||||
RelationshipsAttuneCharDB.quests[qid] = "turnedin"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function RA:MarkQuestTurnedIn(questId)
|
||||
if not questId then return end
|
||||
RelationshipsAttuneCharDB.quests[questId] = "turnedin"
|
||||
|
||||
Reference in New Issue
Block a user