|
|
|
@ -47,6 +47,7 @@ namespace Build_God_Api.Services |
|
|
|
public bool IsFromYesterday { get; set; } |
|
|
|
public DateTime AssignedDate { get; set; } |
|
|
|
public int ExpReward { get; set; } |
|
|
|
public int MoneyReward { get; set; } |
|
|
|
public int TodayClaimedCount { get; set; } |
|
|
|
public int TodayTotalCount { get; set; } |
|
|
|
public List<MissionRewardDto> Rewards { get; set; } = new(); |
|
|
|
@ -102,6 +103,18 @@ namespace Build_God_Api.Services |
|
|
|
return coefficient * levelId * levelId * levelId; |
|
|
|
} |
|
|
|
|
|
|
|
private int CalculateMoneyReward(MissionDifficulty difficulty, int levelId) |
|
|
|
{ |
|
|
|
var rate = difficulty switch |
|
|
|
{ |
|
|
|
MissionDifficulty.Normal => 1, |
|
|
|
MissionDifficulty.Hard => 2, |
|
|
|
MissionDifficulty.Purgatory => 3, |
|
|
|
_ => 1 |
|
|
|
}; |
|
|
|
return (int)(100 * rate * (1 + (levelId - 10) * 0.1m)); |
|
|
|
} |
|
|
|
|
|
|
|
private DateTime GetBeijingTime() |
|
|
|
{ |
|
|
|
return TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, BeijingTimeZone); |
|
|
|
@ -158,6 +171,7 @@ namespace Build_God_Api.Services |
|
|
|
IsFromYesterday = dm.IsFromYesterday, |
|
|
|
AssignedDate = dm.AssignedDate, |
|
|
|
ExpReward = CalculateExpReward(mission.Difficulty, character.LevelId), |
|
|
|
MoneyReward = CalculateMoneyReward(mission.Difficulty, character.LevelId), |
|
|
|
TodayClaimedCount = todayClaimedCount, |
|
|
|
TodayTotalCount = todayTotalCount, |
|
|
|
MissionType = mission.Type, |
|
|
|
@ -258,6 +272,10 @@ namespace Build_God_Api.Services |
|
|
|
character.CurrentExp += expReward; |
|
|
|
_logger.LogInformation("角色 {CharacterId} 领取任务奖励:经验 +{ExpReward}", characterId, expReward); |
|
|
|
|
|
|
|
var moneyReward = CalculateMoneyReward(mission.Difficulty, character.LevelId); |
|
|
|
character.Money += moneyReward; |
|
|
|
_logger.LogInformation("角色 {CharacterId} 领取任务奖励:灵石 +{MoneyReward}", characterId, moneyReward); |
|
|
|
|
|
|
|
if (mission.Rewards != null) |
|
|
|
{ |
|
|
|
foreach (var reward in mission.Rewards) |
|
|
|
|