Added pet to character customization menu

master
Mohammad Shoaib 2022-04-02 15:49:18 +05:30
parent bfad0676bd
commit 7ecf7fb30c
1 changed files with 34 additions and 0 deletions

View File

@ -1,5 +1,7 @@
using StardewValley;
using StardewValley.Characters;
using StardewValley.Menus;
using static StardewValley.Menus.CharacterCustomization;
using static StardewValley.Menus.LoadGameMenu;
namespace stardew_access.Patches
@ -208,6 +210,15 @@ namespace stardew_access.Patches
if (__instance.favThingBoxCC != null && __instance.favThingBoxCC.visible)
buttons.Add(__instance.favThingBoxCC, "Enter Favourite Thing");
if (__instance.petPortraitBox.HasValue) // Cannot get petButtons like with others
{
ClickableComponent petPrev = __instance.getComponentWithID(511);
buttons.Add(petPrev, "Previous pet: " + getPetName(-1, __instance.isModifyingExistingPet));
ClickableComponent petNext = __instance.getComponentWithID(510);
buttons.Add(petNext, "Next pet: " + getPetName(+1, __instance.isModifyingExistingPet));
}
if (__instance.skipIntroButton != null && __instance.skipIntroButton.visible)
buttons.Add(__instance.skipIntroButton, (___skipIntro ? "Enabled" : "Disabled") + " Skip Intro Button");
@ -274,6 +285,29 @@ namespace stardew_access.Patches
}
}
private static string getPetName(int change, bool isModifyingExistingPet)
{
Game1.player.whichPetBreed += change;
if (Game1.player.whichPetBreed >= 3)
{
Game1.player.whichPetBreed = 0;
if (!isModifyingExistingPet)
{
Game1.player.catPerson = !Game1.player.catPerson;
}
}
else if (Game1.player.whichPetBreed < 0)
{
Game1.player.whichPetBreed = 2;
if (!isModifyingExistingPet)
{
Game1.player.catPerson = !Game1.player.catPerson;
}
}
return ((Game1.player.catPerson) ? "Cat" : "Dog") + " Breed: " + Game1.player.whichPetBreed;
}
private static string getFarmHoverText(ClickableTextureComponent farm)
{
string hoverTitle = " ", hoverText = " ";