TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ SmartSelect_PickToolForStrategy()

void Terraria.Player.SmartSelect_PickToolForStrategy ( int tX,
int tY,
int toolStrategy,
bool wetTile )
inlineprivate

Definition at line 15850 of file Player.cs.

15851 {
15852 for (int i = 0; i < 50; i++)
15853 {
15854 int type = inventory[i].type;
15855 switch (toolStrategy)
15856 {
15857 case 0:
15858 if (ItemID.Sets.Torches[type])
15859 {
15861 return;
15862 }
15863 if (ItemID.Sets.Glowsticks[type])
15864 {
15866 }
15867 break;
15868 case 1:
15869 if (inventory[i].hammer > 0)
15870 {
15872 return;
15873 }
15874 break;
15875 case 2:
15876 if (inventory[i].axe > 0)
15877 {
15879 return;
15880 }
15881 break;
15882 case 3:
15883 if (inventory[i].pick > 0)
15884 {
15886 return;
15887 }
15888 break;
15889 case 4:
15890 if (inventory[i].type != 930 && ItemID.Sets.Torches[type] && !ItemID.Sets.WaterTorches[type] && !ItemID.Sets.Glowsticks[type])
15891 {
15892 if (nonTorch == -1)
15893 {
15895 }
15897 {
15898 selectedItem = i;
15899 }
15900 break;
15901 }
15902 if (ItemID.Sets.Glowsticks[type] && wetTile)
15903 {
15905 return;
15906 }
15907 if (type == 930 && wetTile)
15908 {
15909 bool flag = false;
15910 for (int num = 57; num >= 0; num--)
15911 {
15912 if (inventory[num].ammo == inventory[i].useAmmo && inventory[num].stack > 0)
15913 {
15914 flag = true;
15915 break;
15916 }
15917 }
15918 if (!flag && !ItemLoader.NeedsAmmo(inventory[i], this))
15919 {
15920 flag = true;
15921 }
15922 if (flag)
15923 {
15925 return;
15926 }
15927 }
15928 else if (ItemID.Sets.WaterTorches[type])
15929 {
15931 return;
15932 }
15933 break;
15934 case 5:
15935 {
15936 if (ItemID.Sets.Torches[type])
15937 {
15938 if (nonTorch == -1)
15939 {
15941 }
15943 {
15944 selectedItem = i;
15945 }
15946 break;
15947 }
15948 int thisType = type;
15949 switch (thisType)
15950 {
15951 case 930:
15952 {
15953 bool flag2 = false;
15954 for (int num2 = 57; num2 >= 0; num2--)
15955 {
15956 if (inventory[num2].ammo == inventory[i].useAmmo && inventory[num2].stack > 0)
15957 {
15958 flag2 = true;
15959 break;
15960 }
15961 }
15962 if (flag2)
15963 {
15965 return;
15966 }
15967 goto end_IL_0016;
15968 }
15969 default:
15971 {
15972 goto end_IL_0016;
15973 }
15974 break;
15975 case 282:
15976 case 286:
15977 case 3002:
15978 case 3112:
15979 case 4776:
15980 break;
15981 }
15983 return;
15984 }
15985 case 6:
15986 {
15987 int num3 = Main.tile[tX, tY].frameX / 72;
15988 int num4 = -1;
15989 switch (num3)
15990 {
15991 case 0:
15992 num4 = 929;
15993 break;
15994 case 1:
15995 num4 = 1338;
15996 break;
15997 case 2:
15998 num4 = 1345;
15999 break;
16000 }
16001 if (type == num4)
16002 {
16004 return;
16005 }
16006 break;
16007 }
16008 case 7:
16009 {
16011 if (itemTrader != null && itemTrader.TryGetTradeOption(inventory[i], out var _))
16012 {
16014 return;
16015 }
16016 if (ItemID.Sets.ExtractinatorMode[type] >= 0)
16017 {
16019 return;
16020 }
16021 break;
16022 }
16023 case 8:
16024 {
16025 if (ItemID.Sets.IsPaintScraper[type])
16026 {
16028 return;
16029 }
16030 break;
16031 }
16033 break;
16034 }
16035 }
16036 }
static bool[] IsPaintScraper
If true for a given item type (F:Terraria.Item.type), then that item is a paint scraper....
Definition ItemID.cs:430
static bool[] Torches
If true for a given item type (F:Terraria.Item.type), then that item is a torch. Torches can be aut...
Definition ItemID.cs:1539
static bool[] WaterTorches
If true for a given item type (F:Terraria.Item.type), then that item is a water torch....
Definition ItemID.cs:1546
static bool[] Glowsticks
If true for a given item type (F:Terraria.Item.type), then that item is a glowstick....
Definition ItemID.cs:1582
static int[] ExtractinatorMode
Indicates which extractinator type an item belongs to. An extractType of 0 represents the default ext...
Definition ItemID.cs:1352
static bool[] Torch
Whether or not this tile behaves like a torch. If you are making a torch tile, then setting this to t...
Definition TileID.cs:428
int createTile
The ID of the tile this item places on use. Either a T:Terraria.ID.TileID entry or M:Terraria....
Definition Item.cs:435
int type
The Item ID of this item. The Item ID is a unique number assigned to each Item loaded into the game....
Definition Item.cs:345
static bool NeedsAmmo(Item weapon, Player player)
Calls ModItem.NeedsAmmo, then all GlobalItem.NeedsAmmo hooks, until any of them returns false.
This serves as the central class from which item-related functions are carried out....
Definition ItemLoader.cs:26
void SmartSelect_SelectItem(int t)
Definition Player.cs:16038
static ItemTrader TryGettingItemTraderFromBlock(Tile targetBlock)
Definition Player.cs:40408
Item[] inventory
The player's normal inventory. Indexes 0-9 hold the hotbar items, 10-49 the rest of the main inventor...
Definition Player.cs:1767

References Terraria.Item.createTile, Terraria.ID.ItemID.Sets.ExtractinatorMode, Terraria.ID.ItemID.Sets.Glowsticks, Terraria.Player.inventory, Terraria.ID.ItemID.Sets.IsPaintScraper, Terraria.ModLoader.ItemLoader.NeedsAmmo(), Terraria.Player.nonTorch, Terraria.Player.selectedItem, Terraria.Player.SmartSelect_SelectItem(), Terraria.Main.tile, Terraria.ID.TileID.Sets.Torch, Terraria.ID.ItemID.Sets.Torches, Terraria.Player.TryGettingItemTraderFromBlock(), Terraria.Item.type, and Terraria.ID.ItemID.Sets.WaterTorches.

Referenced by Terraria.Player.SmartSelectLookup().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: