public override void Entry(IModHelper helper)
        {
            //initializes mod features and reads config
            ModFeature.Init(this);

            Helper.Events.GameLoop.GameLaunched += GameLoop_GameLaunched;

            //TODO:
            //ReturnMuseumRewardsFeature.Enable();

            //if (config.ToolsFeature)
            //     DontUseToolsFeature.Enable();

            Monitor.Log("Configuration:", LogLevel.Trace);
            Monitor.Log($"config.EatingFeature: {config.EatingFeature}", LogLevel.Trace);
            Monitor.Log($"config.AdventurersGuildShopFeature: {config.AdventurersGuildShopFeature}", LogLevel.Trace);
            Monitor.Log($"config.CarpenterMenuFeature: {config.CarpenterMenuFeature}", LogLevel.Trace);
            Monitor.Log($"config.SellableItemsFeature: {config.SellableItemsFeature}", LogLevel.Trace);
            //Monitor.Log($"config.SlingshotFeature: {config.SlingshotFeature}", LogLevel.Trace);
            //Monitor.Log($"config.FishingRodFeature: {config.FishingRodFeature}", LogLevel.Trace);

            /*
             * Helper.ConsoleCommands.Add("player_inventory", "",(string arg1, string[] arg2) => {
             *  Monitor.Log("Player inventory:", LogLevel.Info);
             *  foreach (StardewValley.Item item in StardewValley.Game1.player.Items)
             *      Monitor.Log("Item is type " + item?.GetType().ToString(), LogLevel.Info);
             * });
             * Helper.ConsoleCommands.Add("reset_marnie", "", (string arg1, string[] arg2) => {
             *  MarniesItemShopFeature.ResetItems(new StardewValley.Menus.ShopMenu(StardewValley.Utility.getAnimalShopStock()));
             * });
             */

            //Helper.ConsoleCommands.Add("carpenter_menu", "", (arg1, arg2) => Game1.activeClickableMenu = new StardewValley.Menus.CarpenterMenu());
        }
 public override void receiveRightClick(int x, int y, bool playSound = true)
 {
     //this prevents the standard inventory right-click action (removal of attachments) and prevents the slingshot to be sold with attachments
     if (SlingshotChanges && inventory.getItemAt(x, y) is Slingshot slingshot && HasAmmunition(slingshot))
     {
         Game1.playSound("cancel");
         Game1.showRedMessage(ModFeature.GetTrans("menu.slingshotempty"));
         return;
     }
     base.receiveRightClick(x, y, playSound);
 }
        public override void receiveLeftClick(int x, int y, bool playSound = true)
        {
            Item item = inventory.getItemAt(x, y);

            //prevents the slingshot to be sold with attachments
            if (SlingshotChanges && item is Slingshot slingshot && HasAmmunition(slingshot))
            {
                Game1.playSound("cancel");
                Game1.showRedMessage(ModFeature.GetTrans("menu.slingshotempty"));
                return;
            }
            base.receiveLeftClick(x, y, playSound);
        }
Пример #4
0
        public override void Entry(IModHelper helper)
        {
            //initializes mod features and reads config
            ModFeature.Init(this);

            if (config.EatingFeature || false /*config.WeaponBlockingFeature*/)
            {
                EatingBlockingFeature.Enable();
            }
            if (config.AdventurersGuildShopFeature || config.SellableItemsFeature)
            {
                AdventurersGuildFeature.Enable();
            }
            if (config.CarpenterMenuFeature)
            {
                CarpenterMenuFeature.Enable();
            }
            if (config.SellableItemsFeature)
            {
                FishingRodFeature.Enable();
            }
            if (config.SellableItemsFeature)
            {
                MarniesItemShopFeature.Enable();
            }

            //if (config.ToolsFeature)
            //     DontUseToolsFeature.Enable();

            Monitor.Log("Configuration:", LogLevel.Trace);
            Monitor.Log($"config.EatingFeature: {config.EatingFeature}", LogLevel.Trace);
            Monitor.Log($"config.AdventurersGuildShopFeature: {config.AdventurersGuildShopFeature}", LogLevel.Trace);
            Monitor.Log($"config.CarpenterMenuFeature: {config.CarpenterMenuFeature}", LogLevel.Trace);
            Monitor.Log($"config.SellableItemsFeature: {config.SellableItemsFeature}", LogLevel.Trace);
            //Monitor.Log($"config.SlingshotFeature: {config.SlingshotFeature}", LogLevel.Trace);
            //Monitor.Log($"config.FishingRodFeature: {config.FishingRodFeature}", LogLevel.Trace);

            /*
             * Helper.ConsoleCommands.Add("player_inventory", "",(string arg1, string[] arg2) => {
             *  Monitor.Log("Player inventory:", LogLevel.Info);
             *  foreach (StardewValley.Item item in StardewValley.Game1.player.Items)
             *      Monitor.Log("Item is type " + item?.GetType().ToString(), LogLevel.Info);
             * });
             * Helper.ConsoleCommands.Add("reset_marnie", "", (string arg1, string[] arg2) => {
             *  MarniesItemShopFeature.ResetItems(new StardewValley.Menus.ShopMenu(StardewValley.Utility.getAnimalShopStock()));
             * });
             */
        }
