WaaaghBar

25 - Display Rank and Renown Rank in xp and rp labels

This tiny modification adds current rank and renown rank in xp label and rp label.

Modified labels will look like these:
 R:19 123456/234567 (52.63%)
 RR:16 4567/9876 (64.24%)

=== Patch ===

In WaaaghBar_Stats.lua change OnPlayerRenownUpdated and OnPlayerExperienceUpdated as follow (will provide a diff if requested, but I don't think it's necessary) :)

 function Stats.OnPlayerRenownUpdated()
     local curRenownRank   = GameData.Player.Renown.curRank
     local curRenownEarned = GameData.Player.Renown.curRenownEarned
     local curRenownNeeded = GameData.Player.Renown.curRenownNeeded
     local curRenownPrcent = curRenownEarned / curRenownNeeded * 100
     Stats.Rnw:SetText(towstring(string.format("RR %i: %i / %i (%.2f%%)", curRenownRank, curRenownEarned, curRenownNeeded, curRenownPrcent)))
 end
 
 function Stats.OnPlayerExperienceUpdated()
     local curRank   = GameData.Player.level
     local curExperienceEarned = GameData.Player.Experience.curXpEarned
     local curExperienceNeeded = GameData.Player.Experience.curXpNeeded
     local curExperiencePrcent = curExperienceEarned / curExperienceNeeded * 100
     Stats.Exp:SetText(towstring(string.format("R %i: %i / %i (%.2f%%)", curRank, curExperienceEarned, curExperienceNeeded, curExperiencePrcent)))
 end

User When Change
Elder82 Thu, 09 Oct 2008 08:29:03 Changed description:
  This tiny modification adds current rank and renown rank in xp label and rp label.

  Modified labels will look like these:
-  R:19 123456/234567
+  R:19 123456/234567 (52.63%)
-  RR:16 4567/9876
+  RR:16 4567/9876 (64.24%)
  === Patch ===
Elder82 Thu, 09 Oct 2008 08:26:37 Create

