- Fixed combat initialization when the player start casting a Dot spell.

- Added new custom display: Damage Taken By Spell.
This commit is contained in:
tercio
2014-10-31 18:48:03 -02:00
parent 4dd789e3f9
commit 1ab15245b4
6 changed files with 236 additions and 21 deletions
+8 -7
View File
File diff suppressed because one or more lines are too long
+182 -11
View File
@@ -176,6 +176,10 @@
return _detalhes:EndRefresh (instance, total, combat, combat [container_index])
end
if (amount > #instance_container._ActorTable) then
amount = #instance_container._ActorTable
end
combat.totals [custom_object:GetName()] = total
instance_container:Sort()
@@ -478,7 +482,15 @@
-- update tooltip function--
actor_class_color_r, actor_class_color_g, actor_class_color_b = self:GetBarColor()
if (self.id) then
local school_color = _detalhes.school_colors [self.classe]
if (not school_color) then
school_color = _detalhes.school_colors ["unknown"]
end
actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack (school_color)
else
actor_class_color_r, actor_class_color_g, actor_class_color_b = self:GetBarColor()
end
self:RefreshBarra2 (row, instance, previous_table, is_forced, row_value, index, row_container)
@@ -558,7 +570,15 @@
function atributo_custom:RefreshBarra (esta_barra, instancia, from_resize)
if (from_resize) then
actor_class_color_r, actor_class_color_g, actor_class_color_b = self:GetBarColor()
if (self.id) then
local school_color = _detalhes.school_colors [self.classe]
if (not school_color) then
school_color = _detalhes.school_colors ["unknown"]
end
actor_class_color_r, actor_class_color_g, actor_class_color_b = _unpack (school_color)
else
actor_class_color_r, actor_class_color_g, actor_class_color_b = self:GetBarColor()
end
end
if (instancia.row_info.texture_class_colors) then
@@ -599,8 +619,13 @@
esta_barra.icone_classe:SetVertexColor (actor_class_color_r, actor_class_color_g, actor_class_color_b)
else
esta_barra.icone_classe:SetTexture (instancia.row_info.icon_file)
esta_barra.icone_classe:SetTexCoord (_unpack (CLASS_ICON_TCOORDS [self.classe])) --very slow method
if (self.id) then
esta_barra.icone_classe:SetTexCoord (0, 1, 0, 1)
esta_barra.icone_classe:SetTexture (self.icon)
else
esta_barra.icone_classe:SetTexture (instancia.row_info.icon_file)
esta_barra.icone_classe:SetTexCoord (_unpack (CLASS_ICON_TCOORDS [self.classe])) --very slow method
end
esta_barra.icone_classe:SetVertexColor (1, 1, 1)
end
@@ -712,12 +737,20 @@
function atributo_custom:UpdateClass (actors)
actors.new_actor.classe = actors.actor.classe
end
function atributo_custom:GetActorTable (actor)
local index = self._NameIndexTable [actor.nome]
if (index) then
return self._ActorTable [index]
else
--> if is a spell object
if (actor.id) then
local spellname = _GetSpellInfo (actor.id)
actor.nome = spellname
actor.classe = actor.spellschool
end
local new_actor = _setmetatable ({
nome = actor.nome,
classe = actor.classe,
@@ -726,11 +759,16 @@
new_actor.displayName = new_actor.nome
if (not new_actor.classe) then
new_actor.classe = _detalhes:GetClass (actor.nome) or "UNKNOW"
end
if (new_actor.classe == "UNGROUPPLAYER") then
atributo_custom:ScheduleTimer ("UpdateClass", 5, {new_actor = new_actor, actor = actor})
if (actor.id) then
new_actor.id = actor.id
new_actor.icon = select (3, _GetSpellInfo (actor.id))
else
if (not new_actor.classe) then
new_actor.classe = _detalhes:GetClass (actor.nome) or "UNKNOW"
end
if (new_actor.classe == "UNGROUPPLAYER") then
atributo_custom:ScheduleTimer ("UpdateClass", 5, {new_actor = new_actor, actor = actor})
end
end
index = #self._ActorTable+1
@@ -785,7 +823,16 @@
--> get the actor
local actor = self.my_actor
local r, g, b = actor:GetClassColor()
local r, g, b
if (actor.id) then
local school_color = _detalhes.school_colors [actor.classe]
if (not school_color) then
school_color = _detalhes.school_colors ["unknown"]
end
r, g, b = _unpack (school_color)
else
r, g, b = actor:GetClassColor()
end
_detalhes:AddTooltipSpellHeaderText (custom_object:GetName(), "yellow", 1, 0, 0, 0)
GameCooltip:AddIcon (custom_object:GetIcon(), 1, 1, 14, 14, 0.90625, 0.109375, 0.15625, 0.875)
@@ -1308,6 +1355,130 @@
self.custom [#self.custom+1] = HealActivityTime
end
---------------------------------------
local DamageTakenBySpell = {
name = Loc ["STRING_CUSTOM_DTBS"],
icon = [[Interface\ICONS\spell_mage_infernoblast]],
attribute = false,
spellid = false,
author = "Details!",
desc = Loc ["STRING_CUSTOM_DTBS_DESC"],
source = false,
target = false,
script = [[
--> get the parameters passed
local combat, instance_container, instance = ...
--> declade the values to return
local total, top, amount = 0, 0, 0
--> get a list of all damage actors
local AllDamageCharacters = combat:GetActorList (DETAILS_ATTRIBUTE_DAMAGE)
--> no amount increase for repeated spells
local NoRepeat = {}
--> do a loop amoung the actors
for index, character in ipairs (AllDamageCharacters) do
--> is the actor a enemy?
if (character:IsEnemy()) then
local AllSpells = character:GetSpellList()
for spellid, spell in pairs (AllSpells) do
if (spell.total >= 1 and spellid > 10) then
instance_container:AddValue (spell, spell.total)
total = total + spell.total
if (top < spell.total) then
top = spell.total
end
if (not NoRepeat [spellid]) then
amount = amount + 1
NoRepeat [spellid] = true
end
end
end
end
end
--> return
return total, top, amount
]],
tooltip = [[
--get the parameters passed
local actor, combat, instance = ...
--get the cooltip object (we do not use the convencional GameTooltip here)
local GameCooltip = GameCooltip
--Cooltip code
local from_spell = actor.id
--> get a list of all damage actors
local AllDamageCharacters = combat:GetActorList (DETAILS_ATTRIBUTE_DAMAGE)
--> hold the targets
local Targets = {}
for index, character in ipairs (AllDamageCharacters) do
if (character:IsEnemy()) then
local AllSpells = character:GetSpellList()
for spellid, spell in pairs (AllSpells) do
if (spellid == from_spell) then
for targetname, amount in pairs (spell.targets) do
local got = false
for index, t in ipairs (Targets) do
if (t[1] == targetname) then
t[2] = t[2] + amount
got = true
break
end
end
if (not got) then
Targets [#Targets+1] = {targetname, amount}
end
end
end
end
end
end
table.sort (Targets, _detalhes.Sort2)
for index, t in ipairs (Targets) do
GameCooltip:AddLine (t[1], _detalhes:ToK2 (t[2]))
_detalhes:AddTooltipBackgroundStatusbar()
local class = _detalhes:GetClass (t[1])
if (class) then
local texture, l, r, t, b = _detalhes:GetClassIcon (class)
GameCooltip:AddIcon (texture, 1, 1, 14, 14, l, r, t, b)
end
end
]],
}
local have = false
for _, custom in ipairs (self.custom) do
if (custom.name == Loc ["STRING_CUSTOM_DTBS"]) then
have = true
break
end
end
if (not have) then
setmetatable (DamageTakenBySpell, _detalhes.atributo_custom)
DamageTakenBySpell.__index = _detalhes.atributo_custom
self.custom [#self.custom+1] = DamageTakenBySpell
end
end
+25 -3
View File
@@ -146,6 +146,28 @@
return false
end
--[[ exported]] function _detalhes:IsNeutralOrEnemy()
if (self.flag_original) then
if (_bit_band (self.flag_original, 0x00000060) ~= 0) then
return true
end
end
return false
end
--[[ exported]] function _detalhes:IsEnemy()
if (self.flag_original) then
if (_bit_band (self.flag_original, 0x00000060) ~= 0) then
return true
end
end
return false
end
--[[ exported]] function _detalhes:GetSpellList()
return self.spells._ActorTable
end
-- enemies (sort function)
local sortEnemies = function (t1, t2)
local a = _bit_band (t1.flag_original, 0x00000060)
@@ -3312,7 +3334,7 @@ end
--> soma todos os demais valores
for key, value in _pairs (habilidade) do
if (_type (value) == "number") then
if (key ~= "id") then
if (key ~= "id" and key ~= "spellschool") then
if (not habilidade_shadow [key]) then
habilidade_shadow [key] = 0
end
@@ -3453,7 +3475,7 @@ atributo_damage.__add = function (tabela1, tabela2)
--> soma os valores da habilidade
for key, value in _pairs (habilidade) do
if (_type (value) == "number") then
if (key ~= "id") then
if (key ~= "id" and key ~= "spellschool") then
if (not habilidade_tabela1 [key]) then
habilidade_tabela1 [key] = 0
end
@@ -3515,7 +3537,7 @@ atributo_damage.__sub = function (tabela1, tabela2)
--> subtrai os valores da habilidade
for key, value in _pairs (habilidade) do
if (_type (value) == "number") then
if (key ~= "id") then
if (key ~= "id" and key ~= "spellschool") then
if (not habilidade_tabela1 [key]) then
habilidade_tabela1 [key] = 0
end
+1
View File
@@ -343,6 +343,7 @@
end
_detalhes.leaving_combat = true
_detalhes.last_combat_time = _tempo
if (_detalhes.schedule_remove_overall and not from_encounter_end and not InCombatLockdown()) then
if (_detalhes.debug) then
+8
View File
@@ -204,6 +204,13 @@
_detalhes:Msg ("First hit: " .. (link or "") .. " from " .. (who_name or "Unknown"))
end
_detalhes:EntrarEmCombate (who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags)
else
--> entrar em combate se for dot e for do jogador e o ultimo combate ter sido a mais de 10 segundos atrás
if (token == "SPELL_PERIODIC_DAMAGE" and who_name == _detalhes.playername) then
if (_detalhes.last_combat_time+10 < _tempo) then
_detalhes:EntrarEmCombate (who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags)
end
end
end
end
@@ -489,6 +496,7 @@
local spell = este_jogador.spell_tables._ActorTable [spellid]
if (not spell) then
spell = este_jogador.spell_tables:PegaHabilidade (spellid, true, token)
spell.spellschool = school
end
return spell_damage_func (spell, alvo_serial, alvo_name, alvo_flags, amount, who_name, resisted, blocked, absorbed, critical, glacing, token, multistrike, isoffhand)
+12
View File
@@ -461,8 +461,20 @@ function _detalhes:ApplyProfile (profile_name, nosave, is_copy)
local window = _detalhes.tabela_instancias [id]
if (not window.ativa) then
instance.snap [side] = nil
if ((side == 1 or side == 3) and (not instance.snap [1] and not instance.snap [3])) then
instance.horizontalSnap = false
elseif ((side == 2 or side == 4) and (not instance.snap [2] and not instance.snap [4])) then
instance.verticalSnap = false
end
end
end
if (not instance:IsEnabled()) then
for side, id in pairs (instance.snap) do
instance.snap [side] = nil
end
instance.horizontalSnap = false
instance.verticalSnap = false
end
end
end