Пример #1
0
        private void StopEmoteFarmAnimal(string command, string[] args)
        {
            if (!Context.IsMainPlayer && !Config.AllowNonHostEmoteAnimalCommand)
            {
                this.Monitor.Log(I18n.Command_PermissionsDenied(), LogLevel.Info);
                return;
            }

            if (args.Length < 2)
            {
                this.Monitor.Log($"{I18n.Command_MissingParameters()}\n\n{I18n.Command_PlayEmoteAnimal_Usage()}", LogLevel.Info);
                return;
            }

            FarmAnimal farmAnimal = Game1.getFarm().getAllFarmAnimals().FirstOrDefault(x => x.Name == args[0]);

            if (farmAnimal == null)
            {
                this.Monitor.Log($"Could not find any FarmAnimal with \"{args[0]}\".", LogLevel.Info);
                return;
            }

            if (farmAnimal.IsEmoting)
            {
                this.Monitor.Log($"Stoping {args[0]} from playing emote...", LogLevel.Info);
                farmAnimal.IsEmoting = false;
            }
            else
            {
                this.Monitor.Log($"No emote is being played by {args[0]}.", LogLevel.Info);
            }
        }
Пример #2
0
        private void EmoteFarmAnimal(string command, string[] args)
        {
            if (!Context.IsMainPlayer && !Config.AllowNonHostEmoteAnimalCommand)
            {
                this.Monitor.Log(I18n.Command_PermissionsDenied(), LogLevel.Info);
                return;
            }

            if (args.Length < 2)
            {
                this.Monitor.Log($"{I18n.Command_MissingParameters()}\n\n{I18n.Command_PlayEmoteAnimal_Usage()}", LogLevel.Info);
                return;
            }

            FarmAnimal farmAnimal = Game1.getFarm().getAllFarmAnimals().FirstOrDefault(x => x.Name == args[0]);

            if (farmAnimal == null)
            {
                this.Monitor.Log($"Could not find any FarmAnimal with \"{args[0]}\".", LogLevel.Info);
                return;
            }

            if (!int.TryParse(args[1], out int id))
            {
                this.Monitor.Log("The emote id must be a integer.", LogLevel.Info);
                return;
            }

            if (id <= 0)
            {
                this.Monitor.Log("The emote id value must be greater than 0.", LogLevel.Info);
                return;
            }

            farmAnimal.doEmote(id * 4);

#if DEBUG
            this.Monitor.Log($"[id: {farmAnimal.myID.Value}, name: \"{farmAnimal.Name}\"] Playing emote: {id}", LogLevel.Info);
#else
            this.Monitor.Log($"[\"{farmAnimal.Name}\"] Playing emote: {id}", LogLevel.Info);
#endif
        }