예제 #1
0
 private static void AfteranswerDialogueAction(string questionAndAnswer)
 {
     if (questionAndAnswer == "Eat_Yes" || questionAndAnswer == "Eat_No")
     {
         ClickToMoveManager.GetOrCreate(Game1.currentLocation).Reset();
     }
 }
예제 #2
0
 /// <summary>
 ///     A method called via Harmony after <see cref="Building.dayUpdate" />.
 ///     It reinitializes the <see cref="ClickToMove" /> object associated to animal houses.
 /// </summary>
 /// <param name="__instance">The <see cref="Building" /> instance.</param>
 private static void AfterDayUpdate(Building __instance)
 {
     if (__instance.indoors.Value is AnimalHouse animalHouse)
     {
         ClickToMoveManager.GetOrCreate(animalHouse).Init();
     }
 }
예제 #3
0
        private static bool BeforeAnswerDialogue(BusStop __instance, Response answer)
        {
            if (__instance.lastQuestionKey is not null && __instance.afterQuestion is null)
            {
                string[] words = __instance.lastQuestionKey.Split(' ');

                if (words[0] == "Minecart")
                {
                    ClickToMoveManager.GetOrCreate(Game1.currentLocation).PreventMountingHorse = false;
                }

                string questionAndAnswer = words[0] + "_" + answer.responseKey;

                if (questionAndAnswer == "Bus_Yes")
                {
                    NPC pam = Game1.getCharacterFromName("Pam");
                    if (!(Game1.player.Money >= (Game1.shippingTax ? 50 : 500) && __instance.characters.Contains(pam) &&
                          pam.getTileLocation().Equals(
                              new Vector2(11f, 10f))))
                    {
                        ClickToMoveManager.GetOrCreate(Game1.currentLocation).PreventMountingHorse = false;
                    }
                }
                else if (questionAndAnswer == "Bus_No")
                {
                    ClickToMoveManager.GetOrCreate(Game1.currentLocation).PreventMountingHorse = false;
                }
            }

            return(true);
        }
예제 #4
0
        private static bool BeforeTownCheckAction(
            Town __instance,
            Location tileLocation,
            Rectangle viewport,
            Farmer who)
        {
            if (__instance.map.GetLayer("Buildings").Tiles[tileLocation] is not null && who.mount is null)
            {
                int tileIndex = __instance.map.GetLayer("Buildings").Tiles[tileLocation].TileIndex;
                if ((tileIndex == 958 || tileIndex == 1080 || tileIndex == 1081) && Game1.player.mount is null &&
                    (__instance.currentEvent is null || !__instance.currentEvent.isFestival ||
                     !__instance.currentEvent.checkAction(
                         tileLocation,
                         viewport,
                         who)) && !(Game1.player.getTileX() <= 70 &&
                                    (Game1.CurrentEvent is null ||
                                     Game1.CurrentEvent.FestivalName != "Egg Festival")) &&
                    Game1.MasterPlayer.mailReceived.Contains("ccBoilerRoom"))
                {
                    ClickToMoveManager.GetOrCreate(Game1.currentLocation).PreventMountingHorse = true;
                }
            }

            return(true);
        }
예제 #5
0
 private static void AfterresetLocalState(GameLocation __instance)
 {
     if (ClickToMoveManager.GetOrCreate(__instance) is not null &&
         ClickToMoveManager.GetOrCreate(__instance).Graph is not null)
     {
         ClickToMoveManager.GetOrCreate(__instance).Graph.RefreshBubbles();
     }
 }
예제 #6
0
        private static bool BeforePerformTouchAction(MovieTheater __instance, string fullActionString)
        {
            if (fullActionString.Split(' ')[0] == "Theater_Exit")
            {
                ClickToMoveManager.GetOrCreate(__instance).Reset();
            }

            return(true);
        }
예제 #7
0
        private static bool BeforeShopMenuReceiveLeftClick(ShopMenu __instance, int x, int y)
        {
            if (__instance.upperRightCloseButton.containsPoint(x, y))
            {
                ClickToMoveManager.GetOrCreate(Game1.currentLocation).ResetRotatingFurniture();
            }

            return(true);
        }
예제 #8
0
        private static bool BeforeanswerDialogueAction(string questionAndAnswer, string[] questionParams)
        {
            if (questionAndAnswer is not null && questionParams is not null && questionParams.Length != 0 &&
                questionParams[0] == "Minecart")
            {
                ClickToMoveManager.GetOrCreate(Game1.currentLocation).PreventMountingHorse = false;
            }

            return(true);
        }
예제 #9
0
        private static bool BeforeLowPriorityLeftClick(GameLocation __instance, ref bool __result)
        {
            if (ClickToMoveManager.GetOrCreate(__instance).ClickHoldActive &&
                ClickToMoveManager.GetOrCreate(__instance).Furniture is null)
            {
                __result = false;
                return(false);
            }

            return(true);
        }
