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

◆ SwapVanityEquip()

static void Terraria.UI.ItemSlot.SwapVanityEquip ( Item[] inv,
int context,
int slot,
Player player )
inlinestaticprivate

Definition at line 1555 of file ItemSlot.cs.

1556 {
1557 if (Main.npcShop > 0 || ((inv[slot].type <= 0 || inv[slot].stack <= 0) && (inv[slot - 10].type <= 0 || inv[slot - 10].stack <= 0)))
1558 {
1559 return;
1560 }
1561 Item item = inv[slot - 10];
1562 bool flag = context != 11 || item.FitsAccessoryVanitySlot || item.IsAir;
1563 if (flag && context == 11 && inv[slot].wingSlot > 0)
1564 {
1565 for (int i = 3; i < 10; i++)
1566 {
1567 if (inv[i].wingSlot > 0 && i != slot - 10)
1568 {
1569 flag = false;
1570 }
1571 }
1572 }
1573 if (!flag)
1574 {
1575 return;
1576 }
1577 Utils.Swap(ref inv[slot], ref inv[slot - 10]);
1579 Recipe.FindRecipes();
1580 if (inv[slot].stack > 0)
1581 {
1582 switch (context)
1583 {
1584 case 0:
1585 AchievementsHelper.NotifyItemPickup(player, inv[slot]);
1586 break;
1587 case 8:
1588 case 9:
1589 case 10:
1590 case 11:
1591 case 12:
1592 case 16:
1593 case 17:
1594 case 25:
1595 case 27:
1596 case 33:
1597 AchievementsHelper.HandleOnEquip(player, inv[slot], context);
1598 break;
1599 }
1600 }
1601 }
static void PlaySound(int type, Vector2 position, int style=1)
static void NotifyItemPickup(Player player, Item item)
static void HandleOnEquip(Player player, Item item, int context)

References Terraria.Recipe.FindRecipes(), Terraria.GameContent.Achievements.AchievementsHelper.HandleOnEquip(), System.item, Terraria.GameContent.Achievements.AchievementsHelper.NotifyItemPickup(), Terraria.Main.npcShop, Terraria.Audio.SoundEngine.PlaySound(), Terraria.Item.stack, and Terraria.Item.type.

Referenced by Terraria.UI.ItemSlot.RightClick().