Add files via upload

This commit is contained in:
Relationship
2026-07-16 17:03:20 +01:00
committed by GitHub
parent fda04907c2
commit 4502a1db7e
3 changed files with 38 additions and 11 deletions
+27 -8
View File
@@ -81,10 +81,16 @@ end
-- --------------------------------------------------------------- -- ---------------------------------------------------------------
function RA:ScanQuestLog() function RA:ScanQuestLog()
if not GetNumQuestLogEntries then return end if not GetNumQuestLogEntries then return end
-- Rebuild transient quest states from the live log so that abandoning a -- Snapshot previous transient states so we can detect a turn-in on clients
-- quest reverts its step colour. "turnedin" is authoritative and preserved. -- 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 = {} 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 if st == "turnedin" then kept[qid] = "turnedin" end
end end
RelationshipsAttuneCharDB.quests = kept RelationshipsAttuneCharDB.quests = kept
@@ -92,6 +98,7 @@ function RA:ScanQuestLog()
RA:BuildNameIndex() RA:BuildNameIndex()
local qNameMap = RA._questNameToId or {} local qNameMap = RA._questNameToId or {}
local seenThisScan = {}
local numEntries = GetNumQuestLogEntries() local numEntries = GetNumQuestLogEntries()
for i = 1, numEntries do for i = 1, numEntries do
local ok, title, level, tag, isHeader, _, isComplete, _, questId = local ok, title, level, tag, isHeader, _, isComplete, _, questId =
@@ -104,17 +111,29 @@ function RA:ScanQuestLog()
if (not qid) and title then if (not qid) and title then
qid = qNameMap[string.lower(title)] qid = qNameMap[string.lower(title)]
end end
if qid and RelationshipsAttuneCharDB.quests[qid] ~= "turnedin" then if qid then
if isComplete and isComplete == 1 then seenThisScan[qid] = true
RelationshipsAttuneCharDB.quests[qid] = "complete" if RelationshipsAttuneCharDB.quests[qid] ~= "turnedin" then
else if isComplete and isComplete == 1 then
RelationshipsAttuneCharDB.quests[qid] = "inlog" RelationshipsAttuneCharDB.quests[qid] = "complete"
else
RelationshipsAttuneCharDB.quests[qid] = "inlog"
end
end end
end 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 end
function RA:MarkQuestTurnedIn(questId) function RA:MarkQuestTurnedIn(questId)
if not questId then return end if not questId then return end
RelationshipsAttuneCharDB.quests[questId] = "turnedin" RelationshipsAttuneCharDB.quests[questId] = "turnedin"
+10 -2
View File
@@ -66,8 +66,12 @@ end
function MM:Create() function MM:Create()
if getglobal(BTN_NAME) then return getglobal(BTN_NAME) end if getglobal(BTN_NAME) then return getglobal(BTN_NAME) end
-- Parent to UIParent so we're not clipped to the minimap area. -- Parent to Minimap so button-collector addons (MinimapButtonBag /
local btn = CreateFrame("Button", BTN_NAME, UIParent) -- 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:SetWidth(31); btn:SetHeight(31)
btn:SetFrameStrata("MEDIUM") btn:SetFrameStrata("MEDIUM")
btn:SetFrameLevel(8) btn:SetFrameLevel(8)
@@ -75,6 +79,9 @@ function MM:Create()
btn:RegisterForClicks("LeftButtonUp", "RightButtonUp") btn:RegisterForClicks("LeftButtonUp", "RightButtonUp")
btn:RegisterForDrag("LeftButton", "RightButton") btn:RegisterForDrag("LeftButton", "RightButton")
btn:SetMovable(true) 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) -- Round border ring (standard minimap-button look)
local overlay = btn:CreateTexture(nil, "OVERLAY") local overlay = btn:CreateTexture(nil, "OVERLAY")
@@ -89,6 +96,7 @@ function MM:Create()
icon:SetPoint("TOPLEFT", btn, "TOPLEFT", 7, -6) icon:SetPoint("TOPLEFT", btn, "TOPLEFT", 7, -6)
btn.icon = icon btn.icon = icon
btn:SetScript("OnClick", function() btn:SetScript("OnClick", function()
if RA.UI and RA.UI.Toggle then RA.UI:Toggle() end if RA.UI and RA.UI.Toggle then RA.UI:Toggle() end
end) end)
+1 -1
View File
@@ -2,7 +2,7 @@
## Title: Relationships Attune ## Title: Relationships Attune
## Notes: Track Vanilla and Turtle/Octo WoW attunement progress ## Notes: Track Vanilla and Turtle/Octo WoW attunement progress
## Author: Relationship ## Author: Relationship
## Version: 1.5 ## Version: 1.6
## X-Category: Quest ## X-Category: Quest
## SavedVariables: RelationshipsAttuneDB ## SavedVariables: RelationshipsAttuneDB
## SavedVariablesPerCharacter: RelationshipsAttuneCharDB ## SavedVariablesPerCharacter: RelationshipsAttuneCharDB