Example #1
0
        private async Task CheckCurrencyAchievementUnlocksAsync(TransactionResponse response)
        {
            if (response.Receiver.Id == AppProps.Currency.BankId)
            {
                return;
            }
            var achievements          = achievementService.GetAchievement(AchievementIds.CurrencyId);
            var totalReceiverCurrency = response.Receiver.Currency + response.Amount;

            if (totalReceiverCurrency >= 1000000000)
            {
                await achievementService.UnlockUpToRankAsync(achievements, (ulong)response.Receiver.Id, 4);

                return;
            }
            if (totalReceiverCurrency >= 1000000)
            {
                await achievementService.UnlockUpToRankAsync(achievements, (ulong)response.Receiver.Id, 3);

                return;
            }
            if (totalReceiverCurrency >= 125000)
            {
                await achievementService.UnlockUpToRankAsync(achievements, (ulong)response.Receiver.Id, 2);

                return;
            }
            if (totalReceiverCurrency >= 50000)
            {
                await achievementService.UnlockUpToRankAsync(achievements, (ulong)response.Receiver.Id, 1);

                return;
            }
            if (totalReceiverCurrency >= 10000)
            {
                await achievementService.UnlockUpToRankAsync(achievements, (ulong)response.Receiver.Id, 0);

                return;
            }
        }