Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a276cca444 | |||
| 4502a1db7e |
@@ -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,7 +111,9 @@ 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
|
||||||
|
seenThisScan[qid] = true
|
||||||
|
if RelationshipsAttuneCharDB.quests[qid] ~= "turnedin" then
|
||||||
if isComplete and isComplete == 1 then
|
if isComplete and isComplete == 1 then
|
||||||
RelationshipsAttuneCharDB.quests[qid] = "complete"
|
RelationshipsAttuneCharDB.quests[qid] = "complete"
|
||||||
else
|
else
|
||||||
@@ -115,6 +124,16 @@ function RA:ScanQuestLog()
|
|||||||
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)
|
function RA:MarkQuestTurnedIn(questId)
|
||||||
if not questId then return end
|
if not questId then return end
|
||||||
RelationshipsAttuneCharDB.quests[questId] = "turnedin"
|
RelationshipsAttuneCharDB.quests[questId] = "turnedin"
|
||||||
@@ -597,6 +616,34 @@ local function slashHandler(msg)
|
|||||||
print("Minimap button shown. Drag to reposition around the minimap.")
|
print("Minimap button shown. Drag to reposition around the minimap.")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
elseif string.find(msg, "^pos") then
|
||||||
|
-- /attune pos <x> <y> -- set exact offset from UIParent CENTER.
|
||||||
|
-- Values may be off-screen (e.g. -9999) to park the button out of
|
||||||
|
-- the way while still letting MinimapButtonBag collect it.
|
||||||
|
local _, _, sx, sy = string.find(msg, "pos%s+(%-?%d+%.?%d*)%s+(%-?%d+%.?%d*)")
|
||||||
|
local x, y = tonumber(sx), tonumber(sy)
|
||||||
|
if x and y and RA.Minimap then
|
||||||
|
local o = RelationshipsAttuneDB.options
|
||||||
|
o.minimapX, o.minimapY = x, y
|
||||||
|
RA.Minimap:Refresh()
|
||||||
|
print("Minimap button moved to " .. x .. ", " .. y .. ".")
|
||||||
|
else
|
||||||
|
print("Usage: /attune pos <x> <y> (offsets from screen center; can be off-screen)")
|
||||||
|
end
|
||||||
|
elseif msg == "offscreen" or msg == "park" then
|
||||||
|
if RA.Minimap then
|
||||||
|
local o = RelationshipsAttuneDB.options
|
||||||
|
o.minimapX, o.minimapY = -10000, -10000
|
||||||
|
RA.Minimap:Refresh()
|
||||||
|
print("Minimap button parked off-screen. MinimapButtonBag (if installed) can still collect it. Use /attune resetpos to bring it back.")
|
||||||
|
end
|
||||||
|
elseif msg == "resetpos" then
|
||||||
|
if RA.Minimap then
|
||||||
|
local o = RelationshipsAttuneDB.options
|
||||||
|
o.minimapX, o.minimapY = 0, -140
|
||||||
|
RA.Minimap:Refresh()
|
||||||
|
print("Minimap button position reset.")
|
||||||
|
end
|
||||||
elseif msg == "sync" then
|
elseif msg == "sync" then
|
||||||
if RA.Comm then RA.Comm:RequestSync() end
|
if RA.Comm then RA.Comm:RequestSync() end
|
||||||
print(L.MSG_SYNC_SENT)
|
print(L.MSG_SYNC_SENT)
|
||||||
@@ -645,6 +692,9 @@ local function slashHandler(msg)
|
|||||||
print(" /attune show - open the window")
|
print(" /attune show - open the window")
|
||||||
print(" /attune hide - close the window (or hide the minimap button)")
|
print(" /attune hide - close the window (or hide the minimap button)")
|
||||||
print(" /attune minimap - toggle the minimap button")
|
print(" /attune minimap - toggle the minimap button")
|
||||||
|
print(" /attune pos x y - place the minimap button at exact offset (can be off-screen)")
|
||||||
|
print(" /attune offscreen- park the minimap button off-screen (MBB can still collect it)")
|
||||||
|
print(" /attune resetpos - restore the minimap button to a visible default position")
|
||||||
print(" /attune scan - force a rescan of quests + bags")
|
print(" /attune scan - force a rescan of quests + bags")
|
||||||
print(" /attune sync - request sync from your group")
|
print(" /attune sync - request sync from your group")
|
||||||
print(" /attune debug - dump keyring + item detection")
|
print(" /attune debug - dump keyring + item detection")
|
||||||
|
|||||||
+14
-2
@@ -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,12 @@ 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)
|
||||||
|
-- Allow the button to sit off-screen (via /attune pos or /attune offscreen)
|
||||||
|
-- while remaining discoverable by MinimapButtonBag.
|
||||||
|
if btn.SetClampedToScreen then btn:SetClampedToScreen(false) end
|
||||||
|
-- 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 +99,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)
|
||||||
@@ -107,6 +118,7 @@ function MM:Create()
|
|||||||
GameTooltip:AddLine("Relationships Attune", 1, 0.82, 0)
|
GameTooltip:AddLine("Relationships Attune", 1, 0.82, 0)
|
||||||
GameTooltip:AddLine("Left-click: open / close window", 0.9, 0.9, 0.9)
|
GameTooltip:AddLine("Left-click: open / close window", 0.9, 0.9, 0.9)
|
||||||
GameTooltip:AddLine("Drag: move anywhere on screen", 0.9, 0.9, 0.9)
|
GameTooltip:AddLine("Drag: move anywhere on screen", 0.9, 0.9, 0.9)
|
||||||
|
GameTooltip:AddLine("/attune offscreen - park off-screen (MBB safe)", 0.6, 0.8, 1)
|
||||||
GameTooltip:AddLine("/attune hide - hide this button", 0.6, 0.8, 1)
|
GameTooltip:AddLine("/attune hide - hide this button", 0.6, 0.8, 1)
|
||||||
GameTooltip:Show()
|
GameTooltip:Show()
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user