Exemplo n.º 1
0
        public string GetWeatherForDate(WorldDate date, GameLocation location)
        {
            if (location is null)
            {
                throw new ArgumentNullException(nameof(location));
            }

            string val;

            if (location is Desert)
            {
                val = "Desert";
            }
            else
            {
                GameLocation.LocationContext ctx = location.GetLocationContext();
                switch (ctx)
                {
                case GameLocation.LocationContext.Default:
                    val = "Default";
                    break;

                case GameLocation.LocationContext.Island:
                    val = "Island";
                    break;

                default:
                    throw new ArgumentException("Invalid location context");
                }
            }

            return(GetWeatherForDate(date, val));
        }
Exemplo n.º 2
0
        public override ActionResponse Handle()
        {
            if (hasTriggeredToday)
            {
                return(ActionResponse.Retry);
            }

            Farmer who = Game1.player;

            GameLocation.LocationContext location_context = Game1.currentLocation.GetLocationContext();

            if (location_context == GameLocation.LocationContext.Default)
            {
                if (Game1.netWorldState.Value.WeatherForTomorrow == (Game1.weatherForTomorrow = weather))
                {
                    return(ActionResponse.Retry);
                }

                if (!Utility.isFestivalDay(Game1.dayOfMonth + 1, Game1.currentSeason))
                {
                    Game1.netWorldState.Value.WeatherForTomorrow = (Game1.weatherForTomorrow = weather);
                    Game1.pauseThenMessage(2000, $" {this.from} has spoken {Game1.content.LoadString("Strings\\StringsFromCSFiles:Object.cs.12822")}", showProgressBar: false);
                    hasTriggeredToday = true;
                }
                else
                {
                    return(ActionResponse.Retry);
                }
            }
            else
            {
                if (Game1.netWorldState.Value.GetWeatherForLocation(location_context).weatherForTomorrow.Value == weather)
                {
                    return(ActionResponse.Retry);
                }
                else
                {
                    Game1.netWorldState.Value.GetWeatherForLocation(location_context).weatherForTomorrow.Value = weather;
                    Game1.pauseThenMessage(2000, $" {this.from}: {Game1.content.LoadString("Strings\\StringsFromCSFiles:Object.cs.12822")}", showProgressBar: false);
                    hasTriggeredToday = true;
                }
            }
            Game1.screenGlow = false;
            who.currentLocation.playSound("thunder");
            Game1.screenGlowOnce(Color.SlateBlue, hold: false);

            DelayedAction.playSoundAfterDelay("rainsound", 2000);

            return(ActionResponse.Done);
        }
Exemplo n.º 3
0
 public LocationWeather GetWeatherForLocation(GameLocation.LocationContext location_context)
 {
     return(GetWeatherForLocation((int)location_context));
 }
 private static bool Before_GetLocationContext(GameLocation __instance, ref GameLocation.LocationContext __result)
 {
     __result = GetLocationContextImpl(__instance);
     return(false);
 }