- fix for tickets #189 and #186.

This commit is contained in:
Tercio
2017-05-07 16:21:47 -03:00
parent 0ea81a27ea
commit 025d339a44
9 changed files with 283 additions and 71 deletions
+40 -4
View File
@@ -102,6 +102,10 @@
return self.combat_counter
end
function combate:GetAlteranatePower()
return self.alternate_power
end
--return the name of the encounter or enemy
function combate:GetCombatName (try_find)
if (self.is_pvp) then
@@ -166,7 +170,7 @@
end
--return the total of a specific attribute
local power_table = {0, 1, 3, 6}
local power_table = {0, 1, 3, 6, 0, "alternatepower"}
function combate:GetTotal (attribute, subAttribute, onlyGroup)
if (attribute == 1 or attribute == 2) then
@@ -197,6 +201,12 @@
return 0
end
function combate:CreateAlternatePowerTable (actorName)
local t = {last = 0, total = 0}
self.alternate_power [actorName] = t
return t
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--> internals
@@ -252,6 +262,9 @@
esta_tabela.frags = {}
esta_tabela.frags_need_refresh = false
--> alternate power
esta_tabela.alternate_power = {}
--> time data container
esta_tabela.TimeData = _detalhes:TimeDataCreateCombatTables()
esta_tabela.PhaseData = {{1, 1}, damage = {}, heal = {}, damage_section = {}, heal_section = {}} --[1] phase number [2] phase started
@@ -290,7 +303,8 @@
[0] = 0, --> mana
[1] = 0, --> rage
[3] = 0, --> energy (rogues cat)
[6] = 0 --> runepower (dk)
[6] = 0, --> runepower (dk)
alternatepower = 0,
},
{--> misc
cc_break = 0, --> armazena quantas quebras de CC
@@ -316,7 +330,8 @@
[0] = 0, --> mana
[1] = 0, --> rage
[3] = 0, --> energy (rogues cat)
[6] = 0 --> runepower (dk)
[6] = 0, --> runepower (dk)
alternatepower = 0,
},
{--> misc
cc_break = 0, --> armazena quantas quebras de CC
@@ -467,7 +482,17 @@
end
end
combate1.frags_need_refresh = true
--> alternate power
local overallPowerTable = combate1.alternate_power
for actorName, powerTable in pairs (combate2.alternate_power) do
local power = overallPowerTable [actorName]
if (power) then
power.total = power.total - powerTable.total
end
combate2.alternate_power [actorName].last = 0
end
return combate1
end
@@ -495,6 +520,17 @@
shadow.grupo = actor.grupo
end
end
--> alternate power
local overallPowerTable = combate1.alternate_power
for actorName, powerTable in pairs (combate2.alternate_power) do
local power = overallPowerTable [actorName]
if (not power) then
power = combate1:CreateAlternatePowerTable (actorName)
end
power.total = power.total + powerTable.total
combate2.alternate_power [actorName].last = 0
end
return combate1
end
+91 -34
View File
@@ -76,6 +76,7 @@ function atributo_energy:NovaTabela (serial, nome, link)
total = alphabetical,
received = alphabetical,
resource = alphabetical,
alternatepower = alphabetical,
last_value = nil,
@@ -146,6 +147,10 @@ local sort_energy = function (t1, t2)
end
end
local sort_energyalternate = function (t1, t2)
return t1.alternatepower > t2.alternatepower
end
local sort_energy_group = function (t1, t2)
if (t1.grupo and t2.grupo) then
if (t1.powertype == power_type and t2.powertype == power_type) then
@@ -168,6 +173,20 @@ local sort_energy_group = function (t1, t2)
end
end
local sort_alternateenergy_group = function (t1, t2)
if (t1.grupo and t2.grupo) then
return t1.alternatepower > t2.alternatepower
else
if (t1.grupo) then
return true
elseif (t2.grupo) then
return false
else
return t1.alternatepower > t2.alternatepower
end
end
end
--> resource refresh
local function RefreshBarraResources (tabela, barra, instancia)
@@ -341,58 +360,93 @@ function atributo_energy:RefreshWindow (instancia, tabela_do_combate, forcar, ex
keyName = "received"
if (sub_atributo == 6) then
keyName = "alternatepower"
end
if (exportar) then
if (_type (exportar) == "boolean") then
keyName = "received"
--keyName = "received"
else
keyName = exportar.key
modo = exportar.modo
end
else
keyName = "received"
--keyName = "received"
end
if (modo == modo_ALL) then
_table_sort (conteudo, sort_energy)
_table_sort (conteudo, sort_energyalternate)
for i = amount, 1, -1 do
if (conteudo[i].received < 1) then
amount = amount-1
elseif (conteudo[i].powertype ~= power_type) then
amount = amount-1
else
break
end
end
total = tabela_do_combate.totals [class_type] [power_type]
instancia.top = conteudo[1].received
elseif (modo == modo_GROUP) then
_table_sort (conteudo, sort_energy_group)
for index, player in _ipairs (conteudo) do
if (player.grupo) then
if (player.received < 1) then
amount = index - 1
break
elseif (player.powertype ~= power_type) then
amount = index - 1
if (keyName == "alternatepower") then
for i = amount, 1, -1 do
if (conteudo[i].alternatepower < 1) then
amount = amount-1
else
break
end
total = total + player.received
else
amount = index-1
break
end
total = tabela_do_combate.totals [class_type] ["alternatepower"]
instancia.top = conteudo[1].alternatepower
else
for i = amount, 1, -1 do
if (conteudo[i].received < 1) then
amount = amount-1
elseif (conteudo[i].powertype ~= power_type) then
amount = amount-1
else
break
end
end
total = tabela_do_combate.totals [class_type] [power_type]
instancia.top = conteudo[1].received
end
instancia.top = conteudo[1].received
elseif (modo == modo_GROUP) then
if (keyName == "alternatepower") then
_table_sort (conteudo, sort_alternateenergy_group)
for index, player in _ipairs (conteudo) do
if (player.grupo) then
if (player.alternatepower < 1) then
amount = index - 1
break
end
total = total + player.alternatepower
else
amount = index-1
break
end
end
instancia.top = conteudo[1].alternatepower
else
_table_sort (conteudo, sort_energy_group)
for index, player in _ipairs (conteudo) do
if (player.grupo) then
if (player.received < 1) then
amount = index - 1
break
elseif (player.powertype ~= power_type) then
amount = index - 1
break
end
total = total + player.received
else
amount = index-1
break
end
end
instancia.top = conteudo[1].received
end
end
showing:remapear()
@@ -1369,6 +1423,7 @@ end
--> total das energias (captura de dados)
shadow.total = shadow.total + actor.total
shadow.received = shadow.received + actor.received
shadow.alternatepower = shadow.alternatepower + actor.alternatepower
if (not actor.powertype) then
--print ("actor without powertype", actor.nome, actor.powertype)
@@ -1449,6 +1504,7 @@ atributo_energy.__add = function (tabela1, tabela2)
--> total and received
tabela1.total = tabela1.total + tabela2.total
tabela1.received = tabela1.received + tabela2.received
tabela1.alternatepower = tabela1.alternatepower + tabela2.alternatepower
--> targets
for target_name, amount in _pairs (tabela2.targets) do
@@ -1486,6 +1542,7 @@ atributo_energy.__sub = function (tabela1, tabela2)
--> total and received
tabela1.total = tabela1.total - tabela2.total
tabela1.received = tabela1.received - tabela2.received
tabela1.alternatepower = tabela1.alternatepower - tabela2.alternatepower
--> targets
for target_name, amount in _pairs (tabela2.targets) do
+57 -2
View File
@@ -266,7 +266,7 @@ function atributo_heal:RefreshWindow (instancia, tabela_do_combate, forcar, expo
--> grava o total
instancia.top = conteudo[1][keyName]
elseif (instancia.modo == modo_ALL or sub_atributo == 5) then --> mostrando ALL
elseif (instancia.modo == modo_ALL or sub_atributo == 5 or sub_atributo == 7) then --> mostrando ALL
amount = _detalhes:ContainerSortHeal (conteudo, amount, keyName)
@@ -974,6 +974,7 @@ function atributo_heal:ToolTip_HealingDenied (instancia, numero, barra, keydown)
local spellList = {} --spells the player used to deny heal
local targetList = {} --all players affected
local spellsDenied = {} --all spells which had heal denied
local healersDenied = {} --heal denied on healers
local icon_size = _detalhes.tooltip.icon_size
local icon_border = _detalhes.tooltip.icon_border_texcoord
@@ -992,6 +993,11 @@ function atributo_heal:ToolTip_HealingDenied (instancia, numero, barra, keydown)
for spellID, amount in _pairs (spell.heal_denied) do
spellsDenied [spellID] = (spellsDenied [spellID] or 0) + amount
end
--healers denied
for healerName, amount in _pairs (spell.heal_denied_healers) do
healersDenied [healerName] = (healersDenied [healerName] or 0) + amount
end
end
end
@@ -1110,7 +1116,38 @@ function atributo_heal:ToolTip_HealingDenied (instancia, numero, barra, keydown)
_detalhes:AddTooltipBackgroundStatusbar()
end
--healers denied
_detalhes:AddTooltipSpellHeaderText ("Healers", headerColor, #spellsSorted, [[Interface\TUTORIALFRAME\UI-TutorialFrame-LevelUp]], 0.10546875, 0.89453125, 0.05859375, 0.6796875)
_detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha)
local healersSorted = {}
for healerName, amount in _pairs (healersDenied) do
tinsert (healersSorted, {healerName, amount})
end
table.sort (healersSorted, _detalhes.Sort2)
for i = 1, #healersSorted do
local playerName, amountDenied = unpack (healersSorted [i])
GameCooltip:AddLine (playerName .. ": ", FormatTooltipNumber (_, amountDenied) .." (" .. _cstr ("%.1f", amountDenied / totalDenied * 100) .. "%)")
_detalhes:AddTooltipBackgroundStatusbar()
local targetActor = container:PegarCombatente (nil, playerName) or instancia.showing [1]:PegarCombatente (nil, playerName)
if (targetActor) then
local classe = targetActor.classe
if (not classe) then
classe = "UNKNOW"
end
if (classe == "UNKNOW") then
GameCooltip:AddIcon ("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, 14, 14, .25, .5, 0, 1)
else
GameCooltip:AddIcon ("Interface\\AddOns\\Details\\images\\classes_small", nil, nil, 14, 14, _unpack (_detalhes.class_coords [classe]))
end
end
end
return true
end
@@ -2348,12 +2385,18 @@ end
if (habilidade.heal_denied) then
--> cria o container na shadow de ele não existir
habilidade_shadow.heal_denied = habilidade_shadow.heal_denied or {}
habilidade_shadow.heal_denied_healers = habilidade_shadow.heal_denied_healers or {}
--> copia
for spellID, amount in _pairs (habilidade.heal_denied) do
if (not habilidade_shadow.heal_denied [spellID]) then
habilidade_shadow.heal_denied [spellID] = 0
end
end
for healerName, amount in _pairs (habilidade.heal_denied_healers) do
if (not habilidade_shadow.heal_denied_healers [healerName]) then
habilidade_shadow.heal_denied_healers [healerName] = 0
end
end
end
end
@@ -2464,10 +2507,14 @@ end
if (habilidade.heal_denied) then
--> cria o container na shadow de ele não existir
habilidade_shadow.heal_denied = habilidade_shadow.heal_denied or {}
habilidade_shadow.heal_denied_healers = habilidade_shadow.heal_denied_healers or {}
--> copia
for spellID, amount in _pairs (habilidade.heal_denied) do
habilidade_shadow.heal_denied [spellID] = (habilidade_shadow.heal_denied [spellID] or 0) + amount
end
for healerName, amount in _pairs (habilidade.heal_denied_healers) do
habilidade_shadow.heal_denied_healers [healerName] = (habilidade_shadow.heal_denied_healers [healerName] or 0) + amount
end
end
--> soma todos os demais valores
@@ -2570,10 +2617,14 @@ atributo_heal.__add = function (tabela1, tabela2)
if (habilidade.heal_denied) then
--> cria o container na shadow de ele não existir
habilidade_tabela1.heal_denied = habilidade_tabela1.heal_denied or {}
habilidade_tabela1.heal_denied_healers = habilidade_tabela1.heal_denied_healers or {}
--> copia
for spellID, amount in _pairs (habilidade.heal_denied) do
habilidade_tabela1.heal_denied [spellID] = (habilidade_tabela1.heal_denied [spellID] or 0) + amount
end
for healerName, amount in _pairs (habilidade.heal_denied_healers) do
habilidade_tabela1.heal_denied_healers [healerName] = (habilidade_tabela1.heal_denied_healers [healerName] or 0) + amount
end
end
--> soma os valores da habilidade
@@ -2676,10 +2727,14 @@ atributo_heal.__sub = function (tabela1, tabela2)
if (habilidade.heal_denied) then
--> cria o container na shadow de ele não existir
habilidade_tabela1.heal_denied = habilidade_tabela1.heal_denied or {}
habilidade_tabela1.heal_denied_healers = habilidade_tabela1.heal_denied_healers or {}
--> copia
for spellID, amount in _pairs (habilidade.heal_denied) do
habilidade_tabela1.heal_denied [spellID] = (habilidade_tabela1.heal_denied [spellID] or 0) - amount
end
for healerName, amount in _pairs (habilidade.heal_denied_healers) do
habilidade_tabela1.heal_denied_healers [healerName] = (habilidade_tabela1.heal_denied_healers [healerName] or 0) - amount
end
end
--> soma os valores da habilidade
+4 -1
View File
@@ -64,13 +64,16 @@
self.counter = self.counter + 1
self.totaldenied = self.totaldenied + amount
local healerName = critical
--create the denied table spells, on the fly
if (not self.heal_denied) then
self.heal_denied = {}
self.heal_denied_healers = {}
end
self.heal_denied [extraSpellID] = (self.heal_denied [extraSpellID] or 0) + amount
self.heal_denied_healers [healerName] = (self.heal_denied_healers [healerName] or 0) + amount
else
self.total = self.total + amount