- Added an option for change the amount of lines on death log.

- Added custom display for CC done.
This commit is contained in:
Tercio
2015-03-13 23:47:41 -03:00
parent c8711a97d1
commit c5957e1dfd
16 changed files with 522 additions and 148 deletions
+4 -2
View File
@@ -309,8 +309,10 @@
--> core
function combate:CreateLastEventsTable (player_name)
--> sixteen indexes, thinking in 32 but it's just too much
local t = { {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {} }
local t = {}
for i = 1, _detalhes.deadlog_events do
t [i] = {}
end
t.n = 1
self.player_last_events [player_name] = t
return t
+125 -4
View File
@@ -227,8 +227,9 @@
else
actor.report_name = actor.nome
end
else
actor.report_name = actor.nome
end
end
end
@@ -673,7 +674,7 @@
if (instancia.row_info.textL_show_number) then
bar_number = esta_barra.colocacao .. ". "
end
if (self.enemy) then
if (self.arena_enemy) then
if (UsingCustomLeftText) then
@@ -783,22 +784,37 @@
return self._ActorTable [index]
else
--> if is a spell object
local class
if (actor.id) then
local spellname = _GetSpellInfo (actor.id)
actor.nome = spellname
actor.classe = actor.spellschool
class = actor.spellschool
else
class = actor.classe
if (class == "UNKNOW") then
--> try once again
class = _detalhes:GetClass (actor.nome)
if (class and class ~= "UNKNOW") then
actor.classe = class
end
end
end
local new_actor = _setmetatable ({
nome = actor.nome,
classe = actor.classe,
classe = class,
value = _detalhes:GetOrderNumber (actor.nome),
}, atributo_custom.mt)
new_actor.name_complement = name_complement
new_actor.displayName = new_actor.nome .. (name_complement or "")
new_actor.displayName = _detalhes:GetOnlyName (new_actor.nome) .. (name_complement or "")
new_actor.spec = actor.spec
new_actor.enemy = actor.enemy
new_actor.arena_enemy = actor.arena_enemy
new_actor.arena_ally = actor.arena_ally
if (actor.id) then
new_actor.id = actor.id
new_actor.icon = select (3, _GetSpellInfo (actor.id))
@@ -1697,6 +1713,111 @@
end
end
----------------------------------------------------------------------------------------------------------------------------------------------------
--doas
local CC_Done = {
name = "Crowd Control",
icon = [[Interface\ICONS\Spell_Frost_FreezingBreath]],
attribute = false,
spellid = false,
author = "Details!",
desc = "Show the crowd control amount for each player.",
source = false,
target = false,
script_version = 6,
script = [[
local combat, instance_container, instance = ...
local total, top, amount = 0, 0, 0
local misc_actors = combat:GetActorList (DETAILS_ATTRIBUTE_MISC)
for index, character in ipairs (misc_actors) do
if (character.cc_done) then
local cc_done = floor (character.cc_done)
instance_container:AddValue (character, cc_done)
total = total + cc_done
if (cc_done > top) then
top = cc_done
end
amount = amount + 1
end
end
return total, top, amount
]],
tooltip = [[
local actor, combat, instance = ...
local spells = {}
for spellid, spell in pairs (actor.cc_done_spells._ActorTable) do
tinsert (spells, {spellid, spell.counter})
end
table.sort (spells, _detalhes.Sort2)
for index, spell in ipairs (spells) do
local name, _, icon = GetSpellInfo (spell [1])
GameCooltip:AddLine (name, spell [2])
_detalhes:AddTooltipBackgroundStatusbar()
GameCooltip:AddIcon (icon, 1, 1, 14, 14)
end
local targets = {}
for playername, amount in pairs (actor.cc_done_targets) do
tinsert (targets, {playername, amount})
end
table.sort (targets, _detalhes.Sort2)
_detalhes:AddTooltipSpellHeaderText ("Targets", "yellow", r, g, b, #targets)
local class, _, _, _, _, r, g, b = _detalhes:GetClass (actor.nome)
GameCooltip:AddStatusBar (100, 1, r, g, b, 1)
for index, target in ipairs (targets) do
GameCooltip:AddLine (target[1], target [2])
_detalhes:AddTooltipBackgroundStatusbar()
local class, _, _, _, _, r, g, b = _detalhes:GetClass (target [1])
if (class and class ~= "UNKNOW") then
local texture, l, r, t, b = _detalhes:GetClassIcon (class)
GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small_alpha", 1, 1, 14, 14, l, r, t, b)
else
GameCooltip:AddIcon ("Interface\\GossipFrame\\IncompleteQuestIcon", 1, 1, 14, 14)
end
--
end
]],
total_script = [[
local value, top, total, combat, instance = ...
return floor (value)
]],
}
-- /run _detalhes:AddDefaultCustomDisplays()
local have = false
for _, custom in ipairs (self.custom) do
if (custom.name == "Crowd Control" and (custom.script_version and custom.script_version >= CC_Done.script_version) ) then
have = true
break
end
end
if (not have) then
setmetatable (CC_Done, _detalhes.atributo_custom)
CC_Done.__index = _detalhes.atributo_custom
for i, custom in ipairs (self.custom) do
if (custom.name == "Crowd Control") then
table.remove (self.custom, i)
tinsert (self.custom, i, CC_Done)
have = true
end
end
if (not have) then
self.custom [#self.custom+1] = CC_Done
end
end
----------------------------------------------------------------------------------------------------------------------------------------------------
local MySpells = {
+38 -3
View File
@@ -1892,6 +1892,33 @@ function _detalhes:AtualizaSegmentos_AfterCombat (instancia, historico)
end
local function ValidateAttribute (atributo, sub_atributo)
if (atributo == 1) then
if (sub_atributo < 0 or sub_atributo > _detalhes.atributos[1]) then
return false
end
elseif (atributo == 2) then
if (sub_atributo < 0 or sub_atributo > _detalhes.atributos[2]) then
return false
end
elseif (atributo == 3) then
if (sub_atributo < 0 or sub_atributo > _detalhes.atributos[3]) then
return false
end
elseif (atributo == 4) then
if (sub_atributo < 0 or sub_atributo > _detalhes.atributos[4]) then
return false
end
elseif (atributo == 5) then
return true
else
return false
end
return true
end
function _detalhes:SetDisplay (segmento, atributo, sub_atributo, iniciando_instancia, InstanceMode)
if (not self.meu_id) then
return
@@ -1916,7 +1943,7 @@ function _detalhes:TrocaTabela (instancia, segmento, atributo, sub_atributo, ini
segmento = instancia
instancia = self
end
if (InstanceMode and InstanceMode ~= instancia:GetMode()) then
instancia:AlteraModo (instancia, InstanceMode)
end
@@ -1992,6 +2019,12 @@ function _detalhes:TrocaTabela (instancia, segmento, atributo, sub_atributo, ini
return
end
if (not ValidateAttribute (atributo, sub_atributo)) then
sub_atributo = 1
atributo = 1
_detalhes:Msg ("invalid attribute, switching to damage done.")
end
--> Muda o segmento caso necessário
if (segmento ~= current_segmento or _detalhes.initializing or iniciando_instancia) then
@@ -2397,6 +2430,8 @@ function _detalhes:MontaAtributosOption (instancia, func)
CoolTip:SetOption ("SelectedTopAnchorMod", -2)
CoolTip:SetOption ("SelectedBottomAnchorMod", 2)
CoolTip:SetOption ("TextFont", _detalhes.font_faces.menus)
local last_selected = atributo_ativo
if (atributo_ativo == 5) then
last_selected = 6
@@ -2777,6 +2812,7 @@ function _detalhes:monta_relatorio (este_relatorio, custom)
total, container, first, container_amount, nm = _detalhes.atributo_custom:RefreshWindow (self, self.showing, true, true)
if (nm) then
name_member = nm
print ("nm:", nm)
end
keyName = "report_value"
else
@@ -2788,7 +2824,6 @@ function _detalhes:monta_relatorio (este_relatorio, custom)
--print (total, keyName, first, atributo, container_amount)
end
amt = math.min (amt, container_amount or 0)
--amt é zero
for i = 1, amt do
@@ -2803,7 +2838,7 @@ function _detalhes:monta_relatorio (este_relatorio, custom)
amount = _thisActor [keyName]
is_string = true
end
local name = _thisActor [name_member] .. " "
if (_detalhes.remove_realm_from_name and name:find ("-")) then
name = name:gsub (("%-.*"), "")
+120 -44
View File
@@ -198,53 +198,55 @@ function _detalhes:ToolTipDead (instancia, morte, esta_barra, keydown)
local time = event [4]
local source = event [6]
if (type (evtype) == "boolean") then
--> is damage or heal
if (evtype) then
--> damage
local overkill = event [10] or 0
if (overkill > 0) then
amount = amount - overkill
overkill = " (" .. _detalhes:ToK (overkill) .. " |cFFFF8800overkill|r)"
GameCooltip:AddLine ("" .. _cstr ("%.1f", time - hora_da_morte) .. "s |cFFFFFF00" .. spellname .. "|r (|cFFC6B0D9" .. source .. "|r)", "-" .. _detalhes:ToK (amount) .. overkill .. " (" .. hp .. "%)", 1, "white", "white")
if (time + 12 > hora_da_morte) then
if (type (evtype) == "boolean") then
--> is damage or heal
if (evtype) then
--> damage
local overkill = event [10] or 0
if (overkill > 0) then
amount = amount - overkill
overkill = " (" .. _detalhes:ToK (overkill) .. " |cFFFF8800overkill|r)"
GameCooltip:AddLine ("" .. _cstr ("%.1f", time - hora_da_morte) .. "s |cFFFFFF00" .. spellname .. "|r (|cFFC6B0D9" .. source .. "|r)", "-" .. _detalhes:ToK (amount) .. overkill .. " (" .. hp .. "%)", 1, "white", "white")
else
overkill = ""
GameCooltip:AddLine ("" .. _cstr ("%.1f", time - hora_da_morte) .. "s " .. spellname .. " (|cFFC6B0D9" .. source .. "|r)", "-" .. _detalhes:ToK (amount) .. overkill .. " (" .. hp .. "%)", 1, "white", "white")
end
GameCooltip:AddIcon (spellicon)
if (event [9]) then
--> friendly fire
GameCooltip:AddStatusBar (hp, 1, "darkorange", true)
else
--> from a enemy
GameCooltip:AddStatusBar (hp, 1, "red", true)
end
else
overkill = ""
GameCooltip:AddLine ("" .. _cstr ("%.1f", time - hora_da_morte) .. "s " .. spellname .. " (|cFFC6B0D9" .. source .. "|r)", "-" .. _detalhes:ToK (amount) .. overkill .. " (" .. hp .. "%)", 1, "white", "white")
--> heal
GameCooltip:AddLine ("" .. _cstr ("%.1f", time - hora_da_morte) .. "s " .. spellname .. " (|cFFC6B0D9" .. source .. "|r)", "+" .. _detalhes:ToK (amount) .. " (" .. hp .. "%)", 1, "white", "white")
GameCooltip:AddIcon (spellicon)
GameCooltip:AddStatusBar (hp, 1, "green", true)
end
GameCooltip:AddIcon (spellicon)
if (event [9]) then
--> friendly fire
GameCooltip:AddStatusBar (hp, 1, "darkorange", true)
else
--> from a enemy
GameCooltip:AddStatusBar (hp, 1, "red", true)
elseif (type (evtype) == "number") then
if (evtype == 1) then
--> cooldown
GameCooltip:AddLine ("" .. _cstr ("%.1f", time - hora_da_morte) .. "s " .. spellname .. " (" .. source .. ")", "cooldown (" .. hp .. "%)", 1, "white", "white")
GameCooltip:AddIcon (spellicon)
GameCooltip:AddStatusBar (100, 1, "yellow", true)
elseif (evtype == 2 and not battleress) then
--> battle ress
battleress = event
elseif (evtype == 3) then
--> last cooldown used
lastcooldown = event
end
else
--> heal
GameCooltip:AddLine ("" .. _cstr ("%.1f", time - hora_da_morte) .. "s " .. spellname .. " (|cFFC6B0D9" .. source .. "|r)", "+" .. _detalhes:ToK (amount) .. " (" .. hp .. "%)", 1, "white", "white")
GameCooltip:AddIcon (spellicon)
GameCooltip:AddStatusBar (hp, 1, "green", true)
end
elseif (type (evtype) == "number") then
if (evtype == 1) then
--> cooldown
GameCooltip:AddLine ("" .. _cstr ("%.1f", time - hora_da_morte) .. "s " .. spellname .. " (" .. source .. ")", "cooldown (" .. hp .. "%)", 1, "white", "white")
GameCooltip:AddIcon (spellicon)
GameCooltip:AddStatusBar (100, 1, "yellow", true)
elseif (evtype == 2 and not battleress) then
--> battle ress
battleress = event
elseif (evtype == 3) then
--> last cooldown used
lastcooldown = event
end
end
end
@@ -278,6 +280,7 @@ function _detalhes:ToolTipDead (instancia, morte, esta_barra, keydown)
GameCooltip:SetOption ("LeftBorderSize", -4)
GameCooltip:SetOption ("RightBorderSize", 5)
GameCooltip:SetOption ("StatusBarTexture", [[Interface\AddOns\Details\images\bar4_reverse]])
GameCooltip:SetOption ("StatusBarTexture", [[Interface\AddOns\Details\images\BantoBar]])
GameCooltip:SetWallpaper (1, [[Interface\SPELLBOOK\Spellbook-Page-1]], {.6, 0.1, 0.64453125, 0}, {.8, .8, .8, 0.2}, true)
local myPoint = _detalhes.tooltip.anchor_point
@@ -334,11 +337,15 @@ function atributo_misc:ReportSingleDeadLine (morte, instancia)
local elapsed = _cstr ("%.1f", evento [4] - time_of_death) .."s"
local spellname, _, spellicon = _GetSpellInfo (evento [2])
local spelllink
if (evento [2] > 10) then
if (evento [2] == 1) then
spelllink = GetSpellLink (6603)
elseif (evento [2] > 10) then
spelllink = GetSpellLink (evento [2])
else
spelllink = spellname
end
local source = _detalhes:GetOnlyName (evento [6])
local amount = evento [3]
local hp = _math_floor (evento [5] / max_health * 100)
@@ -2350,6 +2357,12 @@ function atributo_misc:r_onlyrefresh_shadow (actor)
_detalhes.refresh:r_atributo_misc (actor, shadow)
--> cc done
if (actor.cc_done) then
refresh_alvos (shadow.cc_done_targets, actor.cc_done_targets)
refresh_habilidades (shadow.cc_done_spells, actor.cc_done_spells)
end
--> cooldowns
if (actor.cooldowns_defensive) then
refresh_alvos (shadow.cooldowns_defensive_targets, actor.cooldowns_defensive_targets)
@@ -2463,6 +2476,19 @@ function atributo_misc:r_connect_shadow (actor, no_refresh)
_detalhes.refresh:r_atributo_misc (actor, shadow)
end
if (actor.cc_done) then
if (not shadow.cc_done_targets) then
shadow.cc_done = _detalhes:GetOrderNumber()
shadow.cc_done_targets = {}
shadow.cc_done_spells = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS)
end
shadow.cc_done = shadow.cc_done + actor.cc_done
somar_alvos (shadow.cc_done_targets, actor.cc_done_targets)
somar_habilidades (shadow.cc_done_spells, actor.cc_done_spells)
end
if (actor.cooldowns_defensive) then
if (not shadow.cooldowns_defensive_targets) then
shadow.cooldowns_defensive = _detalhes:GetOrderNumber (actor.nome)
@@ -2650,6 +2676,16 @@ function _detalhes.refresh:r_atributo_misc (este_jogador, shadow)
_setmetatable (este_jogador, _detalhes.atributo_misc)
este_jogador.__index = _detalhes.atributo_misc
--> refresh cc done
if (este_jogador.cc_done) then
if (shadow and not shadow.cc_done_targets) then
shadow.cc_done = 0
shadow.cc_done_targets = {}
shadow.cc_done_spells = container_habilidades:NovoContainer (_detalhes.container_type.CONTAINER_MISC_CLASS)
end
_detalhes.refresh:r_container_habilidades (este_jogador.cc_done_spells, shadow and shadow.cc_done_spells)
end
--> refresh interrupts
if (este_jogador.interrupt_targets) then
if (shadow and not shadow.interrupt_targets) then
@@ -2740,6 +2776,10 @@ function _detalhes.clear:c_atributo_misc (este_jogador)
este_jogador.links = nil
este_jogador.minha_barra = nil
if (este_jogador.cc_done_targets) then
_detalhes.clear:c_container_habilidades (este_jogador.cc_done_spells)
end
if (este_jogador.interrupt_targets) then
_detalhes.clear:c_container_habilidades (este_jogador.interrupt_spells)
end
@@ -2772,6 +2812,24 @@ end
atributo_misc.__add = function (tabela1, tabela2)
if (tabela2.cc_done) then
tabela1.cc_done = tabela1.cc_done + tabela2.cc_done
for target_name, amount in _pairs (tabela2.cc_done_targets) do
tabela1.cc_done_targets [target_name] = (tabela1.cc_done_targets [target_name] or 0) + amount
end
for spellid, habilidade in _pairs (tabela2.cc_done_spells._ActorTable) do
local habilidade_tabela1 = tabela1.cc_done_spells:PegaHabilidade (spellid, true, nil, false)
for target_name, amount in _pairs (habilidade.targets) do
habilidade_tabela1.targets [target_name] = (habilidade_tabela1.targets [target_name] or 0) + amount
end
somar_keys (habilidade, habilidade_tabela1)
end
end
if (tabela2.interrupt) then
if (not tabela1.interrupt) then
@@ -3012,6 +3070,24 @@ end
atributo_misc.__sub = function (tabela1, tabela2)
if (tabela2.cc_done) then
tabela1.cc_done = tabela1.cc_done - tabela2.cc_done
for target_name, amount in _pairs (tabela2.cc_done_targets) do
tabela1.cc_done_targets [target_name] = (tabela1.cc_done_targets [target_name] or 0) - amount
end
for spellid, habilidade in _pairs (tabela2.cc_done_spells._ActorTable) do
local habilidade_tabela1 = tabela1.cc_done_spells:PegaHabilidade (spellid, true, nil, false)
for target_name, amount in _pairs (habilidade.targets) do
habilidade_tabela1.targets [target_name] = (habilidade_tabela1.targets [target_name] or 0) - amount
end
subtrair_keys (habilidade, habilidade_tabela1)
end
end
if (tabela2.interrupt) then
--> total de interrupts
tabela1.interrupt = tabela1.interrupt - tabela2.interrupt
+5
View File
@@ -151,6 +151,11 @@ function historico:adicionar (tabela)
--print ("0x10")
end
if (not overall_added and (tabela.is_pvp or tabela.is_arena)) then --> is a PvP combat
overall_added = true
--print ("0x10")
end
if (overall_added) then
if (_detalhes.debug) then
_detalhes:Msg ("(debug) overall data flag match with the current combat.")