예제 #10
0
        /// <summary>Draw the current click to move target.</summary>
        /// <param name="spriteBatch">The sprite batch being drawn.</param>
        public static void DrawClickToMoveTarget(SpriteBatch spriteBatch)
        {
            ClickToMove clickToMove = ClickToMoveManager.GetOrCreate(Game1.currentLocation);

            // Draw click to move target.
            if (clickToMove.TargetNpc is null && (Game1.displayHUD || Game1.eventUp) && Game1.currentBillboard == 0 &&
                Game1.gameMode == Game1.playingGameMode && !Game1.freezeControls && !Game1.panMode &&
                !Game1.HostPaused)
            {
                if (Game1.activeClickableMenu is not null && clickToMove.ClickedTile.X != -1)
                {
                    clickToMove.Reset();
                }
예제 #11
0
        private static void AfterToolbarUpdate(GameTime time)
        {
            if (!Game1.player.usingTool && MenusPatcher.nextToolIndex != int.MinValue)
            {
                Game1.player.CurrentToolIndex = MenusPatcher.nextToolIndex;
                MenusPatcher.nextToolIndex    = int.MinValue;

                ClickToMoveManager.GetOrCreate(Game1.currentLocation).ClearAutoSelectTool();

                if (Game1.player.CurrentTool is not null && Game1.player.CurrentTool is MeleeWeapon weapon)
                {
                    ClickToMove.MostRecentlyChosenMeleeWeapon = weapon;
                }
            }
        }
예제 #12
0
        private static bool BeforeMountainCheckAction(Mountain __instance, Location tileLocation)
        {
            if (__instance.map.GetLayer("Buildings").Tiles[tileLocation] is not null)
            {
                int tileIndex = __instance.map.GetLayer("Buildings").Tiles[tileLocation].TileIndex;

                if ((tileIndex == 958 || tileIndex == 1080 || tileIndex == 1081) &&
                    Game1.MasterPlayer.mailReceived.Contains("ccBoilerRoom") && Game1.player.mount is null &&
                    !Game1.player.isRidingHorse())
                {
                    ClickToMoveManager.GetOrCreate(Game1.currentLocation).PreventMountingHorse = true;
                }
            }

            return(true);
        }
예제 #13
0
        private static bool BeforeDayTimeMoneyBoxReceiveLeftClick(DayTimeMoneyBox __instance, int x, int y)
        {
            if (Game1.currentLocation is not null && ClickToMoveManager.GetOrCreate(Game1.currentLocation).ClickHoldActive)
            {
                return(false);
            }

            if (Game1.player.visibleQuestCount > 0 && __instance.questButton.containsPoint(x, y) && Game1.player.CanMove &&
                !Game1.dialogueUp && !Game1.eventUp && Game1.farmEvent is null)
            {
                ClickToMoveManager.GetOrCreate(Game1.currentLocation).Reset();
                ClickToMoveManager.OnScreenButtonClicked = true;
            }
            else if (Game1.options.zoomButtons && (__instance.zoomInButton.containsPoint(x, y) || __instance.zoomOutButton.containsPoint(x, y)))
            {
                ClickToMoveManager.GetOrCreate(Game1.currentLocation).Reset();
                ClickToMoveManager.OnScreenButtonClicked = true;
            }

            return(true);
        }
        private static bool BeforeDraw(FarmAnimal __instance, SpriteBatch b)
        {
            if (ClickToMoveManager.GetOrCreate(Game1.currentLocation).TargetFarmAnimal == __instance)
            {
                b.Draw(
                    Game1.mouseCursors,
                    Game1.GlobalToLocal(
                        Game1.viewport,
                        new Vector2(
                            (int)__instance.Position.X + (__instance.Sprite.getWidth() * 4 / 2) - 32,
                            (int)__instance.Position.Y + (__instance.Sprite.getHeight() * 4 / 2) - 24)),
                    new Rectangle(194, 388, 16, 16),
                    Color.White,
                    0f,
                    Vector2.Zero,
                    4f,
                    SpriteEffects.None,
                    0.01f);
            }

            return(true);
        }
예제 #15
0
        private static bool BeforeBusStopCheckAction(BusStop __instance, Location tileLocation)
        {
            if (__instance.map.GetLayer("Buildings").Tiles[tileLocation] is not null)
            {
                switch (__instance.map.GetLayer("Buildings").Tiles[tileLocation].TileIndex)
                {
                case 958:
                case 1080:
                case 1081:
                    if (Game1.MasterPlayer.mailReceived.Contains("ccBoilerRoom") &&
                        (Game1.player.mount is null || !Game1.player.isRidingHorse()))
                    {
                        ClickToMoveManager.GetOrCreate(Game1.currentLocation).PreventMountingHorse = true;
                    }

                    break;

                case 1057:
                    if (Game1.MasterPlayer.mailReceived.Contains("ccVault"))
                    {
                        if (Game1.player.mount is null || !Game1.player.isRidingHorse())
                        {
                            ClickToMoveManager.GetOrCreate(Game1.currentLocation).PreventMountingHorse = true;
                        }
                    }
                    else
                    {
                        ClickToMoveManager.GetOrCreate(Game1.currentLocation).PreventMountingHorse = false;
                    }

                    break;
                }
            }

            return(true);
        }
예제 #16
0
 private static void AfterAfterViewportGetsToJunimoNotePosition(CommunityCenter __instance)
 {
     ClickToMoveManager.GetOrCreate(__instance).Init();
 }
예제 #17
0
        private static bool BeforeToolbarReceiveLeftClick(int x, int y, List <ClickableComponent> ___buttons)
        {
            if (Game1.IsChatting || Game1.currentLocation is MermaidHouse || Game1.player.isEating || !Game1.displayFarmer || ClickToMoveManager.GetOrCreate(Game1.currentLocation).ClickHoldActive)
            {
                return(false);
            }

            if (Game1.player.usingTool.Value)
            {
                foreach (ClickableComponent button in ___buttons)
                {
                    if (button.containsPoint(x, y))
                    {
                        ClickToMoveManager.OnScreenButtonClicked = true;

                        int toolIndex = Convert.ToInt32(button.name);

                        if (Game1.player.CurrentToolIndex == toolIndex)
                        {
                            MenusPatcher.nextToolIndex = -1;
                        }
                        else
                        {
                            MenusPatcher.nextToolIndex = toolIndex;
                        }

                        break;
                    }
                }

                return(false);
            }

            foreach (ClickableComponent button in ___buttons)
            {
                if (button.containsPoint(x, y))
                {
                    ClickToMoveManager.OnScreenButtonClicked = true;

                    int toolIndex = Convert.ToInt32(button.name);

                    if (Game1.player.CurrentToolIndex == toolIndex)
                    {
                        Game1.player.CurrentToolIndex = -1;
                    }
                    else
                    {
                        Game1.player.CurrentToolIndex = toolIndex;

                        ClickToMoveManager.GetOrCreate(Game1.currentLocation).ClearAutoSelectTool();

                        if (Game1.player.CurrentTool is MeleeWeapon weapon)
                        {
                            ClickToMove.MostRecentlyChosenMeleeWeapon = weapon;
                        }

                        if (Game1.player.ActiveObject != null)
                        {
                            Game1.player.showCarrying();
                            Game1.playSound("pickUpItem");
                        }
                        else
                        {
                            Game1.player.showNotCarrying();
                            Game1.playSound("stoneStep");
                        }
                    }

                    break;
                }
            }

            return(false);
        }
 private static void AfterSetUpgradeLevel(Shed __instance)
 {
     ClickToMoveManager.GetOrCreate(__instance).Init();
 }
 private static void AfterReleaseLeftClick(GameLocation ___location)
 {
     ClickToMoveManager.GetOrCreate(___location).Reset();
 }
 /// <summary>
 ///     A method called via Harmony after <see cref="FishingRod.doDoneFishing" />.
 ///     It resets the state of the <see cref="ClickToMove" /> object associated with the current game location.
 /// </summary>
 private static void AfterDoDoneFishing()
 {
     ClickToMoveManager.GetOrCreate(Game1.currentLocation).Reset();
 }
예제 #21
0
 private static void AfterSetMapForUpgradeLevel(FarmHouse __instance)
 {
     ClickToMoveManager.GetOrCreate(__instance).Init();
 }
예제 #22
0
 private static void AftercleanupBeforePlayerExit(GameLocation __instance)
 {
     ClickToMoveManager.GetOrCreate(__instance).Reset();
 }
예제 #23
0
 private static void AfterResetLocalState(CommunityCenter __instance)
 {
     ClickToMoveManager.GetOrCreate(__instance).Init();
 }
예제 #24
0
 private static void AfterLoadSpouseRoom(FarmHouse __instance)
 {
     ClickToMoveManager.GetOrCreate(__instance).Graph.Init();
 }
예제 #25
0
        private static bool BeforePlayerReachedBusDoor()
        {
            ClickToMoveManager.GetOrCreate(Game1.currentLocation).PreventMountingHorse = false;

            return(true);
        }
예제 #26
0
 private static void AfterLoadLevel(MineShaft __instance)
 {
     ClickToMoveManager.AddOrUpdate(__instance, new ClickToMove(__instance));
 }
예제 #27
0
        private static bool BeforePlacementAction(GameLocation location)
        {
            ClickToMoveManager.GetOrCreate(location).Reset();

            return(true);
        }