Пример #1
0
        private void OnPress(object Sender, ButtonPressedEventArgs args)
        {
            if (Context.IsWorldReady)
            {
                foreach (SButton btn in Config.Buttons)
                {
                    if (!Helper.Input.IsDown(btn))
                    {
                        return;
                    }
                }

                Item ToDecraft = Game1.player.CurrentItem;

                foreach (CraftableItem CItem in Items)
                {
                    if (CItem.Equal(ToDecraft))
                    {
                        Monitor.Log("Decrafting " + ToDecraft.DisplayName + " (id " + ToDecraft.ParentSheetIndex + ").", LogLevel.Debug);

                        Game1.player.removeItemFromInventory(ToDecraft);

                        foreach (Item ing in CItem.Ingradients)
                        {
                            Game1.player.addItemToInventory(ItemFromID(ing.ParentSheetIndex, ing.Stack * ToDecraft.Stack / CItem.Item.Stack));
                        }

                        return;
                    }
                }
            }
        }