Esempio n. 1
0
 /*********
 ** Private methods
 *********/
 /// <summary>The method called after the player enters a new location.</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 private void LocationEvents_CurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
 {
     if (e.NewLocation is FarmHouse && Game1.player.spouse == "Wizard")
     {
         this.LoadSpouseRoom();
     }
 }
Esempio n. 2
0
        private void LocationEvents_CurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
        {
            if (e.NewLocation is Farm farm)
            {
                for (int i = 0; i < farm.buildings.Count; ++i)
                {
                    // This is probably a new building if it hasn't been converted yet.
                    if (farm.buildings[i].buildingType == "Brewery" &&
                        farm.buildings[i].GetType() == typeof(Building))
                    {
                        var b = farm.buildings[i];

                        farm.buildings[i] = new BreweryBuilding();
                        farm.buildings[i].buildingType       = b.buildingType;
                        farm.buildings[i].humanDoor          = b.humanDoor;
                        farm.buildings[i].indoors            = b.indoors;
                        farm.buildings[i].indoors.isOutdoors = false;
                        farm.buildings[i].nameOfIndoors      = b.nameOfIndoors;
                        farm.buildings[i].tileX     = b.tileX;
                        farm.buildings[i].tileY     = b.tileY;
                        farm.buildings[i].tilesWide = b.tilesWide;
                        farm.buildings[i].tilesHigh = b.tilesHigh;
                        farm.buildings[i].load();
                    }
                }
            }
        }
Esempio n. 3
0
 private void restoreRegularHorse(object sender, EventArgsCurrentLocationChanged e)
 {
     if (e.NewLocation is FarmHouse)
     {
         restoreHorse(null, null);
     }
 }
 private void LocationEvents_CurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
 {
     if (Game1.currentLocation is DecoratableLocation dl)
     {
         checkLocation(dl);
     }
 }
Esempio n. 5
0
 //misleading event wireup is actually for the has-all-professions mod, which enables all professions at the appropriate level.
 private void LocationEvents_CurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
 {
     if (hasAllProfessionsMod)
     {
         List <int>         professions = Game1.player.professions;
         List <List <int> > list        = new List <List <int> > {
             Professions.firstRankProfessions, Professions.secondRankProfessions
         };
         foreach (List <int> current in list)
         {
             bool flag = professions.Intersect(current).Any <int>();
             if (flag)
             {
                 foreach (int current2 in current)
                 {
                     bool flag2 = !professions.Contains(current2);
                     if (flag2)
                     {
                         professions.Add(current2);
                     }
                 }
             }
         }
     }
 }
 public void LocationEvents_CurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
 {
     if (e.NewLocation is MineShaft)
     {
         ms = e.NewLocation as MineShaft;
     }
 }
Esempio n. 7
0
        /*********
        ** Private methods
        *********/
        /// <summary>The method invoked when the player presses a keyboard button.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event data.</param>
        private void LocationEvents_CurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
        {
            ModConfig config = this.Helper.ReadConfig <ModConfig>();

            if (Context.IsWorldReady)
            {
                if (config.logLocation)
                {
                    playerLocation = " at this coordinates: " + Game1.currentLocation.ToString() + "  also known as: " + Game1.currentLocation.name;
                }
                else
                {
                    playerLocation = "";
                }
                if (config.logMusic)
                {
                    musicPlaying = " this music: " + Game1.currentSong.Name;
                }
                else
                {
                    musicPlaying = "";
                }
                log = "Player entered" + playerLocation + " and" + musicPlaying;
                Monitor.Log(log);
            }
        }
 private void LocationEvents_CurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
 {
     if (e.NewLocation is GameLocation g && g.map is Map m && m.Properties.ContainsKey("EntryAction"))
     {
         TileAction.invokeCustomTileActions("EntryAction", g, Vector2.Zero, "Map");
     }
 }
Esempio n. 9
0
 /*********
 ** Private methods
 *********/
 /// <summary>The method called when the player enters a new location.</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 private void LocationEvents_CurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
 {
     if (this.Config.Locations.Contains(e.NewLocation.Name))
     {
         this.ApplyWatering(e.NewLocation);
     }
 }
