Exemple #1
0
        public static async Task <PlayerBasicInformation> ByAccount(string account,
                                                                    PersonalDBShardManager pdbsm, Common1DBContext common1DB)
        {
            var r = await common1DB.Accounts.FindAsync(account, evolib.Account.Type.Dev1);

            if (r == null)
            {
                return(null);
            }

            return(await pdbsm.PersonalDBContext(r.playerId).PlayerBasicInformations.FindAsync(r.playerId));
        }
Exemple #2
0
        public static async Task <PlayerBasicInformation> ByPlayerName(string playerName,
                                                                       PersonalDBShardManager pdbsm, Common2DBContext common2DB)
        {
            var rec = await common2DB.PlayerNames.FindAsync(playerName);

            if (rec == null)
            {
                return(null);
            }

            var db = pdbsm.PersonalDBContext(rec.playerId);

            return(await db.PlayerBasicInformations.FindAsync(rec.playerId));
        }
Exemple #3
0
            public async Task Init(PersonalDBShardManager pdbsm, List <long> playerIds, List <string> msIds = null)
            {
                MsList = new List <OwnMobileSuitSetting>();
                VpList = new List <OwnVoicePackSetting>();
                IiList = new List <ItemInventory>();

                var dbMap = new Dictionary <PersonalDBContext, List <long> >();

                playerIds.ForEach(id =>
                {
                    var db = pdbsm.PersonalDBContext(id);
                    if (!dbMap.ContainsKey(db))
                    {
                        dbMap[db] = new List <long>();
                    }
                    dbMap[db].Add(id);
                });


                foreach (var db in dbMap)
                {
                    {
                        var query = db.Key.OwnMobileSuitSettings.Where(r => db.Value.Contains(r.playerId));
                        if (msIds != null)
                        {
                            query.Where(r => msIds.Contains(r.mobileSuitId));
                        }

                        MsList.AddRange(await query.ToListAsync());
                    }

                    {
                        var query = db.Key.OwnVoicePackSettings.Where(r => db.Value.Contains(r.playerId));
                        if (msIds != null)
                        {
                            query.Where(r => msIds.Contains(r.mobileSuitId));
                        }

                        VpList.AddRange(await query.ToListAsync());
                    }

                    {
                        var query = db.Key.ItemInventories.Where(r => db.Value.Contains(r.playerId) &&
                                                                 r.itemType == Item.Type.MobileSuit);
                        IiList.AddRange(await query.ToListAsync());
                    }
                }
            }
Exemple #4
0
                public async Task AddToDb(PersonalDBShardManager pdbsm)
                {
                    var db = pdbsm.PersonalDBContext(msRecord.playerId);

                    if (msRecordNew)
                    {
                        await db.OwnMobileSuitSettings.AddAsync(msRecord);
                    }

                    for (int i = 0; i < vpRecords.Count; i++)
                    {
                        if (vpRecordsNew[i])
                        {
                            await db.OwnVoicePackSettings.AddAsync(vpRecords[i]);
                        }
                    }
                }
Exemple #5
0
        public async Task <bool> Validate(PersonalDBShardManager pdbsm)
        {
            await FetchAsync();

            if (!Model.validated)
            {
                var db = pdbsm.PersonalDBContext(playerId);

                var basic = await db.PlayerBasicInformations.FindAsync(playerId);

                if (basic == null)
                {
                    return(false);
                }

                Model.validated        = true;
                Model.playerName       = basic.playerName;
                Model.playerIconItemId = basic.playerIconItemId;
                Model.pretendOffline   = basic.pretendOffline;
                Model.openType         = basic.openType;

                var playerPass = await db.BattlePasses.FindAsync(playerId, (int)BattlePass.PlayerLevelPassId);

                if (playerPass != null)
                {
                    Model.playerLevel  = playerPass.level;
                    Model.exp          = playerPass.levelExp;
                    Model.nextLevelExp = playerPass.nextExp;
                }


                var battle = await db.PlayerBattleInformations.FindAsync(playerId);

                if (battle != null)
                {
                    Model.battleRating = battle.rating;
                }
                else
                {
                    Model.battleRating = Battle.InitialRating;
                }
                await SaveAsync();
            }
            return(true);
        }
        public async Task <object> GetAggregationData(string account)
        {
            var playerId = await GetPlayerId(account);

            if (playerId == null)
            {
                return(null);
            }

            PDB = PDBSM.PersonalDBContext(playerId.Value);

            // evocommon1
            var accounts = await GetAccountsAsync(account);

            var playerIds = await GetPlayerIdsAsync(playerId.Value);

            // evocommon2

            // evocommon3

            // evopersonal
            var achievements = await GetAchievementsAsync(playerId.Value);

            var appOptions = await GetAppOptionsAsync(playerId.Value);

            var assetsInventories = await GetAssetsInventoriesAsync(playerId.Value);

            var battlePasses = await GetBattlePassesAsync(playerId.Value);

            var careerRecords = await GetCareerRecordsAsync(playerId.Value);

            var dateLogs = await GetDateLogsAsync(playerId.Value);

            var itemInventories = await GetItemInventoriesAsync(playerId.Value);

            var mobileSuitOptions = await GetMobileSuitOptionsAsync(playerId.Value);

            var ownMobileSuitSettings = await GetOwnMobileSuitSettingsAsync(playerId.Value);

            var ownVoicePackSettings = await GetOwnVoicePackSettingsAsync(playerId.Value);

            var playerBasicInformations = await GetPlayerBasicInformationsAsync(playerId.Value);

            var playerBattleInformations = await GetPlayerBattleInformationsAsync(playerId.Value);

            var replayUserHistory = await GetReplayUserHistoryAsync(playerId.Value);

            return(new
            {
                accounts,
                playerIds,

                achievements,
                appOptions,
                assetsInventories,
                battlePasses,
                careerRecords,
                dateLogs,
                itemInventories,
                mobileSuitOptions,
                ownMobileSuitSettings,
                ownVoicePackSettings,
                playerBasicInformations,
                playerBattleInformations,
                replayUserHistory,
            });
        }