private static void HandleFindProduce(ref Decorators.FarmAnimal moddedAnimal, ref Location moddedLocation)
        {
            var moddedPlayer = new Farmer(Game.GetPlayer());

            if (!IsValidLocation(moddedLocation) || !CanFindProduce(moddedAnimal, moddedPlayer) ||
                Random.NextDouble() >= 0.0002 || !HasNoImpediments(moddedAnimal, moddedLocation))
            {
                return;
            }
            if (moddedPlayer.IsCurrentLocation(moddedLocation.GetOriginal()))
            {
                BellsAndWhistles.PlaySound("dirtyHit", 450);
                BellsAndWhistles.PlaySound("dirtyHit", 900);
                BellsAndWhistles.PlaySound("dirtyHit", 1350);
            }

            if (Game.IsCurrentLocation(moddedLocation.GetOriginal()))
            {
                moddedAnimal.AnimateFindingProduce();
            }
            else
            {
                moddedAnimal.FindProduce(moddedPlayer.GetOriginal());
            }
        }
 private static void PurchasedAnimalBellsAndWhistles(Decorators.FarmAnimal moddedAnimal)
 {
     if (moddedAnimal.MakesSound())
     {
         BellsAndWhistles.CueSound(moddedAnimal.GetSound(), "Pitch", 1200 + Random.Next(-200, 201));
     }
     BellsAndWhistles.AddHudMessage(
         Content.LoadString("Strings\\StringsFromCSFiles:PurchaseAnimalsMenu.cs.11324", moddedAnimal.GetDisplayType()),
         Color.LimeGreen, 3500f);
 }
Beispiel #3
0
        public static bool Prefix(ref StardewValley.Menus.PurchaseAnimalsMenu __instance, ref SpriteBatch b)
        {
            var purchaseAnimalsMenu = new Decorators.PurchaseAnimalsMenu(__instance);
            var farmAnimal          = new Decorators.FarmAnimal(purchaseAnimalsMenu.GetAnimalBeingPurchased());

            if (!BellsAndWhistles.IsFaded() && purchaseAnimalsMenu.IsOnFarm())
            {
                var str = Content.FormatMoneyString(farmAnimal.GetPrice());
                var x   = Game.GetViewport().Width / 2 - Content.GetWidthOfString(str) / 2;
                var y   = (int)(18.0 * SpriteText.fontPixelZoom * 2.0);
                BellsAndWhistles.DrawScroll(b, str, x, y);
            }

            return(true);
        }
 private static void SelectedStockBellsAndWhistles(ref Decorators.PurchaseAnimalsMenu moddedMenu)
 {
     BellsAndWhistles.FadeToBlack(afterFade: moddedMenu.GetOriginal().setUpForAnimalPlacement);
     BellsAndWhistles.PlaySound("smallSelect");
 }
 private static bool IsActionable(Decorators.PurchaseAnimalsMenu moddedMenu)
 {
     return(!BellsAndWhistles.IsFaded() && !moddedMenu.IsFrozen());
 }