Add files via upload

This commit is contained in:
Relationship
2026-07-12 17:16:47 +01:00
committed by GitHub
parent 044b6593ec
commit e95e65fca5
+35 -3
View File
@@ -6,7 +6,7 @@ RelationshipsAttune = RelationshipsAttune or {}
local RA = RelationshipsAttune local RA = RelationshipsAttune
local L = RelationshipsAttune_L local L = RelationshipsAttune_L
RA.VERSION = "1.4.0" RA.VERSION = "1.4.2"
RA.COMM_PREFIX = "RATTUNE" RA.COMM_PREFIX = "RATTUNE"
RA.playerName = nil RA.playerName = nil
@@ -329,9 +329,13 @@ function RA:EvaluateStep(step)
return (UnitLevel("player") or 0) >= (step.level or 0), false return (UnitLevel("player") or 0) >= (step.level or 0), false
elseif step.type == "quest" then elseif step.type == "quest" then
local st = RelationshipsAttuneCharDB.quests[step.id] local st = RelationshipsAttuneCharDB.quests[step.id]
if st == "complete" or st == "turnedin" then if st == "turnedin" then
return true, false return true, false
elseif st == "inlog" then elseif st == "complete" or st == "inlog" then
-- Quest is in the log (either accepted or ready to turn in).
-- Treat both as "on this step" (orange) until it is actually
-- turned in. Retroactive completion will still mark this
-- step green once the player advances to a later step.
return false, true return false, true
end end
return false, false return false, false
@@ -398,6 +402,34 @@ function RA:EvaluateAttunement(att)
end end
end end
end end
-- Retroactive completion: if the player is on a later step (done or in
-- progress), any earlier quest/item steps must already be done. Quests
-- get turned in and key items get consumed, so their live state can
-- flip back to "not done" even though the player clearly finished
-- them. Level and reputation steps have their own live truth and are
-- left alone.
local laterActive = false
for i = numSteps, 1, -1 do
local step = att.steps[i]
if step and self:StepApplies(step) then
if laterActive and steps[i] == false then
local t = step.type
if t == "quest" or t == "item" then
steps[i] = true
stepsInProgress[i] = false
doneCount = doneCount + 1
if t == "quest" then
RelationshipsAttuneCharDB.quests[step.id] = "turnedin"
elseif t == "item" then
RelationshipsAttuneCharDB.items[step.id] = true
end
end
end
if steps[i] == true or stepsInProgress[i] == true then
laterActive = true
end
end
end
local persistedDone = RelationshipsAttuneCharDB.completedAttunements and RelationshipsAttuneCharDB.completedAttunements[att.id] local persistedDone = RelationshipsAttuneCharDB.completedAttunements and RelationshipsAttuneCharDB.completedAttunements[att.id]
if persistedDone or (finalIdx and steps[finalIdx] == true) then if persistedDone or (finalIdx and steps[finalIdx] == true) then
for i = 1, numSteps do for i = 1, numSteps do