General Fixes

This commit is contained in:
Tercio Jose
2023-04-30 23:23:56 -03:00
parent 6be5ab14f4
commit 11a6c48ddd
24 changed files with 420 additions and 696 deletions
-2
View File
@@ -376,8 +376,6 @@ spell.counter = how many hits this spell made.
spell.id = spellid
spell.successful_casted = how many times this spell has been casted successfully (only for enemies).
- players has its own spell cast counter inside Misc Container with the member "spell_cast".
- the reason os this is spell_cast holds all spells regardless of its attribute (can hold healing/damage/energy/misc).
spell.n_min = minimal damage made on a normal hit.
spell.n_max = max damage made on a normal hit.
-2
View File
@@ -379,8 +379,6 @@ spell.counter = how many hits this spell made.
spell.id = spellid
spell.successful_casted = how many times this spell has been casted successfully (only for enemies).
- players has its own spell cast counter inside Misc Container with the member "spell_cast".
- the reason os this is spell_cast holds all spells regardless of its attribute (can hold healing/damage/energy/misc).
spell.n_min = minimal damage made on a normal hit.
spell.n_max = max damage made on a normal hit.
+5 -2
View File
@@ -305,6 +305,7 @@
---@field UnregisterEvent fun(self: detailseventlistener, event: "DETAILS_INSTANCE_OPEN"|"DETAILS_INSTANCE_CLOSE"|"DETAILS_INSTANCE_SIZECHANGED"|"DETAILS_INSTANCE_STARTRESIZE"|"DETAILS_INSTANCE_ENDRESIZE"|"DETAILS_INSTANCE_STARTSTRETCH"|"DETAILS_INSTANCE_ENDSTRETCH"|"DETAILS_INSTANCE_CHANGESEGMENT"|"DETAILS_INSTANCE_CHANGEATTRIBUTE"|"DETAILS_INSTANCE_CHANGEMODE"|"DETAILS_INSTANCE_NEWROW"|"DETAILS_OPTIONS_MODIFIED"|"DETAILS_DATA_RESET"|"DETAILS_DATA_SEGMENTREMOVED"|"COMBAT_ENCOUNTER_START"|"COMBAT_ENCOUNTER_END"|"COMBAT_PLAYER_ENTER"|"COMBAT_PLAYER_LEAVE"|"COMBAT_PLAYER_TIMESTARTED"|"COMBAT_BOSS_WIPE"|"COMBAT_BOSS_DEFEATED"|"COMBAT_BOSS_FOUND"|"COMBAT_INVALID"|"COMBAT_PREPOTION_UPDATED"|"COMBAT_CHARTTABLES_CREATING"|"COMBAT_CHARTTABLES_CREATED"|"COMBAT_ENCOUNTER_PHASE_CHANGED"|"COMBAT_ARENA_START"|"COMBAT_ARENA_END"|"COMBAT_MYTHICDUNGEON_START"|"COMBAT_MYTHICDUNGEON_END"|"GROUP_ONENTER"|"GROUP_ONLEAVE"|"ZONE_TYPE_CHANGED"|"REALM_CHANNEL_ENTER"|"REALM_CHANNEL_LEAVE"|"COMM_EVENT_RECEIVED"|"COMM_EVENT_SENT"|"UNIT_SPEC"|"UNIT_TALENTS"|"PLAYER_TARGET"|"DETAILS_PROFILE_APPLYED")
---@class combat : table
---@field amountCasts {[string]: table<string, number>}
---@field end_time number
---@field start_time number
---@field is_mythic_dungeon_trash boolean
@@ -318,8 +319,11 @@
---@field SetEndTime fun(combat: combat, time: number)
---@field CopyDeathsFrom fun(combat1: combat, combat2: combat, bMythicPlus: boolean) copy the deaths from combat2 to combat1, use true on bMythicPlus if the combat is from a mythic plus run
---@field GetContainer fun(combat: combat, containerType: number) : actorcontainer get an actor container, containerType can be 1 for damage, 2 heal, 3 energy, 4 utility
---@field GetSpellCastAmount fun(combat: combat, actorName: string, spellId: number) : number get the amount of times a spell was casted
---@field GetSpellCastAmount fun(combat: combat, actorName: string, spellName: string) : number get the amount of times a spell was casted
---@field RemoveActorFromSpellCastTable fun(combat: combat, actorName: string)
---@field GetSpellCastTable fun(combat: combat, actorName: string|nil) : table
---@field GetSpellUptime fun(combat: combat, actorName: string, spellId: number, auraType: string|nil) : number get the uptime of a buff or debuff
---@field GetActor fun(combat: combat, attribute: number, playerName: string) : actor
---@class actorcontainer : table
---@field _ActorTable table
@@ -396,7 +400,6 @@
---@field last_event unixtime
---@field total_without_pet number
---@field total number
---@field spell_cast table<number, number>
---@field pets table<number, string>
---@field targets targettable
+1 -1
View File
@@ -16,7 +16,7 @@
_detalhes.dont_open_news = true
_detalhes.game_version = version
_detalhes.userversion = version .. " " .. _detalhes.build_counter
_detalhes.realversion = 149 --core version, this is used to check API version for scripts and plugins (see alias below)
_detalhes.realversion = 150 --core version, this is used to check API version for scripts and plugins (see alias below)
_detalhes.APIVersion = _detalhes.realversion --core version
_detalhes.version = _detalhes.userversion .. " (core " .. _detalhes.realversion .. ")" --simple stirng to show to players
+23 -13
View File
@@ -181,25 +181,33 @@
end
---return the amount of casts of a spells from an actor
---@param self combat
---@param actorName string
---@param spellId number
---@param spellName string
---@return number
function combate:GetSpellCastAmount(actorName, spellId)
---@type actorcontainer
local utilityContainer = self:GetContainer(DETAILS_ATTRIBUTE_MISC)
---@type actor
local actorObject = utilityContainer:GetActor(actorName)
if (actorObject) then
if (actorObject.spell_cast) then
return actorObject.spell_cast[spellId] or 0
else
return 0
end
function combate:GetSpellCastAmount(actorName, spellName)
return self.amountCasts[actorName] and self.amountCasts[actorName][spellName] or 0
end
---return the cast amount table
---@param self combat
---@param actorName string|nil
---@return table
function combate:GetSpellCastTable(actorName)
if (actorName) then
return self.amountCasts[actorName] or {}
else
return 0
return self.amountCasts
end
end
---delete an actor from the spell casts amount
---@param self combat
---@param actorName string
function combate:RemoveActorFromSpellCastTable(actorName)
self.amountCasts[actorName] = nil
end
---return the uptime of a buff from an actor
---@param actorName string
---@param spellId number
@@ -548,6 +556,8 @@
setmetatable(esta_tabela, combate)
esta_tabela.amountCasts = {}
_detalhes.combat_counter = _detalhes.combat_counter + 1
esta_tabela.combat_counter = _detalhes.combat_counter
+8 -16
View File
@@ -1748,7 +1748,7 @@
desc = Loc ["STRING_CUSTOM_MYSPELLS_DESC"],
source = false,
target = false,
script_version = 9,
script_version = 10,
script = [[
--get the parameters passed
local combat, instance_container, instance = ...
@@ -1824,7 +1824,7 @@
local spellschool, schooltext = spell.spellschool, ""
if (spellschool) then
local t = _detalhes.spells_school [spellschool]
local t = Details.spells_school [spellschool]
if (t and t.name) then
schooltext = t.formated
end
@@ -1834,28 +1834,20 @@
local combat_time = instance.showing:GetCombatTime()
local debuff_uptime_total, cast_string = "", ""
local misc_actor = instance.showing (4, _detalhes.playername)
local misc_actor = instance.showing (4, Details.playername)
if (misc_actor) then
local debuff_uptime = misc_actor.debuff_uptime_spells and misc_actor.debuff_uptime_spells._ActorTable [spell.id] and misc_actor.debuff_uptime_spells._ActorTable [spell.id].uptime
if (debuff_uptime) then
debuff_uptime_total = floor(debuff_uptime / instance.showing:GetCombatTime() * 100)
end
local spell_cast = misc_actor.spell_cast and misc_actor.spell_cast [spell.id]
local spellName = GetSpellInfo(spell.id)
local amountOfCasts = combat:GetSpellCastAmount(Details.playername, spellName)
if (not spell_cast and misc_actor.spell_cast) then
local spellname = GetSpellInfo(spell.id)
for casted_spellid, amount in pairs(misc_actor.spell_cast) do
local casted_spellname = GetSpellInfo(casted_spellid)
if (casted_spellname == spellname) then
spell_cast = amount .. " (|cFFFFFF00?|r)"
end
end
if (amountOfCasts == 0) then
amountOfCasts = "(|cFFFFFF00?|r)"
end
if (not spell_cast) then
spell_cast = "(|cFFFFFF00?|r)"
end
cast_string = cast_string .. spell_cast
cast_string = cast_string .. amountOfCasts
end
--Cooltip code
+4 -20
View File
@@ -5272,33 +5272,17 @@ function atributo_damage:MontaDetalhesDamageDone (spellId, spellLine, instance)
local misc_actor = info.instancia.showing (4, self:name())
if (misc_actor) then
local uptime_spellid = spellTable.id
--if (uptime_spellid == 233490) then
-- uptime_spellid = 233496
-- uptime_spellid = 233490
--end
local debuff_uptime = misc_actor.debuff_uptime_spells and misc_actor.debuff_uptime_spells._ActorTable [uptime_spellid] and misc_actor.debuff_uptime_spells._ActorTable [uptime_spellid].uptime
if (debuff_uptime) then
hits_string = hits_string .. " |cFFDDDD44(" .. _math_floor(debuff_uptime / info.instancia.showing:GetCombatTime() * 100) .. "% uptime)|r"
end
local spell_cast = misc_actor.spell_cast and misc_actor.spell_cast [spellId]
if (not spell_cast and misc_actor.spell_cast) then
local spellname = GetSpellInfo(spellId)
for casted_spellid, amount in pairs(misc_actor.spell_cast) do
local casted_spellname = GetSpellInfo(casted_spellid)
if (casted_spellname == spellname) then
spell_cast = amount .. " (|cFFFFFF00?|r)"
end
end
local amountOfCasts = info.instancia.showing:GetSpellCastAmount(self:Name(), spellName)
if (amountOfCasts == 0) then
amountOfCasts = "(|cFFFFFF00?|r)"
end
if (not spell_cast) then
spell_cast = "(|cFFFFFF00?|r)"
end
cast_string = cast_string .. spell_cast
cast_string = cast_string .. amountOfCasts
end
if (spellTable.e_total) then
+5 -15
View File
@@ -2403,7 +2403,7 @@ function atributo_heal:MontaDetalhesHealingDone (spellid, barra)
end
--icone direito superior
local _, _, icone = _GetSpellInfo(spellid)
local spellName, _, icone = _GetSpellInfo(spellid)
info.spell_icone:SetTexture(icone)
local total = self.total
@@ -2457,21 +2457,11 @@ function atributo_heal:MontaDetalhesHealingDone (spellid, barra)
hits_string = hits_string .. " |cFFDDDD44(" .. _math_floor(buff_uptime / info.instancia.showing:GetCombatTime() * 100) .. "% uptime)|r"
end
local spell_cast = misc_actor.spell_cast and misc_actor.spell_cast [spellid]
if (not spell_cast and misc_actor.spell_cast) then
local spellname = GetSpellInfo(spellid)
for casted_spellid, amount in pairs(misc_actor.spell_cast) do
local casted_spellname = GetSpellInfo(casted_spellid)
if (casted_spellname == spellname) then
spell_cast = amount .. " (|cFFFFFF00?|r)"
end
end
local amountOfCasts = info.instancia.showing:GetSpellCastAmount(self:Name(), spellName)
if (not amountOfCasts) then
amountOfCasts = "(|cFFFFFF00?|r)"
end
if (not spell_cast) then
spell_cast = "(|cFFFFFF00?|r)"
end
cast_string = cast_string .. spell_cast
cast_string = cast_string .. amountOfCasts
end
gump:SetaDetalheInfoTexto( index, 100,
+3 -65
View File
@@ -135,30 +135,9 @@ end
---attempt to get the amount of casts of a spell
---@param combat table the combat object
---@param actorName string name of the actor
---@param spellId number spell id
function Details:GetSpellCastAmount(combat, actorName, spellId) --[[exported]]
local actorUtilityObject = combat:GetActor(4, actorName)
if (actorUtilityObject) then
local castAmountTable = actorUtilityObject.spell_cast
if (castAmountTable) then
local castAmount = castAmountTable[spellId]
if (castAmount) then
return castAmount
elseif (not castAmount) then
--if the amount of casts is not found, attempt to find a spell with the same name and get the amount of casts of that spell instead
local spellName = GetSpellInfo(spellId)
for thisSpellId, thisCastAmount in pairs(castAmountTable) do
local thisSpellName = GetSpellInfo(thisSpellId)
if (thisSpellName == spellName and thisCastAmount and thisCastAmount > 0) then
return thisCastAmount
end
end
end
end
end
return 0
---@param spellName string
function Details:GetSpellCastAmount(combat, actorName, spellName) --[[exported]]
return combat:GetSpellCastAmount(actorName, spellName)
end
function atributo_misc:NovaTabela(serial, nome, link)
@@ -2414,16 +2393,6 @@ function atributo_misc:r_onlyrefresh_shadow (actor)
_detalhes.refresh:r_atributo_misc (actor, shadow)
--spell cast
if (actor.spell_cast) then
if (not shadow.spell_cast) then
shadow.spell_cast = {}
end
for spellid, _ in pairs(actor.spell_cast) do
shadow.spell_cast [spellid] = shadow.spell_cast [spellid] or 0
end
end
--cc done
if (actor.cc_done) then
refresh_alvos (shadow.cc_done_targets, actor.cc_done_targets)
@@ -2551,16 +2520,6 @@ function atributo_misc:r_connect_shadow (actor, no_refresh, combat_object)
DetailsFramework.table.addunique (shadow.pets, petName)
end
if (actor.spell_cast) then
if (not shadow.spell_cast) then
shadow.spell_cast = {}
end
for spellid, amount in pairs(actor.spell_cast) do
shadow.spell_cast [spellid] = (shadow.spell_cast [spellid] or 0) + amount
end
end
if (actor.cc_done) then
if (not shadow.cc_done_targets) then
shadow.cc_done = _detalhes:GetOrderNumber()
@@ -2761,13 +2720,6 @@ function _detalhes.refresh:r_atributo_misc(thisActor, shadow)
thisActor.__index = _detalhes.atributo_misc
--refresh spell cast
if (thisActor.spell_cast) then
if (shadow and not shadow.spell_cast) then
shadow.spell_cast = {}
end
end
--refresh cc done
if (thisActor.cc_done) then
if (shadow and not shadow.cc_done_targets) then
@@ -2903,13 +2855,6 @@ function _detalhes.clear:c_atributo_misc (este_jogador)
end
atributo_misc.__add = function(tabela1, tabela2)
if (tabela2.spell_cast) then
for spellid, amount in pairs(tabela2.spell_cast) do
tabela1.spell_cast [spellid] = (tabela1.spell_cast [spellid] or 0) + amount
end
end
if (tabela2.cc_done) then
tabela1.cc_done = tabela1.cc_done + tabela2.cc_done
@@ -3169,13 +3114,6 @@ local subtrair_keys = function(habilidade, habilidade_tabela1)
end
atributo_misc.__sub = function(tabela1, tabela2)
if (tabela2.spell_cast) then
for spellid, amount in pairs(tabela2.spell_cast) do
tabela1.spell_cast [spellid] = (tabela1.spell_cast [spellid] or 0) - amount
end
end
if (tabela2.cc_done) then
tabela1.cc_done = tabela1.cc_done - tabela2.cc_done
+10 -3
View File
@@ -840,11 +840,12 @@
---@type number
local _tempo = _time()
---@type number
for containerId = 1, 4 do
---@type actorcontainer
local actorContainer = combatObject:GetContainer(containerId)
---@type table<number, actor>
local actorList = actorContainer:GetActorTable()
local beforeCleanupAmountOfActors = #actorList
for actorIndex = #actorList, 1, -1 do
---@type actor
@@ -879,6 +880,9 @@
end
if (canCollect) then
local actorName = actorObject:Name()
combatObject:RemoveActorFromSpellCastTable(actorName)
if (not actorObject.owner) then --not a pet
actorObject:subtract_total(combatObject)
end
@@ -917,14 +921,17 @@
---@type table
local segmentsList = {}
---@type combat
local currentCombat = Details:GetCurrentCombat()
for _, combatObject in ipairs(allSegments) do
if (combatObject ~= Details.tabela_vigente) then
if (combatObject ~= currentCombat) then
segmentsList[#segmentsList+1] = combatObject
end
end
--add the current segment at the end of the list
segmentsList[#segmentsList+1] = Details.tabela_vigente
segmentsList[#segmentsList+1] = currentCombat
--collect the garbage
for i, combatObject in ipairs(segmentsList) do
+57 -60
View File
@@ -44,7 +44,7 @@
--check if the cooldown is type 2 or 3 or 4 and add to the defensive_cooldowns table
for spellId, spellTable in pairs(LIB_OPEN_RAID_COOLDOWNS_INFO) do
if (spellTable.type == 2 or spellTable.type == 3 or spellTable.type == 4) then
defensive_cooldowns[spellId] = true
defensive_cooldowns[spellId] = spellTable
end
end
end
@@ -3652,105 +3652,102 @@ local SPELL_POWER_PAIN = SPELL_POWER_PAIN or (PowerEnum and PowerEnum.Pain) or 1
end
end
--search key: ~spellcast ~castspell ~cast
function parser:spellcast (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname, spelltype)
------------------------------------------------------------------------------------------------
--early checks and fixes
---search key: ~spellcast ~castspell ~cast
---comment: this function is called when a spell is casted
---@param token string
---@param time number
---@param sourceSerial string
---@param sourceName string
---@param sourceFlags number
---@param targetSerial string
---@param targetName string
---@param targetFlags number
---@param targetRaidFlags number
---@param spellId number
---@param spellName string
---@param spellType number
function parser:spellcast(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetRaidFlags, spellId, spellName, spellType)
--only capture if is in combat
if (not _in_combat) then
return
end
if (not who_name) then
who_name = "[*] " .. spellname
if (not sourceName) then
sourceName = "[*] " .. spellName
end
------------------------------------------------------------------------------------------------
--get actors
--main actor
local este_jogador, meu_dono = misc_cache [who_serial] or misc_cache_pets [who_serial] or misc_cache [who_name], misc_cache_petsOwners [who_serial]
--local este_jogador = misc_cache [who_name]
if (not este_jogador) then
este_jogador, meu_dono, who_name = _current_misc_container:PegarCombatente (who_serial, who_name, who_flags, true)
if (meu_dono) then -- um pet
if (who_serial ~= "") then
misc_cache_pets [who_serial] = este_jogador
misc_cache_petsOwners [who_serial] = meu_dono
local sourceActor, ownerActor = misc_cache[sourceSerial] or misc_cache_pets[sourceSerial] or misc_cache[sourceName], misc_cache_petsOwners[sourceSerial]
if (not sourceActor) then
sourceActor, ownerActor, sourceName = _current_misc_container:PegarCombatente (sourceSerial, sourceName, sourceFlags, true)
if (ownerActor) then
if (sourceSerial ~= "") then
misc_cache_pets [sourceSerial] = sourceActor
misc_cache_petsOwners [sourceSerial] = ownerActor
end
--conferir se o dono j esta no cache
if (not misc_cache [meu_dono.serial] and meu_dono.serial ~= "") then
misc_cache [meu_dono.serial] = meu_dono
if (not misc_cache[ownerActor.serial] and ownerActor.serial ~= "") then
misc_cache[ownerActor.serial] = ownerActor
end
else
if (who_flags) then
misc_cache [who_name] = este_jogador
if (sourceFlags) then
misc_cache[sourceName] = sourceActor
end
end
end
------------------------------------------------------------------------------------------------
--build containers on the fly
local spell_cast = este_jogador.spell_cast
if (not spell_cast) then
este_jogador.spell_cast = {[spellid] = 1}
else
spell_cast [spellid] = (spell_cast [spellid] or 0) + 1
--amount of casts by actors ~casts
local castsByPlayer = _current_combat.amountCasts[sourceName]
if (not castsByPlayer) then
castsByPlayer = {}
_current_combat.amountCasts[sourceName] = castsByPlayer
end
local amountOfCasts = _current_combat.amountCasts[sourceName][spellName] or 0
amountOfCasts = amountOfCasts + 1
_current_combat.amountCasts[sourceName][spellName] = amountOfCasts
------------------------------------------------------------------------------------------------
--record cooldowns cast which can't track with buff applyed.
--foi um jogador que castou
if (raid_members_cache [who_serial]) then
--check if is a cooldown :D
if (defensive_cooldowns [spellid]) then
--usou cooldown
if (not alvo_name) then
if (DetailsFramework.CooldownsDeffense [spellid]) then
alvo_name = who_name
elseif (DetailsFramework.CooldownsRaid [spellid]) then
alvo_name = Loc ["STRING_RAID_WIDE"]
--record cooldowns cast which can't track with buff applyed
--a player is the caster
if (raid_members_cache[sourceSerial]) then
--check if is a cooldown
local cooldownInfo = defensive_cooldowns[spellId]
if (cooldownInfo) then
if (not targetName) then
if (cooldownInfo.type == 2 or cooldownInfo.type == 3) then
targetName = sourceName
elseif (cooldownInfo.type == 4) then
targetName = Loc ["STRING_RAID_WIDE"]
else
alvo_name = "--x--x--"
targetName = "--x--x--"
end
end
return parser:add_defensive_cooldown (token, time, who_serial, who_name, who_flags, alvo_serial, alvo_name, alvo_flags, alvo_flags2, spellid, spellname)
return parser:add_defensive_cooldown(token, time, sourceSerial, sourceName, sourceFlags, targetSerial, targetName, targetFlags, targetRaidFlags, spellId, spellName)
end
else
--enemy successful casts (not interrupted)
if (bitBand(who_flags, 0x00000040) ~= 0 and who_name) then --byte 2 = 4 (enemy)
if (bitBand(sourceFlags, 0x00000040) ~= 0 and sourceName) then --byte 2 = 4 (enemy)
--damager
local este_jogador = damage_cache [who_serial]
local este_jogador = damage_cache [sourceSerial]
if (not este_jogador) then
este_jogador = _current_damage_container:PegarCombatente (who_serial, who_name, who_flags, true)
este_jogador = _current_damage_container:PegarCombatente (sourceSerial, sourceName, sourceFlags, true)
end
if (este_jogador) then
--actor spells table
local spell = este_jogador.spells._ActorTable [spellid] --line where the actor was nil
local spell = este_jogador.spells._ActorTable [spellId] --line where the actor was nil
if (not spell) then
spell = este_jogador.spells:PegaHabilidade (spellid, true, token)
spell = este_jogador.spells:PegaHabilidade (spellId, true, token)
end
spell.successful_casted = spell.successful_casted + 1
end
--add the spellId in the enemy_cast_cache table to store the time the enemy successfully cast a spell
--check if the spell is in the table
local enemyName = who_name
local enemyName = sourceName
if (not enemy_cast_cache[time]) then
enemy_cast_cache[time] = {enemyName, spellid, 1}
enemy_cast_cache[time] = {enemyName, spellId, 1}
else
enemy_cast_cache[time][3] = enemy_cast_cache[time][3] + 1
end
+19 -53
View File
@@ -960,6 +960,8 @@ local on_enter = function(self)
frame3.tooltip:SetPoint("bottomleft", bar3[2], "topleft", -18, 5)
local spellid = bar1[3][4]
--these are player names
local player1 = frame1.player
local player2 = frame2.player
local player3 = frame3.player
@@ -968,9 +970,12 @@ local on_enter = function(self)
local average = bar1[3][2]
local critical = bar1[3][3]
local player1_misc = info.instancia.showing (4, player1)
local player2_misc = info.instancia.showing (4, player2)
local player3_misc = info.instancia.showing (4, player3)
---@type combat
local combatObject = info.instancia.showing
local player1_misc = combatObject(4, player1)
local player2_misc = combatObject(4, player2)
local player3_misc = combatObject(4, player3)
local player1_uptime
local player1_casts
@@ -1000,7 +1005,6 @@ local on_enter = function(self)
frame1.tooltip.crit_label2:SetText(COMPARE_FIRSTPLAYER_PERCENT)
if (player1_misc) then
--uptime
local spell = player1_misc.debuff_uptime_spells and player1_misc.debuff_uptime_spells._ActorTable and player1_misc.debuff_uptime_spells._ActorTable [spellid]
if (spell) then
@@ -1018,38 +1022,20 @@ local on_enter = function(self)
end
--total casts
local amt_casts = player1_misc.spell_cast and player1_misc.spell_cast [spellid]
if (amt_casts) then
frame1.tooltip.casts_label3:SetText(amt_casts)
local amountOfCasts = combatObject:GetSpellCastAmount(player1, GetSpellInfo(spellid))
if (amountOfCasts) then
frame1.tooltip.casts_label3:SetText(amountOfCasts)
frame1.tooltip.casts_label2:SetText(COMPARE_FIRSTPLAYER_PERCENT)
Details.gump:SetFontColor(frame1.tooltip.casts_label3, "white")
player1_casts = amt_casts
player1_casts = amountOfCasts
else
local spellname = GetSpellInfo(spellid)
local extra_search_found
for casted_spellid, amount in pairs(player1_misc.spell_cast or {}) do
local casted_spellname = GetSpellInfo(casted_spellid)
if (casted_spellname == spellname) then
frame1.tooltip.casts_label3:SetText(amount)
frame1.tooltip.casts_label2:SetText(COMPARE_FIRSTPLAYER_PERCENT)
frame1.tooltip.casts_label3:SetText("?")
frame1.tooltip.casts_label2:SetText("?")
Details.gump:SetFontColor(frame1.tooltip.casts_label3, "white")
player1_casts = amount
extra_search_found = true
break
end
end
if (not extra_search_found) then
frame1.tooltip.casts_label3:SetText("?")
frame1.tooltip.casts_label2:SetText("?")
Details.gump:SetFontColor(frame1.tooltip.casts_label3, "silver")
Details.gump:SetFontColor(frame1.tooltip.casts_label2, "silver")
end
Details.gump:SetFontColor(frame1.tooltip.casts_label3, "silver")
Details.gump:SetFontColor(frame1.tooltip.casts_label2, "silver")
end
else
frame1.tooltip.uptime_label3:SetText(COMPARE_UNKNOWNDATA)
@@ -1190,19 +1176,9 @@ local on_enter = function(self)
end
--total casts
local amt_casts = player2_misc.spell_cast and player2_misc.spell_cast [spellid]
if (not amt_casts) then
local spellname = GetSpellInfo(spellid)
for casted_spellid, amount in pairs(player2_misc.spell_cast or {}) do
local casted_spellname = GetSpellInfo(casted_spellid)
if (casted_spellname == spellname) then
amt_casts = amount
break
end
end
end
if (amt_casts) then
local amt_casts = combatObject:GetSpellCastAmount(player2_misc:Name(), GetSpellInfo(spellid))
if (amt_casts) then
if (not player1_casts) then
frame2.tooltip.casts_label3:SetText(amt_casts)
frame2.tooltip.casts_label2:SetText(COMPARE_UNKNOWNDATA)
@@ -1356,17 +1332,7 @@ local on_enter = function(self)
end
--total casts
local amt_casts = player3_misc.spell_cast and player3_misc.spell_cast [spellid]
if (not amt_casts) then
local spellname = GetSpellInfo(spellid)
for casted_spellid, amount in pairs(player3_misc.spell_cast or {}) do
local casted_spellname = GetSpellInfo(casted_spellid)
if (casted_spellname == spellname) then
amt_casts = amount
break
end
end
end
local amt_casts = combatObject:GetSpellCastAmount(player3_misc:Name(), GetSpellInfo(spellid))
if (amt_casts) then
+12 -142
View File
@@ -14,8 +14,6 @@ local GameTooltip = GameTooltip
local IsShiftKeyDown = IsShiftKeyDown
local DF = DetailsFramework
---@type breakdownspelltab
local spellsTab = {}
@@ -1397,9 +1395,9 @@ end
---@param bkSpellData spelltableadv
---@param bkSpellStableIndex number
---@param totalValue number
---@param maxValue number
---@param topValue number
---@param bIsMainLine boolean if true this is the line which has all the values of the spell merged
local updateSpellBar = function(spellBar, index, actorName, combatObject, scrollFrame, headerTable, bkSpellData, bkSpellStableIndex, totalValue, maxValue, bIsMainLine)
local updateSpellBar = function(spellBar, index, actorName, combatObject, scrollFrame, headerTable, bkSpellData, bkSpellStableIndex, totalValue, topValue, bIsMainLine)
--scrollFrame is defined as a table which is false, scrollFrame is a frame
local textIndex = 1
@@ -1433,8 +1431,11 @@ local updateSpellBar = function(spellBar, index, actorName, combatObject, scroll
---@cast spellTable spelltable
spellBar.spellTable = spellTable
---@type string, number, string
local spellName, _, spellIcon = Details.GetSpellInfo(spellId)
---@type number
local amtCasts = combatObject:GetSpellCastAmount(actorName, spellId)
local amtCasts = combatObject:GetSpellCastAmount(actorName, spellName)
spellBar.amountCasts = amtCasts
---@type number
@@ -1443,9 +1444,6 @@ local updateSpellBar = function(spellBar, index, actorName, combatObject, scroll
---@type number
local combatTime = combatObject:GetCombatTime()
---@type string, number, string
local spellName, _, spellIcon = Details.GetSpellInfo(spellId)
if (petName ~= "") then
spellName = spellName .. " (" .. petName .. ")"
end
@@ -1456,8 +1454,8 @@ local updateSpellBar = function(spellBar, index, actorName, combatObject, scroll
spellBar.statusBar.backgroundTexture:SetAlpha(Details.breakdown_spell_tab.spellbar_background_alpha)
--statusbar size by percent
if (maxValue > 0) then
spellBar.statusBar:SetValue(bkSpellData.statusBarValue / maxValue * 100)
if (topValue > 0) then
spellBar.statusBar:SetValue(bkSpellData.statusBarValue / topValue * 100)
else
spellBar.statusBar:SetValue(0)
end
@@ -1673,7 +1671,7 @@ local refreshFunc = function(scrollFrame, scrollData, offset, totalLines) --~ref
end
end
--then it adds the lines for each spell merged, but it cannot use the bkSpellData, it needs the spellTable
--then it adds the lines for each spell merged, but it cannot use the bkSpellData, it needs the spellTable, it's kinda using bkSpellData, need to debug
if (bkSpellData.bIsExpanded and spellTablesAmount > 1) then
---@type number spellTableIndex is the same counter as bkSpellStableIndex
for spellTableIndex = 1, spellTablesAmount do
@@ -1686,6 +1684,9 @@ local refreshFunc = function(scrollFrame, scrollData, offset, totalLines) --~ref
---@type string
local nameToUse = petName ~= "" and petName or actorName
local bIsMainLine = false
updateSpellBar(spellBar, index, nameToUse, combatObject, scrollFrame, headerTable, bkSpellData, spellTableIndex, totalValue, maxValue, bIsMainLine)
mainSpellBar.ExpandedChildren[#mainSpellBar.ExpandedChildren + 1] = spellBar
end
@@ -1891,137 +1892,6 @@ local onEnterSpellTarget = function(targetFrame)
cooltip:SetOwner(targetFrame)
cooltip:Show()
if true then return end
do
if (spellId and type(spellId) == "number") then
---@type actor
local actorObject = lineBar.other_actor or breakdownWindow.jogador
local spellTable = actorObject.spells and actorObject.spells:GetSpell(spellId)
if (spellTable) then
local spellsSortedResult = {}
local targetContainer
local total = 0
if (spellTable.isReflection) then
targetContainer = spellTable.extra
else
local attribute, subAttribute = breakdownWindow.instancia:GetDisplay()
if (attribute == 1 or attribute == 3) then
targetContainer = spellTable.targets
else
if (subAttribute == 3) then --overheal
targetContainer = spellTable.targets_overheal
elseif (subAttribute == 6) then --absorbs
targetContainer = spellTable.targets_absorbs
else
targetContainer = spellTable.targets
end
end
end
--add and sort
for targetName, amount in pairs(targetContainer) do
if (amount > 0) then
spellsSortedResult[#spellsSortedResult+1] = {targetName, amount}
total = total + amount
end
end
table.sort(spellsSortedResult, Details.Sort2)
local spellName, _, spellIcon = _GetSpellInfo(spellId)
GameTooltip:SetOwner(targetFrame, "ANCHOR_TOPRIGHT")
GameTooltip:AddLine(lineBar.index .. ". " .. spellName)
GameTooltip:AddLine(Loc ["STRING_TARGETS"] .. ":")
GameTooltip:AddLine(" ")
--get time type
local timeElapsed
if (Details.time_type == 1 or not actorObject.grupo) then
timeElapsed = actorObject:Tempo()
elseif (Details.time_type == 2) then
timeElapsed = breakdownWindow.instancia.showing:GetCombatTime()
end
local abbreviationFunction = Details.ToKFunctions[Details.ps_abbreviation]
if (spellTable.isReflection) then
Details:FormatCooltipForSpells()
GameCooltip:SetOwner(targetFrame, "bottomright", "top", 4, -2)
Details:AddTooltipSpellHeaderText("Spells Reflected", {1, 0.9, 0.0, 1}, 1, select(3, _GetSpellInfo(spellTable.id)), 0.1, 0.9, 0.1, 0.9) --localize-me
Details:AddTooltipHeaderStatusbar(1, 1, 1, 0.4)
GameCooltip:AddIcon(select(3, _GetSpellInfo(spellTable.id)), 1, 1, 16, 16, .1, .9, .1, .9)
Details:AddTooltipHeaderStatusbar(1, 1, 1, 0.5)
local topAmount = spellsSortedResult[1] and spellsSortedResult[1][2]
for index, targetTable in ipairs(spellsSortedResult) do
local targetName = targetTable[1]
local amount = targetTable[2]
GameCooltip:AddLine(spellName, abbreviationFunction(_, amount) .. " (" .. math.floor(amount / topAmount * 100) .. "%)")
GameCooltip:AddIcon(spellIcon, 1, 1, 16, 16, .1, .9, .1, .9)
Details:AddTooltipBackgroundStatusbar(false, amount / topAmount * 100)
end
GameCooltip:Show()
targetFrame.texture:SetAlpha(1)
targetFrame:SetAlpha(1)
lineBar:GetScript("OnEnter")(lineBar)
return
else
for index, targetTable in ipairs(spellsSortedResult) do
local targetName = targetTable[1]
local amount = targetTable[2]
local class = Details:GetClass(targetName)
if (class and Details.class_coords[class]) then
local cords = Details.class_coords[class]
if (breakdownWindow.target_persecond) then
GameTooltip:AddDoubleLine(index .. ". |TInterface\\AddOns\\Details\\images\\classes_small_alpha:14:14:0:0:128:128:"..cords[1]*128 ..":"..cords[2]*128 ..":"..cords[3]*128 ..":"..cords[4]*128 .."|t " .. targetName, Details:comma_value(math.floor(amount / timeElapsed)), 1, 1, 1, 1, 1, 1)
else
GameTooltip:AddDoubleLine(index .. ". |TInterface\\AddOns\\Details\\images\\classes_small_alpha:14:14:0:0:128:128:"..cords[1]*128 ..":"..cords[2]*128 ..":"..cords[3]*128 ..":"..cords[4]*128 .."|t " .. targetName, abbreviationFunction(_, amount), 1, 1, 1, 1, 1, 1)
end
else
if (breakdownWindow.target_persecond) then
GameTooltip:AddDoubleLine(index .. ". " .. targetName, Details:comma_value(math.floor(amount / timeElapsed)), 1, 1, 1, 1, 1, 1)
else
GameTooltip:AddDoubleLine(index .. ". " .. targetName, abbreviationFunction(_, amount), 1, 1, 1, 1, 1, 1)
end
end
end
end
GameTooltip:Show()
else
GameTooltip:SetOwner(targetFrame, "ANCHOR_TOPRIGHT")
GameTooltip:AddLine(lineBar.index .. ". " .. lineBar.spellId)
GameTooltip:AddLine(breakdownWindow.target_text)
GameTooltip:AddLine(Loc ["STRING_NO_TARGET"], 1, 1, 1)
GameTooltip:AddLine(Loc ["STRING_MORE_INFO"], 1, 1, 1)
GameTooltip:Show()
end
else
GameTooltip:SetOwner(targetFrame, "ANCHOR_TOPRIGHT")
GameTooltip:AddLine(lineBar.index .. ". " .. lineBar.spellId)
GameTooltip:AddLine(breakdownWindow.target_text)
GameTooltip:AddLine(Loc ["STRING_NO_TARGET"], 1, 1, 1)
GameTooltip:AddLine(Loc ["STRING_MORE_INFO"], 1, 1, 1)
GameTooltip:Show()
end
targetFrame.texture:SetAlpha(.7)
targetFrame:SetAlpha(1)
lineBar:GetScript("OnEnter")(lineBar)
end
end
local onLeaveSpellTarget = function(self)
+157 -187
View File
@@ -12,7 +12,7 @@ local addonName, Details222 = ...
--local helpers
local getCombatObject = function(segmentNumber)
local combatObject
--select which segment to use, use low level variables for performance
if (segmentNumber == -1) then
combatObject = _detalhes.tabela_overall
@@ -21,7 +21,7 @@ local getCombatObject = function(segmentNumber)
else
combatObject = _detalhes.tabela_historico.tabelas [segmentNumber]
end
return combatObject
end
@@ -46,17 +46,17 @@ end
--return the spell object and the spellId
local getSpellObject = function(playerObject, spellId, isLiteral)
local parameterType = type(spellId)
if (parameterType == "number" and isLiteral) then
--is the id of a spell and literal, directly get the spell object
return playerObject.spells._ActorTable [spellId], spellId
else
local passedSpellName
if (parameterType == "string") then
--passed a spell name, make the spell be in lower case
passedSpellName = spellId:lower()
elseif (parameterType == "number") then
--passed a number but with literal off, transform the spellId into a spell name
local spellName = GetSpellInfo(spellid)
@@ -64,7 +64,7 @@ local getSpellObject = function(playerObject, spellId, isLiteral)
passedSpellName = spellName:lower()
end
end
if (passedSpellName) then
for thisSpellId, spellObject in pairs(playerObject.spells._ActorTable) do
local spellName = Details.GetSpellInfo(thisSpellId)
@@ -120,17 +120,17 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.SegmentInfo (segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
local segmentInfo = {
}
if (not combatObject) then
return segmentInfo
end
return segmentInfo
end
@@ -161,11 +161,11 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.SegmentElapsedTime (segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
return combatObject:GetCombatTime()
end
@@ -216,34 +216,34 @@ function Details.SegmentDamagingUnits (includePlayerUnits, includeEnemyUnits, in
if (type(includePlayerUnits) ~= "boolean") then
includePlayerUnits = true
end
local combatObject = getCombatObject (segment)
local units = {}
local nextIndex = 1
if (not combatObject) then
return units
end
local damageContainer = combatObject:GetContainer (DETAILS_ATTRIBUTE_DAMAGE)
for i = 1, #damageContainer._ActorTable do
local playerObject = damageContainer._ActorTable [i]
if (includePlayerUnits and playerObject.grupo) then
units [nextIndex] = playerObject:GetName()
nextIndex = nextIndex + 1
elseif (includeEnemyUnits and playerObject:IsEnemy()) then
units [nextIndex] = playerObject:GetName()
nextIndex = nextIndex + 1
elseif (includeFriendlyPetUnits and playerObject:IsPetOrGuardian()) then
units [nextIndex] = playerObject:GetName()
nextIndex = nextIndex + 1
end
end
return units
end
@@ -295,34 +295,34 @@ function Details.SegmentHealingUnits (includePlayerUnits, includeEnemyUnits, inc
if (type(includePlayerUnits) ~= "boolean") then
includePlayerUnits = true
end
local combatObject = getCombatObject (segment)
local units = {}
local nextIndex = 1
if (not combatObject) then
return units
end
local damageContainer = combatObject:GetContainer (DETAILS_ATTRIBUTE_HEAL)
for i = 1, #damageContainer._ActorTable do
local playerObject = damageContainer._ActorTable [i]
if (includePlayerUnits and playerObject.grupo) then
units [nextIndex] = playerObject:GetName()
nextIndex = nextIndex + 1
elseif (includeEnemyUnits and playerObject:IsEnemy()) then
units [nextIndex] = playerObject:GetName()
nextIndex = nextIndex + 1
elseif (includeFriendlyPetUnits and playerObject:IsPetOrGuardian()) then
units [nextIndex] = playerObject:GetName()
nextIndex = nextIndex + 1
end
end
return units
end
@@ -354,11 +354,11 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.SegmentTotalDamage (segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
return floor(combatObject.totals_grupo [1])
end
@@ -391,11 +391,11 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.SegmentTotalHealing (segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
return floor(combatObject.totals_grupo [2])
end
@@ -427,20 +427,20 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.SegmentPhases (segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
local phases = {}
if (not combatObject) then
return phases
end
end
local phaseData = combatObject.PhaseData
for phaseChangeId, phaseTable in ipairs(phaseData) do
local phaseNumber = phaseTable [1]
DetailsFramework.table.addunique (phases, phaseNumber)
end
return phases
end
@@ -481,7 +481,7 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitInfo (unitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
local unitInfo = {
class = "UNKNOW", --old typo in details
spec = 0,
@@ -494,18 +494,18 @@ function Details.UnitInfo (unitId, segment)
isArenaEnemy = false,
arenaTeam = false,
}
if (not combatObject) then
return unitInfo
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return unitInfo
end
local specCache = Details.cached_specs
local unitSerial = UnitGUID(unitId)
local _, class = UnitClass(unitId)
@@ -566,7 +566,7 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitTexture (unitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
local textureInfo = {
classTexture = [[Interface\LFGFRAME\LFGROLE_BW]],
classLeft = 0.25,
@@ -579,32 +579,32 @@ function Details.UnitTexture (unitId, segment)
specTop = 0,
specBottom = 1,
}
if (not combatObject) then
return textureInfo
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return textureInfo
end
local texture, left, right, top, bottom = playerObject:GetClassIcon()
textureInfo.classTexture = texture
textureInfo.classLeft = left
textureInfo.classRight = right
textureInfo.classTop = top
textureInfo.classBottom = bottom
local texture, left, right, top, bottom = Details:GetSpecIcon (playerObject.spec)
textureInfo.specTexture = texture
textureInfo.specLeft = left
textureInfo.specRight = right
textureInfo.specTop = top
textureInfo.specBottom = bottom
return textureInfo
end
@@ -644,18 +644,18 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitDamage (unitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return 0
end
return floor(playerObject.total or 0)
end
@@ -699,22 +699,22 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitDamageByPhase (unitId, phaseNumber, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
if (not phaseNumber) then
return 0
end
local unitName = getUnitName (unitId)
local damagePhaseData = combatObject.PhaseData.damage [phaseNumber]
if (not damagePhaseData) then
return 0
end
local phaseDamage = damagePhaseData [unitName] or 0
return floor(phaseDamage)
end
@@ -752,13 +752,13 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitDamageInfo (unitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local damageInfo = {
total = 0,
totalWithoutPet = 0,
@@ -767,19 +767,19 @@ function Details.UnitDamageInfo (unitId, segment)
friendlyFire = 0,
activityTime = 0,
}
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return damageInfo
end
damageInfo.total = floor(playerObject.total)
damageInfo.totalWithoutPet = floor(playerObject.total_without_pet)
damageInfo.damageAbsorbed = floor(playerObject.totalabsorbed)
damageInfo.damageTaken = floor(playerObject.damage_taken)
damageInfo.friendlyFire = playerObject.friendlyfire_total
damageInfo.activityTime = playerObject:Tempo()
return damageInfo
end
@@ -838,14 +838,14 @@ function Details.UnitDamageBySpell (unitId, spellId, isLiteral, segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return 0
end
local spellObject, spellId = getSpellObject (playerObject, spellId, isLiteral)
if (spellObject) then
@@ -903,15 +903,15 @@ function Details.UnitDamageSpellInfo (unitId, spellId, isLiteral, segment)
isLiteral = true
end
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local spellInfo = {
total = 0,
spellId = 0,
@@ -927,35 +927,20 @@ function Details.UnitDamageSpellInfo (unitId, spellId, isLiteral, segment)
criticalHits = 0,
criticalDamage = 0,
}
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
local playerObject = getActorObjectFromCombat(combatObject, 1, unitName)
if (not playerObject) then
return spellInfo
end
local spellObject, spellId = getSpellObject (playerObject, spellId, isLiteral)
local spellObject, spellId = getSpellObject(playerObject, spellId, isLiteral)
if (not spellObject) then
return spellInfo
end
local miscPlayerObject = getActorObjectFromCombat (combatObject, 4, unitName)
if (miscPlayerObject) then
local spellName = GetSpellInfo(spellId)
local castedAmount = miscPlayerObject.spell_cast and miscPlayerObject.spell_cast [spellId]
if (castedAmount) then
spellInfo.casted = castedAmount
else
for castedSpellId, castedAmount in pairs(miscPlayerObject.spell_cast) do
local castedSpellName = GetSpellInfo(castedSpellId)
if (castedSpellName == spellName) then
spellInfo.casted = castedAmount
break
end
end
end
end
local spellName = GetSpellInfo(spellId)
spellInfo.casted = combatObject:GetSpellCastAmount(unitName, spellName)
if (spellObject) then
spellInfo.total = spellObject.total
spellInfo.count = spellObject.counter
@@ -970,7 +955,7 @@ function Details.UnitDamageSpellInfo (unitId, spellId, isLiteral, segment)
spellInfo.criticalHits = spellObject.c_amt
spellInfo.criticalDamage = spellObject.c_total
end
return spellInfo
end
@@ -1027,19 +1012,19 @@ function Details.UnitDamageSpellOnUnit (unitId, spellId, targetUnitId, isLiteral
isLiteral = true
end
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return 0
end
local spellObject, spellId = getSpellObject (playerObject, spellId, isLiteral)
if (spellObject) then
local targetName = getUnitName (targetUnitId)
@@ -1086,14 +1071,14 @@ function Details.UnitDamageTaken (unitId, segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return 0
end
return floor(playerObject.damage_taken)
end
@@ -1136,18 +1121,18 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitDamageOnUnit (unitId, targetUnitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return 0
end
local targetName = getUnitName (targetUnitId)
return playerObject.targets [targetName] or 0
end
@@ -1193,16 +1178,16 @@ function Details.UnitDamageTakenFromSpell (unitId, spellId, isLiteral, segment)
if (type(isLiteral) ~= "boolean") then
isLiteral = true
end
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local damageContainer = combatObject:GetContainer (DETAILS_ATTRIBUTE_DAMAGE)
local totalDamageTaken = 0
if (isLiteral and type(spellId) == "number") then
for i = 1, #damageContainer._ActorTable do
@@ -1265,20 +1250,20 @@ function Details.UnitDamagingSpells (unitId, segment)
if (not combatObject) then
return {}
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return {}
end
local unitSpells = playerObject.spells._ActorTable
local resultTable = {}
for spellId, spellObject in pairs(unitSpells) do
resultTable [#resultTable + 1] = spellId
end
return resultTable
end
@@ -1315,23 +1300,23 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitDamagingTargets (unitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local offensiveTargetNames = {}
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return offensiveTargetNames
end
for targetName, _ in pairs(playerObject.targets) do
offensiveTargetNames [#offensiveTargetNames + 1] = targetName
end
return offensiveTargetNames
end
@@ -1369,23 +1354,23 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitDamagingPets (unitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local petNames = {}
local playerObject = getActorObjectFromCombat (combatObject, 1, unitName)
if (not playerObject) then
return petNames
end
for i = 1, #playerObject.pets do
petNames [#petNames + 1] = playerObject.pets [i]
end
return petNames
end
@@ -1427,18 +1412,18 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitHealing (unitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 2, unitName)
if (not playerObject) then
return 0
end
return floor(playerObject.total or 0)
end
@@ -1476,13 +1461,13 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitHealingInfo (unitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local healingInfo = {
total = 0,
totalWithoutPet = 0,
@@ -1494,12 +1479,12 @@ function Details.UnitHealingInfo (unitId, segment)
healingTaken = 0,
activityTime = 0,
}
local playerObject = getActorObjectFromCombat (combatObject, 2, unitName)
if (not playerObject) then
return healingInfo
end
healingInfo.total = floor(playerObject.total)
healingInfo.totalWithoutPet = floor(playerObject.total_without_pet)
healingInfo.totalOverhealWithoutPet = floor(playerObject.totalover_without_pet)
@@ -1567,16 +1552,16 @@ function Details.UnitHealingBySpell (unitId, spellId, isLiteral, segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 2, unitName)
if (not playerObject) then
return 0
end
local spellObject, spellId = getSpellObject (playerObject, spellId, isLiteral)
if (spellObject) then
return spellObject.total
else
@@ -1634,13 +1619,13 @@ function Details.UnitHealingSpellInfo (unitId, spellId, isLiteral, segment)
isLiteral = true
end
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local spellInfo = {
@@ -1658,35 +1643,20 @@ function Details.UnitHealingSpellInfo (unitId, spellId, isLiteral, segment)
criticalHits = 0,
criticalHealing = 0,
}
local playerObject = getActorObjectFromCombat (combatObject, 2, unitName)
if (not playerObject) then
return spellInfo
end
local spellObject, spellId = getSpellObject (playerObject, spellId, isLiteral)
if (not spellObject) then
return spellInfo
end
local miscPlayerObject = getActorObjectFromCombat (combatObject, 4, unitName)
if (miscPlayerObject) then
local spellName = GetSpellInfo(spellId)
local castedAmount = miscPlayerObject.spell_cast and miscPlayerObject.spell_cast [spellId]
if (castedAmount) then
spellInfo.casted = castedAmount
else
for castedSpellId, castedAmount in pairs(miscPlayerObject.spell_cast) do
local castedSpellName = GetSpellInfo(castedSpellId)
if (castedSpellName == spellName) then
spellInfo.casted = castedAmount
break
end
end
end
end
local spellName = GetSpellInfo(spellId)
spellInfo.casted = combatObject:GetSpellCastAmount(unitName, spellName)
if (spellObject) then
spellInfo.total = spellObject.total
spellInfo.count = spellObject.counter
@@ -1701,7 +1671,7 @@ function Details.UnitHealingSpellInfo (unitId, spellId, isLiteral, segment)
spellInfo.criticalHits = spellObject.c_amt
spellInfo.criticalHealing = spellObject.c_total
end
return spellInfo
end
@@ -1759,19 +1729,19 @@ function Details.UnitHealingSpellOnUnit (unitId, spellId, targetUnitId, isLitera
isLiteral = true
end
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 2, unitName)
if (not playerObject) then
return 0
end
local spellObject, spellId = getSpellObject (playerObject, spellId, isLiteral)
if (spellObject) then
local targetName = getUnitName (targetUnitId)
@@ -1820,14 +1790,14 @@ function Details.UnitHealingTaken (unitId, segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 2, unitName)
if (not playerObject) then
return 0
end
return floor(playerObject.healing_taken)
end
@@ -1872,18 +1842,18 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitHealingOnUnit (unitId, targetUnitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 2, unitName)
if (not playerObject) then
return 0
end
local targetName = getUnitName (targetUnitId)
return playerObject.targets [targetName] or 0
end
@@ -1932,16 +1902,16 @@ function Details.UnitHealingTakenFromSpell (unitId, spellId, isLiteral, segment)
if (type(isLiteral) ~= "boolean") then
isLiteral = true
end
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local healingContainer = combatObject:GetContainer (DETAILS_ATTRIBUTE_HEAL)
local totalHealingTaken = 0
if (isLiteral and type(spellId) == "number") then
for i = 1, #healingContainer._ActorTable do
@@ -2005,20 +1975,20 @@ function Details.UnitHealingSpells (unitId, segment)
if (not combatObject) then
return {}
end
local unitName = getUnitName (unitId)
local playerObject = getActorObjectFromCombat (combatObject, 2, unitName)
if (not playerObject) then
return {}
end
local unitSpells = playerObject.spells._ActorTable
local resultTable = {}
for spellId, spellObject in pairs(unitSpells) do
resultTable [#resultTable + 1] = spellId
end
return resultTable
end
@@ -2056,23 +2026,23 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitHealingTargets (unitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local healingTargetNames = {}
local playerObject = getActorObjectFromCombat (combatObject, 2, unitName)
if (not playerObject) then
return healingTargetNames
end
for targetName, _ in pairs(playerObject.targets) do
healingTargetNames [#healingTargetNames + 1] = targetName
end
return healingTargetNames
end
@@ -2111,24 +2081,24 @@ tinsert(Details.API_Description.namespaces[1].api, {
function Details.UnitHealingPets (unitId, segment)
segment = segment or 0
local combatObject = getCombatObject (segment)
if (not combatObject) then
return 0
end
local unitName = getUnitName (unitId)
local petNames = {}
local playerObject = getActorObjectFromCombat (combatObject, 2, unitName)
if (not playerObject) then
return petNames
end
for i = 1, #playerObject.pets do
petNames [#petNames + 1] = playerObject.pets [i]
end
return petNames
end
--stop auto complete: doo ende endp elsez
--stop auto complete: doo ende endp elsez
+74 -76
View File
@@ -283,56 +283,60 @@ do
end
function _detalhes:ReGuessSpec (t)
local Actor, container = t[1], t[2]
local actorObject, container = t[1], t[2]
local SpecSpellList = _detalhes.SpecSpellList
---@type combat
local combatObject = Details:GetCurrentCombat()
--get from the spell cast list
if (_detalhes.tabela_vigente) then
local misc_actor = _detalhes.tabela_vigente(4, Actor.nome)
if (misc_actor and misc_actor.spell_cast) then
for spellid, _ in pairs(misc_actor.spell_cast) do
local spec = SpecSpellList [spellid]
if (spec) then
_detalhes.cached_specs [Actor.serial] = spec
if (combatObject) then
local spellCastTable = combatObject:GetSpellCastTable(actorObject.nome)
Actor:SetSpecId(spec)
Actor.classe = _detalhes.SpecIDToClass [spec] or Actor.classe
Actor.guessing_spec = nil
for spellName in pairs(spellCastTable) do
local _, _, _, _, _, _, spellid = GetSpellInfo(spellName)
local spec = SpecSpellList[spellid]
if (spec) then
_detalhes.cached_specs[actorObject.serial] = spec
Details:SendEvent("UNIT_SPEC", nil, Actor:GetUnitId(), spec, Actor.serial)
actorObject:SetSpecId(spec)
actorObject.classe = _detalhes.SpecIDToClass[spec] or actorObject.classe
actorObject.guessing_spec = nil
if (container) then
container.need_refresh = true
end
Details:SendEvent("UNIT_SPEC", nil, actorObject:GetUnitId(), spec, actorObject.serial)
if (Actor.minha_barra and type(Actor.minha_barra) == "table") then
Actor.minha_barra.minha_tabela = nil
_detalhes:ScheduleWindowUpdate (2, true)
end
return spec
if (container) then
container.need_refresh = true
end
if (actorObject.minha_barra and type(actorObject.minha_barra) == "table") then
actorObject.minha_barra.minha_tabela = nil
_detalhes:ScheduleWindowUpdate (2, true)
end
return spec
end
end
else
if (Actor.spells) then
for spellid, _ in pairs(Actor.spells._ActorTable) do
if (actorObject.spells) then
for spellid, _ in pairs(actorObject.spells._ActorTable) do
local spec = SpecSpellList [spellid]
if (spec) then
if (spec ~= Actor.spec) then
_detalhes.cached_specs [Actor.serial] = spec
if (spec ~= actorObject.spec) then
_detalhes.cached_specs [actorObject.serial] = spec
Actor:SetSpecId(spec)
Actor.classe = _detalhes.SpecIDToClass [spec] or Actor.classe
actorObject:SetSpecId(spec)
actorObject.classe = _detalhes.SpecIDToClass [spec] or actorObject.classe
Details:SendEvent("UNIT_SPEC", nil, Actor:GetUnitId(), spec, Actor.serial)
Details:SendEvent("UNIT_SPEC", nil, actorObject:GetUnitId(), spec, actorObject.serial)
if (container) then
container.need_refresh = true
end
if (Actor.minha_barra and type(Actor.minha_barra) == "table") then
Actor.minha_barra.minha_tabela = nil
if (actorObject.minha_barra and type(actorObject.minha_barra) == "table") then
actorObject.minha_barra.minha_tabela = nil
_detalhes:ScheduleWindowUpdate (2, true)
end
@@ -343,9 +347,9 @@ do
end
end
if (Actor.classe == "HUNTER") then
if (actorObject.classe == "HUNTER") then
local container_misc = _detalhes.tabela_vigente[4]
local index = container_misc._NameIndexTable [Actor.nome]
local index = container_misc._NameIndexTable [actorObject.nome]
if (index) then
local misc_actor = container_misc._ActorTable [index]
local buffs = misc_actor.buff_uptime_spells and misc_actor.buff_uptime_spells._ActorTable
@@ -353,20 +357,20 @@ do
for spellid, spell in pairs(buffs) do
local spec = SpecSpellList [spellid]
if (spec) then
if (spec ~= Actor.spec) then
_detalhes.cached_specs [Actor.serial] = spec
if (spec ~= actorObject.spec) then
_detalhes.cached_specs [actorObject.serial] = spec
Actor:SetSpecId(spec)
Actor.classe = _detalhes.SpecIDToClass [spec] or Actor.classe
actorObject:SetSpecId(spec)
actorObject.classe = _detalhes.SpecIDToClass [spec] or actorObject.classe
Details:SendEvent("UNIT_SPEC", nil, Actor:GetUnitId(), spec, Actor.serial)
Details:SendEvent("UNIT_SPEC", nil, actorObject:GetUnitId(), spec, actorObject.serial)
if (container) then
container.need_refresh = true
end
if (Actor.minha_barra and type(Actor.minha_barra) == "table") then
Actor.minha_barra.minha_tabela = nil
if (actorObject.minha_barra and type(actorObject.minha_barra) == "table") then
actorObject.minha_barra.minha_tabela = nil
_detalhes:ScheduleWindowUpdate (2, true)
end
@@ -384,18 +388,13 @@ do
end
end
function _detalhes:GuessSpec (t)
function _detalhes:GuessSpec(t)
local Actor, container, tries = t[1], t[2], t[3]
if (not Actor) then
return false
end
local SpecSpellList = _detalhes.SpecSpellList
--local misc_actor = info.instancia.showing (4, self:name())
--spell_cast
--get from the spec cache
local spec = _detalhes.cached_specs [Actor.serial]
if (spec) then
@@ -418,21 +417,46 @@ do
--get from the spell cast list
if (_detalhes.tabela_vigente) then
local misc_actor = _detalhes.tabela_vigente(4, Actor.nome)
local spellCastTable = _detalhes.tabela_vigente:GetSpellCastTable(Actor.nome)
if (misc_actor and misc_actor.spell_cast) then
for spellid, _ in pairs(misc_actor.spell_cast) do
for spellName, _ in pairs(spellCastTable) do
local _, _, _, _, _, _, spellid = GetSpellInfo(spellName)
local spec = SpecSpellList[spellid]
if (spec) then
_detalhes.cached_specs [Actor.serial] = spec
Actor:SetSpecId(spec)
Actor.classe = _detalhes.SpecIDToClass [spec] or Actor.classe
Details:SendEvent("UNIT_SPEC", nil, Actor:GetUnitId(), spec, Actor.serial)
Actor.guessing_spec = nil
if (container) then
container.need_refresh = true
end
if (Actor.minha_barra and type(Actor.minha_barra) == "table") then
Actor.minha_barra.minha_tabela = nil
_detalhes:ScheduleWindowUpdate (2, true)
end
return spec
end
end
if (Actor.spells) then --correcao pros containers misc, precisa pegar os diferentes tipos de containers de l
for spellid, _ in pairs(Actor.spells._ActorTable) do
local spec = SpecSpellList [spellid]
if (spec) then
_detalhes.cached_specs [Actor.serial] = spec
Actor:SetSpecId(spec)
Actor.classe = _detalhes.SpecIDToClass [spec] or Actor.classe
Actor.guessing_spec = nil
Details:SendEvent("UNIT_SPEC", nil, Actor:GetUnitId(), spec, Actor.serial)
Actor.guessing_spec = nil
if (container) then
container.need_refresh = true
end
@@ -445,32 +469,6 @@ do
return spec
end
end
else
if (Actor.spells) then --correcao pros containers misc, precisa pegar os diferentes tipos de containers de l
for spellid, _ in pairs(Actor.spells._ActorTable) do
local spec = SpecSpellList [spellid]
if (spec) then
_detalhes.cached_specs [Actor.serial] = spec
Actor:SetSpecId(spec)
Actor.classe = _detalhes.SpecIDToClass [spec] or Actor.classe
Actor.guessing_spec = nil
Details:SendEvent("UNIT_SPEC", nil, Actor:GetUnitId(), spec, Actor.serial)
if (container) then
container.need_refresh = true
end
if (Actor.minha_barra and type(Actor.minha_barra) == "table") then
Actor.minha_barra.minha_tabela = nil
_detalhes:ScheduleWindowUpdate (2, true)
end
return spec
end
end
end
end
else
+25 -21
View File
@@ -4113,40 +4113,44 @@ local SplitLoadFunc = function(self, deltaTime)
if (actorToIndex [containerName]) then
local spellList = actorToIndex [containerName]._ActorTable
if (spellList) then
local SpellPool = Details.spell_pool
local EncounterSpellPool = Details.encounter_spell_pool
local spellPool = Details.spell_pool
local encounterSpellPool = Details.encounter_spell_pool
for spellID, _ in pairs(spellList) do
if (not SpellPool [spellID]) then
SpellPool [spellID] = source
for spellId, _ in pairs(spellList) do
if (not spellPool[spellId]) then
spellPool[spellId] = source
end
if (encounterID and not EncounterSpellPool [spellID]) then
if (encounterID and not encounterSpellPool[spellId]) then
if (actorToIndex:IsEnemy()) then
EncounterSpellPool [spellID] = {encounterID, source}
encounterSpellPool[spellId] = {encounterID, source}
end
end
end
end
end
end
--[=[ .spell_cast is deprecated
--spells the actor casted
if (actorToIndex.spell_cast) then
local SpellPool = Details.spell_pool
local EncounterSpellPool = Details.encounter_spell_pool
for spellID, _ in pairs(actorToIndex.spell_cast) do
if (not SpellPool [spellID]) then
SpellPool [spellID] = source
end
if (encounterID and not EncounterSpellPool [spellID]) then
if (actorToIndex:IsEnemy()) then
EncounterSpellPool [spellID] = {encounterID, source}
end
end
local spellPool = Details.spell_pool
local encounterSpellPool = Details.encounter_spell_pool
for spellName, _ in pairs(actorToIndex.spell_cast) do
local _, _, _, _, _, _, spellId = GetSpellInfo(spellName)
if (spellId) then
if (not spellPool[spellId]) then
spellPool[spellId] = source
end
if (encounterID and not encounterSpellPool[spellId]) then
if (actorToIndex:IsEnemy()) then
encounterSpellPool[spellId] = {encounterID, source}
end
end
end
end
end
--]=]
end
end
end
+10 -11
View File
@@ -353,12 +353,11 @@ do
local noData = "-"
--amount of casts
local castAmount = 0
local combatObject = Details:GetCombatFromBreakdownWindow()
local playerMiscObject = combatObject:GetActor (DETAILS_ATTRIBUTE_MISC, playerName)
local castAmount = combatObject:GetSpellCastAmount(playerName, GetSpellInfo(spellId))
local playerMiscObject = combatObject:GetActor(DETAILS_ATTRIBUTE_MISC, playerName)
if (playerMiscObject) then
castAmount = playerMiscObject.spell_cast and playerMiscObject.spell_cast [spellId] or 0
if (castAmount > 0) then
tooltip.casts_label2:SetText (fullPercent)
tooltip.casts_label3:SetText (castAmount)
DetailsFramework:SetFontColor (tooltip.casts_label2, "gray")
@@ -470,15 +469,14 @@ do
local spellId = rawSpellTable.id
local noData = "-"
tooltip.player_name_label:SetText (Details:GetOnlyName (actualPlayerName))
tooltip.player_name_label:SetText(Details:GetOnlyName(actualPlayerName))
--amount of casts
local castAmount = 0
local combatObject = Details:GetCombatFromBreakdownWindow()
local combatObject = Details:GetCombatFromBreakdownWindow()
local playerMiscObject = combatObject:GetActor (DETAILS_ATTRIBUTE_MISC, playerName)
if (playerMiscObject) then
castAmount = playerMiscObject.spell_cast and playerMiscObject.spell_cast [spellId] or 0
local castAmount = combatObject:GetSpellCastAmount(playerName, GetSpellInfo(spellId))
if (castAmount > 0) then
tooltip.casts_label2:SetText (getPercentComparison (mainCastAmount, castAmount))
tooltip.casts_label3:SetText (castAmount)
DetailsFramework:SetFontColor (tooltip.casts_label2, "white")
@@ -1564,6 +1562,7 @@ do
[2] = {1, 2, 3, 4, 5, 6, 7, 8},
},
tabNameToReplace = "Compare",
bIsCompareTab = true,
} --replace tab [attribute] = [sub attributes]
)
end
@@ -1,4 +1,4 @@
## Interface: 100005
## Interface: 100007
## Title: Details!: Compare 2.0
## Notes: Replace the Compare tab in the player breakdown window.
## RequiredDeps: Details
@@ -1,4 +1,4 @@
## Interface: 100005
## Interface: 100007
## Title: Details!: Storage
## Notes: Stores information for Details! Damage Meter
## DefaultState: Enabled
@@ -1,4 +1,4 @@
## Interface: 100005
## Interface: 100007
## Title: Details!: Encounter Breakdown (plugin)
## Notes: Show detailed information about a boss encounter. Also provide damage per phase, graphic charts, easy weakauras creation.
## RequiredDeps: Details
@@ -1,4 +1,4 @@
## Interface: 100005
## Interface: 100007
## Title: Details!: Raid Check (plugin)
## Notes: Show talents and item level for all members in your group, also shows food and flask state.
## RequiredDeps: Details
@@ -1,4 +1,4 @@
## Interface: 100005
## Interface: 100007
## Title: Details!: Streamer (plugin)
## Notes: Show which spells you are casting, viewers can see what are you doing and follow your steps.
## RequiredDeps: Details
@@ -1,4 +1,4 @@
## Interface: 100005
## Interface: 100007
## Title: Details!: Tiny Threat (plugin)
## Notes: Threat meter plugin, show threat for group members in the window. Select it from the Plugin menu in the Orange Cogwheel.
## RequiredDeps: Details
@@ -1,4 +1,4 @@
## Interface: 100005
## Interface: 100007
## Title: Details!: Vanguard (plugin)
## Notes: Show the health and debuffs for tanks in your group.
## SavedVariablesPerCharacter: _detalhes_databaseVanguard