Esempio n. 10
0
 internal void LocationEvents_CurrentLocationChanged(object s, EventArgsCurrentLocationChanged e)
 {
     if (e.NewLocation.name == "Farm" || (e.PriorLocation != null && e.PriorLocation.isOutdoors != e.NewLocation.isOutdoors))
     {
         UpdateTextures();
     }
 }
Esempio n. 11
0
 /// <summary>The method invoked when the player warps into a new location.</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event data.</param>
 private void ReceiveCurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
 {
     if (this.DebugMode)
     {
         this.CorrectEntryPosition(e.NewLocation, Game1.player);
     }
 }
Esempio n. 12
0
 internal void LocationEvents_CurrentLocationChanged(object s, EventArgsCurrentLocationChanged e)
 {
     if (Game1.hasLoadedGame && Game1.currentLocation != null && ContentReady && e.NewLocation.name == "Farm")
     {
         UpdateTextures();
     }
 }
Esempio n. 13
0
 private void LocationEvents_CurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
 {
     if (e.PriorLocation is Farm)
     {
         saveHoeDirt();
         hoeDirtReplaced = false;
     }
 }
Esempio n. 14
0
 private void OnCurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
 {
     if (!IsMappingActivated)
     {
         return;
     }
     Log.Trace("Location changed...");
     Traverser.Instance.TraverseLocation(Game1.currentLocation, Wrap);
 }
Esempio n. 15
0
        /// <summary>The event called when the player warps to a new location.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void LocationEvents_CurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
        {
            if (!this.IsEnabled)
            {
                return;
            }

            this.Tractor?.UpdateForNewLocation(e.PriorLocation, e.NewLocation);
        }
        private void Event_LocationChanged(object send, EventArgsCurrentLocationChanged e)
        {
            var priorlocation = e.PriorLocation;

            if (e.NewLocation is FarmHouse)
            {
                FarmHouse ptrFH = (FarmHouse)Game1.currentLocation;
            }
        }
Esempio n. 17
0
 private void LocationEvents_CurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
 {
     // spawn tractor house & tractor
     if (this.IsNewDay && e.NewLocation == this.Farm)
     {
         this.LoadModInfo();
         this.IsNewDay = false;
     }
 }
Esempio n. 18
0
 /*********
 ** Private methods
 *********/
 /****
 ** Event handlers
 ****/
 /// <summary>The method called when the player warps to a new location.</summary>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 private void ReceiveCurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
 {
     // when player enters farmhouse (including on new day), back up crops in case they're
     // about to end the day
     if (e.NewLocation is FarmHouse)
     {
         this.StashCrops();
     }
 }
Esempio n. 19
0
 private void ReceiveCurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
 {
     if (!e.NewLocation.name.Equals(Constants.FARM) || Game1.timeOfDay == 2400)
     {
         return;
     }
     harvestableNotification.CheckHarvestsOnFarm();
     productionNotification.CheckProductionAroundFarm();
 }
Esempio n. 20
0
 private void LocationEvents_CurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
 {
     if (Game1.player == null)
     {
         return;
     }
     if (Game1.player.currentLocation != null)
     {
         Game1.showGlobalMessage(getLocationNames(Game1.player.currentLocation.Name));
     }
 }
        private void OnCurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
        {
            if (!IsActivated)
            {
                return;
            }
            var sw = Stopwatch.StartNew();

            Traverser.Instance.TraverseLocationDeep(Game1.currentLocation, ToSmartObject);
            Log.Info($"Activation of objects(cause: entered to {Game1.currentLocation?.Name}) finished: {sw.ElapsedMilliseconds} ms");
        }
Esempio n. 22
0
 private static void watchCurrentLocation_1(object sender, EventArgsCurrentLocationChanged args)
 {
     if (args.PriorLocation != null)
     {
         args.PriorLocation.objects.CollectionChanged -= watchCurrentLocation_2;
     }
     if (args.NewLocation != null)
     {
         args.NewLocation.objects.CollectionChanged += watchCurrentLocation_2;
     }
 }
 private void CurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
 {
     if (e.NewLocation.name == _locationOfLetterbox)
     {
         // Only watch for mouse events while at the location of the letterbox, for performance
         ControlEvents.MouseChanged += MouseChanged;
     }
     else
     {
         ControlEvents.MouseChanged -= MouseChanged;
     }
 }
Esempio n. 24
0
        /// <summary>The method invoked after the player warps to a new location.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void LocationEvents_CurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
        {
            if (!Context.IsWorldReady || Game1.eventUp || !this.Handlers.Any())
            {
                return;
            }

            foreach (IAnimationHandler handler in this.Handlers)
            {
                handler.OnNewLocation(e.NewLocation);
            }
        }
        /// <summary>The event invoked when the player loads a new map.</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>
        private void ReceiveCurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
        {
            // get farm
            Farm farm = e.NewLocation as Farm;

            if (farm == null)
            {
                return;
            }

            this.PrepareMapForRendering(farm);
        }
Esempio n. 26
0
 private void LocationEvents_CurrentLocationChanged(object sender, EventArgsCurrentLocationChanged e)
 {
     //  if (Game1.currentLocation is SlimeHutch)
     //  {
     //      var smeHutch = Game1.currentLocation as SlimeHutch;
     //      var slimeHutch = new SlimeHutch();
     //      slimeHutch.add
     //      foreach (GreenSlime Slime in smeHutch.characters)
     //      {
     //
     //      }
     //    }
 }
Esempio n. 27
0
        /// <summary>
        /// Handles a change timespeed when moving between locations
        /// </summary>
        private void adjustIndoorOutdoorTimer(object sender, EventArgsCurrentLocationChanged e)
        {
            int option = e.NewLocation.isOutdoors ? ModEntry.modData.intOptions[QualityOfLifeModOptions.TIME_PER_TEN_MINUTE_OPTION] : ModEntry.modData.intOptions[QualityOfLifeModOptions.TIME_PER_TEN_MINUTE_INSIDE_OPTION];

            amountOfTimeToAlterPerTenMinutes = optionTable[option];

            int timePerTenMinute = optionTable[option];
            int totalTimeNeededForUpdatedTick        = timePerTenMinute + 7000;
            int timeStillNeededToCompleteUpdatedTick = totalTimeNeededForUpdatedTick - timePassedPerTenMinuteUpdate;

            // Time will be added no matter what so only reduce to 0
            Game1.gameTimeInterval = Math.Max(7000 - timeStillNeededToCompleteUpdatedTick, 0);
        }
Esempio n. 28
0
 private void OnLocationChange(object sender, EventArgsCurrentLocationChanged e)
 {
     if (e.NewLocation is AnimalHouse ||
         e.NewLocation is Farm)
     {
         _timer.Interval = 1000;
         _timer.Start();
     }
     else
     {
         _timer.Stop();
         StopDrawingPetNeeds();
     }
 }
Esempio n. 29
0
 /// <summary>
 /// Starts or stops the timer to display hand icon when pets are still needed
 /// </summary>
 private void onLocationChange(object sender, EventArgsCurrentLocationChanged e)
 {
     // Only start timer in places where animals exist
     if (e.NewLocation is AnimalHouse || e.NewLocation is Farm)
     {
         timer.Interval = 5000;
         timer.Start();
     }
     else
     {
         timer.Stop();
         GraphicsEvents.OnPreRenderHudEvent -= drawNeedsPetTooltip;
     }
 }
Esempio n. 30
0
 private void AdjustIconXToBlackBorder(object sender, EventArgsCurrentLocationChanged e)
 {
     _icon = new ClickableTextureComponent("",
                                           new Rectangle(Tools.GetWidthInPlayArea() - 134,
                                                         290,
                                                         10 * Game1.pixelZoom,
                                                         10 * Game1.pixelZoom),
                                           "",
                                           "",
                                           Game1.mouseCursors,
                                           new Rectangle(50, 428, 10, 14),
                                           Game1.pixelZoom,
                                           false);
 }