Ejemplo n.º 1
0
        public static PersistedAccountData GetAccountData(ClientConnection connection)
        {
            PersistedAccountData accountData = new PersistedAccountData()
            {
                AccountId        = connection.AccountId,
                AccountComponent = GetAccountComponent(connection),
                BankComponent    = GetBankData(connection.AccountId),
                CreateDate       = DateTime.Now.AddHours(-1),
                Handle           = connection.UserName,
                QuestComponent   = new QuestComponent()
                {
                    ActiveSeason = 9
                },                                                          // Provide a SeasonExperience to set Season Level on client
                SchemaVersion = new SchemaVersion <AccountSchemaChange>(0x1FFFF),
                UpdateDate    = DateTime.Now,
                UserName      = connection.UserName,
            };

            return(accountData);
        }
Ejemplo n.º 2
0
        public static PersistedAccountData GetPersistedAccountData(long accountId)
        {
            Database.Account account = Database.Account.GetByAccountId(accountId);

            PersistedAccountData accountData = new PersistedAccountData()
            {
                AccountComponent   = GetAccountComponent(account),
                AccountId          = accountId,
                BankComponent      = Bank.GetBankComponent(account.AccountId),
                CharacterData      = CharacterManager.GetPersistedCharacterData(account.AccountId),
                Handle             = account.UserName,
                InventoryComponent = InventoryManager.GetInventoryComponent(accountId),
                QuestComponent     = new QuestComponent()
                {
                    ActiveSeason = 9
                },
                SchemaVersion = new SchemaVersion <AccountSchemaChange>(0x1FFFF),
                UserName      = account.UserName
            };

            return(accountData);
        }
Ejemplo n.º 3
0
        public static PersistedAccountData GetAccountData(LobbyServerConnection connection)
        {
            PersistedAccountData accountData = new PersistedAccountData()
            {
                //AccountId = connection.PlayerInfo.GetAccountId(),
                AccountComponent = GetAccountComponent(connection),
                //BankComponent = GetBankData(connection.PlayerInfo.GetAccountId()),
                CharacterData = GetCharacterData(),
                CreateDate    = DateTime.Now.AddHours(-1),
                //Handle = connection.PlayerInfo.GetHandle(),
                QuestComponent = new QuestComponent()
                {
                    ActiveSeason = 9
                },                                                          // Provide a SeasonExperience to set Season Level on client
                SchemaVersion = new SchemaVersion <AccountSchemaChange>(0x1FFFF),
                UpdateDate    = DateTime.Now,
                //UserName = connection.PlayerInfo.GetHandle(),
                InventoryComponent = new InventoryComponent(true)
            };

            return(accountData);
        }
Ejemplo n.º 4
0
        public void HandlePlayerInfoUpdateRequest(PlayerInfoUpdateRequest request)
        {
            LobbyPlayerInfoUpdate playerInfoUpdate = request.PlayerInfoUpdate;


            if (request.GameType != null && request.GameType.HasValue)
            {
                SetGameType(request.GameType.Value);
            }

            if (playerInfoUpdate.CharacterType != null && playerInfoUpdate.CharacterType.HasValue)
            {
                SetCharacterType(playerInfoUpdate.CharacterType.Value);
                LobbyPlayerInfo playerInfo = SessionManager.GetPlayerInfo(this.AccountId);

                PersistedAccountData accountData = AccountManager.GetPersistedAccountData(this.AccountId);
                // should be automatic when account gets its data from database, but for now we modify the needed things here
                accountData.AccountComponent.LastCharacter = playerInfo.CharacterInfo.CharacterType;
                accountData.AccountComponent.SelectedBackgroundBannerID = playerInfo.BannerID;
                accountData.AccountComponent.SelectedForegroundBannerID = playerInfo.EmblemID;
                accountData.AccountComponent.SelectedRibbonID           = playerInfo.RibbonID;
                accountData.AccountComponent.SelectedTitleID            = playerInfo.TitleID;
                // end "should be automatic"

                PlayerAccountDataUpdateNotification updateNotification = new PlayerAccountDataUpdateNotification()
                {
                    AccountData = accountData
                };
                Send(updateNotification);

                PlayerInfoUpdateResponse response = new PlayerInfoUpdateResponse()
                {
                    PlayerInfo               = playerInfo,
                    CharacterInfo            = playerInfo.CharacterInfo,
                    OriginalPlayerInfoUpdate = request.PlayerInfoUpdate,
                    ResponseId               = request.RequestId
                };
                Send(response);
            }

            if (playerInfoUpdate.AllyDifficulty != null && playerInfoUpdate.AllyDifficulty.HasValue)
            {
                SetAllyDifficulty(playerInfoUpdate.AllyDifficulty.Value);
            }
            if (playerInfoUpdate.CharacterAbilityVfxSwaps != null && playerInfoUpdate.CharacterAbilityVfxSwaps.HasValue)
            {
                SetCharacterAbilityVfxSwaps(playerInfoUpdate.CharacterAbilityVfxSwaps.Value);
            }
            if (playerInfoUpdate.CharacterCards != null && playerInfoUpdate.CharacterCards.HasValue)
            {
                SetCharacterCards(playerInfoUpdate.CharacterCards.Value);
            }
            if (playerInfoUpdate.CharacterLoadoutChanges != null && playerInfoUpdate.CharacterLoadoutChanges.HasValue)
            {
                SetCharacterLoadoutChanges(playerInfoUpdate.CharacterLoadoutChanges.Value);
            }
            if (playerInfoUpdate.CharacterMods != null && playerInfoUpdate.CharacterMods.HasValue)
            {
                SetCharacterMods(playerInfoUpdate.CharacterMods.Value);
            }
            if (playerInfoUpdate.CharacterSkin != null && playerInfoUpdate.CharacterSkin.HasValue)
            {
                SetCharacterSkin(playerInfoUpdate.CharacterSkin.Value);
            }

            if (playerInfoUpdate.ContextualReadyState != null && playerInfoUpdate.ContextualReadyState.HasValue)
            {
                SetContextualReadyState(playerInfoUpdate.ContextualReadyState.Value);
            }
            if (playerInfoUpdate.EnemyDifficulty != null && playerInfoUpdate.EnemyDifficulty.HasValue)
            {
                SetEnemyDifficulty(playerInfoUpdate.EnemyDifficulty.Value);
            }
            if (playerInfoUpdate.LastSelectedLoadout != null && playerInfoUpdate.LastSelectedLoadout.HasValue)
            {
                SetLastSelectedLoadout(playerInfoUpdate.LastSelectedLoadout.Value);
            }

            //Console.WriteLine(JsonConvert.SerializeObject(response, Formatting.Indented));
        }