View Single Post
09-06-16, 02:58 AM   #8
asdf
A Deviate Faerie Dragon
Join Date: Feb 2005
Posts: 18
Originally Posted by Phanx View Post
Does it work if, instead of AbbreviateNumber, you simply change the output to an arbitrary string like "TEST"?

That's where the "you could try" part of my original response comes in -- it may be that the combat text system, once loaded into memory, can't be affected by any further changes by addons. This would be in keeping with things like the NAME_TEXT_FONT global, which can be overridden to change the font used for unit names in the game world, but only if it's called early in the loading process, and changes persist through UI reloads, and additional changes after logging in are ignored.

Another (simpler) way you can solve the load-on-demand problem is to just write this in your TOC file:
## LoadOnDemand: 1
## LoadWith: Blizzard_CombatText
Then your addon will automatically be loaded right after Blizzard_CombatText.
I'm still trying to get it to work, but the more I look into CombatText_OnEvent the less I understand. I'm able to print strings wherever the code is executing, so my local version is getting executed. However, I'm not sure if the combat text itself is actually sent through this event handler (???).

Here's where I'm at. If I attack with an ability on a target dummy on a Rogue, I get executions of the following events:
PLAYER_REGEN_DISABLED (entering combat), COMBAT_TEXT_UPDATE (arg1: ENERGIZE, happens twice), COMBAT_TEXT_UPDATE (arg1: SPELL_AURA_START), UNIT_POWER (happens 3x), COMBAT_TEXT_UPDATE (arg1: SPELL_AURA_END), UNIT_POWER (3x), PLAYER_REGEN_ENABLED (when I leave combat), UNIT_POWER

But I can't seem to find the actual damage value in any of these events. And if I attack with no weapon/procs equipped and just autoattack with a fist, the only events I get are PLAYER_REGEN_DISABLED and PLAYER_REGEN_ENABLED. There are no events fired on each autoattack, at least not ones that are caught by my handler.

And within the code of the function itself, it doesn't actually get to the end when it does execute. This part of the function:
Code:
  -- See if we should display the message or not
  if ( not info.show ) then
    -- When Resists aren't being shown, partial resists should display as Damage
    if (info.var == "COMBAT_TEXT_SHOW_RESISTANCES" and arg3) then
      if ( strsub(messageType, 1, 5) == "SPELL" ) then
        messageType = arg4 and "SPELL_DAMAGE_CRIT" or "SPELL_DAMAGE";
      else
        messageType = arg4 and "DAMAGE_CRIT" or "DAMAGE";
      end
    else
      return;
    end
  end
Returns always because (info.var == "COMBAT_TEXT_SHOW_RESISTANCES" and arg3) seems to never be true for any of the events that it's processing.

At the end is the only call to addMessage that I can find in all of Blizzard_CombatText.lua:
Code:
  -- Add the message
  if ( message ) then
    print("adding message: ", message)
    CombatText_AddMessage(message, COMBAT_TEXT_SCROLL_FUNCTION, info.r, info.g, info.b, displayType, isStaggered);
  end
I added the print statement and it never gets executed. So how are the combat messages getting on the screen if AddMessage isn't called? Is there other combat text code somewhere else?

-----

Edit: Played around with print some more and confirmed that I was only getting secondary events, the actual "damage" event of COMBAT_TEXT_UPDATE doesn't seem to be getting caught.

Code:
[05:09:37] Event: UNIT_POWER  arg1: player  data: COMBO_POINTS  arg3: nil  arg4: nil
[05:09:37] Event: COMBAT_TEXT_UPDATE  arg1: ENERGIZE  data: 15  arg3: ENERGY  arg4: nil
[05:09:38] Event: COMBAT_TEXT_UPDATE  arg1: SPELL_AURA_START  data: Opportunity  arg3: nil  arg4: nil
[05:09:38] Event: COMBAT_TEXT_UPDATE  arg1: ENERGIZE  data: 1  arg3: COMBO_POINTS  arg4: nil
[05:09:38] Event: UNIT_POWER  arg1: player  data: ENERGY  arg3: nil  arg4: nil

Last edited by asdf : 09-06-16 at 03:13 AM.
  Reply With Quote