You must login to post a comment. Don't have an account? Register to get one!

  • 8 comments
  • Avatar of Elder82 Elder82 Sun, 26 Oct 2008 10:44:51

    I was thinking about tooltips: I wanted to give different tooltips to the two elements in Stats module, but I can't find a way. WindowRegisterCoreEventHandler(Stats.Exp.name, "OnMouseOver", "WaaaghBar.Stats.OnXpMouseOver") does not seem to work. :(

    Adding the tooltip to the module gives the same tooltip for xp and rp, so we should put in the same tooltip informations about xp (eg, rested xp) and rp (rank and title): I don't really like this... :(

    Have anybody found a way to do this, apart from creating two separate modules?

  • Avatar of Killbert Killbert Sat, 25 Oct 2008 17:16:04

    Note for Ben Logan:
    I don't think your function is returning the right result. Your example shows the user with rank 23 and 3.64% into rank 24. It then shows the person having a rank of 23.4. I believe that should be 23.04 as 3.64% in decimal is 0.0364

    I changed the function to this instead:

    function Stats.OnPlayerRenownUpdated()
    	local curRenownEarned = GameData.Player.Renown.curRenownEarned
    	local curRenownNeeded = GameData.Player.Renown.curRenownNeeded
    	local curRenownPrcent = curRenownEarned / curRenownNeeded * 100
    	local curRenownRankPoint  = GameData.Player.Renown.curRank + (curRenownEarned / curRenownNeeded)
    	Stats.Rnw:SetText(towstring(string.format("%i / %i (%.2f%%) - RR:%.2f", curRenownEarned, curRenownNeeded, curRenownPrcent, curRenownRankPoint)))
    end
    

    This would give 23.04.

  • Avatar of phliptrip phliptrip Wed, 22 Oct 2008 16:57:28

    I'd love to see this added soon.

  • Avatar of encaitar encaitar Tue, 21 Oct 2008 21:36:14

    Didn't like the rank taking up space in the bar itself, so made a tooltip. This also gives the renown rank title (this is your default title if you do not select another).

    Add to Stats.Intialize ...

    WindowRegisterCoreEventHandler(Stats.Waaagh.name, "OnMouseOver", "WaaaghBar.Stats.OnMouseOver")
    

    And add the function ...

    function Stats.OnMouseOver()
    	local curTitle = GameData.Player.Renown.curTitle
    	local curRank = GameData.Player.Renown.curRank
    
    	Tooltips.CreateTextOnlyTooltip( WaaaghBar.Stats.Waaagh.name )
    	Tooltips.AnchorTooltip( Tooltips.ANCHOR_WINDOW_BOTTOM )
    Tooltips.SetTooltipText( 1, 1, curTitle )
    	Tooltips.SetTooltipText( 2, 1, towstring(string.format("Renown Rank: %i", curRank)))
    	
    	Tooltips.Finalize()
    end
    
  • Avatar of benlogan benlogan Mon, 13 Oct 2008 07:14:52

    To fix the percentage etc not being changed, all you have to do is widen it. The initial value of 200 isnt enuff.

    Open up WaaghBar_Stats.lua and at lines 5 & 6you should fine this

    Stats.Exp = Stats.Waaagh:NewElement("Exp", 230, L"Exp", { r = 255, g = 255, b = 255 }, 00052)
    Stats.Rnw = Stats.Waaagh:NewElement("Rnw", 230, L"Rnw", { r = 255, g = 255, b = 255 }, 00045)
    <</code>>\\
    Where mine says 230, yours should say 200..I found 230 to be sufficient.
    
    Also I noticed another user wanting the percentage to be tacked onto his realm rank i.e. Being 20% to rank 24, so his RR would display as 23.20.
    
    This is my WaaghBar_Stats section, slightly different to the one originally posted here.
    
    <<code>>
    function Stats.OnPlayerRenownUpdated()
    	local curRenownEarned = GameData.Player.Renown.curRenownEarned
    	local curRenownNeeded = GameData.Player.Renown.curRenownNeeded
    	local curRenownRank = GameData.Player.Renown.curRank
    	local curRenownPrcent = curRenownEarned / curRenownNeeded * 100
    	local curRenownPoint = Stats.Convert(curRenownPrcent)
    	Stats.Rnw:SetText(towstring(string.format("%i / %i (%.2f%%) - RR%i.%i", curRenownEarned, curRenownNeeded, curRenownPrcent, curRenownRank, curRenownPoint)))
    end
    
    function Stats.Convert(num)
    	return math.ceil(num - .5)
    end
    

    Just add the new function (Stats.Convert) below the OnPlayerRenownUpdated function.

    Should like something like this

    http://farm4.static.flickr.com/3051/2937656576_a268da9a3e.jpg?v=0

  • Avatar of debichu debichu Sun, 12 Oct 2008 20:44:01

    Super! Thanks, it works flawlessly!

  • Avatar of Elder82 Elder82 Sun, 12 Oct 2008 09:53:05

    ops, that depends on the fact that the width of each module is currently fixed, stated at module creation. To enlarge it, go at the beginning of the same file (WaaaghBar_Stats.lua), lines 5-6, in function Stats.Initialize(), and change the first number inside the two calls to Stats.Waaagh:NewElement to a bigger size (it is the second parameter of the function call, the one between "Exp" and L"Exp") ^_^

    I did not really noticed that, probably because when I tested it I had smaller numbers for xp :P

    Hope in the future the size of an element will be variable size... but currently I don't know how to do that :(

  • Avatar of debichu debichu Sun, 12 Oct 2008 01:42:56

    Nice little thing.
    Except. It's not completely showing percentage.
    Screenshot: http://img520.imageshack.us/img520/3214/78074564hs1.jpg

    Is it me who needs to adjust the width used by these two (if so, how?) or is this little "patch" not complete?

  • 8 comments

Facts

Last updated on
25 Oct 2008
Reported on
09 Oct 2008
Status
New - Issue has not had initial review yet.
Type
Patch - Source code patch for review
Priority
Medium - Normal priority.

Reported by

Possible assignees

Votes (Total: +16, Average: +2.7)