You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* removed redundant PacketSender.SendExperience call
* invert negative for readability.
* refactored logic checks.
* add handle for zero condition.
* Combine redundant checks. One SendExperience call.
* CheckLevelUp making 3 calls to GetExperienceToNextLevel per loop. Create a variable to reduce calls.
* single return check
* Noted two spots where AddLevels zero check is being handled.
* Add handle and documentation to AddLevels
* Refactor summary comment and include the zero handle, removing it from other redundant locations.
* renamed levels variable to amount.
* Added summary comment to SetLevel. Noted redundancy in SetLevel and AddLevels
* Added a boolean to SetLevels that skips the redundant calls when inside the AddLevels while loop. Summary comment updated to reflect.
* Since AddLevels has a built in zero handle now, CheckLevelUp doesn't need to return a bool and be handled outside itself.
* moved the redundant EXP < 0 call in GiveExperience. It can't be negative before checking levelups.
I suppose it's possible the equipment bonus is so far negative, gaining experience takes it away... but then let it be handled in CheckLevelUp instead.
* added summary comments to GetExperienceToNextLevel so it's obvious it returns -1 if Maxlevel is reached.
* add summary comment to CheckLevelUp
* update test to match the new signature
---------
Co-authored-by: lodicolo <pandacoder@pm.me>
/// Sets the player's level to a sepecific value. Then sends all relevent data through <see cref="PacketSender"/>
1243
+
/// </summary>
1244
+
/// <param name="newLevel">Does nothing if less than 1. Clamped to <see cref="Options"/> MaxLevel</param>
1245
+
/// <param name="resetExperience">Unless <paramref name="newLevel"/> is zero, will reset Exp to 0 if true.</param>
1246
+
/// <param name="sendPackets">If set to false, will not send packets or <see cref="RecalculateStatsAndPoints"/> or <see cref="UnequipInvalidItems"/>/></param>
0 commit comments