Jump to content

Change exp label to % with decimals


Austermann
 Share

Recommended Posts

Hey guys

I came to share a way to change the EXP label to % with decimals.
Some players know how anoying and frustrating when you get lv and it's show 315171737819273171312751358109131 of exp to next Lv.
So, i changed that to show in % with decimals, you can change many as you want.
 

How to do that!

Go to: 

Intersect.Client
Interface
Game
EntityPanel
Open EntityBox.cs

Find:  private void UpdateXpBar(float elapsedTime, bool instant = false)


Add:
                var percent = targetExpWidth * 100;
                ExpLbl.Text =  percent == 0 ? $"{percent}%" : $"{percent:0.0000}%";

This one have four number 0 after the first number, like: 0,0000%

I just disabled the:
                 ExpLbl.Text = Strings.EntityBox.expval.ToString(
                     ((Player) MyEntity)?.Experience, ((Player) MyEntity)?.GetNextLevelExperience()
                 );

just putting /* before and */ after
Because if i want to change back, just delete the last 2 lines and enable "ExpLbl.Text" again

Look how it is.
Before:

Spoiler

ae2c0a4f48011e519771164620b2f49e.png


After: 

Spoiler

50977702911dabbe1524dae14b335465.png


Look how it's appear at my game. (the private void)

Spoiler

        private void UpdateXpBar(float elapsedTime, bool instant = false)
        {
            float targetExpWidth = 1;
            if (((Player) MyEntity).GetNextLevelExperience() > 0)
            {
                targetExpWidth = (float) ((Player) MyEntity).Experience /
                                 (float) ((Player) MyEntity).GetNextLevelExperience();

                /*
                 ExpLbl.Text = Strings.EntityBox.expval.ToString(
                     ((Player) MyEntity)?.Experience, ((Player) MyEntity)?.GetNextLevelExperience()
                 );
                */

                var percent = targetExpWidth * 100;
                ExpLbl.Text =  percent == 0 ? $"{percent}%" : $"{percent:0.0000}%";
            }

 

That's it!



 

Link to comment
Share on other sites

This is actually pretty easy to port over to the base engine, if you open a feature request for it (if there isn't one already for it), i could work around it to make it configurable (within the client's config) during this week, that way people won't need to edit the source code but instead, they will be able to simply change a boolean from false to true within the client's config (or game settings -> interface) in order to have this feature :22_stuck_out_tongue_winking_eye: thanks for sharing!

Link to comment
Share on other sites

9 minutes ago, Arufonsu said:

this is actually pretty easy to port over to the base engine, if you open a feature request for it (if there isn't one already for it), i could work around it to make it configurable (within the server's config) during this week, that way people won't need to edit the source code but instead, they will be able to simply change a boolean from false to true within the server's config in order to have this feature :22_stuck_out_tongue_winking_eye: thanks for sharing!

Cool, i can do that ofc.
That's no problem, i know how depressing is see you current exp is low and the exp to next lv is a really astronomic number, that's make me really bored, that's why i make this xD

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...