- Added new Death Recap implemented! replaces the default from Blizzard and can be configured at Options > Raid Tools.
- Fixed Paladin 'Light of the Martyr' damage to self.
This commit is contained in:
@@ -3002,4 +3002,434 @@
|
||||
end
|
||||
|
||||
--_detalhes:ScheduleTimer ("OpenForge", 3)
|
||||
|
||||
----------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
--framename:
|
||||
-- DeathRecapFrame
|
||||
-- OpenDeathRecapUI()
|
||||
-- Blizzard_DeathRecap
|
||||
|
||||
local textAlpha = 0.9
|
||||
|
||||
local on_deathrecap_line_enter = function (self)
|
||||
if (self.spellid) then
|
||||
GameTooltip:SetOwner (self, "ANCHOR_RIGHT")
|
||||
_detalhes:GameTooltipSetSpellByID (self.spellid)
|
||||
self:SetBackdropColor (.3, .3, .3, .2)
|
||||
GameTooltip:Show()
|
||||
self.backgroundTextureOverlay:Show()
|
||||
self.timeAt:SetAlpha (1)
|
||||
self.sourceName:SetAlpha (1)
|
||||
self.amount:SetAlpha (1)
|
||||
self.lifePercent:SetAlpha (1)
|
||||
end
|
||||
end
|
||||
local on_deathrecap_line_leave = function (self)
|
||||
GameTooltip:Hide()
|
||||
self:SetBackdropColor (.3, .3, .3, 0)
|
||||
self.backgroundTextureOverlay:Hide()
|
||||
self.timeAt:SetAlpha (textAlpha)
|
||||
self.sourceName:SetAlpha (textAlpha)
|
||||
self.amount:SetAlpha (textAlpha)
|
||||
self.lifePercent:SetAlpha (textAlpha)
|
||||
end
|
||||
|
||||
local create_deathrecap_line = function (parent, n)
|
||||
local line = CreateFrame ("frame", "DetailsDeathRecapLine" .. n, parent)
|
||||
line:SetPoint ("topleft", parent, "topleft", 10, (-24 * n) - 17)
|
||||
line:SetPoint ("topright", parent, "topright", -10, (-24 * n) - 17)
|
||||
--line:SetBackdrop ({bgFile = [[Interface\AddOns\Details\images\background]], tile = true, tileSize = 16,
|
||||
--insets = {left = 0, right = 0, top = 0, bottom = 0}})
|
||||
line:SetScript ("OnEnter", on_deathrecap_line_enter)
|
||||
line:SetScript ("OnLeave", on_deathrecap_line_leave)
|
||||
|
||||
line:SetSize (300, 21)
|
||||
|
||||
if (n % 2 == 0) then
|
||||
--line:SetBackdropColor (0, 0, 0, 0)
|
||||
else
|
||||
--line:SetBackdropColor (.3, .3, .3, 0)
|
||||
end
|
||||
|
||||
local timeAt = line:CreateFontString (nil, "overlay", "GameFontNormal")
|
||||
local backgroundTexture = line:CreateTexture (nil, "border")
|
||||
local backgroundTextureOverlay = line:CreateTexture (nil, "artwork")
|
||||
local spellIcon = line:CreateTexture (nil, "overlay")
|
||||
local spellIconBorder = line:CreateTexture (nil, "overlay")
|
||||
spellIcon:SetDrawLayer ("overlay", 1)
|
||||
spellIconBorder:SetDrawLayer ("overlay", 2)
|
||||
local sourceName = line:CreateFontString (nil, "overlay", "GameFontNormal")
|
||||
local amount = line:CreateFontString (nil, "overlay", "GameFontNormal")
|
||||
local lifePercent = line:CreateFontString (nil, "overlay", "GameFontNormal")
|
||||
|
||||
--grave icon
|
||||
local graveIcon = line:CreateTexture (nil, "overlay")
|
||||
graveIcon:SetTexture ([[Interface\MINIMAP\POIIcons]])
|
||||
graveIcon:SetTexCoord (146/256, 160/256, 0/512, 18/512)
|
||||
graveIcon:SetPoint ("left", line, "left", 11, 0)
|
||||
graveIcon:SetSize (14, 18)
|
||||
|
||||
--spell icon
|
||||
spellIcon:SetSize (19, 19)
|
||||
spellIconBorder:SetTexture ([[Interface\ENCOUNTERJOURNAL\LootTab]])
|
||||
spellIconBorder:SetTexCoord (6/256, 38/256, 49/128, 81/128)
|
||||
spellIconBorder:SetSize (20, 20)
|
||||
spellIconBorder:SetPoint ("topleft", spellIcon, "topleft", 0, 0)
|
||||
|
||||
--locations
|
||||
timeAt:SetPoint ("left", line, "left", 2, 0)
|
||||
spellIcon:SetPoint ("left", line, "left", 50, 0)
|
||||
sourceName:SetPoint ("left", line, "left", 82, 0)
|
||||
amount:SetPoint ("left", line, "left", 220, 0)
|
||||
lifePercent:SetPoint ("left", line, "left", 320, 0)
|
||||
|
||||
--text colors
|
||||
_detalhes.gump:SetFontColor (amount, "red")
|
||||
_detalhes.gump:SetFontColor (timeAt, "gray")
|
||||
_detalhes.gump:SetFontColor (sourceName, "yellow")
|
||||
|
||||
--text alpha
|
||||
timeAt:SetAlpha (textAlpha)
|
||||
sourceName:SetAlpha (textAlpha)
|
||||
amount:SetAlpha (textAlpha)
|
||||
lifePercent:SetAlpha (textAlpha)
|
||||
|
||||
--text setup
|
||||
amount:SetWidth (75)
|
||||
amount:SetJustifyH ("right")
|
||||
lifePercent:SetWidth (36)
|
||||
lifePercent:SetJustifyH ("right")
|
||||
|
||||
--background
|
||||
--backgroundTexture:SetTexture ([[Interface\AdventureMap\AdventureMap]])
|
||||
--backgroundTexture:SetTexCoord (460/1024, 659/1024, 330/1024, 350/1024)
|
||||
|
||||
backgroundTexture:SetTexture ([[Interface\AddOns\Details\images\deathrecap_background]])
|
||||
backgroundTexture:SetTexCoord (0, 1, 0, 1)
|
||||
backgroundTexture:SetVertexColor (.1, .1, .1, .3)
|
||||
|
||||
|
||||
--top border
|
||||
local TopFader = line:CreateTexture (nil, "border")
|
||||
TopFader:SetTexture ([[Interface\AddOns\Details\images\deathrecap_background_top]])
|
||||
TopFader:SetTexCoord (0, 1, 0, 1)
|
||||
TopFader:SetVertexColor (.1, .1, .1, .3)
|
||||
TopFader:SetPoint ("bottomleft", backgroundTexture, "topleft", 0, -0)
|
||||
TopFader:SetPoint ("bottomright", backgroundTexture, "topright", 0, -0)
|
||||
TopFader:SetHeight (32)
|
||||
TopFader:Hide()
|
||||
line.TopFader = TopFader
|
||||
|
||||
if (n == 10) then
|
||||
--bottom fader
|
||||
local backgroundTexture2 = line:CreateTexture (nil, "border")
|
||||
backgroundTexture2:SetTexture ([[Interface\AddOns\Details\images\deathrecap_background_bottom]])
|
||||
backgroundTexture2:SetTexCoord (0, 1, 0, 1)
|
||||
backgroundTexture2:SetVertexColor (.1, .1, .1, .3)
|
||||
backgroundTexture2:SetPoint ("topleft", backgroundTexture, "bottomleft", 0, 0)
|
||||
backgroundTexture2:SetPoint ("topright", backgroundTexture, "bottomright", 0, 0)
|
||||
backgroundTexture2:SetHeight (32)
|
||||
|
||||
--_detalhes.gump:SetFontColor (amount, "red")
|
||||
_detalhes.gump:SetFontSize (amount, 16)
|
||||
_detalhes.gump:SetFontSize (lifePercent, 16)
|
||||
backgroundTexture:SetVertexColor (.2, .1, .1, .3)
|
||||
|
||||
end
|
||||
|
||||
--backgroundTexture:SetAllPoints()
|
||||
backgroundTexture:SetPoint ("topleft", 0, 1)
|
||||
backgroundTexture:SetPoint ("bottomright", 0, -1)
|
||||
backgroundTexture:SetDesaturated (true)
|
||||
backgroundTextureOverlay:SetTexture ([[Interface\AdventureMap\AdventureMap]])
|
||||
backgroundTextureOverlay:SetTexCoord (460/1024, 659/1024, 330/1024, 350/1024)
|
||||
backgroundTextureOverlay:SetAllPoints()
|
||||
backgroundTextureOverlay:SetDesaturated (true)
|
||||
backgroundTextureOverlay:SetAlpha (0.5)
|
||||
backgroundTextureOverlay:Hide()
|
||||
|
||||
line.timeAt = timeAt
|
||||
line.spellIcon = spellIcon
|
||||
line.sourceName = sourceName
|
||||
line.amount = amount
|
||||
line.lifePercent = lifePercent
|
||||
line.backgroundTexture = backgroundTexture
|
||||
line.backgroundTextureOverlay = backgroundTextureOverlay
|
||||
line.graveIcon = graveIcon
|
||||
|
||||
if (n == 10) then
|
||||
graveIcon:Show()
|
||||
line.timeAt:Hide()
|
||||
else
|
||||
graveIcon:Hide()
|
||||
end
|
||||
|
||||
return line
|
||||
end
|
||||
|
||||
local OpenDetailsDeathRecapAtSegment = function (segment)
|
||||
_detalhes.OpenDetailsDeathRecap (segment)
|
||||
end
|
||||
|
||||
function _detalhes.OpenDetailsDeathRecap (segment)
|
||||
|
||||
if (not _detalhes.death_recap.enabled) then
|
||||
if (Details.DeathRecap and Details.DeathRecap.Lines) then
|
||||
for i = 1, 10 do
|
||||
Details.DeathRecap.Lines [i]:Hide()
|
||||
end
|
||||
for i, button in ipairs (Details.DeathRecap.Segments) do
|
||||
button:Hide()
|
||||
end
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
DeathRecapFrame.Recap1:Hide()
|
||||
DeathRecapFrame.Recap2:Hide()
|
||||
DeathRecapFrame.Recap3:Hide()
|
||||
DeathRecapFrame.Recap4:Hide()
|
||||
DeathRecapFrame.Recap5:Hide()
|
||||
|
||||
if (not Details.DeathRecap) then
|
||||
Details.DeathRecap = CreateFrame ("frame", "DetailsDeathRecap", DeathRecapFrame)
|
||||
Details.DeathRecap:SetAllPoints()
|
||||
|
||||
--lines
|
||||
Details.DeathRecap.Lines = {}
|
||||
for i = 1, 10 do
|
||||
Details.DeathRecap.Lines [i] = create_deathrecap_line (Details.DeathRecap, i)
|
||||
end
|
||||
|
||||
--segments
|
||||
Details.DeathRecap.Segments = {}
|
||||
for i = 5, 1, -1 do
|
||||
local segmentButton = CreateFrame ("button", "DetailsDeathRecapSegmentButton" .. i, Details.DeathRecap)
|
||||
|
||||
segmentButton:SetSize (16, 20)
|
||||
segmentButton:SetPoint ("topright", DeathRecapFrame, "topright", (-abs (i-6) * 22) - 10, -5)
|
||||
|
||||
local text = segmentButton:CreateFontString (nil, "overlay", "GameFontNormal")
|
||||
segmentButton.text = text
|
||||
text:SetText ("#" .. i)
|
||||
text:SetPoint ("center")
|
||||
_detalhes.gump:SetFontColor (text, "silver")
|
||||
|
||||
segmentButton:SetScript ("OnClick", function()
|
||||
OpenDetailsDeathRecapAtSegment (i)
|
||||
end)
|
||||
tinsert (Details.DeathRecap.Segments, i, segmentButton)
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, 10 do
|
||||
Details.DeathRecap.Lines [i]:Hide()
|
||||
end
|
||||
|
||||
--segment to use
|
||||
local death = _detalhes.tabela_vigente.last_events_tables
|
||||
|
||||
--segments
|
||||
if (_detalhes.death_recap.show_segments) then
|
||||
local last_index = 0
|
||||
local buttonsInUse = {}
|
||||
for i, button in ipairs (Details.DeathRecap.Segments) do
|
||||
if (_detalhes.tabela_historico.tabelas [i]) then
|
||||
button:Show()
|
||||
tinsert (buttonsInUse, button)
|
||||
_detalhes.gump:SetFontColor (button.text, "silver")
|
||||
last_index = i
|
||||
else
|
||||
button:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
local buttonsInUse2 = {}
|
||||
for i = #buttonsInUse, 1, -1 do
|
||||
tinsert (buttonsInUse2, buttonsInUse[i])
|
||||
end
|
||||
for i = 1, #buttonsInUse2 do
|
||||
local button = buttonsInUse2 [i]
|
||||
button:ClearAllPoints()
|
||||
button:SetPoint ("topright", DeathRecapFrame, "topright", (-i * 22) - 10, -5)
|
||||
end
|
||||
|
||||
if (not segment) then
|
||||
_detalhes.gump:SetFontColor (Details.DeathRecap.Segments [1].text, "orange")
|
||||
else
|
||||
_detalhes.gump:SetFontColor (Details.DeathRecap.Segments [segment].text, "orange")
|
||||
death = _detalhes.tabela_historico.tabelas [segment].last_events_tables
|
||||
end
|
||||
|
||||
else
|
||||
for i, button in ipairs (Details.DeathRecap.Segments) do
|
||||
button:Hide()
|
||||
end
|
||||
end
|
||||
|
||||
if (not death) then
|
||||
return
|
||||
end
|
||||
|
||||
--get the relevance config
|
||||
local relevanceTime = _detalhes.death_recap.relevance_time
|
||||
|
||||
--for index, t in ipairs (death) do
|
||||
for index = #death, 1, -1 do
|
||||
local t = death [index]
|
||||
|
||||
if (t [3] == _detalhes.playername) then
|
||||
|
||||
local events = t [1]
|
||||
local timeOfDeath = t [2]
|
||||
|
||||
local BiggestDamageHits = {}
|
||||
for i = #events, 1, -1 do
|
||||
tinsert (BiggestDamageHits, events [i])
|
||||
end
|
||||
table.sort (BiggestDamageHits, function (t1, t2)
|
||||
return t1[3] > t2[3]
|
||||
end)
|
||||
for i = #BiggestDamageHits, 1, -1 do
|
||||
if (BiggestDamageHits [i][4] + relevanceTime < timeOfDeath) then
|
||||
tremove (BiggestDamageHits, i)
|
||||
end
|
||||
end
|
||||
|
||||
--verifica se o evento que matou o jogador esta na lista, se nao, adiciona no primeiro index do BiggestDamageHits
|
||||
local hitKill
|
||||
for i = #events, 1, -1 do
|
||||
local event = events [i]
|
||||
local evType = event [1]
|
||||
if (type (evType) == "boolean" and evType) then
|
||||
hitKill = event
|
||||
break
|
||||
end
|
||||
end
|
||||
if (hitKill) then
|
||||
local haveHitKill = false
|
||||
for index, t in ipairs (BiggestDamageHits) do
|
||||
if (t == hitKill) then
|
||||
haveHitKill = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if (not haveHitKill) then
|
||||
tinsert (BiggestDamageHits, 1, hitKill)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--tem menos que 10 eventos com grande dano dentro dos ultimos 5 segundos
|
||||
--precisa preencher com danos pequenos
|
||||
if (#BiggestDamageHits < 10) then
|
||||
for i = #events, 1, -1 do
|
||||
local event = events [i]
|
||||
local evType = event [1]
|
||||
if (type (evType) == "boolean" and evType) then
|
||||
local alreadyHave = false
|
||||
for index, t in ipairs (BiggestDamageHits) do
|
||||
if (t == event) then
|
||||
alreadyHave = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if (not alreadyHave) then
|
||||
tinsert (BiggestDamageHits, event)
|
||||
if (#BiggestDamageHits == 10) then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
--encurta a tabela em no maximo 10 eventos
|
||||
while (#BiggestDamageHits > 10) do
|
||||
tremove (BiggestDamageHits, 11)
|
||||
end
|
||||
end
|
||||
|
||||
table.sort (BiggestDamageHits, function (t1, t2)
|
||||
return t1[4] > t2[4]
|
||||
end)
|
||||
|
||||
local events = BiggestDamageHits
|
||||
|
||||
local maxHP = t [5]
|
||||
local lineIndex = 10
|
||||
|
||||
--for i = #events, 1, -1 do
|
||||
for i, event in ipairs (events) do
|
||||
local event = events [i]
|
||||
|
||||
local evType = event [1]
|
||||
local hp = min (floor (event [5] / maxHP * 100), 100)
|
||||
local spellName, _, spellIcon = _detalhes.GetSpellInfo (event [2])
|
||||
local amount = event [3]
|
||||
local eventTime = event [4]
|
||||
local source = event [6]
|
||||
local overkill = event [10] or 0
|
||||
|
||||
if (type (evType) == "boolean" and evType) then
|
||||
|
||||
local line = Details.DeathRecap.Lines [lineIndex]
|
||||
|
||||
if (line) then
|
||||
line.timeAt:SetText (format ("%.1f", eventTime - timeOfDeath) .. "s")
|
||||
line.spellIcon:SetTexture (spellIcon)
|
||||
line.TopFader:Hide()
|
||||
--line.spellIcon:SetTexCoord (.1, .9, .1, .9)
|
||||
|
||||
--line.sourceName:SetText ("|cFFC6B0D9" .. source .. "|r")
|
||||
line.sourceName:SetText (spellName)
|
||||
|
||||
if (amount > 1000) then
|
||||
--line.amount:SetText ("-" .. _detalhes:ToK (amount))
|
||||
line.amount:SetText ("-" .. amount)
|
||||
else
|
||||
line.amount:SetText ("-" .. floor (amount))
|
||||
end
|
||||
|
||||
line.lifePercent:SetText (hp .. "%")
|
||||
line.spellid = event [2]
|
||||
|
||||
line:Show()
|
||||
|
||||
if (_detalhes.death_recap.show_life_percent) then
|
||||
line.lifePercent:Show()
|
||||
line.amount:SetPoint ("left", line, "left", 220, 0)
|
||||
line.lifePercent:SetPoint ("left", line, "left", 320, 0)
|
||||
else
|
||||
line.lifePercent:Hide()
|
||||
line.amount:SetPoint ("left", line, "left", 280, 0)
|
||||
--line.lifePercent:SetPoint ("left", line, "left", 320, 0)
|
||||
end
|
||||
end
|
||||
|
||||
lineIndex = lineIndex - 1
|
||||
end
|
||||
end
|
||||
|
||||
local lastLine = Details.DeathRecap.Lines [lineIndex + 1]
|
||||
if (lastLine) then
|
||||
lastLine.TopFader:Show()
|
||||
end
|
||||
|
||||
DeathRecapFrame.Unavailable:Hide()
|
||||
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
hooksecurefunc (_G, "DeathRecap_LoadUI", function()
|
||||
hooksecurefunc (_G, "DeathRecapFrame_OpenRecap", function()
|
||||
_detalhes.OpenDetailsDeathRecap()
|
||||
end)
|
||||
end)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user