Example #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();
             }
         }
     }
 }
Example #2
0
 internal void CommandFired_TestAdoption(string name, string[] args)
 {
     if (!DogTextures.Any() && !CatTextures.Any())
     {
         return;
     }
     random = new Random();
     AdoptQuestion.Show();
 }