Vote Rewards: resolve Steam ID via LivePlayerManager, not naive Steam_ prefix#54
Merged
Merged
Conversation
When granting points (or any future Steam-ID-keyed reward), I was naively returning "Steam_<76digit>" as the player_id. That doesn't match the actual cross-platform id the rest of KC uses, because in 7D2D V 2.x CrossplatformId is "EOS_<32hex>" even for Steam-platform players. Result: every vote-grant created an orphan points_info row that lived alongside the player's real EOS-keyed row instead of merging with it. Caught by Ada in the Points panel — her real NonToxThicc row had 836 points + a recent sign-in; a separate "NonToxThicc" row keyed by Steam_ form held the orphan 100 points from a vote grant. Fix: ResolvePlayerId(steamId) finds the player in LivePlayerManager by matching PlatformId (which IS in Steam_ form) and returns their actual PlayerId (the EOS-form CrossplatformId). Falls back to Steam_<id> with a warning when the player is offline at grant time — that's the only case where we can't map without a persistent Steam-ID → CrossplatformId table, which is its own future card. Common case (vote arrives while the player is online or recently was) now lands on the correct row. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Summary
Bug fix caught by Ada during real testing. Vote-grant rewards were landing on orphan player_id rows instead of merging with the voter's real account.
What was wrong
`DispatchReward` was calling `ToPlayerId(steamId) => $"Steam_{steamId}"` and using that as the points_info / vip_gifts player_id. But:
So every vote-grant created a fresh row keyed by `Steam_` that didn't match the player's real `EOS_` row. Result in Ada's Points panel:
Fix
`ResolvePlayerId(steamId)` does the lookup properly:
The audit row + provider `MarkClaimed` flow is unchanged — only the dispatch step was wrong.
Files
Test plan
What about the existing orphan row?
The 100 misallocated points are still on the orphan row. Ada can either:
Future card worth considering: a one-time migration that walks points_info, finds rows where `id` starts with `Steam_`, looks up if a corresponding `EOS_` row exists for the same player (via `player_metadata` if we wire that), and merges them.
🤖 Generated with Claude Code