-
Notifications
You must be signed in to change notification settings - Fork 792
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tidy up the way experience/character levels are handled #6404
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should go even further
- remove
_pNextExper
- change
AddPlrExperience
to a member function ofPlayer
- change
_pExperience
to private (like_pLevel
)
I haven't implemented this as when I went to do the refactor I realised there were more assignments to _pExperience that didn't want to change the character level than there were which did. It didn't really add any benefit. For reference the writes to experience:
The last two uses went through AddPlrExperience anyway, the only potential improvement would've been for the debug command. |
Oh, just realised why the demo is failing even after a rebase. The demo save file has _pMaxLevel set to 2, _pLevel is 3. I'm assuming the player's maxLevel stat was reset when the player struct was packed and unpacked (when starting the game?), then the player leveled up twice. A dodgy "fix" would be to set _pMaxLevel to _pLevel - 1 when saving but we can probably just skip it without harm as well. |
This could be done with calling
This could be done with calling
I'm not sure if this check is needed anymore. Do we want to prevent in-memory modifications?
This could also be combined in a Context: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, only some minor nits/questions left. 🙂
We could make
Need to bypass the power levelling cap, this would need a debug-only flag for only that call site.
Probably not, I ended up removing the clevel check in IsNetPlayerValid because it was no longer needed for that purpose. I couldn't see any other reason for that behaviour in ValidatePlayer though so figured it was safer to leave it there. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm 🙂
This PR can be closed if we don't want to include this change in 1.5.1, #6399 includes all these changes and is already rebased on development. |
Prep work for loading experience thresholds from an external source.
The getter/setter really blows out the diff but this was mainly in response to the code paths that unpacked player data and only set
_pLevel
, relying on_pNextExper
getting set inInitPlayer()
.