Terraria v1.4.4.9
Terraria 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 465 of file TEDisplayDoll.cs.

466 {
467 Item item = inv[slot];
468 int num = -1;
469 if (item.headSlot > 0)
470 {
471 num = 0;
472 }
473 if (item.bodySlot > 0)
474 {
475 num = 1;
476 }
477 if (item.legSlot > 0)
478 {
479 num = 2;
480 }
481 if (item.accessory)
482 {
484 }
485 if (num == -1)
486 {
487 return false;
488 }
489 if (justCheck)
490 {
491 return true;
492 }
493 if (item.accessory)
494 {
496 if (accessoryTargetSlot >= 8)
497 {
499 }
500 bool flag = ItemSlot.AccCheck(_items, inv[slot], -1);
501 for (int i = 3; i < 8; i++)
502 {
503 if (_items[i].IsAir)
504 {
505 num = i;
507 break;
508 }
509 }
510 for (int j = 3; j < 8; j++)
511 {
512 if (inv[slot].type == _items[j].type || (flag && !ItemSlot.AccCheck(_items, inv[slot], j)))
513 {
514 num = j;
515 if (flag)
516 {
517 flag = false;
518 break;
519 }
520 }
521 }
522 if (flag && num > -1)
523 {
524 return false;
525 }
526 }
528 Utils.Swap(ref _items[num], ref inv[slot]);
529 if (Main.netMode == 1)
530 {
531 NetMessage.SendData(121, -1, -1, null, Main.myPlayer, ID, num);
532 }
533 return true;
534 }
static void PlaySound(int type, Vector2 position, int style=1)
static bool AccCheck(Item[] itemCollection, Item item, int slot)
Definition ItemSlot.cs:2654

References Terraria.GameContent.Tile_Entities.TEDisplayDoll._items, Terraria.UI.ItemSlot.AccCheck(), Terraria.GameContent.Tile_Entities.TEDisplayDoll.accessoryTargetSlot, 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().