fix(game): show granted/bought hints in-game — finish the D31 wire removal
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 10s
CI / integration (pull_request) Successful in 19s
CI / ui (pull_request) Successful in 1m11s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m58s
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 10s
CI / integration (pull_request) Successful in 19s
CI / ui (pull_request) Successful in 1m11s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m58s
The in-game hint badge ignored the payments hint wallet: loading a game clobbered app.profile.hintBalance with the deprecated StateView.wallet_balance (zeroed in the D31 domain removal but left in the protocol as a dead 0, then synced over the real balance at game load). Finish the removal honestly. StateView carries the per-game allowance alone (hints_remaining); the purchasable wallet lives solely on the profile and the client adds it (lib/hints). Removed StateView.wallet_balance across every layer — backend StateView/DTO, notify.PlayerState (live events), gateway StateResp + wire.StateView, the client model/codec/mock/localgame — and dropped the now-unused wallet arg from hintsRemaining. The FBS field is tombstoned `(deprecated)` (not deleted) so the vtable slots after it stay stable across a rolling deploy; no accessor is generated. HintResult keeps wallet_balance (the real post-spend payments balance the client adopts into the profile). The StateView type no longer has walletBalance, so the clobber cannot return without a compile error. Tests: hintsRemaining (2-arg); hints.hintsLeft (allowance + live wallet, no strip); the game state/hint integration (allowance-only HintsRemaining); gateway transcode; FBS regen.
This commit is contained in:
+8
-10
@@ -330,12 +330,11 @@ table StateView {
|
||||
bag_len:int;
|
||||
hints_remaining:int;
|
||||
alphabet:[AlphabetEntry];
|
||||
// wallet_balance is the requesting player's global hint-wallet balance, sent apart from
|
||||
// hints_remaining (which folds the wallet in with the per-game allowance) so the client can
|
||||
// separate the two: the per-game allowance remaining is hints_remaining - wallet_balance, and
|
||||
// the wallet is a single global figure the client keeps live across games (added trailing —
|
||||
// backward-compatible).
|
||||
wallet_balance:int;
|
||||
// wallet_balance is deprecated (D31): the purchasable hint wallet moved to the profile (payments),
|
||||
// and hints_remaining now carries the per-game allowance alone. The field is tombstoned rather than
|
||||
// deleted so the vtable slots of the fields after it stay stable across a rolling deploy (an old
|
||||
// SPA served before the deploy must keep reading a new gateway correctly). No accessor is generated.
|
||||
wallet_balance:int (deprecated);
|
||||
// hint_unlock_left_seconds is, for a vs_ai game, how many seconds until the idle hint unlocks
|
||||
// (the robot's last move plus the idle window, computed from the SERVER clock online / the device
|
||||
// clock offline, capped at the window and floored at 0); 0 for a human's first move (no robot move
|
||||
@@ -393,10 +392,9 @@ table ComplaintRequest {
|
||||
note:string;
|
||||
}
|
||||
|
||||
// HintResult is the top-ranked move plus the remaining hint budget. wallet_balance is the
|
||||
// global hint-wallet balance after spending (see StateView.wallet_balance), so the client
|
||||
// refreshes its live wallet and re-derives the per-game allowance (added trailing —
|
||||
// backward-compatible).
|
||||
// HintResult is the top-ranked move plus hints_remaining (the per-game allowance alone) and
|
||||
// wallet_balance (the purchasable hint wallet after spending, from payments). The client adopts
|
||||
// wallet_balance into the profile so the badge stays live across games (see lib/hints).
|
||||
table HintResult {
|
||||
move:MoveRecord;
|
||||
hints_remaining:int;
|
||||
|
||||
@@ -144,18 +144,6 @@ func (rcv *StateView) AlphabetLength() int {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *StateView) WalletBalance() int32 {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(16))
|
||||
if o != 0 {
|
||||
return rcv._tab.GetInt32(o + rcv._tab.Pos)
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (rcv *StateView) MutateWalletBalance(n int32) bool {
|
||||
return rcv._tab.MutateInt32Slot(16, n)
|
||||
}
|
||||
|
||||
func (rcv *StateView) HintUnlockLeftSeconds() int32 {
|
||||
o := flatbuffers.UOffsetT(rcv._tab.Offset(18))
|
||||
if o != 0 {
|
||||
@@ -195,9 +183,6 @@ func StateViewAddAlphabet(builder *flatbuffers.Builder, alphabet flatbuffers.UOf
|
||||
func StateViewStartAlphabetVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
|
||||
return builder.StartVector(4, numElems, 4)
|
||||
}
|
||||
func StateViewAddWalletBalance(builder *flatbuffers.Builder, walletBalance int32) {
|
||||
builder.PrependInt32Slot(6, walletBalance, 0)
|
||||
}
|
||||
func StateViewAddHintUnlockLeftSeconds(builder *flatbuffers.Builder, hintUnlockLeftSeconds int32) {
|
||||
builder.PrependInt32Slot(7, hintUnlockLeftSeconds, 0)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user