|
@@ -760,14 +760,18 @@ namespace Kitty_Fall.Apis.Business.Game
|
|
|
if (awardedScore <= 0) awardedScore = levelConfig.BaseScore;
|
|
if (awardedScore <= 0) awardedScore = levelConfig.BaseScore;
|
|
|
awardedScore = Math.Min(awardedScore, MaxAttemptScore);
|
|
awardedScore = Math.Min(awardedScore, MaxAttemptScore);
|
|
|
|
|
|
|
|
- // Level moc random 1 option thuong theo weight; level thuong se khong co option.
|
|
|
|
|
- var rewardOptions = await dbContext.GameLevelRewardOptions.AsNoTracking()
|
|
|
|
|
- .Where(x => x.ModeId == mode.ModeId && x.LevelNo == levelNo.Value && x.Status != false)
|
|
|
|
|
- .OrderByDescending(x => x.IsDefault == true)
|
|
|
|
|
- .ThenByDescending(x => x.Weight)
|
|
|
|
|
- .ThenBy(x => x.RewardOptionId)
|
|
|
|
|
- .ToListAsync();
|
|
|
|
|
- var rewardOption = SelectRewardOption(rewardOptions);
|
|
|
|
|
|
|
+ GameLevelRewardOption? rewardOption = null;
|
|
|
|
|
+ if (levelConfig.IsMilestone == true)
|
|
|
|
|
+ {
|
|
|
|
|
+ // Chi level duoc danh dau IS_MILESTONE moi random 1 trong cac option thuong.
|
|
|
|
|
+ var rewardOptions = await dbContext.GameLevelRewardOptions.AsNoTracking()
|
|
|
|
|
+ .Where(x => x.ModeId == mode.ModeId && x.LevelNo == levelNo.Value && x.Status != false)
|
|
|
|
|
+ .OrderByDescending(x => x.IsDefault == true)
|
|
|
|
|
+ .ThenByDescending(x => x.Weight)
|
|
|
|
|
+ .ThenBy(x => x.RewardOptionId)
|
|
|
|
|
+ .ToListAsync();
|
|
|
|
|
+ rewardOption = SelectRewardOption(rewardOptions);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
var attemptNo = ((await dbContext.GameLevelAttempts.AsNoTracking()
|
|
var attemptNo = ((await dbContext.GameLevelAttempts.AsNoTracking()
|
|
|
.Where(x => x.SessionId == session.SessionId && x.LevelNo == levelNo.Value)
|
|
.Where(x => x.SessionId == session.SessionId && x.LevelNo == levelNo.Value)
|