View Single Post
09-30-15, 02:20 AM   #1
Nikita S. Doroshenko
A Cyclonian
 
Nikita S. Doroshenko's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2015
Posts: 45
Can we somehow hook Blizzard's Combat Damage Text (that shows above target)?

I'm looking for a way to hook all incoming numbers in combat floating text and chat and multiply them by 0.1 (According to Lua performance manual and tests: multiply is faster then divide). And then use string.format for strings higher then 100 to remove decimal. So for example 637 will become 63.7, but 7 906 or greater will become 791.
This way i will be able to build an AddOn that get rid of long numbers.

The main problem is that AddOns\Blizzard_CombatText\Blizzard_CombatText.lua looks like only handles texts below character. For example if i'll add this code:

Lua Code:
  1. hooksecurefunc("CombatText_AddMessage", function()
  2.     print(message, scrollFunction, r, g, b, displayType, isStaggered)
  3.     -- When i swing or damage deal nothing is output :(
  4.     -- Only Output when i receive heal or get damage
  5. end)
  6.  
  7. local function Test(self, event, ...)
  8.     print(self, event)
  9.     local arg1, data, arg3, arg4 = ...;
  10.     print(arg1, data, arg3, arg4)
  11.     -- Same here, when i swing or damage deal nothing is output :(
  12.     -- Only Output when i receive heal or get damage
  13. end
  14. CombatText:HookScript("OnEvent", Test)

It will only print heal on me, special effects, damage that i take and so on... but nothing about damage that i deal.

So i take a look on other solutions, I inspected Scrolling Combat Text - Damage AddOn, and it looks like it only turn off Blizzard's Cvar that show Combat Damage Done Text, and then uses it's own frame and put there text taken from Combat Chat and animate it.

The main problem in method from Scrolling Combat Text - Damage, is that this text uses fixed position on screen, and if you fight with multiple targets, all damage done text will be placed in center in on place. But i am looking for a way to keep using Blizzard's Damage Done text style, but just hook it to remove 1 number.

I will very appreciate your help and advises.
  Reply With Quote