Bugfix: offlevel reconnect and player count#806
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses critical bugs related to player disconnection and server state management. By ensuring that players are explicitly removed from the GameContext and improving the client-server handshake during disconnection, the server now maintains accurate online counts and prevents unnecessary reconnection attempts. The PR also includes a wide range of maintenance tasks, including documentation updates, code refactoring, and improved test assertions. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request performs extensive code cleanup, refactoring, and documentation updates across the codebase. Key changes include extracting the ResetProgression struct and AppearanceChangedExtendedPlugIn class into separate files, updating unit tests to use modern NUnit constraint-based assertions, and fixing various XML documentation comments. Additionally, minor logic improvements were introduced, such as explicitly removing disconnected players in OfflinePlayerManager to ensure player list consistency. As there are no review comments provided, we have no feedback to offer.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
…nt clean up naturally
… the online list is purged Replace SuppressDisconnectedEvent() in the offline-session handover with a proper close-game logout view call before DisconnectAsync(). Letting the PlayerDisconnected event fire naturally makes GameContext.RemovePlayerAsync run (removing the phantom-online entry), while the close-game packet stops the client from auto-reconnecting. Removes the now-unused Player.SuppressDisconnectedEvent(). Extracted minimal fix from eduardosmaniotto's bugfix/offlevel-reconnect (PR MUnique#806).
|
▎ Heads-up on a data-loss issue I hit with this offline flow: OfflinePlayer attaches the real player's already-tracked Account/Character graph into its own fresh PersistenceContext instead of loading it fresh, which corrupts EF change tracking — so every periodic SaveChangesAsync throws DbUpdateConcurrencyException ("expected 1 row, affected 0") and no offline progress is ever persisted. The result is that the character silently rolls back to its pre-/offlevel state on the next login (also worth disposing the OfflinePlayer on stop, since the connectionless ghost never triggers the game server's disconnect/dispose path). ▎ Fix that worked for me: load the account/character via GetAccountByLoginNameAsync into the offline player's own context (no cross-context Attach), mirroring the normal login. |
Closes #804
Phantom online entries
SuppressDisconnectedEvent() nulled all PlayerDisconnected subscribers, including GameContext.RemovePlayerAsync. Since RemovePlayerAsync is the only place that cleans up _playerList PlayerCounter, and PlayersByCharacterName, the real player leaked as a "phantom online" entry that permanently inflated the online count until server restart.
Client not closing gracefully
DisconnectAsync() just dropped the TCP connection without sending a close-game packet, so the client's auto-reconnect feature kicked in and tried to reconnect immediately.