Example #1
0
        /******************
        ** Print Strings
        ******************/

        /// <summary>Prints the the requested creature information from the list_animals console command.</summary>
        internal static void PrintRequestedCreatures(string arg)
        {
            string type = ModEntry.Sanitize(arg);

            // Handle animal portion of "all" argument and the "animal" argument
            if (type == "all" || type == "animal")
            {
                List <string> animalInfo = new List <string>();

                foreach (FarmAnimal animal in ModEntry.GetAnimals())
                {
                    animalInfo.Add(GetPrintString(animal));
                }

                ModEntry.SMonitor.Log("Animals:", LogLevel.Alert);
                ModEntry.SMonitor.Log($"{string.Join(", ", animalInfo)}", LogLevel.Info);
            }
            // Handle coop animal types only
            else if (type == "coop")
            {
                List <string> coopInfo = new List <string>();

                foreach (FarmAnimal animal in ModEntry.GetAnimals())
                {
                    if (animal.isCoopDweller())
                    {
                        coopInfo.Add(GetPrintString(animal));
                    }
                }

                ModEntry.SMonitor.Log("Coop Animals:", LogLevel.Alert);
                ModEntry.SMonitor.Log($"{string.Join(", ", coopInfo)}", LogLevel.Info);
            }
            // Handle barn animal types only
            else if (type == "barn")
            {
                List <string> barnInfo = new List <string>();

                foreach (FarmAnimal animal in ModEntry.GetAnimals())
                {
                    if (!animal.isCoopDweller())
                    {
                        barnInfo.Add(GetPrintString(animal));
                    }
                }

                ModEntry.SMonitor.Log("Barn Animals:", LogLevel.Alert);
                ModEntry.SMonitor.Log($"{string.Join(", ", barnInfo)}", LogLevel.Info);
            }
            // Handle chicken type arguments
            else if (type == "chicken")
            {
                List <string> chickenInfo = new List <string>();

                foreach (FarmAnimal animal in ModEntry.GetAnimals())
                {
                    string potentialChicken = ModEntry.Sanitize(animal.type.Value);

                    if (ModApi.IsChicken(potentialChicken))
                    {
                        chickenInfo.Add(GetPrintString(animal));
                    }
                }
                ModEntry.SMonitor.Log("Chickens:", LogLevel.Alert);
                ModEntry.SMonitor.Log($"{string.Join(", ", chickenInfo)}", LogLevel.Info);
            }
            // Handle cow type arguments
            else if (type == "cow")
            {
                List <string> cowInfo = new List <string>();

                foreach (FarmAnimal animal in ModEntry.GetAnimals())
                {
                    string potentialCow = ModEntry.Sanitize(animal.type.Value);

                    if (ModApi.IsCow(potentialCow))
                    {
                        cowInfo.Add(GetPrintString(animal));
                    }
                }
                ModEntry.SMonitor.Log("Cows:", LogLevel.Alert);
                ModEntry.SMonitor.Log($"{string.Join(", ", cowInfo)}", LogLevel.Info);
            }
            // Handle other animal type arguments
            else if (ModApi.GetHandledAnimalTypes().Contains(type))
            {
                List <string> animalInfo = new List <string>();

                foreach (FarmAnimal animal in ModEntry.GetAnimals())
                {
                    if (type == ModEntry.Sanitize(animal.type.Value))
                    {
                        animalInfo.Add(GetPrintString(animal));
                    }
                }
                ModEntry.SMonitor.Log($"{arg}s:", LogLevel.Alert);
                ModEntry.SMonitor.Log($"{string.Join(", ", animalInfo)}", LogLevel.Info);
            }


            // Handle the pet portion of the "all" argument and the "pet" argument
            if (type == "all" || type == "pet")
            {
                List <string> petInfo = new List <string>();

                foreach (Pet pet in ModEntry.GetPets())
                {
                    if (pet.Manners != Stray.StrayID)
                    {
                        petInfo.Add(GetPrintString(pet));
                    }
                }

                ModEntry.SMonitor.Log("Pets:", LogLevel.Alert);
                ModEntry.SMonitor.Log($"{string.Join(", ", petInfo)}", LogLevel.Info);
            }
            else if (ModApi.GetHandledPetTypes().Contains(type))
            {
                List <string> petInfo = new List <string>();

                foreach (Pet pet in ModEntry.GetPets())
                {
                    if (type == ModEntry.Sanitize(pet.GetType().Name))
                    {
                        petInfo.Add(GetPrintString(pet));
                    }
                }
                ModEntry.SMonitor.Log($"{arg}s:", LogLevel.Alert);
                ModEntry.SMonitor.Log($"{string.Join(", ", petInfo)}", LogLevel.Info);
            }


            // Handle the horse portion of the "all" argument and the horse argument
            if (type == "all" || ModApi.GetHandledHorseTypes().Contains(type))
            {
                List <string> horseInfo = new List <string>();

                foreach (Horse horse in ModEntry.GetHorses())
                {
                    if (horse.Manners != 0 && horse.Manners != WildHorse.WildID)
                    {
                        horseInfo.Add(GetPrintString(horse));
                    }
                }

                ModEntry.SMonitor.Log("Horses:", LogLevel.Alert);
                ModEntry.SMonitor.Log($"{string.Join(", ", horseInfo)}", LogLevel.Info);
            }
        }
        /*****************************
        ** Console Command Handlers
        ******************************/

        /// <summary>Handles commands for the SMAPI console</summary>
        internal void OnCommandReceived(string command, string[] args)
        {
            switch (command)
            {
            case "debug_idmaps":
                ModEntry.SMonitor.Log($"Animals Long to Short:\n{string.Join("\n", ModEntry.AnimalLongToShortIDs)}", LogLevel.Info);
                ModEntry.SMonitor.Log($"Animals Short to Long equal length: {ModEntry.AnimalLongToShortIDs.Count == ModEntry.AnimalShortToLongIDs.Count}", LogLevel.Alert);
                break;


            case "debug_skinmaps":
                ModEntry.SMonitor.Log($"Animals:\n{string.Join("\n", ModEntry.AnimalSkinMap)}", LogLevel.Info);
                ModEntry.SMonitor.Log($"Pets:\n{string.Join("\n", ModEntry.PetSkinMap)}", LogLevel.Alert);
                ModEntry.SMonitor.Log($"Horses:\n{string.Join("\n", ModEntry.HorseSkinMap)}", LogLevel.Info);
                break;


            case "debug_manners":
                ModEntry.SMonitor.Log("Horse manners:", LogLevel.Alert);
                foreach (Horse horse in ModEntry.GetHorses())
                {
                    ModEntry.SMonitor.Log($"#{horse.Name}: {horse.Manners}", LogLevel.Info);
                }
                ModEntry.SMonitor.Log("Pet manners:", LogLevel.Alert);
                foreach (Pet pet in ModEntry.GetPets())
                {
                    ModEntry.SMonitor.Log($"#{pet.Name}: {pet.Manners}", LogLevel.Info);
                }
                break;


            case "debug_horses":
                if (!EnforceArgCount(args, 0))
                {
                    break;
                }

                foreach (NPC npc in Utility.getAllCharacters())
                {
                    if (npc is Horse horse)
                    {
                        ModEntry.SMonitor.Log($"Horse. Manners: {horse.Manners}", LogLevel.Info);
                    }
                }
                break;


            case "adopt_pet":
                Earth.Creator.AdoptPet();
                break;


            case "summon_horse":
                Earth.Creator.NewWildHorse(true);
                break;


            // Expected arguments: <horse ID>
            case "find_horse":
                // Enforce argument constraints
                if (!EnforceArgCount(args, 1) ||
                    !EnforceArgTypeInt(args[0], 1))
                {
                    break;
                }

                int id = int.Parse(args[0]);
                foreach (Horse horse in ModEntry.GetHorses())
                {
                    if (horse.Manners == id)
                    {
                        ModEntry.SMonitor.Log($"{horse.Name} located at: {horse.currentLocation}\n{horse.position.X}, {horse.position.Y}\nVector: {horse.position.Value}", LogLevel.Alert);
                    }
                }

                break;


            case "corral_horses":
                // Find the farm's stable
                Stable horsehut = null;
                foreach (Building building in Game1.getFarm().buildings)
                {
                    if (building is Stable)
                    {
                        horsehut = building as Stable;
                    }
                }

                // No stable was found on the farm
                if (horsehut == null)
                {
                    ModEntry.SMonitor.Log("NOTICE: You don't have a stable to warp to!", LogLevel.Error);
                    break;
                }

                // WARP THEM. WARP THEM ALL.
                int     stableX    = int.Parse(horsehut.tileX.ToString()) + 1;
                int     stableY    = int.Parse(horsehut.tileY.ToString()) + 1;
                Vector2 stableWarp = new Vector2(stableX, stableY);
                foreach (Horse horse in ModEntry.GetHorses())
                {
                    if (ModEntry.HorseSkinMap.ContainsKey(horse.Manners))
                    {
                        Game1.warpCharacter(horse, "farm", stableWarp);
                    }
                }

                ModEntry.SMonitor.Log("All horses have been warped to the stable.", LogLevel.Alert);

                break;


            // Expected arguments: <creature type/category/group>
            case "list_creatures":
                // Enforce argument constraints
                if (!EnforceArgCount(args, 1) ||
                    !EnforceArgTypeGroup(args[0]))
                {
                    break;
                }

                PrintRequestedCreatures(ModEntry.Sanitize(args[0]));
                break;


            // Expected arguments: None.
            case "randomize_all_skins":
                // Enforce argument constraints
                if (!EnforceArgCount(args, 0))
                {
                    break;
                }

                // Randomize all skins
                foreach (Horse horse in ModEntry.GetHorses())
                {
                    Earth.SetRandomSkin(horse);
                }
                foreach (Pet pet in ModEntry.GetPets())
                {
                    Earth.SetRandomSkin(pet);
                }
                foreach (FarmAnimal animal in ModEntry.GetAnimals())
                {
                    Earth.SetRandomSkin(animal);
                }

                ModEntry.SMonitor.Log("All animal, pet, and horse skins have been randomized.", LogLevel.Alert);
                break;


            // Expected arguments: <creature category>, <creature ID>
            case "randomize_skin":
                // Enforce argument constraints
                if (!EnforceArgCount(args, 2))
                {
                    break;
                }
                if (!EnforceArgTypeCategory(args[0], 1) || !EnforceArgTypeInt(args[1], 2))
                {
                    break;
                }

                string    category   = ModEntry.Sanitize(args[0]);
                int       creatureID = int.Parse(args[1]);
                Character creature   = null;

                // Find associated creature instance
                if (category == "horse" && ModEntry.HorseSkinMap.ContainsKey(creatureID))
                {
                    creature = ModEntry.GetCreature(ModEntry.CreatureCategory.Horse, creatureID);
                }
                else if (category == "pet" && ModEntry.PetSkinMap.ContainsKey(creatureID))
                {
                    creature = ModEntry.GetCreature(ModEntry.CreatureCategory.Pet, creatureID);
                }
                else if (category == "animal" && ModEntry.AnimalShortToLongIDs.ContainsKey(creatureID))
                {
                    creature = ModEntry.GetCreature(ModEntry.CreatureCategory.Animal, ModEntry.AnimalShortToLongIDs[creatureID]);
                }


                // A creature was able to be located with the given category and ID
                if (creature != null)
                {
                    int newSkin = Earth.SetRandomSkin(creature);
                    if (newSkin == 0)
                    {
                        ModEntry.SMonitor.Log($"No skins are located in `/assets/skins` for {creature.Name}'s type: {ModEntry.Sanitize(creature.GetType().Name)}", LogLevel.Error);
                    }
                    else
                    {
                        ModEntry.SMonitor.Log($"{creature.Name}'s skin has been randomized.", LogLevel.Alert);
                    }
                }
                else
                {
                    ModEntry.SMonitor.Log($"Creature category `{category}` with given ID does not exist: {creatureID}", LogLevel.Error);
                }


                break;


            // Expected arguments: <skin ID>, <creature category>, <creature ID>
            case "set_skin":
                // Enforce argument constraints
                if (!EnforceArgCount(args, 3))
                {
                    break;
                }
                if (!EnforceArgTypeInt(args[0], 1) || !EnforceArgTypeCategory(args[1], 2) || !EnforceArgTypeInt(args[2], 3))
                {
                    break;
                }

                int       skinID         = int.Parse(args[0]);
                string    creatureCat    = ModEntry.Sanitize(args[1]);
                int       shortID        = int.Parse(args[2]);
                Character creatureToSkin = null;

                if (creatureCat == "horse" && ModEntry.HorseSkinMap.ContainsKey(shortID))
                {
                    creatureToSkin = ModEntry.GetCreature(ModEntry.CreatureCategory.Horse, shortID);

                    // Ensure that the skin ID given exists in Animal Skinner
                    if (!EnforceArgRange(skinID, ModEntry.HorseAssets[ModEntry.Sanitize(creatureToSkin.GetType().Name)].Count, 1))
                    {
                        break;
                    }

                    // Set skin
                    ModEntry.HorseSkinMap[shortID] = skinID;
                }
                else if (creatureCat == "pet" && ModEntry.PetSkinMap.ContainsKey(shortID))
                {
                    creatureToSkin = ModEntry.GetCreature(ModEntry.CreatureCategory.Pet, shortID);

                    // Ensure that the skin ID given exists in Animal Skinner
                    if (!EnforceArgRange(skinID, ModEntry.PetAssets[ModEntry.Sanitize(creatureToSkin.GetType().Name)].Count, 1))
                    {
                        break;
                    }

                    // Set skin
                    ModEntry.PetSkinMap[shortID] = skinID;
                }
                else if (creatureCat == "animal" && ModEntry.AnimalShortToLongIDs.ContainsKey(shortID))
                {
                    FarmAnimal animal = ModEntry.GetCreature(ModEntry.CreatureCategory.Animal, ModEntry.AnimalShortToLongIDs[shortID]) as FarmAnimal;
                    creatureToSkin = animal;

                    // Ensure that the skin ID given exists in Animal Skinner
                    if (!EnforceArgRange(skinID, ModEntry.AnimalAssets[ModEntry.Sanitize(animal.type.Value)].Count, 1))
                    {
                        break;
                    }

                    // Set skin
                    ModEntry.AnimalSkinMap[ModEntry.AnimalShortToLongIDs[shortID]] = skinID;
                }


                // Successfully found given creature to set skin for. Run a skin update.
                if (creatureToSkin != null)
                {
                    Earth.UpdateSkin(creatureToSkin);
                    ModEntry.SMonitor.Log($"{creatureToSkin.Name}'s skin has been set to skin {skinID}", LogLevel.Alert);
                }
                else
                {
                    ModEntry.SMonitor.Log($"Skin setting error. Creature category {creatureCat} ID {shortID} could not be given skin {skinID}", LogLevel.Error);
                }

                break;


            default:
                break;
            }
        }
