Exemplo n.º 1
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);
            }
        }