+ Reply to Thread
Results 1 to 11 of 11
Like Tree4Likes
  • 3 Post By chuckySTAR
  • 1 Post By Leitsha

Thread: Rift Meter question

  1. #1
    Rift Chaser Lifeismystery's Avatar
    Join Date
    Dec 2010
    Posts
    341

    Default Rift Meter question

    Hi guys, anyone know how to change number format in Rift Meter?

    To see 10k dps/hps instead of 10000

    I find in this:
    Code:
    function RM.numberFormat(num)
    	local str = tostring(VU.round(num))
    	local formatted = str:reverse():gsub("(%d%d%d)","%1,"):reverse()
    	return str:len() % 3 == 0 and formatted:sub(2) or formatted
    end
    And this:
    Code:
    local function BuildFormat(absolute, perSecond, percent)
    	local args = {}
    	local format = ""
    	if RiftMeter_showAbsolute then
    		tinsert(args, absolute)
    
    		format = format .. "%s (%d"
    	else
    		format = format .."%d"
    	end
    	
    	tinsert(args, perSecond)
    
    	if RiftMeter_showPercent then
    		tinsert(args, percent)
    		format = format .. (RiftMeter_showAbsolute and ", " or " ") .. (RiftMeter_showAbsolute and "" or "(") .. "%.1f%%)"
    	elseif RiftMeter_showAbsolute and not RiftMeter_showPercent then
    		format = format .. ")"
    	end
    
    	return format:format(unpack(args))
    end
    And:
    Code:
    if RelativeTo > 0 then
    				row.rightLabel = BuildFormat(NumberFormat(player.value), player.value / duration, player.value / max(data.players[RelativeTo].value, 1) * 100)
    			else
    				row.rightLabel = BuildFormat(NumberFormat(player.value), player.value / duration, player.value / max(data.total, 1) * 100)
    			end
    Don't know how to change it.

  2. #2
    ETI
    ETI is offline
    Rift Disciple
    Join Date
    Mar 2011
    Posts
    175

    Default

    Code:
    local function BuildFormat(absolute, perSecond, percent)
    	local args = {}
    	local format = ""
    	if RiftMeter_showAbsolute then
    		tinsert(args, absolute)
    
    		format = format .. "%s (%d"
    	else
    		format = format .."%d"
    	end
    	
    	tinsert(args, perSecond)
            format = format .. "k"
    
    	if RiftMeter_showPercent then
    		tinsert(args, percent)
    		format = format .. (RiftMeter_showAbsolute and ", " or " ") .. (RiftMeter_showAbsolute and "" or "(") .. "%.1f%%)"
    	elseif RiftMeter_showAbsolute and not RiftMeter_showPercent then
    		format = format .. ")"
    	end
    
    	return format:format(unpack(args))
    end
    Code:
    if RelativeTo > 0 then
    				row.rightLabel = BuildFormat(NumberFormat(player.value), player.value / duration / 1000, player.value / max(data.players[RelativeTo].value, 1) * 100)
    			else
    				row.rightLabel = BuildFormat(NumberFormat(player.value), player.value / duration / 1000, player.value / max(data.total, 1) * 100)
    			end
    Try something like this. Should work.

    EDIT: Actually you should even add something like this too,or numbers will not shrink.
    Code:
    	format = format .. "%s (%d%.0f"
    	else
    		format = format .."%d%.0f"
    	end
    Last edited by ETI; 10-27-2015 at 02:42 AM.
    Jozy
    The one and only.

  3. #3
    Rift Chaser Lifeismystery's Avatar
    Join Date
    Dec 2010
    Posts
    341

    Default

    Thank you for help,

    I did changes here
    --RiftMeter_Utilities.lua
    Code:
    function RM.numberFormat(num)
        local str
        local placeValue = ("%%.%df"):format(places or 0)
        if not num then
            return 0
        elseif num >= 1000000000000 then
            str = placeValue:format(num / 1000000000000) .. "T"
        elseif num >= 1000000000 then
            str = placeValue:format(num / 1000000000) .. "B"
        elseif num >= 1000000 then
            str = placeValue:format(num / 1000000) .. "M"
        elseif num >= 1000 then
            str = placeValue:format(num / 1000) .. "k"
        else
            str = num
        end
    
    	return str
    end
    
    function RM.numberFormat2(num)
        local str
        local placeValue = ("%%.%df"):format(places or 0)
        if not num then
            return 0
        elseif num >= 1000000000000 then
            str = placeValue:format(num / 1000000000000)
        elseif num >= 1000000000 then
            str = placeValue:format(num / 1000000000)
        elseif num >= 1000000 then
            str = placeValue:format(num / 1000000)
        elseif num >= 1000 then
            str = placeValue:format(num / 1000)
        else
            str = num 
        end
    
    	return str
    end
    --RiftMeter.lua
    Code:
    local NumberFormat2 = RM.numberFormat2
    --RiftMeter_UI.lua

    Code:
    local NumberFormat2 = RM.numberFormat2
    
    local function BuildFormat(absolute, perSecond, percent)
    	local args = {}
    	local format = ""
    	if RiftMeter_showAbsolute then
    		tinsert(args, absolute)
    		format = format .. "%s (%.1f"
    	else
    		format = format .."%.1f"
    	end
    
        if tonumber(perSecond) >= 1000000000 then
            format = format .. "T"
        elseif tonumber(perSecond) >= 1000000 then
            format = format .. "B"
        elseif tonumber(perSecond) >= 1000 then
            format = format .. "M"
        elseif tonumber(perSecond) >= 1 then
            format = format .. "k"
        else
            --
        end
    	
    	tinsert(args, perSecond)
    
    	if RiftMeter_showPercent then
    		tinsert(args, percent)
    		format = format .. (RiftMeter_showAbsolute and ", " or " ") .. (RiftMeter_showAbsolute and "" or "(") .. "%.1f%%)"
    	elseif RiftMeter_showAbsolute and not RiftMeter_showPercent then
    		format = format .. ")"
    	end
    
    	return format:format(unpack(args))
    end
    
    if RelativeTo > 0 then
    	row.rightLabel = BuildFormat(NumberFormat(player.value), NumberFormat2(player.value / duration), player.value / max(data.players[RelativeTo].value, 1) * 100)
    else
    	row.rightLabel = BuildFormat(NumberFormat(player.value), NumberFormat2(player.value / duration), player.value / max(data.total, 1) * 100)
    end
    
    if RelativeTo > 1 then
    	-- RelativeTo - 1 because of the total bar
             row.rightLabel = BuildFormat(NumberFormat(value), NumberFormat2(value / duration), value / max(data.abilities[RelativeTo - 1].value, 1) * 100)
    else
             row.rightLabel = BuildFormat(NumberFormat(value), NumberFormat2(value / duration), value / max(window.selectedPlayer:getStat(sortKey), 1) * 100)
    end


    and that what i get

    Last edited by Lifeismystery; 10-27-2015 at 03:39 AM.

  4. #4
    ETI
    ETI is offline
    Rift Disciple
    Join Date
    Mar 2011
    Posts
    175

    Default

    Still think that for an absolute value it would be better to do numbers with parts up to 2 digits.

    For example when you crop absolute damage to millions format you should have something like 3.27M instead of just 3M. Its more representative and informative.
    Jozy
    The one and only.

  5. #5
    Rift Chaser Lifeismystery's Avatar
    Join Date
    Dec 2010
    Posts
    341

    Default

    Quote Originally Posted by ETI View Post
    Still think that for an absolute value it would be better to do numbers with parts up to 2 digits.

    For example when you crop absolute damage to millions format you should have something like 3.27M instead of just 3M. Its more representative and informative.
    Ye, you right

  6. #6
    Rift Disciple chuckySTAR's Avatar
    Join Date
    Feb 2011
    Posts
    152
    Vince
    GAME OVER
    WORLD FIRST PRE NERFZ REGULOS

  7. #7
    ETI
    ETI is offline
    Rift Disciple
    Join Date
    Mar 2011
    Posts
    175

    Default

    gj, that was fast
    Jozy
    The one and only.

  8. #8
    Rift Chaser Lifeismystery's Avatar
    Join Date
    Dec 2010
    Posts
    341

    Default

    Quote Originally Posted by chuckySTAR View Post
    Thank you

  9. #9
    Ascendant Gilgad's Avatar
    Join Date
    Nov 2014
    Posts
    1,705

    Default

    Rift meter used to view for me as:

    10000 dps ----- Not
    10,000 dps

    Then I updated rift meter and it's showing the comma for everything and can't figure out how to turn it off, it's throwing me off bad haha, any idea how to change it?

    Previously:



    Currently after updating:



    Comma's everywhere!
    Last edited by Gilgad; 11-11-2015 at 12:04 AM.

  10. #10
    Telaran
    Join Date
    May 2014
    Posts
    84

    Default

    Quote Originally Posted by Gilgad View Post
    Snip
    Delete comma after 1 at line 221 in Utilities
    Code:
    local formatted = str:reverse():gsub("(%d%d%d)","%1,"):reverse()

  11. #11
    Ascendant Gilgad's Avatar
    Join Date
    Nov 2014
    Posts
    1,705

    Default

    Quote Originally Posted by Leitsha View Post
    Delete comma after 1 at line 221 in Utilities
    Code:
    local formatted = str:reverse():gsub("(%d%d%d)","%1,"):reverse()
    I did this but now the damage doesn't show correctly:


+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts