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

◆ QuickStackAllChests()

void Terraria.Player.QuickStackAllChests ( )
inline

Definition at line 21144 of file Player.cs.

21145 {
21146 //IL_007d: Unknown result type (might be due to invalid IL or missing references)
21147 //IL_0090: Unknown result type (might be due to invalid IL or missing references)
21148 //IL_041e: Unknown result type (might be due to invalid IL or missing references)
21149 //IL_0182: Unknown result type (might be due to invalid IL or missing references)
21150 //IL_0188: Unknown result type (might be due to invalid IL or missing references)
21151 //IL_018d: Unknown result type (might be due to invalid IL or missing references)
21152 //IL_0192: Unknown result type (might be due to invalid IL or missing references)
21153 //IL_050e: Unknown result type (might be due to invalid IL or missing references)
21154 if (HasLockedInventory())
21155 {
21156 return;
21157 }
21159 for (int i = 0; i < nearbyContainerProjectilesList.Count; i++)
21160 {
21161 Projectile projectile = Main.projectile[nearbyContainerProjectilesList[i]];
21162 if (projectile.TryGetContainerIndex(out var containerIndex))
21163 {
21165 int num = chest;
21167 ChestUI.QuickStack(context);
21168 if (useVoidBag())
21169 {
21170 ChestUI.QuickStack(context, voidStack: true);
21171 }
21172 chest = num;
21173 }
21174 }
21175 int num2 = 39;
21176 int num3 = (int)(base.Center.X / 16f);
21177 int num4 = (int)(base.Center.Y / 16f);
21178 for (int j = num3 - num2; j <= num3 + num2; j++)
21179 {
21180 if (j < 0 || j >= Main.maxTilesX)
21181 {
21182 continue;
21183 }
21184 for (int k = num4 - num2; k <= num4 + num2; k++)
21185 {
21186 if (k < 0 || k >= Main.maxTilesY)
21187 {
21188 continue;
21189 }
21190 int num5 = 0;
21191 if (Main.tile[j, k].type == 29)
21192 {
21193 num5 = -2;
21194 }
21195 else if (Main.tile[j, k].type == 97)
21196 {
21197 num5 = -3;
21198 }
21199 else if (Main.tile[j, k].type == 463)
21200 {
21201 num5 = -4;
21202 }
21203 else if (Main.tile[j, k].type == 491)
21204 {
21205 num5 = -5;
21206 }
21207 if (num5 >= 0)
21208 {
21209 continue;
21210 }
21211 Vector2 val = new Vector2((float)(j * 16 + 8), (float)(k * 16 + 8)) - base.Center;
21212 if (((Vector2)(ref val)).Length() < 600f)
21213 {
21215 int num6 = chest;
21216 chest = num5;
21218 if (useVoidBag())
21219 {
21221 }
21222 chest = num6;
21223 }
21224 }
21225 }
21226 if (Main.netMode == 1)
21227 {
21228 for (int l = 10; l < 50; l++)
21229 {
21230 if (inventory[l].type > 0 && inventory[l].stack > 0 && !inventory[l].favorited && !inventory[l].IsACoin)
21231 {
21232 NetMessage.SendData(5, -1, -1, null, whoAmI, PlayerItemSlotID.Inventory0 + l, inventory[l].prefix);
21233 NetMessage.SendData(85, -1, -1, null, PlayerItemSlotID.Inventory0 + l);
21234 inventoryChestStack[l] = true;
21235 }
21236 }
21237 if (!useVoidBag())
21238 {
21239 return;
21240 }
21241 for (int m = 0; m < 40; m++)
21242 {
21243 if (bank4.item[m].type > 0 && bank4.item[m].stack > 0 && !bank4.item[m].favorited && !bank4.item[m].IsACoin)
21244 {
21245 NetMessage.SendData(5, -1, -1, null, whoAmI, PlayerItemSlotID.Bank4_0 + m, bank4.item[m].prefix);
21246 NetMessage.SendData(85, -1, -1, null, PlayerItemSlotID.Bank4_0 + m);
21247 disableVoidBag = m;
21248 }
21249 }
21250 return;
21251 }
21252 for (int n = 10; n < 50; n++)
21253 {
21254 if (inventory[n].type > 0 && inventory[n].stack > 0 && !inventory[n].favorited && !inventory[n].IsACoin)
21255 {
21256 int type = inventory[n].type;
21257 _ = inventory[n].stack;
21258 inventory[n] = Chest.PutItemInNearbyChest(inventory[n], base.Center);
21259 if (inventory[n].type == type)
21260 {
21261 _ = inventory[n].stack;
21262 }
21263 }
21264 }
21265 if (!useVoidBag())
21266 {
21267 return;
21268 }
21269 for (int num7 = 0; num7 < 40; num7++)
21270 {
21272 {
21273 int type2 = bank4.item[num7].type;
21274 _ = bank4.item[num7].stack;
21275 bank4.item[num7] = Chest.PutItemInNearbyChest(bank4.item[num7], base.Center);
21276 if (bank4.item[num7].type == type2)
21277 {
21278 _ = bank4.item[num7].stack;
21279 }
21280 }
21281 }
21282 }
Item[] item
The items this chest contains. F:Terraria.Chest.maxItems elements long.
Definition Chest.cs:93
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
static readonly int Inventory0
int stack
The current stack of the item. F:Terraria.Item.maxStack indicates the max possible stack.
Definition Item.cs:396
bool IsACoin
Definition Item.cs:953
bool favorited
If true, then the given item is favorited. Favorited items cannot be dropped, automatically moved in...
Definition Item.cs:354
int prefix
The current prefix applied to this item. Either a T:Terraria.ID.PrefixID entry or M:Terraria....
Definition Item.cs:752
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
int chest
Represents the chest the player currently has open. If -1, the player has no chest open....
Definition Player.cs:2979
bool HasLockedInventory()
Definition Player.cs:21028
bool useVoidBag()
Definition Player.cs:21132
List< int > GetNearbyContainerProjectilesList()
Definition Player.cs:21053
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
bool[] inventoryChestStack
Definition Player.cs:1769
static void QuickStack(ContainerTransferContext context, bool voidStack=false)
Definition ChestUI.cs:721
static ContainerTransferContext FromProjectile(Projectile projectile)
static ContainerTransferContext FromBlockPosition(int x, int y)

References Terraria.Player.bank4, Terraria.ID.PlayerItemSlotID.Bank4_0, Terraria.Player.chest, Terraria.Player.disableVoidBag, Terraria.Item.favorited, Terraria.DataStructures.ContainerTransferContext.FromBlockPosition(), Terraria.DataStructures.ContainerTransferContext.FromProjectile(), Terraria.Player.GetNearbyContainerProjectilesList(), Terraria.Player.HasLockedInventory(), Terraria.Player.inventory, Terraria.ID.PlayerItemSlotID.Inventory0, Terraria.Player.inventoryChestStack, Terraria.Item.IsACoin, Terraria.Chest.item, Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Main.netMode, Terraria.Item.prefix, Terraria.Main.projectile, Terraria.Chest.PutItemInNearbyChest(), Terraria.UI.ChestUI.QuickStack(), Terraria.NetMessage.SendData(), Terraria.Item.stack, Terraria.Main.tile, Terraria.Projectile.TryGetContainerIndex(), Terraria.Item.type, Terraria.Player.useVoidBag(), and Terraria.Entity.whoAmI.

+ Here is the call graph for this function: