Example #1
0
 private void PlayerCommandReceived(string command, string data, Impostor.Api.Events.Player.IPlayerChatEvent source)
 {
     switch (command)
     {
     case PlayerReportCommand:
     {
         if (string.IsNullOrEmpty(data))
         {
             PluginBase.ChatInterface.SafeMultiMessage(source.Game, "Invalid command data. Please use /help for more information.", Structures.BroadcastType.Error, destination: source.ClientPlayer);
             return;
         }
         HighCourt.HandleReport(data, source);
         break;
     }
     }
 }
Example #2
0
        private async void ChatInterface_OnCommandInvoked(string command, string data, Impostor.Api.Events.Player.IPlayerChatEvent source)
        {
            if (source == null || source.ClientPlayer.Character == null)
            {
                return;
            }
            if (source.ClientPlayer.Game.GameState == GameStates.Started)
            {
                if (!Config.AllowInGame)
                {
                    return;
                }
            }
            try
            {
                switch (command)
                {
                case Constants.PlayerCommands.FashionCommand:
                {
                    if (string.IsNullOrEmpty(data))
                    {
                        PluginBase.ChatInterface.SafeMultiMessage(source.Game, Help, Structures.BroadcastType.Error, destination: source.ClientPlayer);
                        return;
                    }
                    else if (data.Equals("new") && Config.AllowRandomSkins)
                    {
                        var randomSkin = Skin.GetRandomSkin(SkinProvider);
                        await source.ClientPlayer.Character.SetSkinAsync(randomSkin.Clothes).ConfigureAwait(false);

                        await source.ClientPlayer.Character.SetHatAsync(randomSkin.Hat).ConfigureAwait(false);

                        await source.ClientPlayer.Character.SetPetAsync(randomSkin.Pet).ConfigureAwait(false);
                    }

                    else if (SkinList.ContainsKey(data) && Config.AllowPreSetSkins)
                    {
                        var skin = SkinList[data];
                        await source.ClientPlayer.Character.SetSkinAsync(skin.Clothes).ConfigureAwait(false);

                        await source.ClientPlayer.Character.SetHatAsync(skin.Hat).ConfigureAwait(false);

                        await source.ClientPlayer.Character.SetPetAsync(skin.Pet).ConfigureAwait(false);
                    }
                    else
                    {
                        PluginBase.ChatInterface.SafeMultiMessage(source.Game, "Invalid skin.", Structures.BroadcastType.Error, destination: source.ClientPlayer);
                    }
                    break;
                }
                }
            }
            catch (Exception e)
            {
                PluginBase.LogManager.LogError("Fashion: " + e.Message, Shared.ErrorLocation.Plugin);
            }
        }