Beispiel #1
0
        // Loosly taken from Slingshot. It's not perfect but it's close enough, and simple to read.
        private Vector2 GetMotion(Farmer farmer, StardewValley.Tools.Slingshot slingshot)
        {
            Vector2 motion = Utility.getVelocityTowardPoint(new Vector2((float)slingshot.aimPos.X, (float)slingshot.aimPos.Y), new Vector2(Game1.player.getStandingX(), Game1.player.getStandingY() + 32), 256f);

            motion.Normalize();
            motion *= 0.3f;

            return(motion);
        }
Beispiel #2
0
        /// <summary>Replaces the active slingshot (regular) with a better slingshot.</summary>
        public void PrepareForFiring()
        {
            this.preparedSlingshot = Game1.player.CurrentTool as StardewValley.Tools.Slingshot;

            this.slingshotBeingUsed = new BetterSlingshot(this.reflection, this.config, this.preparedSlingshot.attachments[0], isActionButtonDown, this.preparedSlingshot.initialParentTileIndex);
            this.slingshotBeingUsed.beginUsing(Game1.currentLocation, Game1.getMouseX(), Game1.getMouseY(), Game1.player);

            Game1.player.CurrentTool = this.slingshotBeingUsed;
        }
        private void MenuEvents_MenuChanged(object sender, EventArgsClickableMenuChanged e)
        {
            if (e.NewMenu is ShopMenu shopMenu && shopMenu.portraitPerson == null && Game1.currentLocation is Club)
            {
                Item slingshotItem = new StardewValley.Tools.Slingshot(34);

                Dictionary <Item, int[]> itemPriceAndStock = Helper.Reflection.GetField <Dictionary <Item, int[]> >(shopMenu, "itemPriceAndStock").GetValue();
                itemPriceAndStock.Add(slingshotItem, new int[] { config.GalaxySlingshotPrice, 1 });
                List <Item> forSale = Helper.Reflection.GetField <List <Item> >(shopMenu, "forSale").GetValue();
                forSale.Insert(0, slingshotItem);
            }
        }