Ejemplo n.º 1
0
 public Server(string localIPAddress, int listenPort) : base(localIPAddress, listenPort)
 {
     Options = new ServerOptions(Flags.ServerOptionFlag.MAINTENANCE_FLAG_PAPELSHOP, 1);
     IFFEntry.Load();
     WriteConsole.WriteLine($"[GAMESERVER]: START {localIPAddress}:{listenPort}", ConsoleColor.Green);
     LobbyList = new LobbyCollection(new Lobby(name: "#Lobby Test", maxPlayers: 100, id: 1, flag: 0));
 }
Ejemplo n.º 2
0
        private void LoadLobbies(LobbyCollection lobbies)
        {
            if (lobbies.Count == 0)
            {
                _skinDefinition.Lobbies = new LobbyCollectionViewModel(Constants.DefaultNumberOfLobbyItems, _skinDefinition.Triggers);
            }
            else
            {
                _skinDefinition.Lobbies = new LobbyCollectionViewModel(lobbies.First().Items.Count, _skinDefinition.Triggers);
            }

            foreach (var lobby in lobbies)
            {
                var lobbyViewModel = new LobbyViewModel(new PlayerStatusTypeViewModel(PlayerStatusType.FromId(lobby.PlayerStatus), _skinDefinition.Triggers),
                                                        lobby.FavoriteSize);

                foreach (var item in lobby.Items)
                {
                    var itemViewModel = FindLobbyItemSource(item.Id);
                    if (itemViewModel != null)
                    {
                        lobbyViewModel.Items.Add(new LobbyItemViewModel(itemViewModel));
                    }
                    else
                    {
                        _buildErrors.Add(new ErrorMessageViewModel("Lobby arena",
                                                                   $"Cannot find the lobby item {item.Id} in the list of available lobby items",
                                                                   ErrorServerity.Warning,
                                                                   null));
                    }
                }

                _skinDefinition.Lobbies.Add(lobbyViewModel);
            }
        }
Ejemplo n.º 3
0
        private void FillLobbyCollection(LobbyCollection lobbyCollection, SkinDefinitionContext skinDefinitionContext)
        {
            var lobbyXmlElements = ReadArenasXmlElements().Where(element => XmlValues.lobby == element.GetAttributeValue(XmlNames.type));

            foreach (var lobbyXmlElement in lobbyXmlElements)
            {
                var lobby = new Lobby(lobbyXmlElement.GetAttributeValue <int>(XmlNames.favoritesSize),
                                      lobbyXmlElement.GetAttributeValue(XmlNames.playerStatus));

                foreach (var lobbyItemXmlElement in lobbyXmlElement.Elements(XmlNames.game))
                {
                    lobby.Items.Add(new LobbyItem(lobbyItemXmlElement.GetAttributeValue <int>(XmlNames.gameType),
                                                  XmlValues.mcDynamicTextedButtonPersonalize == lobbyItemXmlElement.GetAttributeValue(XmlNames.templateId, "")));
                }

                lobbyCollection.Add(lobby);
            }
        }
Ejemplo n.º 4
0
        private void FillLobbyCollection(LobbyCollection lobbyCollection, SkinDefinitionContext skinDefinitionContext)
        {
            foreach (var lobbyElement in _navigationPlanJson.navigationPlan.arenas)
            {
                if (JsonValues.lobby != ConvertDynamicValue <string>(lobbyElement.type))
                {
                    continue;
                }

                var lobby = new Lobby(ConvertDynamicValue <int>(lobbyElement.favoritesSize),
                                      ExtractPlayerStatus(lobbyElement.playerStatus));

                foreach (var lobbyItemElement in lobbyElement.games)
                {
                    lobby.Items.Add(new LobbyItem(ConvertDynamicValue <int>(lobbyItemElement.gametype),
                                                  ConvertDynamicValue <string>(lobbyItemElement.templateId) == JsonValues.mcDynamicTextedButtonPersonalize));
                }

                lobbyCollection.Add(lobby);
            }
        }