Repository navigation
fix: persist character playtime and handle the native played command - #1086
Merged
evrydayjunglist merged 5 commits intoNov 18, 2026
Merged
Conversation
3 of 9 tasks
evrydayjunglist
previously approved these changes
Nov 18, 2026
Collaborator
There was a problem hiding this comment.
Thanks, this is a clean fix. I pushed one small commit on top (7998164):
- Reply text now matches the client's own string, BackendErrors
PlayedTime("You have played for {0}."), with singular units ("1 day", "1 minute"). - The 30 s checkpoint no longer writes inside
lock (sessions), which every player's tick takes: the write took about 16 ms for a 400-item character, so other players' ticks waited behind it. It now locks only that character's session. Saveuses the current valueChangeModuleDatapasses in instead of reading the whole save again, andEndremoves the session before saving, so a failed write can't keep a closed connection in the dictionary.
Checks on the merged tree with current main (0fd21fc): build clean, Data 43, Core 443, Gateway 595/596. The one failure is a Delve level-generation test that needs game files and doesn't touch this PR. Live on the regular client with typed input: /played arrives as 0x16 command 2 (not chat), the time carries across an area change and a relog, offline time is not counted, and /remaining still falls through to the Gateway.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
The player-reported
/playedcommand has no counter on main, and the client's normal command is not chat:ShowTimePlayedsends C2S0x16, command2. Commands now handles that packet and the chat/tool route, and stores online seconds per character in module data. Time is checkpointed every 30 seconds while ticking and flushed on area departure, disconnect and module unload. Area changes and module reload do not reset or double-credit time; offline time is excluded. Controlled bots are excluded.Existing saves start this counter at zero: past playtime was never recorded and cannot be recovered. An abrupt process termination may lose the uncheckpointed tail. Paused simulation does not run periodic checkpoints; elapsed connected time is included on the next checkpoint or normal departure.
Two Gateway tests exercise the real module event/command dispatch, deterministic checkpoints, repeated enter/leave calls, offline gaps, replacement module ownership and preservation of unrelated character data. No schema, framework behavior or client archive changes are required.
Player feedback audit
Source: the Discord Various bugs player report, including its November 16 update. This PR fixes the confirmed, uncovered
/playeddefect. It does not claim that the entire report has been reproduced or resolved. The open-PR list was refreshed before publication; no competing/playedimplementation was found.a2q6-HelenaInTown, followed by reward offer 13 through row 155. Rescuing Helena and retrieving the Gem are distinct flags.NpcCatalog.AutomaticContextSupported; bench crafting does not complete that tutorial chain.BeginDelve()and routes entry toDelve_Hubat its waypoint. This contradicts an explanation that the option has no handler at all./playedPlacedSkillsalready contains Fire Trap hit/burning ground and Skitterbot triggering/rearm paths; reservation/summon regressions pass.Layer
Module:
Modules/Core/Player/Commands. Gateway regression tests reference the existing Commands module project. The only documentation additions describe the native packet and current support.Issue
Player feedback from the Discord thread above; no new issue created.
Checks
main:3a6cb35d507c79ee9fc4cd74f19467a69cef8346a8591e766c5b25fb7f74e9370011d7b0da6b48cedotnet build GameServer.slnx -c Release: 0 warnings, 0 errors.git diff --check, upstream reviewer-warning and docs scans: no findings.The diagnostic mod was kept outside the commit and removed from the runtime mod folder. The isolated client and servers have been stopped. Game files, accounts, logs and local diagnostic fixtures are not part of this PR.
For the reviewer
sql/.github/CODEOWNERS:tests/GameServer.Gateway.Tests/GameServer.Gateway.Tests.csprojadds a reference to the existing Commands module, without a package or new project. Maintainer review is required.