Example #3
0
        /*****************************
        ** Console Command Handlers
        ******************************/

        /// <summary>Handles commands for the SMAPI console</summary>
        internal void OnCommandReceived(string command, string[] args)
        {
            switch (command)
            {
            case "debug_reset":
                if (!EnforceArgCount(args, 0))
                {
                    break;
                }

                ModEntry.AnimalSkinMap = new Dictionary <long, int>();
                ModEntry.PetSkinMap    = new Dictionary <long, int>();
                ModEntry.HorseSkinMap  = new Dictionary <long, int>();

                ModEntry.AnimalLongToShortIDs = new Dictionary <long, int>();
                ModEntry.AnimalShortToLongIDs = new Dictionary <int, long>();

                foreach (Horse horse in ModEntry.GetHorses())
                {
                    if (horse.Manners != WildHorse.WildID)
                    {
                        horse.Manners = 0;
                    }
                }
                foreach (Pet pet in ModEntry.GetPets())
                {
                    if (pet.Manners != Stray.StrayID)
                    {
                        pet.Manners = 0;
                    }
                }

                foreach (Horse horse in ModEntry.GetHorses())
                {
                    if (horse.Manners != WildHorse.WildID)
                    {
                        Earth.AddCreature(horse);
                    }
                }
                foreach (Pet pet in ModEntry.GetPets())
                {
                    if (pet.Manners != Stray.StrayID)
                    {
                        Earth.AddCreature(pet);
                    }
                }
                foreach (FarmAnimal animal in ModEntry.GetAnimals())
                {
                    Earth.AddCreature(animal);
                }


                break;


            case "debug_idmaps":
                if (!EnforceArgCount(args, 0))
                {
                    break;
                }

                ModEntry.SMonitor.Log($"Animals Long to Short:\n{string.Join("\n", ModEntry.AnimalLongToShortIDs)}", LogLevel.Info);
                ModEntry.SMonitor.Log($"Animals Short to Long equal length: {ModEntry.AnimalLongToShortIDs.Count == ModEntry.AnimalShortToLongIDs.Count}", LogLevel.Alert);
                break;


            case "debug_skinmaps":
                if (!EnforceArgCount(args, 0))
                {
                    break;
                }

                ModEntry.SMonitor.Log($"Animals:\n{string.Join("\n", ModEntry.AnimalSkinMap)}", LogLevel.Info);
                ModEntry.SMonitor.Log($"Pets:\n{string.Join("\n", ModEntry.PetSkinMap)}", LogLevel.Alert);
                ModEntry.SMonitor.Log($"Horses:\n{string.Join("\n", ModEntry.HorseSkinMap)}", LogLevel.Info);
                break;


            case "debug_pets":
                if (!EnforceArgCount(args, 0))
                {
                    break;
                }

                foreach (NPC npc in Utility.getAllCharacters())
                {
                    if (npc is Pet pet)
                    {
                        int petSkin = 0;
                        if (pet.Manners == Stray.StrayID)
                        {
                            petSkin = ModEntry.Creator.StrayInfo.SkinID;
                        }
                        else if (ModEntry.HorseSkinMap.ContainsKey(pet.Manners))
                        {
                            petSkin = ModEntry.HorseSkinMap[pet.Manners];
                        }

                        ModEntry.SMonitor.Log($"[{pet.Name}] | Manners: {pet.Manners} | Skin: {petSkin} | Stray: {pet.Manners == Stray.StrayID}", LogLevel.Info);
                    }
                }
                break;


            case "debug_horses":
                if (!EnforceArgCount(args, 0))
                {
                    break;
                }

                foreach (NPC npc in Utility.getAllCharacters())
                {
                    if (npc is Horse horse)
                    {
                        int horseSkin = 0;
                        if (horse.Manners == WildHorse.WildID)
                        {
                            horseSkin = ModEntry.Creator.HorseInfo.SkinID;
                        }
                        else if (ModEntry.HorseSkinMap.ContainsKey(horse.Manners))
                        {
                            horseSkin = ModEntry.HorseSkinMap[horse.Manners];
                        }

                        ModEntry.SMonitor.Log($"[{horse.Name}] | Manners: {horse.Manners} | Skin: {horseSkin} | Wild: {horse.Manners == WildHorse.WildID}", LogLevel.Info);
                    }
                }
                break;


            case "summon_stray":
                if (!EnforceArgCount(args, 0))
                {
                    break;
                }

                // Get rid of any previous stray still on the map
                if (ModEntry.Creator.StrayInfo != null)
                {
                    ModEntry.Creator.StrayInfo.RemoveFromWorld();
                }
                // Create a gosh darn new stray
                ModEntry.Creator.StrayInfo = new Stray();
                break;


            case "summon_horse":
                if (!EnforceArgCount(args, 0))
                {
                    break;
                }

                // Get rid of any previous horse still on the map
                if (ModEntry.Creator.HorseInfo != null)
                {
                    ModEntry.Creator.HorseInfo.RemoveFromWorld();
                }
                // Create a gosh darn new horse
                ModEntry.Creator.HorseInfo = new WildHorse();
                break;


            case "debug_clearunowned":
                if (!EnforceArgCount(args, 0))
                {
                    break;
                }

                foreach (NPC npc in Utility.getAllCharacters())
                {
                    if (npc is Horse horse && horse.Manners == WildHorse.WildID)
                    {
                        Game1.removeThisCharacterFromAllLocations(horse);
                    }
                    if (npc is Pet pet && pet.Manners == Stray.StrayID)
                    {
                        Game1.removeThisCharacterFromAllLocations(pet);
                    }
                }
                break;


            // Expected arguments: <horse ID>
            case "debug_find":
                // Enforce argument constraints
                if (!EnforceArgCount(args, 2) ||
                    !EnforceArgTypeCategory(args[0], 1) ||
                    !EnforceArgTypeInt(args[1], 2))
                {
                    break;
                }

                string cat = ModEntry.Sanitize(args[0]);
                int    id  = int.Parse(args[1]);

                switch (cat)
                {
                case "horse":
                    foreach (Horse horse in ModEntry.GetHorses())
                    {
                        if (horse.Manners == id)
                        {
                            ModEntry.SMonitor.Log($"{horse.Name} located at: {horse.currentLocation} | {horse.getTileX()}, {horse.getTileY()}", LogLevel.Alert);
                        }
                    }
                    break;

                case "pet":
                    foreach (Pet pet in ModEntry.GetPets())
                    {
                        if (pet.Manners == id)
                        {
                            ModEntry.SMonitor.Log($"{pet.Name} located at: {pet.currentLocation} | {pet.getTileX()}, {pet.getTileY()}", LogLevel.Alert);
                        }
                    }
                    break;

                case "animal":
                    foreach (FarmAnimal animal in ModEntry.GetAnimals())
                    {
                        if (ModEntry.AnimalLongToShortIDs[animal.myID.Value] == id)
                        {
                            ModEntry.SMonitor.Log($"{animal.Name} located at: {animal.currentLocation} | {animal.getTileX()}, {animal.getTileY()}", LogLevel.Alert);
                        }
                    }
                    break;

                default:
                    break;
                }

                break;


            case "horse_whistle":
                if (args.ToList().Count == 1)
                {
                    // Enforce argument constraints
                    if (!EnforceArgTypeInt(args[0], 1))
                    {
                        break;
                    }

                    int callID = int.Parse(args[0]);
                    foreach (Horse horse in ModEntry.GetHorses())
                    {
                        if (horse.Manners == callID)
                        {
                            Game1.warpCharacter(horse, Game1.player.currentLocation, Game1.player.getTileLocation());
                            return;
                        }
                    }
                    // Horse with given ID wasn't found
                    ModEntry.SMonitor.Log($"No horse exists with the given ID: {callID}", LogLevel.Error);
                }
                else
                {
                    // Enforce argument constraints
                    if (!EnforceArgCount(args, 0))
                    {
                        break;
                    }

                    // Call the first horse found
                    ModEntry.CallHorse();
                }
                break;


            case "corral_horses":
                ModEntry.CorralHorses();
                break;


            case "sell":
                // Enforce argument constraints
                if (!EnforceArgCount(args, 2))
                {
                    break;
                }
                if (!EnforceArgTypeCategory(args[0], 1))
                {
                    break;
                }
                if (!EnforceArgTypeInt(args[1], 2))
                {
                    break;
                }


                string type   = ModEntry.Sanitize(args[0]);
                int    sellID = int.Parse(args[1]);
                ModEntry.CreatureCategory sellCategory = ModEntry.CreatureCategory.Animal;
                if (type == "horse")
                {
                    if (!ModEntry.HorseSkinMap.ContainsKey(sellID))
                    {
                        ModEntry.SMonitor.Log($"Horse with the given ID does not exist: {sellID}", LogLevel.Error);
                        return;
                    }
                    sellCategory = ModEntry.CreatureCategory.Horse;
                }
                else if (type == "pet")
                {
                    if (!ModEntry.PetSkinMap.ContainsKey(sellID))
                    {
                        ModEntry.SMonitor.Log($"Pet with the given ID does not exist: {sellID}", LogLevel.Error);
                        return;
                    }
                    sellCategory = ModEntry.CreatureCategory.Pet;
                }
                else
                {
                    ModEntry.SMonitor.Log("Go sell that somewhere else.", LogLevel.Error);
                    return;
                }

                if (sellCategory != ModEntry.CreatureCategory.Animal)
                {
                    Character sellCreature = ModEntry.GetCreature(sellCategory, sellID);
                    Game1.activeClickableMenu = new ConfirmationDialog($"Are you sure you want to sell your {ModEntry.Sanitize(sellCreature.GetType().Name)}, {sellCreature.Name}?", (who) =>
                    {
                        if (Game1.activeClickableMenu is StardewValley.Menus.ConfirmationDialog cd)
                        {
                            cd.cancel();
                        }

                        Earth.RemoveCreature(sellCategory, sellID);
                        Game1.removeThisCharacterFromAllLocations((NPC)sellCreature);
                    });
                }

                break;


            // Expected arguments: <creature type/category/group>
            case "list_creatures":
                // Enforce argument constraints
                if (!EnforceArgCount(args, 1) ||
                    !EnforceArgTypeGroup(args[0]))
                {
                    break;
                }

                PrintRequestedCreatures(ModEntry.Sanitize(args[0]));
                break;


            // Expected arguments: None.
            case "randomize_all_skins":
                // Enforce argument constraints
                if (!EnforceArgCount(args, 0))
                {
                    break;
                }

                // Randomize all skins
                foreach (Horse horse in ModEntry.GetHorses())
                {
                    Earth.SetRandomSkin(horse);
                }
                foreach (Pet pet in ModEntry.GetPets())
                {
                    Earth.SetRandomSkin(pet);
                }
                foreach (FarmAnimal animal in ModEntry.GetAnimals())
                {
                    Earth.SetRandomSkin(animal);
                }

                ModEntry.SMonitor.Log("All animal, pet, and horse skins have been randomized.", LogLevel.Alert);
                break;


            // Expected arguments: <creature category>, <creature ID>
            case "randomize_skin":
                // Enforce argument constraints
                if (!EnforceArgCount(args, 2))
                {
                    break;
                }
                if (!EnforceArgTypeCategory(args[0], 1) || !EnforceArgTypeInt(args[1], 2))
                {
                    break;
                }

                string    category   = ModEntry.Sanitize(args[0]);
                int       creatureID = int.Parse(args[1]);
                Character creature   = null;

                // Find associated creature instance
                if (category == "horse" && ModEntry.HorseSkinMap.ContainsKey(creatureID))
                {
                    creature = ModEntry.GetCreature(ModEntry.CreatureCategory.Horse, creatureID);
                }
                else if (category == "pet" && ModEntry.PetSkinMap.ContainsKey(creatureID))
                {
                    creature = ModEntry.GetCreature(ModEntry.CreatureCategory.Pet, creatureID);
                }
                else if (category == "animal" && ModEntry.AnimalShortToLongIDs.ContainsKey(creatureID))
                {
                    creature = ModEntry.GetCreature(ModEntry.CreatureCategory.Animal, ModEntry.AnimalShortToLongIDs[creatureID]);
                }


                // A creature was able to be located with the given category and ID
                if (creature != null)
                {
                    int newSkin = Earth.SetRandomSkin(creature);
                    if (newSkin == 0)
                    {
                        ModEntry.SMonitor.Log($"No skins are located in `/assets/skins` for {creature.Name}'s type: {ModEntry.Sanitize(creature.GetType().Name)}", LogLevel.Error);
                    }
                    else
                    {
                        ModEntry.SMonitor.Log($"{creature.Name}'s skin has been randomized.", LogLevel.Alert);
                    }
                }
                else
                {
                    ModEntry.SMonitor.Log($"Creature category `{category}` with given ID does not exist: {creatureID}", LogLevel.Error);
                }


                break;


            // Expected arguments: <skin ID>, <creature category>, <creature ID>
            case "set_skin":
                // Enforce argument constraints
                if (!EnforceArgCount(args, 3))
                {
                    break;
                }
                if (!EnforceArgTypeInt(args[0], 1) || !EnforceArgTypeCategory(args[1], 2) || !EnforceArgTypeInt(args[2], 3))
                {
                    break;
                }

                int       skinID         = int.Parse(args[0]);
                string    creatureCat    = ModEntry.Sanitize(args[1]);
                int       shortID        = int.Parse(args[2]);
                Character creatureToSkin = null;

                if (creatureCat == "horse" && ModEntry.HorseSkinMap.ContainsKey(shortID))
                {
                    creatureToSkin = ModEntry.GetCreature(ModEntry.CreatureCategory.Horse, shortID);

                    // Ensure that the skin ID given exists in Adopt & Skin
                    if (!EnforceArgRange(skinID, ModEntry.HorseAssets[ModEntry.Sanitize(creatureToSkin.GetType().Name)].Count, 1))
                    {
                        break;
                    }

                    // Set skin
                    ModEntry.HorseSkinMap[shortID] = skinID;
                }
                else if (creatureCat == "pet" && ModEntry.PetSkinMap.ContainsKey(shortID))
                {
                    creatureToSkin = ModEntry.GetCreature(ModEntry.CreatureCategory.Pet, shortID);

                    // Ensure that the skin ID given exists in Adopt & Skin
                    if (!EnforceArgRange(skinID, ModEntry.PetAssets[ModEntry.Sanitize(creatureToSkin.GetType().Name)].Count, 1))
                    {
                        break;
                    }

                    // Set skin
                    ModEntry.PetSkinMap[shortID] = skinID;
                }
                else if (creatureCat == "animal" && ModEntry.AnimalShortToLongIDs.ContainsKey(shortID))
                {
                    FarmAnimal animal = ModEntry.GetCreature(ModEntry.CreatureCategory.Animal, ModEntry.AnimalShortToLongIDs[shortID]) as FarmAnimal;
                    creatureToSkin = animal;

                    // Ensure that the skin ID given exists in Adopt & Skin
                    if (!EnforceArgRange(skinID, ModEntry.AnimalAssets[ModEntry.Sanitize(animal.type.Value)].Count, 1))
                    {
                        break;
                    }

                    // Set skin
                    ModEntry.AnimalSkinMap[ModEntry.AnimalShortToLongIDs[shortID]] = skinID;
                }


                // Successfully found given creature to set skin for. Run a skin update.
                if (creatureToSkin != null)
                {
                    Earth.UpdateSkin(creatureToSkin);
                    ModEntry.SMonitor.Log($"{creatureToSkin.Name}'s skin has been set to skin {skinID}", LogLevel.Alert);
                }
                else
                {
                    ModEntry.SMonitor.Log($"Skin setting error. Creature category {creatureCat} ID {shortID} could not be given skin {skinID}", LogLevel.Error);
                }

                break;


            default:
                break;
            }
        }
 /// <summary>Refreshes creature information based on how much information the save file contains</summary>
 internal static void LoadCreatureSkins()
 {
     // File is new to A&S. Add all creatures into the system
     if (ModEntry.AnimalSkinMap.Count == 0 && ModEntry.PetSkinMap.Count == 0 && ModEntry.HorseSkinMap.Count == 0)
     {
         foreach (FarmAnimal animal in ModEntry.GetAnimals())
         {
             Entry.AddCreature(animal);
         }
         foreach (Pet pet in ModEntry.GetPets())
         {
             Entry.AddCreature(pet);
         }
         foreach (Horse horse in ModEntry.GetHorses())
         {
             Entry.AddCreature(horse);
         }
     }
     // Refresh skins on creatures + add creatures to system if the save is an older version
     else
     {
         foreach (FarmAnimal animal in ModEntry.GetAnimals())
         {
             if (!ModEntry.AnimalLongToShortIDs.ContainsKey(animal.myID.Value))
             {
                 Entry.AddCreature(animal);
             }
             else
             {
                 Entry.UpdateSkin(animal);
             }
         }
         foreach (Pet pet in ModEntry.GetPets())
         {
             if (pet.Manners == 0)
             {
                 Entry.AddCreature(pet);
             }
             // Remove extra Strays left on map
             else if (pet.Manners == Stray.StrayID && (ModEntry.Creator.StrayInfo == null || ModEntry.Creator.StrayInfo.PetInstance != pet))
             {
                 Game1.removeThisCharacterFromAllLocations(pet);
             }
             else
             {
                 Entry.UpdateSkin(pet);
             }
         }
         foreach (Horse horse in ModEntry.GetHorses())
         {
             // Don't add tractors to the system
             if (horse.Manners == 0 && !horse.Name.StartsWith("tractor/"))
             {
                 Entry.AddCreature(horse);
             }
             // Remove extra WildHorses left on the map
             else if (horse.Manners == WildHorse.WildID && (ModEntry.Creator.HorseInfo == null || ModEntry.Creator.HorseInfo.HorseInstance != horse))
             {
                 Game1.removeThisCharacterFromAllLocations(horse);
             }
             else if (!horse.Name.StartsWith("tractor/"))
             {
                 Entry.UpdateSkin(horse);
             }
         }
     }
 }