Exemplo n.º 1
0
        // Method that is used to postfix world change events
        private static void WorldChangeEvent_setUp_Postfix(WorldChangeEvent __instance)
        {
            try
            {
                switch (__instance.whichEvent.Value)
                {
                // If the world change event in question is building the Joja greenhouse, add Joja greenhouse conversation topic
                case 0:
                    try
                    {
                        MCTHelperFunctions.AddOrExtendCT("joja_Greenhouse", Config.JojaGreenhouseDuration);
                    }
                    catch (Exception ex)
                    {
                        Monitor.Log($"Failed to add Joja greenhouse conversation topic with exception: {ex}", LogLevel.Error);
                    }
                    break;

                // If the world change event is the abandoned JojaMart being struck by lightning, add JojaMart lightning conversation topic
                case 12:
                    try
                    {
                        MCTHelperFunctions.AddOrExtendCT("jojaMartStruckByLightning", Config.JojaLightningDuration);
                    }
                    catch (Exception ex)
                    {
                        Monitor.Log($"Failed to add abandonded JojaMart struck by lightning conversation topic with exception: {ex}", LogLevel.Error);
                    }
                    break;

                // If the world change event is Willy's boat being repaired, add Willy boat repair conversation topic
                case 13:
                    try
                    {
                        MCTHelperFunctions.AddOrExtendCT("willyBoatRepaired", Config.WillyBoatRepairDuration);
                    }
                    catch (Exception ex)
                    {
                        Monitor.Log($"Failed to add Willy's boat repaired conversation topic with exception: {ex}", LogLevel.Error);
                    }
                    break;

                // If the world change event in question is Leo arriving in the valley, add Leo arrival conversation topic
                case 14:
                    try
                    {
                        MCTHelperFunctions.AddOrExtendCT("leoValleyArrival", Config.LeoArrivalDuration);
                    }
                    catch (Exception ex)
                    {
                        Monitor.Log($"Failed to add Leo arrival to the valley conversation topic with exception: {ex}", LogLevel.Error);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Monitor.Log($"Failed to do world change event postfix with exception: {ex}", LogLevel.Error);
            }
        }
Exemplo n.º 2
0
            internal static void setUpGreenhouseJoja(WorldChangeEvent wce)
            {
                Game1.currentLightSources.Clear();
                Game1.getFarm().temporarySprites.Clear();

                GameLocation location = Game1.getFarm();

                string[] position           = location.map.Properties["Greenhouse"].ToString().Split(',');
                Point    greenHousePosition = new Point(int.Parse(position[0]), int.Parse(position[1]));

                int sourceXTile = greenHousePosition.X;
                int sourceYTile = greenHousePosition.Y - 2;

                Game1.isRaining = false;

                location.temporarySprites.Add(new TemporaryAnimatedSprite(Game1.mouseCursors, new Rectangle(288, 1349, 19, 28), 150f, 5, 999, new Vector2((float)((sourceXTile - 3) * Game1.tileSize + 2 * Game1.pixelZoom), (float)((sourceYTile - 1) * Game1.tileSize - Game1.tileSize / 2)), false, false)
                {
                    scale      = (float)Game1.pixelZoom,
                    layerDepth = 0.0961f
                });
                location.temporarySprites.Add(new TemporaryAnimatedSprite(Game1.mouseCursors, new Rectangle(288, 1377, 19, 28), 140f, 5, 999, new Vector2((float)((sourceXTile + 3) * Game1.tileSize - 4 * Game1.pixelZoom), (float)((sourceYTile - 2) * Game1.tileSize)), false, false)
                {
                    scale      = (float)Game1.pixelZoom,
                    layerDepth = 0.0961f
                });
                location.temporarySprites.Add(new TemporaryAnimatedSprite(Game1.mouseCursors, new Rectangle(390, 1405, 18, 32), 1000f, 2, 999, new Vector2((float)(sourceXTile * Game1.tileSize + 2 * Game1.pixelZoom), (float)((sourceYTile - 3) * Game1.tileSize)), false, false)
                {
                    scale      = (float)Game1.pixelZoom,
                    layerDepth = 0.0961f
                });

                Game1.currentLightSources.Add(new LightSource(4, new Vector2(sourceXTile, sourceYTile) * Game1.tileSize, 4f));
                Game1.viewport.X = Math.Max(0, Math.Min(location.map.DisplayWidth - Game1.viewport.Width, sourceXTile * Game1.tileSize - Game1.viewport.Width / 2));
                Game1.viewport.Y = Math.Max(0, Math.Min(location.map.DisplayHeight - Game1.viewport.Height, sourceYTile * Game1.tileSize - Game1.viewport.Height / 2));
            }
Exemplo n.º 3
0
        public static bool Prefix(WorldChangeEvent __instance, ref bool __result)
        {
            NetInt evt = (NetInt)Traverse.Create(__instance).Field("whichEvent").GetValue();

            if (Memory.isCustomFarmLoaded && evt.Value == 1)
            {
                Game1.currentLightSources.Clear();
                Traverse.Create(__instance).Field("location").SetValue(null);
                int targetXTile = 64;
                int targetYTile = 116;
                //__instance.cutsceneLengthTimer = 8000;
                Traverse.Create(__instance).Field("cutsceneLengthTimer").SetValue(8000);
                //__instance.wasRaining = Game1.isRaining;
                Traverse.Create(__instance).Field("wasRaining").SetValue(Game1.isRaining);
                Game1.isRaining = false;

                GameLocation loc = (GameLocation)Traverse.Create(__instance).Field("location").GetValue();
                loc = Game1.getLocationFromName("Farm");
                loc.resetForPlayerEntry();

                Utility.addSprinklesToLocation(loc, targetXTile, 12, 7, 7, 15000, 150, Color.LightCyan, null, false);
                Utility.addStarsAndSpirals(loc, targetXTile, 12, 7, 7, 15000, 150, Color.White, null, false);
                Game1.player.activeDialogueEvents.Add("cc_Greenhouse", 3);
                //__instance.sound = "junimoMeep1";
                Traverse.Create(__instance).Field("sound").SetValue("junimoMeep1");
                Game1.currentLightSources.Add(new LightSource(4, new Vector2((float)targetXTile, (float)targetYTile) * 64f, 4f, Color.DarkGoldenrod));
                loc.temporarySprites.Add(new TemporaryAnimatedSprite("LooseSprites\\Cursors", new Rectangle(294, 1432, 16, 16), 300f, 4, 999, new Vector2(1792f, 704f), false, false)
                {
                    scale             = 4f,
                    layerDepth        = 1f,
                    xPeriodic         = true,
                    xPeriodicLoopTime = 2000f,
                    xPeriodicRange    = 16f,
                    light             = true,
                    lightcolor        = Color.DarkGoldenrod,
                    lightRadius       = 1f
                });
                //this.soundInterval = 800;
                Traverse.Create(__instance).Field("soundInterval").SetValue(800);

                //this.soundTimer = this.soundInterval;
                Traverse.Create(__instance).Field("soundTimer").SetValue(800);
                Traverse.Create(__instance).Field("location").SetValue(loc);
                Game1.currentLocation = loc;
                Game1.fadeClear();
                Game1.nonWarpFade       = true;
                Game1.timeOfDay         = 2400;
                Game1.displayHUD        = false;
                Game1.viewportFreeze    = true;
                Game1.player.position.X = -999999f;
                Game1.viewport.X        = Math.Max(0, Math.Min(loc.map.DisplayWidth - Game1.viewport.Width, targetXTile * 64 - Game1.viewport.Width / 2));
                Game1.viewport.Y        = Math.Max(0, Math.Min(loc.map.DisplayHeight - Game1.viewport.Height, targetYTile * 64 - Game1.viewport.Height / 2));
                Game1.changeMusicTrack("nightTime");
                __result = false;
                return(false);
            }
            //bypass = false;
            return(true);
        }
Exemplo n.º 4
0
 internal static void Postfix(WorldChangeEvent __instance)
 {
     if (Game1.getFarm().map.Properties.ContainsKey("Greenhouse"))
     {
         if (TMXHelper.Reflection.GetField <int>(__instance, "whichEvent").GetValue() == 0)
         {
             setUpGreenhouseJoja(__instance);
         }
         else if (TMXHelper.Reflection.GetField <int>(__instance, "whichEvent").GetValue() == 1)
         {
             setUpGreenhouseCC(__instance);
         }
     }
 }
Exemplo n.º 5
0
            internal static void setUpGreenhouseCC(WorldChangeEvent wce)
            {
                Game1.currentLightSources.Clear();
                Game1.getFarm().temporarySprites.Clear();
                GameLocation location = Game1.getFarm();

                string[] position           = location.map.Properties["Greenhouse"].ToString().Split(',');
                Point    greenHousePosition = new Point(int.Parse(position[0]), int.Parse(position[1]));

                int sourceXTile = greenHousePosition.X;
                int sourceYTile = greenHousePosition.Y - 2;

                Game1.isRaining = false;

                Utility.addSprinklesToLocation(location, sourceXTile, sourceYTile - 1, 7, 7, 15000, 150, Color.LightCyan, null, false);
                Utility.addStarsAndSpirals(location, sourceXTile, sourceYTile - 1, 7, 7, 15000, 150, Color.White, null, false);
                Game1.currentLightSources.Add(new LightSource(4, new Vector2(sourceXTile, sourceYTile) * Game1.tileSize, 4f, Color.DarkGoldenrod));
                List <TemporaryAnimatedSprite> temporarySprites1        = location.temporarySprites;
                TemporaryAnimatedSprite        temporaryAnimatedSprite1 = new TemporaryAnimatedSprite(Game1.mouseCursors, new Rectangle(294, 1432, 16, 16), 300f, 4, 999, new Vector2((sourceXTile * Game1.tileSize), ((sourceYTile - 3) * Game1.tileSize - Game1.tileSize)), false, false);

                temporaryAnimatedSprite1.scale      = Game1.pixelZoom;
                temporaryAnimatedSprite1.layerDepth = 1f;
                int num1 = 1;

                temporaryAnimatedSprite1.xPeriodic = num1 != 0;
                double num2 = 2000.0;

                temporaryAnimatedSprite1.xPeriodicLoopTime = (float)num2;
                double num3 = (Game1.tileSize / 4);

                temporaryAnimatedSprite1.xPeriodicRange = (float)num3;
                int num4 = 1;

                temporaryAnimatedSprite1.light = num4 != 0;
                Color darkGoldenrod1 = Color.DarkGoldenrod;

                temporaryAnimatedSprite1.lightcolor = darkGoldenrod1;
                double num5 = 1.0;

                temporaryAnimatedSprite1.lightRadius = (float)num5;
                temporarySprites1.Add(temporaryAnimatedSprite1);

                Game1.currentLightSources.Add(new LightSource(4, new Vector2(sourceXTile, sourceYTile) * Game1.tileSize, 4f));
                Game1.viewport.X = Math.Max(0, Math.Min(location.map.DisplayWidth - Game1.viewport.Width, sourceXTile * Game1.tileSize - Game1.viewport.Width / 2));
                Game1.viewport.Y = Math.Max(0, Math.Min(location.map.DisplayHeight - Game1.viewport.Height, sourceYTile * Game1.tileSize - Game1.viewport.Height / 2));
            }