|
@@ -129,7 +129,8 @@ namespace Kitty_Fall.Apis.Business.Game
|
|
|
var rewardUnit = rewardLog?.RewardUnit ?? attempt.RewardUnit ?? "";
|
|
var rewardUnit = rewardLog?.RewardUnit ?? attempt.RewardUnit ?? "";
|
|
|
if (string.IsNullOrWhiteSpace(rewardType) && attempt.AwardedScore > 0)
|
|
if (string.IsNullOrWhiteSpace(rewardType) && attempt.AwardedScore > 0)
|
|
|
{
|
|
{
|
|
|
- // Level thuong khong co reward option van phai hien thi diem base da cong.
|
|
|
|
|
|
|
+ // Level thuong khong random reward option van phai hien thi
|
|
|
|
|
+ // SCORE game da duoc server cong khi pass level.
|
|
|
rewardType = "SCORE";
|
|
rewardType = "SCORE";
|
|
|
rewardValue = attempt.AwardedScore;
|
|
rewardValue = attempt.AwardedScore;
|
|
|
rewardUnit = "POINT";
|
|
rewardUnit = "POINT";
|
|
@@ -306,6 +307,7 @@ namespace Kitty_Fall.Apis.Business.Game
|
|
|
msisdn = msisdn,
|
|
msisdn = msisdn,
|
|
|
picture = account.Picture ?? "",
|
|
picture = account.Picture ?? "",
|
|
|
totalTurn = totalTurn,
|
|
totalTurn = totalTurn,
|
|
|
|
|
+ // Point hien thi trong game chinh la SCORE dung cho xep hang.
|
|
|
totalPoint = currentScore.Value
|
|
totalPoint = currentScore.Value
|
|
|
},
|
|
},
|
|
|
items = items,
|
|
items = items,
|
|
@@ -754,16 +756,16 @@ namespace Kitty_Fall.Apis.Business.Game
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var clientScore = ClampScore(request.score, MaxAttemptScore);
|
|
var clientScore = ClampScore(request.score, MaxAttemptScore);
|
|
|
- var awardedScore = clientScore > session.TotalScore
|
|
|
|
|
- ? clientScore - session.TotalScore
|
|
|
|
|
- : clientScore;
|
|
|
|
|
- if (awardedScore <= 0) awardedScore = levelConfig.BaseScore;
|
|
|
|
|
- awardedScore = Math.Min(awardedScore, MaxAttemptScore);
|
|
|
|
|
|
|
+ // Score game do server cap theo BASE_SCORE cau hinh; clientScore chi
|
|
|
|
|
+ // luu de doi soat, khong dung lam so diem cong vao ranking.
|
|
|
|
|
+ long awardedScore = Math.Max(0, levelConfig.BaseScore);
|
|
|
|
|
|
|
|
GameLevelRewardOption? rewardOption = null;
|
|
GameLevelRewardOption? rewardOption = null;
|
|
|
if (levelConfig.IsMilestone == true)
|
|
if (levelConfig.IsMilestone == true)
|
|
|
{
|
|
{
|
|
|
- // Chi level duoc danh dau IS_MILESTONE moi random 1 trong cac option thuong.
|
|
|
|
|
|
|
+ // Level moc (5/10/15/...) chi nhan dung 1 trong 3 loai thuong
|
|
|
|
|
+ // DATA/LOYALTY/SCORE. Khong cong them score client tai level moc.
|
|
|
|
|
+ awardedScore = 0;
|
|
|
var rewardOptions = await dbContext.GameLevelRewardOptions.AsNoTracking()
|
|
var rewardOptions = await dbContext.GameLevelRewardOptions.AsNoTracking()
|
|
|
.Where(x => x.ModeId == mode.ModeId && x.LevelNo == levelNo.Value && x.Status != false)
|
|
.Where(x => x.ModeId == mode.ModeId && x.LevelNo == levelNo.Value && x.Status != false)
|
|
|
.OrderByDescending(x => x.IsDefault == true)
|
|
.OrderByDescending(x => x.IsDefault == true)
|
|
@@ -848,7 +850,6 @@ namespace Kitty_Fall.Apis.Business.Game
|
|
|
rewardScoreDelta = (long)rewardOption.RewardValue;
|
|
rewardScoreDelta = (long)rewardOption.RewardValue;
|
|
|
session.TotalRewardScore += rewardScoreDelta;
|
|
session.TotalRewardScore += rewardScoreDelta;
|
|
|
session.TotalScore = ClampScore(session.TotalScore + rewardScoreDelta, MaxTotalScore);
|
|
session.TotalScore = ClampScore(session.TotalScore + rewardScoreDelta, MaxTotalScore);
|
|
|
- responsePoint = FormatPrizeValue(rewardOption.RewardValue);
|
|
|
|
|
|
|
|
|
|
dbContext.GameScoreLedgers.Add(new GameScoreLedger
|
|
dbContext.GameScoreLedgers.Add(new GameScoreLedger
|
|
|
{
|
|
{
|
|
@@ -875,8 +876,8 @@ namespace Kitty_Fall.Apis.Business.Game
|
|
|
}
|
|
}
|
|
|
else if (string.Equals(rewardOption.RewardType, "LOYALTY", StringComparison.OrdinalIgnoreCase))
|
|
else if (string.Equals(rewardOption.RewardType, "LOYALTY", StringComparison.OrdinalIgnoreCase))
|
|
|
{
|
|
{
|
|
|
- session.TotalLoyalty += rewardOption.RewardValue;
|
|
|
|
|
- responsePoint = FormatPrizeValue(rewardOption.RewardValue);
|
|
|
|
|
|
|
+ // LOYALTY la point cua he thong ngoai game. Chi tao reward log
|
|
|
|
|
+ // de worker cong ben ngoai va luu lich su, khong cong vao score/ranking.
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
var waitWorkerPayout = string.Equals(rewardOption.RewardType, "DATA", StringComparison.OrdinalIgnoreCase)
|
|
var waitWorkerPayout = string.Equals(rewardOption.RewardType, "DATA", StringComparison.OrdinalIgnoreCase)
|
|
@@ -1252,8 +1253,8 @@ namespace Kitty_Fall.Apis.Business.Game
|
|
|
return (rewardType ?? "").ToUpperInvariant() switch
|
|
return (rewardType ?? "").ToUpperInvariant() switch
|
|
|
{
|
|
{
|
|
|
"DATA" => string.IsNullOrWhiteSpace(rewardUnit) ? "MB 5G" : $"{rewardUnit} 5G",
|
|
"DATA" => string.IsNullOrWhiteSpace(rewardUnit) ? "MB 5G" : $"{rewardUnit} 5G",
|
|
|
- "LOYALTY" => "Points",
|
|
|
|
|
- "SCORE" => "Scores",
|
|
|
|
|
|
|
+ "LOYALTY" => "LOYALTY",
|
|
|
|
|
+ "SCORE" => "SCORE",
|
|
|
"MONEY" => string.IsNullOrWhiteSpace(rewardUnit) ? "MMK" : rewardUnit,
|
|
"MONEY" => string.IsNullOrWhiteSpace(rewardUnit) ? "MMK" : rewardUnit,
|
|
|
_ => rewardUnit ?? ""
|
|
_ => rewardUnit ?? ""
|
|
|
};
|
|
};
|