public void StealInsurance(StealInsuranceClientData data)
        {
            _rightsManager.CheckRole(AccountRole.Admin);

            var loserAccount    = UserContext.Accounts.GetOrFail(data.Loser);
            var receiverAccount = UserContext.Accounts.GetOrFail(data.Receiver);

            Try.Condition(receiverAccount.EffectiveLevel <= loserAccount.EffectiveLevel,
                          "Ваша страховка лучше, чем у жертвы");

            Try.Condition(loserAccount.Insurance != InsuranceType.None,
                          $"У пользователя {loserAccount.Login} нет страховки");

            receiverAccount.InsuranceHidden = true;
            SetInsuranceHolder_Checked(receiverAccount, loserAccount.InsuranceLevel, loserAccount.Insurance, true);
            RemoveInsuranceHolder(loserAccount.Login);
        }
Beispiel #2
0
 public IHttpActionResult StealInsurance(StealInsuranceClientData data)
 {
     UserContext.Insurances.StealInsurance(data);
     return(Ok());
 }