- added custom display 'Damage on Shields'.

This commit is contained in:
Tercio
2017-05-28 15:19:05 -03:00
parent f04f4c33ac
commit 8fc0c0f758
4 changed files with 123 additions and 8 deletions
+5 -8
View File
File diff suppressed because one or more lines are too long
+101
View File
@@ -2471,6 +2471,107 @@
self.custom [#self.custom+1] = DynamicOverallDamage
end
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
local DamageOnShields = {
name = "Damage on Shields",
icon = [[Interface\ICONS\Spell_Holy_PowerWordShield]],
attribute = false,
spellid = false,
author = "Details!",
desc = "Damage done to shields",
source = false,
target = false,
script_version = 1,
script = [[
--get the parameters passed
local Combat, CustomContainer, Instance = ...
--declade the values to return
local total, top, amount = 0, 0, 0
--do the loop
for index, actor in ipairs (Combat:GetActorList(1)) do
if (actor:IsPlayer()) then
--get the actor total damage absorbed
local totalAbsorb = actor.totalabsorbed
--get the damage absorbed by all the actor pets
for petIndex, petName in ipairs (actor.pets) do
local pet = Combat :GetActor (1, petName)
if (pet) then
totalAbsorb = totalAbsorb + pet.totalabsorbed
end
end
--add the value to the actor on the custom container
CustomContainer:AddValue (actor, totalAbsorb)
end
end
--loop end
--if not managed inside the loop, get the values of total, top and amount
total, top = CustomContainer:GetTotalAndHighestValue()
amount = CustomContainer:GetNumActors()
--return the values
return total, top, amount
]],
tooltip = [[
--get the parameters passed
local actor, Combat, instance = ...
--get the cooltip object (we dont use the convencional GameTooltip here)
local GameCooltip = GameCooltip
--Cooltip code
--get the actor total damage absorbed
local totalAbsorb = actor.totalabsorbed
local format_func = Details:GetCurrentToKFunction()
--get the damage absorbed by all the actor pets
for petIndex, petName in ipairs (actor.pets) do
local pet = Combat :GetActor (1, petName)
if (pet) then
totalAbsorb = totalAbsorb + pet.totalabsorbed
end
end
GameCooltip:AddLine (actor:Name(), format_func (_, actor.totalabsorbed))
Details:AddTooltipBackgroundStatusbar()
for petIndex, petName in ipairs (actor.pets) do
local pet = Combat :GetActor (1, petName)
if (pet) then
totalAbsorb = totalAbsorb + pet.totalabsorbed
GameCooltip:AddLine (petName, format_func (_, pet.totalabsorbed))
Details:AddTooltipBackgroundStatusbar()
end
end
]],
}
local have = false
for _, custom in ipairs (self.custom) do
if (custom.name == "Damage on Shields" and (custom.script_version and custom.script_version >= DamageOnShields.script_version) ) then
have = true
break
end
end
if (not have) then
for i, custom in ipairs (self.custom) do
if (custom.name == "Damage on Shields") then
table.remove (self.custom, i)
end
end
setmetatable (DamageOnShields, _detalhes.atributo_custom)
DamageOnShields.__index = _detalhes.atributo_custom
self.custom [#self.custom+1] = DamageOnShields
end
---------------------------------------
_detalhes:ResetCustomFunctionsCache()
+5
View File
@@ -369,6 +369,7 @@
tipo = class_type,
total = alphabetical,
totalabsorbed = alphabetical,
total_without_pet = alphabetical,
custom = 0,
@@ -4854,6 +4855,7 @@ end
--> total de dano (captura de dados)
shadow.total = shadow.total + actor.total
shadow.totalabsorbed = shadow.totalabsorbed + actor.totalabsorbed
--> total de dano sem o pet (captura de dados)
shadow.total_without_pet = shadow.total_without_pet + actor.total_without_pet
--> total de dano que o ator sofreu (captura de dados)
@@ -4943,6 +4945,7 @@ atributo_damage.__add = function (tabela1, tabela2)
--> total de dano
tabela1.total = tabela1.total + tabela2.total
tabela1.totalabsorbed = tabela1.totalabsorbed + tabela2.totalabsorbed
--> total de dano sem o pet
tabela1.total_without_pet = tabela1.total_without_pet + tabela2.total_without_pet
--> total de dano que o cara levou
@@ -5022,6 +5025,8 @@ atributo_damage.__sub = function (tabela1, tabela2)
--> total de dano
tabela1.total = tabela1.total - tabela2.total
tabela1.totalabsorbed = tabela1.totalabsorbed - tabela2.totalabsorbed
--> total de dano sem o pet
tabela1.total_without_pet = tabela1.total_without_pet - tabela2.total_without_pet
--> total de dano que o cara levou
+12
View File
@@ -289,6 +289,11 @@
-- end
--end
-- if (absorbed and absorbed > 0) then
-- print ("dano absorbido", spellname, absorbed)
-- end
------------------------------------------------------------------------------------------------
--> check if need start an combat
@@ -823,6 +828,10 @@
--> get actors
--print ("MISS", "|", missType, "|", isOffHand, "|", amountMissed, "|", arg1)
--print (missType, who_name, spellname, amountMissed)
--> 'misser'
local este_jogador = damage_cache [who_serial]
if (not este_jogador) then
@@ -886,12 +895,15 @@
if (missType == "ABSORB") then
if (token == "SWING_MISSED") then
este_jogador.totalabsorbed = este_jogador.totalabsorbed + amountMissed
return parser:swing ("SWING_DAMAGE", time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, amountMissed, -1, 1, nil, nil, nil, false, false, false, false)
elseif (token == "RANGE_MISSED") then
este_jogador.totalabsorbed = este_jogador.totalabsorbed + amountMissed
return parser:range ("RANGE_DAMAGE", time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, amountMissed, -1, 1, nil, nil, nil, false, false, false, false)
else
este_jogador.totalabsorbed = este_jogador.totalabsorbed + amountMissed
return parser:spell_dmg (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype, amountMissed, -1, 1, nil, nil, nil, false, false, false, false)
end