fix(tutorial): gift_receive reward_list carries post-state totals, not deltas
The client's PlayerStaticData.UpdateHaveUserGoodsNumByJsonData does direct assignment on each reward_list entry's reward_num, so currency/item totals must be the new viewer balance — not the gift delta. Fresh accounts were seeing their cached crystal/rupy balances clobbered down to the gift counts until the next /load/index. Matches the project_wire_reward_list_post_state memory and the prod capture (which shows 120 rupy = baseline 20 + gift 100).
This commit is contained in:
@@ -81,6 +81,17 @@ public class GiftControllerTests
|
||||
var post = await factory.GetViewerCurrencyAsync(viewerId);
|
||||
Assert.That(post.Crystals - pre.Crystals, Is.EqualTo(400UL));
|
||||
Assert.That(post.Rupees - pre.Rupees, Is.EqualTo(100UL));
|
||||
|
||||
// reward_list carries post-state TOTALS, not deltas, per project_wire_reward_list_post_state.
|
||||
// After claiming gifts, the crystal/rupy entries in reward_list should equal viewer's post-grant totals.
|
||||
var rewardList = root.GetProperty("reward_list").EnumerateArray().ToList();
|
||||
var crystalEntry = rewardList.First(e => e.GetProperty("reward_type").GetString() == "1");
|
||||
var rupyEntry = rewardList.First(e => e.GetProperty("reward_type").GetString() == "9");
|
||||
Assert.That(crystalEntry.GetProperty("reward_num").GetString(),
|
||||
Is.EqualTo(post.Crystals.ToString()),
|
||||
"reward_list currency entries must carry POST-STATE TOTALS, not gift deltas (client does direct assignment).");
|
||||
Assert.That(rupyEntry.GetProperty("reward_num").GetString(),
|
||||
Is.EqualTo(post.Rupees.ToString()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in New Issue
Block a user