Exemplo n.º 1
0
        public async void User_Energy_Calculate()
        {
            do
            {
                var profile = await User_PVEQueryProfile();

                IEnumerable <IGrouping <string, ISurvivorX> > survivorslots = await profile.Value.GetSurvivors();

                var points = await survivorslots.CalcSurvivorFORTs();

                int research = await profile.Value.CalcResearchFORTs();

                var totalResources = points + research;
                var energy         = await SurvivorStaticData.CalcEnergyByFORT(totalResources);

                Assert.True(energy >= 1);
            }while (true);
        }
        public async Task <bool> UpdateDatabasePVEProfileAsync(KeyValuePair <string, IQueryProfile> profile, IGuildUser guser, IUserMessage msg = null, bool nameTag = false, bool IsNameLocked = false, bool PVEDecimals = true)
        {
            if (_uow.Db <BlackListUser>().Where(p => p.Id == guser.Id.ToString()).Any())
            {
                return(false);
            }

            var svvrs = await profile.Value.GetSurvivors();

            var svvrsResource = await svvrs.CalcSurvivorFORTs();

            var resources = await profile.Value.CalcResearchFORTs();

            var AccountPowerLevel = await SurvivorStaticData.CalcEnergyByFORT(svvrsResource + resources);

            var mSchematics    = profile.Value.AmountOfMythicSchematics();
            var frostnite2019  = profile.Value.DoneEliteFrostnite2019();
            var mockPveProfile = new FortnitePVEProfile
            {
                EpicId              = profile.Value.profileChanges.First().profile.accountId,
                PlayerName          = profile.Key,
                AccountPowerLevel   = AccountPowerLevel,
                NumMythicSchematics = mSchematics,
                EliteFortnite2019   = frostnite2019
            };

            if (AccountPowerLevel < 16)
            {
                mockPveProfile.Map = MapRoles.Stonewood;
            }
            else if (AccountPowerLevel < 46)
            {
                mockPveProfile.Map = MapRoles.Plankerton;
            }
            else if (AccountPowerLevel < 70)
            {
                mockPveProfile.Map = MapRoles.CannyValley;
            }
            else
            {
                mockPveProfile.Map = MapRoles.TwinePeaks;
            }

            StatAttribute stats = profile.Value.profileChanges.First().profile.stats["attributes"];

            if (stats.rewards_claimed_post_max_level.HasValue)
            {
                if (stats != null)
                {
                    mockPveProfile.CommanderLevel = (stats.level + stats.rewards_claimed_post_max_level.Value);
                }
            }
            else
            {
                if (stats != null)
                {
                    mockPveProfile.CommanderLevel = stats.level;
                }
            }
            if (stats.collection_book != null)
            {
                mockPveProfile.CollectionBookLevel = stats.collection_book.maxBookXpLevelAchieved;
            }

            UpdateDatabaseUserProfile(mockPveProfile.EpicId, guser, msg, nameTag, GameUserMode.PVE);
            StoredProcedure.SP_TABLE_FortnitePVEProfile_Update(mockPveProfile);
            await UpdateDiscordPVEProfileAsync(mockPveProfile, nameTag, guser, msg, IsNameLocked, PVEDecimals);

            return(true);
        }