682 {
683 Player player = Main.player[Main.myPlayer];
684 bool flag = Main.mouseLeftRelease && Main.mouseLeft;
686 {
688 {
689 return;
690 }
693 {
694 return;
695 }
696 }
699 {
700 return;
701 }
703 {
704 case 0:
705 {
706 if (context == 6 && Main.mouseItem.type != 0)
707 {
709 }
711 {
712 break;
713 }
714 if (Main.mouseItem.maxStack <= 1 ||
inv[
slot].type != Main.mouseItem.type ||
inv[
slot].stack ==
inv[
slot].maxStack || Main.mouseItem.stack == Main.mouseItem.maxStack)
715 {
717 }
719 {
721 }
722 else
723 {
724 AnnounceTransfer(
new ItemTransferInfo(Main.mouseItem, context, 21, Main.mouseItem.stack));
725 }
727 {
728 switch (
Math.Abs(context))
729 {
730 case 0:
732 break;
733 case 8:
734 case 9:
735 case 10:
736 case 11:
737 case 12:
738 case 16:
739 case 17:
740 case 25:
741 case 27:
742 case 33:
744 break;
745 }
746 }
748 {
750 }
752 {
754 }
755 if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1)
756 {
757 Main.mouseItem = new Item();
758 }
759 if (Main.mouseItem.type > 0 ||
inv[
slot].type > 0)
760 {
761 Recipe.FindRecipes();
763 }
764 if (context == 3 && Main.netMode == 1)
765 {
766 NetMessage.SendData(32, -1, -1,
null, player.chest,
slot);
767 }
768 break;
769 }
770 case 1:
771 if (Main.mouseItem.stack == 1 && Main.mouseItem.type > 0 &&
inv[
slot].type > 0 &&
inv[
slot].IsNotTheSameAs(Main.mouseItem) && (context != 11 || Main.mouseItem.FitsAccessoryVanitySlot))
772 {
774 {
775 break;
776 }
780 {
781 switch (
Math.Abs(context))
782 {
783 case 0:
785 break;
786 case 8:
787 case 9:
788 case 10:
789 case 11:
790 case 12:
791 case 16:
792 case 17:
793 case 25:
794 case 27:
795 case 33:
797 break;
798 }
799 }
800 }
801 else if (Main.mouseItem.type == 0 &&
inv[
slot].type > 0)
802 {
805 {
807 }
808 if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1)
809 {
810 Main.mouseItem = new Item();
811 }
812 if (Main.mouseItem.type > 0 ||
inv[
slot].type > 0)
813 {
814 Recipe.FindRecipes();
816 }
817 }
818 else if (Main.mouseItem.type > 0 &&
inv[
slot].type == 0 && (context != 11 || Main.mouseItem.FitsAccessoryVanitySlot))
819 {
821 {
822 break;
823 }
825 Recipe.FindRecipes();
828 {
829 switch (
Math.Abs(context))
830 {
831 case 0:
833 break;
834 case 8:
835 case 9:
836 case 10:
837 case 11:
838 case 12:
839 case 16:
840 case 17:
841 case 25:
842 case 27:
843 case 33:
845 break;
846 }
847 }
848 }
849 if ((context == 23 || context == 24) && Main.netMode == 1)
850 {
851 NetMessage.SendData(121, -1, -1,
null, Main.myPlayer, player.tileEntityAnchor.interactEntityID,
slot);
852 }
853 if (context == 26 && Main.netMode == 1)
854 {
855 NetMessage.SendData(124, -1, -1,
null, Main.myPlayer, player.tileEntityAnchor.interactEntityID,
slot);
856 }
857 break;
858 case 2:
859 if (Main.mouseItem.stack == 1 && Main.mouseItem.dye > 0 &&
inv[
slot].type > 0 &&
inv[
slot].type != Main.mouseItem.type)
860 {
864 {
865 switch (
Math.Abs(context))
866 {
867 case 0:
869 break;
870 case 8:
871 case 9:
872 case 10:
873 case 11:
874 case 12:
875 case 16:
876 case 17:
877 case 25:
878 case 27:
879 case 33:
881 break;
882 }
883 }
884 }
885 else if (Main.mouseItem.type == 0 &&
inv[
slot].type > 0)
886 {
889 {
891 }
892 if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1)
893 {
894 Main.mouseItem = new Item();
895 }
896 if (Main.mouseItem.type > 0 ||
inv[
slot].type > 0)
897 {
898 Recipe.FindRecipes();
900 }
901 }
902 else if (Main.mouseItem.dye > 0 &&
inv[
slot].type == 0)
903 {
905 Recipe.FindRecipes();
908 {
909 switch (
Math.Abs(context))
910 {
911 case 0:
913 break;
914 case 8:
915 case 9:
916 case 10:
917 case 11:
918 case 12:
919 case 16:
920 case 17:
921 case 25:
922 case 27:
923 case 33:
925 break;
926 }
927 }
928 }
929 if (context == 25 && Main.netMode == 1)
930 {
931 NetMessage.SendData(121, -1, -1,
null, Main.myPlayer, player.tileEntityAnchor.interactEntityID,
slot, 1
f);
932 }
933 if (context == 27 && Main.netMode == 1)
934 {
935 NetMessage.SendData(124, -1, -1,
null, Main.myPlayer, player.tileEntityAnchor.interactEntityID,
slot, 1
f);
936 }
937 break;
938 case 3:
940 break;
941 case 4:
943 {
944 Chest chest = Main.instance.shop[Main.npcShop];
945 if (player.SellItem(Main.mouseItem))
946 {
948 Main.mouseItem.SetDefaults();
952 }
953 else if (Main.mouseItem.value == 0)
954 {
956 Main.mouseItem.SetDefaults();
960 }
961 Recipe.FindRecipes();
962 Main.stackSplit = 9999;
963 }
964 break;
965 case 5:
966 if (Main.mouseItem.IsAir)
967 {
969 Main.mouseItem =
inv[
slot].Clone();
970 Main.mouseItem.stack = Main.mouseItem.maxStack;
973 }
974 break;
975 }
976 if ((uint)context > 2
u && context != 5 && context != 32)
977 {
979 }
980 }
static SlotId PlaySound(in SoundStyle? style, Vector2? position=null, SoundUpdateCallback? updateCallback=null)
Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid ...
static void NotifyItemPickup(Player player, Item item)
static void HandleOnEquip(Player player, Item item, int context)
bool CanAcceptItem(int index, Item checkItem, int context)
This serves as a central place to store equipment slots and their corresponding textures....
static bool TryStackItems(Item destination, Item source, out int numTransferred, bool infiniteSource=false)
Stacks source onto destination if CanStack permits the transfer.
static Item TransferWithLimit(Item source, int limit)
Extract up to limit items from source . If some items remain, M:Terraria.ModLoader....
static bool CanEquipAccessory(Item item, int slot, bool modded)
This serves as the central class from which item-related functions are carried out....
static void PostSellItem(Player player, NPC npc, Item[] shopInventory, Item item)
static bool CanSellItem(Player player, NPC npc, Item[] shopInventory, Item item)
This is where all ModPlayer hooks are gathered and called.
static bool OverrideLeftClick(Item[] inv, int context=0, int slot=0)
static void HandleShopSlot(Item[] inv, int slot, bool rightClickIsValid, bool leftClickIsValid)
static int PickItemMovementAction(Item[] inv, int context, int slot, Item checkItem)
static void AnnounceTransfer(ItemTransferInfo info)
static bool IsAccessoryContext(int context)
static bool LeftClick_SellOrTrash(Item[] inv, int context, int slot)