示例#1
0
        private void GameLoop_GameLaunched(object sender, StardewModdingAPI.Events.GameLaunchedEventArgs e)
        {
            ObjectIDHelper.init();
            //FarmHouseStates.harmony.Patch(
            //    original: Helper.Reflection.GetMethod(new FarmHouse(), "doSetVisibleFloor").MethodInfo,
            //    prefix: new HarmonyMethod(AccessTools.Method(typeof(FarmHouse_doSetVisibleFloor_Patch), nameof(FarmHouse_doSetVisibleFloor_Patch.Prefix)))
            //);
            //Farmer Patches
            //FarmHouseStates.harmony.Patch(
            //    original: typeof(Farmer).GetConstructor(new Type[]
            //    {
            //        typeof(FarmerSprite),
            //        typeof(Vector2),
            //        typeof(int),
            //        typeof(string),
            //        typeof(List<Item>),
            //        typeof(bool)
            //    }),
            //    postfix: new HarmonyMethod(AccessTools.Method(typeof(Farmer_Ctor_Patch), nameof(Farmer_Ctor_Patch.Postfix)))
            //);

            FarmState.init();
            FarmHouseStates.init();
            OtherLocations.DecoratableStates.init();
            OtherLocations.FakeDecor.FakeDecorHandler.init();
        }
示例#2
0
        //internal void drawStuff(object sender, StardewModdingAPI.Events.RenderedHudEventArgs e)
        //{
        //    FarmHouseStates.testCaster.draw(e.SpriteBatch);
        //}

        internal void reloadStaticClasses()
        {
            Logger.Log("Reloading static classes...");
            FarmHouseStates.init();
            FarmHouseStates.clearAll();
            FarmState.init();
            FarmState.setUpFarm(Game1.getFarm());
            OtherLocations.DecoratableStates.init();
            OtherLocations.DecoratableStates.clearAll();
            OtherLocations.FakeDecor.FakeDecorHandler.init();
            //FarmHouseStates.render = FarmHouseStates.renderFarmHouse(Utility.getHomeOfFarmer(Game1.player));
            Logger.Log("House location is " + FarmState.houseLocation.ToString());
            Logger.Log("getPorchStandingSpot() returned " + FarmState.getPorchStandingSpot().ToString());
        }
示例#3
0
        public override void Entry(IModHelper helper)
        {
            Logger.monitor = Monitor;
            var harmony = HarmonyInstance.Create("mabelsyrup.farmhouse");

            FarmHouseStates.harmony     = harmony;
            FarmHouseStates.spouseRooms = new Dictionary <string, int>();
            FarmHouseStates.reflector   = helper.Reflection;

            //FarmHouse patches
            harmony.Patch(
                original: AccessTools.Method(typeof(FarmHouse), nameof(FarmHouse.getFloors)),
                postfix: new HarmonyMethod(AccessTools.Method(typeof(FarmHouse_Patch), nameof(FarmHouse_Patch.Postfix)))
                );
            harmony.Patch(
                original: AccessTools.Method(typeof(FarmHouse), nameof(FarmHouse.getWalls)),
                postfix: new HarmonyMethod(AccessTools.Method(typeof(FarmHouse_getWalls_Patch), nameof(FarmHouse_getWalls_Patch.Postfix)))
                );
            harmony.Patch(
                original: AccessTools.Method(typeof(FarmHouse), nameof(FarmHouse.setMapForUpgradeLevel)),
                prefix: new HarmonyMethod(AccessTools.Method(typeof(FarmHouse_setMapForUpgradeLevel_patch), nameof(FarmHouse_setMapForUpgradeLevel_patch.Prefix)))
                );
            harmony.Patch(
                original: helper.Reflection.GetMethod(new FarmHouse(), "doSetVisibleFloor").MethodInfo,
                prefix: new HarmonyMethod(AccessTools.Method(typeof(FarmHouse_doSetVisibleFloor_Patch), nameof(FarmHouse_doSetVisibleFloor_Patch.Prefix)))
                );
            harmony.Patch(
                original: AccessTools.Method(typeof(FarmHouse), nameof(FarmHouse.loadSpouseRoom)),
                prefix: new HarmonyMethod(AccessTools.Method(typeof(FarmHouse_loadSpouseRoom_Patch), nameof(FarmHouse_loadSpouseRoom_Patch.Prefix)))
                );
            harmony.Patch(
                original: AccessTools.Method(typeof(FarmHouse), nameof(FarmHouse.performTenMinuteUpdate)),
                prefix: new HarmonyMethod(AccessTools.Method(typeof(FarmHouse_performTenMinuteUpdate_patch), nameof(FarmHouse_performTenMinuteUpdate_patch.Prefix)))
                );
            harmony.Patch(
                original: AccessTools.Method(typeof(FarmHouse), nameof(FarmHouse.showSpouseRoom)),
                prefix: new HarmonyMethod(AccessTools.Method(typeof(FarmHouse_showSpouseRoom_Patch), nameof(FarmHouse_showSpouseRoom_Patch.Prefix)))
                );

            //harmony.Patch(
            //    original: AccessTools.Method(typeof(FarmHouse), nameof(FarmHouse.getKitchenStandingSpot)),
            //    prefix: new HarmonyMethod(AccessTools.Method(typeof(FarmHouse_getKitchenStandingSpot_Patch), nameof(FarmHouse_getKitchenStandingSpot_Patch.Prefix)))
            //);

            //DecoratableLocation patches
            harmony.Patch(
                original: helper.Reflection.GetMethod(new DecoratableLocation(), "doSetVisibleWallpaper").MethodInfo,
                prefix: new HarmonyMethod(AccessTools.Method(typeof(DecoratableLocation_doSetVisibleWallpaper_Patch), nameof(DecoratableLocation_doSetVisibleWallpaper_Patch.Prefix)))
                );
            harmony.Patch(
                original: AccessTools.Method(typeof(DecoratableLocation), nameof(DecoratableLocation.setFloor)),
                prefix: new HarmonyMethod(AccessTools.Method(typeof(DecoratableLocation_setFloor_Patch), nameof(DecoratableLocation_setFloor_Patch.Prefix)))
                );
            harmony.Patch(
                original: AccessTools.Method(typeof(DecoratableLocation), nameof(DecoratableLocation.setWallpaper)),
                prefix: new HarmonyMethod(AccessTools.Method(typeof(DecoratableLocation_setWallpaper_Patch), nameof(DecoratableLocation_setWallpaper_Patch.Prefix)))
                );
            FarmHouseStates.init(helper.Content);
            helper.Events.GameLoop.DayStarted  += newDay;
            helper.Events.World.NpcListChanged += npcListChanged;
            helper.Events.Player.Warped        += fixPlayerHouseWarp;
        }