Пример #5
0
        public override void Entry(IModHelper helper)
        {
            //initializes mod features and reads config
            ModFeature.Init(this);

            if (config.EatingFeature || false /*config.WeaponBlockingFeature*/)
            {
                EatingBlockingFeature.Enable();
            }
            if (config.AdventurersGuildShopFeature || config.SellableItemsFeature)
            {
                AdventurersGuildFeature.Enable();
            }
            if (config.CarpenterMenuFeature)
            {
                CarpenterMenuFeature.Enable();
            }
            if (config.SellableItemsFeature)
            {
                FishingRodFeature.Enable();
            }
            if (config.SellableItemsFeature)
            {
                MarniesItemShopFeature.Enable();
            }

            //if (config.ToolsFeature)
            //     DontUseToolsFeature.Enable();

            Monitor.Log("Configuration:", LogLevel.Trace);
            Monitor.Log($"config.EatingFeature: {config.EatingFeature}", LogLevel.Trace);
            Monitor.Log($"config.AdventurersGuildShopFeature: {config.AdventurersGuildShopFeature}", LogLevel.Trace);
            Monitor.Log($"config.CarpenterMenuFeature: {config.CarpenterMenuFeature}", LogLevel.Trace);
            Monitor.Log($"config.SellableItemsFeature: {config.SellableItemsFeature}", LogLevel.Trace);
            //Monitor.Log($"config.SlingshotFeature: {config.SlingshotFeature}", LogLevel.Trace);
            //Monitor.Log($"config.FishingRodFeature: {config.FishingRodFeature}", LogLevel.Trace);
        }
Пример #6
0
        public override void Entry(IModHelper helper)
        {
            //initializes mod features and reads config
            ModFeature.Init(this);

            if (config.EatingFeature || false /*config.WeaponBlockingFeature*/)
            {
                EatingBlockingFeature.Enable();
            }
            if (config.AdventurersGuildShopFeature || config.SlingshotFeature)
            {
                AdventurersGuildFeature.Enable();
            }
            if (config.CarpenterMenuFeature)
            {
                CarpenterMenuFeature.Enable();
            }
            if (config.FishingRodFeature)
            {
                FishingRodFeature.Enable();
            }
            //if (config.ToolsFeature)
            //     DontUseToolsFeature.Enable();

            Monitor.Log("Configuration:", LogLevel.Trace);
            Monitor.Log($"config.EatingFeature: {config.EatingFeature}", LogLevel.Trace);
            Monitor.Log($"config.AdventurersGuildShopFeature: {config.AdventurersGuildShopFeature}", LogLevel.Trace);
            Monitor.Log($"config.CarpenterMenuFeature: {config.CarpenterMenuFeature}", LogLevel.Trace);
            Monitor.Log($"config.SlingshotFeature: {config.SlingshotFeature}", LogLevel.Trace);
            Monitor.Log($"config.FishingRodFeature: {config.FishingRodFeature}", LogLevel.Trace);

            Helper.ConsoleCommands.Add("carp", "", (string arg1, string[] arg2) =>
            {
                StardewValley.Game1.activeClickableMenu = new StardewValley.Menus.CarpenterMenu();
            });
        }
        public override void performHoverAction(int x, int y)
        {
            base.performHoverAction(x, y);
            Item heldItem  = Helper.Reflection.GetField <Item>(this, "heldItem").GetValue();
            bool scrolling = Helper.Reflection.GetField <bool>(this, "scrolling").GetValue();

            if (!scrolling && heldItem == null && inventory.getItemAt(x, y) is Item item && HighlightItemToSell(item))
            {
                Helper.Reflection.GetField <string>(this, "boldTitleText").SetValue(item.DisplayName);
                Helper.Reflection.GetField <string>(this, "hoverText").SetValue(item.getDescription());
                Helper.Reflection.GetField <Item>(this, "hoveredItem").SetValue(item);

                if (item is Slingshot slingshot)
                {
                    if (HasAmmunition(slingshot))
                    {
                        Helper.Reflection.GetField <string>(this, "hoverText").SetValue(ModFeature.GetTrans("menu.slingshotempty"));
                    }
                    float sellPercentage   = Helper.Reflection.GetField <float>(this, "sellPercentage").GetValue();
                    int   sellToStorePrice = (int)((float)(slingshot.salePrice() / 2) * sellPercentage * slingshot.Stack);
                    //Helper.Reflection.GetField<Item>(this, "hoveredItem").SetValue(item);
                    Helper.Reflection.GetField <int>(this, "hoverPrice").SetValue(sellToStorePrice);
                }
            }
        }