You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

7218 lines
259 KiB

--Damage Class
--a damage object is created inside an actor container
--an actor container is created inside a combat object
--combat objects has 4 actor containers: damage, healing, energy, utility
--these containers are indexed within the combat object table: combatObject[1] = damage container, combatObject[2] = healing container, combatObject[3] = energy container, combatObject[4] = utility container
3 years ago
--damage object
local Details = _G.Details
5 months ago
local Loc = LibStub("AceLocale-3.0"):GetLocale( "Details" )
3 years ago
local Translit = LibStub("LibTranslit-1.0")
local gump = Details.gump
local _ = nil
local detailsFramework = DetailsFramework
local addonName, Details222 = ...
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--local pointers
3 years ago
local format = string.format --lua local
local tinsert = table.insert --lua local
local setmetatable = setmetatable --lua local
local _getmetatable = getmetatable --lua local
3 years ago
local ipairs = ipairs --lua local
local pairs = pairs --lua local
local abs = math.abs --lua local
local bitBand = bit.band --lua local
local unpack = unpack --lua local
local type = type --lua local
local GameTooltip = GameTooltip --api local
3 years ago
local IsInRaid = IsInRaid --api local
local IsInGroup = IsInGroup --api local
local GetSpellLink = GetSpellLink or C_Spell.GetSpellLink --api local
3 years ago
5 months ago
local CONST_MELEE_SPELLID = 6603
local CONST_AUTOSHOT_SPELLID = 75
local GetSpellInfo = Details222.GetSpellInfo --api local
local _GetSpellInfo = Details.getspellinfo --details api
3 years ago
local stringReplace = Details.string.replace --details api
--show more information about spells
local debugmode = false
3 years ago
local GetSpellTexture = GetSpellTexture or C_Spell.GetSpellTexture
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--constants
local spellContainerClass = Details.container_habilidades
local damageClass = Details.atributo_damage
local atributo_misc = Details.atributo_misc
local container_damage = Details.container_type.CONTAINER_DAMAGE_CLASS
local modo_ALL = Details.modos.all
local class_type = Details.atributos.dano
5 months ago
local ignoredEnemyNpcsTable = Details.IgnoredEnemyNpcsTable
local ToKFunctions = Details.ToKFunctions
5 months ago
local selectedToKFunction = ToKFunctions[1]
local formatTooltipNumber = ToKFunctions[8]
local bUsingCustomLeftText = false
local bUsingCustomRightText = false
local tooltipMaximizedMethod = 1
5 months ago
--templates
local byspell_tooltip_background = {value = 100, color = {0.1960, 0.1960, 0.1960, 0.9097}, texture = [[Interface\AddOns\Details\images\bar_background_dark]]}
local enemies_background = {value = 100, color = {0.1960, 0.1960, 0.1960, 0.8697}, texture = "Interface\\AddOns\\Details\\images\\bar_background2"}
Details.tooltip_key_overlay1 = {1, 1, 1, .2}
Details.tooltip_key_overlay2 = {1, 1, 1, .5}
5 months ago
local headerColor = {1, 0.9, 0.0, 1}
local spectator = "Commentator"
Details._spectator = spectator
3 years ago
5 months ago
local is_player_class = Details.player_class
local numbertostring = detailsFramework.CatchString
local koKRStart = numbertostring(234) --rectangle
Details.tooltip_key_size_width = 24
Details.tooltip_key_size_height = 10
local breakdownWindowFrame = Details.BreakdownWindowFrame
5 months ago
local keyName
3 years ago
local ntable = {} --temp
local vtable = {} --temp
local tooltip_void_zone_temp = {} --temp
local bs_table = {} --temp
local bs_index_table = {} --temp
local bs_tooltip_table
local frags_tooltip_table
local tooltip_temp_table = {}
--damage mixin
local damageClassMixin = {}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--exported functions
3 years ago
function Details:CreateActorLastEventTable() --[[exported]]
local t = { {}, {}, {}, {}, {}, {}, {}, {} }
t.n = 1
return t
end
function damageClass:CreateFFTable(targetName) --[[exported]]
3 years ago
local newTable = {total = 0, spells = {}}
self.friendlyfire[targetName] = newTable
return newTable
end
3 years ago
function Details:CreateActorAvoidanceTable(noOverall) --[[exported]]
if (noOverall) then
local avoidanceTable = {["ALL"] = 0, ["DODGE"] = 0, ["PARRY"] = 0, ["HITS"] = 0, ["ABSORB"] = 0, --quantas vezes foi dodge, parry, quandos hits tomou, quantos absorbs teve
["FULL_HIT"] = 0, ["FULL_ABSORBED"] = 0, ["PARTIAL_ABSORBED"] = 0, --full hit full absorbed and partial absortion
["FULL_HIT_AMT"] = 0, ["PARTIAL_ABSORB_AMT"] = 0, ["ABSORB_AMT"] = 0, ["FULL_ABSORB_AMT"] = 0, --amounts
["BLOCKED_HITS"] = 0, ["BLOCKED_AMT"] = 0, --amount of hits blocked - amout of damage mitigated
}
return avoidanceTable
else
local avoidanceTable = {
overall = {["ALL"] = 0, ["DODGE"] = 0, ["PARRY"] = 0, ["HITS"] = 0, ["ABSORB"] = 0, --quantas vezes foi dodge, parry, quandos hits tomou, quantos absorbs teve
["FULL_HIT"] = 0, ["FULL_ABSORBED"] = 0, ["PARTIAL_ABSORBED"] = 0, --full hit full absorbed and partial absortion
["FULL_HIT_AMT"] = 0, ["PARTIAL_ABSORB_AMT"] = 0, ["ABSORB_AMT"] = 0, ["FULL_ABSORB_AMT"] = 0, --amounts
["BLOCKED_HITS"] = 0, ["BLOCKED_AMT"] = 0, --amount of hits blocked - amout of damage mitigated
}
}
return avoidanceTable
end
end
3 years ago
function Details.SortGroup(container, keyName2) --[[exported]]
keyName = keyName2
5 months ago
return table.sort(container, Details.SortKeyGroup)
3 years ago
end
5 months ago
function Details.SortKeyGroup(table1, table2) --[[exported]]
3 years ago
if (table1.grupo and table2.grupo) then
return table1[keyName] > table2[keyName]
5 months ago
elseif(table1.grupo and not table2.grupo) then
3 years ago
return true
5 months ago
elseif(not table1.grupo and table2.grupo) then
3 years ago
return false
3 years ago
else
return table1[keyName] > table2[keyName]
end
end
3 years ago
function Details.SortKeySimple(table1, table2) --[[exported]]
3 years ago
return table1[keyName] > table2[keyName]
end
---sort by real time dps
---@param actor1 actor
---@param actor2 actor
---@return boolean
function Details.SortByRealTimeDps(actor1, actor2)
5 months ago
return(actor1.last_dps_realtime or 0) >(actor2.last_dps_realtime or 0)
end
3 years ago
5 months ago
function Details:ContainerSort(container, amount, keyName2) --[[exported]]
3 years ago
keyName = keyName2
5 months ago
table.sort(container, Details.SortKeySimple)
3 years ago
if (amount) then
for i = amount, 1, -1 do --de tr�s pra frente
if (container[i][keyName] < 1) then
amount = amount-1
else
break
end
3 years ago
end
return amount
end
end
---return true if the actor is a friendly npc
---@return boolean
3 years ago
function Details:IsFriendlyNpc() --[[exported]]
local flag = self.flag_original
if (flag) then
if (bitBand(flag, 0x00000008) ~= 0) then
if (bitBand(flag, 0x00000010) ~= 0) then
if (bitBand(flag, 0x00000800) ~= 0) then
return true
end
3 years ago
end
end
end
return false
end
function Details:IsEnemy() --[[exported]]
3 years ago
if (self.flag_original) then
if (bitBand(self.flag_original, 0x00000060) ~= 0) then
local npcId = Details:GetNpcIdFromGuid(self.serial)
if (ignoredEnemyNpcsTable[npcId]) then
return false
end
3 years ago
return true
end
end
return false
end
function Details:GetSpellList() --[[exported]]
3 years ago
return self.spells._ActorTable
end
function Details:GetTimeInCombat(petOwner) --[[exported]]
if (petOwner) then
if (Details.time_type == 1 or not petOwner.grupo) then
return self:Tempo()
5 months ago
elseif(Details.time_type == 2 or Details.use_realtimedps) then
return self:GetCombatTime()
end
else
if (Details.time_type == 1) then
return self:Tempo()
5 months ago
elseif(Details.time_type == 2 or Details.use_realtimedps) then
return self:GetCombatTime()
end
end
end
3 years ago
--enemies(sort function)
local sortEnemies = function(t1, t2)
local a = bitBand(t1.flag_original, 0x00000060)
local b = bitBand(t2.flag_original, 0x00000060)
3 years ago
if (a ~= 0 and b ~= 0) then
local npcid1 = Details:GetNpcIdFromGuid(t1.serial)
local npcid2 = Details:GetNpcIdFromGuid(t2.serial)
if (not ignoredEnemyNpcsTable[npcid1] and not ignoredEnemyNpcsTable[npcid2]) then
return t1.damage_taken > t2.damage_taken
5 months ago
elseif(ignoredEnemyNpcsTable[npcid1] and not ignoredEnemyNpcsTable[npcid2]) then
3 years ago
return false
5 months ago
elseif(not ignoredEnemyNpcsTable[npcid1] and ignoredEnemyNpcsTable[npcid2]) then
3 years ago
return true
else
return t1.damage_taken > t2.damage_taken
end
5 months ago
elseif(a ~= 0 and b == 0) then
3 years ago
return true
5 months ago
elseif(a == 0 and b ~= 0) then
3 years ago
return false
end
return false
end
5 months ago
function Details:ContainerSortEnemies(container, amount, keyName2) --[[exported]]
3 years ago
keyName = keyName2
5 months ago
table.sort(container, sortEnemies)
3 years ago
local total = 0
for index, player in ipairs(container) do
local npcid1 = Details:GetNpcIdFromGuid(player.serial)
5 months ago
--p rint(player.nome, npcid1, ignored_enemy_npcs [npcid1])
3 years ago
if (bitBand(player.flag_original, 0x00000060) ~= 0 and not ignoredEnemyNpcsTable [npcid1]) then --� um inimigo
total = total + player [keyName]
else
amount = index-1
break
end
end
return amount, total
end
5 months ago
function Details:TooltipForCustom(barra) --[[exported]]
3 years ago
GameCooltip:AddLine(Loc ["STRING_LEFT_CLICK_SHARE"])
return true
end
--[[ Void Zone Sort]]
3 years ago
local void_zone_sort = function(t1, t2)
if (t1.damage == t2.damage) then
return t1.nome <= t2.nome
else
return t1.damage > t2.damage
end
end
function Details.Sort1(table1, table2) --[[exported]]
3 years ago
return table1[1] > table2[1]
end
4 years ago
function Details.Sort2(table1, table2) --[[exported]]
3 years ago
return table1[2] > table2[2]
end
4 years ago
function Details.Sort3(table1, table2) --[[exported]]
3 years ago
return table1[3] > table2[3]
end
4 years ago
function Details.Sort4(table1, table2) --[[exported]]
3 years ago
return table1[4] > table2[4]
end
4 years ago
function Details.Sort4Reverse(table1, table2) --[[exported]]
3 years ago
if (not table2) then
return true
end
return table1[4] < table2[4]
end
4 years ago
function Details:GetTextColor(instanceObject, textSide)
local actorObject = self
textSide = textSide or "left"
local bUseClassColor = false
if (textSide == "left") then
bUseClassColor = instanceObject.row_info.textL_class_colors
5 months ago
elseif(textSide == "right") then
bUseClassColor = instanceObject.row_info.textR_class_colors
end
if (bUseClassColor) then
local actorClass = actorObject.classe or "UNKNOW"
if (actorClass == "UNKNOW") then
return unpack(instanceObject.row_info.fixed_text_color)
else
return unpack(Details.class_colors[actorClass])
end
else
return unpack(instanceObject.row_info.fixed_text_color)
end
end
3 years ago
function Details:GetBarColor(actor) --[[exported]]
actor = actor or self
3 years ago
if (actor.monster) then
return unpack(Details.class_colors.ENEMY)
4 years ago
5 months ago
elseif(actor.customColor) then
3 years ago
return unpack(actor.customColor)
5 months ago
elseif(actor.spellicon) then
3 years ago
return 0.729, 0.917, 1
5 months ago
elseif(actor.owner) then
3 years ago
return unpack(Details.class_colors[actor.owner.classe or "UNKNOW"])
5 months ago
elseif(actor.arena_team and Details.color_by_arena_team) then
3 years ago
if (actor.arena_team == 0) then
return unpack(Details.class_colors.ARENA_GREEN)
else
return unpack(Details.class_colors.ARENA_YELLOW)
end
else
if (not is_player_class[actor.classe] and actor.flag_original and bitBand(actor.flag_original, 0x00000020) ~= 0) then --neutral
return unpack(Details.class_colors.NEUTRAL)
5 months ago
elseif(actor.color) then
3 years ago
return unpack(actor.color)
else
return unpack(Details.class_colors[actor.classe or "UNKNOW"])
end
end
end
function Details:GetSpellLink(spellid) --[[exported]]
if (type(spellid) ~= "number") then
return spellid
end
if (spellid == 1) then --melee
5 months ago
return GetSpellLink(CONST_MELEE_SPELLID)
3 years ago
5 months ago
elseif(spellid == 2) then --autoshot
return GetSpellLink(CONST_AUTOSHOT_SPELLID)
3 years ago
5 months ago
elseif(spellid > 10) then
3 years ago
return GetSpellLink(spellid)
else
local spellname = _GetSpellInfo(spellid)
return spellname
end
end
function Details:GameTooltipSetSpellByID(spellId) --[[exported]]
if (spellId == 1) then
5 months ago
GameTooltip:SetSpellByID(CONST_MELEE_SPELLID)
3 years ago
5 months ago
elseif(spellId == 2) then
GameTooltip:SetSpellByID(CONST_AUTOSHOT_SPELLID)
3 years ago
5 months ago
elseif(spellId > 10) then
GameTooltip:SetSpellByID(spellId)
3 years ago
else
GameTooltip:SetSpellByID(spellId)
3 years ago
end
end
4 years ago
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--class ~constructor
---create a new actorObject and set the metatable to the actor prototype
---this function is called from within an actorContainer when it needs to create a new actorObject for a new actor
---actorObject is a ordinary table with the actor attributes and a metatable to inherit the functions from Details object
---@return table
function damageClass:NovaTabela() --create new actorObject
local alphabetical = Details:GetOrderNumber()
--constructor: creates a table with the actor attributes and then set the metatable to the actor prototype
local newDamageActor = {
--type of the actor
tipo = class_type,
3 years ago
--total: amount of damage done
total = alphabetical,
total_extra = 0,
--totalabsorbed: amount of damage done absorbed by shields
totalabsorbed = alphabetical,
--total_without_pet: amount of damage done without pet damage
total_without_pet = alphabetical,
--custom: used by custom scripts, works more like a cache
custom = 0,
3 years ago
--damage_taken: amount of damage the actor took during the combat
damage_taken = alphabetical,
--damage_from: table with actor names as keys and boolean true as value
damage_from = {},
3 years ago
--dps_started: is false until this actor does damage
dps_started = false,
--last_event: the time when the actor as last edited by a damage effect: suffered damage, did damage
last_event = 0,
--on_hold: if the actor is idle, doing nothing during combat, on_hold is true
on_hold = false,
--delay: the time when the actor went idle
delay = 0,
--caches
last_value = nil,
last_dps = 0, --cache of the latest dps value calculated for this actor
last_dps_realtime = 0, --cache of the latest real time dps value calculated for this actor
--start_time: the time when the actor started to do damage
start_time = 0,
--end_time: the time when the actor stopped to do damage
end_time = nil,
3 years ago
--table indexed with pet names
pets = {},
--table where key is the raid target flags and the value is the damage done to that target
raid_targets = {},
3 years ago
--friendlyfire_total: amount of damage done to friendly players
friendlyfire_total = 0,
--friendlyfire: table where key is a player name and value is a table with .total: damage inflicted and .spells a table with spell names as keys and damage done as value
friendlyfire = {},
5 months ago
--targets: table where key is the target name(actor name) and the value is the amount of damage done to that target
targets = {},
--spells: spell container
spells = spellContainerClass:NovoContainer(container_damage)
}
3 years ago
setmetatable(newDamageActor, damageClass)
detailsFramework:Mixin(newDamageActor, Details222.Mixins.ActorMixin)
detailsFramework:Mixin(newDamageActor, damageClassMixin)
3 years ago
return newDamageActor
end
3 years ago
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--special cases
---calculate real time dps for each actor within the passed table
---@param tableWithActors actor[]
---@return number
function damageClass:RefreshDpsRealTime(tableWithActors)
local totalRealTime = 0
local timeSample = Details222.CurrentDPS.GetTimeSample()
for _, actorObject in ipairs(tableWithActors) do
---@cast actorObject actordamage
---@type details_currentdps_actorcache
local realTimeDPS = Details222.CurrentDPS.Cache[actorObject.serial]
if (realTimeDPS) then
realTimeDPS = realTimeDPS.totalDamage / timeSample
actorObject.last_dps_realtime = realTimeDPS
totalRealTime = totalRealTime + realTimeDPS
end
end
return totalRealTime
end
5 months ago
--dps(calculate dps for actors)
---@param tableWithActors table
---@param combatTime combattime
---@return number, number
function damageClass:ContainerRefreshDps(tableWithActors, combatTime)
local total = 0
local totalRealTime = 0
local bIsEffectiveTime = Details.time_type == 2
local bOrderDpsByRealTime = Details.CurrentDps.CanSortByRealTimeDps()
local timeSample = Details222.CurrentDPS.GetTimeSample()
3 years ago
if (bIsEffectiveTime or not Details:CaptureGet("damage")) then
for _, actorObject in ipairs(tableWithActors) do
---@cast actorObject actordamage
if (actorObject.grupo) then
actorObject.last_dps = actorObject.total / combatTime
else
actorObject.last_dps = actorObject.total / actorObject:Tempo()
end
if (bOrderDpsByRealTime) then
---@type details_currentdps_actorcache
local realTimeDPS = Details222.CurrentDPS.Cache[actorObject.serial]
if (realTimeDPS) then
realTimeDPS = realTimeDPS.totalDamage / timeSample
actorObject.last_dps_realtime = realTimeDPS
totalRealTime = totalRealTime + realTimeDPS
end
end
total = total + actorObject.last_dps
end
else
for _, actorObject in ipairs(tableWithActors) do
actorObject.last_dps = actorObject.total / actorObject:Tempo()
total = total + actorObject.last_dps
if (bOrderDpsByRealTime) then
5 months ago
local realTimeDPS = Details222.CurrentDPS.Cache[actorObject.serial]
if (realTimeDPS) then
realTimeDPS = realTimeDPS.totalDamage / timeSample
actorObject.last_dps_realtime = realTimeDPS
totalRealTime = totalRealTime + realTimeDPS
end
end
end
end
3 years ago
return total, totalRealTime
3 years ago
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--damage taken by spell
5 months ago
function Details:ToolTipBySpell(instance, tabela, thisLine, keydown)
local GameCooltip = GameCooltip
local combat = instance.showing
local from_spell = tabela [1] --spellid
local from_spellname
if (from_spell) then
3 years ago
from_spellname = select(1, GetSpellInfo(from_spell))
end
3 years ago
--get a list of all damage actors
5 months ago
local AllDamageCharacters = combat:GetActorList(DETAILS_ATTRIBUTE_DAMAGE)
3 years ago
--hold the targets
local Targets = {}
local total = 0
local top = 0
local is_custom_spell = false
3 years ago
for _, spellcustom in ipairs(Details.savedCustomSpells) do
if (spellcustom[1] == from_spell) then
is_custom_spell = true
end
end
3 years ago
for index, character in ipairs(AllDamageCharacters) do
if (is_custom_spell) then
3 years ago
for playername, ff_table in pairs(character.friendlyfire) do
if (ff_table.spells [from_spell]) then
5 months ago
local damage_actor = combat(1, playername)
local heal_actor = combat(2, playername)
3 years ago
5 months ago
if ((damage_actor or heal_actor) and((damage_actor and damage_actor:IsPlayer()) or(heal_actor and heal_actor:IsPlayer()))) then
3 years ago
local got
3 years ago
for index, t in ipairs(Targets) do
if (t[1] == playername) then
t[2] = t[2] + ff_table.spells [from_spell]
total = total + ff_table.spells [from_spell]
if (t[2] > top) then
top = t[2]
end
got = true
break
end
end
3 years ago
if (not got) then
Targets [#Targets+1] = {playername, ff_table.spells [from_spell]}
total = total + ff_table.spells [from_spell]
if (ff_table.spells [from_spell] > top) then
top = ff_table.spells [from_spell]
end
end
end
end
end
else
3 years ago
for playername, ff_table in pairs(character.friendlyfire) do
for spellid, amount in pairs(ff_table.spells) do
local spellname = select(1, GetSpellInfo(spellid))
if (spellname == from_spellname) then
5 months ago
local damage_actor = combat(1, playername)
local heal_actor = combat(2, playername)
if ((damage_actor or heal_actor) and((damage_actor and damage_actor:IsPlayer()) or(heal_actor and heal_actor:IsPlayer()))) then
local got
3 years ago
for index, t in ipairs(Targets) do
if (t[1] == playername) then
t[2] = t[2] + amount
total = total + amount
if (t[2] > top) then
top = t[2]
end
got = true
break
end
end
3 years ago
if (not got) then
Targets [#Targets+1] = {playername, amount}
total = total + amount
if (amount > top) then
top = amount
end
3 years ago
end
end
3 years ago
end
end
end
end
3 years ago
--search actors which used the spell shown in the bar
local spell = character.spells._ActorTable [from_spell]
3 years ago
if (spell) then
3 years ago
for targetname, amount in pairs(spell.targets) do
local got = false
5 months ago
local damage_actor = combat(1, targetname)
local heal_actor = combat(2, targetname)
3 years ago
5 months ago
if ((damage_actor or heal_actor) and((damage_actor and damage_actor:IsPlayer()) or(heal_actor and heal_actor:IsPlayer()) ) ) then
3 years ago
for index, t in ipairs(Targets) do
if (t[1] == targetname) then
t[2] = t[2] + amount
total = total + amount
if (t[2] > top) then
top = t[2]
end
got = true
break
end
end
3 years ago
if (not got) then
Targets [#Targets+1] = {targetname, amount}
total = total + amount
if (amount > top) then
top = amount
end
end
end
end
end
3 years ago
if (not is_custom_spell) then
3 years ago
for spellid, spell in pairs(character.spells._ActorTable) do
if (spellid ~= from_spell) then
3 years ago
local spellname = select(1, GetSpellInfo(spellid))
if (spellname == from_spellname) then
3 years ago
for targetname, amount in pairs(spell.targets) do
local got = false
5 months ago
local damage_actor = combat(1, targetname)
local heal_actor = combat(2, targetname)
3 years ago
5 months ago
if ((damage_actor or heal_actor) and((damage_actor and damage_actor:IsPlayer()) or(heal_actor and heal_actor:IsPlayer()) ) ) then
3 years ago
for index, t in ipairs(Targets) do
if (t[1] == targetname) then
t[2] = t[2] + amount
total = total + amount
if (t[2] > top) then
top = t[2]
end
got = true
break
end
end
3 years ago
if (not got) then
Targets [#Targets+1] = {targetname, amount}
total = total + amount
if (amount > top) then
top = amount
end
end
end
end
3 years ago
end
end
end
end
end
5 months ago
table.sort(Targets, Details.Sort2)
bs_tooltip_table = Targets
bs_tooltip_table.damage_total = total
--Details:FormatCooltipForSpells()
3 years ago
GameCooltip:SetOption("StatusBarTexture", "Interface\\AddOns\\Details\\images\\bar_serenity")
3 years ago
local spellname, _, spellicon = select(1, _GetSpellInfo(from_spell))
--GameCooltip:AddLine(spellname .. " " .. Loc ["STRING_CUSTOM_ATTRIBUTE_DAMAGE"], nil, nil, headerColor, nil, 10)
5 months ago
--GameCooltip:AddIcon(spellicon, 1, 1, 14, 14, 0.078125, 0.921875, 0.078125, 0.921875)
--GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2)
--Details:AddTooltipHeaderStatusbar(1, 1, 1, 0.5)
3 years ago
local top = Targets[1] and Targets[1][2]
local iconSize = Details.DefaultTooltipIconSize
GameCooltip:SetOption("AlignAsBlizzTooltip", false)
GameCooltip:SetOption("AlignAsBlizzTooltipFrameHeightOffset", -6)
GameCooltip:SetOption("YSpacingMod", -6)
Details:AddRoundedCornerToTooltip()
3 years ago
for index, t in ipairs(Targets) do
5 months ago
GameCooltip:AddLine(Details:GetOnlyName(t[1]), Details:ToK(t[2]) .. "(" .. format("%.1f", t[2]/total*100) .. "%)")
3 years ago
local class, _, _, _, _, r, g, b = Details:GetClass(t[1])
5 months ago
GameCooltip:AddStatusBar(t[2]/top*100, 1, r, g, b, 0.8, false, byspell_tooltip_background)
3 years ago
if (class) then
local specID = Details:GetSpec(t[1])
if (specID) then
5 months ago
local texture, l, r, t, b = Details:GetSpecIcon(specID, false)
GameCooltip:AddIcon(texture, 1, 1, iconSize, iconSize, l, r, t, b)
else
local texture, l, r, t, b = Details:GetClassIcon(class)
5 months ago
GameCooltip:AddIcon("Interface\\AddOns\\Details\\images\\classes_small_alpha", 1, 1,iconSize,iconSize, l, r, t, b)
end
3 years ago
5 months ago
elseif(t[1] == Loc ["STRING_TARGETS_OTHER1"]) then
GameCooltip:AddIcon("Interface\\AddOns\\Details\\images\\classes_small_alpha", 1, 1,iconSize,iconSize, 0.25, 0.49609375, 0.75, 1)
end
end
3 years ago
GameCooltip:AddLine(" ")
Details:AddTooltipReportLineText()
3 years ago
GameCooltip:SetOwner(thisLine)
GameCooltip:Show()
end
3 years ago
5 months ago
local function RefreshBarraBySpell(tabela, barra, instancia)
damageClass:AtualizarBySpell(tabela, tabela.minha_barra, barra.colocacao, instancia)
end
3 years ago
local on_switch_DTBS_show = function(instance)
instance:TrocaTabela(instance, true, 1, 8)
return true
end
3 years ago
local DTBS_search_code = [[
---@type combat, table, instance
local combatObject, instanceContainer, instanceObject = ...
3 years ago
--declade the values to return
local totalDamage, topDamage, amount = 0, 0, 0
---@type {key1: actorname, key2: number, key3: actor}[]
local damageTakenFrom = {}
local spellId = @SPELLID@
local spellName
if (spellId) then
spellName = select(1, Details.GetSpellInfo(spellId))
end
---@type actorcontainer
local damageContainer = combatObject:GetContainer(DETAILS_ATTRIBUTE_DAMAGE)
---@type actorcontainer
local healContainer = combatObject:GetContainer(DETAILS_ATTRIBUTE_HEAL)
local bIsCustomSpell = false
for _, customSpellObject in ipairs(Details.savedCustomSpells) do
if (customSpellObject[1] == spellId) then
bIsCustomSpell = true
end
end
for index, actorObject in damageContainer:ListActors() do
---@cast actorObject actordamage
--> handle friendly fire spell damage taken
if (actorObject:IsPlayer()) then
if (bIsCustomSpell) then --if the spell has been modified, check only by its spellId, as it can't get other spells with the same name
for playerName, friendlyFireTable in pairs(actorObject.friendlyfire) do
---@cast friendlyFireTable friendlyfiretable
if (friendlyFireTable.spells[spellId]) then
---@type actordamage
local damageActor = damageContainer:GetActor(playerName)
---@type actorheal
local healingActor = healContainer:GetActor(playerName)
5 months ago
if ((damageActor and damageActor:IsPlayer()) or(healingActor and healingActor:IsPlayer())) then
local got
for index, damageTakenTable in ipairs(damageTakenFrom) do
if (damageTakenTable[1] == playerName) then
damageTakenTable[2] = damageTakenTable[2] + friendlyFireTable.spells[spellId]
if (damageTakenTable[2] > topDamage) then
topDamage = damageTakenTable[2]
end
got = true
break
end
end
if (not got) then
---@type {key1: actorname, key2: number, key3: actor}
local damageTakenTable = {playerName, friendlyFireTable.spells[spellId], damageActor or healingActor}
damageTakenFrom[#damageTakenFrom+1] = damageTakenTable
if (friendlyFireTable.spells[spellId] > topDamage) then
topDamage = friendlyFireTable.spells[spellId]
end
end
end
end
end
else
for playerName, friendlyFireTable in pairs(actorObject.friendlyfire) do
---@cast friendlyFireTable friendlyfiretable
for ffSpellId, damageAmount in pairs(friendlyFireTable.spells) do
local ffSpellName = select(1, Details.GetSpellInfo(ffSpellId))
if (ffSpellName == spellName) then
---@type actordamage
local damageActor = damageContainer:GetActor(playerName)
---@type actorheal
local healingActor = healContainer:GetActor(playerName)
5 months ago
if ((damageActor and damageActor:IsPlayer()) or(healingActor and healingActor:IsPlayer())) then
local got
for index, damageTakenTable in ipairs(damageTakenFrom) do
if (damageTakenTable[1] == playerName) then
damageTakenTable[2] = damageTakenTable[2] + damageAmount
if (damageTakenTable[2] > topDamage) then
topDamage = damageTakenTable[2]
end
got = true
break
end
end
if (not got) then
---@type {key1: actorname, key2: number, key3: actor}
local damageTakenTable = {playerName, damageAmount, damageActor or healingActor}
damageTakenFrom[#damageTakenFrom+1] = damageTakenTable
if (damageAmount > topDamage) then
topDamage = damageAmount
end
end
end
end
end
3 years ago
end
end
end
--> handle regular damage taken from spells
---@type spelltable
local spellTable = actorObject:GetSpell(spellId)
if (spellTable) then
for targetName, damageAmount in pairs(spellTable.targets) do
local got = false
---@type actordamage
local damageActor = damageContainer:GetActor(targetName)
---@type actorheal
local healingActor = healContainer:GetActor(targetName)
5 months ago
if ((damageActor and damageActor:IsPlayer()) or(healingActor and healingActor:IsPlayer())) then
for index, damageTakenTable in ipairs(damageTakenFrom) do
if (damageTakenTable[1] == targetName) then
damageTakenTable[2] = damageTakenTable[2] + damageAmount
if (damageTakenTable[2] > topDamage) then
topDamage = damageTakenTable[2]
end
got = true
break
end
end
if (not got) then
---@type {key1: actorname, key2: number, key3: actor}
local damageTakenTable = {targetName, damageAmount, damageActor or healingActor}
damageTakenFrom[#damageTakenFrom+1] = damageTakenTable
if (damageAmount > topDamage) then
topDamage = damageAmount
end
end
end
end
end
if (not bIsCustomSpell) then
for thisSpellId, spellTable in pairs(actorObject.spells._ActorTable) do
if (thisSpellId ~= spellId) then --this is invalid
local spellname = select(1, Details.GetSpellInfo(thisSpellId))
if (spellname == spellName) then
for targetName, damageAmount in pairs(spellTable.targets) do
local got = false
---@type actordamage
local damageActor = damageContainer:GetActor(targetName)
---@type actorheal
local healingActor = healContainer:GetActor(targetName)
5 months ago
if ((damageActor and damageActor:IsPlayer()) or(healingActor and healingActor:IsPlayer())) then
for index, damageTakenTable in ipairs(damageTakenFrom) do
if (damageTakenTable[1] == targetName) then
damageTakenTable[2] = damageTakenTable[2] + damageAmount
if (damageTakenTable[2] > topDamage) then
topDamage = damageTakenTable[2]
end
got = true
break
end
end
if (not got) then
---@type {key1: actorname, key2: number, key3: actor}
local damageTakenTable = {targetName, damageAmount, damageActor or healingActor}
damageTakenFrom[#damageTakenFrom+1] = damageTakenTable
if (damageAmount > topDamage) then
topDamage = damageAmount
end
end
end
end
end
end
3 years ago
end
end
end
table.sort(damageTakenFrom, Details.Sort2)
for index, damageTakenTable in ipairs(damageTakenFrom) do
instanceContainer:AddValue(damageTakenTable[3], damageTakenTable[2]) --actorObject, amountDamage
totalDamage = totalDamage + damageTakenTable[2] --amountDamage
amount = amount + 1
end
return totalDamage, topDamage, amount
3 years ago
]]
5 months ago
local function ShowDTBSInWindow(spell, instance) --for hold shift key and click, show players which took damage from this spell
3 years ago
local spellname, _, icon = _GetSpellInfo(spell [1])
local custom_name = spellname .. " - " .. Loc ["STRING_CUSTOM_DTBS"] .. ""
3 years ago
--check if already exists
3 years ago
for index, CustomObject in ipairs(Details.custom) do
if (CustomObject:GetName() == custom_name) then
3 years ago
--fix for not saving funcs on logout
if (not CustomObject.OnSwitchShow) then
CustomObject.OnSwitchShow = on_switch_DTBS_show
end
3 years ago
return instance:TrocaTabela(instance.segmento, 5, index)
end
end
3 years ago
--create a custom for this spell
local new_custom_object = {
name = custom_name,
icon = icon,
attribute = false,
author = Details.playername,
desc = spellname .. " " .. Loc ["STRING_CUSTOM_DTBS"],
source = false,
target = false,
script = false,
tooltip = false,
temp = true,
notooltip = true,
OnSwitchShow = on_switch_DTBS_show,
}
3 years ago
local new_code = DTBS_search_code
3 years ago
new_code = new_code:gsub("@SPELLID@", spell [1])
new_custom_object.script = new_code
3 years ago
tinsert(Details.custom, new_custom_object)
setmetatable(new_custom_object, Details.atributo_custom)
new_custom_object.__index = Details.atributo_custom
3 years ago
return instance:TrocaTabela(instance.segmento, 5, #Details.custom)
end
3 years ago
local DTBS_format_name = function(player_name) return Details:GetOnlyName(player_name) end
5 months ago
local DTBS_format_amount = function(amount) return Details:ToK(amount) .. "(" .. format("%.1f", amount / bs_tooltip_table.damage_total * 100) .. "%)" end
3 years ago
5 months ago
function damageClass:ReportSingleDTBSLine(spell, instance, ShiftKeyDown, ControlKeyDown)
if (ControlKeyDown) then
3 years ago
local spellname, _, spellicon = _GetSpellInfo(spell[1])
5 months ago
return Details:OpenAuraPanel(spell[1], spellname, spellicon)
elseif(ShiftKeyDown) then
return ShowDTBSInWindow(spell, instance)
end
3 years ago
local spelllink = Details:GetSpellLink(spell [1])
local report_table = {"Details!: " .. Loc ["STRING_CUSTOM_DTBS"] .. " " .. spelllink}
3 years ago
Details:FormatReportLines(report_table, bs_tooltip_table, DTBS_format_name, DTBS_format_amount)
return Details:Reportar(report_table, {_no_current = true, _no_inverse = true, _custom = true})
end
3 years ago
function damageClass:AtualizarBySpell(tabela, whichRowLine, colocacao, instance)
3 years ago
tabela ["byspell"] = true --marca que esta tabela � uma tabela de frags, usado no controla na hora de montar o tooltip
local thisLine = instance.barras [whichRowLine] --pega a refer�ncia da barra na janela
4 years ago
if (not thisLine) then
3 years ago
print("DEBUG: problema com <instance.thisLine> "..whichRowLine .. " " .. colocacao)
return
end
4 years ago
thisLine.minha_tabela = tabela
4 years ago
3 years ago
local spellName, _, spellIcon = _GetSpellInfo(tabela[1])
4 years ago
3 years ago
tabela.nome = spellName --evita dar erro ao redimencionar a janela
tabela.minha_barra = whichRowLine
thisLine.colocacao = colocacao
4 years ago
5 months ago
if (not _getmetatable(tabela)) then
setmetatable(tabela, {__call = RefreshBarraBySpell})
tabela._custom = true
end
4 years ago
local total = instance.showing.totals.by_spell
local porcentagem
4 years ago
if (instance.row_info.percent_type == 1) then
3 years ago
porcentagem = format("%.1f", tabela [2] / total * 100)
5 months ago
elseif(instance.row_info.percent_type == 2) then
3 years ago
porcentagem = format("%.1f", tabela [2] / instance.top * 100)
end
3 years ago
thisLine.lineText1:SetText(colocacao .. ". " .. spellName)
4 years ago
local bars_show_data = instance.row_info.textR_show_data
3 years ago
local spell_damage = tabela[2] -- spell_damage passar por uma ToK function, precisa ser number
if (not bars_show_data [1]) then
3 years ago
spell_damage = tabela[2] --damage taken by spell n�o tem PS, ent�o � obrigado a passar o dano total
end
3 years ago
if (not bars_show_data[3]) then
porcentagem = ""
else
porcentagem = porcentagem .. "%"
end
4 years ago
local bars_brackets = instance:GetBarBracket()
3 years ago
4 years ago
if (instance.use_multi_fontstrings) then
5 months ago
instance:SetInLineTexts(thisLine, "",(spell_damage and selectedToKFunction(_, spell_damage) or ""), porcentagem)
else
5 months ago
thisLine.lineText4:SetText((spell_damage and selectedToKFunction(_, spell_damage) or "") .. bars_brackets[1] .. porcentagem .. bars_brackets[2])
end
thisLine.lineText1:SetTextColor(1, 1, 1, 1)
thisLine.lineText2:SetTextColor(1, 1, 1, 1)
thisLine.lineText3:SetTextColor(1, 1, 1, 1)
thisLine.lineText4:SetTextColor(1, 1, 1, 1)
3 years ago
thisLine.lineText1:SetSize(thisLine:GetWidth() - thisLine.lineText4:GetStringWidth() - 20, 15)
if (colocacao == 1) then
3 years ago
thisLine:SetValue(100)
else
3 years ago
thisLine:SetValue(tabela[2] / instance.top * 100)
end
3 years ago
if (thisLine.hidden or thisLine.fading_in or thisLine.faded) then
3 years ago
Details.FadeHandler.Fader(thisLine, "out")
end
3 years ago
4 years ago
if (instance.row_info.texture_class_colors) then
if (tabela [3] > 1) then
3 years ago
local r, g, b = Details:GetSpellSchoolColor(tabela[3])
thisLine.textura:SetVertexColor(r, g, b)
else
3 years ago
local r, g, b = Details:GetSpellSchoolColor(0)
thisLine.textura:SetVertexColor(r, g, b)
end
end
3 years ago
thisLine.icone_classe:SetTexture(spellIcon)
thisLine.icone_classe:SetTexCoord(0.078125, 0.921875, 0.078125, 0.921875)
thisLine.icone_classe:SetVertexColor(1, 1, 1)
5 months ago
if (thisLine.mouse_over and not instance.baseframe.isMoving) then
local classIcon = thisLine:GetClassIcon()
thisLine.iconHighlight:SetTexture(classIcon:GetTexture())
thisLine.iconHighlight:SetTexCoord(classIcon:GetTexCoord())
thisLine.iconHighlight:SetVertexColor(classIcon:GetVertexColor())
end
end
3 years ago
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--frags
5 months ago
function Details:ToolTipFrags(instancia, frag, thisLine, keydown)
local name = frag [1]
local GameCooltip = GameCooltip
3 years ago
--mantendo a fun��o o mais low level poss�vel
local damage_container = instancia.showing [1]
3 years ago
local frag_actor = damage_container._ActorTable [damage_container._NameIndexTable [ name ]]
if (frag_actor) then
3 years ago
local damage_taken_table = {}
local took_damage_from = frag_actor.damage_from
local total_damage_taken = frag_actor.damage_taken
local total = 0
3 years ago
for aggressor, _ in pairs(took_damage_from) do
local damager_actor = damage_container._ActorTable [damage_container._NameIndexTable [ aggressor ]]
3 years ago
if (damager_actor and not damager_actor.owner) then --checagem por causa do total e do garbage collector que n�o limpa os names que deram dano
local target_amount = damager_actor.targets [name]
if (target_amount) then
damage_taken_table [#damage_taken_table+1] = {aggressor, target_amount, damager_actor.classe}
total = total + target_amount
end
end
end
3 years ago
5 months ago
table.sort(damage_taken_table, Details.Sort2)
3 years ago
local iconSize = Details.DefaultTooltipIconSize
GameCooltip:SetOption("AlignAsBlizzTooltip", false)
GameCooltip:SetOption("AlignAsBlizzTooltipFrameHeightOffset", -6)
GameCooltip:SetOption("YSpacingMod", -6)
Details:AddRoundedCornerToTooltip()
local min = 6
local ismaximized = false
--always maximized
5 months ago
if (true or keydown == "shift" or tooltipMaximizedMethod == 2 or tooltipMaximizedMethod == 3) then
min = 99
ismaximized = true
end
3 years ago
local top = damage_taken_table[1] and damage_taken_table[1][2]
frags_tooltip_table = damage_taken_table
frags_tooltip_table.damage_total = total
3 years ago
local lineHeight = Details.tooltip.line_height
3 years ago
if (#damage_taken_table > 0) then
5 months ago
for i = 1, math.min(min, #damage_taken_table) do
local t = damage_taken_table [i]
3 years ago
5 months ago
GameCooltip:AddLine(Details:GetOnlyName(t[1]), formatTooltipNumber(_, t[2]) .. "(" .. format("%.1f", t[2] / total * 100) .. "%)")
local classe = t[3]
if (not classe) then
classe = "UNKNOW"
end
3 years ago
if (classe == "UNKNOW") then
5 months ago
GameCooltip:AddIcon("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, iconSize, iconSize, .25, .5, 0, 1)
else
3 years ago
local specID = Details:GetSpec(t[1])
if (specID) then
5 months ago
local texture, l, r, t, b = Details:GetSpecIcon(specID, false)
GameCooltip:AddIcon(texture, 1, 1, iconSize, iconSize, l, r, t, b)
else
5 months ago
GameCooltip:AddIcon([[Interface\AddOns\Details\images\classes_small_alpha]], nil, nil, iconSize, iconSize, unpack(Details.class_coords [classe]))
end
end
3 years ago
local _, _, _, _, _, r, g, b = Details:GetClass(t[1])
5 months ago
GameCooltip:AddStatusBar(t[2] / top * 100, 1, r, g, b, 1, false, enemies_background)
end
else
3 years ago
GameCooltip:AddLine(Loc ["STRING_NO_DATA"], nil, 1, "white")
5 months ago
GameCooltip:AddIcon(instancia.row_info.icon_file, nil, nil, 14, 14, unpack(Details.class_coords ["UNKNOW"]))
end
3 years ago
GameCooltip:AddLine(" ")
Details:AddTooltipReportLineText()
3 years ago
GameCooltip:SetOption("StatusBarTexture", "Interface\\AddOns\\Details\\images\\bar_serenity")
GameCooltip:ShowCooltip()
end
3 years ago
end
5 months ago
local function RefreshBarraFrags(tabela, barra, instancia)
damageClass:AtualizarFrags(tabela, tabela.minha_barra, barra.colocacao, instancia)
end
function damageClass:AtualizarFrags(tabela, whichRowLine, colocacao, instancia)
3 years ago
tabela ["frags"] = true --marca que esta tabela � uma tabela de frags, usado no controla na hora de montar o tooltip
local thisLine = instancia.barras [whichRowLine] --pega a refer�ncia da barra na janela
if (not thisLine) then
3 years ago
print("DEBUG: problema com <instancia.thisLine> "..whichRowLine.." "..rank)
return
end
3 years ago
local previousData = thisLine.minha_tabela
3 years ago
thisLine.minha_tabela = tabela
3 years ago
tabela.nome = tabela [1] --evita dar erro ao redimencionar a janela
tabela.minha_barra = whichRowLine
thisLine.colocacao = colocacao
3 years ago
5 months ago
if (not _getmetatable(tabela)) then
setmetatable(tabela, {__call = RefreshBarraFrags})
tabela._custom = true
end
local total = instancia.showing.totals.frags_total
local porcentagem
3 years ago
if (instancia.row_info.percent_type == 1) then
3 years ago
porcentagem = format("%.1f", tabela [2] / total * 100)
5 months ago
elseif(instancia.row_info.percent_type == 2) then
3 years ago
porcentagem = format("%.1f", tabela [2] / instancia.top * 100)
end
3 years ago
thisLine.lineText1:SetText(colocacao .. ". " .. tabela [1])
local bars_show_data = instancia.row_info.textR_show_data
local bars_brackets = instancia:GetBarBracket()
3 years ago
local total_frags = tabela [2]
if (not bars_show_data [1]) then
total_frags = ""
end
if (not bars_show_data [3]) then
porcentagem = ""
else
porcentagem = porcentagem .. "%"
end
3 years ago
--
if (instancia.use_multi_fontstrings) then
instancia:SetInLineTexts(thisLine, "", total_frags, porcentagem)
else
3 years ago
thisLine.lineText4:SetText(total_frags .. bars_brackets[1] .. porcentagem .. bars_brackets[2])
end
3 years ago
thisLine.lineText1:SetSize(thisLine:GetWidth() - thisLine.lineText4:GetStringWidth() - 20, 15)
if (colocacao == 1) then
3 years ago
thisLine:SetValue(100)
else
3 years ago
thisLine:SetValue(tabela [2] / instancia.top * 100)
end
3 years ago
thisLine.lineText1:SetTextColor(1, 1, 1, 1)
thisLine.lineText4:SetTextColor(1, 1, 1, 1)
if (thisLine.hidden or thisLine.fading_in or thisLine.faded) then
3 years ago
Details.FadeHandler.Fader(thisLine, "out")
end
3 years ago
Details:SetBarColors(thisLine, instancia, unpack(Details.class_colors [tabela [3]]))
if (tabela [3] == "UNKNOW" or tabela [3] == "UNGROUPPLAYER" or tabela [3] == "ENEMY") then
3 years ago
thisLine.icone_classe:SetTexture([[Interface\AddOns\Details\images\classes_plus]])
thisLine.icone_classe:SetTexCoord(0.50390625, 0.62890625, 0, 0.125)
thisLine.icone_classe:SetVertexColor(1, 1, 1)
else
3 years ago
thisLine.icone_classe:SetTexture(instancia.row_info.icon_file)
thisLine.icone_classe:SetTexCoord(unpack(Details.class_coords [tabela [3]]))
thisLine.icone_classe:SetVertexColor(1, 1, 1)
end
3 years ago
if (thisLine.mouse_over and not instancia.baseframe.isMoving) then --precisa atualizar o tooltip
local classIcon = thisLine:GetClassIcon()
thisLine.iconHighlight:SetTexture(classIcon:GetTexture())
thisLine.iconHighlight:SetTexCoord(classIcon:GetTexCoord())
thisLine.iconHighlight:SetVertexColor(classIcon:GetVertexColor())
end
end
3 years ago
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--void zones
local on_switch_AVZ_show = function(instance)
instance:TrocaTabela(instance, true, 1, 7)
return true
end
3 years ago
local AVZ_search_code = [[
--get the parameters passed
local combat, instance_container, instance = ...
3 years ago
--declade the values to return
local total, top, amount = 0, 0, 0
3 years ago
local actor_name = "@ACTORNAME@"
5 months ago
local actor = combat(4, actor_name)
3 years ago
if (not actor) then
return 0, 0, 0
end
3 years ago
5 months ago
local damage_actor = combat(1, actor.damage_twin)
3 years ago
local habilidade
local alvos
3 years ago
if (damage_actor) then
habilidade = damage_actor.spells._ActorTable [actor.damage_spellid]
end
if (habilidade) then
alvos = habilidade.targets
end
3 years ago
local container = actor.debuff_uptime_targets
local tooltip_void_zone_temp = {}
3 years ago
for target_name, debuff_table in pairs(container) do
if (alvos) then
local damage_alvo = alvos [target_name]
if (damage_alvo) then
debuff_table.damage = damage_alvo
else
debuff_table.damage = 0
end
else
debuff_table.damage = 0
end
end
3 years ago
local i = 1
3 years ago
for target_name, debuff_table in pairs(container) do
local t = tooltip_void_zone_temp [i]
if (not t) then
t = {}
3 years ago
tinsert(tooltip_void_zone_temp, t)
end
3 years ago
5 months ago
local target_actor = combat(1, target_name) or combat(2, target_name) or combat(4, target_name)
t[1] = target_name
t[2] = debuff_table.damage
t[3] = debuff_table
t[4] = target_actor
3 years ago
i = i + 1
end
3 years ago
--sort no container:
5 months ago
table.sort(tooltip_void_zone_temp, Details.sort_tooltip_void_zones)
3 years ago
for index, t in ipairs(tooltip_void_zone_temp) do
5 months ago
instance_container:AddValue(t[4], t[2])
3 years ago
local custom_actor = instance_container:GetActorTable(t[4])
custom_actor.uptime = t[3].uptime
3 years ago
total = total + t[2]
amount = amount + 1
if (t[2] > top) then
top = t[2]
end
end
return total, top, amount
]]
3 years ago
local AVZ_total_code = [[
local value, top, total, combat, instance, custom_actor = ...
local uptime = custom_actor.uptime or 0
3 years ago
local minutos, segundos = floor(uptime / 60), floor(uptime % 60)
if (minutos > 0) then
uptime = "" .. minutos .. "m " .. segundos .. "s" .. ""
else
uptime = "" .. segundos .. "s" .. ""
end
3 years ago
return Details:ToK2(value) .. " - " .. uptime .. " "
]]
3 years ago
5 months ago
local function ShowVoidZonesInWindow(actor, instance)
3 years ago
local spellid = tooltip_void_zone_temp.spellid
3 years ago
local spellname, _, icon = _GetSpellInfo(spellid)
local custom_name = spellname .. " - " .. Loc ["STRING_ATTRIBUTE_DAMAGE_DEBUFFS_REPORT"] .. ""
3 years ago
--check if already exists
3 years ago
for index, CustomObject in ipairs(Details.custom) do
if (CustomObject:GetName() == custom_name) then
3 years ago
--fix for not saving funcs on logout
if (not CustomObject.OnSwitchShow) then
CustomObject.OnSwitchShow = on_switch_AVZ_show
end
3 years ago
return instance:TrocaTabela(instance.segmento, 5, index)
end
end
3 years ago
--create a custom for this spell
local new_custom_object = {
name = custom_name,
icon = icon,
attribute = false,
author = Details.playername,
desc = spellname .. " " .. Loc ["STRING_ATTRIBUTE_DAMAGE_DEBUFFS_REPORT"],
source = false,
target = false,
script = false,
tooltip = false,
temp = true,
notooltip = true,
OnSwitchShow = on_switch_AVZ_show,
}
3 years ago
local new_code = AVZ_search_code
3 years ago
new_code = new_code:gsub("@ACTORNAME@", actor.nome)
new_custom_object.script = new_code
3 years ago
local new_total_code = AVZ_total_code
3 years ago
new_total_code = new_total_code:gsub("@ACTORNAME@", actor.nome)
new_total_code = new_total_code:gsub("@SPELLID@", spellid)
new_custom_object.total_script = new_total_code
3 years ago
tinsert(Details.custom, new_custom_object)
setmetatable(new_custom_object, Details.atributo_custom)
new_custom_object.__index = Details.atributo_custom
3 years ago
return instance:TrocaTabela(instance.segmento, 5, #Details.custom)
end
3 years ago
5 months ago
function damageClass:ReportSingleVoidZoneLine(actor, instance, ShiftKeyDown, ControlKeyDown)
3 years ago
local spellid = tooltip_void_zone_temp.spellid
3 years ago
if (ControlKeyDown) then
3 years ago
local spellname, _, spellicon = _GetSpellInfo(spellid)
5 months ago
return Details:OpenAuraPanel(spellid, spellname, spellicon)
elseif(ShiftKeyDown) then
return ShowVoidZonesInWindow(actor, instance)
end
3 years ago
local spelllink = Details:GetSpellLink(spellid)
local report_table = {"Details!: " .. spelllink .. " " .. Loc ["STRING_ATTRIBUTE_DAMAGE_DEBUFFS_REPORT"]}
3 years ago
local t = {}
3 years ago
for index, void_table in ipairs(tooltip_void_zone_temp) do
--ir� reportar dano zero tamb�m
3 years ago
if (void_table[1] and type(void_table[1]) == "string" and void_table[2] and void_table[3] and type(void_table[3]) == "table") then
local actor_table = {Details:GetOnlyName(void_table[1])}
5 months ago
local m, s = math.floor(void_table[3].uptime / 60), math.floor(void_table[3].uptime % 60)
if (m > 0) then
5 months ago
actor_table [2] = formatTooltipNumber(_, void_table[3].damage) .. "(" .. m .. "m " .. s .. "s" .. ")"
else
5 months ago
actor_table [2] = formatTooltipNumber(_, void_table[3].damage) .. "(" .. s .. "s" .. ")"
end
t [#t+1] = actor_table
end
end
3 years ago
5 months ago
Details:FormatReportLines(report_table, t)
3 years ago
5 months ago
return Details:Reportar(report_table, {_no_current = true, _no_inverse = true, _custom = true})
end
3 years ago
local sort_tooltip_void_zones = function(tabela1, tabela2)
if (tabela1 [2] > tabela2 [2]) then
return true
5 months ago
elseif(tabela1 [2] == tabela2 [2]) then
if (tabela1[1] ~= "" and tabela2[1] ~= "") then
return tabela1 [3].uptime > tabela2 [3].uptime
5 months ago
elseif(tabela1[1] ~= "") then
return true
5 months ago
elseif(tabela2[1] ~= "") then
return false
end
else
return false
end
end
Details.sort_tooltip_void_zones = sort_tooltip_void_zones
3 years ago
5 months ago
function Details:ToolTipVoidZones(instancia, actor, barra, keydown)
3 years ago
5 months ago
local damage_actor = instancia.showing[1]:PegarCombatente(_, actor.damage_twin)
local habilidade
local alvos
3 years ago
if (damage_actor) then
habilidade = damage_actor.spells._ActorTable [actor.damage_spellid]
end
3 years ago
if (habilidade) then
alvos = habilidade.targets
end
3 years ago
local container = actor.debuff_uptime_targets
3 years ago
for target_name, debuff_table in pairs(container) do
if (alvos) then
local damage_alvo = alvos [target_name]
if (damage_alvo) then
debuff_table.damage = damage_alvo
else
debuff_table.damage = 0
end
else
debuff_table.damage = 0
end
end
3 years ago
for i = 1, #tooltip_void_zone_temp do
local t = tooltip_void_zone_temp [i]
t[1] = ""
t[2] = 0
t[3] = 0
end
3 years ago
local i = 1
3 years ago
for target_name, debuff_table in pairs(container) do
local t = tooltip_void_zone_temp [i]
if (not t) then
t = {}
3 years ago
tinsert(tooltip_void_zone_temp, t)
end
3 years ago
t[1] = target_name
t[2] = debuff_table.damage
t[3] = debuff_table
3 years ago
i = i + 1
end
3 years ago
--sort no container:
5 months ago
table.sort(tooltip_void_zone_temp, sort_tooltip_void_zones)
3 years ago
--monta o cooltip
local GameCooltip = GameCooltip
3 years ago
local spellname, _, spellicon = _GetSpellInfo(actor.damage_spellid)
5 months ago
--Details:AddTooltipSpellHeaderText(spellname .. " " .. Loc ["STRING_VOIDZONE_TOOLTIP"], headerColor, #tooltip_void_zone_temp, spellicon, 0.078125, 0.921875, 0.078125, 0.921875)
--Details:AddTooltipHeaderStatusbar(1, 1, 1, 0.5)
--GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2)
3 years ago
--for target_name, debuff_table in pairs(container) do
local first = tooltip_void_zone_temp [1] and tooltip_void_zone_temp [1][3]
3 years ago
if (type(first) == "table") then
first = first.damage
end
3 years ago
tooltip_void_zone_temp.spellid = actor.damage_spellid
tooltip_void_zone_temp.current_actor = actor
3 years ago
local iconSize = Details.DefaultTooltipIconSize
GameCooltip:SetOption("AlignAsBlizzTooltip", false)
GameCooltip:SetOption("AlignAsBlizzTooltipFrameHeightOffset", -6)
GameCooltip:SetOption("YSpacingMod", -6)
Details:AddRoundedCornerToTooltip()
--local lineHeight = Details.tooltip.line_height
3 years ago
for index, t in ipairs(tooltip_void_zone_temp) do
if (t[3] == 0) then
break
end
3 years ago
local debuff_table = t[3]
5 months ago
local minutos, segundos = math.floor(debuff_table.uptime / 60), math.floor(debuff_table.uptime % 60)
if (minutos > 0) then
5 months ago
GameCooltip:AddLine(Details:GetOnlyName(t[1]), formatTooltipNumber(_, debuff_table.damage) .. "(" .. minutos .. "m " .. segundos .. "s" .. ")")
else
5 months ago
GameCooltip:AddLine(Details:GetOnlyName(t[1]), formatTooltipNumber(_, debuff_table.damage) .. "(" .. segundos .. "s" .. ")")
end
3 years ago
local classe = Details:GetClass(t[1])
if (classe) then
local specID = Details:GetSpec(t[1])
if (specID) then
5 months ago
local texture, l, r, t, b = Details:GetSpecIcon(specID, false)
GameCooltip:AddIcon(texture, 1, 1, iconSize, iconSize, l, r, t, b)
else
5 months ago
GameCooltip:AddIcon([[Interface\AddOns\Details\images\classes_small_alpha]], nil, nil, iconSize, iconSize, unpack(Details.class_coords [classe]))
end
else
5 months ago
GameCooltip:AddIcon("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, iconSize, iconSize, .25, .5, 0, 1)
end
3 years ago
local _, _, _, _, _, r, g, b = Details:GetClass(t[1])
if (first == 0) then
first = 0.0000000001
end
5 months ago
GameCooltip:AddStatusBar(debuff_table.damage / first * 100, 1, r, g, b, 1, false, enemies_background)
--Details:AddTooltipBackgroundStatusbar()
3 years ago
end
3 years ago
GameCooltip:AddLine(" ")
Details:AddTooltipReportLineText()
3 years ago
GameCooltip:SetOption("StatusBarTexture", "Interface\\AddOns\\Details\\images\\bar_serenity")
GameCooltip:ShowCooltip()
3 years ago
end
5 months ago
local function RefreshBarraVoidZone(tabela, barra, instancia)
tabela:AtualizarVoidZone(tabela.minha_barra, barra.colocacao, instancia)
end
5 months ago
function atributo_misc:AtualizarVoidZone(whichRowLine, colocacao, instancia)
3 years ago
--pega a refer�ncia da barra na janela
local thisLine = instancia.barras[whichRowLine]
if (not thisLine) then
return
end
3 years ago
self._refresh_window = RefreshBarraVoidZone
3 years ago
local previousData = thisLine.minha_tabela
3 years ago
thisLine.minha_tabela = self
3 years ago
self.minha_barra = whichRowLine
thisLine.colocacao = colocacao
3 years ago
local total = instancia.showing.totals.voidzone_damage
local combat_time = instancia.showing:GetCombatTime()
5 months ago
local dps = math.floor(self.damage / combat_time)
3 years ago
5 months ago
local formated_damage = selectedToKFunction(_, self.damage)
local formated_dps = selectedToKFunction(_, dps)
3 years ago
local porcentagem
3 years ago
if (instancia.row_info.percent_type == 1) then
3 years ago
total = max(total, 0.0001)
porcentagem = format("%.1f", self.damage / total * 100)
5 months ago
elseif(instancia.row_info.percent_type == 2) then
3 years ago
local top = max(instancia.top, 0.0001)
porcentagem = format("%.1f", self.damage / top * 100)
end
3 years ago
local bars_show_data = instancia.row_info.textR_show_data
local bars_brackets = instancia:GetBarBracket()
local bars_separator = instancia:GetBarSeparator()
if (not bars_show_data [1]) then
formated_damage = ""
end
3 years ago
if (not bars_show_data [2]) then
formated_dps = ""
end
3 years ago
if (not bars_show_data [3]) then
porcentagem = ""
else
porcentagem = porcentagem .. "%"
end
local rightText = formated_damage .. bars_brackets[1] .. formated_dps .. bars_separator .. porcentagem .. bars_brackets[2]
5 months ago
if (bUsingCustomRightText) then
3 years ago
thisLine.lineText4:SetText(stringReplace(instancia.row_info.textR_custom_text, formated_damage, formated_dps, porcentagem, self, instancia.showing, instancia, rightText))
else
if (instancia.use_multi_fontstrings) then
instancia:SetInLineTexts(thisLine, formated_damage, formated_dps, porcentagem)
else
3 years ago
thisLine.lineText4:SetText(rightText)
end
end
3 years ago
thisLine.lineText1:SetText(colocacao .. ". " .. self.nome)
thisLine.lineText1:SetSize(thisLine:GetWidth() - thisLine.lineText4:GetStringWidth() - 20, 15)
thisLine.lineText1:SetTextColor(1, 1, 1, 1)
thisLine.lineText4:SetTextColor(1, 1, 1, 1)
thisLine:SetValue(100)
if (thisLine.hidden or thisLine.fading_in or thisLine.faded) then
3 years ago
Details.FadeHandler.Fader(thisLine, "out")
end
3 years ago
local _, _, icon = GetSpellInfo(self.damage_spellid)
local spellSchoolColor = Details.spells_school[self.spellschool] and Details.spells_school[self.spellschool].decimals
if (not spellSchoolColor) then
spellSchoolColor = Details.spells_school[1]
end
3 years ago
Details:SetBarColors(thisLine, instancia, unpack(spellSchoolColor))
3 years ago
thisLine.icone_classe:SetTexture(icon)
thisLine.icone_classe:SetTexCoord(0.078125, 0.921875, 0.078125, 0.921875)
thisLine.icone_classe:SetVertexColor(1, 1, 1)
if (thisLine.mouse_over and not instancia.baseframe.isMoving) then
local classIcon = thisLine:GetClassIcon()
thisLine.iconHighlight:SetTexture(classIcon:GetTexture())
thisLine.iconHighlight:SetTexCoord(classIcon:GetTexCoord())
thisLine.iconHighlight:SetVertexColor(classIcon:GetVertexColor())
--need call a refresh function
end
end
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--main refresh function
--~refresh
---@param instanceObject instance
---@param combatObject combat
---@param bForceUpdate boolean
---@param bExportData boolean
function damageClass:RefreshWindow(instanceObject, combatObject, bForceUpdate, bExportData)
---@type actorcontainer
local damageContainer = combatObject[class_type] --o que esta sendo mostrado -> [1] - dano [2] - cura --pega o container com ._NameIndexTable ._ActorTable
--print("updating the main window")
3 years ago
--not have something to show
if (#damageContainer._ActorTable < 1) then
if (Details.debug and false) then
Details.showing_ActorTable_Timer = Details.showing_ActorTable_Timer or 0
if (time() > Details.showing_ActorTable_Timer) then
3 years ago
Details:Msg("(debug) nothing to show -> #showing._ActorTable < 1")
Details.showing_ActorTable_Timer = time() + 5
end
end
3 years ago
--colocado isso recentemente para fazer as barras de dano sumirem na troca de atributo
return Details:HideBarsNotInUse(instanceObject, damageContainer), "", 0, 0
end
3 years ago
--total
local total = 0
3 years ago
--top actor #1
instanceObject.top = 0
3 years ago
local isUsingCache = false
local subAttribute = instanceObject.sub_atributo
local actorTableContent = damageContainer._ActorTable
3 years ago
local amount = #actorTableContent
local windowMode = instanceObject.modo
3 years ago
--pega qual a sub key que ser� usada --sub keys
if (bExportData) then
if (type(bExportData) == "boolean") then
3 years ago
if (subAttribute == 1) then --DAMAGE DONE
keyName = "total"
3 years ago
5 months ago
elseif(subAttribute == 2) then --DPS
keyName = "last_dps"
3 years ago
5 months ago
elseif(subAttribute == 3) then --DAMAGE TAKEN
keyName = "damage_taken"
3 years ago
if (Details.damage_taken_everything) then
windowMode = modo_ALL
end
5 months ago
elseif(subAttribute == 4) then --FRIENDLY FIRE
keyName = "friendlyfire_total"
3 years ago
5 months ago
elseif(subAttribute == 5) then --FRAGS
keyName = "frags"
3 years ago
5 months ago
elseif(subAttribute == 6) then --ENEMIES
keyName = "enemies"
3 years ago
5 months ago
elseif(subAttribute == 7) then --AURAS VOIDZONES
keyName = "voidzones"
3 years ago
5 months ago
elseif(subAttribute == 8) then --BY SPELL
keyName = "damage_taken_by_spells"
end
else
keyName = bExportData.key
windowMode = bExportData.modo
end
3 years ago
5 months ago
elseif(instanceObject.atributo == 5) then --custom
keyName = "custom"
total = combatObject.totals [instanceObject.customName]
3 years ago
else
3 years ago
if (subAttribute == 1) then --DAMAGE DONE
keyName = "total"
3 years ago
5 months ago
elseif(subAttribute == 2) then --DPS
keyName = "last_dps"
3 years ago
5 months ago
elseif(subAttribute == 3) then --DAMAGE TAKEN
keyName = "damage_taken"
if (Details.damage_taken_everything) then
3 years ago
windowMode = modo_ALL
end
3 years ago
5 months ago
elseif(subAttribute == 4) then --FRIENDLY FIRE
keyName = "friendlyfire_total"
3 years ago
5 months ago
elseif(subAttribute == 5) then --FRAGS
keyName = "frags"
3 years ago
5 months ago
elseif(subAttribute == 6) then --ENEMIES
keyName = "enemies"
3 years ago
5 months ago
elseif(subAttribute == 7) then --AURAS VOIDZONES
keyName = "voidzones"
5 months ago
elseif(subAttribute == 8) then --BY SPELL
keyName = "damage_taken_by_spells"
end
end
3 years ago
if (keyName == "frags") then
local frags = instanceObject.showing.frags
local frags_total_kills = 0
local index = 0
3 years ago
for fragName, fragAmount in pairs(frags) do
local fragged_actor = damageContainer._NameIndexTable [fragName] --get index
if (fragged_actor) then
fragged_actor = damageContainer._ActorTable [fragged_actor] --get object
if (fragged_actor) then
index = index + 1
local actor_classe = fragged_actor.classe
if (fragged_actor and fragged_actor.monster) then
actor_classe = "ENEMY"
5 months ago
elseif(not actor_classe) then
actor_classe = "UNGROUPPLAYER"
end
3 years ago
if (ntable [index]) then
ntable [index] [1] = fragName
ntable [index] [2] = fragAmount
ntable [index] [3] = actor_classe
else
ntable [index] = {fragName, fragAmount, actor_classe}
end
3 years ago
frags_total_kills = frags_total_kills + fragAmount
end
end
end
3 years ago
local tsize = #ntable
if (index < tsize) then
for i = index+1, tsize do
ntable [i][2] = 0
end
end
3 years ago
instanceObject.top = 0
if (tsize > 0) then
5 months ago
table.sort(ntable, Details.Sort2)
instanceObject.top = ntable [1][2]
end
3 years ago
total = index
3 years ago
if (bExportData) then
local export = {}
3 years ago
for i = 1, index do
export [i] = {ntable[i][1], ntable[i][2], ntable[i][3]}
end
return export
end
3 years ago
if (total < 1) then
instanceObject:EsconderScrollBar()
return Details:EndRefresh(instanceObject, total, combatObject, damageContainer) --retorna a tabela que precisa ganhar o refresh
end
3 years ago
combatObject.totals.frags_total = frags_total_kills
instanceObject:RefreshScrollBar(total)
3 years ago
local whichRowLine = 1
local lineContainer = instanceObject.barras
for i = instanceObject.barraS[1], instanceObject.barraS[2], 1 do
damageClass:AtualizarFrags(ntable[i], whichRowLine, i, instanceObject)
whichRowLine = whichRowLine+1
end
3 years ago
return Details:EndRefresh(instanceObject, total, combatObject, damageContainer) --retorna a tabela que precisa ganhar o refresh
3 years ago
5 months ago
elseif(keyName == "damage_taken_by_spells") then
local bs_index, total = 0, 0
Details:Destroy(bs_index_table)
3 years ago
local combat = combatObject
5 months ago
local AllDamageCharacters = combat:GetActorList(DETAILS_ATTRIBUTE_DAMAGE)
3 years ago
--do a loop amoung the actors
for index, character in ipairs(AllDamageCharacters) do
--is the actor a player?
if (character:IsPlayer()) then
3 years ago
for source_name, _ in pairs(character.damage_from) do
5 months ago
local source = combat(1, source_name)
3 years ago
if (source) then
3 years ago
--came from an enemy
if (not source:IsPlayer()) then
3 years ago
local AllSpells = source:GetSpellList()
3 years ago
for spellid, spell in pairs(AllSpells) do
local on_player = spell.targets [character.nome]
3 years ago
if (on_player and on_player >= 1) then
3 years ago
local spellname = _GetSpellInfo(spellid)
if (spellname) then
local has_index = bs_index_table [spellname]
local this_spell
if (has_index) then
this_spell = bs_table [has_index]
else
bs_index = bs_index + 1
this_spell = bs_table [bs_index]
if (this_spell) then
this_spell [1] = spellid
this_spell [2] = 0
3 years ago
this_spell [3] = spell.spellschool or Details.spell_school_cache [select(1, GetSpellInfo(spellid))] or 1
bs_index_table [spellname] = bs_index
else
3 years ago
this_spell = {spellid, 0, spell.spellschool or Details.spell_school_cache [select(1, GetSpellInfo(spellid))] or 1}
bs_table [bs_index] = this_spell
bs_index_table [spellname] = bs_index
end
end
this_spell [2] = this_spell [2] + on_player
total = total + on_player
else
3 years ago
error("error - no spell id for DTBS " .. spellid)
end
end
end
3 years ago
5 months ago
elseif(source:IsGroupPlayer()) then -- friendly fire
3 years ago
local AllSpells = source.friendlyfire [character.nome] and source.friendlyfire [character.nome].spells
if (AllSpells) then -- se n�o existir pode ter vindo de um pet, talvez
3 years ago
for spellid, on_player in pairs(AllSpells) do
if (on_player and on_player >= 1) then
3 years ago
local spellname = _GetSpellInfo(spellid)
if (spellname) then
local has_index = bs_index_table [spellname]
local this_spell
if (has_index) then
this_spell = bs_table [has_index]
else
bs_index = bs_index + 1
this_spell = bs_table [bs_index]
if (this_spell) then
this_spell [1] = spellid
this_spell [2] = 0
3 years ago
this_spell [3] = Details.spell_school_cache [select(1, GetSpellInfo(spellid))] or 1
bs_index_table [spellname] = bs_index
else
3 years ago
this_spell = {spellid, 0, Details.spell_school_cache [select(1, GetSpellInfo(spellid))] or 1}
bs_table [bs_index] = this_spell
bs_index_table [spellname] = bs_index
end
end
this_spell [2] = this_spell [2] + on_player
total = total + on_player
else
--error("error - no spell id for DTBS friendly fire " .. spellid)
end
end
end
end
3 years ago
end
end
3 years ago
end
end
end
local tsize = #bs_table
if (bs_index < tsize) then
for i = bs_index+1, tsize do
bs_table [i][2] = 0
end
end
3 years ago
instanceObject.top = 0
if (tsize > 0) then
5 months ago
table.sort(bs_table, Details.Sort2)
instanceObject.top = bs_table [1][2]
end
3 years ago
local total2 = bs_index
3 years ago
if (bExportData) then
local export = {}
for i = 1, bs_index do
-- spellid, total, spellschool
export [i] = {spellid = bs_table[i][1], damage = bs_table[i][2], spellschool = bs_table[i][3]}
end
return total, "damage", instanceObject.top, bs_index, export
end
3 years ago
if (bs_index < 1) then
instanceObject:EsconderScrollBar()
return Details:EndRefresh(instanceObject, bs_index, combatObject, damageContainer) --retorna a tabela que precisa ganhar o refresh
end
3 years ago
combatObject.totals.by_spell = total
instanceObject:RefreshScrollBar(bs_index)
3 years ago
local whichRowLine = 1
local lineContainer = instanceObject.barras
3 years ago
for i = instanceObject.barraS[1], instanceObject.barraS[2], 1 do
5 months ago
damageClass:AtualizarBySpell(bs_table[i], whichRowLine, i, instanceObject)
whichRowLine = whichRowLine+1
end
3 years ago
return Details:EndRefresh(instanceObject, bs_index, combatObject, damageContainer)
3 years ago
5 months ago
elseif(keyName == "voidzones") then
local index = 0
3 years ago
local misc_container = combatObject [4]
local voidzone_damage_total = 0
3 years ago
for _, actor in ipairs(misc_container._ActorTable) do
if (actor.boss_debuff) then
index = index + 1
3 years ago
--pega no container de dano o actor respons�vel por aplicar o debuff
local twin_damage_actor = damageContainer._NameIndexTable [actor.damage_twin] or damageContainer._NameIndexTable ["[*] " .. actor.damage_twin]
3 years ago
if (twin_damage_actor) then
local index = twin_damage_actor
twin_damage_actor = damageContainer._ActorTable [twin_damage_actor]
local spell = twin_damage_actor.spells._ActorTable [actor.damage_spellid]
3 years ago
if (spell) then
3 years ago
--fix spell, sometimes there is two spells with the same name, one is the cast and other is the debuff
if (spell.total == 0 and not actor.damage_spellid_fixed) then
3 years ago
local curname = _GetSpellInfo(actor.damage_spellid)
for spellid, spelltable in pairs(twin_damage_actor.spells._ActorTable) do
if (spelltable.total > spell.total) then
3 years ago
local name = _GetSpellInfo(spellid)
if (name == curname) then
actor.damage_spellid = spellid
spell = spelltable
end
end
end
actor.damage_spellid_fixed = true
end
3 years ago
actor.damage = spell.total
voidzone_damage_total = voidzone_damage_total + spell.total
3 years ago
5 months ago
elseif(not actor.damage_spellid_fixed) then --not
3 years ago
--fix spell, if the spellid passed for debuff uptime is actully the spell id of a ability and not if the aura it self
actor.damage_spellid_fixed = true
local found = false
3 years ago
for spellid, spelltable in pairs(twin_damage_actor.spells._ActorTable) do
local name = _GetSpellInfo(spellid)
if (actor.damage_twin:find(name)) then
actor.damage = spelltable.total
voidzone_damage_total = voidzone_damage_total + spelltable.total
actor.damage_spellid = spellid
found = true
break
end
end
3 years ago
if (not found) then
actor.damage = 0
end
else
actor.damage = 0
end
else
actor.damage = 0
end
3 years ago
vtable [index] = actor
end
end
3 years ago
local tsize = #vtable
if (index < tsize) then
for i = index+1, tsize do
vtable [i] = nil
end
end
3 years ago
if (tsize > 0 and vtable[1]) then
5 months ago
table.sort(vtable, void_zone_sort)
instanceObject.top = vtable [1].damage
end
3 years ago
total = index
if (bExportData) then
3 years ago
for _, t in ipairs(vtable) do
t.report_name = Details:GetSpellLink(t.damage_spellid)
end
return voidzone_damage_total, "damage", instanceObject.top, total, vtable, "report_name"
end
3 years ago
if (total < 1) then
instanceObject:EsconderScrollBar()
return Details:EndRefresh(instanceObject, total, combatObject, damageContainer) --retorna a tabela que precisa ganhar o refresh
end
3 years ago
combatObject.totals.voidzone_damage = voidzone_damage_total
instanceObject:RefreshScrollBar(total)
3 years ago
local whichRowLine = 1
local lineContainer = instanceObject.barras
for i = instanceObject.barraS[1], instanceObject.barraS[2], 1 do
5 months ago
vtable[i]:AtualizarVoidZone(whichRowLine, i, instanceObject)
whichRowLine = whichRowLine+1
end
3 years ago
return Details:EndRefresh(instanceObject, total, combatObject, damageContainer) --retorna a tabela que precisa ganhar o refresh
3 years ago
else
--/run Details:Dump(Details:GetCurrentCombat():GetActor(1, "Injured Steelspine 1"))
if (keyName == "enemies") then
5 months ago
amount, total = Details:ContainerSortEnemies(actorTableContent, amount, "damage_taken")
--remove actors with zero damage taken
local newAmount = 0
3 years ago
for i = 1, #actorTableContent do
if (actorTableContent[i].damage_taken < 1) then
newAmount = i-1
break
end
end
4 years ago
--if all units shown are enemies and all have damage taken, check if newAmount is zero and #conteudo has value bigger than 0
3 years ago
if (newAmount == 0 and #actorTableContent > 0) then
4 years ago
amount = amount
else
amount = newAmount
end
--keyName = "damage_taken"
--result of the first actor
instanceObject.top = actorTableContent[1] and actorTableContent[1][keyName]
3 years ago
5 months ago
elseif(windowMode == DETAILS_MODE_ALL) then --mostrando ALL
3 years ago
--faz o sort da categoria e retorna o amount corrigido
if (subAttribute == 2) then
local combat_time = instanceObject.showing:GetCombatTime()
total = damageClass:ContainerRefreshDps(actorTableContent, combat_time)
else
3 years ago
--pega o total ja aplicado na tabela do combate
total = combatObject.totals[class_type]
3 years ago
end
amount = Details:ContainerSort(actorTableContent, amount, keyName)
3 years ago
--grava o total
instanceObject.top = actorTableContent[1][keyName]
3 years ago
5 months ago
elseif(windowMode == DETAILS_MODE_GROUP) then --mostrando GROUP
if (Details.in_combat and instanceObject.segmento == 0 and not bExportData) then
3 years ago
isUsingCache = true
end
if (isUsingCache) then
actorTableContent = Details.cache_damage_group
if (#actorTableContent < 1) then
if (Details.debug and false) then
Details.showing_ActorTable_Timer2 = Details.showing_ActorTable_Timer2 or 0
if (time() > Details.showing_ActorTable_Timer2) then
5 months ago
Details:Msg("(debug) nothing to show -> #conteudo < 1(using cache)")
Details.showing_ActorTable_Timer2 = time()+5
end
end
3 years ago
return Details:HideBarsNotInUse(instanceObject, damageContainer), "", 0, 0
end
3 years ago
local bOrderDpsByRealTime = Details.CurrentDps.CanSortByRealTimeDps()
3 years ago
if (subAttribute == 2) then --dps
local combatTime = combatObject:GetCombatTime()
local realTimeTotal = 0
total, realTimeTotal = damageClass:ContainerRefreshDps(actorTableContent, combatTime)
if (bOrderDpsByRealTime) then
total = realTimeTotal
end
5 months ago
elseif(subAttribute == 1) then --damage done
if (bOrderDpsByRealTime) then
total = damageClass:RefreshDpsRealTime(actorTableContent)
end
end
3 years ago
if (bOrderDpsByRealTime) then
5 months ago
table.sort(actorTableContent, Details.SortByRealTimeDps)
if (actorTableContent[1]["last_dps_realtime"] < 1) then
amount = 0
else
instanceObject.top = actorTableContent[1].last_dps_realtime
amount = #actorTableContent
end
else
5 months ago
table.sort(actorTableContent, Details.SortKeySimple)
if (actorTableContent[1][keyName] < 1) then
amount = 0
else
instanceObject.top = actorTableContent[1][keyName]
amount = #actorTableContent
end
if (subAttribute ~= 2) then --other than dps because dps already did the iteration and the total is already calculated
for i = 1, amount do
total = total + actorTableContent[i][keyName]
end
end
end
else
3 years ago
if (subAttribute == 2) then --dps
local combatTime = combatObject:GetCombatTime()
damageClass:ContainerRefreshDps(actorTableContent, combatTime)
end
5 months ago
table.sort(actorTableContent, Details.SortKeyGroup)
end
--
3 years ago
if (not isUsingCache) then
for index, player in ipairs(actorTableContent) do
if (player.grupo) then --� um player e esta em grupo
if (player[keyName] < 1) then --dano menor que 1, interromper o loop
amount = index - 1
break
end
3 years ago
total = total + player[keyName]
else
amount = index-1
break
end
end
3 years ago
instanceObject.top = actorTableContent[1] and actorTableContent[1][keyName]
end
end
end
3 years ago
--refaz o mapa do container
if (not isUsingCache) then
damageContainer:remapear()
end
3 years ago
if (bExportData) then
return total, keyName, instanceObject.top, amount
end
3 years ago
if (amount < 1) then --n�o h� barras para mostrar
if (bForceUpdate) then
if (instanceObject.modo == 2) then --group
for i = 1, instanceObject.rows_fit_in_window do
Details.FadeHandler.Fader(instanceObject.barras [i], "in", Details.fade_speed)
end
end
end
instanceObject:EsconderScrollBar() --precisaria esconder a scroll bar
3 years ago
if (Details.debug and false) then
Details.showing_ActorTable_Timer2 = Details.showing_ActorTable_Timer2 or 0
if (time() > Details.showing_ActorTable_Timer2) then
3 years ago
Details:Msg("(debug) nothing to show -> amount < 1")
Details.showing_ActorTable_Timer2 = time()+5
end
end
3 years ago
return Details:EndRefresh(instanceObject, total, combatObject, damageContainer) --retorna a tabela que precisa ganhar o refresh
end
instanceObject:RefreshScrollBar(amount)
3 years ago
local whichRowLine = 1
local lineContainer = instanceObject.barras
local percentageType = instanceObject.row_info.percent_type
local barsShowData = instanceObject.row_info.textR_show_data
local barsBrackets = instanceObject:GetBarBracket()
local barsSeparator = instanceObject:GetBarSeparator()
local baseframe = instanceObject.baseframe
5 months ago
local useAnimations = Details.is_using_row_animations and(not baseframe.isStretching and not bForceUpdate and not baseframe.isResizing)
3 years ago
if (total == 0) then
total = 0.00000001
end
3 years ago
local myPos
local following = instanceObject.following.enabled and subAttribute ~= 6
3 years ago
if (following) then
3 years ago
if (isUsingCache) then
local pname = Details.playername
3 years ago
for i, actor in ipairs(actorTableContent) do
if (actor.nome == pname) then
myPos = i
break
end
end
else
myPos = damageContainer._NameIndexTable [Details.playername]
end
end
local combatTime = instanceObject.showing:GetCombatTime()
5 months ago
bUsingCustomLeftText = instanceObject.row_info.textL_enable_custom_text
bUsingCustomRightText = instanceObject.row_info.textR_enable_custom_text
3 years ago
local useTotalBar = false
if (instanceObject.total_bar.enabled) then
3 years ago
useTotalBar = true
5 months ago
if (instanceObject.total_bar.only_in_group and(not IsInGroup() and not IsInRaid())) then
3 years ago
useTotalBar = false
end
3 years ago
if (subAttribute > 4) then --enemies, frags, void zones
useTotalBar = false
end
end
3 years ago
if (subAttribute == 2) then --dps
instanceObject.player_top_dps = actorTableContent [1].last_dps
5 months ago
instanceObject.player_top_dps_threshold = instanceObject.player_top_dps -(instanceObject.player_top_dps * 0.65)
end
3 years ago
local totalBarIsShown
3 years ago
if (instanceObject.bars_sort_direction == 1) then --top to bottom
if (useTotalBar and instanceObject.barraS[1] == 1) then
whichRowLine = 2
local iterLast = instanceObject.barraS[2]
if (iterLast == instanceObject.rows_fit_in_window) then
3 years ago
iterLast = iterLast - 1
end
3 years ago
local row1 = lineContainer [1]
row1.minha_tabela = nil
3 years ago
row1.lineText1:SetText(Loc ["STRING_TOTAL"])
if (instanceObject.use_multi_fontstrings) then
row1.lineText2:SetText("")
3 years ago
row1.lineText3:SetText(Details:ToK2(total))
row1.lineText4:SetText(Details:ToK(total / combatTime))
else
5 months ago
row1.lineText4:SetText(Details:ToK2(total) .. "(" .. Details:ToK(total / combatTime) .. ")")
3 years ago
end
row1:SetValue(100)
local r, g, b = unpack(instanceObject.total_bar.color)
3 years ago
row1.textura:SetVertexColor(r, g, b)
row1.icone_classe:SetTexture(instanceObject.total_bar.icon)
3 years ago
row1.icone_classe:SetTexCoord(0.0625, 0.9375, 0.0625, 0.9375)
Details.FadeHandler.Fader(row1, "out")
totalBarIsShown = true
3 years ago
if (following and myPos and myPos+1 > instanceObject.rows_fit_in_window and instanceObject.barraS[2] < myPos+1) then
for i = instanceObject.barraS[1], iterLast-1, 1 do
3 years ago
if (actorTableContent[i]) then
actorTableContent[i]:RefreshLine(instanceObject, lineContainer, whichRowLine, i, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator)
whichRowLine = whichRowLine+1
end
end
actorTableContent[myPos]:RefreshLine(instanceObject, lineContainer, whichRowLine, myPos, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator)
whichRowLine = whichRowLine+1
else
for i = instanceObject.barraS[1], iterLast, 1 do
3 years ago
if (actorTableContent[i]) then
actorTableContent[i]:RefreshLine(instanceObject, lineContainer, whichRowLine, i, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator)
whichRowLine = whichRowLine+1
end
end
end
else
if (following and myPos and myPos > instanceObject.rows_fit_in_window and instanceObject.barraS[2] < myPos) then
for i = instanceObject.barraS[1], instanceObject.barraS[2]-1, 1 do
3 years ago
if (actorTableContent[i]) then
actorTableContent[i]:RefreshLine(instanceObject, lineContainer, whichRowLine, i, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator)
whichRowLine = whichRowLine+1
end
end
3 years ago
actorTableContent[myPos]:RefreshLine(instanceObject, lineContainer, whichRowLine, myPos, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator)
whichRowLine = whichRowLine+1
else
for i = instanceObject.barraS[1], instanceObject.barraS[2], 1 do
3 years ago
if (actorTableContent[i]) then
actorTableContent[i]:RefreshLine(instanceObject, lineContainer, whichRowLine, i, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator)
whichRowLine = whichRowLine+1
end
end
end
end
3 years ago
5 months ago
elseif(instanceObject.bars_sort_direction == 2) then --bottom to top
if (useTotalBar and instanceObject.barraS[1] == 1) then
whichRowLine = 2
local iter_last = instanceObject.barraS[2]
if (iter_last == instanceObject.rows_fit_in_window) then
iter_last = iter_last - 1
end
3 years ago
local row1 = lineContainer [1]
row1.minha_tabela = nil
3 years ago
row1.lineText1:SetText(Loc ["STRING_TOTAL"])
if (instanceObject.use_multi_fontstrings) then
row1.lineText2:SetText("")
3 years ago
row1.lineText3:SetText(Details:ToK2(total))
row1.lineText4:SetText(Details:ToK(total / combatTime))
else
5 months ago
row1.lineText4:SetText(Details:ToK2(total) .. "(" .. Details:ToK(total / combatTime) .. ")")
end
3 years ago
row1:SetValue(100)
local r, g, b = unpack(instanceObject.total_bar.color)
3 years ago
row1.textura:SetVertexColor(r, g, b)
row1.icone_classe:SetTexture(instanceObject.total_bar.icon)
3 years ago
row1.icone_classe:SetTexCoord(0.0625, 0.9375, 0.0625, 0.9375)
Details.FadeHandler.Fader(row1, "out")
totalBarIsShown = true
3 years ago
if (following and myPos and myPos+1 > instanceObject.rows_fit_in_window and instanceObject.barraS[2] < myPos+1) then
actorTableContent[myPos]:RefreshLine(instanceObject, lineContainer, whichRowLine, myPos, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator)
whichRowLine = whichRowLine+1
for i = iter_last-1, instanceObject.barraS[1], -1 do
3 years ago
if (actorTableContent[i]) then
actorTableContent[i]:RefreshLine(instanceObject, lineContainer, whichRowLine, i, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator)
whichRowLine = whichRowLine+1
end
end
else
for i = iter_last, instanceObject.barraS[1], -1 do
3 years ago
if (actorTableContent[i]) then
actorTableContent[i]:RefreshLine(instanceObject, lineContainer, whichRowLine, i, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator)
whichRowLine = whichRowLine+1
end
end
end
else
if (following and myPos and myPos > instanceObject.rows_fit_in_window and instanceObject.barraS[2] < myPos) then
actorTableContent[myPos]:RefreshLine(instanceObject, lineContainer, whichRowLine, myPos, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator)
whichRowLine = whichRowLine+1
for i = instanceObject.barraS[2]-1, instanceObject.barraS[1], -1 do
3 years ago
if (actorTableContent[i]) then
actorTableContent[i]:RefreshLine(instanceObject, lineContainer, whichRowLine, i, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator)
whichRowLine = whichRowLine+1
end
end
else
for i = instanceObject.barraS[2], instanceObject.barraS[1], -1 do
3 years ago
if (actorTableContent[i]) then
actorTableContent[i]:RefreshLine(instanceObject, lineContainer, whichRowLine, i, total, subAttribute, bForceUpdate, keyName, combatTime, percentageType, useAnimations, barsShowData, barsBrackets, barsSeparator)
whichRowLine = whichRowLine+1
end
end
end
end
3 years ago
end
3 years ago
if (totalBarIsShown) then
instanceObject:RefreshScrollBar(amount + 1)
else
instanceObject:RefreshScrollBar(amount)
end
3 years ago
if (useAnimations) then
instanceObject:PerformAnimations(whichRowLine - 1)
end
3 years ago
--beta, hidar barras n�o usadas durante um refresh for�ado
if (bForceUpdate) then
if (instanceObject.modo == 2) then --group
for i = whichRowLine, instanceObject.rows_fit_in_window do
Details.FadeHandler.Fader(instanceObject.barras [i], "in", Details.fade_speed)
end
end
end
3 years ago
Details.LastFullDamageUpdate = Details._tempo
3 years ago
instanceObject:AutoAlignInLineFontStrings()
return Details:EndRefresh(instanceObject, total, combatObject, damageContainer) --retorna a tabela que precisa ganhar o refresh
end
--self is instance
function Details:AutoAlignInLineFontStrings()
--if this instance is using in line texts, check the min distance and the length of strings to make them more spread appart
if (self.use_multi_fontstrings and self.use_auto_align_multi_fontstrings) then
local maxStringLength_StringFour = 0
local maxStringLength_StringThree = 0
local profileOffsetString3 = self.fontstrings_text3_anchor
local profileOffsetString2 = self.fontstrings_text2_anchor
local profileYOffset = self.row_info.text_yoffset
Details.CacheInLineMaxDistance = Details.CacheInLineMaxDistance or {}
Details.CacheInLineMaxDistance[self:GetId()] = Details.CacheInLineMaxDistance[self:GetId()] or {[2] = profileOffsetString2, [3] = profileOffsetString3}
5 months ago
--space between string4 and string3(usually dps is 4 and total value is 3)
for lineId = 1, self:GetNumLinesShown() do
local thisLine = self:GetLine(lineId)
if (thisLine) then
--check strings 3 and 4
if (thisLine.lineText4:GetText() ~= "" and thisLine.lineText3:GetText() ~= "") then
--the length of the far right string determines the space between it and the next string in the left
local stringLength = thisLine.lineText4:GetStringWidth()
maxStringLength_StringFour = stringLength > maxStringLength_StringFour and stringLength or maxStringLength_StringFour
end
--check strings 2 and 3
if (thisLine.lineText2:GetText() ~= "" and thisLine.lineText3:GetText() ~= "") then
--the length of the middle string determines the space between it and the next string in the left
local stringLength = thisLine.lineText3:GetStringWidth()
maxStringLength_StringThree = stringLength > maxStringLength_StringThree and stringLength or maxStringLength_StringThree
end
end
end
--if the length bigger than the min distance? calculate for string4 to string3 distance
5 months ago
if ((maxStringLength_StringFour > 0) and(maxStringLength_StringFour + 5 > profileOffsetString3)) then
local newOffset = maxStringLength_StringFour + 5
--check if the current needed min distance is bigger than the distance stored in the cache
local currentCacheMaxValue = Details.CacheInLineMaxDistance[self:GetId()][3]
if (currentCacheMaxValue < newOffset) then
currentCacheMaxValue = newOffset
Details.CacheInLineMaxDistance[self:GetId()][3] = currentCacheMaxValue
else
--if not, use the distance value cached to avoid jittering in the string
newOffset = currentCacheMaxValue
end
--update the lines
for lineId = 1, self:GetNumLinesShown() do
local thisLine = self:GetLine(lineId)
if (thisLine) then
thisLine.lineText3:SetPoint("right", thisLine.statusbar, "right", -newOffset, profileYOffset)
end
end
end
--check if there's length in the third string, also the third string cannot have a length if the second string is empty
if (maxStringLength_StringThree > 0) then
local newOffset = maxStringLength_StringThree + maxStringLength_StringFour + 14
if (newOffset >= profileOffsetString2) then
--check if the current needed min distance is bigger than the distance stored in the cache
local currentCacheMaxValue = Details.CacheInLineMaxDistance[self:GetId()][2]
if (currentCacheMaxValue < newOffset) then
currentCacheMaxValue = newOffset
Details.CacheInLineMaxDistance[self:GetId()][2] = currentCacheMaxValue
else
--if not, use the distance value cached to avoid jittering in the string
newOffset = currentCacheMaxValue
end
--update the lines
for lineId = 1, self:GetNumLinesShown() do
local thisLine = self:GetLine(lineId)
if (thisLine) then
thisLine.lineText2:SetPoint("right", thisLine.statusbar, "right", -newOffset, profileYOffset)
end
end
end
end
--reduce the size of the actor name string based on the total size of all strings in the right side
for lineId = 1, self:GetNumLinesShown() do
local thisLine = self:GetLine(lineId)
--check if there's something showing in this line
3 years ago
--check if the line is shown and if the text exists for sanitization
if (thisLine and thisLine.minha_tabela and thisLine:IsShown() and thisLine.lineText1:GetText()) then
local playerNameFontString = thisLine.lineText1
local text2 = thisLine.lineText2
local text3 = thisLine.lineText3
local text4 = thisLine.lineText4
local totalWidth = text2:GetStringWidth() + text3:GetStringWidth() + text4:GetStringWidth()
totalWidth = totalWidth + 40 - self.fontstrings_text_limit_offset
DetailsFramework:TruncateTextSafe(playerNameFontString, self.cached_bar_width - totalWidth) --this avoid truncated strings with ...
--these commented lines are for to create a cache and store the name already truncated there to safe performance
--local truncatedName = playerNameFontString:GetText()
--local actorObject = thisLine.minha_tabela
--actorObject.name_cached = truncatedName
--actorObject.name_cached_time = GetTime()
end
end
end
end
--handle internal details! events
local eventListener = Details:CreateEventListener()
eventListener:RegisterEvent("COMBAT_PLAYER_ENTER", function(eventName, combatObject)
if (Details.CacheInLineMaxDistance) then
Details:Destroy(Details.CacheInLineMaxDistance)
for i = 1, 10 do
C_Timer.After(i, function()
Details:Destroy(Details.CacheInLineMaxDistance)
end)
end
end
end)
local classColor_Red, classColor_Green, classColor_Blue
-- ~texts
--[[exported]] function Details:SetInLineTexts(thisLine, valueText, perSecondText, percentText)
--set defaults
4 years ago
local instance = self
valueText = valueText or ""
perSecondText = perSecondText or ""
percentText = percentText or ""
5 months ago
if ((Details.use_realtimedps or(Details.combat_log.evoker_show_realtimedps and Details.playerspecid == 1473)) and Details.in_combat) then --real time
if (thisLine:GetActor()) then
local actorSerial = thisLine:GetActor().serial
local currentDps = Details.CurrentDps.GetCurrentDps(actorSerial)
if (currentDps and currentDps > 0) then
currentDps = Details:ToK2(currentDps)
end
perSecondText = currentDps
end
end
3 years ago
4 years ago
--check if the instance is showing total, dps and percent
local instanceSettings = instance.row_info
if (not instanceSettings.textR_show_data[3]) then --percent text disabled on options panel
local attributeId = instance:GetDisplay()
if (attributeId ~= 5) then --not custom
percentText = ""
end
end
--parse information
if (percentText ~= "") then --has percent text
thisLine.lineText4:SetText(percentText)
if (perSecondText ~= "") then --has dps?
thisLine.lineText3:SetText(perSecondText) --set dps
thisLine.lineText2:SetText(valueText) --set amount
else
thisLine.lineText3:SetText(valueText) --set amount
thisLine.lineText2:SetText("") --clear
end
else --no percent text
if (perSecondText ~= "") then --has dps and no percent
thisLine.lineText4:SetText(perSecondText) --set dps
thisLine.lineText3:SetText(valueText) --set amount
thisLine.lineText2:SetText("") --clear
else --no dps and not percent
thisLine.lineText4:SetText(valueText) --set dps
thisLine.lineText3:SetText("") --clear
thisLine.lineText2:SetText("") --clear
end
end
end
-- ~atualizar ~barra ~update
function damageClass:RefreshLine(instanceObject, lineContainer, whichRowLine, rank, total, subAttribute, bForceRefresh, keyName, combatTime, percentageType, bUseAnimations, bars_show_data, bars_brackets, bars_separator)
3 years ago
local thisLine = lineContainer[whichRowLine]
if (not thisLine) then
3 years ago
print("DEBUG: problema com <instance.thisLine> "..whichRowLine.." "..rank)
return
end
3 years ago
local previousData = thisLine.minha_tabela
thisLine.minha_tabela = self --store references
self.minha_barra = thisLine --store references
thisLine.colocacao = rank
self.colocacao = rank
3 years ago
local damageTotal = self.total --total damage of this actor
local dps
3 years ago
local percentString
local percentNumber
--calc the percent amount base on the percent type
if (percentageType == 1) then
3 years ago
percentString = format("%.1f", self[keyName] / total * 100)
5 months ago
elseif(percentageType == 2) then
percentString = format("%.1f", self[keyName] / instanceObject.top * 100)
end
local currentCombat = instanceObject:GetCombat()
if (currentCombat:GetCombatType() == DETAILS_SEGMENTTYPE_MYTHICDUNGEON_OVERALL) then
if (Details.mythic_plus.mythicrun_time_type == 1) then
--total time in combat, activity time
combatTime = currentCombat:GetCombatTime()
5 months ago
elseif(Details.mythic_plus.mythicrun_time_type == 2) then
--elapsed time of the run
combatTime = currentCombat:GetRunTime()
end
dps = damageTotal / combatTime
self.last_dps = dps
else
--calculate the actor dps
if ((Details.time_type == 2 and self.grupo) or not Details:CaptureGet("damage") or instanceObject.segmento == -1 or Details.use_realtimedps) then
if (Details.use_realtimedps and Details.in_combat) then
local currentDps = self.last_dps_realtime
if (currentDps) then
dps = currentDps
end
end
if (not dps) then
if (instanceObject.segmento == -1 and combatTime == 0) then
local actor = currentCombat(1, self.nome)
if (actor) then
local combatTime = actor:Tempo()
dps = damageTotal / combatTime
self.last_dps = dps
else
dps = damageTotal / combatTime
self.last_dps = dps
end
else
dps = damageTotal / combatTime
self.last_dps = dps
end
end
3 years ago
else
if (not self.on_hold) then
dps = damageTotal/self:Tempo() --calcula o dps deste objeto
self.last_dps = dps --salva o dps dele
else
if (self.last_dps == 0) then --n�o calculou o dps dele ainda mas entrou em standby
dps = damageTotal/self:Tempo()
self.last_dps = dps
else
dps = self.last_dps
end
end
end
3 years ago
end
--right text
if (subAttribute == 1) then --damage done
5 months ago
dps = math.floor(dps)
local formatedDamage = selectedToKFunction(_, damageTotal)
local formatedDps = selectedToKFunction(_, dps)
thisLine.ps_text = formatedDps
if (not bars_show_data[1]) then
formatedDamage = ""
end
3 years ago
if (not bars_show_data[2]) then
formatedDps = ""
end
3 years ago
if (not bars_show_data[3]) then
3 years ago
percentString = ""
else
3 years ago
percentString = percentString .. "%"
end
3 years ago
local rightText = formatedDamage .. bars_brackets[1] .. formatedDps .. bars_separator .. percentString .. bars_brackets[2]
5 months ago
if (bUsingCustomRightText) then
thisLine.lineText4:SetText(stringReplace(instanceObject.row_info.textR_custom_text, formatedDamage, formatedDps, percentString, self, instanceObject.showing, instanceObject, rightText))
else
if (instanceObject.use_multi_fontstrings) then
instanceObject:SetInLineTexts(thisLine, formatedDamage, formatedDps, percentString)
else
thisLine.lineText4:SetText(rightText)
end
end
3 years ago
if (Details.CurrentDps.CanSortByRealTimeDps()) then
5 months ago
percentNumber = math.floor((self.last_dps_realtime / instanceObject.top) * 100)
else
5 months ago
percentNumber = math.floor((damageTotal/instanceObject.top) * 100)
end
5 months ago
elseif(subAttribute == 2) then --dps
local raw_dps = dps
5 months ago
dps = math.floor(dps)
3 years ago
5 months ago
local formated_damage = selectedToKFunction(_, damageTotal)
local formated_dps = selectedToKFunction(_, dps)
thisLine.ps_text = formated_dps
3 years ago
local diff_from_topdps
3 years ago
if (rank > 1) then
diff_from_topdps = instanceObject.player_top_dps - raw_dps
end
3 years ago
local rightText
if (diff_from_topdps) then
local threshold = diff_from_topdps / instanceObject.player_top_dps_threshold * 100
if (threshold < 100) then
3 years ago
threshold = abs(threshold - 100)
else
threshold = 5
end
3 years ago
5 months ago
local rr, gg, bb = Details:percent_color( threshold )
3 years ago
5 months ago
rr, gg, bb = Details:hex(math.floor(rr*255)), Details:hex(math.floor(gg*255)), "28"
local color_percent = "" .. rr .. gg .. bb .. ""
3 years ago
if (not bars_show_data [1]) then
formated_dps = ""
end
if (not bars_show_data [2]) then
color_percent = ""
else
5 months ago
color_percent = bars_brackets[1] .. "|cFFFF4444-|r|cFF" .. color_percent .. selectedToKFunction(_, math.floor(diff_from_topdps)) .. "|r" .. bars_brackets[2]
end
3 years ago
rightText = formated_dps .. color_percent
3 years ago
else
local icon = " |TInterface\\GROUPFRAME\\UI-Group-LeaderIcon:14:14:0:0:16:16:0:16:0:16|t "
if (not bars_show_data [1]) then
formated_dps = ""
end
if (not bars_show_data [2]) then
icon = ""
end
3 years ago
rightText = formated_dps .. icon
end
5 months ago
if (bUsingCustomRightText) then
thisLine.lineText4:SetText(stringReplace(instanceObject.row_info.textR_custom_text, formated_dps, formated_damage, percentString, self, instanceObject.showing, instanceObject, rightText))
else
if (instanceObject.use_multi_fontstrings) then
--instance:SetInLineTexts(thisLine, formated_damage, formated_dps, porcentagem)
instanceObject:SetInLineTexts(thisLine, rightText)
else
thisLine.lineText4:SetText(rightText)
end
end
5 months ago
percentNumber = math.floor((dps/instanceObject.top) * 100)
5 months ago
elseif(subAttribute == 3) then --damage taken
local dtps = self.damage_taken / combatTime
3 years ago
5 months ago
local formated_damage_taken = selectedToKFunction(_, self.damage_taken)
local formated_dtps = selectedToKFunction(_, dtps)
thisLine.ps_text = formated_dtps
if (not bars_show_data [1]) then
formated_damage_taken = ""
end
if (not bars_show_data [2]) then
formated_dtps = ""
end
if (not bars_show_data [3]) then
3 years ago
percentString = ""
else
3 years ago
percentString = percentString .. "%"
end
3 years ago
local rightText = formated_damage_taken .. bars_brackets[1] .. formated_dtps .. bars_separator .. percentString .. bars_brackets[2]
5 months ago
if (bUsingCustomRightText) then
thisLine.lineText4:SetText(stringReplace(instanceObject.row_info.textR_custom_text, formated_damage_taken, formated_dtps, percentString, self, instanceObject.showing, instanceObject, rightText))
else
if (instanceObject.use_multi_fontstrings) then
instanceObject:SetInLineTexts(thisLine, formated_damage_taken, formated_dtps, percentString)
else
thisLine.lineText4:SetText(rightText)
end
end
3 years ago
5 months ago
percentNumber = math.floor((self.damage_taken/instanceObject.top) * 100)
3 years ago
5 months ago
elseif(subAttribute == 4) then --friendly fire
local formated_friendly_fire = selectedToKFunction(_, self.friendlyfire_total)
if (not bars_show_data [1]) then
formated_friendly_fire = ""
end
if (not bars_show_data [3]) then
3 years ago
percentString = ""
else
3 years ago
percentString = percentString .. "%"
end
3 years ago
local rightText = formated_friendly_fire .. bars_brackets[1] .. percentString .. bars_brackets[2]
5 months ago
if (bUsingCustomRightText) then
thisLine.lineText4:SetText(stringReplace(instanceObject.row_info.textR_custom_text, formated_friendly_fire, "", percentString, self, instanceObject.showing, instanceObject, rightText))
else
if (instanceObject.use_multi_fontstrings) then
instanceObject:SetInLineTexts(thisLine, "", formated_friendly_fire, percentString)
else
thisLine.lineText4:SetText(rightText)
end
end
5 months ago
percentNumber = math.floor((self.friendlyfire_total/instanceObject.top) * 100)
3 years ago
5 months ago
elseif(subAttribute == 6) then --enemies
local dtps = self.damage_taken / combatTime
3 years ago
5 months ago
local formatedDamageTaken = selectedToKFunction(_, self.damage_taken)
local formatedDtps = selectedToKFunction(_, dtps)
3 years ago
thisLine.ps_text = formatedDtps
5 months ago
if (not bars_show_data[1]) then
3 years ago
formatedDamageTaken = ""
end
5 months ago
if (not bars_show_data[2]) then
3 years ago
formatedDtps = ""
end
5 months ago
if (not bars_show_data[3]) then
3 years ago
percentString = ""
else
3 years ago
percentString = percentString .. "%"
end
3 years ago
local rightText = formatedDamageTaken .. bars_brackets[1] .. formatedDtps .. bars_separator .. percentString .. bars_brackets[2]
5 months ago
if (bUsingCustomRightText) then
thisLine.lineText4:SetText(stringReplace(instanceObject.row_info.textR_custom_text, formatedDamageTaken, formatedDtps, percentString, self, instanceObject.showing, instanceObject, rightText))
else
if (instanceObject.use_multi_fontstrings) then
instanceObject:SetInLineTexts(thisLine, formatedDamageTaken, formatedDtps, percentString)
else
thisLine.lineText4:SetText(rightText)
end
end
3 years ago
5 months ago
percentNumber = math.floor((self.damage_taken/instanceObject.top) * 100)
end
--need tooltip update?
if (thisLine.mouse_over and not instanceObject.baseframe.isMoving) then
gump:UpdateTooltip(whichRowLine, thisLine, instanceObject)
end
if (self.need_refresh) then
self.need_refresh = false
bForceRefresh = true
end
3 years ago
classColor_Red, classColor_Green, classColor_Blue = self:GetBarColor()
3 years ago
return self:RefreshLineValue(thisLine, instanceObject, previousData, bForceRefresh, percentNumber, bUseAnimations, total, instanceObject.top)
end
5 months ago
---show an extra statusbar on the line, after the main statusbar ~extra ~statusbar
---@param thisLine table
---@param amount valueamount
---@param extraAmount valueamount
---@param totalAmount valueamount
---@param topAmount valueamount
---@param instanceObject instance
---@param onEnterFunc function?
---@param onLeaveFunc function?
function Details:ShowExtraStatusbar(thisLine, amount, extraAmount, totalAmount, topAmount, instanceObject, onEnterFunc, onLeaveFunc)
local extraStatusbar = thisLine.extraStatusbar
if (extraAmount and extraAmount > 0 and instanceObject.atributo == 1 and instanceObject.sub_atributo == 1) then
local initialOffset = 0
local icon_offset_x, icon_offset_y = unpack(instanceObject.row_info.icon_offset)
local bIsUsingBarStartAfterIcon = instanceObject.row_info.start_after_icon
if (bIsUsingBarStartAfterIcon) then
initialOffset = thisLine.icone_classe:GetWidth() + icon_offset_x
end
local statusBarWidth = thisLine.statusbar:GetWidth()
local percent = amount / topAmount
local fillTheGapWidth = percent * 4
local startExtraStatusbarOffset = percent * statusBarWidth
5 months ago
local extraStatusbarWidth = statusBarWidth *(extraAmount / topAmount)
extraStatusbar:ClearAllPoints()
extraStatusbar:SetHeight(thisLine:GetHeight())
if (bIsUsingBarStartAfterIcon) then
extraStatusbar:SetPoint("topleft", thisLine.icone_classe, "topright", startExtraStatusbarOffset - fillTheGapWidth, 0)
else
5 months ago
extraStatusbar:SetPoint("topleft", thisLine, "topleft",(statusBarWidth * percent) - fillTheGapWidth, 0)
end
--check if the extra bar will be bigger than the window
local windowWidth = instanceObject:GetSize()
5 months ago
local lineWidth = thisLine:GetWidth() *(amount/topAmount)
local maxExtraBarWidth = windowWidth - lineWidth - initialOffset
if (extraStatusbarWidth > maxExtraBarWidth) then
extraStatusbarWidth = maxExtraBarWidth
end
extraStatusbar:SetWidth(extraStatusbarWidth)
extraStatusbar:SetFrameLevel(thisLine:GetFrameLevel() + 1)
extraStatusbar.OnEnterCallback = onEnterFunc
extraStatusbar.OnLeaveCallback = onLeaveFunc
if (Details.combat_log.calc_evoker_damage) then
extraStatusbar:SetAlpha(0.2)
extraStatusbar.defaultAlpha = 0.2
else
extraStatusbar:SetAlpha(0.7)
extraStatusbar.defaultAlpha = 0.7
end
extraStatusbar:Show()
else
extraStatusbar:Hide()
end
end
--when the script detect the extrastatusbar need to be show, it will call this function
local handleShowExtraStatusbar = function(thisLine, self, instance, previousData, isForceRefresh, percent, bUseAnimations, totalValue, topValue)
if (self.spec == 1473 and self.augmentedSpellsContainer) then
--prepare the extra bar to show the damage prediction to augmented evoker
local onEnterFunc = damageClass.PredictedAugSpellsOnEnter
local onLeaveFunc = damageClass.PredictedAugSpellsOnLeave
Details:ShowExtraStatusbar(thisLine, self.total, self.total_extra, totalValue, topValue, instance, onEnterFunc, onLeaveFunc)
thisLine.extraStatusbar.augmentedSpellsContainer = self.augmentedSpellsContainer
thisLine.extraStatusbar.actorName = self:Name()
---@cast instance instance
thisLine.extraStatusbar.instanceId = instance:GetId()
else
Details:ShowExtraStatusbar(thisLine, self.total, self.total_extra, totalValue, topValue, instance)
end
end
function Details:RefreshLineValue(thisLine, instance, previousData, isForceRefresh, percent, bUseAnimations, totalValue, topValue) --[[exported]]
thisLine.extraStatusbar:Hide()
3 years ago
if (thisLine.colocacao == 1) then
thisLine.animacao_ignorar = true
3 years ago
if (not previousData or previousData ~= thisLine.minha_tabela or isForceRefresh) then
thisLine:SetValue(100)
if (thisLine.hidden or thisLine.fading_in or thisLine.faded) then
3 years ago
Details.FadeHandler.Fader(thisLine, "out")
end
3 years ago
return self:RefreshBarra(thisLine, instance)
else
return
end
else
if (thisLine.hidden or thisLine.fading_in or thisLine.faded) then
3 years ago
--setando o valor mesmo com anima��es pq o barra esta hidada com o value do �ltimo actor que ela mostrou
if (bUseAnimations and self.spec ~= 1473) then
3 years ago
thisLine.animacao_fim = percent
thisLine:SetValue(percent)
else
3 years ago
thisLine:SetValue(percent)
thisLine.animacao_ignorar = true
end
3 years ago
Details.FadeHandler.Fader(thisLine, "out")
if (self.total_extra and self.total_extra > 0) then
if (self.spec == 1473) then
if (Details.combat_log.calc_evoker_damage) then
handleShowExtraStatusbar(thisLine, self, instance, previousData, isForceRefresh, percent, bUseAnimations, totalValue, topValue)
end
else
handleShowExtraStatusbar(thisLine, self, instance, previousData, isForceRefresh, percent, bUseAnimations, totalValue, topValue)
end
end
3 years ago
return self:RefreshBarra(thisLine, instance)
else
3 years ago
--agora esta comparando se a tabela da barra � diferente da tabela na atualiza��o anterior
if (not previousData or previousData ~= thisLine.minha_tabela or isForceRefresh) then --aqui diz se a barra do jogador mudou de posi��o ou se ela apenas ser� atualizada
if (bUseAnimations and self.spec ~= 1473) then
3 years ago
thisLine.animacao_fim = percent
else
3 years ago
thisLine:SetValue(percent)
thisLine.animacao_ignorar = true
end
3 years ago
thisLine.last_value = percent --reseta o ultimo valor da barra
if (self.total_extra and self.total_extra > 0) then
if (self.spec == 1473) then
if (Details.combat_log.calc_evoker_damage) then
handleShowExtraStatusbar(thisLine, self, instance, previousData, isForceRefresh, percent, bUseAnimations, totalValue, topValue)
end
else
handleShowExtraStatusbar(thisLine, self, instance, previousData, isForceRefresh, percent, bUseAnimations, totalValue, topValue)
end
end
3 years ago
return self:RefreshBarra(thisLine, instance)
5 months ago
elseif(percent ~= thisLine.last_value) then
3 years ago
--apenas atualizar
if (bUseAnimations and self.spec ~= 1473) then
3 years ago
thisLine.animacao_fim = percent
else
3 years ago
thisLine:SetValue(percent)
end
3 years ago
thisLine.last_value = percent
if (self.total_extra and self.total_extra > 0) then
if (self.spec == 1473) then
if (Details.combat_log.calc_evoker_damage) then
handleShowExtraStatusbar(thisLine, self, instance, previousData, isForceRefresh, percent, bUseAnimations, totalValue, topValue)
end
else
Details:ShowExtraStatusbar(thisLine, self.total, self.total_extra, totalValue, topValue, instance)
end
end
3 years ago
return self:RefreshBarra(thisLine, instance)
else
if (self.total_extra and self.total_extra > 0) then
if (self.spec == 1473) then
if (Details.combat_log.calc_evoker_damage) then
handleShowExtraStatusbar(thisLine, self, instance, previousData, isForceRefresh, percent, bUseAnimations, totalValue, topValue)
end
else
handleShowExtraStatusbar(thisLine, self, instance, previousData, isForceRefresh, percent, bUseAnimations, totalValue, topValue)
end
end
end
end
end
end
3 years ago
local setLineTextSize = function(line, instance)
if (instance.bars_inverted) then
3 years ago
line.lineText4:SetSize(instance.cached_bar_width - line.lineText1:GetStringWidth() - 20, 15)
else
3 years ago
line.lineText1:SetSize(instance.cached_bar_width - line.lineText4:GetStringWidth() - 20, 15)
end
end
function Details:SetBarLeftText(bar, instance, enemy, arenaEnemy, arenaAlly, usingCustomLeftText) --[[exported]]
3 years ago
local barNumber = ""
if (instance.row_info.textL_show_number) then
3 years ago
barNumber = bar.colocacao .. ". "
end
if (instance.row_info.textL_translit_text) then
if (not self.transliteratedName) then
5 months ago
--translate cyrillic alphabet to western alphabet by Vardex(https://github.com/Vardex May 22, 2019)
self.transliteratedName = Translit:Transliterate(self.displayName, "!")
end
self.displayName = self.transliteratedName or self.displayName
end
if (enemy) then
3 years ago
if (arenaEnemy) then
if (instance.row_info.show_arena_role_icon) then
--show arena role icon
local sizeOffset = instance.row_info.arena_role_icon_size_offset
5 months ago
local leftText = barNumber .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" ..(instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:256:" .. Details.role_texcoord [self.role or "NONE"] .. "|t " .. self.displayName
3 years ago
if (usingCustomLeftText) then
5 months ago
bar.lineText1:SetText(stringReplace(instance.row_info.textL_custom_text, bar.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" ..(instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:256:" .. Details.role_texcoord [self.role or "NONE"] .. "|t ", self, instance.showing, instance, leftText))
else
3 years ago
bar.lineText1:SetText(leftText)
end
else
--don't show arena role icon
3 years ago
local leftText = barNumber .. self.displayName
if (usingCustomLeftText) then
bar.lineText1:SetText(stringReplace(instance.row_info.textL_custom_text, bar.colocacao, self.displayName, " ", self, instance.showing, instance, leftText))
else
3 years ago
bar.lineText1:SetText(leftText)
end
end
else
3 years ago
if (instance.row_info.show_faction_icon) then
local sizeOffset = instance.row_info.faction_icon_size_offset
if (Details.faction_against == "Horde") then
5 months ago
local leftText = barNumber .. "|TInterface\\AddOns\\Details\\images\\icones_barra:" ..(instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:32:0:32:0:32|t"..self.displayName
3 years ago
if (usingCustomLeftText) then
5 months ago
bar.lineText1:SetText(stringReplace(instance.row_info.textL_custom_text, bar.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:" ..(instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:32:0:32:0:32|t", self, instance.showing, instance, leftText))
3 years ago
else
bar.lineText1:SetText(leftText) --seta o texto da esqueda -- HORDA
end
else --alliance
5 months ago
local leftText = barNumber .. "|TInterface\\AddOns\\Details\\images\\icones_barra:" ..(instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:32:32:64:0:32|t"..self.displayName
3 years ago
if (usingCustomLeftText) then
5 months ago
bar.lineText1:SetText(stringReplace(instance.row_info.textL_custom_text, bar.colocacao, self.displayName, "|TInterface\\AddOns\\Details\\images\\icones_barra:" ..(instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:32:32:64:0:32|t", self, instance.showing, instance, leftText))
3 years ago
else
bar.lineText1:SetText(leftText) --seta o texto da esqueda -- ALLY
end
end
3 years ago
else
--don't show faction icon
local leftText = barNumber .. self.displayName
if (usingCustomLeftText) then
bar.lineText1:SetText(stringReplace(instance.row_info.textL_custom_text, bar.colocacao, self.displayName, " ", self, instance.showing, instance, leftText))
else
3 years ago
bar.lineText1:SetText(leftText)
end
end
end
else
3 years ago
if (arenaAlly and instance.row_info.show_arena_role_icon) then
local sizeOffset = instance.row_info.arena_role_icon_size_offset
5 months ago
local leftText = barNumber .. "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" ..(instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:256:" .. Details.role_texcoord [self.role or "NONE"] .. "|t " .. self.displayName
3 years ago
if (usingCustomLeftText) then
5 months ago
bar.lineText1:SetText(stringReplace(instance.row_info.textL_custom_text, bar.colocacao, self.displayName, "|TInterface\\LFGFRAME\\UI-LFG-ICON-ROLES:" ..(instance.row_info.height + sizeOffset)..":"..(instance.row_info.height + sizeOffset) .. ":0:0:256:256:" .. Details.role_texcoord [self.role or "NONE"] .. "|t ", self, instance.showing, instance, leftText))
else
3 years ago
bar.lineText1:SetText(leftText)
end
else
3 years ago
local leftText = barNumber .. self.displayName
if (usingCustomLeftText) then
bar.lineText1:SetText(stringReplace(instance.row_info.textL_custom_text, bar.colocacao, self.displayName, "", self, instance.showing, instance, leftText))
else
3 years ago
bar.lineText1:SetText(leftText) --seta o texto da esqueda
end
end
end
3 years ago
5 months ago
setLineTextSize(bar, instance)
end
function Details:SetBarColors(bar, instance, r, g, b, a) --[[exported]] --~colors
a = a or 1
3 years ago
local bUseClassColor = instance.row_info.texture_class_colors
if (self.customColor) then
bar.textura:SetVertexColor(r, g, b, a)
5 months ago
elseif(bUseClassColor) then
if (self.classe == "UNGROUPPLAYER") then
if (self.spec) then
local specId, specName, specDescription, specIcon, specRole, specClass = DetailsFramework.GetSpecializationInfoByID(self.spec)
if (specClass) then
self.classe = specClass
end
end
end
bar.textura:SetVertexColor(r, g, b, a)
else
r, g, b, a = unpack(instance.row_info.fixed_texture_color)
bar.textura:SetVertexColor(r, g, b, a)
end
3 years ago
if (instance.row_info.texture_background_class_color) then
4 years ago
bar.background:SetVertexColor(r, g, b, a)
end
3 years ago
if (instance.row_info.textL_class_colors) then
local textColor_Red, textColor_Green, textColor_Blue = self:GetTextColor(instance, "left")
bar.lineText1:SetTextColor(textColor_Red, textColor_Green, textColor_Blue) --the r, g, b color passed are the color used on the bar, so if the bar is not using class color, the text is painted with the fixed color for the bar
end
4 years ago
if (instance.row_info.textR_class_colors) then
local textColor_Red, textColor_Green, textColor_Blue = self:GetTextColor(instance, "right")
bar.lineText2:SetTextColor(textColor_Red, textColor_Green, textColor_Blue)
bar.lineText3:SetTextColor(textColor_Red, textColor_Green, textColor_Blue)
bar.lineText4:SetTextColor(textColor_Red, textColor_Green, textColor_Blue)
end
if (instance.row_info.backdrop.use_class_colors) then
--get the alpha from the border color
local alpha = instance.row_info.backdrop.color[4]
if (not bUseClassColor) then
r, g, b = self:GetClassColor()
end
bar.lineBorder:SetVertexColor(r, g, b, alpha)
end
3 years ago
end
---set the icon of the actor spec, class, pet, enemy, custom icom, spellicon, etc.
---@param self actor
---@param texture texture
---@param instance instance
---@param class string
function Details:SetClassIcon(texture, instance, class) --[[exported]] --~icons
local customIcon
if (Details.immersion_unit_special_icons) then
customIcon = Details.Immersion.GetIcon(self.aID)
end
3 years ago
--set the size offset of the icon
local iconSizeOffset = instance.row_info.icon_size_offset
local iconSize = instance.row_info.height
local newIconSize = iconSize + iconSizeOffset
texture:SetSize(newIconSize, newIconSize)
if (customIcon) then
texture:SetTexture(customIcon[1])
texture:SetTexCoord(unpack(customIcon[2]))
texture:SetVertexColor(1, 1, 1)
5 months ago
elseif(self.spellicon) then
3 years ago
texture:SetTexture(self.spellicon)
texture:SetTexCoord(0.078125, 0.921875, 0.078125, 0.921875)
5 months ago
elseif(class == "UNKNOW") then
3 years ago
texture:SetTexture([[Interface\AddOns\Details\images\classes_plus]])
texture:SetTexCoord(0.50390625, 0.62890625, 0, 0.125)
texture:SetVertexColor(1, 1, 1)
5 months ago
elseif(class == "UNGROUPPLAYER") then
if (self.spec) then
if (instance and instance.row_info.use_spec_icons) then
if (self.spec and Details.class_specs_coords[self.spec]) then
texture:SetTexture(instance.row_info.spec_file)
texture:SetTexCoord(unpack(Details.class_specs_coords[self.spec]))
texture:SetVertexColor(1, 1, 1)
return
end
end
end
local englishClass
if (self.serial ~= "") then
local bResult, sResult = pcall(function() local lClass, eClass = GetPlayerInfoByGUID(self.serial or "") return eClass end) --will error with: nil, table and boolean
if (bResult) then
englishClass = sResult
else
local bIncludeStackTrace = true
--[[GLOBAL]] DETAILS_FAILED_ACTOR = Details:GenerateActorInfo(self, sResult, bIncludeStackTrace) --avoid the game gc and details gc from destroying the actor info
Details:Msg("Bug happend on GetPlayerInfoByGUID() class_damage.lua:3419. Use command '/details bug' to report.")
englishClass = "UNKNOW"
end
end
if (englishClass) then
texture:SetTexture(instance.row_info.icon_file or [[Interface\AddOns\Details\images\classes_small]])
texture:SetTexCoord(unpack(Details.class_coords[englishClass]))
texture:SetVertexColor(1, 1, 1)
return
end
if (self.enemy) then
if (Details.faction_against == "Horde") then
3 years ago
texture:SetTexture("Interface\\ICONS\\Achievement_Character_Troll_Male")
texture:SetTexCoord(0.05, 0.95, 0.05, 0.95)
else
3 years ago
texture:SetTexture("Interface\\ICONS\\Achievement_Character_Nightelf_Female")
texture:SetTexCoord(0.05, 0.95, 0.05, 0.95)
end
else
if (Details.faction_against == "Horde") then
3 years ago
texture:SetTexture("Interface\\ICONS\\Achievement_Character_Nightelf_Female")
texture:SetTexCoord(0.05, 0.95, 0.05, 0.95)
else
3 years ago
texture:SetTexture("Interface\\ICONS\\Achievement_Character_Troll_Male")
texture:SetTexCoord(0.05, 0.95, 0.05, 0.95)
end
end
3 years ago
texture:SetVertexColor(1, 1, 1)
5 months ago
elseif(class == "PET") then
texture:SetTexture(instance and instance.row_info.icon_file or [[Interface\AddOns\Details\images\classes_small]])
texture:SetTexCoord(0.25, 0.49609375, 0.75, 1)
classColor_Red, classColor_Green, classColor_Blue = DetailsFramework:ParseColors(classColor_Red, classColor_Green, classColor_Blue)
texture:SetVertexColor(classColor_Red, classColor_Green, classColor_Blue)
3 years ago
else
if (instance and instance.row_info.use_spec_icons) then
if (self.spec and Details.class_specs_coords[self.spec]) then
texture:SetTexture(instance.row_info.spec_file)
3 years ago
texture:SetTexCoord(unpack(Details.class_specs_coords[self.spec]))
texture:SetVertexColor(1, 1, 1)
else
texture:SetTexture(instance.row_info.icon_file or [[Interface\AddOns\Details\images\classes_small]])
3 years ago
texture:SetTexCoord(unpack(Details.class_coords[class]))
texture:SetVertexColor(1, 1, 1)
end
else
texture:SetTexture(instance and instance.row_info.icon_file or [[Interface\AddOns\Details\images\classes_small]])
3 years ago
texture:SetTexCoord(unpack(Details.class_coords[class]))
texture:SetVertexColor(1, 1, 1)
end
end
end
3 years ago
function Details:RefreshBarra(thisLine, instance, fromResize) --[[exported]]
3 years ago
local class, enemy, arenaEnemy, arenaAlly = self.classe, self.enemy, self.arena_enemy, self.arena_ally
if (not class) then
3 years ago
Details:Msg("Warning, actor without a class:", self.nome, self.flag_original, self.serial)
self.classe = "UNKNOW"
class = "UNKNOW"
end
3 years ago
if (fromResize) then
classColor_Red, classColor_Green, classColor_Blue = self:GetBarColor()
end
3 years ago
--icon
4 years ago
self:SetClassIcon(thisLine.icone_classe, instance, class)
3 years ago
5 months ago
if (thisLine.mouse_over) then
local classIcon = thisLine:GetClassIcon()
thisLine.iconHighlight:SetTexture(classIcon:GetTexture())
thisLine.iconHighlight:SetTexCoord(classIcon:GetTexCoord())
thisLine.iconHighlight:SetVertexColor(classIcon:GetVertexColor())
end
3 years ago
--texture color
self:SetBarColors(thisLine, instance, classColor_Red, classColor_Green, classColor_Blue)
3 years ago
--left text
5 months ago
self:SetBarLeftText(thisLine, instance, enemy, arenaEnemy, arenaAlly, bUsingCustomLeftText)
end
5 months ago
---~aug ~evoker
---@param self table extraStatusbar frame
function damageClass.PredictedAugSpellsOnEnter(self)
if (Details.show_aug_predicted_spell_damage) then
---@type spellcontainer
local spellContainer = self.augmentedSpellsContainer
GameCooltip:Preset(2)
---@type instance
local instanceObject = Details:GetInstance(self.instanceId)
---@type combat
local combatObject = instanceObject:GetCombat()
for spellId, spellTable in spellContainer:ListSpells() do
local spellName, _, spellTexture = GetSpellInfo(spellId)
if (spellName) then
GameCooltip:AddLine(spellName, Details:Format(spellTable.total))
GameCooltip:AddIcon(spellTexture, 1, 1, 14, 14)
local spellsAugmented = {}
--the damage sources are added into the targets table for recycling
---@type table<actorname, valueamount>
local sources = spellTable.targets
for sourceName, sourceAmount in pairs(sources) do
spellsAugmented[#spellsAugmented+1] = {sourceName, sourceAmount}
end
table.sort(spellsAugmented, Details.Sort2)
for i = 1, math.min(#spellsAugmented, 5) do
local sourceName, sourceAmount = unpack(spellsAugmented[i])
GameCooltip:AddLine(sourceName, Details:Format(sourceAmount), 1, "yellow", "yellow", 10)
local actorObject = combatObject:GetActor(1, sourceName)
if (actorObject) then
local actorIcon = Details:GetActorIcon(actorObject)
if (actorIcon) then
GameCooltip:AddIcon(actorIcon.texture, 1, 1, 14, 14, actorIcon.coords.left, actorIcon.coords.right, actorIcon.coords.top, actorIcon.coords.bottom)
else
GameCooltip:AddIcon([[Interface\COMMON\Indicator-Gray]], 1, 1, 14, 14)
end
end
end
GameCooltip:AddLine(" ")
GameCooltip:AddIcon("", 1, 1, 5, 5)
end
end
else
---@type instance
local instanceObject = Details:GetInstance(self.instanceId)
---@type combat
local combatObject = instanceObject:GetCombat()
local combatTime = combatObject:GetCombatTime()
---@type actorname
local actorName = self.actorName
---@type actorcontainer
local utilityContainer = combatObject:GetContainer(DETAILS_ATTRIBUTE_MISC)
---@type table<spellid, table<spellid, number, actorname, actorname, class, boolean>>
local buffUptimeTable = {}
5 months ago
local iconSize = 22
local iconBorderInfo = Details.tooltip.icon_border_texcoord
local CONST_SPELLID_EBONMIGHT = 395152
local CONST_SPELLID_PRESCIENCE = 410089
local CONST_SPELLID_BLACKATTUNEMENT = 403264
local CONST_SPELLID_BLISTERING_SCALES = 360827
5 months ago
local ebonMightSpellName, _, ebonMightSpellIcon = Details.GetSpellInfo(CONST_SPELLID_EBONMIGHT)
local _, _, ebonMightOnSelfIcon = Details.GetSpellInfo(395296)
---@type actor[]
local augmentationEvokers = {}
5 months ago
local thisEvokerObject = utilityContainer:GetActor(actorName)
--prescience and ebon might updatime on each actor
5 months ago
for _, actorUtilityObject in utilityContainer:ListActors() do
---@type spellcontainer
5 months ago
local receivedBuffs = actorUtilityObject.received_buffs_spells
--check if the actor is an augmentation evoker
5 months ago
if (actorUtilityObject.spec == 1473) then
augmentationEvokers[#augmentationEvokers+1] = actorUtilityObject
if (actorUtilityObject:Name() == actorName) then
thisEvokerObject = actorUtilityObject
end
end
5 months ago
if (receivedBuffs and actorUtilityObject:IsPlayer() and actorUtilityObject:IsGroupPlayer()) then
for sourceNameSpellId, spellTable in receivedBuffs:ListSpells() do
local sourceName, spellId = strsplit("@", sourceNameSpellId)
if (sourceName == actorName) then
spellId = tonumber(spellId)
local spellName, _, spellIcon = Details.GetSpellInfo(spellId)
if (spellName and spellId) then
sourceName = detailsFramework:RemoveRealmName(sourceName)
5 months ago
local targetName = actorUtilityObject:Name()
targetName = detailsFramework:RemoveRealmName(targetName)
local uptime = spellTable.uptime or 0
local bCanShowOnTooltip = true
buffUptimeTable[spellId] = buffUptimeTable[spellId] or {}
5 months ago
table.insert(buffUptimeTable[spellId], {spellId, uptime, sourceName, targetName, actorUtilityObject:Class(), bCanShowOnTooltip})
end
end
end
end
end
for spellId, buffTable in pairs(buffUptimeTable) do
local totalUptime = 0
for i = 1, #buffTable do
totalUptime = totalUptime + buffTable[i][2]
end
table.sort(buffTable, Details.Sort2)
end
Details:FormatCooltipForSpells()
Details:AddTooltipSpellHeaderText(Loc ["STRING_SPELLS"], headerColor, #buffUptimeTable, Details.tooltip_spell_icon.file, unpack(Details.tooltip_spell_icon.coords))
Details:AddTooltipHeaderStatusbar(.1, .1, .1, 0.834)
--add the total combat time into the tooltip
local combatTimeMinutes, combatTimeSeconds = math.floor(combatTime / 60), math.floor(combatTime % 60)
5 months ago
GameCooltip:AddLine("Combat Time", combatTimeMinutes .. "m " .. combatTimeSeconds .. "s" .. "(" .. format("%.1f", 100) .. "%)")
GameCooltip:AddIcon([[Interface\TARGETINGFRAME\UnitFrameIcons]], nil, nil, iconSize, iconSize, iconBorderInfo.L, iconBorderInfo.R, iconBorderInfo.T, iconBorderInfo.B)
Details:AddTooltipBackgroundStatusbar(false, 100, true, "darkgreen")
GameCooltip:AddLine("", "")
GameCooltip:AddIcon("", nil, nil, 1, 1)
5 months ago
--show the caster evoker ebonmight uptime on the tooltip
local thisEvokerEbonMightSpellTable = thisEvokerObject.buff_uptime_spells:GetSpell(395296)
local evokerEbonMightUptime = thisEvokerEbonMightSpellTable and thisEvokerEbonMightSpellTable.uptime
local ebonMightColor = "saddlebrown"
if (evokerEbonMightUptime) then
local minutes, seconds = math.floor(evokerEbonMightUptime / 60), math.floor(evokerEbonMightUptime % 60)
local percent = evokerEbonMightUptime / combatTime * 100
if (minutes > 0) then
GameCooltip:AddLine(ebonMightSpellName .. "(self)", minutes .. "m " .. seconds .. "s" .. "(" .. format("%.1f", percent) .. "%)")
Details:AddTooltipBackgroundStatusbar(false, percent, true, ebonMightColor)
else
GameCooltip:AddLine(ebonMightSpellName .. "(self)", seconds .. "s" .. "(" .. format("%.1f", percent) .. "%)")
Details:AddTooltipBackgroundStatusbar(false, percent, true, ebonMightColor)
end
GameCooltip:AddIcon(ebonMightOnSelfIcon, nil, nil, iconSize, iconSize, iconBorderInfo.L, iconBorderInfo.R, iconBorderInfo.T, iconBorderInfo.B)
end
local ebonMightTable = buffUptimeTable[CONST_SPELLID_EBONMIGHT]
if (ebonMightTable) then
5 months ago
--all ebon mights
for i = 1, #ebonMightTable do
local thisEbonMightTable = ebonMightTable[i]
local uptime = thisEbonMightTable[2]
local evokerName = thisEbonMightTable[3]
local targetName = thisEbonMightTable[4]
local targetClass = thisEbonMightTable[5]
local spellName = ebonMightSpellName
if (evokerName) then
targetName = detailsFramework:AddClassColorToText(targetName, targetClass)
targetName = detailsFramework:AddClassIconToText(targetName, targetName, targetClass)
spellName = spellName .. " [" .. targetName .. " ]"
end
local minutes, seconds = math.floor(uptime / 60), math.floor(uptime % 60)
5 months ago
if (uptime > 0) then
local uptimePercent = uptime / combatTime * 100
GameCooltip:AddLine(spellName, minutes .. "m " .. seconds .. "s" .. "(" .. format("%.1f", uptimePercent) .. "%)")
GameCooltip:AddIcon(ebonMightSpellIcon, nil, nil, iconSize, iconSize, iconBorderInfo.L, iconBorderInfo.R, iconBorderInfo.T, iconBorderInfo.B)
Details:AddTooltipBackgroundStatusbar(false, uptimePercent, true, ebonMightColor)
end
end
end
GameCooltip:AddLine("", "")
GameCooltip:AddIcon("", nil, nil, 1, 1)
for i = 1, #augmentationEvokers do --black attunement
local actorObject = augmentationEvokers[i]
if (actorObject:Name() == actorName) then
local buffUptimeSpellContainer = actorObject:GetSpellContainer("buff")
if (buffUptimeSpellContainer) then
local spellTable = buffUptimeSpellContainer:GetSpell(403264)
if (spellTable) then
local uptime = spellTable.uptime
local spellName, _, spellIcon = _GetSpellInfo(CONST_SPELLID_BLACKATTUNEMENT)
local uptimePercent = uptime / combatTime * 100
if (uptime <= combatTime) then
local minutes, seconds = math.floor(uptime / 60), math.floor(uptime % 60)
if (minutes > 0) then
5 months ago
GameCooltip:AddLine(spellName, minutes .. "m " .. seconds .. "s" .. "(" .. format("%.1f", uptimePercent) .. "%)")
Details:AddTooltipBackgroundStatusbar(false, uptimePercent, true, "darkgreen")
else
5 months ago
GameCooltip:AddLine(spellName, seconds .. "s" .. "(" .. format("%.1f", uptimePercent) .. "%)")
Details:AddTooltipBackgroundStatusbar(false, uptimePercent, true, "darkgreen")
end
GameCooltip:AddIcon(spellIcon, nil, nil, iconSize, iconSize, iconBorderInfo.L, iconBorderInfo.R, iconBorderInfo.T, iconBorderInfo.B)
end
end
local spellTable = buffUptimeSpellContainer:GetSpell(CONST_SPELLID_BLISTERING_SCALES)
if (spellTable) then
local uptime = spellTable.uptime
local spellName, _, spellIcon = _GetSpellInfo(CONST_SPELLID_BLISTERING_SCALES)
local uptimePercent = uptime / combatTime * 100
if (uptime <= combatTime) then
local minutes, seconds = math.floor(uptime / 60), math.floor(uptime % 60)
if (minutes > 0) then
5 months ago
GameCooltip:AddLine(spellName, minutes .. "m " .. seconds .. "s" .. "(" .. format("%.1f", uptimePercent) .. "%)")
Details:AddTooltipBackgroundStatusbar(false, uptimePercent, true, "darkgreen")
else
5 months ago
GameCooltip:AddLine(spellName, seconds .. "s" .. "(" .. format("%.1f", uptimePercent) .. "%)")
Details:AddTooltipBackgroundStatusbar(false, uptimePercent, true, "darkgreen")
end
GameCooltip:AddIcon(spellIcon, nil, nil, iconSize, iconSize, iconBorderInfo.L, iconBorderInfo.R, iconBorderInfo.T, iconBorderInfo.B)
end
end
end
end
end
GameCooltip:AddLine("", "")
GameCooltip:AddIcon("", nil, nil, 1, 1)
--add the buff uptime into the tooltip
local allPrescienceTargets = buffUptimeTable[CONST_SPELLID_PRESCIENCE]
if (allPrescienceTargets and #allPrescienceTargets > 0) then
for i = 1, math.min(30, #allPrescienceTargets) do
local uptimeTable = allPrescienceTargets[i]
local spellId = uptimeTable[1]
local uptime = uptimeTable[2]
local sourceName = uptimeTable[3]
local targetName = uptimeTable[4]
local targetClass = uptimeTable[5]
local bCanShow = uptimeTable[6]
local uptimePercent = uptime / combatTime * 100
if (uptime > 0 and uptimePercent < 99.5 and bCanShow) then
local spellName, _, spellIcon = _GetSpellInfo(spellId)
if (sourceName) then
targetName = detailsFramework:AddClassColorToText(targetName, targetClass)
targetName = detailsFramework:AddClassIconToText(targetName, targetName, targetClass)
5 months ago
spellName = spellName .. " [" .. targetName .. " ]"
end
if (uptime <= combatTime) then
local minutes, seconds = math.floor(uptime / 60), math.floor(uptime % 60)
if (minutes > 0) then
5 months ago
GameCooltip:AddLine(spellName, minutes .. "m " .. seconds .. "s" .. "(" .. format("%.1f", uptimePercent) .. "%)")
Details:AddTooltipBackgroundStatusbar(false, uptimePercent, true, sourceName and "darkgreen")
else
5 months ago
GameCooltip:AddLine(spellName, seconds .. "s" .. "(" .. format("%.1f", uptimePercent) .. "%)")
Details:AddTooltipBackgroundStatusbar(false, uptimePercent, true, sourceName and "darkgreen")
end
GameCooltip:AddIcon(spellIcon, nil, nil, iconSize, iconSize, iconBorderInfo.L, iconBorderInfo.R, iconBorderInfo.T, iconBorderInfo.B)
end
end
end
else
GameCooltip:AddLine(Loc ["STRING_NO_SPELL"])
end
local evokerObject = combatObject:GetActor(DETAILS_ATTRIBUTE_MISC, actorName)
GameCooltip:AddLine(" ")
GameCooltip:AddIcon(" ", 1, 1, 10, 10)
if (evokerObject) then
GameCooltip:AddLine("Prescience Uptime by Amount of Applications")
local prescienceData = evokerObject.cleu_prescience_time
if (prescienceData) then
prescienceData = prescienceData.stackTime
local totalTimeWithPrescienceUp = 0
for amountOfPrescienceApplied, time in ipairs(prescienceData) do
totalTimeWithPrescienceUp = totalTimeWithPrescienceUp + time
end
for amountOfPrescienceApplied, time in ipairs(prescienceData) do
if (time > 0) then
local uptimePercent = time / combatTime * 100
local timeString = detailsFramework:IntegerToTimer(time)
5 months ago
GameCooltip:AddLine("Presciece Applied: " .. amountOfPrescienceApplied, timeString .. "(" .. format("%.1f", uptimePercent) .. "%)")
--5199639 prescience icon
GameCooltip:AddIcon([[Interface\AddOns\Details\images\spells\prescience_time]], nil, nil, iconSize, iconSize)
Details:AddTooltipBackgroundStatusbar(false, time/totalTimeWithPrescienceUp*100, true, "green")
end
end
end
end
--iterate among all the actors and find which one are healers, then get the amount of mana the evoker restored for that healer
---@type actorcontainer
local resourcesContainer = combatObject:GetContainer(DETAILS_ATTRIBUTE_ENERGY)
local manaRestoredToHealers = {}
for index, actorObject in resourcesContainer:ListActors() do
if (actorObject.spec == 1473) then --this is an aug evoker
local spellContainer = actorObject:GetSpellContainer("spell")
--local spellContainer = actorObject.spells
if (spellContainer) then
local sourceOfMagic = spellContainer:GetSpell(372571)
if (sourceOfMagic) then
for targetName, restoredAmount in pairs(sourceOfMagic.targets) do
manaRestoredToHealers[#manaRestoredToHealers+1] = {targetName, restoredAmount}
end
end
end
end
end
if (#manaRestoredToHealers > 0) then
GameCooltip:AddLine(" ")
GameCooltip:AddIcon(" ", 1, 1, 10, 10)
GameCooltip:AddLine("Mana Restored to Healers:")
table.sort(manaRestoredToHealers, Details.Sort2)
for i = 1, math.min(10, #manaRestoredToHealers) do
local targetName, restoredAmount = unpack(manaRestoredToHealers[i])
local targetActorObject = combatObject(DETAILS_ATTRIBUTE_ENERGY, targetName)
if (targetActorObject) then
local targetClass = targetActorObject:GetActorClass()
local targetName = detailsFramework:AddClassColorToText(targetName, targetClass)
targetName = detailsFramework:AddClassIconToText(targetName, targetName, targetClass)
GameCooltip:AddLine(targetName, Details:Format(restoredAmount))
local spellIcon = GetSpellTexture(372571)
GameCooltip:AddIcon(spellIcon, nil, nil, iconSize, iconSize, iconBorderInfo.L, iconBorderInfo.R, iconBorderInfo.T, iconBorderInfo.B)
Details:AddTooltipBackgroundStatusbar(false, 100, true, "dodgerblue")
end
end
end
end
GameCooltip:AddLine("feature under test, can't disable atm")
GameCooltip:AddIcon([[Interface\BUTTONS\UI-GROUPLOOT-PASS-DOWN]], nil, nil, 16, 16)
--GameCooltip:SetOption("LeftBorderSize", -5)
--GameCooltip:SetOption("RightBorderSize", 5)
--GameCooltip:SetOption("RightTextMargin", 0)
GameCooltip:SetOption("VerticalOffset", 0)
--GameCooltip:SetOption("AlignAsBlizzTooltip", true)
GameCooltip:SetOption("AlignAsBlizzTooltipFrameHeightOffset", 0)
GameCooltip:SetOption("LineHeightSizeOffset", 0)
GameCooltip:SetOption("VerticalPadding", 0)
GameCooltip:ShowCooltip(self, "tooltip")
end
function damageClass.PredictedAugSpellsOnLeave(self)
GameCooltip:Hide()
--extraStatusbar.defaultAlpha
end
--------------------------------------------- // TOOLTIPS // ---------------------------------------------
3 years ago
---------TOOLTIPS BIFURCA��O
-- ~tooltip
5 months ago
function damageClass:ToolTip(instance, numero, barra, keydown)
3 years ago
--seria possivel aqui colocar o icone da classe dele?
3 years ago
if (instance.atributo == 5) then --custom
return self:TooltipForCustom(barra)
else
3 years ago
if (instance.sub_atributo == 1 or instance.sub_atributo == 2) then --damage done or Dps or enemy
return self:ToolTip_DamageDone(instance, numero, barra, keydown)
5 months ago
elseif(instance.sub_atributo == 3) then --damage taken
3 years ago
return self:ToolTip_DamageTaken(instance, numero, barra, keydown)
5 months ago
elseif(instance.sub_atributo == 6) then --enemies
3 years ago
return self:ToolTip_Enemies(instance, numero, barra, keydown)
5 months ago
elseif(instance.sub_atributo == 4) then --friendly fire
3 years ago
return self:ToolTip_FriendlyFire(instance, numero, barra, keydown)
end
end
end
3 years ago
--tooltip locals
local r, g, b
local barAlha = .6
5 months ago
Details222.commprefixes = "Comm"
3 years ago
---------DAMAGE DONE & DPS
5 months ago
local findPlayerPositionInEnemyDamageTaken = function(playerName, enemyName, combatObject)
--find the player position in the enemy damage taken table
---@type actordamage
local enemyActor = combatObject(DETAILS_ATTRIBUTE_DAMAGE, enemyName)
local damagers = {}
if (enemyActor) then
local damageTakenTable = enemyActor.damage_from
for damagerName in pairs(damageTakenTable) do
---@type actordamage
local damagerActor = combatObject(DETAILS_ATTRIBUTE_DAMAGE, damagerName)
if (damagerActor and damagerActor:IsPlayer()) then
local amount = damagerActor.targets[enemyName] or 0
damagers[#damagers+1] = {damagerName, amount}
end
end
end
table.sort(damagers, Details.Sort2)
for i = 1, #damagers do
if (damagers[i][1] == playerName) then
return "#" .. i --return the position of the player in the enemy damage taken table
end
end
return "" --not found
end
5 months ago
function damageClass:ToolTip_DamageDone(instancia, numero, barra, keydown)
local owner = self.owner
if (owner and owner.classe) then
3 years ago
r, g, b = unpack(Details.class_colors [owner.classe])
else
if (not Details.class_colors [self.classe]) then
3 years ago
return print("Details!: error class not found:", self.classe, "for", self.nome)
end
3 years ago
r, g, b = unpack(Details.class_colors [self.classe])
end
local combatObject = instancia:GetShowingCombat()
3 years ago
--habilidades
local icon_size = Details.tooltip.icon_size
local icon_border = Details.tooltip.icon_border_texcoord
3 years ago
do
3 years ago
--TOP HABILIDADES
--get variables
--local ActorDamage = self.total_without_pet --mostrando os pets no tooltip
local ActorDamage = self.total
local ActorDamageWithPet = self.total
if (ActorDamage == 0) then
ActorDamage = 0.00000001
end
local ActorSkillsContainer = self.spells._ActorTable
local ActorSkillsSortTable = {}
local reflectionSpells = {}
3 years ago
--get time type
local meu_tempo
if (Details.time_type == 1 or not self.grupo) then
meu_tempo = self:Tempo()
5 months ago
elseif(Details.time_type == 2 or Details.use_realtimedps) then
meu_tempo = instancia.showing:GetCombatTime()
end
if (not meu_tempo) then
meu_tempo = instancia.showing:GetCombatTime()
if (Details.time_type == 3) then --time type 3 is deprecated
Details.time_type = 2
end
end
--add actor spells
3 years ago
for _spellid, _skill in pairs(ActorSkillsContainer) do
ActorSkillsSortTable [#ActorSkillsSortTable+1] = {_spellid, _skill.total, _skill.total/meu_tempo}
if (_skill.isReflection) then
reflectionSpells[#reflectionSpells+1] = _skill
end
end
--add actor pets
3 years ago
for petIndex, petName in ipairs(self:Pets()) do
5 months ago
local petActor = instancia.showing[class_type]:PegarCombatente(nil, petName)
if (petActor) then
3 years ago
for _spellid, _skill in pairs(petActor:GetActorSpells()) do
local formattedPetName = petName:gsub((" <.*"), "")
if (instancia.row_info.textL_translit_text) then
formattedPetName = Translit:Transliterate(formattedPetName, "!")
end
ActorSkillsSortTable [#ActorSkillsSortTable+1] = {_spellid, _skill.total, _skill.total/meu_tempo, formattedPetName}
end
end
end
--sort
table.sort(ActorSkillsSortTable, Details.Sort2)
3 years ago
--TOP INIMIGOS
--get variables
local ActorTargetsSortTable = {}
3 years ago
--add
for targetName, amount in pairs(self.targets) do
local targetActorObject = combatObject(DETAILS_ATTRIBUTE_DAMAGE, targetName)
local npcId = targetActorObject and targetActorObject.aID
npcId = tonumber(npcId or 0)
ActorTargetsSortTable[#ActorTargetsSortTable+1] = {targetName, amount, npcId}
end
--sort
table.sort(ActorTargetsSortTable, Details.Sort2)
--tooltip stuff
local tooltip_max_abilities = Details.tooltip.tooltip_max_abilities
3 years ago
local is_maximized = false
5 months ago
if (keydown == "shift" or tooltipMaximizedMethod == 2 or tooltipMaximizedMethod == 3) then
tooltip_max_abilities = 99
is_maximized = true
end
3 years ago
--MOSTRA HABILIDADES
5 months ago
--Details:AddTooltipSpellHeaderText(Loc ["STRING_SPELLS"], headerColor, #ActorSkillsSortTable, Details.tooltip_spell_icon.file, unpack(Details.tooltip_spell_icon.coords))
if (is_maximized) then
--highlight shift key
5 months ago
--GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2)
--Details:AddTooltipHeaderStatusbar(r, g, b, 1)
else
5 months ago
--GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1)
--Details:AddTooltipHeaderStatusbar(r, g, b, barAlha)
end
3 years ago
GameCooltip:SetOption("AlignAsBlizzTooltip", false)
GameCooltip:SetOption("YSpacingMod", -6)
local iconSize = Details.DefaultTooltipIconSize
local topAbility = ActorSkillsSortTable [1] and ActorSkillsSortTable [1][2] or 0.0001
3 years ago
if (#ActorSkillsSortTable > 0) then
5 months ago
for i = 1, math.min(tooltip_max_abilities, #ActorSkillsSortTable) do
3 years ago
local SkillTable = ActorSkillsSortTable [i]
3 years ago
local spellID = SkillTable [1]
local totalDamage = SkillTable [2]
local totalDPS = SkillTable [3]
local petName = SkillTable [4]
3 years ago
local nome_magia, _, icone_magia = _GetSpellInfo(spellID)
if (petName) then
if (not nome_magia) then
spellID = spellID or "spellId?"
5 months ago
nome_magia = "|cffffaa00" .. spellID .. " " .. "(|cFFCCBBBB" .. petName .. "|r)"
else
5 months ago
nome_magia = nome_magia .. "(|cFFCCBBBB" .. petName .. "|r)"
end
end
3 years ago
local percent = format("%.1f", totalDamage/ActorDamage*100)
if (string.len(percent) < 4) then
percent = percent .. "0"
end
if (instancia.sub_atributo == 1 or instancia.sub_atributo == 6) then
5 months ago
GameCooltip:AddLine(nome_magia, formatTooltipNumber(_, totalDamage) .." ("..percent.."%)")
else
5 months ago
GameCooltip:AddLine(nome_magia, formatTooltipNumber(_, math.floor(totalDPS)) .." ("..percent.."%)")
end
3 years ago
5 months ago
GameCooltip:AddIcon(icone_magia, nil, nil, iconSize, iconSize, icon_border.L, icon_border.R, icon_border.T, icon_border.B)
Details:AddTooltipBackgroundStatusbar(false, totalDamage/topAbility*100)
end
else
3 years ago
GameCooltip:AddLine(Loc ["STRING_NO_SPELL"])
end
3 years ago
--spell reflected
if (#reflectionSpells > 0) then
--small blank space
5 months ago
Details:AddTooltipSpellHeaderText("", headerColor, 1, false, 0.1, 0.9, 0.1, 0.9, true) --add a space
Details:AddTooltipSpellHeaderText("Spells Reflected", headerColor, 1, select(3, _GetSpellInfo(reflectionSpells[1].id)), 0.1, 0.9, 0.1, 0.9) --localize-me
Details:AddTooltipHeaderStatusbar(r, g, b, barAlha)
for i = 1, #reflectionSpells do
local _spell = reflectionSpells[i]
local extraInfo = _spell.extra
for spellId, damageDone in pairs(extraInfo) do
local spellName, _, spellIcon = _GetSpellInfo(spellId)
if (spellName) then
5 months ago
GameCooltip:AddLine(spellName, formatTooltipNumber(_, damageDone) .. " (" .. math.floor(damageDone / self.total * 100) .. "%)")
Details:AddTooltipBackgroundStatusbar(false, damageDone / self.total * 100)
GameCooltip:AddIcon(spellIcon, 1, 1, iconSize, iconSize, 0.1, 0.9, 0.1, 0.9)
end
end
end
3 years ago
end
5 months ago
--targets(enemies)
local topEnemy = ActorTargetsSortTable[1] and ActorTargetsSortTable[1][2] or 0
if (instancia.sub_atributo == 1 or instancia.sub_atributo == 6) then
--small blank space
Details:AddTooltipSpellHeaderText("", headerColor, 1, false, 0.1, 0.9, 0.1, 0.9, true)
Details:AddTooltipSpellHeaderText(Loc ["STRING_TARGETS"], headerColor, #ActorTargetsSortTable, [[Interface\Addons\Details\images\icons]], 0, 0.03125, 0.126953125, 0.15625)
local max_targets = Details.tooltip.tooltip_max_targets
local is_maximized = false
5 months ago
if (keydown == "ctrl" or tooltipMaximizedMethod == 2 or tooltipMaximizedMethod == 4) then
max_targets = 99
is_maximized = true
end
3 years ago
if (is_maximized) then
--highlight
GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_ctrl]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2)
Details:AddTooltipHeaderStatusbar(r, g, b, 1)
else
GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_ctrl]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1)
Details:AddTooltipHeaderStatusbar(r, g, b, barAlha)
end
for i = 1, math.min(max_targets, #ActorTargetsSortTable) do
local enemyTable = ActorTargetsSortTable[i]
5 months ago
local position = findPlayerPositionInEnemyDamageTaken(self.nome, enemyTable[1], combatObject)
GameCooltip:AddLine(enemyTable[1], formatTooltipNumber(_, enemyTable[2]) .. " " .. position .. " ("..format("%.1f", enemyTable[2] / ActorDamageWithPet * 100).."%)")
local portraitTexture-- = Details222.Textures.GetPortraitTextureForNpcID(enemyTable[3]) --disabled atm
if (portraitTexture) then
GameCooltip:AddIcon(portraitTexture, 1, 1, icon_size.W, icon_size.H)
else
GameCooltip:AddIcon([[Interface\PetBattles\PetBattle-StatIcons]], nil, nil, icon_size.W, icon_size.H, 0, 0.5, 0, 0.5, {.7, .7, .7, 1}, nil, true)
end
Details:AddTooltipBackgroundStatusbar(false, enemyTable[2] / topEnemy * 100)
end
end
end
3 years ago
--PETS
local instance = instancia
local combatObject = instance:GetShowingCombat()
3 years ago
local myPets = self.pets
if (#myPets > 0) then --teve ajudantes
local petAmountWithSameName = {} --armazena a quantidade de pets iguais
local petDamageTable = {} --armazena o dano total de cada objeto
3 years ago
--small blank space
Details:AddTooltipSpellHeaderText("", headerColor, 1, false, 0.1, 0.9, 0.1, 0.9, true)
for index, petName in ipairs(myPets) do
if (not petAmountWithSameName[petName]) then
petAmountWithSameName[petName] = 1
local damageContainer = combatObject:GetContainer(DETAILS_ATTRIBUTE_DAMAGE)
local petActorObject = damageContainer:GetActor(petName)
3 years ago
if (petActorObject) then
local petDamageDone = petActorObject.total_without_pet
local petSpells = petActorObject:GetSpellList()
local petSpellsSorted = {}
3 years ago
--local timeInCombat = petActorObject:GetTimeInCombat(self)
local timeInCombat = 0
if (Details.time_type == 1 or not self.grupo) then
timeInCombat = petActorObject:Tempo()
5 months ago
elseif(Details.time_type == 2 or Details.use_realtimedps) then
timeInCombat = petActorObject:GetCombatTime()
end
3 years ago
petDamageTable[#petDamageTable+1] = {petName, petActorObject.total_without_pet, petActorObject.total_without_pet / timeInCombat}
for spellId, spellTable in pairs(petSpells) do
local spellName, rank, spellIcon = _GetSpellInfo(spellId)
tinsert(petSpellsSorted, {spellId, spellTable.total, spellTable.total / petDamageDone * 100, {spellName, rank, spellIcon}})
end
3 years ago
table.sort(petSpellsSorted, Details.Sort2)
local petTargets = {}
petSpells = petActorObject.targets
for targetName, spellDamageDone in pairs(petSpells) do
tinsert(petTargets, {targetName, spellDamageDone, spellDamageDone / petDamageDone * 100})
end
table.sort(petTargets,Details.Sort2)
end
else
petAmountWithSameName[petName] = petAmountWithSameName[petName] + 1
end
end
3 years ago
local petHeaderAdded = false
3 years ago
table.sort(petDamageTable, Details.Sort2)
3 years ago
local ismaximized = false
5 months ago
if (keydown == "alt" or tooltipMaximizedMethod == 2 or tooltipMaximizedMethod == 5) then
ismaximized = true
end
3 years ago
local topPetDamageDone = petDamageTable[1] and petDamageTable[1][2] or 0
3 years ago
for index, damageTable in ipairs(petDamageTable) do
5 months ago
if (damageTable [2] > 0 and(index <= Details.tooltip.tooltip_max_pets or ismaximized)) then
if (not petHeaderAdded) then
petHeaderAdded = true
Details:AddTooltipSpellHeaderText(Loc ["STRING_PETS"], headerColor, #petDamageTable, [[Interface\COMMON\friendship-heart]], 0.21875, 0.78125, 0.09375, 0.6875)
3 years ago
if (ismaximized) then
5 months ago
GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_alt]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2)
Details:AddTooltipHeaderStatusbar(r, g, b, 1)
else
5 months ago
GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_alt]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1)
Details:AddTooltipHeaderStatusbar(r, g, b, barAlha)
end
end
3 years ago
local petName = damageTable[1]
local petDamageDone = damageTable[2]
local petDPS = damageTable[3]
petName = damageTable[1]:gsub(("%s%<.*"), "")
if (instance.row_info.textL_translit_text) then
petName = Translit:Transliterate(petName, "!")
end
if (instancia.sub_atributo == 1) then
5 months ago
GameCooltip:AddLine(petName, formatTooltipNumber(_, petDamageDone) .. " (" .. math.floor(petDamageDone/self.total*100) .. "%)")
else
5 months ago
GameCooltip:AddLine(petName, formatTooltipNumber(_, math.floor(petDPS)) .. " (" .. math.floor(petDamageDone/self.total*100) .. "%)")
end
3 years ago
Details:AddTooltipBackgroundStatusbar(false, petDamageDone / topPetDamageDone * 100)
3 years ago
GameCooltip:AddIcon([[Interface\AddOns\Details\images\classes_small_alpha]], 1, 1, icon_size.W, icon_size.H, 0.25/2, 0.49609375/2, 0.75/2, 1/2)
end
end
end
3 years ago
--~Phases
local segment = instancia:GetShowingCombat()
if (segment and self.grupo) then
local bossInfo = segment:GetBossInfo()
local phasesInfo = segment:GetPhases()
if (bossInfo and phasesInfo) then
if (#phasesInfo > 1) then
3 years ago
--small blank space
5 months ago
Details:AddTooltipSpellHeaderText("", headerColor, 1, false, 0.1, 0.9, 0.1, 0.9, true)
5 months ago
Details:AddTooltipSpellHeaderText("Damage Per Phase", headerColor, 1, [[Interface\Garrison\orderhall-missions-mechanic8]], 11/64, 53/64, 11/64, 53/64) --localize-me
Details:AddTooltipHeaderStatusbar(r, g, b, barAlha)
3 years ago
local playerPhases = {}
local totalDamage = 0
3 years ago
for phase, playersTable in pairs(phasesInfo.damage) do --each phase
local allPlayers = {} --all players for this phase
3 years ago
for playerName, amount in pairs(playersTable) do
tinsert(allPlayers, {playerName, amount})
totalDamage = totalDamage + amount
end
5 months ago
table.sort(allPlayers, function(a, b) return a[2] > b[2] end)
3 years ago
local myRank = 0
for i = 1, #allPlayers do
if (allPlayers [i] [1] == self.nome) then
myRank = i
break
end
end
3 years ago
5 months ago
tinsert(playerPhases, {phase, playersTable [self.nome] or 0, myRank,(playersTable [self.nome] or 0) / totalDamage * 100})
end
3 years ago
5 months ago
table.sort(playerPhases, function(a, b) return a[1] < b[1] end)
3 years ago
for i = 1, #playerPhases do
--[1] Phase Number [2] Amount Done [3] Rank [4] Percent
5 months ago
GameCooltip:AddLine("|cFFF0F0F0Phase|r " .. playerPhases [i][1], formatTooltipNumber(_, playerPhases [i][2]) .. " (|cFFFFFF00#" .. playerPhases [i][3] .. "|r, " .. format("%.1f", playerPhases [i][4]) .. "%)")
GameCooltip:AddIcon([[Interface\Garrison\orderhall-missions-mechanic9]], 1, 1, 14, 14, 11/64, 53/64, 11/64, 53/64)
Details:AddTooltipBackgroundStatusbar()
end
end
end
end
return true
end
3 years ago
local on_switch_show_enemies = function(instance)
instance:TrocaTabela(instance, true, 1, 6)
return true
end
3 years ago
local on_switch_show_frags = function(instance)
instance:TrocaTabela(instance, true, 1, 5)
return true
end
3 years ago
local ENEMIES_format_name = function(player) if (player == 0) then return false end return Details:GetOnlyName(player.nome) end
5 months ago
local ENEMIES_format_amount = function(amount) if (amount <= 0) then return false end return Details:ToK(amount) .. "(" .. format("%.1f", amount / tooltip_temp_table.damage_total * 100) .. "%)" end
5 months ago
function damageClass:ReportEnemyDamageTaken(actor, instance, ShiftKeyDown, ControlKeyDown, fromFrags)
--can open the breakdown window now
--this function is deprecated
if (ShiftKeyDown) then
local inimigo = actor.nome
local custom_name = inimigo .. " -" .. Loc ["STRING_CUSTOM_ENEMY_DT"]
3 years ago
--procura se j� tem um custom:
for index, CustomObject in ipairs(Details.custom) do
if (CustomObject:GetName() == custom_name) then
3 years ago
--fix for not saving funcs on logout
if (not CustomObject.OnSwitchShow) then
CustomObject.OnSwitchShow = fromFrags and on_switch_show_frags or on_switch_show_enemies
end
3 years ago
return instance:TrocaTabela(instance.segmento, 5, index)
end
end
3 years ago
--criar um custom para este actor.
local new_custom_object = {
name = custom_name,
icon = [[Interface\ICONS\Pet_Type_Undead]],
attribute = "damagedone",
author = Details.playername,
desc = inimigo .. " Damage Taken",
source = "[raid]",
target = inimigo,
script = false,
tooltip = false,
temp = true,
OnSwitchShow = fromFrags and on_switch_show_frags or on_switch_show_enemies,
}
3 years ago
tinsert(Details.custom, new_custom_object)
setmetatable(new_custom_object, Details.atributo_custom)
new_custom_object.__index = Details.atributo_custom
3 years ago
return instance:TrocaTabela(instance.segmento, 5, #Details.custom)
end
3 years ago
if (true) then return end
local report_table = {"Details!: " .. actor.nome .. " - " .. Loc ["STRING_ATTRIBUTE_DAMAGE_TAKEN"]}
3 years ago
5 months ago
Details:FormatReportLines(report_table, tooltip_temp_table, ENEMIES_format_name, ENEMIES_format_amount)
5 months ago
return Details:Reportar(report_table, {_no_current = true, _no_inverse = true, _custom = true})
end
3 years ago
local FRAGS_format_name = function(player_name) return Details:GetOnlyName(player_name) end
5 months ago
local FRAGS_format_amount = function(amount) return Details:ToK(amount) .. "(" .. format("%.1f", amount / frags_tooltip_table.damage_total * 100) .. "%)" end
5 months ago
function damageClass:ReportSingleFragsLine(frag, instance, ShiftKeyDown, ControlKeyDown)
if (not frags_tooltip_table) then --some cases a friendly object is getting threat as neutral, example is Druid's Efflorescense
return
end
if (ShiftKeyDown) then
5 months ago
return damageClass:ReportEnemyDamageTaken(frag, instance, ShiftKeyDown, ControlKeyDown, true)
end
local report_table = {"Details!: " .. frag [1] .. " - " .. Loc ["STRING_ATTRIBUTE_DAMAGE_TAKEN"]}
3 years ago
5 months ago
Details:FormatReportLines(report_table, frags_tooltip_table, FRAGS_format_name, FRAGS_format_amount)
5 months ago
return Details:Reportar(report_table, {_no_current = true, _no_inverse = true, _custom = true})
end
---@param self actor
---@param instanceObject instance
function damageClass:ToolTip_Enemies(instanceObject, numero, barra, keydown)
--check if the actor has an owner, if it does, it's a pet
local ownerObject = self.owner
if (ownerObject and ownerObject.classe) then
r, g, b = unpack(Details.class_colors[ownerObject.classe])
else
r, g, b = unpack(Details.class_colors[self.classe])
end
3 years ago
local combatObject = instanceObject:GetCombat()
local enemyName = self:Name()
3 years ago
Details:Destroy(tooltip_temp_table) --fix for translit bug report, 'player' is nil
3 years ago
--enemy damage taken
local i = 1
local damageTaken = 0
---@type actorcontainer
local damageContainer = combatObject:GetContainer(DETAILS_ATTRIBUTE_DAMAGE)
---@type number, actor
for idx, actor in damageContainer:ListActors() do
if (actor:IsGroupPlayer() and actor.targets[enemyName]) then
---@type table<actor, number>
local agressorsTable = tooltip_temp_table[i]
if (not agressorsTable) then
tooltip_temp_table[i] = {}
agressorsTable = tooltip_temp_table[i]
end
agressorsTable[1] = actor
5 months ago
agressorsTable[2] =(actor.targets[enemyName]) or 0
damageTaken = damageTaken + agressorsTable[2]
i = i + 1
end
end
3 years ago
for o = i, #tooltip_temp_table do
local t = tooltip_temp_table[o]
t[2] = 0
t[1] = 0
end
5 months ago
table.sort(tooltip_temp_table, Details.Sort2)
3 years ago
--build the tooltip
5 months ago
local top =(tooltip_temp_table[1] and tooltip_temp_table[1][2]) or 0
tooltip_temp_table.damage_total = damageTaken
3 years ago
local iconSize = Details.DefaultTooltipIconSize
GameCooltip:SetOption("AlignAsBlizzTooltip", false)
GameCooltip:SetOption("YSpacingMod", -6)
3 years ago
for o = 1, i-1 do
local actorAggressor = tooltip_temp_table[o][1]
local damageDone = tooltip_temp_table[o][2]
local playerName = Details:GetOnlyName(actorAggressor:name())
5 months ago
GameCooltip:AddLine(playerName .. " ", formatTooltipNumber(_, damageDone) .."(" .. format("%.1f",(damageDone / damageTaken) * 100) .. "%)")
3 years ago
local classe = actorAggressor:class()
if (not classe) then
classe = "UNKNOW"
end
if (classe == "UNKNOW") then
GameCooltip:AddIcon("Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, iconSize, iconSize, .25, .5, 0, 1)
else
local specID = actorAggressor.spec
if (specID) then
local texture, l, r, t, b = Details:GetSpecIcon(specID, false)
GameCooltip:AddIcon(texture, 1, 1, iconSize, iconSize, l, r, t, b)
else
GameCooltip:AddIcon(instanceObject.row_info.icon_file, nil, nil, iconSize, iconSize, unpack(Details.class_coords [classe]))
end
end
3 years ago
local r, g, b = unpack(Details.class_colors[classe])
GameCooltip:AddStatusBar(damageDone/top*100, 1, r, g, b, 1, false, enemies_background)
end
3 years ago
GameCooltip:SetOption("StatusBarTexture", "Interface\\AddOns\\Details\\images\\bar_serenity")
--damage done and heal
GameCooltip:AddLine(" ")
5 months ago
GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_DAMAGE_ENEMIES_DONE"], formatTooltipNumber(_, math.floor(self.total)))
local half = 0.00048828125
5 months ago
GameCooltip:AddIcon(instanceObject:GetSkinTexture(), 1, 1, 14, 14, 0.005859375 + half, 0.025390625 - half, 0.3623046875, 0.3818359375)
GameCooltip:AddStatusBar(0, 1, r, g, b, 1, false, enemies_background)
3 years ago
5 months ago
local heal_actor = instanceObject.showing(2, self.nome)
if (heal_actor) then
5 months ago
GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_HEAL_ENEMY"], formatTooltipNumber(_, math.floor(heal_actor.heal_enemy_amt)))
else
3 years ago
GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_HEAL_ENEMY"], 0)
end
5 months ago
GameCooltip:AddIcon(instanceObject:GetSkinTexture(), 1, 1, 14, 14, 0.037109375 + half, 0.056640625 - half, 0.3623046875, 0.3818359375)
GameCooltip:AddStatusBar(0, 1, r, g, b, 1, false, enemies_background)
3 years ago
GameCooltip:AddLine(" ")
Details:AddTooltipReportLineText()
3 years ago
return true
end
3 years ago
---------DAMAGE TAKEN
function damageClass:ToolTip_DamageTaken(instance, numero, barra, keydown)
--if the object has a owner, it's a pet
local owner = self.owner
if (owner and owner.classe) then
r, g, b = unpack(Details.class_colors[owner.classe])
else
r, g, b = unpack(Details.class_colors[self.classe])
end
local damageTakenFrom = self.damage_from
local totalDamageTaken = self.damage_taken
local actorName = self:Name()
3 years ago
local combatObject = instance:GetShowingCombat()
local damageContainer = combatObject:GetContainer(DETAILS_ATTRIBUTE_DAMAGE)
3 years ago
5 months ago
---@type {[1]:actorname, [2]:valueamount, [3]:class, [4]:actor}[]
local damageTakenDataSorted = {}
local mainAttribute, subAttribute = instance:GetDisplay()
if (subAttribute == DETAILS_SUBATTRIBUTE_ENEMIES) then
for _, actorObject in damageContainer:ListActors() do
if (actorObject:IsGroupPlayer() and actorObject.targets[actorName]) then
damageTakenDataSorted [#damageTakenDataSorted+1] = {
actorName,
actorObject.targets[actorName],
actorObject:Class(),
actorObject
}
end
end
else
for enemyName, _ in pairs(damageTakenFrom) do --who damaged the player
--get the aggressor
local enemyActorObject = damageContainer:GetActor(enemyName)
if (enemyActorObject) then
5 months ago
---@type {[1]:actorname, [2]:valueamount, [3]:class, [4]:actor}
local damageTakenTable
local damageInflictedByThisEnemy = enemyActorObject.targets[actorName]
if (damageInflictedByThisEnemy) then
if (enemyActorObject:IsPlayer() or enemyActorObject:IsNeutralOrEnemy()) then
damageTakenTable = {enemyName, damageInflictedByThisEnemy, enemyActorObject:Class(), enemyActorObject}
damageTakenDataSorted[#damageTakenDataSorted+1] = damageTakenTable
end
end
3 years ago
--special cases - monk stagger
if (enemyName == actorName and self:Class() == "MONK") then
local friendlyFire = enemyActorObject.friendlyfire[enemyName]
if (friendlyFire and friendlyFire.total > 0) then
local staggerDamage = friendlyFire.spells[124255] or 0
if (staggerDamage > 0) then
if (damageTakenTable) then
damageTakenTable[2] = damageTakenTable[2] + staggerDamage
else
damageTakenDataSorted[#damageTakenDataSorted+1] = {enemyName, staggerDamage, "MONK", enemyActorObject}
end
end
end
end
end
end
end
local maxDataAllowed = #damageTakenDataSorted
if (maxDataAllowed > 10) then
maxDataAllowed = 10
end
3 years ago
local bIsMaximized = false
5 months ago
if (keydown == "shift" or tooltipMaximizedMethod == 2 or tooltipMaximizedMethod == 3 or instance.sub_atributo == 6 or Details.damage_taken_everything) then
maxDataAllowed = #damageTakenDataSorted
bIsMaximized = true
end
if (subAttribute == DETAILS_SUBATTRIBUTE_ENEMIES) then
--Details:AddTooltipSpellHeaderText(Loc ["STRING_DAMAGE_TAKEN_FROM"], headerColor, #damageTakenDataSorted, [[Interface\Buttons\UI-MicroStream-Red]], 0.1875, 0.8125, 0.15625, 0.78125)
else
--Details:AddTooltipSpellHeaderText(Loc ["STRING_FROM"], headerColor, #damageTakenDataSorted, [[Interface\Addons\Details\images\icons]], 0.126953125, 0.1796875, 0, 0.0546875)
end
if (bIsMaximized) then
--highlight
--GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2)
--if (subAttribute == DETAILS_SUBATTRIBUTE_ENEMIES) then
-- GameCooltip:AddStatusBar(100, 1, 0.7, g, b, 1)
--else
-- Details:AddTooltipHeaderStatusbar(r, g, b, 1)
--end
else
--GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1)
--if (subAttribute == DETAILS_SUBATTRIBUTE_ENEMIES) then
-- GameCooltip:AddStatusBar(100, 1, 0.7, 0, 0, barAlha)
--else
-- Details:AddTooltipHeaderStatusbar(r, g, b, barAlha)
--end
3 years ago
end
--local iconSize = Details.tooltip.icon_size
local iconBorderTexCoord = Details.tooltip.icon_border_texcoord
3 years ago
GameCooltip:SetOption("AlignAsBlizzTooltip", false)
GameCooltip:SetOption("AlignAsBlizzTooltipFrameHeightOffset", -6)
GameCooltip:SetOption("YSpacingMod", -6)
local iconSize = Details.DefaultTooltipIconSize
-- create a full list of incoming damage, before adding any lines to the tooltip, so we can sort them appropriately
---@class cooltip_icon
5 months ago
---@field [1] textureid|texturepath
---@field [2] number 1 for main tooltip frame, 2 for the secondary frame
---@field [3] number 1 for the left side, 2 for the right size
---@field [4] width
---@field [5] height
---@field [6] coordleft?
---@field [7] coordright?
---@field [8] coordtop?
---@field [9] coordbottom?
---@type {[1]:valueamount, [2]:{[1]:actorname, [1]:string, [3]:nil, [4]:color}, [3]:cooltip_icon}
local lines_to_add = {}
for i = 1, maxDataAllowed do
local enemyActorObject = damageTakenDataSorted[i][4]
3 years ago
--only shows damage from enemies or from the player it self
--the player it self can only be placed on the list by the iteration above
--the iteration doesnt check friendly fire for all actors, only a few cases like Monk Stagger
3 years ago
if (enemyActorObject:IsNeutralOrEnemy() or enemyActorObject:Name() == self:Name()) then
5 months ago
---@type {[1]:spellid, [2]:valueamount, [3]:actorname}[]
local spellTargetDamageList = {}
3 years ago
for spellId, spellTable in pairs(enemyActorObject.spells._ActorTable) do
local damageOnTarget = spellTable.targets[self:Name()]
if (damageOnTarget) then
tinsert(spellTargetDamageList, {spellId, damageOnTarget, enemyActorObject:Name()})
end
end
3 years ago
--friendly fire
local friendlyFire = enemyActorObject.friendlyfire[self:Name()]
if (friendlyFire) then
for spellId, valueAmount in pairs(friendlyFire.spells) do
table.insert(spellTargetDamageList, {spellId, valueAmount, enemyActorObject:Name()})
end
end
3 years ago
for _, spell in ipairs(spellTargetDamageList) do
local spellId, valueAmount, thisActorName = unpack(spell)
local spellName, _, spellIcon = _GetSpellInfo(spellId)
5 months ago
local addTextArgs = {spellName .. "(|cFFFFFF00" .. thisActorName .. "|r)", Details:Format(valueAmount) .. "(" .. string.format("%.1f",(valueAmount / totalDamageTaken) * 100) .. "%)"}
---@type cooltip_icon
local addIconArgs = {spellIcon, 1, 1, iconSize, iconSize, iconBorderTexCoord.L, iconBorderTexCoord.R, iconBorderTexCoord.T, iconBorderTexCoord.B}
3 years ago
tinsert(lines_to_add, {
valueAmount,
addTextArgs,
addIconArgs
})
end
else
5 months ago
---@type {[1]:actorname, [2]:valueamount, [3]:class, [4]:actor}
local thisAggrossorTable = damageTakenDataSorted[i]
local actorName = thisAggrossorTable[1]
local amount = thisAggrossorTable[2]
local class = thisAggrossorTable[3]
local actorObject = thisAggrossorTable[4]
5 months ago
---@type {[1]:actorname, [1]:string, [3]:nil, [4]:color}
local addLineArgs
---@type cooltip_icon
local addIconArgs
local aggressorName = Details:GetOnlyName(actorName)
if (bIsMaximized and actorName:find(Details.playername)) then
5 months ago
addLineArgs = {aggressorName, Details:Format(amount) .. "("..string.format("%.1f",(amount / totalDamageTaken) * 100) .. "%)", nil, "yellow"}
else
5 months ago
addLineArgs = {aggressorName, Details:Format(amount) .. "("..string.format("%.1f",(amount / totalDamageTaken) * 100) .. "%)"}
end
3 years ago
if (not class) then
class = "UNKNOW"
end
3 years ago
if (class == "UNKNOW") then
addIconArgs = {"Interface\\LFGFRAME\\LFGROLE_BW", nil, nil, iconSize, iconSize, .25, .5, 0, 1}
else
addIconArgs= {instance.row_info.icon_file, nil, nil, iconSize, iconSize, unpack(Details.class_coords [class])}
end
tinsert(lines_to_add, {amount, addLineArgs, addIconArgs})
end
end
table.sort(lines_to_add, Details.Sort1)
for _, line in ipairs(lines_to_add) do
GameCooltip:AddLine(unpack(line[2]))
GameCooltip:AddIcon(unpack(line[3]))
Details:AddTooltipBackgroundStatusbar()
end
if (subAttribute == DETAILS_SUBATTRIBUTE_ENEMIES) then
3 years ago
GameCooltip:AddLine(" ")
5 months ago
GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_DAMAGE_DONE"], formatTooltipNumber(_, math.floor(self.total)))
local half = 0.00048828125
5 months ago
GameCooltip:AddIcon(instance:GetSkinTexture(), 1, 1, iconSize, iconSize, 0.005859375 + half, 0.025390625 - half, 0.3623046875, 0.3818359375)
Details:AddTooltipBackgroundStatusbar()
3 years ago
5 months ago
local heal_actor = instance.showing(2, self.nome)
if (heal_actor) then
5 months ago
GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_HEAL_DONE"], formatTooltipNumber(_, math.floor(heal_actor.heal_enemy_amt)))
else
3 years ago
GameCooltip:AddLine(Loc ["STRING_ATTRIBUTE_HEAL_DONE"], 0)
end
5 months ago
GameCooltip:AddIcon(instance:GetSkinTexture(), 1, 1, iconSize, iconSize, 0.037109375 + half, 0.056640625 - half, 0.3623046875, 0.3818359375)
Details:AddTooltipBackgroundStatusbar()
end
3 years ago
return true
end
3 years ago
---------FRIENDLY FIRE
5 months ago
function damageClass:ToolTip_FriendlyFire(instancia, numero, barra, keydown)
local owner = self.owner
if (owner and owner.classe) then
3 years ago
r, g, b = unpack(Details.class_colors [owner.classe])
else
3 years ago
r, g, b = unpack(Details.class_colors [self.classe])
end
local FriendlyFire = self.friendlyfire
local FriendlyFireTotal = self.friendlyfire_total
local combat = instancia:GetShowingCombat()
local tabela_do_combate = instancia.showing
local showing = tabela_do_combate [class_type]
local icon_size = Details.tooltip.icon_size
local icon_border = Details.tooltip.icon_border_texcoord
local lineHeight = Details.tooltip.line_height
3 years ago
local DamagedPlayers = {}
local Skills = {}
3 years ago
for target_name, ff_table in pairs(FriendlyFire) do
5 months ago
local actor = combat(1, target_name)
if (actor) then
DamagedPlayers [#DamagedPlayers+1] = {target_name, ff_table.total, actor.classe}
3 years ago
for spellid, amount in pairs(ff_table.spells) do
5 months ago
Skills [spellid] =(Skills [spellid] or 0) + amount
end
end
end
5 months ago
table.sort(DamagedPlayers, Details.Sort2)
3 years ago
5 months ago
Details:AddTooltipSpellHeaderText(Loc ["STRING_TARGETS"], headerColor, #DamagedPlayers, Details.tooltip_target_icon.file, unpack(Details.tooltip_target_icon.coords))
3 years ago
local ismaximized = false
5 months ago
if (keydown == "shift" or tooltipMaximizedMethod == 2 or tooltipMaximizedMethod == 3) then
GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2)
Details:AddTooltipHeaderStatusbar(r, g, b, 1)
ismaximized = true
else
5 months ago
GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_shift]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1)
Details:AddTooltipHeaderStatusbar(r, g, b, barAlha)
end
3 years ago
local max_abilities = Details.tooltip.tooltip_max_abilities
if (ismaximized) then
max_abilities = 99
end
3 years ago
5 months ago
for i = 1, math.min(max_abilities, #DamagedPlayers) do
local classe = DamagedPlayers[i][3]
if (not classe) then
classe = "UNKNOW"
end
5 months ago
GameCooltip:AddLine(Details:GetOnlyName(DamagedPlayers[i][1]), formatTooltipNumber(_, DamagedPlayers[i][2]).."("..format("%.1f", DamagedPlayers[i][2]/FriendlyFireTotal*100).."%)")
GameCooltip:AddIcon("Interface\\AddOns\\Details\\images\\espadas", nil, nil, lineHeight, lineHeight)
Details:AddTooltipBackgroundStatusbar()
3 years ago
if (classe == "UNKNOW") then
5 months ago
GameCooltip:AddIcon("Interface\\AddOns\\Details\\images\\classes_small", nil, nil, lineHeight, lineHeight, unpack(Details.class_coords ["UNKNOW"]))
else
local specID = Details:GetSpec(DamagedPlayers[i][1])
if (specID) then
5 months ago
local texture, l, r, t, b = Details:GetSpecIcon(specID, false)
GameCooltip:AddIcon(texture, 1, 1, lineHeight, lineHeight, l, r, t, b)
else
5 months ago
GameCooltip:AddIcon("Interface\\AddOns\\Details\\images\\classes_small", nil, nil, lineHeight, lineHeight, unpack(Details.class_coords [classe]))
end
end
3 years ago
end
3 years ago
5 months ago
Details:AddTooltipSpellHeaderText(Loc ["STRING_SPELLS"], headerColor, 1, Details.tooltip_spell_icon.file, unpack(Details.tooltip_spell_icon.coords))
3 years ago
local ismaximized = false
5 months ago
if (keydown == "ctrl" or tooltipMaximizedMethod == 2 or tooltipMaximizedMethod == 4) then
GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_ctrl]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2)
Details:AddTooltipHeaderStatusbar(r, g, b, 1)
ismaximized = true
else
5 months ago
GameCooltip:AddIcon([[Interface\AddOns\Details\images\key_ctrl]], 1, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay1)
Details:AddTooltipHeaderStatusbar(r, g, b, barAlha)
end
3 years ago
local max_abilities2 = Details.tooltip.tooltip_max_abilities
if (ismaximized) then
max_abilities2 = 99
end
3 years ago
--spells usadas no friendly fire
local SpellsInOrder = {}
3 years ago
for spellID, amount in pairs(Skills) do
SpellsInOrder [#SpellsInOrder+1] = {spellID, amount}
end
5 months ago
table.sort(SpellsInOrder, Details.Sort2)
3 years ago
5 months ago
for i = 1, math.min(max_abilities2, #SpellsInOrder) do
3 years ago
local nome, _, icone = _GetSpellInfo(SpellsInOrder[i][1])
5 months ago
GameCooltip:AddLine(nome, formatTooltipNumber(_, SpellsInOrder[i][2]).."("..format("%.1f", SpellsInOrder[i][2]/FriendlyFireTotal*100).."%)")
GameCooltip:AddIcon(icone, nil, nil, icon_size.W, icon_size.H, icon_border.L, icon_border.R, icon_border.T, icon_border.B)
Details:AddTooltipBackgroundStatusbar()
3 years ago
end
return true
end
--------------------------------------------- // JANELA DETALHES // ---------------------------------------------
---------DETALHES BIFURCA��O ~detalhes ~detailswindow ~bi
function damageClass:MontaInfo()
if (breakdownWindowFrame.sub_atributo == 1 or breakdownWindowFrame.sub_atributo == 2 or breakdownWindowFrame.sub_atributo == 6) then --damage done & dps
return self:MontaInfoDamageDone() --has new code for the new destails window | left scroll and 6 blocks implemented
5 months ago
elseif(breakdownWindowFrame.sub_atributo == 3) then --damage taken
return self:MontaInfoDamageTaken() --has new code for the new destails window | left and right scrolls implemented
5 months ago
elseif(breakdownWindowFrame.sub_atributo == 4) then --friendly fire
return self:MontaInfoFriendlyFire() --has new code for the new destails window | left scroll implemeneted(need to implemente the right scroll yet)
end
end
3 years ago
---------DETALHES bloco da direita BIFURCA��O
5 months ago
function damageClass:MontaDetalhes(spellid, barra, instancia) --these functions were used to fill the 5 blocks from the old breakdown window
if (breakdownWindowFrame.sub_atributo == 1 or breakdownWindowFrame.sub_atributo == 2) then
5 months ago
return self:MontaDetalhesDamageDone(spellid, barra, instancia) --deprecated
3 years ago
5 months ago
elseif(breakdownWindowFrame.sub_atributo == 3) then
return self:MontaDetalhesDamageTaken(spellid, barra, instancia)
3 years ago
5 months ago
elseif(breakdownWindowFrame.sub_atributo == 4) then
return self:MontaDetalhesFriendlyFire(spellid, barra, instancia)
3 years ago
5 months ago
elseif(breakdownWindowFrame.sub_atributo == 6) then
3 years ago
if (bitBand(self.flag_original, 0x00000400) ~= 0) then --� um jogador
5 months ago
return self:MontaDetalhesDamageDone(spellid, barra, instancia) --deprecated
end
5 months ago
return self:MontaDetalhesEnemy(spellid, barra, instancia)
end
end
local friendlyFireSpellSourcesHeadersAllowed = {icon = true, name = true, rank = true, amount = true, persecond = true, percent = true}
---when hovering over the player name in the breakdown window, this function will be called to build a the list of spells used to inflict damage on that player
---@param friendlyFireAggressorActor actordamage
---@param targetName string
function damageClass.BuildFriendlySpellListFromAgressor(friendlyFireAggressorActor, targetName)
---@type combat
local combatObject = Details:GetCombatFromBreakdownWindow()
---@type friendlyfiretable
local friendlyFireTable = friendlyFireAggressorActor.friendlyfire[targetName]
local totalDamage = friendlyFireTable.total
local spellsUsed = friendlyFireTable.spells
--create the table which will be returned with the data
---@type {topValue: number, totalValue: number, headersAllowed: table, combatTime: number}
local resultTable = {topValue = 0, totalValue = totalDamage, headersAllowed = friendlyFireSpellSourcesHeadersAllowed, combatTime = combatObject:GetCombatTime()}
--iterate among the spells used by the aggressorActor
for spellId, amountDamage in pairs(spellsUsed) do
--add the spell to the list
local spellName = GetSpellInfo(spellId)
resultTable[#resultTable+1] = {spellId = spellId, total = amountDamage, petName = "", spellScholl = Details.spell_school_cache[spellName] or 1}
end
return resultTable
end
------ Friendly Fire
local friendlyFireHeadersAllowed = {icon = true, name = true, rank = true, amount = true, persecond = true, percent = true}
---build the friendly fire list, the list contains players who were damaged by this actor.
function damageClass:MontaInfoFriendlyFire() --~friendlyfire ~friendly ~ff
---@type actordamage
local actorObject = self
---@type instance
local instance = breakdownWindowFrame.instancia
---@type combat
local combatObject = instance:GetCombat()
---@type string
local actorName = actorObject:Name()
---@type number
local friendlyFireTotal = actorObject.friendlyfire_total
---@type table<string, friendlyfiretable>
local damagedPlayers = actorObject.friendlyfire --players which got hit by this actor
---@type actorcontainer
local damageContainer = combatObject:GetContainer(class_type)
local resultTable = {}
for targetName, friendlyFireTable in pairs(damagedPlayers) do
local amountOfFriendlyFire = friendlyFireTable.total
if (amountOfFriendlyFire > 0) then
---@type actordamage this is an actor who was damaged by the friendly fire of the actorObject
local targetActorObject = damageContainer:GetActor(targetName)
if (targetActorObject) then
---@type texturetable
local iconTable = Details:GetActorIcon(targetActorObject)
---@type {name: string, amount: number, icon: texturetable, class: string}
local ffTable = {name = targetName, total = amountOfFriendlyFire, icon = iconTable, class = targetActorObject:Class()}
resultTable[#resultTable+1] = ffTable
end
end
end
resultTable.totalValue = friendlyFireTotal
resultTable.combatTime = combatObject:GetCombatTime()
resultTable.headersAllowed = friendlyFireHeadersAllowed
Details222.BreakdownWindow.SendGenericData(resultTable, actorObject, combatObject, instance)
if true then return end
do
local instancia = breakdownWindowFrame.instancia
local combat = instancia:GetShowingCombat()
local barras = breakdownWindowFrame.barras1
local barras2 = breakdownWindowFrame.barras2
local barras3 = breakdownWindowFrame.barras3
local FriendlyFireTotal = self.friendlyfire_total
3 years ago
local DamagedPlayers = {}
local Skills = {}
3 years ago
for target_name, ff_table in pairs(self.friendlyfire) do
3 years ago
5 months ago
local actor = combat(1, target_name)
if (actor) then
tinsert(DamagedPlayers, {target_name, ff_table.total, ff_table.total / FriendlyFireTotal * 100, actor.classe})
3 years ago
for spellid, amount in pairs(ff_table.spells) do
5 months ago
Skills [spellid] =(Skills [spellid] or 0) + amount
end
end
end
5 months ago
table.sort(DamagedPlayers, Details.Sort2)
3 years ago
local amt = #DamagedPlayers
5 months ago
gump:JI_AtualizaContainerBarras(amt)
3 years ago
local FirstPlaceDamage = DamagedPlayers [1] and DamagedPlayers [1][2] or 0
3 years ago
for index, tabela in ipairs(DamagedPlayers) do
local barra = barras [index]
if (not barra) then
5 months ago
barra = gump:CriaNovaBarraInfo1(instancia, index)
barra.textura:SetStatusBarColor(1, 1, 1, 1)
barra.on_focus = false
end
3 years ago
if (not breakdownWindowFrame.mostrando_mouse_over) then
if (tabela[1] == self.detalhes) then --tabela [1] = NOME = NOME que esta na caixa da direita
if (not barra.on_focus) then --se a barra n�o tiver no foco
barra.textura:SetStatusBarColor(129/255, 125/255, 69/255, 1)
barra.on_focus = true
if (not breakdownWindowFrame.mostrando) then
breakdownWindowFrame.mostrando = barra
end
end
else
if (barra.on_focus) then
barra.textura:SetStatusBarColor(1, 1, 1, 1) --volta a cor antiga
barra:SetAlpha(.9) --volta a alfa antiga
barra.on_focus = false
end
end
end
if (index == 1) then
barra.textura:SetValue(100)
else
barra.textura:SetValue(tabela[2]/FirstPlaceDamage*100)
end
3 years ago
barra.lineText1:SetText(index .. instancia.divisores.colocacao .. Details:GetOnlyName(tabela[1])) --seta o texto da esqueda
5 months ago
barra.lineText4:SetText(Details:comma_value(tabela[2]) .. "(" .. format("%.1f", tabela[3]) .."%)") --seta o texto da direita
3 years ago
local classe = tabela[4]
if (not classe) then
classe = "MONSTER"
end
3 years ago
barra.icone:SetTexture(breakdownWindowFrame.instancia.row_info.icon_file)
3 years ago
if (Details.class_coords [classe]) then
barra.icone:SetTexCoord(unpack(Details.class_coords [classe]))
else
barra.icone:SetTexture("")
end
3 years ago
local color = Details.class_colors [classe]
if (color) then
barra.textura:SetStatusBarColor(unpack(color))
else
barra.textura:SetStatusBarColor(1, 1, 1)
end
barra.minha_tabela = self
barra.show = tabela[1]
barra:Show()
if (self.detalhes and self.detalhes == barra.show) then
5 months ago
self:MontaDetalhes(self.detalhes, barra, instancia)
end
end
local SkillTable = {}
for spellid, amt in pairs(Skills) do
local nome, _, icone = _GetSpellInfo(spellid)
SkillTable [#SkillTable+1] = {nome, amt, amt/FriendlyFireTotal*100, icone}
end
5 months ago
table.sort(SkillTable, Details.Sort2)
amt = #SkillTable
if (amt < 1) then
return
end
5 months ago
gump:JI_AtualizaContainerAlvos(amt)
FirstPlaceDamage = SkillTable [1] and SkillTable [1][2] or 0
3 years ago
for index, tabela in ipairs(SkillTable) do
local barra = barras2 [index]
if (not barra) then
5 months ago
barra = gump:CriaNovaBarraInfo2(instancia, index)
barra.textura:SetStatusBarColor(1, 1, 1, 1)
end
3 years ago
if (index == 1) then
barra.textura:SetValue(100)
else
barra.textura:SetValue(tabela[2]/FirstPlaceDamage*100)
end
3 years ago
barra.lineText1:SetText(index..instancia.divisores.colocacao..tabela[1]) --seta o texto da esqueda
5 months ago
barra.lineText4:SetText(Details:comma_value(tabela[2]) .."(" ..format("%.1f", tabela[3]) .. ")") --seta o texto da direita
barra.icone:SetTexture(tabela[4])
3 years ago
barra.minha_tabela = nil --desativa o tooltip
barra:Show()
end
end
end
3 years ago
local damageTakenSpellSourcesHeadersAllowed = {icon = true, name = true, rank = true, amount = true, persecond = true, percent = true}
5 months ago
function damageClass:BuildDamageTakenSpellListFromAgressor(aggressorActor)
--target actor name
5 months ago
local targetActorName = self:Name()
---@type combat
local combatObject = Details:GetCombatFromBreakdownWindow()
--get the list of spells from the aggressorActor and check each one to see if it was casted on the targetActor
---@type spellcontainer
local spellContainer = aggressorActor:GetSpellContainer("spell")
--create the table which will be returned with the data
---@type {topValue: number, totalValue: number, headersAllowed: table, combatTime: number}
local resultTable = {topValue = 0, totalValue = 0, headersAllowed = damageTakenSpellSourcesHeadersAllowed, combatTime = combatObject:GetCombatTime()}
for spellId, spellTable in spellContainer:ListSpells() do
---@cast spellTable spelltable
for targetName, amount in pairs(spellTable.targets) do
if (targetName == targetActorName) then
--add the spell to the list
resultTable[#resultTable+1] = {spellId = spellId, total = amount, petName = "", spellScholl = spellTable.spellschool}
resultTable.totalValue = resultTable.totalValue + amount
end
3 years ago
end
end
3 years ago
--iterate among the pets of the aggressorActor and get the spells casted by them
---@type table<number, actorname>
local petTable = aggressorActor.pets
3 years ago
for i = 1, #petTable do
local petName = petTable[i]
local petActorObject = combatObject:GetActor(DETAILS_ATTRIBUTE_DAMAGE, petName)
if (petActorObject) then
---@type spellcontainer
local petSpellContainer = petActorObject:GetSpellContainer("spell")
3 years ago
for spellId, spellTable in petSpellContainer:ListSpells() do
for targetName, amount in pairs(spellTable.targets) do
if (targetName == targetActorName) then
--add the spell to the list
resultTable[#resultTable+1] = {spellId = spellId, total = amount, petName = petName, spellScholl = spellTable.spellschool}
resultTable.totalValue = resultTable.totalValue + amount
end
end
end
end
end
3 years ago
return resultTable
end
5 months ago
---@return {topValue: number, totalValue: number, headersAllowed: table, combatTime: number, [number]: {spellId: number, total: number, petName: string, spellScholl: number}}
function damageClass:BuildDamageTakenSpellList()
--target actor name
local targetActorName = self:Name()
---@type combat
local combatObject = Details:GetCombatFromBreakdownWindow()
---@type actorcontainer
local damageContainer = combatObject:GetContainer(DETAILS_ATTRIBUTE_DAMAGE)
--create the table which will be returned with the data
---@type {topValue: number, totalValue: number, headersAllowed: table, combatTime: number, [number]: {spellId: number, total: number, petName: string, spellScholl: number}}
local resultTable = {topValue = 0, totalValue = 0, headersAllowed = damageTakenSpellSourcesHeadersAllowed, combatTime = combatObject:GetCombatTime()}
--- @type table<number, {spellId: number, total: number, petName: string, spellScholl: number}>
local unsortedSpells = {}
for enemyName, _ in pairs(self.damage_from) do --who damaged the player
--get the aggressor
local enemyActorObject = damageContainer:GetActor(enemyName)
if (
enemyActorObject
and (
(enemyActorObject.targets[targetActorName] and enemyActorObject:IsNeutralOrEnemy())
or (enemyActorObject.friendlyfire[targetActorName] and enemyActorObject:Name() == targetActorName)
)
) then
if (enemyActorObject.targets[targetActorName]) then
for spellId, spellTable in pairs(enemyActorObject.spells._ActorTable) do
---@cast spellTable spelltable
local damageOnTarget = spellTable.targets[targetActorName]
if (damageOnTarget) then
unsortedSpells[spellId] = unsortedSpells[spellId] or {spellId = spellId, total = 0, petName = "", spellScholl = spellTable.spellschool}
unsortedSpells[spellId].total = unsortedSpells[spellId].total + damageOnTarget
resultTable.totalValue = resultTable.totalValue + damageOnTarget
end
end
else
local staggerSpellId = 124255
local friendlyFire = enemyActorObject.friendlyfire[targetActorName]
if (friendlyFire and friendlyFire.spells[staggerSpellId] and friendlyFire.spells[staggerSpellId] > 0) then
local staggerDamage = friendlyFire.spells[staggerSpellId]
unsortedSpells[staggerSpellId] = unsortedSpells[staggerSpellId] or {spellId = staggerSpellId, total = 0, petName = "", spellScholl = 1}
unsortedSpells[staggerSpellId].total = unsortedSpells[staggerSpellId].total + staggerDamage
resultTable.totalValue = resultTable.totalValue + staggerDamage
end
end
end
end
local sortedSpells = {}
for _, spellTable in pairs(unsortedSpells) do
sortedSpells[#sortedSpells+1] = spellTable
end
table.sort(sortedSpells, function(a, b) return a.total > b.total end)
Mixin(resultTable, sortedSpells)
return resultTable
end
------ Damage Taken
local damageTakenHeadersAllowed = {icon = true, name = true, rank = true, amount = true, persecond = true, percent = true}
function damageClass:MontaInfoDamageTaken()
---@type actordamage
local actorObject = self
---@type instance
local instance = breakdownWindowFrame.instancia
---@type combat
local combatObject = instance:GetCombat()
---@type string
local actorName = actorObject:Name()
---@type number
local damageTakenTotal = actorObject.damage_taken
---@type table<string, boolean>
local damageTakenFrom = actorObject.damage_from
---@type actorcontainer
local damageContainer = combatObject:GetContainer(class_type)
local resultTable = {}
---@type string
for aggressorName in pairs(damageTakenFrom) do
local aggressorActor = damageContainer:GetActor(aggressorName)
if (aggressorActor) then
---@type table<string, number>
local targets = aggressorActor:GetTargets()
---@type number|nil
local amountOfDamage = targets[actorName]
if (amountOfDamage) then
---@type texturetable
local iconTable = Details:GetActorIcon(aggressorActor)
---@type {name: string, amount: number, icon: texturetable}
local damageTakenTable = {name = aggressorName, total = amountOfDamage, icon = iconTable, class = aggressorActor:Class()}
resultTable[#resultTable+1] = damageTakenTable
end
end
end
resultTable.totalValue = damageTakenTotal
resultTable.combatTime = combatObject:GetCombatTime()
resultTable.headersAllowed = damageTakenHeadersAllowed
Details222.BreakdownWindow.SendGenericData(resultTable, actorObject, combatObject, instance)
end
3 years ago
--[[exported]] function Details:UpdadeInfoBar(row, index, spellId, name, value, formattedValue, max, percent, icon, detalhes, texCoords, spellSchool, class)
if (index == 1) then
3 years ago
row.textura:SetValue(100)
else
3 years ago
max = math.max(max, 0.001)
row.textura:SetValue(value / max * 100)
end
3 years ago
if (type(index) == "number") then
if (debugmode) then
5 months ago
row.lineText1:SetText(index .. ". " .. name .. "(" .. spellId .. ")")
else
3 years ago
row.lineText1:SetText(index .. ". " .. name)
end
else
3 years ago
row.lineText1:SetText(name)
end
3 years ago
row.lineText1.text = row.lineText1:GetText()
3 years ago
if (formattedValue) then
5 months ago
row.lineText4:SetText(formattedValue .. "(" .. format("%.1f", percent) .."%)")
end
3 years ago
row.lineText1:SetSize(row:GetWidth() - row.lineText4:GetStringWidth() - 40, 15)
if (icon) then
row.icone:SetTexture(icon)
if (icon == "Interface\\AddOns\\Details\\images\\classes_small") then
3 years ago
row.icone:SetTexCoord(0.25, 0.49609375, 0.75, 1)
else
3 years ago
row.icone:SetTexCoord(0, 1, 0, 1)
end
else
3 years ago
row.icone:SetTexture("")
end
3 years ago
if (not row.IconUpBorder) then
3 years ago
row.IconUpBorder = CreateFrame("frame", nil, row,"BackdropTemplate")
row.IconUpBorder:SetAllPoints(row.icone)
row.IconUpBorder:SetBackdrop({edgeFile = [[Interface\Buttons\WHITE8X8]], edgeSize = 1})
row.IconUpBorder:SetBackdropBorderColor(0, 0, 0, 0.75)
end
3 years ago
if (texCoords) then
3 years ago
row.icone:SetTexCoord(unpack(texCoords))
else
3 years ago
local iconBorder = Details.tooltip.icon_border_texcoord
row.icone:SetTexCoord(iconBorder.L, iconBorder.R, iconBorder.T, iconBorder.B)
end
3 years ago
row.minha_tabela = self
3 years ago
row.show = spellId
row:Show()
if (spellSchool) then
local schoolColor = Details.spells_school[spellSchool]
if (schoolColor and schoolColor.decimals) then
row.textura:SetStatusBarColor(schoolColor.decimals[1], schoolColor.decimals[2], schoolColor.decimals[3])
else
3 years ago
row.textura:SetStatusBarColor(1, 1, 1)
end
3 years ago
5 months ago
elseif(class) then
3 years ago
local color = Details.class_colors[class]
if (color and class ~= "UNKNOW") then
3 years ago
row.textura:SetStatusBarColor(unpack(color))
else
3 years ago
row.textura:SetStatusBarColor(1, 1, 1)
end
else
3 years ago
if (spellId == 98021) then --spirit linkl
row.textura:SetStatusBarColor(1, 0.4, 0.4)
else
3 years ago
row.textura:SetStatusBarColor(1, 1, 1)
end
end
3 years ago
if (detalhes and self.detalhes and self.detalhes == spellId and breakdownWindowFrame.showing == index) then
self:MontaDetalhes(row.show, row, breakdownWindowFrame.instancia)
end
end
3 years ago
--lock into a line after clicking on it
--[[exported]] function Details:FocusLock(row, spellId) --will be deprecated
if (not breakdownWindowFrame.mostrando_mouse_over) then
3 years ago
if (spellId == self.detalhes) then --tabela [1] = spellid = spellid que esta na caixa da direita
if (not row.on_focus) then --se a barra n�o tiver no foco
row.textura:SetStatusBarColor(129/255, 125/255, 69/255, 1)
row.on_focus = true
if (not breakdownWindowFrame.mostrando) then
breakdownWindowFrame.mostrando = row
end
end
else
if (row.on_focus) then
3 years ago
row.textura:SetStatusBarColor(1, 1, 1, 1) --volta a cor antiga
row:SetAlpha(.9) --volta a alfa antiga
row.on_focus = false
end
end
end
end
local wipeSpellCache = function() --deprecated
Details:Destroy(Details222.PlayerBreakdown.DamageSpellsCache)
end
local addToSpellCache = function(unitGUID, spellName, spellTable) --deprecated
local unitSpellCache = Details222.PlayerBreakdown.DamageSpellsCache[unitGUID]
if (not unitSpellCache) then
unitSpellCache = {}
Details222.PlayerBreakdown.DamageSpellsCache[unitGUID] = unitSpellCache
end
local spellCache = Details222.PlayerBreakdown.DamageSpellsCache[unitGUID][spellName]
if (not spellCache) then
spellCache = {}
Details222.PlayerBreakdown.DamageSpellsCache[unitGUID][spellName] = spellCache
end
table.insert(spellCache, spellTable)
end
local getSpellDetails = function(unitGUID, spellName) --deprecated
local unitCachedSpells = Details222.PlayerBreakdown.DamageSpellsCache[unitGUID]
local spellsTableForSpellName = unitCachedSpells and unitCachedSpells[spellName]
if (spellsTableForSpellName) then --should always be valid
if (#spellsTableForSpellName > 1) then
local t = spellsTableForSpellName
local spellId = t[1].id
local newSpellTable = Details222.DamageSpells.CreateSpellTable(spellId)
newSpellTable.n_min = 99999999
newSpellTable.c_min = 99999999
newSpellTable.n_max = 0
newSpellTable.c_max = 0
for i = 1, #t do
for key, value in pairs(t[i]) do
if (type(value) == "number") then
if (key == "n_min" or key == "c_min") then
if (value < newSpellTable[key]) then
newSpellTable[key] = value
end
5 months ago
elseif(key == "n_max" or key == "c_max") then
if (value > newSpellTable[key]) then
newSpellTable[key] = value
end
5 months ago
elseif(key ~= "id" and key ~= "spellschool") then
newSpellTable[key] =(newSpellTable[key] or 0) + value
end
end
end
end
return newSpellTable
else
--there's only one table, so return the first
return spellsTableForSpellName[1]
end
end
end
5 months ago
--[=
_detalhes.string_size = UIParent:CreateFontString(nil, "overlay", "GameFontNormal")
_detalhes.string_size:SetText("MMMMMMMMMMMM") --12 M's - max playername in width
_detalhes.string_size_default = _detalhes.string_size:GetStringWidth()
Details.numbertostring = numbertostring
--]=]
5 months ago
--I guess this fills the list of spells in the topleft scrollBar in the summary tab
--the goal of this function is to build a list of spells the actor used and send the data to Details! which will delivery to the summary tab actived
--so the script only need to build the list of spells and send it to Details!
------ Damage Done & Dps
5 months ago
function damageClass:MontaInfoDamageDone()
---@type actor
local actorObject = self
---@type instance
local instance = breakdownWindowFrame.instancia
---@type combat
local combatObject = instance:GetCombat()
---@type number
local diff, diffEngName = combatObject:GetDifficulty()
---@type string
local playerName = actorObject:Name()
local attribute, subAttribute = instance:GetDisplay()
--guild ranking on a boss
--check if is a raid encounter and if is heroic or mythic
do
5 months ago
if (diff and(diff == 15 or diff == 16)) then --this might give errors
local db = Details.OpenStorage()
if (db) then
---@type details_storage_unitresult, details_encounterkillinfo
local bestRank, encounterTable = Details222.storage.GetBestFromPlayer(diffEngName, combatObject:GetBossInfo().id, "DAMAGER", playerName, true)
if (bestRank) then
--discover which are the player position in the guild rank
local rankPosition = Details222.storage.GetUnitGuildRank(diffEngName, combatObject:GetBossInfo().id, "DAMAGER", playerName, true)
5 months ago
local text1 = playerName .. " Guild Rank on " ..(combatObject:GetBossInfo().name or "") .. ": |cFFFFFF00" ..(rankPosition or "x") .. "|r Best Dps: |cFFFFFF00" .. Details:ToK2((bestRank.total or SMALL_NUMBER) / encounterTable.elapsed) .. "|r(" .. encounterTable.date:gsub(".*%s", "") .. ")"
breakdownWindowFrame:SetStatusbarText(text1, 10, "gray")
else
breakdownWindowFrame:SetStatusbarText()
end
else
breakdownWindowFrame:SetStatusbarText()
end
else
breakdownWindowFrame:SetStatusbarText()
end
end
---@type breakdownspelldatalist
local breakdownSpellDataList = {}
---@type number
local totalDamageWithoutPet = actorObject.total_without_pet
---@type number
local actorTotal = actorObject.total
---@type table<number, spelltable>
local actorSpells = actorObject:GetSpellList()
3 years ago
wipeSpellCache()
--get time
3 years ago
local actorCombatTime
if (Details.time_type == 1 or not actorObject.grupo) then
actorCombatTime = actorObject:Tempo()
5 months ago
elseif(Details.time_type == 2 or Details.use_realtimedps) then
actorCombatTime = breakdownWindowFrame.instancia.showing:GetCombatTime()
end
3 years ago
--actor spells
---@type table<string, number>
local alreadyAdded = {}
local bShouldMergePlayerSpells = Details.breakdown_spell_tab.nest_players_spells_with_same_name
---@type number, spelltable
for spellId, spellTable in pairs(actorSpells) do
spellTable.ChartData = nil --~ChartData
---@type string
local spellName = _GetSpellInfo(spellId)
if (spellName) then
---@type number in which index the spell with the same name was stored
local index = alreadyAdded[spellName]
if (index and bShouldMergePlayerSpells) then
---@type spelltableadv
local bkSpellData = breakdownSpellDataList[index]
bkSpellData.spellTables[#bkSpellData.spellTables+1] = spellTable
---@type bknesteddata
local nestedData = {spellId = spellId, spellTable = spellTable, actorName = "", value = 0}
bkSpellData.nestedData[#bkSpellData.nestedData+1] = nestedData
bkSpellData.bCanExpand = true
else
---@type spelltableadv
local bkSpellData = {
id = spellId,
spellschool = spellTable.spellschool,
bIsExpanded = Details222.BreakdownWindow.IsSpellExpanded(spellId),
bCanExpand = false,
3 years ago
spellTables = {spellTable},
nestedData = {{spellId = spellId, spellTable = spellTable, actorName = "", value = 0}},
}
3 years ago
detailsFramework:Mixin(bkSpellData, Details.SpellTableMixin)
breakdownSpellDataList[#breakdownSpellDataList+1] = bkSpellData
alreadyAdded[spellName] = #breakdownSpellDataList
end
end
end
3 years ago
--pets spells
local bShouldMergeSpellsWithThePet = Details.breakdown_spell_tab.nest_pet_spells_by_caster
local bShouldMergePetSpells = Details.breakdown_spell_tab.nest_pet_spells_by_name
local actorPets = actorObject:GetPets()
for _, petName in ipairs(actorPets) do
---@type actor
local petActor = combatObject(DETAILS_ATTRIBUTE_DAMAGE, petName)
if (petActor) then --PET
--get the amount of spells the pet used, if the pet used only one there`s no reason to nest one spell with the pet
local petSpellContainer = petActor:GetSpellContainer("spell")
if (bShouldMergeSpellsWithThePet and petSpellContainer:HasTwoOrMoreSpells()) then
---@type spelltableadv
local bkSpellData = {
bIsActorHeader = true, --tag this spelltable as an actor header, when the actor is the header it will nest the spells use by this actor
actorName = petName,
npcId = petActor.aID,
id = 0,
spellschool = 0,
bIsExpanded = Details222.BreakdownWindow.IsSpellExpanded(petName),
spellTables = {}, --populated below with the spells the pet used
nestedData = {}, --there's none data here in the main bar as the first bar is the pet name
bCanExpand = true,
actorIcon = [[Interface\AddOns\Details\images\pets\pet_icon_1]],
}
detailsFramework:Mixin(bkSpellData, Details.SpellTableMixin)
--output
breakdownSpellDataList[#breakdownSpellDataList+1] = bkSpellData
--fill here the spellTables using the actor abilities
--all these spells belong to the current actor in the loop
for spellId, spellTable in petSpellContainer:ListSpells() do
local spellName, _, spellIcon = GetSpellInfo(spellId)
if (spellName) then
bkSpellData.spellTables[#bkSpellData.spellTables+1] = spellTable
---@type bknesteddata
local nestedData = {spellId = spellId, spellTable = spellTable, actorName = petName, value = 0, bIsActorHeader = true} --value to be defined
bkSpellData.nestedData[#bkSpellData.nestedData+1] = nestedData
end
end
else
local spells = petActor:GetSpellList()
--all these spells belong to the current pet in the loop
for spellId, spellTable in pairs(spells) do
---@cast spellId number
---@cast spellTable spelltable
spellTable.ChartData = nil
--PET
---@type string
local spellName = _GetSpellInfo(spellId)
if (spellName) then
---@type number in which index the spell with the same name was stored
local index = alreadyAdded[spellName]
if (index and bShouldMergePetSpells) then --PET
---@type spelltableadv
local bkSpellData = breakdownSpellDataList[index]
bkSpellData.spellTables[#bkSpellData.spellTables+1] = spellTable
---@type bknesteddata
local nestedData = {spellId = spellId, spellTable = spellTable, actorName = petName, value = 0}
bkSpellData.nestedData[#bkSpellData.nestedData+1] = nestedData
bkSpellData.bCanExpand = true
else --PET
---@type spelltableadv
local bkSpellData = {
id = spellId,
actorName = petName,
npcId = petActor.aID,
spellschool = spellTable.spellschool,
bIsExpanded = Details222.BreakdownWindow.IsSpellExpanded(spellId),
bCanExpand = false,
spellTables = {spellTable},
nestedData = {{spellId = spellId, spellTable = spellTable, actorName = petName, value = 0}},
}
detailsFramework:Mixin(bkSpellData, Details.SpellTableMixin)
breakdownSpellDataList[#breakdownSpellDataList+1] = bkSpellData
alreadyAdded[spellName] = #breakdownSpellDataList
end
end
end
end
end
end
3 years ago
--copy the keys from the spelltable and add them to the spelltableadv
--repeated spells will be summed
for i = 1, #breakdownSpellDataList do
---@type spelltableadv
local bkSpellData = breakdownSpellDataList[i]
Details.SpellTableMixin.SumSpellTables(bkSpellData.spellTables, bkSpellData)
--Details:Destroy(bkSpellData, "spellTables") --temporary fix for BuildSpellTargetFromBreakdownSpellData, that function need to use bkSpellData.nestedData
end
breakdownSpellDataList.totalValue = actorTotal
breakdownSpellDataList.combatTime = actorCombatTime
Details:Destroy(alreadyAdded)
--send to the breakdown window
Details222.BreakdownWindow.SendSpellData(breakdownSpellDataList, actorObject, combatObject, instance)
--targets
---an array of breakdowntargettable
---@type breakdowntargettablelist
local targetList = {}
local targetTotalValue = 0
local targetsTable = self:GetTargets()
for targetName, amount in pairs(targetsTable) do
---@class breakdowntargettable
local bkTargetData = {
name = targetName,
total = amount,
overheal = 0,
}
targetTotalValue = targetTotalValue + amount
tinsert(targetList, bkTargetData)
end
targetList.totalValue = targetTotalValue
targetList.combatTime = actorCombatTime
Details222.BreakdownWindow.SendTargetData(targetList, actorObject, combatObject, instance)
3 years ago
if 1 then return end
3 years ago
--to be deprecated and removed:
3 years ago
5 months ago
--gump:JI_AtualizaContainerBarras(#actorSpellsSorted + 1)
local max_ = breakdownSpellDataList[1] and breakdownSpellDataList[1][2] or 0 --dano que a primeiro magia vez
local barra
3 years ago
--aura bar
3 years ago
if (false) then --disabled for now
barra = allLines [1]
if (not barra) then
5 months ago
barra = gump:CriaNovaBarraInfo1(instance, 1)
end
3 years ago
self:UpdadeInfoBar(barra, "", -51, "Auras", max_, false, max_, 100, [[Interface\BUTTONS\UI-GroupLoot-DE-Up]], true, nil, nil)
barra.textura:SetStatusBarColor(Details.gump:ParseColors("purple"))
end
3 years ago
--spell bars
for index, tabela in ipairs(breakdownSpellDataList) do
3 years ago
--index = index + 1 --with the aura bar
index = index
3 years ago
barra = allLines [index]
if (not barra) then
5 months ago
barra = gump:CriaNovaBarraInfo1(instance, index)
end
barra.other_actor = tabela [6]
local name = tabela[4]
3 years ago
if (breakdownWindowFrame.sub_atributo == 2) then
5 months ago
local formated_value = selectedToKFunction(_, math.floor(tabela[2]/actorCombatTime))
3 years ago
self:UpdadeInfoBar(barra, index, tabela[1], name, tabela[2], formated_value, max_, tabela[3], tabela[5], true, nil, tabela [7])
else
5 months ago
local formated_value = selectedToKFunction(_, math.floor(tabela[2]))
3 years ago
self:UpdadeInfoBar(barra, index, tabela[1], name, tabela[2], formated_value, max_, tabela[3], tabela[5], true, nil, tabela [7])
end
3 years ago
self:FocusLock(barra, tabela[1])
end
3 years ago
--targets
if (instance.sub_atributo == DETAILS_SUBATTRIBUTE_ENEMIES) then
local totalDamageTaken = self.damage_taken
local damageTakenFrom = self.damage_from
local combatObject = instance:GetShowingCombat()
local damageContainer = combatObject:GetContainer(DETAILS_ATTRIBUTE_DAMAGE)
local barras = breakdownWindowFrame.barras2
local enemyTable = {}
local targetName = self:Name()
local enemyActorObject
for enemyName in pairs(damageTakenFrom) do
enemyActorObject = damageContainer:GetActor(enemyName)
if (enemyActorObject) then
local damageDoneToTarget = enemyActorObject.targets[targetName]
if (damageDoneToTarget) then
local npcId = DetailsFramework:GetNpcIdFromGuid(enemyActorObject:GetGUID())
enemyTable[#enemyTable+1] = {enemyName, damageDoneToTarget, damageDoneToTarget / totalDamageTaken * 100, enemyActorObject:Class(), npcId}
end
end
end
local enemyAmount = #enemyTable
3 years ago
if (enemyAmount < 1) then
return true
end
3 years ago
gump:JI_AtualizaContainerAlvos(enemyAmount)
3 years ago
table.sort(enemyTable, Details.Sort2)
3 years ago
local topDamage = enemyTable[1] and enemyTable[1][2] or 0
3 years ago
local thisLine
for index, thisEnemyTable in ipairs(enemyTable) do
thisLine = barras[index]
if (not thisLine) then --se a barra n�o existir, criar ela ent�o
5 months ago
thisLine = gump:CriaNovaBarraInfo2(instance, index)
thisLine.textura:SetStatusBarColor(1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o
end
3 years ago
if (index == 1) then
thisLine.textura:SetValue(100)
else
thisLine.textura:SetValue(thisEnemyTable[2] / topDamage * 100)
end
thisLine.lineText1:SetText(index .. ". " .. Details:GetOnlyName(thisEnemyTable[1])) --left text
5 months ago
thisLine.lineText4:SetText(Details:comma_value(thisEnemyTable[2]) .. "(" .. format("%.1f", thisEnemyTable[3]) .. "%)") --right text
3 years ago
thisLine.icone:SetTexture([[Interface\AddOns\Details\images\classes_small_alpha]]) --class icon
3 years ago
local texCoords = Details.class_coords[thisEnemyTable[4]]
if (not texCoords) then
texCoords = Details.class_coords["UNKNOW"]
end
thisLine.icone:SetTexCoord(unpack(texCoords))
3 years ago
local color = Details.class_colors[thisEnemyTable[4]]
if (color) then
thisLine.textura:SetStatusBarColor(unpack(color))
else
thisLine.textura:SetStatusBarColor(1, 1, 1)
end
3 years ago
Details:name_space_info(thisLine)
3 years ago
if (thisLine.mouse_over) then --atualizar o tooltip
if (thisLine.isAlvo) then
3 years ago
GameTooltip:Hide()
GameTooltip:SetOwner(thisLine, "ANCHOR_TOPRIGHT")
if (not thisLine.minha_tabela:MontaTooltipDamageTaken(thisLine, index)) then
return
end
GameTooltip:Show()
end
end
3 years ago
thisLine.minha_tabela = self --grava o jogador na tabela
thisLine.nome_inimigo = thisEnemyTable[1] --salva o nome do inimigo na barra --isso � necess�rio?
3 years ago
-- no rank do spell id colocar o que?
thisLine.spellid = "enemies"
thisLine:Show() --mostra a barra
end
else
local combatObject = instance:GetShowingCombat()
local damageContainer = combatObject:GetContainer(DETAILS_ATTRIBUTE_DAMAGE)
local allActorTargets = {}
3 years ago
--table with actor names and damage done which the player caused damage to
local targetsTable = self.targets
for targetName, damageDone in pairs(targetsTable) do
tinsert(allActorTargets, {targetName, damageDone, damageDone / totalDamageWithoutPet * 100})
end
3 years ago
table.sort(allActorTargets, Details.Sort2)
3 years ago
local enemyAmount = #allActorTargets
if (enemyAmount < 1) then
return
end
3 years ago
gump:JI_AtualizaContainerAlvos(enemyAmount)
3 years ago
local topDamage = allActorTargets[1] and allActorTargets[1][2] or 0
3 years ago
local barra
for index, targetTable in ipairs(allActorTargets) do
barra = breakdownWindowFrame.barras2[index]
3 years ago
if (not barra) then
barra = gump:CriaNovaBarraInfo2(instance, index)
3 years ago
barra.textura:SetStatusBarColor(1, 1, 1, 1)
end
3 years ago
if (index == 1) then
3 years ago
barra.textura:SetValue(100)
else
barra.textura:SetValue(targetTable[2] / topDamage * 100)
end
3 years ago
local targetName = targetTable[1]
local targetActorObject = damageContainer:GetActor(targetName)
if (targetActorObject) then
local npcId = DetailsFramework:GetNpcIdFromGuid(targetActorObject:GetGUID())
local portraitTexture -- = Details222.Textures.GetPortraitTextureForNpcID(npcId) disabled
if (portraitTexture) then
Details222.Textures.FormatPortraitAsTexture(portraitTexture, barra.icone)
else
targetActorObject:SetClassIcon(barra.icone, instance, targetActorObject.classe)
end
else
3 years ago
barra.icone:SetTexture([[Interface\AddOns\Details\images\classes_small_alpha]]) --CLASSE
local texCoords = Details.class_coords ["ENEMY"]
3 years ago
barra.icone:SetTexCoord(unpack(texCoords))
end
barra.textura:SetStatusBarColor(1, 0.8, 0.8)
barra.textura:SetStatusBarColor(1, 1, 1, 1)
barra.lineText1:SetText(index .. ". " .. Details:GetOnlyName(targetName))
3 years ago
if (breakdownWindowFrame.sub_atributo == 2) then
5 months ago
barra.lineText4:SetText(Details:comma_value( math.floor(targetTable[2]/actorCombatTime)) .. "(" .. format("%.1f", targetTable[3]) .. "%)")
else
5 months ago
barra.lineText4:SetText(selectedToKFunction(_, targetTable[2]) .."(" .. format("%.1f", targetTable[3]) .. "%)")
end
3 years ago
if (barra.mouse_over) then --atualizar o tooltip
if (barra.isAlvo) then
5 months ago
if (not barra.minha_tabela:MontaTooltipAlvos(barra, index, instance)) then
return
end
end
end
3 years ago
barra.minha_tabela = self --grava o jogador na tabela
barra.nome_inimigo = targetTable [1] --salva o nome do inimigo na barra --isso � necess�rio?
3 years ago
-- no rank do spell id colocar o que?
barra.spellid = targetTable[5]
barra:Show()
end
end
end
------ Detalhe Info Friendly Fire
5 months ago
function damageClass:MontaDetalhesFriendlyFire(nome, barra)
local barras = breakdownWindowFrame.barras3
local instancia = breakdownWindowFrame.instancia
3 years ago
local tabela_do_combate = breakdownWindowFrame.instancia.showing
3 years ago
local showing = tabela_do_combate [class_type] --o que esta sendo mostrado -> [1] - dano [2] - cura --pega o container com ._NameIndexTable ._ActorTable
local friendlyfire = self.friendlyfire
3 years ago
local ff_table = self.friendlyfire [nome] --assumindo que nome � o nome do Alvo que tomou dano // bastaria pegar a tabela de habilidades dele
if (not ff_table) then
return
end
local total = ff_table.total
3 years ago
local minhas_magias = {}
3 years ago
for spellid, amount in pairs(ff_table.spells) do --da foreach em cada spellid do container
local nome, _, icone = _GetSpellInfo(spellid)
tinsert(minhas_magias, {spellid, amount, amount / total * 100, nome, icone})
end
5 months ago
table.sort(minhas_magias, Details.Sort2)
3 years ago
local max_ = minhas_magias[1] and minhas_magias[1][2] or 0 --dano que a primeiro magia vez
local lastIndex = 1
local barra
3 years ago
for index, tabela in ipairs(minhas_magias) do
lastIndex = index
barra = barras [index]
3 years ago
if (not barra) then --se a barra n�o existir, criar ela ent�o
5 months ago
barra = gump:CriaNovaBarraInfo3(instancia, index)
3 years ago
barra.textura:SetStatusBarColor(1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o
end
3 years ago
barra.show = tabela[1]
if (index == 1) then
3 years ago
barra.textura:SetValue(100)
else
3 years ago
barra.textura:SetValue(tabela[2]/max_*100) --muito mais rapido...
end
barra.lineText1:SetText(index..instancia.divisores.colocacao..tabela[4]) --seta o texto da esqueda
5 months ago
barra.lineText4:SetText(Details:comma_value(tabela[2]) .. " " .. instancia.divisores.abre .. format("%.1f", tabela[3]) .. "%" .. instancia.divisores.fecha) --seta o texto da direita
3 years ago
barra.icone:SetTexture(tabela[5])
barra.icone:SetTexCoord(0, 1, 0, 1)
barra:Show() --mostra a barra
if (index == 15) then
break
end
end
3 years ago
for i = lastIndex+1, #barras do
barras[i]:Hide()
end
end
-- detalhes info enemies
5 months ago
function damageClass:MontaDetalhesEnemy(spellid, barra)
3 years ago
local container = breakdownWindowFrame.instancia.showing[1]
local barras = breakdownWindowFrame.barras3
local instancia = breakdownWindowFrame.instancia
3 years ago
local other_actor = barra.other_actor
if (other_actor) then
self = other_actor
end
3 years ago
if (barra.lineText1:IsTruncated()) then
3 years ago
Details:CooltipPreset(2)
GameCooltip:SetOption("FixedWidth", nil)
GameCooltip:AddLine(barra.lineText1.text)
GameCooltip:SetOwner(barra, "bottomleft", "topleft", 5, -10)
GameCooltip:ShowCooltip()
end
3 years ago
5 months ago
local spell = self.spells:PegaHabilidade(spellid)
3 years ago
local targets = spell.targets
local target_pool = {}
3 years ago
for target_name, amount in pairs(targets) do
local classe
5 months ago
local this_actor = breakdownWindowFrame.instancia.showing(1, target_name)
if (this_actor) then
classe = this_actor.classe or "UNKNOW"
else
classe = "UNKNOW"
end
target_pool [#target_pool+1] = {target_name, amount, classe}
end
3 years ago
5 months ago
table.sort(target_pool, Details.Sort2)
3 years ago
local max_ = target_pool [1] and target_pool [1][2] or 0
3 years ago
local lastIndex = 1
local barra
3 years ago
for index, tabela in ipairs(target_pool) do
lastIndex = index
barra = barras [index]
3 years ago
if (not barra) then --se a barra n�o existir, criar ela ent�o
5 months ago
barra = gump:CriaNovaBarraInfo3(instancia, index)
3 years ago
barra.textura:SetStatusBarColor(1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o
end
3 years ago
barra.show = tabela[1]
if (index == 1) then
3 years ago
barra.textura:SetValue(100)
else
3 years ago
barra.textura:SetValue(tabela[2]/max_*100) --muito mais rapido...
end
3 years ago
barra.lineText1:SetText(index .. ". " .. Details:GetOnlyName(tabela [1])) --seta o texto da esqueda
5 months ago
Details:name_space_info(barra)
3 years ago
if (spell.total > 0) then
5 months ago
barra.lineText4:SetText(Details:comma_value(tabela[2]) .."(".. format("%.1f", tabela[2] / spell.total * 100) .."%)") --seta o texto da direita
else
5 months ago
barra.lineText4:SetText(tabela[2] .."(0%)") --seta o texto da direita
end
3 years ago
local texCoords = Details.class_coords [tabela[3]]
if (not texCoords) then
texCoords = Details.class_coords ["UNKNOW"]
end
3 years ago
local color = Details.class_colors [tabela[3]]
if (color) then
3 years ago
barra.textura:SetStatusBarColor(unpack(color))
else
3 years ago
barra.textura:SetStatusBarColor(1, 1, 1, 1)
end
3 years ago
barra.icone:SetTexture("Interface\\AddOns\\Details\\images\\classes_small_alpha")
barra.icone:SetTexCoord(unpack(texCoords))
barra:Show() --mostra a barra
if (index == 15) then
break
end
end
3 years ago
for i = lastIndex+1, #barras do
barras[i]:Hide()
end
end
------ Detalhe Info Damage Taken
5 months ago
function damageClass:MontaDetalhesDamageTaken(nome, barra)
local barras = breakdownWindowFrame.barras3
local instancia = breakdownWindowFrame.instancia
3 years ago
local tabela_do_combate = breakdownWindowFrame.instancia.showing
3 years ago
local showing = tabela_do_combate [class_type] --o que esta sendo mostrado -> [1] - dano [2] - cura --pega o container com ._NameIndexTable ._ActorTable
local este_agressor = showing._ActorTable[showing._NameIndexTable[nome]]
3 years ago
if (not este_agressor ) then
return
end
3 years ago
local conteudo = este_agressor.spells._ActorTable --pairs[] com os IDs das magias
local actor = breakdownWindowFrame.jogador.nome
3 years ago
local total = este_agressor.targets [actor] or 0
local minhas_magias = {}
3 years ago
for spellid, tabela in pairs(conteudo) do --da foreach em cada spellid do container
local este_alvo = tabela.targets [actor]
3 years ago
if (este_alvo) then --esta magia deu dano no actor
local spell_nome, rank, icone = _GetSpellInfo(spellid)
tinsert(minhas_magias, {spellid, este_alvo, este_alvo/total*100, spell_nome, icone})
end
end
5 months ago
table.sort(minhas_magias, Details.Sort2)
--local amt = #minhas_magias
5 months ago
--gump:JI_AtualizaContainerBarras(amt)
3 years ago
local max_ = minhas_magias[1] and minhas_magias[1][2] or 0 --dano que a primeiro magia vez
local lastIndex = 1
local barra
3 years ago
for index, tabela in ipairs(minhas_magias) do
lastIndex = index
barra = barras [index]
3 years ago
if (not barra) then --se a barra n�o existir, criar ela ent�o
5 months ago
barra = gump:CriaNovaBarraInfo3(instancia, index)
3 years ago
barra.textura:SetStatusBarColor(1, 1, 1, 1) --isso aqui � a parte da sele��o e descele��o
end
3 years ago
barra.show = tabela[1]
if (index == 1) then
3 years ago
barra.textura:SetValue(100)
else
3 years ago
barra.textura:SetValue(tabela[2]/max_*100)
end
3 years ago
barra.lineText1:SetText(index .. "." .. tabela[4]) --seta o texto da esqueda
5 months ago
Details:name_space_info(barra)
3 years ago
5 months ago
barra.lineText4:SetText(Details:comma_value(tabela[2]) .." ".. instancia.divisores.abre ..format("%.1f", tabela[3]) .."%".. instancia.divisores.fecha) --seta o texto da direita
3 years ago
barra.icone:SetTexture(tabela[5])
barra.icone:SetTexCoord(0, 1, 0, 1)
barra:Show() --mostra a barra
if (index == 15) then
break
end
end
3 years ago
for i = lastIndex+1, #barras do
barras[i]:Hide()
end
end
------ Detalhe Info Damage Done e Dps
5 months ago
local defensesTable = {c = {1, 1, 1, 0.5}, p = 0}
local normalTable = {c = {1, 1, 1, 0.5}, p = 0}
local criticalTable = {c = {1, 1, 1, 0.5}, p = 0}
local columnSizes = {67,95,67,111,109,109,101,110,116,97,116,111,114}
Details.column_sizes = columnSizes
local dataTable = {}
local t1, t2, t3, t4 = {}, {}, {}, {}
5 months ago
local maxPercent = 100
---called from the spell breakdown when a spellbar is hovered over
---@param spellBar breakdownspellbar
---@param spellBlockContainer breakdownspellblockframe
---@param blockIndex number
---@param summaryBlock breakdownspellblock
---@param spellId number
---@param combatTime number
---@param actorName string
---@param spellTable spelltableadv
---@param trinketData trinketdata
---@param combatObject combat
function damageClass:BuildSpellDetails(spellBar, spellBlockContainer, blockIndex, summaryBlock, spellId, combatTime, actorName, spellTable, trinketData, combatObject)
---@type number
local totalHits = spellTable.counter
--damage section showing damage done sub section
blockIndex = blockIndex + 1
do --update the texts in the summary block
local blockLine1, blockLine2, blockLine3 = summaryBlock:GetLines()
local totalCasts = spellBar.amountCasts > 0 and spellBar.amountCasts or "(?)"
blockLine1.leftText:SetText(Loc ["STRING_CAST"] .. ": " .. totalCasts) --total amount of casts
local trinketProcs = combatObject:GetTrinketProcsForPlayer(actorName)
if (trinketData[spellId] and trinketProcs) then
local trinketProcData = trinketProcs[actorName]
if (trinketProcData) then
local trinketProc = trinketProcData[spellId]
if (trinketProc) then
blockLine1.leftText:SetText("Procs: " .. trinketProc.total)
end
end
5 months ago
elseif(Details.GetItemSpellInfo(spellId)) then
blockLine1.leftText:SetText("Uses: " .. totalCasts)
end
blockLine1.rightText:SetText(Loc ["STRING_HITS"]..": " .. totalHits) --hits and uptime
blockLine2.leftText:SetText(Loc ["STRING_DAMAGE"]..": " .. Details:Format(spellTable.total)) --total damage
blockLine2.rightText:SetText(Details:GetSpellSchoolFormatedName(spellTable.spellschool)) --spell school
blockLine3.leftText:SetText(Loc ["STRING_AVERAGE"] .. ": " .. Details:Format(spellBar.average)) --average damage
if (spellBar.perSecond and spellBar.perSecond > 0) then
blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellBar.perSecond)) --dps
else
blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellTable.total / combatTime)) --dps
end
end
local emporwerSpell = spellTable.e_total
if (emporwerSpell) then
local empowerLevelSum = spellTable.e_total --total sum of empower levels
local empowerAmount = spellTable.e_amt --amount of casts with empower
local empowerAmountPerLevel = spellTable.e_lvl --{[1] = 4; [2] = 9; [3] = 15}
local empowerDamagePerLevel = spellTable.e_dmg --{[1] = 54548745, [2] = 74548745}
---@type breakdownspellblock
local empowerBlock = spellBlockContainer:GetBlock(blockIndex)
blockIndex = blockIndex + 1
local level1AverageDamage = "0"
local level2AverageDamage = "0"
local level3AverageDamage = "0"
local level4AverageDamage = "0"
local level5AverageDamage = "0"
if (empowerDamagePerLevel[1]) then
level1AverageDamage = Details:Format(empowerDamagePerLevel[1] / empowerAmountPerLevel[1])
end
if (empowerDamagePerLevel[2]) then
level2AverageDamage = Details:Format(empowerDamagePerLevel[2] / empowerAmountPerLevel[2])
end
if (empowerDamagePerLevel[3]) then
level3AverageDamage = Details:Format(empowerDamagePerLevel[3] / empowerAmountPerLevel[3])
end
if (empowerDamagePerLevel[4]) then
level4AverageDamage = Details:Format(empowerDamagePerLevel[4] / empowerAmountPerLevel[4])
end
if (empowerDamagePerLevel[5]) then
level5AverageDamage = Details:Format(empowerDamagePerLevel[5] / empowerAmountPerLevel[5])
end
empowerBlock:Show()
empowerBlock:SetValue(100)
empowerBlock.sparkTexture:SetPoint("left", empowerBlock, "left", empowerBlock:GetWidth() + Details.breakdown_spell_tab.blockspell_spark_offset, 0)
empowerBlock:SetColor(0.200, 0.576, 0.498, 0.6)
local blockLine1, blockLine2, blockLine3 = empowerBlock:GetLines()
blockLine1.leftText:SetText("Spell Empower Average Level: " .. string.format("%.2f", empowerLevelSum / empowerAmount))
if (level1AverageDamage ~= "0") then
5 months ago
blockLine2.leftText:SetText("#1 Avg: " .. level1AverageDamage .. "(" ..(empowerAmountPerLevel[1] or 0) .. ")")
end
if (level2AverageDamage ~= "0") then
5 months ago
blockLine2.centerText:SetText("#2 Avg: " .. level2AverageDamage .. "(" ..(empowerAmountPerLevel[2] or 0) .. ")")
end
if (level3AverageDamage ~= "0") then
5 months ago
blockLine2.rightText:SetText("#3 Avg: " .. level3AverageDamage .. "(" ..(empowerAmountPerLevel[3] or 0) .. ")")
end
if (level4AverageDamage ~= "0") then
5 months ago
blockLine3.leftText:SetText("#4 Avg: " .. level4AverageDamage .. "(" ..(empowerAmountPerLevel[4] or 0) .. ")")
end
if (level5AverageDamage ~= "0") then
5 months ago
blockLine3.rightText:SetText("#5 Avg: " .. level5AverageDamage .. "(" ..(empowerAmountPerLevel[5] or 0) .. ")")
end
end
--check if there's normal hits and build the block
---@type number
local normalHitsAmt = spellTable.n_amt
if (normalHitsAmt > 0) then
---@type breakdownspellblock
local normalHitsBlock = spellBlockContainer:GetBlock(blockIndex)
normalHitsBlock:Show()
blockIndex = blockIndex + 1
local percent = normalHitsAmt / math.max(totalHits, 0.0001) * 100
normalHitsBlock:SetValue(percent)
normalHitsBlock.sparkTexture:SetPoint("left", normalHitsBlock, "left", percent / 100 * normalHitsBlock:GetWidth() + Details.breakdown_spell_tab.blockspell_spark_offset, 0)
local blockLine1, blockLine2, blockLine3 = normalHitsBlock:GetLines()
blockLine1.leftText:SetText(Loc ["STRING_NORMAL_HITS"])
blockLine1.rightText:SetText(normalHitsAmt .. " [|cFFC0C0C0" .. string.format("%.1f", normalHitsAmt / math.max(totalHits, 0.0001) * 100) .. "%|r]")
blockLine2.leftText:SetText(Loc ["STRING_MINIMUM_SHORT"] .. ": " .. Details:CommaValue(spellTable.n_min))
blockLine2.rightText:SetText(Loc ["STRING_MAXIMUM_SHORT"] .. ": " .. Details:CommaValue(spellTable.n_max))
local normalAverage = spellTable.n_total / math.max(normalHitsAmt, 0.0001)
blockLine3.leftText:SetText(Loc ["STRING_AVERAGE"] .. ": " .. Details:CommaValue(normalAverage))
5 months ago
local tempo =(combatTime * spellTable.n_total) / math.max(spellTable.total, 0.001)
local normalAveragePercent = spellBar.average / normalAverage * 100
local normalTempoPercent = normalAveragePercent * tempo / 100
blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellTable.n_total / normalTempoPercent))
end
---@type number
local criticalHitsAmt = spellTable.c_amt
if (criticalHitsAmt > 0) then
---@type breakdownspellblock
local critHitsBlock = spellBlockContainer:GetBlock(blockIndex)
critHitsBlock:Show()
blockIndex = blockIndex + 1
local percent = Details.SpellTableMixin.GetCritPercent(spellTable)
critHitsBlock:SetValue(percent)
critHitsBlock.sparkTexture:SetPoint("left", critHitsBlock, "left", percent / 100 * critHitsBlock:GetWidth() + Details.breakdown_spell_tab.blockspell_spark_offset, 0)
local blockLine1, blockLine2, blockLine3 = critHitsBlock:GetLines()
blockLine1.leftText:SetText(Loc ["STRING_CRITICAL_HITS"])
blockLine1.rightText:SetText(criticalHitsAmt .. " [|cFFC0C0C0" .. string.format("%.1f", criticalHitsAmt / math.max(totalHits, 0.0001) * 100) .. "%|r]")
blockLine2.leftText:SetText(Loc ["STRING_MINIMUM_SHORT"] .. ": " .. Details:CommaValue(spellTable.c_min))
blockLine2.rightText:SetText(Loc ["STRING_MAXIMUM_SHORT"] .. ": " .. Details:CommaValue(spellTable.c_max))
local critAverage = Details.SpellTableMixin.GetCritAverage(spellTable)
blockLine3.leftText:SetText(Loc ["STRING_AVERAGE"] .. ": " .. Details:CommaValue(critAverage))
5 months ago
local tempo =(combatTime * spellTable.c_total) / math.max(spellTable.total, 0.001)
local critAveragePercent = spellBar.average / critAverage * 100
local critTempoPercent = critAveragePercent * tempo / 100
blockLine3.rightText:SetText(Loc ["STRING_DPS"] .. ": " .. Details:CommaValue(spellTable.c_total / critTempoPercent))
end
--missing hits
local semiDodgeAmount = spellTable.g_amt + spellTable.b_amt --glancing and blocking
local fullDodgeAmount = spellTable["DODGE"] or 0
local parryAmount = spellTable["PARRY"] or 0
local missedHitsAmount = spellTable["MISS"] or 0
local hitErrorsAmount = parryAmount + fullDodgeAmount + missedHitsAmount
if (semiDodgeAmount > 0 or hitErrorsAmount > 0) then
---@type breakdownspellblock
local defensesBlock = spellBlockContainer:GetBlock(blockIndex)
defensesBlock:Show()
blockIndex = blockIndex + 1
5 months ago
local percent =(semiDodgeAmount + hitErrorsAmount) / spellTable.counter * 100
defensesBlock:SetValue(percent)
defensesBlock.sparkTexture:SetPoint("left", defensesBlock, "left", percent / 100 * defensesBlock:GetWidth() + Details.breakdown_spell_tab.blockspell_spark_offset, 0)
local blockLine1, blockLine2, blockLine3 = defensesBlock:GetLines()
blockLine1.leftText:SetText(Loc ["STRING_DEFENSES"])
blockLine1.rightText:SetText((semiDodgeAmount + hitErrorsAmount) .. " / " .. format("%.1f", percent) .. "%")
if (missedHitsAmount > 0) then
blockLine2.leftText:SetText("Miss" .. ": " .. missedHitsAmount)
end
if (parryAmount > 0) then
blockLine2.centerText:SetText(Loc ["STRING_PARRY"] .. ": " .. parryAmount)
end
if (fullDodgeAmount > 0) then
blockLine2.rightText:SetText(Loc ["STRING_DODGE"] .. ": " .. fullDodgeAmount)
end
if (spellTable.b_amt > 0) then
blockLine3.leftText:SetText(Loc ["STRING_BLOCKED"] .. ": " .. spellTable.b_amt)
end
if (spellTable.g_amt > 0) then
blockLine3.rightText:SetText(Loc ["STRING_GLANCING"] .. ": " .. spellTable.g_amt)
end
end
if (trinketData[spellId]) then
---@type trinketdata
local trinketInfo = trinketData[spellId]
local minTime = trinketInfo.minTime
local maxTime = trinketInfo.maxTime
local average = trinketInfo.averageTime
---@type breakdownspellblock
local trinketBlock = spellBlockContainer:GetBlock(blockIndex)
trinketBlock:Show()
trinketBlock:SetValue(100)
trinketBlock.sparkTexture:SetPoint("left", trinketBlock, "left", trinketBlock:GetWidth() + Details.breakdown_spell_tab.blockspell_spark_offset, 0)
blockIndex = blockIndex + 1
local blockLine1, blockLine2, blockLine3 = trinketBlock:GetLines()
blockLine1.leftText:SetText("Trinket Info")
blockLine1.rightText:SetText("PPM: " .. string.format("%.2f", average / 60))
if (minTime == 9999999) then
blockLine2.leftText:SetText("Min Time: " .. _G["UNKNOWN"])
else
blockLine2.leftText:SetText("Min Time: " .. math.floor(minTime))
end
blockLine2.rightText:SetText("Max Time: " .. math.floor(maxTime))
end
end
function Details:BuildPlayerDetailsSpellChart()
local playerDetailSmallChart = DetailsPlayerDetailSmallChart
3 years ago
if (not playerDetailSmallChart) then
3 years ago
playerDetailSmallChart = CreateFrame("frame", "DetailsPlayerDetailSmallChart", breakdownWindowFrame,"BackdropTemplate")
3 years ago
DetailsFramework:ApplyStandardBackdrop(playerDetailSmallChart)
playerDetailSmallChart.Lines = {}
3 years ago
for i = 1, 200 do
3 years ago
local texture = playerDetailSmallChart:CreateTexture(nil, "artwork")
texture:SetColorTexture(1, 1, 1, 1)
tinsert(playerDetailSmallChart.Lines, texture)
end
3 years ago
--Details.BreakdownWindowFrame.grupos_detalhes [index]
5 months ago
function playerDetailSmallChart.ShowChart(parent, combatObject, cleuData, playerName, targetName, spellId, ...)
local tokenIdList = {}
local eventList = {}
3 years ago
--build the list of tokens
3 years ago
for i = 1, select("#", ... ) do
local tokenId = select(i, ...)
tokenIdList [tokenId] = true
end
3 years ago
--check which lines can be added
local index = 1
local peakValue = 0
3 years ago
for i = 1, cleuData.n -1 do
local event = cleuData [i]
if (event [2]) then --index 2 = token
local playerNameFilter = playerName and playerName == event [3]
local targetNameFilter = targetName and targetName == event [4]
local spellIdFilter = spellId and spellId == event [5]
3 years ago
if (playerNameFilter or targetNameFilter or spellIdFilter) then
eventList [index] = cleuData [i]
if (peakValue < cleuData [i] [6]) then
peakValue = cleuData [i] [6]
end
index = index + 1
end
end
end
--200 lines, adjust the mini chart
3 years ago
playerDetailSmallChart:SetPoint("topleft", parent, "topleft")
playerDetailSmallChart:SetPoint("bottomright", parent, "bottomright")
--update lines
local width = playerDetailSmallChart:GetWidth()
local combatTime = combatObject:GetCombatTime()
local secondsPerBar = combatTime / 200
local barWidth = width / 200
local barHeight = playerDetailSmallChart:GetHeight()
3 years ago
local currentTime = eventList [1][1]
local currentIndex = 1
local eventAmount = #eventList
3 years ago
for i = 1, #playerDetailSmallChart.Lines do
3 years ago
playerDetailSmallChart.Lines [i]:SetWidth(width / 200)
playerDetailSmallChart.Lines [i]:SetHeight(1)
for o = currentIndex, eventAmount do
if (eventList [o][1] <= currentTime + secondsPerBar or eventList [o][1] >= currentTime) then
5 months ago
playerDetailSmallChart.Lines [i]:SetPoint("bottomleft", playerDetailSmallChart, "bottomleft", barWidth *(i - 1), 0)
3 years ago
playerDetailSmallChart.Lines [i]:SetWidth(barWidth)
playerDetailSmallChart.Lines [i]:SetHeight(eventList [o][6] / peakValue * barHeight)
else
currentIndex = o
break
end
end
3 years ago
currentTime = currentTime + secondsPerBar
end
end
end
end
5 months ago
function damageClass:MontaTooltipDamageTaken(thisLine, index)
local aggressor = breakdownWindowFrame.instancia.showing [1]:PegarCombatente(_, thisLine.nome_inimigo)
local container = aggressor.spells._ActorTable
local habilidades = {}
local total = 0
3 years ago
for spellid, spell in pairs(container) do
for target_name, amount in pairs(spell.targets) do
if (target_name == self.nome) then
total = total + amount
habilidades [#habilidades+1] = {spellid, amount}
end
end
end
5 months ago
table.sort(habilidades, Details.Sort2)
3 years ago
GameTooltip:AddLine(index..". "..thisLine.nome_inimigo)
GameTooltip:AddLine(Loc ["STRING_DAMAGE_TAKEN_FROM2"]..":")
GameTooltip:AddLine(" ")
for index, tabela in ipairs(habilidades) do
local nome, _, icone = _GetSpellInfo(tabela[1])
if (index < 8) then
5 months ago
GameTooltip:AddDoubleLine(index..". |T"..icone..":0|t "..nome, Details:comma_value(tabela[2]).."("..format("%.1f", tabela[2]/total*100).."%)", 1, 1, 1, 1, 1, 1)
else
5 months ago
GameTooltip:AddDoubleLine(index..". "..nome, Details:comma_value(tabela[2]).."("..format("%.1f", tabela[2]/total*100).."%)", .65, .65, .65, .65, .65, .65)
end
end
3 years ago
return true
5 months ago
--GameTooltip:AddDoubleLine(meus_danos[i][4][1]..": ", meus_danos[i][2].."(".._cstr("%.1f", meus_danos[i][3]).."%)", 1, 1, 1, 1, 1, 1)
3 years ago
end
5 months ago
function damageClass:MontaTooltipAlvos(thisLine, index, instancia) --~deprecated
3 years ago
local inimigo = thisLine.nome_inimigo
local habilidades = {}
local total = self.total
local i = 1
3 years ago
Details:FormatCooltipForSpells()
GameCooltip:SetOwner(thisLine, "bottom", "top", 4, -2)
5 months ago
GameCooltip:SetOption("MinWidth", math.max(230, thisLine:GetWidth()*0.98))
3 years ago
for spellid, spell in pairs(self.spells._ActorTable) do
if (spell.isReflection) then
3 years ago
for target_name, amount in pairs(spell.targets) do
if (target_name == inimigo) then
3 years ago
for reflectedSpellId, amount in pairs(spell.extra) do
local spellName, _, spellIcon = _GetSpellInfo(reflectedSpellId)
local t = habilidades [i]
if (not t) then
habilidades [i] = {}
t = habilidades [i]
end
3 years ago
5 months ago
t[1], t[2], t[3] = spellName .. "(|cFFCCBBBBreflected|r)", amount, spellIcon
i = i + 1
end
end
end
3 years ago
else
for target_name, amount in pairs(spell.targets) do
if (target_name == inimigo) then
3 years ago
local nome, _, icone = _GetSpellInfo(spellid)
local t = habilidades [i]
if (not t) then
habilidades [i] = {}
t = habilidades [i]
end
t[1], t[2], t[3] = nome, amount, icone
i = i + 1
end
end
end
end
3 years ago
--add pets
for _, PetName in ipairs(self.pets) do
5 months ago
local PetActor = instancia.showing(class_type, PetName)
3 years ago
if (PetActor) then
local PetSkillsContainer = PetActor.spells._ActorTable
3 years ago
for _spellid, _skill in pairs(PetSkillsContainer) do
local alvos = _skill.targets
3 years ago
for target_name, amount in pairs(alvos) do
if (target_name == inimigo) then
3 years ago
local t = habilidades [i]
if (not t) then
habilidades [i] = {}
t = habilidades [i]
end
3 years ago
local nome, _, icone = _GetSpellInfo(_spellid)
5 months ago
t[1], t[2], t[3] = nome .. "(" .. PetName:gsub((" <.*"), "") .. ")", amount, icone
3 years ago
i = i + 1
end
end
end
end
end
5 months ago
table.sort(habilidades, Details.Sort2)
--get time type
local meu_tempo
if (Details.time_type == 1 or not self.grupo) then
meu_tempo = self:Tempo()
5 months ago
elseif(Details.time_type == 2 or Details.use_realtimedps) then
meu_tempo = breakdownWindowFrame.instancia.showing:GetCombatTime()
end
3 years ago
local is_dps = breakdownWindowFrame.instancia.sub_atributo == 2
3 years ago
if (is_dps) then
5 months ago
Details:AddTooltipSpellHeaderText(Loc ["STRING_DAMAGE_DPS_IN"] .. ":", {1, 0.9, 0.0, 1}, 1, Details.tooltip_spell_icon.file, unpack(Details.tooltip_spell_icon.coords))
Details:AddTooltipHeaderStatusbar(1, 1, 1, 1)
else
5 months ago
Details:AddTooltipSpellHeaderText(Loc ["STRING_DAMAGE_FROM"] .. ":", {1, 0.9, 0.0, 1}, 1, Details.tooltip_spell_icon.file, unpack(Details.tooltip_spell_icon.coords))
Details:AddTooltipHeaderStatusbar(1, 1, 1, 1)
end
local icon_size = Details.tooltip.icon_size
local icon_border = Details.tooltip.icon_border_texcoord
local topSpellDamage = habilidades[1] and habilidades[1][2]
if (topSpellDamage) then
3 years ago
for index, tabela in ipairs(habilidades) do
if (tabela [2] < 1) then
break
end
if (is_dps) then
5 months ago
--GameCooltip:AddDoubleLine(index..". |T"..tabela[3]..":0|t "..tabela[1], Details:comma_value( math.floor(tabela[2] / meu_tempo) ).."(".._cstr("%.1f", tabela[2]/total*100).."%)", 1, 1, 1, 1, 1, 1)
GameCooltip:AddLine(tabela[1], Details:comma_value( math.floor(tabela[2] / meu_tempo) ).."("..format("%.1f", tabela[2]/total*100).."%)")
else
5 months ago
--GameCooltip:AddDoubleLine(index..". |T"..tabela[3]..":0|t " .. tabela[1], SelectedToKFunction(_, tabela[2]) .. "(".._cstr("%.1f", tabela[2]/total*100).."%)", 1, 1, 1, 1, 1, 1)
GameCooltip:AddLine(tabela[1], selectedToKFunction(_, tabela[2]) .. "("..format("%.1f", tabela[2]/total*100).."%)")
end
5 months ago
GameCooltip:AddIcon(tabela[3], nil, nil, icon_size.W + 4, icon_size.H + 4, icon_border.L, icon_border.R, icon_border.T, icon_border.B)
Details:AddTooltipBackgroundStatusbar(false, tabela[2] / topSpellDamage * 100)
end
end
GameCooltip:Show()
3 years ago
return true
end
--controls the activity time of the actor
function damageClass:GetOrChangeActivityStatus(activityStatus)
if (activityStatus == nil) then
--if no value passed, return the current activity status
return self.dps_started
5 months ago
elseif(activityStatus) then
self.dps_started = true
Details222.TimeMachine.AddActor(self)
else
self.dps_started = false
Details222.TimeMachine.RemoveActor(self)
end
5 months ago
end Details.network_key = "Comm"
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
3 years ago
--core functions
--clear cache tables when resetting data
function damageClass:ClearCacheTables()
for i = #ntable, 1, -1 do
ntable [i] = nil
end
for i = #vtable, 1, -1 do
vtable [i] = nil
end
for i = #bs_table, 1, -1 do
bs_table [i] = nil
end
3 years ago
if (bs_tooltip_table) then
Details:Destroy(bs_tooltip_table)
end
if (frags_tooltip_table) then
Details:Destroy(frags_tooltip_table)
end
Details:Destroy(bs_index_table)
Details:Destroy(tooltip_temp_table)
Details:Destroy(tooltip_void_zone_temp)
end
3 years ago
--atualize a funcao de abreviacao
function damageClass:UpdateSelectedToKFunction()
5 months ago
selectedToKFunction = ToKFunctions [Details.ps_abbreviation]
formatTooltipNumber = ToKFunctions [Details.tooltip.abbreviation]
tooltipMaximizedMethod = Details.tooltip.maximize_method
headerColor = Details.tooltip.header_text_color
end
3 years ago
--diminui o total das tabelas do combate
5 months ago
function damageClass:subtract_total(combat_table)
combat_table.totals [class_type] = combat_table.totals [class_type] - self.total
if (self.grupo) then
combat_table.totals_grupo [class_type] = combat_table.totals_grupo [class_type] - self.total
end
end
5 months ago
function damageClass:add_total(combat_table)
combat_table.totals [class_type] = combat_table.totals [class_type] + self.total
if (self.grupo) then
combat_table.totals_grupo [class_type] = combat_table.totals_grupo [class_type] + self.total
end
end
3 years ago
---sum the passed actor into a combat, if the combat isn't passed, it will use the overall combat
---the function returns the actor that was created of found in the combat passed
---@param actorObject actor
---@param bRefreshActor boolean|nil
---@param combatObject combat|nil
---@return actor
function damageClass:AddToCombat(actorObject, bRefreshActor, combatObject)
--check if there's a custom combat, if not just use the overall container
combatObject = combatObject or Details.tabela_overall --same as Details:GetCombat(DETAILS_SEGMENTID_OVERALL)
3 years ago
--check if the combatObject has an actor with the same name, if not, just create one new
local actorContainer = combatObject[DETAILS_ATTRIBUTE_DAMAGE] --same as combatObject:GetContainer(DETAILS_ATTRIBUTE_DAMAGE)
local overallActor = actorContainer._ActorTable[actorContainer._NameIndexTable[actorObject.nome]] --same as actorContainer:GetActor(actorObject:Name())
3 years ago
if (not overallActor) then
overallActor = actorContainer:GetOrCreateActor(actorObject.serial, actorObject.nome, actorObject.flag_original, true)
overallActor.classe = actorObject.classe
overallActor:SetSpecId(actorObject.spec)
overallActor.isTank = actorObject.isTank
overallActor.pvp = actorObject.pvp
overallActor.boss = actorObject.boss
overallActor.start_time = time() - 3
overallActor.end_time = time()
end
3 years ago
overallActor.displayName = actorObject.displayName or actorObject.nome
overallActor.boss_fight_component = actorObject.boss_fight_component or overallActor.boss_fight_component
overallActor.fight_component = actorObject.fight_component or overallActor.fight_component
overallActor.grupo = actorObject.grupo or overallActor.grupo
3 years ago
--check if need to restore meta tables and indexes for this actor
if (bRefreshActor) then
--this call will reenable the metatable, __index and set the metatable on the .spells container
Details.refresh:r_atributo_damage(actorObject)
end
3 years ago
--elapsed time
local endTime = actorObject.end_time
if (not actorObject.end_time) then
endTime = time()
end
3 years ago
local tempo = endTime - actorObject.start_time
overallActor.start_time = overallActor.start_time - tempo
5 months ago
--pets(add unique pet names)
for _, petName in ipairs(actorObject.pets) do --same as actorObject:GetPets()
DetailsFramework.table.addunique(overallActor.pets, petName)
end
---@cast actorObject actordamage
3 years ago
--sum total damage
overallActor.total = overallActor.total + actorObject.total
overallActor.total_extra = overallActor.total_extra + actorObject.total_extra
overallActor.totalabsorbed = overallActor.totalabsorbed + actorObject.totalabsorbed
3 years ago
--sum total damage without pet
overallActor.total_without_pet = overallActor.total_without_pet + actorObject.total_without_pet
3 years ago
--sum total damage taken
overallActor.damage_taken = overallActor.damage_taken + actorObject.damage_taken
3 years ago
--sum friendly fire
overallActor.friendlyfire_total = overallActor.friendlyfire_total + actorObject.friendlyfire_total
3 years ago
--sum total damage on the combatObject passed
combatObject.totals[1] = combatObject.totals[1] + actorObject.total
if (actorObject.grupo) then
combatObject.totals_grupo[1] = combatObject.totals_grupo[1] + actorObject.total
end
3 years ago
--copy damage taken from
for aggressorName, _ in pairs(actorObject.damage_from) do
overallActor.damage_from[aggressorName] = true
end
3 years ago
--copy targets
for targetName, amount in pairs(actorObject.targets) do
5 months ago
overallActor.targets[targetName] =(overallActor.targets[targetName] or 0) + amount
end
3 years ago
--copy raid targets
for flag, amount in pairs(actorObject.raid_targets) do
overallActor.raid_targets = overallActor.raid_targets or {}
5 months ago
overallActor.raid_targets[flag] =(overallActor.raid_targets[flag] or 0) + amount
end
---@type spellcontainer
local overallSpellsContainer = overallActor.spells --same as overallActor:GetSpellContainer("spell")
4 years ago
--copy spell table
for spellId, spellTable in pairs(actorObject.spells._ActorTable) do --same as overallSpellsContainer:GetRawSpellTable()
--var name has 'overall' but this function accepts any combat table
local overallSpellTable = overallSpellsContainer:GetOrCreateSpell(spellId, true)
3 years ago
--sum spell targets
for targetName, amount in pairs(spellTable.targets) do
5 months ago
overallSpellTable.targets[targetName] =(overallSpellTable.targets[targetName] or 0) + amount
end
--refresh and add extra values
for extraSpellId, amount in pairs(spellTable.extra) do
5 months ago
overallSpellTable.extra[extraSpellId] =(overallSpellTable.extra[extraSpellId] or 0) + amount
end
3 years ago
overallSpellTable.spellschool = spellTable.spellschool
3 years ago
--sum all values of the spelltable which can be summed
for key, value in pairs(spellTable) do
if (type(value) == "number") then
if (key ~= "id" and key ~= "spellschool") then
if (not overallSpellTable [key]) then
overallSpellTable [key] = 0
end
if (key == "n_min" or key == "c_min") then
if (overallSpellTable [key] > value) then
overallSpellTable [key] = value
end
5 months ago
elseif(key == "n_max" or key == "c_max") then
if (overallSpellTable [key] < value) then
overallSpellTable [key] = value
end
else
overallSpellTable [key] = overallSpellTable [key] + value
end
end
3 years ago
--empowered spells
elseif(key == "e_dmg" or key == "e_lvl") then
if (not overallSpellTable[key]) then
overallSpellTable[key] = {}
end
for empowermentLevel, empowermentValue in pairs(spellTable[key]) do
overallSpellTable[key][empowermentLevel] = empowermentValue
end
end
end
end
3 years ago
if (actorObject.augmentedSpellsContainer) then
local overallAugmentedSpellsContainer = overallActor.augmentedSpellsContainer or spellContainerClass:CreateSpellContainer(Details.container_type.CONTAINER_DAMAGE_CLASS)
overallActor.augmentedSpellsContainer = overallAugmentedSpellsContainer
for spellId, spellTable in pairs(actorObject.augmentedSpellsContainer._ActorTable) do --same as actorObject.augmentedSpellsContainer:GetRawSpellTable()
local overallSpellTable = overallAugmentedSpellsContainer:GetOrCreateSpell(spellId, true)
overallSpellTable.total = overallSpellTable.total + spellTable.total
for targetName, amount in pairs(spellTable.targets) do
5 months ago
overallSpellTable.targets[targetName] =(overallSpellTable.targets[targetName] or 0) + amount
end
end
end
--copy the friendly fire container
for targetName, friendlyFireTable in pairs(actorObject.friendlyfire) do
--get or create the friendly fire table in the overall data
local friendlyFireOverall = overallActor.friendlyfire[targetName] or overallActor:CreateFFTable(targetName)
--sum the total
friendlyFireOverall.total = friendlyFireOverall.total + friendlyFireTable.total
--sum spells
for friendlyFireSpellId, amount in pairs(friendlyFireTable.spells) do
5 months ago
friendlyFireOverall.spells[friendlyFireSpellId] =(friendlyFireOverall.spells[friendlyFireSpellId] or 0) + amount
end
end
return overallActor
end
--actor 1 is who will receive the sum from actor2
function Details.SumDamageActors(actor1, actor2, actorContainer) --not called anywhere, can be deprecated
--general
actor1.total = actor1.total + actor2.total
actor1.damage_taken = actor1.damage_taken + actor2.damage_taken
actor1.totalabsorbed = actor1.totalabsorbed + actor2.totalabsorbed
actor1.total_without_pet = actor1.total_without_pet + actor2.total_without_pet
actor1.friendlyfire_total = actor1.friendlyfire_total + actor2.friendlyfire_total
--damage taken from
for actorName in pairs(actor2.damage_from) do
actor1.damage_from[actorName] = true
--add the damage done to actor2 into the damage done to target1
if (actorContainer) then
--get the actor that caused the damage on actor2
local actorObject = actorContainer:GetActor(actorName)
if (actorObject) then
5 months ago
local damageToActor2 =(actorObject.targets[actor2.nome]) or 0
actorObject.targets[actor1.nome] =(actorObject.targets[actor1.nome] or 0) + damageToActor2
end
end
end
--targets
for actorName, damageDone in pairs(actor2.targets) do
5 months ago
actor1.targets[actorName] =(actor1.targets[actorName] or 0) + damageDone
end
--pets
for i = 1, #actor2.pets do
DetailsFramework.table.addunique(actor1.pets, actor2.pets[i])
end
--raid targets
for raidTargetFlag, damageDone in pairs(actor2.raid_targets) do
5 months ago
actor1.raid_targets[raidTargetFlag] =(actor1.raid_targets[raidTargetFlag] or 0) + damageDone
end
--friendly fire
for actorName, ffTable in pairs(actor2.friendlyfire) do
actor1.friendlyfire[actorName] = actor1.friendlyfire[actorName] or actor1:CreateFFTable(actorName)
actor1.friendlyfire[actorName].total = actor1.friendlyfire[actorName].total + ffTable.total
for spellId, damageDone in pairs(ffTable.spells) do
5 months ago
actor1.friendlyfire[actorName].spells[spellId] =(actor1.friendlyfire[actorName].spells[spellId] or 0) + damageDone
end
end
--spells
local ignoredKeys = {
id = true,
spellschool = true,
}
local actor1Spells = actor1.spells
for spellId, spellTable in pairs(actor2.spells._ActorTable) do
local actor1Spell = actor1Spells:GetOrCreateSpell(spellId, true, "DAMAGE_DONE")
--genetal spell attributes
for key, value in pairs(spellTable) do
if (type(value) == "number") then
if (not ignoredKeys[key]) then
if (key == "n_min" or key == "c_min") then
if (actor1Spell[key] > value) then
actor1Spell[key] = value
end
5 months ago
elseif(key == "n_max" or key == "c_max") then
if (actor1Spell[key] < value) then
actor1Spell[key] = value
end
else
actor1Spell[key] = actor1Spell[key] + value
end
end
end
end
--spell targets
for targetName, damageDone in pairs(spellTable) do
5 months ago
actor1Spell.targets[targetName] =(actor1Spell.targets[targetName] or 0) + damageDone
end
end
end
damageClass.__add = function(tabela1, tabela2)
3 years ago
--tempo decorrido
5 months ago
local tempo =(tabela2.end_time or time()) - tabela2.start_time
tabela1.start_time = tabela1.start_time - tempo
3 years ago
--total de dano
tabela1.total = tabela1.total + tabela2.total
tabela1.totalabsorbed = tabela1.totalabsorbed + tabela2.totalabsorbed
3 years ago
--total de dano sem o pet
tabela1.total_without_pet = tabela1.total_without_pet + tabela2.total_without_pet
3 years ago
--total de dano que o cara levou
tabela1.damage_taken = tabela1.damage_taken + tabela2.damage_taken
3 years ago
--total do friendly fire causado
tabela1.friendlyfire_total = tabela1.friendlyfire_total + tabela2.friendlyfire_total
3 years ago
--soma o damage_from
for nome, _ in pairs(tabela2.damage_from) do
tabela1.damage_from [nome] = true
end
3 years ago
5 months ago
--pets(add unique pet names)
3 years ago
for _, petName in ipairs(tabela2.pets) do
local hasPet = false
for i = 1, #tabela1.pets do
if (tabela1.pets[i] == petName) then
hasPet = true
break
end
end
3 years ago
if (not hasPet) then
tabela1.pets [#tabela1.pets+1] = petName
end
end
3 years ago
--soma os containers de alvos
for target_name, amount in pairs(tabela2.targets) do
5 months ago
tabela1.targets [target_name] =(tabela1.targets [target_name] or 0) + amount
end
3 years ago
--soma o container de raid targets
for flag, amount in pairs(tabela2.raid_targets) do
5 months ago
tabela1.raid_targets [flag] =(tabela1.raid_targets [flag] or 0) + amount
end
3 years ago
--soma o container de habilidades
for spellid, habilidade in pairs(tabela2.spells._ActorTable) do
--pega a habilidade no primeiro ator
5 months ago
local habilidade_tabela1 = tabela1.spells:PegaHabilidade(spellid, true, "SPELL_DAMAGE", false)
3 years ago
--soma os alvos
for target_name, amount in pairs(habilidade.targets) do
5 months ago
habilidade_tabela1.targets[target_name] =(habilidade_tabela1.targets [target_name] or 0) + amount
end
3 years ago
--soma os extras
for spellId, amount in pairs(habilidade.extra) do
5 months ago
habilidade_tabela1.extra =(habilidade_tabela1.extra [spellId] or 0) + amount
end
3 years ago
--soma os valores da habilidade
for key, value in pairs(habilidade) do
if (type(value) == "number") then
if (key ~= "id" and key ~= "spellschool") then
3 years ago
if (not habilidade_tabela1 [key]) then
habilidade_tabela1 [key] = 0
end
3 years ago
if (key == "n_min" or key == "c_min") then
if (habilidade_tabela1 [key] > value) then
habilidade_tabela1 [key] = value
end
5 months ago
elseif(key == "n_max" or key == "c_max") then
if (habilidade_tabela1 [key] < value) then
habilidade_tabela1 [key] = value
end
else
habilidade_tabela1 [key] = habilidade_tabela1 [key] + value
end
3 years ago
end
elseif(key == "e_dmg" or key == "e_lvl") then
if (not habilidade_tabela1[key]) then
habilidade_tabela1[key] = {}
end
for empowermentLevel, empowermentValue in pairs(habilidade[key]) do
habilidade_tabela1[key][empowermentLevel] = habilidade_tabela1[key][empowermentValue] or 0 + empowermentValue
end
end
end
end
3 years ago
--soma o container de friendly fire
for target_name, ff_table in pairs(tabela2.friendlyfire) do
--pega o ator ff no ator principal
5 months ago
local friendlyFire_tabela1 = tabela1.friendlyfire [target_name] or tabela1:CreateFFTable(target_name)
3 years ago
--soma o total
friendlyFire_tabela1.total = friendlyFire_tabela1.total + ff_table.total
3 years ago
--soma as habilidades
for spellid, amount in pairs(ff_table.spells) do
5 months ago
friendlyFire_tabela1.spells [spellid] =(friendlyFire_tabela1.spells [spellid] or 0) + amount
end
end
return tabela1
end
damageClass.__sub = function(tabela1, tabela2)
3 years ago
--tempo decorrido
5 months ago
local tempo =(tabela2.end_time or time()) - tabela2.start_time
tabela1.start_time = tabela1.start_time + tempo
3 years ago
--total de dano
tabela1.total = tabela1.total - tabela2.total
tabela1.totalabsorbed = tabela1.totalabsorbed - tabela2.totalabsorbed
3 years ago
--total de dano sem o pet
tabela1.total_without_pet = tabela1.total_without_pet - tabela2.total_without_pet
3 years ago
--total de dano que o cara levou
tabela1.damage_taken = tabela1.damage_taken - tabela2.damage_taken
3 years ago
--total do friendly fire causado
tabela1.friendlyfire_total = tabela1.friendlyfire_total - tabela2.friendlyfire_total
3 years ago
--reduz os containers de alvos
for target_name, amount in pairs(tabela2.targets) do
local alvo_tabela1 = tabela1.targets [target_name]
if (alvo_tabela1) then
tabela1.targets [target_name] = tabela1.targets [target_name] - amount
end
end
3 years ago
--reduz o container de raid targets
for flag, amount in pairs(tabela2.raid_targets) do
if (tabela1.raid_targets [flag]) then
5 months ago
tabela1.raid_targets [flag] = math.max(tabela1.raid_targets [flag] - amount, 0)
end
end
3 years ago
--reduz o container de habilidades
for spellid, habilidade in pairs(tabela2.spells._ActorTable) do
--get the spell from the first actor
5 months ago
local habilidade_tabela1 = tabela1.spells:PegaHabilidade(spellid, true, "SPELL_DAMAGE", false)
3 years ago
--subtract targets
for target_name, amount in pairs(habilidade.targets) do
local alvo_tabela1 = habilidade_tabela1.targets [target_name]
if (alvo_tabela1) then
habilidade_tabela1.targets [target_name] = habilidade_tabela1.targets [target_name] - amount
end
end
3 years ago
--subtract extra table
for spellId, amount in pairs(habilidade.extra) do
local extra_tabela1 = habilidade_tabela1.extra [spellId]
if (extra_tabela1) then
habilidade_tabela1.extra [spellId] = habilidade_tabela1.extra [spellId] - amount
end
end
3 years ago
--subtrai os valores da habilidade
for key, value in pairs(habilidade) do
if (type(value) == "number") then
if (key ~= "id" and key ~= "spellschool") then
3 years ago
if (not habilidade_tabela1 [key]) then
habilidade_tabela1 [key] = 0
end
if (key == "n_min" or key == "c_min") then
if (habilidade_tabela1 [key] > value) then
habilidade_tabela1 [key] = value
end
5 months ago
elseif(key == "n_max" or key == "c_max") then
if (habilidade_tabela1 [key] < value) then
habilidade_tabela1 [key] = value
end
else
habilidade_tabela1 [key] = habilidade_tabela1 [key] - value
end
end
end
end
end
3 years ago
--reduz o container de friendly fire
for target_name, ff_table in pairs(tabela2.friendlyfire) do
--pega o ator ff no ator principal
local friendlyFire_tabela1 = tabela1.friendlyfire [target_name]
if (friendlyFire_tabela1) then
friendlyFire_tabela1.total = friendlyFire_tabela1.total - ff_table.total
3 years ago
for spellid, amount in pairs(ff_table.spells) do
if (friendlyFire_tabela1.spells [spellid]) then
friendlyFire_tabela1.spells [spellid] = friendlyFire_tabela1.spells [spellid] - amount
end
end
end
end
3 years ago
return tabela1
end
function Details.refresh:r_atributo_damage(actorObject)
detailsFramework:Mixin(actorObject, Details222.Mixins.ActorMixin)
detailsFramework:Mixin(actorObject, damageClassMixin)
setmetatable(actorObject, Details.atributo_damage)
actorObject.__index = Details.atributo_damage
--restore metatable for the spell container
Details.refresh:r_container_habilidades(actorObject.spells)
if (actorObject.augmentedSpellsContainer) then
Details.refresh:r_container_habilidades(actorObject.augmentedSpellsContainer)
end
end
5 months ago
function Details.clear:c_atributo_damage(este_jogador)
este_jogador.__index = nil
este_jogador.links = nil
este_jogador.minha_barra = nil
5 months ago
Details.clear:c_container_habilidades(este_jogador.spells)
end
--[[
3 years ago
--enemy damage done
i = 1
5 months ago
local enemy = combat(1, enemy_name)
if (enemy) then
3 years ago
local damage_done = 0
3 years ago
--get targets
for target_name, amount in pairs(enemy.targets) do
5 months ago
local player = combat(1, target_name)
if (player and player.grupo) then
local t = tooltip_temp_table [i]
if (not t) then
tooltip_temp_table [i] = {}
t = tooltip_temp_table [i]
end
t [1] = player
t [2] = amount
damage_done = damage_done + amount
i = i + 1
end
end
3 years ago
--first clenup
for o = i, #tooltip_temp_table do
local t = tooltip_temp_table [o]
t[2] = 0
t[1] = 0
end
5 months ago
table.sort(tooltip_temp_table, Details.Sort2)
3 years ago
--enemy damage taken
5 months ago
Details:AddTooltipSpellHeaderText(Loc ["STRING_ATTRIBUTE_DAMAGE"], headerColor, i-1, true)
GameCooltip:AddIcon([=[Interface\Buttons\UI-MicroStream-Green]=], 2, 1, 14, 14, 0.1875, 0.8125, 0.15625, 0.78125)
GameCooltip:AddIcon([=[Interface\AddOns\Details\images\key_shift]=], 2, 2, Details.tooltip_key_size_width, Details.tooltip_key_size_height, 0, 1, 0, 0.640625, Details.tooltip_key_overlay2)
GameCooltip:AddStatusBar(100, 2, 0.7, g, b, 1)
3 years ago
--build the tooltip
for o = 1, i-1 do
local player = tooltip_temp_table [o][1]
local total = tooltip_temp_table [o][2]
local player_name = player:name()
3 years ago
if (player_name:find(Details.playername)) then
5 months ago
GameCooltip:AddLine(player_name .. ": ", FormatTooltipNumber(_, total) .. "(" .. _cstr("%.1f",(total / damage_done) * 100) .. "%)", 2, "yellow")
else
5 months ago
GameCooltip:AddLine(player_name .. ": ", FormatTooltipNumber(_, total) .."(" .. _cstr("%.1f",(total / damage_done) * 100) .. "%)", 2)
end
3 years ago
local classe = player:class()
if (not classe) then
classe = "UNKNOW"
end
if (classe == "UNKNOW") then
5 months ago
GameCooltip:AddIcon("Interface\\LFGFRAME\\LFGROLE_BW", 2, nil, 14, 14, .25, .5, 0, 1)
else
5 months ago
GameCooltip:AddIcon(instancia.row_info.icon_file, 2, nil, 14, 14, _unpack(Details.class_coords [classe]))
end
5 months ago
Details:AddTooltipBackgroundStatusbar(2)
end
3 years ago
end
3 years ago
--clean up
for o = 1, #tooltip_temp_table do
local t = tooltip_temp_table [o]
t[2] = 0
t[1] = 0
end
--]]