Exemplo n.º 1
0
        public void GetMyGameModes(Client client)
        {
            try
            {
                List <BaseGameMode> myGameModes = GameModeHandler.Instance.GetGameModeByHost(client);
                string response = "";

                if (myGameModes.Count == 0)
                {
                    response += "You are not hosting any game modes.";
                }

                for (int i = 0; i < myGameModes.Count; i++)
                {
                    BaseGameMode gm = myGameModes[i];
                    response += $"({gm.GetGameModeData().Id}) {gm.GetGameModeData().Name}";

                    if (i < myGameModes.Count - 1)
                    {
                        response += ", ";
                    }
                }
                Main.Logger.LogClient(client, response);
            }
            catch (Exception e)
            {
                Main.Logger.LogClient(client, e.Message);
            }
        }
Exemplo n.º 2
0
        public void CMD_RemovePlayerFromGameMode(Client client, uint gmId, string playerFirstName, string playerSecondName = "")
        {
            Client player = ServerUtilities.GetPlayerIfExists(client, playerFirstName, playerSecondName);

            if (player == null)
            {
                return;
            }

            try
            {
                BaseGameMode gameMode = GameModeHandler.Instance.GetGameModeById(gmId);
                gameMode.RemovePlayer(player);
                Main.Logger.LogClient(gameMode.GetGameModeData().EventHost, $"{client.Name} joined the event ({gameMode.GetGameModeData().Id}) {gameMode.GetGameModeData().Name}.");
                Main.Logger.LogClient(player, $"You were added to the event ({gameMode.GetGameModeData().Id}) {gameMode.GetGameModeData().Name} by {client.Name}.");
            }
            catch (Exception e)
            {
                Main.Logger.LogClient(client, e.Message);
            }
        }
Exemplo n.º 3
0
        public void SetGameModeMap(Client client, uint gmId, uint mapId = 99999999)
        {
            try
            {
                //map id not specified
                if (mapId == 99999999)
                {
                    BaseGameMode gameMode = GameModeHandler.Instance.GetGameModeById(gmId);
                    List <BaseGameModeMapData> suitableMaps = GameModeHandler.Instance.GetSuitableMaps(gameMode.GetGameModeData().Type);

                    string response = "Suitable Maps: ";
                    for (int i = 0; i < suitableMaps.Count; i++)
                    {
                        BaseGameModeMapData mapData = suitableMaps[i];
                        response += $"({mapData.MapId}) {mapData.DisplayName}";

                        if (i < suitableMaps.Count - 1)
                        {
                            response += ", ";
                        }
                    }

                    Main.Logger.LogClient(client, response);
                }
                else
                {
                    BaseGameMode gameMode = GameModeHandler.Instance.GetGameModeById(gmId);
                    gameMode.SetGameModeMapId(mapId);
                }
            }
            catch (Exception e)
            {
                Main.Logger.LogClient(client, e.Message);
            }
        }