Consolidation
This commit is contained in:
@@ -377,6 +377,7 @@ public class StoryService : IStoryService
|
||||
// Load viewer with all collections RewardGrantService might mutate. Split-query
|
||||
// to avoid the cartesian-explode pitfall (CLAUDE.md "EF split query").
|
||||
var viewer = await _db.Viewers
|
||||
.Include(v => v.Cards).ThenInclude(c => c.Card)
|
||||
.Include(v => v.Sleeves)
|
||||
.Include(v => v.Emblems)
|
||||
.Include(v => v.LeaderSkins)
|
||||
@@ -388,10 +389,11 @@ public class StoryService : IStoryService
|
||||
|
||||
foreach (var r in chapter.Rewards)
|
||||
{
|
||||
GrantedReward granted;
|
||||
IReadOnlyList<GrantedReward> granted;
|
||||
try
|
||||
{
|
||||
granted = _rewards.Apply(viewer, (UserGoodsType)r.RewardType, r.RewardDetailId, r.RewardNumber);
|
||||
granted = await _rewards.ApplyAsync(
|
||||
viewer, (UserGoodsType)r.RewardType, r.RewardDetailId, r.RewardNumber);
|
||||
}
|
||||
catch (NotSupportedException ex)
|
||||
{
|
||||
@@ -407,16 +409,19 @@ public class StoryService : IStoryService
|
||||
// balances (e.g. UserRupyCount = num).
|
||||
// - story_reward_list: deltas. Client (ResultAnimationAgent
|
||||
// .HandleStoryAndMissionRewards) feeds each entry to
|
||||
// AddReward(item) which draws a "+N received" line in
|
||||
// the rewards popup.
|
||||
// Same reward_id, different reward_num. For cosmetics (binary owned/not-owned)
|
||||
// both happen to be 1, so the bug only surfaces on currency rewards.
|
||||
resp.RewardList.Add(new RewardGrant
|
||||
// AddReward(item) which draws a "+N received" popup line.
|
||||
// ApplyAsync may return 1+N entries (Card grants cascade into cosmetics). All
|
||||
// post-state entries go into reward_list; story_reward_list only gets the
|
||||
// top-level mission row's delta (cascade cosmetics have no corresponding row).
|
||||
foreach (var g in granted)
|
||||
{
|
||||
RewardType = granted.RewardType.ToString(),
|
||||
RewardId = granted.RewardId.ToString(),
|
||||
RewardNum = granted.RewardNum.ToString(),
|
||||
});
|
||||
resp.RewardList.Add(new RewardGrant
|
||||
{
|
||||
RewardType = g.RewardType.ToString(),
|
||||
RewardId = g.RewardId.ToString(),
|
||||
RewardNum = g.RewardNum.ToString(),
|
||||
});
|
||||
}
|
||||
resp.StoryRewardList.Add(new RewardGrant
|
||||
{
|
||||
RewardType = ((int)r.RewardType).ToString(),
|
||||
|
||||
Reference in New Issue
Block a user