Skip to content

fix: persist character playtime and handle the native played command - #1086

Merged
evrydayjunglist merged 5 commits into
LocalExile:mainfrom
zj1022:fix/discord-player-feedback-1117
Nov 18, 2026
Merged

evrydayjunglist merged 5 commits into
LocalExile:mainfrom
zj1022:fix/discord-player-feedback-1117

Conversation

@zj1022

@zj1022 zj1022 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

What changes

The player-reported /played command has no counter on main, and the client's normal command is not chat: ShowTimePlayed sends C2S 0x16, command 2. 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 /played defect. It does not claim that the entire report has been reproduced or resolved. The open-PR list was refreshed before publication; no competing /played implementation was found.

Report Current-code / verification result Disposition
1, 2, 8: Shrieker, Inua Totem and Flame Mother range, cadence and damage Open #1031 changes monster shot flight/contact, range and LOS handling; #1040 changes general monster skills, totems and attack execution. These are overlapping work areas, not proof that every reported monster is already fixed. No duplicate patch; no exact-monster native acceptance claimed.
3: Intruders in Black / Greust reward Act2 quest rules contain Fidelitas, Helena and Baleful Gem progression. Greust's NPCTalk 153 requires a2q6-HelenaInTown, followed by reward offer 13 through row 155. Rescuing Helena and retrieving the Gem are distinct flags. Dialogue/data inspected; the player's exact save/progression order was not reproduced. No unconditional reward or flag grant.
4: Safe and Sound QuestStates 1122-1125 use account/league flags 201/202. Helena's Crafting Bench talk uses additional context columns currently excluded by NpcCatalog.AutomaticContextSupported; bench crafting does not complete that tutorial chain. Incomplete tutorial support identified. Exact account-dialogue transition semantics and native end-to-end acceptance remain open; no fabricated completion.
5: Niko's Mine / encampment arrival Delve already handles BeginDelve() and routes entry to Delve_Hub at its waypoint. This contradicts an explanation that the option has no handler at all. Rock overlap, the player's tutorial state and the reported inert interaction remain unconfirmed.
6: Einhar's Menagerie Menagerie NPC placement exists; hideout and Menagerie NPC variants have different talk rows. No full Bestiary tutorial completion path was established in this audit. Partial system; no blanket tutorial completion. Native quest-state reproduction remains open.
7: /played Confirmed missing counter and unhandled native command 2. Fixed here; native and automated checks below.
9: Piety Abomination laser General monster skill execution overlaps #1040; zero beam damage was not reproduced in this session. Deferred overlapping work, not declared fixed.
10: Malachai stops attacking General monster decision/skill execution overlaps #1040. No exact fight reproduction; no duplicate AI patch.
11: PS5 controller load crash No matching controller hardware or crash trace available in this run. Unconfirmed; no speculative packet/input change.
12: Overseer Krow idle General monster execution overlaps #1040. No exact encounter reproduction; no duplicate AI patch.
13: inventory drag to stash rejected, Ctrl-click works #1000 concerns Unique Collection category retention and is not evidence for this generic drag failure. Item, stash tab and cursor/request details are absent. Unconfirmed; not mislabeled as covered by #1000.
14: Stygian Revenant damage/cast rate The original report itself is uncertain; cadence/projectile execution overlaps #1031/#1040. No guessed balance adjustment.
15: Lifetap spends both Life and Mana Existing real-gem-link regression (Tornado Shot + Lifetap) passes: 27 Life paid, Mana remains 1000. Open #1063 is about Lifetap's ailment damage multiplier, a separate issue. Double payment not reproduced in this tested direct-attack case; other skill paths are not ruled out.
16: Fire Trap / possible Skitterbots issue PlacedSkills already contains Fire Trap hit/burning ground and Skitterbot triggering/rearm paths; reservation/summon regressions pass. Source presence and tests do not prove the player's setup works; exact native skill setup remains open.
17: Celestial Tempest MTX Exact cosmetic, equipped slot and affected skill variant are unspecified. Unconfirmed; no speculative asset substitution.
18: Avarius / Innocence idle General monster execution overlaps #1040. No exact encounter reproduction; not declared fixed.
19: Sin missing after Death to Purity Existing QuestEncounterRestore regressions pass for the Act5 Sin spawn, including the eligible peer's own quest state. Covered by existing implementation/tests; the reported save still needs native reproduction.
20: Holy Flame Totem does nothing #1075, integrated by #1079, already added the direct Holy Flame executor on main. Related broader totem work remains open in #794/#975. Do not resubmit the merged basic executor; consecrated-ground completeness and this player's native setup remain open.

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

  • Base commit of main: 3a6cb35d507c79ee9fc4cd74f19467a69cef8346
  • Head commit: a8591e766c5b25fb7f74e9370011d7b0da6b48ce
  • dotnet build GameServer.slnx -c Release: 0 warnings, 0 errors.
  • Core, Data and Gateway full test suites: 443 / 43 / 573 passed, 0 failed, 0 skipped.
  • Focused pre-integration run: 7 passed (two new playtime tests, existing Lifetap, reservation/summon and quest-encounter tests); all are included in the final full Gateway run.
  • Seen in the client: isolated 3.29.3c session. Sent the literal native command-2 packet and received the time chat line; the chat/tool route also responds. Before base integration, area transfer, logout/relogin and Commands reload retained the counter. After integrating the final base, server restart/relogin and command-2/reload checks passed again (19m45s, then 19m46s after reload). No claim of native reproduction for the other report rows above.
  • git diff --check, upstream reviewer-warning and docs scans: no findings.
  • Open PRs refreshed before publication. No related Commands implementation to integrate; no code from another pending PR is included. Combined acceptance with the pending monster/totem PRs has not been run and is not claimed.

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

  • Adds a project, a solution entry or a package
  • Makes a network request, opens a listener or starts a process
  • Adds or changes files under sql/
  • Changes a file listed in .github/CODEOWNERS: tests/GameServer.Gateway.Tests/GameServer.Gateway.Tests.csproj adds a reference to the existing Commands module, without a package or new project. Maintainer review is required.
  • Adds a game-data file or changes what a generator writes

@zj1022
zj1022 requested a review from Wrathen as a code owner November 17, 2026 10:10
@evrydayjunglist evrydayjunglist added the protected-files Touches a CODEOWNERS path, so it needs that path's owner. label Nov 18, 2026

@evrydayjunglist evrydayjunglist left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
  • Save uses the current value ChangeModuleData passes in instead of reading the whole save again, and End removes 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.

@evrydayjunglist
evrydayjunglist merged commit 93c85de into LocalExile:main Nov 18, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

protected-files Touches a CODEOWNERS path, so it needs that path's owner.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants