What's new
  • Visit Rebornbuddy
  • Visit Resources
  • Visit API Documentation
  • Visit Downloads
  • Visit Portal
  • Visit Panda Profiles
  • Visit LLamamMagic

[Fix] Total XP Gained and XP/HR

Deathshiver

Member
Joined
Nov 2, 2012
Messages
119
Reaction score
1
I've been doing some personal debugging and investigating of Trinity's incorrect display of experience information in the RunStats log. After some testing, I have found that occasionally Trinity's measure of Trinity.Player.ParagonExperienceNextLevel (dubbed as LastXP) defaults to 0. This variable is important for recognizing the amount of experience you had at the last time Trinity checked -- therefore when it defaults to 0 it assumes that you have recently gained ALL of the experience that you currently have. To put this into plain English, it means that experience you have already earned can be double counted (and this can happen many times; in fact my tests revealed it to happen 16 times in 50 minutes). The following line on Items\ItemHandling.cs is what applies the faulty XP information to your total:

Code:
TotalXP += Trinity.Player.ParagonCurrentExperience - LastXP;

The exact cause of LastXP being defaulted to 0 is currently unclear. While it appears to happen most often after using a waypoint, I have observed this occuring in normal combat.

That said, there was another way to approach the problem which currently does NOT appear to be bugged: To use experience deficit to count total experience gained. Unliked checking the CurrentExperience, Trinity.Player.ParagonExperienceNextLevel (dubbed NextLevelXP) never appeared to deviate from expected values during my tests. Below is the results of my most recent T1 Rift run, which I manually recorded my experience and compared, the fixed Trinity was 100% accurate. For fun, I had the log also record the number of errors detected in the values. As you will see at the end, the code WOULD have incorrectly given hundreds of millions of experience 16 times, but was instead completely accurate because I was using deficits.

Code:
===== Misc Statistics =====
Total tracking time: 0h 50m 50s
Total deaths: 0 [0 per hour]
Total games (approx): 3 [3.53999996185303 per hour]
Total XP gained: 386.320007324219 million [455.910003662109 million per hour]
Total Gold gained: 784.840026855469 Thousand [926.219970703125 Thousand per hour]

TimesLastError=16; TimesNextError=0

To apply the fix, please change the following:



Link: Patch (Diff)

Find in Items\ItemHandling.cs
Code:
                    else
                    {
                        if (!(TotalXP == 0 && LastXP == 0 && NextLevelXP == 0))
                        {
                            if (LastXP > Trinity.Player.ParagonCurrentExperience)
                            {
                                TotalXP += NextLevelXP;
                            }
                            else
                            {
                                TotalXP += Trinity.Player.ParagonCurrentExperience - LastXP;
                            }
                        }
                        LastXP = Trinity.Player.ParagonCurrentExperience;
                        NextLevelXP = Trinity.Player.ParagonExperienceNextLevel;
                    }

Replace:
Code:
                    else
                    {
                        if (!(TotalXP == 0 && LastXP == 0 && NextLevelXP == 0))
                        {
                            // We have leveled up
                            if (NextLevelXP < Trinity.Player.ParagonExperienceNextLevel)
                            {
                                TotalXP += NextLevelXP + Trinity.Player.ParagonCurrentExperience;
                            }
                            else // We have not leveled up
                            {
                                TotalXP += NextLevelXP - Trinity.Player.ParagonExperienceNextLevel;
                            }
                        }
                        LastXP = Trinity.Player.ParagonCurrentExperience;
                        NextLevelXP = Trinity.Player.ParagonExperienceNextLevel;
                    }


P.S. Let me know if this doesn't fix it. All of my tests indicated the information was now correct, but I'm just one person with limited testing time.
 
Last edited:
Not working. Paragon lvl 549

Total XP gained: -1241,6 million [-7478,11 million per hour]

edit: nvm works ty!
 
Last edited:
Not working. Paragon lvl 549

Total XP gained: -1241,6 million [-7478,11 million per hour]

edit: nvm works ty!

Glad to hear you got it working. Theoretically speaking it shouldn't be possible to be negative, since the if-condition stops any potential negative results. I would assume in this instance it was a minor error when you changed the code somewhere, but if more people happen to get this result I can add an additional check.
 
