diff --git a/Core.lua b/Core.lua index a064093..8fee1d6 100644 --- a/Core.lua +++ b/Core.lua @@ -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" diff --git a/Minimap.lua b/Minimap.lua index d258beb..1130add 100644 --- a/Minimap.lua +++ b/Minimap.lua @@ -66,8 +66,12 @@ end function MM:Create() if getglobal(BTN_NAME) then return getglobal(BTN_NAME) end - -- Parent to UIParent so we're not clipped to the minimap area. - local btn = CreateFrame("Button", BTN_NAME, UIParent) + -- Parent to Minimap so button-collector addons (MinimapButtonBag / + -- MBB, and similar) can discover and manage this button the same way + -- they discover Blizzard's built-in minimap buttons. SetPoint still + -- anchors to UIParent CENTER so the button can be dragged anywhere + -- on screen -- the anchor frame is independent of the parent frame. + local btn = CreateFrame("Button", BTN_NAME, Minimap) btn:SetWidth(31); btn:SetHeight(31) btn:SetFrameStrata("MEDIUM") btn:SetFrameLevel(8) @@ -75,6 +79,9 @@ function MM:Create() btn:RegisterForClicks("LeftButtonUp", "RightButtonUp") btn:RegisterForDrag("LeftButton", "RightButton") btn:SetMovable(true) + -- MBB-friendly highlight so the button visually matches other + -- minimap buttons once it has been swept into the bag. + btn:SetHighlightTexture("Interface\\Minimap\\UI-Minimap-ZoomButton-Highlight") -- Round border ring (standard minimap-button look) local overlay = btn:CreateTexture(nil, "OVERLAY") @@ -89,6 +96,7 @@ function MM:Create() icon:SetPoint("TOPLEFT", btn, "TOPLEFT", 7, -6) btn.icon = icon + btn:SetScript("OnClick", function() if RA.UI and RA.UI.Toggle then RA.UI:Toggle() end end) diff --git a/RelationshipsAttune.toc b/RelationshipsAttune.toc index 81ab41b..e68f263 100644 --- a/RelationshipsAttune.toc +++ b/RelationshipsAttune.toc @@ -2,7 +2,7 @@ ## Title: Relationships Attune ## Notes: Track Vanilla and Turtle/Octo WoW attunement progress ## Author: Relationship -## Version: 1.5 +## Version: 1.6 ## X-Category: Quest ## SavedVariables: RelationshipsAttuneDB ## SavedVariablesPerCharacter: RelationshipsAttuneCharDB