Code cleanup, framework update and bug fixes
This commit is contained in:
+36
-33
@@ -1156,41 +1156,42 @@ function atributo_misc:ToolTipCC (instancia, numero, barra)
|
||||
return true
|
||||
end
|
||||
|
||||
function atributo_misc:ToolTipDispell (instancia, numero, barra)
|
||||
|
||||
function atributo_misc:ToolTipDispell(instancia, numero, barra)
|
||||
local owner = self.owner
|
||||
if (owner and owner.classe) then
|
||||
r, g, b = unpack(_detalhes.class_colors [owner.classe])
|
||||
r, g, b = unpack(_detalhes.class_colors[owner.classe])
|
||||
else
|
||||
r, g, b = unpack(_detalhes.class_colors [self.classe])
|
||||
r, g, b = unpack(_detalhes.class_colors[self.classe])
|
||||
end
|
||||
|
||||
local meu_total = _math_floor(self ["dispell"])
|
||||
local totalDispels = math.floor(self["dispell"])
|
||||
local habilidades = self.dispell_spells._ActorTable
|
||||
|
||||
--habilidade usada para dispelar
|
||||
local meus_dispells = {}
|
||||
for _spellid, _tabela in pairs(habilidades) do
|
||||
if (_tabela.dispell) then
|
||||
meus_dispells [#meus_dispells+1] = {_spellid, _math_floor(_tabela.dispell)} --_math_floor valor é nil, uma magia na tabela de dispel, sem dispel?
|
||||
--habilidade usada para dispelar
|
||||
local spellsUsedToDispel = {}
|
||||
for spellId, spellTable in pairs(habilidades) do
|
||||
if (spellTable.dispell) then
|
||||
spellsUsedToDispel[#spellsUsedToDispel+1] = {spellId, math.floor(spellTable.dispell)}
|
||||
else
|
||||
Details:Msg("D! table.dispell is invalid. spellId:", _spellid)
|
||||
Details:Msg("D! table.dispell is invalid. spellId:", spellId)
|
||||
end
|
||||
end
|
||||
table.sort (meus_dispells, _detalhes.Sort2)
|
||||
table.sort (spellsUsedToDispel, _detalhes.Sort2)
|
||||
|
||||
_detalhes:AddTooltipSpellHeaderText (Loc ["STRING_SPELLS"], headerColor, #meus_dispells, [[Interface\ICONS\Spell_Arcane_ArcaneTorrent]], 0.078125, 0.9375, 0.078125, 0.953125)
|
||||
_detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha)
|
||||
_detalhes:AddTooltipSpellHeaderText(Loc ["STRING_SPELLS"], headerColor, #spellsUsedToDispel, [[Interface\ICONS\Spell_Arcane_ArcaneTorrent]], 0.078125, 0.9375, 0.078125, 0.953125)
|
||||
_detalhes:AddTooltipHeaderStatusbar(r, g, b, barAlha)
|
||||
|
||||
local icon_size = _detalhes.tooltip.icon_size
|
||||
local icon_border = _detalhes.tooltip.icon_border_texcoord
|
||||
|
||||
if (#meus_dispells > 0) then
|
||||
for i = 1, min (25, #meus_dispells) do
|
||||
local esta_habilidade = meus_dispells[i]
|
||||
local nome_magia, _, icone_magia = _GetSpellInfo(esta_habilidade[1])
|
||||
GameCooltip:AddLine(nome_magia, esta_habilidade[2].." (".._cstr("%.1f", esta_habilidade[2]/meu_total*100).."%)")
|
||||
GameCooltip:AddIcon (icone_magia, nil, nil, icon_size.W, icon_size.H, icon_border.L, icon_border.R, icon_border.T, icon_border.B)
|
||||
if (#spellsUsedToDispel > 0) then
|
||||
for i = 1, math.min(25, #spellsUsedToDispel) do
|
||||
local spellInfo = spellsUsedToDispel[i]
|
||||
local spellId = spellInfo[1]
|
||||
local amountDispels = spellInfo[2]
|
||||
local spellName, _, spellicon = _GetSpellInfo(spellId)
|
||||
GameCooltip:AddLine(spellName, amountDispels .. " (" .. string.format("%.1f", amountDispels / totalDispels * 100) .. "%)")
|
||||
GameCooltip:AddIcon(spellicon, nil, nil, icon_size.W, icon_size.H, icon_border.L, icon_border.R, icon_border.T, icon_border.B)
|
||||
_detalhes:AddTooltipBackgroundStatusbar()
|
||||
end
|
||||
else
|
||||
@@ -1198,21 +1199,23 @@ function atributo_misc:ToolTipDispell (instancia, numero, barra)
|
||||
end
|
||||
|
||||
--quais habilidades foram dispaladas
|
||||
local buffs_dispelados = {}
|
||||
for _spellid, amt in pairs(self.dispell_oque) do
|
||||
buffs_dispelados [#buffs_dispelados+1] = {_spellid, amt}
|
||||
local dispelledSpells = {}
|
||||
for spellId, amount in pairs(self.dispell_oque) do
|
||||
dispelledSpells[#dispelledSpells+1] = {spellId, amount}
|
||||
end
|
||||
table.sort (buffs_dispelados, _detalhes.Sort2)
|
||||
table.sort(dispelledSpells, _detalhes.Sort2)
|
||||
|
||||
_detalhes:AddTooltipSpellHeaderText (Loc ["STRING_DISPELLED"], headerColor, #buffs_dispelados, [[Interface\ICONS\Spell_Arcane_ManaTap]], 0.078125, 0.9375, 0.078125, 0.953125)
|
||||
_detalhes:AddTooltipHeaderStatusbar (r, g, b, barAlha)
|
||||
_detalhes:AddTooltipSpellHeaderText(Loc ["STRING_DISPELLED"], headerColor, #dispelledSpells, [[Interface\ICONS\Spell_Arcane_ManaTap]], 0.078125, 0.9375, 0.078125, 0.953125)
|
||||
_detalhes:AddTooltipHeaderStatusbar(r, g, b, barAlha)
|
||||
|
||||
if (#buffs_dispelados > 0) then
|
||||
for i = 1, min (25, #buffs_dispelados) do
|
||||
local esta_habilidade = buffs_dispelados[i]
|
||||
local nome_magia, _, icone_magia = _GetSpellInfo(esta_habilidade[1])
|
||||
GameCooltip:AddLine(nome_magia, esta_habilidade[2].." (".._cstr("%.1f", esta_habilidade[2]/meu_total*100).."%)")
|
||||
GameCooltip:AddIcon (icone_magia, nil, nil, icon_size.W, icon_size.H, icon_border.L, icon_border.R, icon_border.T, icon_border.B)
|
||||
if (#dispelledSpells > 0) then
|
||||
for i = 1, math.min(25, #dispelledSpells) do
|
||||
local spellInfo = dispelledSpells[i]
|
||||
local spellId = spellInfo[1]
|
||||
local amountDispels = spellInfo[2]
|
||||
local spellName, _, spellIcon = _GetSpellInfo(spellId)
|
||||
GameCooltip:AddLine(spellName, amountDispels .. " (" .. string.format("%.1f", amountDispels / totalDispels * 100) .. "%)")
|
||||
GameCooltip:AddIcon (spellIcon, nil, nil, icon_size.W, icon_size.H, icon_border.L, icon_border.R, icon_border.T, icon_border.B)
|
||||
_detalhes:AddTooltipBackgroundStatusbar()
|
||||
end
|
||||
end
|
||||
@@ -1221,7 +1224,7 @@ function atributo_misc:ToolTipDispell (instancia, numero, barra)
|
||||
|
||||
local alvos_dispelados = {}
|
||||
for target_name, amount in pairs(self.dispell_targets) do
|
||||
alvos_dispelados [#alvos_dispelados + 1] = {target_name, _math_floor(amount), amount / meu_total * 100}
|
||||
alvos_dispelados [#alvos_dispelados + 1] = {target_name, _math_floor(amount), amount / totalDispels * 100}
|
||||
end
|
||||
table.sort (alvos_dispelados, _detalhes.Sort2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user