Beispiel #1
0
 private void CheckForAction()
 {
     if (!Game1.hasLoadedGame)
     {
         return;
     }
     if (!Game1.player.UsingTool && !Game1.pickingTool && !Game1.menuUp && (!Game1.eventUp || Game1.currentLocation.currentEvent.playerControlSequence) && !Game1.nameSelectUp && Game1.numberOfSelectedItems == -1 && !Game1.fadeToBlack)
     {
         Vector2 grabTile = new Vector2((Game1.getOldMouseX() + Game1.viewport.X), (Game1.getOldMouseY() + Game1.viewport.Y)) / Game1.tileSize;
         if (!Utility.tileWithinRadiusOfPlayer((int)grabTile.X, (int)grabTile.Y, 1, Game1.player))
         {
             grabTile = Game1.player.GetGrabTile();
         }
         Tile          tile          = Game1.currentLocation.map.GetLayer("Buildings").PickTile(new xTile.Dimensions.Location((int)grabTile.X * Game1.tileSize, (int)grabTile.Y * Game1.tileSize), Game1.viewport.Size);
         PropertyValue propertyValue = null;
         if (tile != null)
         {
             tile.Properties.TryGetValue("Action", out propertyValue);
         }
         if (propertyValue != null && "MorePetsAdoption".Equals(propertyValue))
         {
             int seed = Game1.year * 1000 + seasons.IndexOf(Game1.currentSeason) * 100 + Game1.dayOfMonth;
             random = new Random(seed);
             List <NPC> list = GetAllPets();
             if ((!DogTextures.Any() && !CatTextures.Any()) || (Config.UseMaxAdoptionLimit && list.Count >= Config.MaxAdoptionLimit) || random.NextDouble() < Math.Max(0.1, Math.Min(0.9, list.Count * Config.RepeatedAdoptionPenality)) || list.FindIndex(a => a.age == seed) != -1)
             {
                 Game1.drawObjectDialogue("Just an empty box.");
             }
             else
             {
                 AdoptQuestion.Show();
             }
         }
     }
 }
Beispiel #2
0
 internal void CommandFired_TestAdoption(string name, string[] args)
 {
     if (!DogTextures.Any() && !CatTextures.Any())
     {
         return;
     }
     random = new Random();
     AdoptQuestion.Show();
 }
Beispiel #3
0
        internal static void Show()
        {
            Random rnd = MorePetsMod.random;

            int catLimit = MorePetsMod.CatTextures.Length;
            int dogLimit = MorePetsMod.DogTextures.Length;

            bool          cat = catLimit != 0 && (dogLimit == 0 || rnd.NextDouble() < 0.5);
            AdoptQuestion q   = new AdoptQuestion(cat, rnd.Next(1, cat ? catLimit : dogLimit));

            GraphicsEvents.OnPostRenderHudEvent  += q.Display;
            Game1.currentLocation.lastQuestionKey = "AdoptPetQuestion";
            Game1.currentLocation.createQuestionDialogue(
                "Oh dear, it looks like someone has abandoned a poor " + (cat ? "Cat" : "Dog") + " here! Perhaps you should pay Marnie " + MorePetsMod.Config.AdoptionPrice + " gold to give it a checkup so you can adopt it?",
                Game1.player.money < MorePetsMod.Config.AdoptionPrice ?
                new Response[] {
                new Response("n", "Unfortunately I do not have the required " + MorePetsMod.Config.AdoptionPrice + " gold in order to do this.")
            } :
                new Response[] {
                new Response("y", "Yes, I really should adopt the poor animal!"),
                new Response("n", "No, I do not have the space to house it.")
            },
                q.Resolver, null);
        }