Added in next Trinity

If it's broken i'm blaming you :D
 
Ok. It's broken again:

===== Misc Statistics =====
Total tracking time: 0h 23m 25s
Total deaths: 0 [0 per hour]
Total games (approx): 0 [0 per hour]
(your games left value may be bugged @ 0 due to profile managers/routines etc., now showing games joined instead:)
Total games joined: 23 [58,92 per hour]
Total XP gained: 566,95 million [1452,5 million per hour]
Total Gold gained: 2866,22 Thousand [7343,1 Thousand per hour]

23mins, working great....

then next log:

===== Misc Statistics =====
Total tracking time: 0h 26m 52s
Total deaths: 0 [0 per hour]
Total games (approx): 0 [0 per hour]
(your games left value may be bugged @ 0 due to profile managers/routines etc., now showing games joined instead:)
Total games joined: 27 [60,27 per hour]
Total XP gained: -802,15 million [-1790,48 million per hour]
Total Gold gained: 3233,39 Thousand [7217,29 Thousand per hour]
 
Ok. It's broken again:

23mins, working great....

then next log:

Did you make sure to copy the entire block and not individual lines?

The only conceivable reason I can think this would happen is

Code:
TotalXP += NextLevelXP - Trinity.Player.ParagonExperienceNextLevel;

Because it is the only subtraction there, however you'll notice it's in the else portion of the if which states

Code:
if (NextLevelXP < Trinity.Player.ParagonExperienceNextLevel)
{
...
}
else
{
    TotalXP += NextLevelXP - Trinity.Player.ParagonExperienceNextLevel;
}
 
Last edited:
Yea, want to upload yours so i can test? but i'm pretty sure i did it right
 
===== Misc Statistics =====
Total tracking time: 0h 38m 33s
Total deaths: 0 [0 per hour]
Total games (approx): 0 [0 per hour]
(your games left value may be bugged @ 0 due to profile managers/routines etc., now showing games joined instead:)
Total games joined: 39 [60,7 per hour]
Total XP gained: 936,7 million [1457,82 million per hour]
Total Gold gained: 4716,47 Thousand [7340,38 Thousand per hour]

well i reset it and mines working now, but duno why sometimes it gets negative..
 
I'll run it for several hours tonight and see if I can reproduce this issue. Would like to see more people report on how it's working for them. Make sure to try the latest svn version.
 
Was working til 1min ago, accurate xp/hr, now its way wrong:

===== Misc Statistics =====
Total tracking time: 1h 20m 11s
Total deaths: 0 [0 per hour]
Total games (approx): 0 [0 per hour]
(your games left value may be bugged @ 0 due to profile managers/routines etc., now showing games joined instead:)
Total games joined: 80 [59,86 per hour]
Total XP gained: 3394,65 million [2540,13 million per hour]
Total Gold gained: 9932,75 Thousand [7432,43 Thousand per hour]

giving 1b more than im rly getting
 
Did anything in particular happen around when you noticed the jump? Level up perhaps?
 
Anyone else getting this when they level? I leveled once in my tests and this didn't happen, it might depend on some condition.
 
It fixed itself now lol
===== Misc Statistics =====
Total tracking time: 1h 52m 32s
Total deaths: 0 [0 per hour]
Total games (approx): 0 [0 per hour]
(your games left value may be bugged @ 0 due to profile managers/routines etc., now showing games joined instead:)
Total games joined: 113 [60,24 per hour]
Total XP gained: 2760,8 million [1471,82 million per hour]
Total Gold gained: 13924,17 Thousand [7423,17 Thousand per hour]
duno wats happening
 
Running bot now, will update with new developments. I've added debug code to watch for any and all scenarios that jump the experience higher or apply any negative value at all.

Edit: Still nothing unusual. It has even leveled up normally.

Edit: Getting close to 3 hours, still no abnormalities. Are you sure you installed it right?

Code:
Total tracking time: 2h 36m 56s
Total XP gained: 1023.85 million [391.41 million per hour]
 
Last edited:
Back
Top