Terraria.UI.ItemSlot.PickItemMovementAction C# (CSharp) Method

PickItemMovementAction() public static method

public static PickItemMovementAction ( System.Item inv, int context, int slot, System.Item checkItem ) : int
inv System.Item
context int
slot int
checkItem System.Item
return int
        public static int PickItemMovementAction(Item[] inv, int context, int slot, Item checkItem)
        {
            Player player = Main.player[Main.myPlayer];
            int num = -1;
            if (context == 0)
                num = 0;
            else if (context == 1)
            {
                if (checkItem.itemId == 0 || checkItem.itemId == 71 || (checkItem.itemId == 72 || checkItem.itemId == 73) || checkItem.itemId == 74)
                    num = 0;
            }
            else if (context == 2)
            {
                if ((checkItem.itemId == 0 || checkItem.ammo > 0 || checkItem.bait > 0) && !checkItem.notAmmo || checkItem.itemId == 530)
                    num = 0;
            }
            else if (context == 3)
                num = 0;
            else if (context == 4)
                num = 0;
            else if (context == 5)
            {
                if (checkItem.Prefix(-3) || checkItem.itemId == 0)
                    num = 0;
            }
            else if (context == 6)
                num = 0;
            else if (context == 7)
            {
                if (checkItem.material || checkItem.itemId == 0)
                    num = 0;
            }
            else if (context == 8)
            {
                if (checkItem.itemId == 0 || checkItem.headSlot > -1 && slot == 0 || (checkItem.bodySlot > -1 && slot == 1 || checkItem.legSlot > -1 && slot == 2))
                    num = 1;
            }
            else if (context == 9)
            {
                if (checkItem.itemId == 0 || checkItem.headSlot > -1 && slot == 10 || (checkItem.bodySlot > -1 && slot == 11 || checkItem.legSlot > -1 && slot == 12))
                    num = 1;
            }
            else if (context == 10)
            {
                if (checkItem.itemId == 0 || checkItem.accessory && !ItemSlot.AccCheck(checkItem, slot))
                    num = 1;
            }
            else if (context == 11)
            {
                if (checkItem.itemId == 0 || checkItem.accessory && !ItemSlot.AccCheck(checkItem, slot))
                    num = 1;
            }
            else if (context == 12)
                num = 2;
            else if (context == 15)
            {
                if (checkItem.itemId == 0 && inv[slot].itemId > 0)
                {
                    if (player.BuyItem(inv[slot].value))
                        num = 3;
                }
                else if (inv[slot].itemId == 0 && checkItem.itemId > 0 && (checkItem.itemId < 71 || checkItem.itemId > 74))
                    num = 4;
            }
            else if (context == 16)
            {
                if (checkItem.itemId == 0 || Main.projHook[checkItem.shoot])
                    num = 1;
            }
            else if (context == 17)
            {
                if (checkItem.itemId == 0 || checkItem.mountType != -1 && !MountID.Sets.Cart[checkItem.mountType])
                    num = 1;
            }
            else if (context == 19)
            {
                if (checkItem.itemId == 0 || checkItem.buffType > 0 && Main.vanityPet[checkItem.buffType] && !Main.lightPet[checkItem.buffType])
                    num = 1;
            }
            else if (context == 18)
            {
                if (checkItem.itemId == 0 || checkItem.mountType != -1 && MountID.Sets.Cart[checkItem.mountType])
                    num = 1;
            }
            else if (context == 20 && (checkItem.itemId == 0 || checkItem.buffType > 0 && Main.lightPet[checkItem.buffType]))
                num = 1;
            return num;
        }