Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7070b4b263 | |||
| 2cdf47dbb3 | |||
| 9824274b2c |
@@ -1,4 +1,4 @@
|
|||||||
<img src="https://i.postimg.cc/Prk2RKn3/bg.png"/>
|
<img src="https://i.postimg.cc/YjBwZFzk/sdf.png"/>
|
||||||
|
|
||||||
|
|
||||||
# Relationships PVP
|
# Relationships PVP
|
||||||
|
|||||||
+18
-21
@@ -156,6 +156,7 @@ local function FinalizeSpendableHonor(key, clear)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Handle a currentBG transition: capture on enter, finalize on leave.
|
-- Handle a currentBG transition: capture on enter, finalize on leave.
|
||||||
|
local FinalizeMatchKillers
|
||||||
local function OnCurrentBGChanged(prevKey, newKey)
|
local function OnCurrentBGChanged(prevKey, newKey)
|
||||||
if newKey and newKey ~= prevKey then
|
if newKey and newKey ~= prevKey then
|
||||||
if prevKey then FinalizeSpendableHonor(prevKey, true) end
|
if prevKey then FinalizeSpendableHonor(prevKey, true) end
|
||||||
@@ -226,28 +227,28 @@ local function RegisterDeath()
|
|||||||
local db = EnsureDB()
|
local db = EnsureDB()
|
||||||
if not db.currentMatch or db.currentMatch.key ~= currentBG then
|
if not db.currentMatch or db.currentMatch.key ~= currentBG then
|
||||||
db.currentMatch = { key = currentBG, killedBy = {} }
|
db.currentMatch = { key = currentBG, killedBy = {} }
|
||||||
|
-- Fresh match: reset the "last match" tally so the Nemesis line
|
||||||
|
-- starts from zero and updates live as deaths accumulate.
|
||||||
|
db.lastMatchKilledBy = {}
|
||||||
|
db.lastMatchKey = currentBG
|
||||||
end
|
end
|
||||||
local n = lastAttackerName
|
local n = lastAttackerName
|
||||||
db.currentMatch.killedBy[n] = (db.currentMatch.killedBy[n] or 0) + 1
|
db.currentMatch.killedBy[n] = (db.currentMatch.killedBy[n] or 0) + 1
|
||||||
|
-- Live update: promote this death straight into the "last match" and
|
||||||
|
-- all-time KOS tables so the UI reflects it immediately, instead of
|
||||||
|
-- waiting until FinalizeMatchKillers() runs at match end.
|
||||||
|
db.lastMatchKilledBy[n] = (db.lastMatchKilledBy[n] or 0) + 1
|
||||||
|
db.killedByAll[n] = (db.killedByAll[n] or 0) + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Called when we transition out of a BG: promote currentMatch tallies to
|
-- Called when we transition out of a BG: promote currentMatch tallies to
|
||||||
-- "last match" and roll them into the all-time KOS table.
|
-- "last match" and roll them into the all-time KOS table.
|
||||||
local function FinalizeMatchKillers()
|
function FinalizeMatchKillers()
|
||||||
local db = RelationshipsPVPCharDB
|
local db = RelationshipsPVPCharDB
|
||||||
if not db or not db.currentMatch then return end
|
if not db or not db.currentMatch then return end
|
||||||
local cm = db.currentMatch
|
-- Deaths are now folded into lastMatchKilledBy / killedByAll live in
|
||||||
local hasAny = false
|
-- RegisterDeath(), so there's nothing to promote here -- just clear
|
||||||
local newLast = {}
|
-- the in-progress match marker.
|
||||||
for name, cnt in pairs(cm.killedBy or {}) do
|
|
||||||
newLast[name] = cnt
|
|
||||||
db.killedByAll[name] = (db.killedByAll[name] or 0) + cnt
|
|
||||||
hasAny = true
|
|
||||||
end
|
|
||||||
if hasAny then
|
|
||||||
db.lastMatchKilledBy = newLast
|
|
||||||
db.lastMatchKey = cm.key
|
|
||||||
end
|
|
||||||
db.currentMatch = nil
|
db.currentMatch = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1152,14 +1153,10 @@ function RelationshipsPVP_Refresh()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if RelationshipsPVPNemesisText then
|
if RelationshipsPVPNemesisText then
|
||||||
local nm, cnt = TopKiller(db.lastMatchKilledBy)
|
local nm = TopKiller(db.lastMatchKilledBy)
|
||||||
if nm then
|
if nm then
|
||||||
local bgTag = ""
|
|
||||||
if db.lastMatchKey and BG_NAMES[db.lastMatchKey] then
|
|
||||||
bgTag = " |cff888888(" .. BG_NAMES[db.lastMatchKey] .. ")|r"
|
|
||||||
end
|
|
||||||
RelationshipsPVPNemesisText:SetText(
|
RelationshipsPVPNemesisText:SetText(
|
||||||
"|cffff9966Last BG Nemesis:|r |cffffffff" .. nm .. "|r |cffff6666x" .. cnt .. "|r" .. bgTag
|
"|cffff9966Last BG Nemesis:|r |cffffffff" .. nm .. "|r"
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
RelationshipsPVPNemesisText:SetText("|cffff9966Last BG Nemesis:|r |cff888888none yet|r")
|
RelationshipsPVPNemesisText:SetText("|cffff9966Last BG Nemesis:|r |cff888888none yet|r")
|
||||||
@@ -1167,10 +1164,10 @@ function RelationshipsPVP_Refresh()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if RelationshipsPVPKOSText then
|
if RelationshipsPVPKOSText then
|
||||||
local nm, cnt = TopKiller(db.killedByAll)
|
local nm = TopKiller(db.killedByAll)
|
||||||
if nm then
|
if nm then
|
||||||
RelationshipsPVPKOSText:SetText(
|
RelationshipsPVPKOSText:SetText(
|
||||||
"|cffff3333KOS:|r |cffffffff" .. nm .. "|r |cffff6666x" .. cnt .. "|r"
|
"|cffff3333KOS:|r |cffffffff" .. nm .. "|r"
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
RelationshipsPVPKOSText:SetText("|cffff3333KOS:|r |cff888888none yet|r")
|
RelationshipsPVPKOSText:SetText("|cffff3333KOS:|r |cff888888none yet|r")
|
||||||
|
|||||||
Reference in New Issue
Block a user