Thread: 3 Questions
View Single Post
07-23-13, 04:31 PM   #4
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
1. You will have to write your own AbbreviateLargeNumbers function for it.
lua Code:
  1. local SiValue = function(val)
  2.     if (val >= 1e6) then
  3.         return ("%.1fm"):format(val / 1e6)
  4.     elseif (val >= 1e3) then
  5.         return ("%.1fk"):format(val / 1e3)
  6.     else
  7.         return val
  8.     end
  9. end
would be a simple example without using blizzard's separators.

2. I'm not sure what's the texture shown there, but it might be these:
MainMenuXPBarTextureLeftCap
MainMenuXPBarTextureRightCap
MainMenuXPBarTextureMid
(Those are global names)
If so, you could use MainMenuXPBarTextureLeftCap:SetTexture(nil) and so on or play with SetTexCoords to make the border suit your needs. You might have to hook MainMenuExpBar_SetWidth as well.

Apart from that, when you use hooksecurefunc, your hook will be called with the same arguments as the function you hook to. In the case of TextStatusBar_UpdateTextStringWithValues those are:
statusFrame - StatusBar - the status bar the text is being changed on (i.e. PlayerFrameHealthBar)
textString - FontString - the text being changed (i.e. PlayerFrameHealthBar.TextString)
value - number - the current value of the statusbar (probably the same as the return of UnitHealth("player") +/- some negligible lag, if the func is being called for the player)
valueMin - number - the min value of the statusbar (probably 0)
valueMax - number - the max value of the statusbar (probably the same as the return of UnitMaxHealth("player") +/- some negligible lag, if the func is being called for the player)

By using those you could spare yourself some global look-ups and only update when there is need to and not all player, target and focus every time TextStatusBar_UpdateTextStringWithValues has been called.

Edit: By the way, what is the third question?

Last edited by Rainrider : 07-23-13 at 04:33 PM.
  Reply With Quote