Beispiel #1
0
 private void GameLoop_GameLaunched(object sender, GameLaunchedEventArgs e)
 {
     // Add on-day-started handler for instant pets
     this.Helper.Events.GameLoop.DayStarted      += this.GameLoop_DayStarted;
     this.Helper.Events.GameLoop.ReturnedToTitle += this.GameLoop_ReturnedToTitle;
     // Add GMCM entries
     this.AddGenericModConfigMenu();
     // Add SMAPI console commands
     ConsoleCommands.AddConsoleCommands(helper: this.Helper, monitor: this.Monitor);
 }
        private static void pet_clear(string s, string[] args)
        {
            IEnumerable <Pet> pets = ConsoleCommands.CommandPetCheck(args: args, isNameRequired: false);

            if (pets == null)
            {
                return;
            }

            Utils.ClearPets(isMessageVisible: true, isExplosive: args.Length > 0);
            Utils.SetRejectedMail(isRejected: true);
        }
        private static void pet_species(string s, string[] args)
        {
            string name = args.Length <= 1 ? null : args[1];

            IEnumerable <Pet> pets = ConsoleCommands.CommandPetCheck(args: args, isNameRequired: true, matchName: name);

            if (pets == null)
            {
                return;
            }

            Pet pet = pets.First();

            Utils.SetSpecies(pet: pet, isCat: !(pet is Cat), isMessageVisible: true);
        }
        private static void pet_breed(string s, string[] args)
        {
            IEnumerable <Pet> pets = ConsoleCommands.CommandPetCheck(args: args, isNameRequired: true);

            if (pets == null)
            {
                return;
            }

            if (args.Length < 1 || !int.TryParse(args[0], out int whichBreed) || whichBreed < 1 || whichBreed > 3)
            {
                ConsoleCommands.Monitor.Log($"Use 1/2/3 to choose the breed.", LogLevel.Debug);
                return;
            }

            Utils.SetBreed(pet: pets.First(), whichBreed: --whichBreed, setForPlayer: pets.Count() == 1, isMessageVisible: true);
        }
        private static void pet_rename(string s, string[] args)
        {
            if (args.Length == 0)
            {
                ConsoleCommands.Monitor.Log($"Provide a name to rename your pet.", LogLevel.Debug);
                return;
            }

            string newName = args[0];
            string oldName = args.Length <= 1 ? null : args[1];

            IEnumerable <Pet> pets = ConsoleCommands.CommandPetCheck(args: args, isNameRequired: true, matchName: oldName);

            if (pets == null)
            {
                return;
            }

            Utils.RenamePet(pet: pets.First(), name: newName, isMessageVisible: true);
        }