Ejemplo n.º 1
0
        /*********
        ** Private methods
        *********/

        /// <summary>Raised when button is pressed</summary>
        /// <param name="sender">The event sender.</param>
        /// <param name="e">The event arguments.</param>

        private void CheckHotkey(object sender, ButtonsChangedEventArgs e)
        {
            if (myKeybinds.Value == null)
            {
                return;
            }
            KeybindList keybinds = myKeybinds.Value;
            Farmer      player   = Game1.player;

            if (!keybinds.JustPressed())
            {
                return;
            }

            if (bestItem.Value != null && keybinds.GetByType(KeybindType.CancelKeybind).IsPressed())
            {
                keybinds.SuppressType(Helper, KeybindType.CancelKeybind);
                RestoreLastItem(player);
                return;
            }

            if (bestItem.Value != null && keybinds.PressedByType(KeybindType.ForceEatFoodKeybind))
            {
                keybinds.SuppressType(Helper, KeybindType.ForceEatFoodKeybind);
                EatBestItem(player);
                return;
            }

            if (keybinds.PressedByType(KeybindType.CycleFoodKeybind))
            {
                keybinds.SuppressType(Helper, KeybindType.CycleFoodKeybind);
                CheckBestItems(player);
            }

            if (bestItem != null && (keybinds.PressedByType(KeybindType.ForceEatFoodKeybind) || keybinds.PressedByType(KeybindType.EatCurrentFoodKeybind)))
            {
                keybinds.SuppressType(Helper, KeybindType.ForceEatFoodKeybind);
                keybinds.SuppressType(Helper, KeybindType.EatCurrentFoodKeybind);
                EatBestItem(player);
            }
        }