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

◆ TryFitting()

bool Terraria.GameContent.Tile_Entities.TEDisplayDoll.TryFitting ( Item[] inv,
int context = 0,
int slot = 0,
bool justCheck = false )
inlineprivate

Definition at line 484 of file TEDisplayDoll.cs.

485 {
486 Item item = inv[slot];
487 int num = -1;
488 if (item.headSlot > 0)
489 {
490 num = 0;
491 }
492 if (item.bodySlot > 0)
493 {
494 num = 1;
495 }
496 if (item.legSlot > 0)
497 {
498 num = 2;
499 }
500 if (item.accessory)
501 {
503 }
504 if (num == -1)
505 {
506 return false;
507 }
508 if (justCheck)
509 {
510 return true;
511 }
512 if (item.accessory)
513 {
515 if (accessoryTargetSlot >= 8)
516 {
518 }
519 bool flag = ItemSlot.AccCheck(_items, inv[slot], -1);
520 for (int i = 3; i < 8; i++)
521 {
522 if (_items[i].IsAir)
523 {
524 num = i;
526 break;
527 }
528 }
529 for (int j = 3; j < 8; j++)
530 {
531 if (inv[slot].type == _items[j].type || (flag && !ItemSlot.AccCheck(_items, inv[slot], j)))
532 {
533 num = j;
534 if (flag)
535 {
536 flag = false;
537 break;
538 }
539 }
540 }
541 if (flag && num > -1)
542 {
543 return false;
544 }
545 }
547 Utils.Swap(ref _items[num], ref inv[slot]);
548 if (Main.netMode == 1)
549 {
550 NetMessage.SendData(121, -1, -1, null, Main.myPlayer, ID, num);
551 }
552 return true;
553 }
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 bool AccCheck(Item[] itemCollection, Item item, int slot)
Definition ItemSlot.cs:3036

References Terraria.GameContent.Tile_Entities.TEDisplayDoll._items, Terraria.UI.ItemSlot.AccCheck(), Terraria.Item.accessory, Terraria.GameContent.Tile_Entities.TEDisplayDoll.accessoryTargetSlot, Terraria.Item.bodySlot, Terraria.Item.headSlot, Terraria.Item.legSlot, Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.Audio.SoundEngine.PlaySound(), Terraria.NetMessage.SendData(), and Terraria.DataStructures.TileEntity.type.

Referenced by Terraria.GameContent.Tile_Entities.TEDisplayDoll.OverrideItemSlotLeftClick().

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