Details! Damage Meter

Details! Damage Meter

251M Downloads

[TBC][API][BUG] Player Aura data missing for somecase

tywtyw2002 opened this issue · 3 comments

commented

Before Start!

Make sure the bug also happen when Details! is the only addon enabled.

Game and Details! version
Use /details to grab these two.
Details!: DETAILS! VERSION: BCC41
Details!: GAME VERSION: 2.5.4

Describe the bug

  • Steps to Reproduce (what did you do to make the bug happen):
    In some cases, some player's aura data is missing from the API while do the script tooltip code. The other player's aura data are fine.

The following are 2 dumped table for player.

[15:38] flag_original 1300 
[15:38] resource 0.147086 
[15:38] targets table: 0x7fae3a0a7c70 
[15:38] pets table: 0x7fae3a0a7cc0 
[15:38] powertype 0 
[15:38] aID 4728-03B45A18 
[15:38] totalover 0.007407 
[15:38] __index table: 0x7fae33997190 
[15:38] alternatepower 0.063384 
[15:38] spells table: 0x7fae3a0a7d10 
[15:38] nome Älice 
[15:38] spec 266 
[15:38] grupo true 
[15:38] displayName Älice 
[15:38] classe WARLOCK 
[15:38] tipo 3 
[15:38] total 330672.063384 
[15:38] last_event 0 
[15:38] boss_fight_component true 
[15:38] passiveover 0.007407 
[15:38] serial Player-4728-03B45A18 
[15:38] received 349632.063384 
[15:39] flag_original 1300 
[15:39] resource 0.142256 
[15:39] targets table: 0x7fae3a0a7fe0 
[15:39] pets table: 0x7fae3a0a8030 
[15:39] powertype 0 
[15:39] aID 4728-03611CD2 
[15:39] totalover 0.004181 
[15:39] __index table: 0x7fae33997190 
[15:39] alternatepower 0.06444 
[15:39] spells table: 0x7fae3a0a8080 
[15:39] nome Drusk 
[15:39] spec 253 
[15:39] grupo true 
[15:39] displayName Drusk 
[15:39] classe HUNTER 
[15:39] tipo 3 
[15:39] total 43675.06444 
[15:39] last_event 0 
[15:39] boss_fight_component true 
[15:39] passiveover 0.004181 
[15:39] serial Player-4728-03611CD2 
[15:39] received 70239.06444 
commented

I'm going to require some more information from you.

If I'm correct, you say that you're writing a Custom Script, and attempting to use stuff in the Tooltip Code section.

In your Search Script, what type of actors are being added to your custom container? DAMAGE? MISC? HEAL?

What value on the actors are you trying to look at in the Tooltip Code? .spells? .total?

Please give more information total about everything related to your script.

commented

Yes, the custom script.

In somecase the tooltip script cannot get the aura(misc) info from the player object. As far as I know, the player use Restore Mana(28499) and (Haste(28507) or Destruction(28508)) together.

If people only use Haste(28507) the aura(misc) info could get from player object.

To retrieve the misc need get it from the combat object

local buff_player = combat:GetActor(4, player.nome)
local buff_uptime_container = buff_player.buff_uptime_spells and buff_player.buff_uptime_spells._ActorTable

Tooltip Script (work the version)

--init:
local player, combat, instance = ...

local TBC_POTION_BUFF_IDS = {
    [17528] = true,   -- Mighty Rage    强效怒气
    [28494] = true,   -- Insane Strength Potion 疯狂力量药水
    [28506] = true,   -- Potion of Heroes   英雄药水
    [28507] = true,   -- Haste  加速
    [28508] = true,   -- Destruction    毁灭
    [28511] = true,   -- Fire Protection    防护火焰
    [28512] = true,   -- Frost Protection   防护冰霜
    [28513] = true,   -- Nature Protection  防护自然
    [28536] = true,   -- Arcane Protection  奥术防护
    [28537] = true,   -- Shadow Protection  防护暗影
    [28538] = true,   -- Holy Protection    防护神圣
    [28515] = true,   -- Ironshield 铁盾
}

local TBC_POTION_SPELL_IDS = {
    [28495] = 22829,   -- Healing Potion 治疗药水
    [28499] = 22832,   -- Restore Mana   恢复法力
    [28517] = 22850,   -- Rejuvenation Potion    活力药水
    [45051] = 34440,   -- "Mad Alchemist's Potion"   疯狂炼金师药水
}

local function debug_t(t)
    for k, v in pairs(t) do
        print(k, v)
    end
end

--get the misc actor container
local buff_player = combat:GetActor(4, player.nome)
local buff_uptime_container = buff_player.buff_uptime_spells and buff_player.buff_uptime_spells._ActorTable
-- local buff_uptime_container = player.buff_uptime_spells and player.buff_uptime_spells._ActorTable
--debug_t(player)
if (buff_uptime_container) then
    --debug_t(buff_uptime_container)
    for spellId, _ in pairs (TBC_POTION_BUFF_IDS) do
        local potionUsed = buff_uptime_container [spellId]
        
        if (potionUsed) then
            local name, _, icon = GetSpellInfo (spellId)
            --print(name, potionUsed)
            GameCooltip:AddLine (name, potionUsed.activedamt)
            _detalhes:AddTooltipBackgroundStatusbar()
            GameCooltip:AddIcon (icon, 1, 1, _detalhes.tooltip.line_height, _detalhes.tooltip.line_height)
        end
    end
end

local spell_container = player.spells and player.spells._ActorTable
if (spell_container) then
    for spellId, itemID in pairs (TBC_POTION_SPELL_IDS) do
        local potionUsed = spell_container [spellId]
        
        if (potionUsed) then
            local name, _, _, _, _, _, _,_, _, icon = GetItemInfo(itemID)
            GameCooltip:AddLine (name, potionUsed.counter)
            _detalhes:AddTooltipBackgroundStatusbar()
            GameCooltip:AddIcon (icon, 1, 1, _detalhes.tooltip.line_height, _detalhes.tooltip.line_height)
        end
    end
end


Search Script

--init:
local combat, instance_container, instance = ...
local total, top, amount = 0, 0, 0

--get the misc actor container
local misc_container = combat:GetActorList ( DETAILS_ATTRIBUTE_MISC )
local energy_container = combat:GetActorList ( DETAILS_ATTRIBUTE_ENERGY )

local TBC_POTION_BUFF_IDS = {
    [17528] = true,   -- Mighty Rage    强效怒气
    [28494] = true,   -- Insane Strength Potion 疯狂力量药水
    [28506] = true,   -- Potion of Heroes   英雄药水
    [28507] = true,   -- Haste  加速
    [28508] = true,   -- Destruction    毁灭
    [28511] = true,   -- Fire Protection    防护火焰
    [28512] = true,   -- Frost Protection   防护冰霜
    [28513] = true,   -- Nature Protection  防护自然
    [28536] = true,   -- Arcane Protection  奥术防护
    [28537] = true,   -- Shadow Protection  防护暗影
    [28538] = true,   -- Holy Protection    防护神圣
    [28515] = true,   -- Ironshield 铁盾
}

local TBC_POTION_SPELL_IDS = {
    [28495] = 22829,   -- Healing Potion 治疗药水
    [28499] = 22832,   -- Restore Mana   恢复法力
    [28517] = 22850,   -- Rejuvenation Potion    活力药水
    [45051] = 34440,   -- "Mad Alchemist's Potion"   疯狂炼金师药水
}

--do the loop:
for _, player in ipairs ( misc_container ) do
    
    --only player in group
    if (player:IsGroupPlayer()) then
        
        local found_potion = false
        
        --get the spell buff uptime container
        local buff_uptime_container = player.buff_uptime and player.buff_uptime_spells and player.buff_uptime_spells._ActorTable
        if (buff_uptime_container) then
            for spellId, _ in pairs (TBC_POTION_BUFF_IDS) do
                local potionUsed = buff_uptime_container [spellId]
                
                if (potionUsed) then
                    local used = potionUsed.activedamt
                    if (used and used > 0) then
                        total = total + used
                        found_potion = true
                        if (used > top) then
                            top = used
                        end
                        
                        --add amount to the player
                        instance_container:AddValue (player, used)
                    end
                end
            end
        end
        
        if (found_potion) then
            amount = amount + 1
        end
    end
end

for _, player in ipairs ( energy_container ) do
    
    --only player in group
    if (player:IsGroupPlayer()) then
        
        local found_potion = false
        
        --get the spells
        local spell_container = player.spells and player.spells._ActorTable
        if (spell_container) then
            for spellId, _ in pairs (TBC_POTION_SPELL_IDS) do
                local potionUsed = spell_container [spellId]
                
                if (potionUsed) then
                    local used = potionUsed.counter
                    if (used and used > 0) then
                        total = total + used
                        found_potion = true
                        if (used > top) then
                            top = used
                        end
                        
                        --add amount to the player
                        instance_container:AddValue (player, used)
                    end
                end
            end
        end
        
        if (found_potion) then
            amount = amount + 1
        end
    end
end

--return:
return total, top, amount

Here is the data
Details.lua.zip

commented

Apologies for the late reply.

You're adding misc and energy actors into the instance_container. It is likely that one is overwriting the other and giving you an Energy actor inside your tooltip function.

2 different solutions: Change the order of energy_container and misc_container being used, so add players from the misc container second.
OR: Get the misc actor from the combat in the tooltip script. combat:GetActor(DETAILS_ATTRIBUTE_MISC,player:Name()) --Not tested