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

◆ DyeSwap()

static Item Terraria.UI.ItemSlot.DyeSwap ( Item item,
out bool success )
inlinestaticprivate

Definition at line 2692 of file ItemSlot.cs.

2693 {
2694 success = false;
2695 if (item.dye <= 0)
2696 {
2697 return item;
2698 }
2699 Player player = Main.player[Main.myPlayer];
2700 Item item2 = item;
2701 for (int i = 0; i < 10; i++)
2702 {
2703 if (player.dye[i].type == 0)
2704 {
2705 dyeSlotCount = i;
2706 break;
2707 }
2708 }
2709 if (dyeSlotCount >= 10)
2710 {
2711 dyeSlotCount = 0;
2712 }
2713 if (dyeSlotCount < 0)
2714 {
2715 dyeSlotCount = 9;
2716 }
2717 item2 = player.dye[dyeSlotCount].Clone();
2718 player.dye[dyeSlotCount] = item.Clone();
2719 dyeSlotCount++;
2720 if (dyeSlotCount >= 10)
2721 {
2722 accSlotToSwapTo = 0;
2723 }
2725 Recipe.FindRecipes();
2726 success = true;
2727 return item2;
2728 }
static void PlaySound(int type, Vector2 position, int style=1)
static int accSlotToSwapTo
Definition ItemSlot.cs:155
static int dyeSlotCount
Definition ItemSlot.cs:153

References Terraria.UI.ItemSlot.accSlotToSwapTo, Terraria.Item.Clone(), Terraria.Player.dye, Terraria.UI.ItemSlot.dyeSlotCount, Terraria.Recipe.FindRecipes(), System.item, Terraria.Main.myPlayer, Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), and Terraria.Item.type.

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