Thread Tools Display Modes
Prev Previous Post   Next Post Next
02-22-14, 07:57 PM   #1
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Help with some Font settings

EDIT:

Disreguard this post..

Was able to work most of the issues out with the "search" function.

for those that might want to see the code im currently using.

This code was posted by Phanx and editied to my likeing.
Code:
local shorts = {
	{ 1e10, 1e9, "%.0fb" }, --  10b+ as  12b
	{  1e9, 1e9, "%.1fb" }, --   1b+ as 8.3b
	{  1e7, 1e6, "%.0fm" }, --  10m+ as  14m
	{  1e6, 1e6, "%.1fm" }, --   1m+ as 7.4m
	{  1e5, 1e3, "%.0fk" }, -- 100k+ as 840k
	{  1e3, 1e3, "%.1fk" }, --   1k+ as 2.5k
	{    0,   1,    "%d" }, -- < 1k  as  974
}
for i = 1, #shorts do
	shorts[i][4] = shorts[i][3] .. " (%.0f%%)"
end

hooksecurefunc("TextStatusBar_UpdateTextStringWithValues", function(statusBar, fontString, value, valueMin, valueMax)
	local style = GetCVar("statusTextDisplay")
	if style == "PERCENT" then
		return fontString:SetFormattedText("%.0f%%", value / valueMax * 100)
	end
	
	for i = 1, #shorts do
		local t = shorts[i]
		if style == "NUMERIC" then
			if value >= t[1] then
					return fontString:SetFormattedText(t[3], value / t[2])				
			end
		end
		if style == "BOTH" then		
			if value >= t[1] then
					return fontString:SetFormattedText(t[4], value / t[2], value / valueMax * 100)				
			end
		end	
	end
end)
Now just to search and figure out how to adjust the size of Healthbar/Manabar fonts for each unitframe.

Coke

Last edited by cokedrivers : 02-23-14 at 10:31 AM.
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » Help with some Font settings


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off