Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ItemSlot.cs
Go to the documentation of this file.
1using System;
11using Terraria.ID;
15
16namespace Terraria.UI;
17
18public class ItemSlot
19{
20 public class Options
21 {
22 public static bool DisableLeftShiftTrashCan = true;
23
24 public static bool DisableQuickTrash = false;
25
26 public static bool HighlightNewItems = true;
27 }
28
29 public class Context
30 {
31 public const int InventoryItem = 0;
32
33 public const int InventoryCoin = 1;
34
35 public const int InventoryAmmo = 2;
36
37 public const int ChestItem = 3;
38
39 public const int BankItem = 4;
40
41 public const int PrefixItem = 5;
42
43 public const int TrashItem = 6;
44
45 public const int GuideItem = 7;
46
47 public const int EquipArmor = 8;
48
49 public const int EquipArmorVanity = 9;
50
51 public const int EquipAccessory = 10;
52
53 public const int EquipAccessoryVanity = 11;
54
55 public const int EquipDye = 12;
56
57 public const int HotbarItem = 13;
58
59 public const int ChatItem = 14;
60
61 public const int ShopItem = 15;
62
63 public const int EquipGrapple = 16;
64
65 public const int EquipMount = 17;
66
67 public const int EquipMinecart = 18;
68
69 public const int EquipPet = 19;
70
71 public const int EquipLight = 20;
72
73 public const int MouseItem = 21;
74
75 public const int CraftingMaterial = 22;
76
77 public const int DisplayDollArmor = 23;
78
79 public const int DisplayDollAccessory = 24;
80
81 public const int DisplayDollDye = 25;
82
83 public const int HatRackHat = 26;
84
85 public const int HatRackDye = 27;
86
87 public const int GoldDebug = 28;
88
89 public const int CreativeInfinite = 29;
90
91 public const int CreativeSacrifice = 30;
92
93 public const int InWorld = 31;
94
95 public const int VoidItem = 32;
96
97 public const int EquipMiscDye = 33;
98
99 public static readonly int Count = 34;
100 }
101
102 public struct ItemTransferInfo
103 {
104 public int ItemType;
105
106 public int TransferAmount;
107
108 public int FromContenxt;
109
110 public int ToContext;
111
112 public ItemTransferInfo(Item itemAfter, int fromContext, int toContext, int transferAmount = 0)
113 {
114 ItemType = itemAfter.type;
115 TransferAmount = itemAfter.stack;
116 if (transferAmount != 0)
117 {
118 TransferAmount = transferAmount;
119 }
120 FromContenxt = fromContext;
121 ToContext = toContext;
122 }
123 }
124
126
128
129 public static bool ShiftForcedOn;
130
131 private static Item[] singleSlotArray;
132
133 private static bool[] canFavoriteAt;
134
135 private static bool[] canShareAt;
136
137 private static float[] inventoryGlowHue;
138
139 private static int[] inventoryGlowTime;
140
141 private static float[] inventoryGlowHueChest;
142
143 private static int[] inventoryGlowTimeChest;
144
145 private static int _customCurrencyForSavings;
146
147 public static bool forceClearGlowsOnChest;
148
150
151 private static Color[,] LoadoutSlotColors;
152
153 private static int dyeSlotCount;
154
155 private static int accSlotToSwapTo;
156
157 public static float CircularRadialOpacity;
158
159 public static float QuicksRadialOpacity;
160
161 public static bool ShiftInUse
162 {
163 get
164 {
165 if (!Main.keyState.PressingShift())
166 {
167 return ShiftForcedOn;
168 }
169 return true;
170 }
171 }
172
173 public static bool ControlInUse => Main.keyState.PressingControl();
174
176
178
179 static ItemSlot()
180 {
182 singleSlotArray = new Item[1];
183 canFavoriteAt = new bool[Context.Count];
184 canShareAt = new bool[Context.Count];
185 inventoryGlowHue = new float[58];
186 inventoryGlowTime = new int[58];
187 inventoryGlowHueChest = new float[58];
188 inventoryGlowTimeChest = new int[58];
191 LoadoutSlotColors = new Color[3, 3]
192 {
193 {
194 new Color(50, 106, 64),
195 new Color(46, 106, 98),
196 new Color(45, 85, 105)
197 },
198 {
199 new Color(35, 106, 126),
200 new Color(50, 89, 140),
201 new Color(57, 70, 128)
202 },
203 {
204 new Color(122, 63, 83),
205 new Color(104, 46, 85),
206 new Color(84, 37, 87)
207 }
208 };
209 canFavoriteAt[0] = true;
210 canFavoriteAt[1] = true;
211 canFavoriteAt[2] = true;
212 canFavoriteAt[32] = true;
213 canShareAt[15] = true;
214 canShareAt[4] = true;
215 canShareAt[32] = true;
216 canShareAt[5] = true;
217 canShareAt[6] = true;
218 canShareAt[7] = true;
219 canShareAt[27] = true;
220 canShareAt[26] = true;
221 canShareAt[23] = true;
222 canShareAt[24] = true;
223 canShareAt[25] = true;
224 canShareAt[22] = true;
225 canShareAt[3] = true;
226 canShareAt[8] = true;
227 canShareAt[9] = true;
228 canShareAt[10] = true;
229 canShareAt[11] = true;
230 canShareAt[12] = true;
231 canShareAt[33] = true;
232 canShareAt[16] = true;
233 canShareAt[20] = true;
234 canShareAt[18] = true;
235 canShareAt[19] = true;
236 canShareAt[17] = true;
237 canShareAt[29] = true;
238 canShareAt[30] = true;
239 }
240
242 {
243 if (ItemSlot.OnItemTransferred != null)
244 {
246 }
247 }
248
249 public static void SetGlow(int index, float hue, bool chest)
250 {
251 if (chest)
252 {
253 if (hue < 0f)
254 {
257 }
258 else
259 {
262 }
263 }
264 else
265 {
267 inventoryGlowHue[index] = hue;
268 }
269 }
270
271 public static void UpdateInterface()
272 {
273 if (!Main.playerInventory || Main.player[Main.myPlayer].talkNPC == -1)
274 {
276 }
277 for (int i = 0; i < inventoryGlowTime.Length; i++)
278 {
279 if (inventoryGlowTime[i] > 0)
280 {
282 if (inventoryGlowTime[i] == 0)
283 {
284 inventoryGlowHue[i] = 0f;
285 }
286 }
287 }
288 for (int j = 0; j < inventoryGlowTimeChest.Length; j++)
289 {
290 if (inventoryGlowTimeChest[j] > 0)
291 {
294 {
295 inventoryGlowHueChest[j] = 0f;
296 }
297 }
298 }
300 }
301
302 public static void Handle(ref Item inv, int context = 0)
303 {
304 singleSlotArray[0] = inv;
305 Handle(singleSlotArray, context);
306 inv = singleSlotArray[0];
308 }
309
310 public static void Handle(Item[] inv, int context = 0, int slot = 0)
311 {
312 OverrideHover(inv, context, slot);
313 LeftClick(inv, context, slot);
314 RightClick(inv, context, slot);
316 {
318 }
319 MouseHover(inv, context, slot);
320 }
321
322 public static void OverrideHover(ref Item inv, int context = 0)
323 {
324 singleSlotArray[0] = inv;
326 inv = singleSlotArray[0];
327 }
328
329 public static bool isEquipLocked(int type)
330 {
331 return false;
332 }
333
334 public static void OverrideHover(Item[] inv, int context = 0, int slot = 0)
335 {
336 Item item = inv[slot];
338 {
340 }
341 bool shiftForcedOn = ShiftForcedOn;
342 if (NotUsingGamepad && Options.DisableLeftShiftTrashCan && !shiftForcedOn)
343 {
345 {
346 if (item.type > 0 && item.stack > 0 && !inv[slot].favorited)
347 {
348 switch (context)
349 {
350 case 0:
351 case 1:
352 case 2:
353 if (Main.npcShop > 0 && !item.favorited)
354 {
355 Main.cursorOverride = 10;
356 }
357 else
358 {
359 Main.cursorOverride = 6;
360 }
361 break;
362 case 3:
363 case 4:
364 case 7:
365 case 32:
366 if (Main.player[Main.myPlayer].ItemSpace(item).CanTakeItemToPersonalInventory)
367 {
368 Main.cursorOverride = 6;
369 }
370 break;
371 }
372 }
373 }
374 else if (ShiftInUse)
375 {
376 bool flag = false;
377 if (Main.LocalPlayer.tileEntityAnchor.IsInValidUseTileEntity())
378 {
379 flag = Main.LocalPlayer.tileEntityAnchor.GetTileEntity().OverrideItemSlotHover(inv, context, slot);
380 }
381 if (item.type > 0 && item.stack > 0 && !inv[slot].favorited && !flag)
382 {
383 switch (context)
384 {
385 case 0:
386 if (Main.CreativeMenu.IsShowingResearchMenu())
387 {
388 Main.cursorOverride = 9;
389 break;
390 }
391 goto case 1;
392 case 1:
393 case 2:
394 if (context == 0 && Main.InReforgeMenu)
395 {
396 if (item.maxStack == 1 && item.Prefix(-3))
397 {
398 Main.cursorOverride = 9;
399 }
400 }
401 else if (context == 0 && Main.InGuideCraftMenu)
402 {
403 if (item.material)
404 {
405 Main.cursorOverride = 9;
406 }
407 }
408 else if (Main.player[Main.myPlayer].chest != -1 && ChestUI.TryPlacingInChest(item, justCheck: true, context))
409 {
410 Main.cursorOverride = 9;
411 }
412 break;
413 case 3:
414 case 4:
415 case 32:
416 if (Main.player[Main.myPlayer].ItemSpace(item).CanTakeItemToPersonalInventory)
417 {
418 Main.cursorOverride = 8;
419 }
420 break;
421 case 5:
422 case 7:
423 case 8:
424 case 9:
425 case 10:
426 case 11:
427 case 12:
428 case 16:
429 case 17:
430 case 18:
431 case 19:
432 case 20:
433 case 23:
434 case 24:
435 case 25:
436 case 26:
437 case 27:
438 case 29:
439 case 33:
440 if (Main.player[Main.myPlayer].ItemSpace(inv[slot]).CanTakeItemToPersonalInventory)
441 {
442 Main.cursorOverride = 7;
443 }
444 break;
445 }
446 }
447 }
448 }
449 else if (ShiftInUse)
450 {
451 bool flag2 = false;
452 if (Main.LocalPlayer.tileEntityAnchor.IsInValidUseTileEntity())
453 {
454 flag2 = Main.LocalPlayer.tileEntityAnchor.GetTileEntity().OverrideItemSlotHover(inv, context, slot);
455 }
456 if (item.type > 0 && item.stack > 0 && !inv[slot].favorited && !flag2)
457 {
458 switch (context)
459 {
460 case 0:
461 case 1:
462 case 2:
463 if (Main.npcShop > 0 && !item.favorited)
464 {
466 {
467 Main.cursorOverride = 10;
468 }
469 }
470 else if (context == 0 && Main.CreativeMenu.IsShowingResearchMenu())
471 {
472 Main.cursorOverride = 9;
473 }
474 else if (context == 0 && Main.InReforgeMenu)
475 {
476 if (item.maxStack == 1 && item.Prefix(-3))
477 {
478 Main.cursorOverride = 9;
479 }
480 }
481 else if (context == 0 && Main.InGuideCraftMenu)
482 {
483 if (item.material)
484 {
485 Main.cursorOverride = 9;
486 }
487 }
488 else if (Main.player[Main.myPlayer].chest != -1)
489 {
490 if (ChestUI.TryPlacingInChest(item, justCheck: true, context))
491 {
492 Main.cursorOverride = 9;
493 }
494 }
495 else if (!Options.DisableQuickTrash)
496 {
497 Main.cursorOverride = 6;
498 }
499 break;
500 case 3:
501 case 4:
502 case 32:
503 if (Main.player[Main.myPlayer].ItemSpace(item).CanTakeItemToPersonalInventory)
504 {
505 Main.cursorOverride = 8;
506 }
507 break;
508 case 5:
509 case 7:
510 case 8:
511 case 9:
512 case 10:
513 case 11:
514 case 12:
515 case 16:
516 case 17:
517 case 18:
518 case 19:
519 case 20:
520 case 23:
521 case 24:
522 case 25:
523 case 26:
524 case 27:
525 case 29:
526 case 33:
527 if (Main.player[Main.myPlayer].ItemSpace(inv[slot]).CanTakeItemToPersonalInventory)
528 {
529 Main.cursorOverride = 7;
530 }
531 break;
532 }
533 }
534 }
535 if (Main.keyState.IsKeyDown(Main.FavoriteKey) && (canFavoriteAt[context] || (Main.drawingPlayerChat && canShareAt[context])))
536 {
537 if (item.type > 0 && item.stack > 0 && Main.drawingPlayerChat)
538 {
539 Main.cursorOverride = 2;
540 }
541 else if (item.type > 0 && item.stack > 0)
542 {
543 Main.cursorOverride = 3;
544 }
545 }
546 }
547
548 private static bool OverrideLeftClick(Item[] inv, int context = 0, int slot = 0)
549 {
550 if (context == 10 && isEquipLocked(inv[slot].type))
551 {
552 return true;
553 }
554 if (Main.LocalPlayer.tileEntityAnchor.IsInValidUseTileEntity() && Main.LocalPlayer.tileEntityAnchor.GetTileEntity().OverrideItemSlotLeftClick(inv, context, slot))
555 {
556 return true;
557 }
558 Item item = inv[slot];
559 if (Main.cursorOverride == 2)
560 {
562 {
564 }
565 return true;
566 }
567 if (Main.cursorOverride == 3)
568 {
569 if (!canFavoriteAt[context])
570 {
571 return false;
572 }
573 item.favorited = !item.favorited;
575 return true;
576 }
577 if (Main.cursorOverride == 7)
578 {
579 if (context == 29)
580 {
581 Item item2 = new Item();
582 item2.SetDefaults(inv[slot].netID);
583 item2.stack = item2.maxStack;
587 return true;
588 }
591 return true;
592 }
593 if (Main.cursorOverride == 8)
594 {
596 if (Main.player[Main.myPlayer].chest > -1)
597 {
598 NetMessage.SendData(32, -1, -1, null, Main.player[Main.myPlayer].chest, slot);
599 }
600 return true;
601 }
602 if (Main.cursorOverride == 9)
603 {
604 if (Main.CreativeMenu.IsShowingResearchMenu())
605 {
606 Main.CreativeMenu.SwapItem(ref inv[slot]);
608 Main.CreativeMenu.SacrificeItemInSacrificeSlot();
609 }
610 else if (Main.InReforgeMenu)
611 {
612 Utils.Swap(ref inv[slot], ref Main.reforgeItem);
614 }
615 else if (Main.InGuideCraftMenu)
616 {
617 Utils.Swap(ref inv[slot], ref Main.guideItem);
620 }
621 else
622 {
623 ChestUI.TryPlacingInChest(inv[slot], justCheck: false, context);
624 }
625 return true;
626 }
627 return false;
628 }
629
630 public static void LeftClick(ref Item inv, int context = 0)
631 {
632 singleSlotArray[0] = inv;
633 LeftClick(singleSlotArray, context);
634 inv = singleSlotArray[0];
635 }
636
637 public static void LeftClick(Item[] inv, int context = 0, int slot = 0)
638 {
639 Player player = Main.player[Main.myPlayer];
640 bool flag = Main.mouseLeftRelease && Main.mouseLeft;
641 if (flag)
642 {
643 if (OverrideLeftClick(inv, context, slot))
644 {
645 return;
646 }
647 inv[slot].newAndShiny = false;
648 if (LeftClick_SellOrTrash(inv, context, slot) || player.itemAnimation != 0 || player.itemTime != 0)
649 {
650 return;
651 }
652 }
653 int num = PickItemMovementAction(inv, context, slot, Main.mouseItem);
654 if (num != 3 && !flag)
655 {
656 return;
657 }
658 switch (num)
659 {
660 case 0:
661 if (context == 6 && Main.mouseItem.type != 0)
662 {
663 inv[slot].SetDefaults();
664 }
665 if (context == 11 && !inv[slot].FitsAccessoryVanitySlot)
666 {
667 break;
668 }
669 Utils.Swap(ref inv[slot], ref Main.mouseItem);
670 if (inv[slot].stack > 0)
671 {
672 AnnounceTransfer(new ItemTransferInfo(inv[slot], 21, context, inv[slot].stack));
673 }
674 else
675 {
677 }
678 if (inv[slot].stack > 0)
679 {
680 switch (context)
681 {
682 case 0:
683 AchievementsHelper.NotifyItemPickup(player, inv[slot]);
684 break;
685 case 8:
686 case 9:
687 case 10:
688 case 11:
689 case 12:
690 case 16:
691 case 17:
692 case 25:
693 case 27:
694 case 33:
695 AchievementsHelper.HandleOnEquip(player, inv[slot], context);
696 break;
697 }
698 }
699 if (inv[slot].type == 0 || inv[slot].stack < 1)
700 {
701 inv[slot] = new Item();
702 }
703 if (Main.mouseItem.IsTheSameAs(inv[slot]))
704 {
705 Utils.Swap(ref inv[slot].favorited, ref Main.mouseItem.favorited);
706 if (inv[slot].stack != inv[slot].maxStack && Main.mouseItem.stack != Main.mouseItem.maxStack)
707 {
708 if (Main.mouseItem.stack + inv[slot].stack <= Main.mouseItem.maxStack)
709 {
710 inv[slot].stack += Main.mouseItem.stack;
711 Main.mouseItem.stack = 0;
712 AnnounceTransfer(new ItemTransferInfo(inv[slot], 21, context, inv[slot].stack));
713 }
714 else
715 {
716 int num2 = Main.mouseItem.maxStack - inv[slot].stack;
717 inv[slot].stack += num2;
718 Main.mouseItem.stack -= num2;
719 AnnounceTransfer(new ItemTransferInfo(inv[slot], 21, context, num2));
720 }
721 }
722 }
723 if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1)
724 {
725 Main.mouseItem = new Item();
726 }
727 if (Main.mouseItem.type > 0 || inv[slot].type > 0)
728 {
731 }
732 if (context == 3 && Main.netMode == 1)
733 {
734 NetMessage.SendData(32, -1, -1, null, player.chest, slot);
735 }
736 break;
737 case 1:
738 if (Main.mouseItem.stack == 1 && Main.mouseItem.type > 0 && inv[slot].type > 0 && inv[slot].IsNotTheSameAs(Main.mouseItem) && (context != 11 || Main.mouseItem.FitsAccessoryVanitySlot))
739 {
740 Utils.Swap(ref inv[slot], ref Main.mouseItem);
742 if (inv[slot].stack > 0)
743 {
744 switch (context)
745 {
746 case 0:
747 AchievementsHelper.NotifyItemPickup(player, inv[slot]);
748 break;
749 case 8:
750 case 9:
751 case 10:
752 case 11:
753 case 12:
754 case 16:
755 case 17:
756 case 25:
757 case 27:
758 case 33:
759 AchievementsHelper.HandleOnEquip(player, inv[slot], context);
760 break;
761 }
762 }
763 }
764 else if (Main.mouseItem.type == 0 && inv[slot].type > 0)
765 {
766 Utils.Swap(ref inv[slot], ref Main.mouseItem);
767 if (inv[slot].type == 0 || inv[slot].stack < 1)
768 {
769 inv[slot] = new Item();
770 }
771 if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1)
772 {
773 Main.mouseItem = new Item();
774 }
775 if (Main.mouseItem.type > 0 || inv[slot].type > 0)
776 {
779 }
780 }
781 else if (Main.mouseItem.type > 0 && inv[slot].type == 0 && (context != 11 || Main.mouseItem.FitsAccessoryVanitySlot))
782 {
783 if (Main.mouseItem.stack == 1)
784 {
785 Utils.Swap(ref inv[slot], ref Main.mouseItem);
786 if (inv[slot].type == 0 || inv[slot].stack < 1)
787 {
788 inv[slot] = new Item();
789 }
790 if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1)
791 {
792 Main.mouseItem = new Item();
793 }
794 if (Main.mouseItem.type > 0 || inv[slot].type > 0)
795 {
798 }
799 }
800 else
801 {
802 Main.mouseItem.stack--;
803 inv[slot].SetDefaults(Main.mouseItem.type);
806 }
807 if (inv[slot].stack > 0)
808 {
809 switch (context)
810 {
811 case 0:
812 AchievementsHelper.NotifyItemPickup(player, inv[slot]);
813 break;
814 case 8:
815 case 9:
816 case 10:
817 case 11:
818 case 12:
819 case 16:
820 case 17:
821 case 25:
822 case 27:
823 case 33:
824 AchievementsHelper.HandleOnEquip(player, inv[slot], context);
825 break;
826 }
827 }
828 }
829 if ((context == 23 || context == 24) && Main.netMode == 1)
830 {
831 NetMessage.SendData(121, -1, -1, null, Main.myPlayer, player.tileEntityAnchor.interactEntityID, slot);
832 }
833 if (context == 26 && Main.netMode == 1)
834 {
835 NetMessage.SendData(124, -1, -1, null, Main.myPlayer, player.tileEntityAnchor.interactEntityID, slot);
836 }
837 break;
838 case 2:
839 if (Main.mouseItem.stack == 1 && Main.mouseItem.dye > 0 && inv[slot].type > 0 && inv[slot].type != Main.mouseItem.type)
840 {
841 Utils.Swap(ref inv[slot], ref Main.mouseItem);
843 if (inv[slot].stack > 0)
844 {
845 switch (context)
846 {
847 case 0:
848 AchievementsHelper.NotifyItemPickup(player, inv[slot]);
849 break;
850 case 8:
851 case 9:
852 case 10:
853 case 11:
854 case 12:
855 case 16:
856 case 17:
857 case 25:
858 case 27:
859 case 33:
860 AchievementsHelper.HandleOnEquip(player, inv[slot], context);
861 break;
862 }
863 }
864 }
865 else if (Main.mouseItem.type == 0 && inv[slot].type > 0)
866 {
867 Utils.Swap(ref inv[slot], ref Main.mouseItem);
868 if (inv[slot].type == 0 || inv[slot].stack < 1)
869 {
870 inv[slot] = new Item();
871 }
872 if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1)
873 {
874 Main.mouseItem = new Item();
875 }
876 if (Main.mouseItem.type > 0 || inv[slot].type > 0)
877 {
880 }
881 }
882 else if (Main.mouseItem.dye > 0 && inv[slot].type == 0)
883 {
884 if (Main.mouseItem.stack == 1)
885 {
886 Utils.Swap(ref inv[slot], ref Main.mouseItem);
887 if (inv[slot].type == 0 || inv[slot].stack < 1)
888 {
889 inv[slot] = new Item();
890 }
891 if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1)
892 {
893 Main.mouseItem = new Item();
894 }
895 if (Main.mouseItem.type > 0 || inv[slot].type > 0)
896 {
899 }
900 }
901 else
902 {
903 Main.mouseItem.stack--;
904 inv[slot].SetDefaults(Main.mouseItem.type);
907 }
908 if (inv[slot].stack > 0)
909 {
910 switch (context)
911 {
912 case 0:
913 AchievementsHelper.NotifyItemPickup(player, inv[slot]);
914 break;
915 case 8:
916 case 9:
917 case 10:
918 case 11:
919 case 12:
920 case 16:
921 case 17:
922 case 25:
923 case 27:
924 case 33:
925 AchievementsHelper.HandleOnEquip(player, inv[slot], context);
926 break;
927 }
928 }
929 }
930 if (context == 25 && Main.netMode == 1)
931 {
932 NetMessage.SendData(121, -1, -1, null, Main.myPlayer, player.tileEntityAnchor.interactEntityID, slot, 1f);
933 }
934 if (context == 27 && Main.netMode == 1)
935 {
936 NetMessage.SendData(124, -1, -1, null, Main.myPlayer, player.tileEntityAnchor.interactEntityID, slot, 1f);
937 }
938 break;
939 case 3:
940 HandleShopSlot(inv, slot, rightClickIsValid: false, leftClickIsValid: true);
941 break;
942 case 4:
943 {
944 Chest chest = Main.instance.shop[Main.npcShop];
945 if (player.SellItem(Main.mouseItem))
946 {
948 Main.mouseItem.SetDefaults();
950 AnnounceTransfer(new ItemTransferInfo(inv[slot], 21, 15));
951 }
952 else if (Main.mouseItem.value == 0)
953 {
955 Main.mouseItem.SetDefaults();
957 AnnounceTransfer(new ItemTransferInfo(inv[slot], 21, 15));
958 }
960 Main.stackSplit = 9999;
961 break;
962 }
963 case 5:
964 if (Main.mouseItem.IsAir)
965 {
967 Main.mouseItem.SetDefaults(inv[slot].netID);
968 Main.mouseItem.stack = Main.mouseItem.maxStack;
970 AnnounceTransfer(new ItemTransferInfo(inv[slot], 29, 21));
971 }
972 break;
973 }
974 if ((uint)context > 2u && context != 5 && context != 32)
975 {
976 inv[slot].favorited = false;
977 }
978 }
979
980 private static bool DisableTrashing()
981 {
983 {
985 }
986 return false;
987 }
988
989 private static bool LeftClick_SellOrTrash(Item[] inv, int context, int slot)
990 {
991 bool flag = false;
992 bool result = false;
994 {
996 {
997 if ((uint)context <= 4u || context == 7 || context == 32)
998 {
999 flag = true;
1000 }
1001 if (ControlInUse && flag)
1002 {
1003 SellOrTrash(inv, context, slot);
1004 result = true;
1005 }
1006 }
1007 }
1008 else
1009 {
1010 if ((uint)context <= 4u || context == 32)
1011 {
1012 flag = Main.player[Main.myPlayer].chest == -1;
1013 }
1015 {
1016 SellOrTrash(inv, context, slot);
1017 result = true;
1018 }
1019 }
1020 return result;
1021 }
1022
1023 private static void SellOrTrash(Item[] inv, int context, int slot)
1024 {
1025 Player player = Main.player[Main.myPlayer];
1026 if (inv[slot].type <= 0)
1027 {
1028 return;
1029 }
1030 if (Main.npcShop > 0 && !inv[slot].favorited)
1031 {
1032 Chest chest = Main.instance.shop[Main.npcShop];
1033 if (inv[slot].type < 71 || inv[slot].type > 74)
1034 {
1035 if (player.SellItem(inv[slot]))
1036 {
1037 chest.AddItemToShop(inv[slot]);
1038 AnnounceTransfer(new ItemTransferInfo(inv[slot], context, 15));
1039 inv[slot].TurnToAir();
1042 }
1043 else if (inv[slot].value == 0)
1044 {
1045 chest.AddItemToShop(inv[slot]);
1046 AnnounceTransfer(new ItemTransferInfo(inv[slot], context, 15));
1047 inv[slot].TurnToAir();
1050 }
1051 }
1052 }
1053 else if (!inv[slot].favorited)
1054 {
1056 player.trashItem = inv[slot].Clone();
1057 AnnounceTransfer(new ItemTransferInfo(player.trashItem, context, 6));
1058 inv[slot].TurnToAir();
1059 if (context == 3 && Main.netMode == 1)
1060 {
1061 NetMessage.SendData(32, -1, -1, null, player.chest, slot);
1062 }
1064 }
1065 }
1066
1067 private static string GetOverrideInstructions(Item[] inv, int context, int slot)
1068 {
1069 Player player = Main.player[Main.myPlayer];
1070 TileEntity tileEntity = player.tileEntityAnchor.GetTileEntity();
1071 if (tileEntity != null && tileEntity.TryGetItemGamepadOverrideInstructions(inv, context, slot, out var instruction))
1072 {
1073 return instruction;
1074 }
1075 if (inv[slot].type > 0 && inv[slot].stack > 0)
1076 {
1077 if (!inv[slot].favorited)
1078 {
1079 switch (context)
1080 {
1081 case 0:
1082 case 1:
1083 case 2:
1084 if (Main.npcShop > 0 && !inv[slot].favorited)
1085 {
1086 return Lang.misc[75].Value;
1087 }
1088 if (Main.player[Main.myPlayer].chest != -1)
1089 {
1090 if (ChestUI.TryPlacingInChest(inv[slot], justCheck: true, context))
1091 {
1092 return Lang.misc[76].Value;
1093 }
1094 }
1095 else if (Main.InGuideCraftMenu && inv[slot].material)
1096 {
1097 return Lang.misc[76].Value;
1098 }
1099 if (Main.mouseItem.type > 0 && (context == 0 || context == 1 || context == 2 || context == 6 || context == 15 || context == 7 || context == 4 || context == 32 || context == 3))
1100 {
1101 return null;
1102 }
1103 return Lang.misc[74].Value;
1104 case 3:
1105 case 4:
1106 case 32:
1107 if (Main.player[Main.myPlayer].ItemSpace(inv[slot]).CanTakeItemToPersonalInventory)
1108 {
1109 return Lang.misc[76].Value;
1110 }
1111 break;
1112 case 5:
1113 case 8:
1114 case 9:
1115 case 10:
1116 case 11:
1117 case 12:
1118 case 16:
1119 case 17:
1120 case 18:
1121 case 19:
1122 case 20:
1123 case 25:
1124 case 27:
1125 case 33:
1126 if (Main.player[Main.myPlayer].ItemSpace(inv[slot]).CanTakeItemToPersonalInventory)
1127 {
1128 return Lang.misc[68].Value;
1129 }
1130 break;
1131 }
1132 }
1133 bool flag = false;
1134 if ((uint)context <= 4u || context == 32)
1135 {
1136 flag = player.chest == -1;
1137 }
1138 if (flag)
1139 {
1140 if (Main.npcShop > 0 && !inv[slot].favorited)
1141 {
1142 _ = Main.instance.shop[Main.npcShop];
1143 if (inv[slot].type >= 71 && inv[slot].type <= 74)
1144 {
1145 return "";
1146 }
1147 return Lang.misc[75].Value;
1148 }
1149 if (!inv[slot].favorited)
1150 {
1151 return Lang.misc[74].Value;
1152 }
1153 }
1154 }
1155 return "";
1156 }
1157
1158 public static int PickItemMovementAction(Item[] inv, int context, int slot, Item checkItem)
1159 {
1160 _ = Main.player[Main.myPlayer];
1161 int result = -1;
1162 switch (context)
1163 {
1164 case 0:
1165 result = 0;
1166 break;
1167 case 1:
1168 if (checkItem.type == 0 || checkItem.type == 71 || checkItem.type == 72 || checkItem.type == 73 || checkItem.type == 74)
1169 {
1170 result = 0;
1171 }
1172 break;
1173 case 2:
1174 if (checkItem.FitsAmmoSlot())
1175 {
1176 result = 0;
1177 }
1178 break;
1179 case 3:
1180 result = 0;
1181 break;
1182 case 4:
1183 case 32:
1184 {
1185 ChestUI.GetContainerUsageInfo(out var _, out var chestinv);
1186 if (!ChestUI.IsBlockedFromTransferIntoChest(checkItem, chestinv))
1187 {
1188 result = 0;
1189 }
1190 break;
1191 }
1192 case 5:
1193 if (checkItem.Prefix(-3) || checkItem.type == 0)
1194 {
1195 result = 0;
1196 }
1197 break;
1198 case 6:
1199 result = 0;
1200 break;
1201 case 7:
1202 if (checkItem.material || checkItem.type == 0)
1203 {
1204 result = 0;
1205 }
1206 break;
1207 case 8:
1208 if (checkItem.type == 0 || (checkItem.headSlot > -1 && slot == 0) || (checkItem.bodySlot > -1 && slot == 1) || (checkItem.legSlot > -1 && slot == 2))
1209 {
1210 result = 1;
1211 }
1212 break;
1213 case 23:
1214 if (checkItem.type == 0 || (checkItem.headSlot > 0 && slot == 0) || (checkItem.bodySlot > 0 && slot == 1) || (checkItem.legSlot > 0 && slot == 2))
1215 {
1216 result = 1;
1217 }
1218 break;
1219 case 26:
1220 if (checkItem.type == 0 || checkItem.headSlot > 0)
1221 {
1222 result = 1;
1223 }
1224 break;
1225 case 9:
1226 if (checkItem.type == 0 || (checkItem.headSlot > -1 && slot == 10) || (checkItem.bodySlot > -1 && slot == 11) || (checkItem.legSlot > -1 && slot == 12))
1227 {
1228 result = 1;
1229 }
1230 break;
1231 case 10:
1232 if (checkItem.type == 0 || (checkItem.accessory && !AccCheck(Main.LocalPlayer.armor, checkItem, slot)))
1233 {
1234 result = 1;
1235 }
1236 break;
1237 case 24:
1238 if (checkItem.type == 0 || (checkItem.accessory && !AccCheck(inv, checkItem, slot)))
1239 {
1240 result = 1;
1241 }
1242 break;
1243 case 11:
1244 if (checkItem.type == 0 || (checkItem.accessory && !AccCheck(Main.LocalPlayer.armor, checkItem, slot)))
1245 {
1246 result = 1;
1247 }
1248 break;
1249 case 12:
1250 case 25:
1251 case 27:
1252 case 33:
1253 result = 2;
1254 break;
1255 case 15:
1256 if (checkItem.type == 0 && inv[slot].type > 0)
1257 {
1258 result = 3;
1259 }
1260 else if (checkItem.type == inv[slot].type && checkItem.type > 0 && checkItem.stack < checkItem.maxStack && inv[slot].stack > 0)
1261 {
1262 result = 3;
1263 }
1264 else if (inv[slot].type == 0 && checkItem.type > 0 && (checkItem.type < 71 || checkItem.type > 74))
1265 {
1266 result = 4;
1267 }
1268 break;
1269 case 16:
1270 if (checkItem.type == 0 || Main.projHook[checkItem.shoot])
1271 {
1272 result = 1;
1273 }
1274 break;
1275 case 17:
1276 if (checkItem.type == 0 || (checkItem.mountType != -1 && !MountID.Sets.Cart[checkItem.mountType]))
1277 {
1278 result = 1;
1279 }
1280 break;
1281 case 19:
1282 if (checkItem.type == 0 || (checkItem.buffType > 0 && Main.vanityPet[checkItem.buffType] && !Main.lightPet[checkItem.buffType]))
1283 {
1284 result = 1;
1285 }
1286 break;
1287 case 18:
1288 if (checkItem.type == 0 || (checkItem.mountType != -1 && MountID.Sets.Cart[checkItem.mountType]))
1289 {
1290 result = 1;
1291 }
1292 break;
1293 case 20:
1294 if (checkItem.type == 0 || (checkItem.buffType > 0 && Main.lightPet[checkItem.buffType]))
1295 {
1296 result = 1;
1297 }
1298 break;
1299 case 29:
1300 if (checkItem.type == 0 && inv[slot].type > 0)
1301 {
1302 result = 5;
1303 }
1304 break;
1305 }
1306 if (context == 30)
1307 {
1308 result = 0;
1309 }
1310 return result;
1311 }
1312
1313 public static void RightClick(ref Item inv, int context = 0)
1314 {
1315 singleSlotArray[0] = inv;
1316 RightClick(singleSlotArray, context);
1317 inv = singleSlotArray[0];
1318 }
1319
1320 public static void RightClick(Item[] inv, int context = 0, int slot = 0)
1321 {
1322 Player player = Main.player[Main.myPlayer];
1323 inv[slot].newAndShiny = false;
1324 if (player.itemAnimation > 0)
1325 {
1326 return;
1327 }
1328 if (context == 15)
1329 {
1330 HandleShopSlot(inv, slot, rightClickIsValid: true, leftClickIsValid: false);
1331 }
1332 else
1333 {
1334 if (!Main.mouseRight)
1335 {
1336 return;
1337 }
1338 if (context == 0 && Main.mouseRightRelease)
1339 {
1340 TryItemSwap(inv[slot]);
1341 }
1342 if (context == 0 && ItemID.Sets.OpenableBag[inv[slot].type])
1343 {
1345 {
1346 TryOpenContainer(inv[slot], player);
1347 }
1348 return;
1349 }
1350 switch (context)
1351 {
1352 case 9:
1353 case 11:
1355 {
1356 SwapVanityEquip(inv, context, slot, player);
1357 }
1358 break;
1359 case 12:
1360 case 25:
1361 case 27:
1362 case 33:
1364 {
1365 TryPickupDyeToCursor(context, inv, slot, player);
1366 }
1367 break;
1368 case 0:
1369 case 3:
1370 case 4:
1371 case 32:
1372 if (inv[slot].maxStack == 1)
1373 {
1375 {
1376 SwapEquip(inv, context, slot);
1377 }
1378 break;
1379 }
1380 goto default;
1381 default:
1382 {
1383 if (Main.stackSplit > 1)
1384 {
1385 break;
1386 }
1387 bool flag = true;
1388 bool flag2 = inv[slot].maxStack <= 1 && inv[slot].stack <= 1;
1389 if (context == 0 && flag2)
1390 {
1391 flag = false;
1392 }
1393 if (context == 3 && flag2)
1394 {
1395 flag = false;
1396 }
1397 if (context == 4 && flag2)
1398 {
1399 flag = false;
1400 }
1401 if (context == 32 && flag2)
1402 {
1403 flag = false;
1404 }
1405 if (!flag)
1406 {
1407 break;
1408 }
1409 int num = Main.superFastStack + 1;
1410 for (int i = 0; i < num; i++)
1411 {
1412 if ((Main.mouseItem.IsTheSameAs(inv[slot]) || Main.mouseItem.type == 0) && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0))
1413 {
1414 PickupItemIntoMouse(inv, context, slot, player);
1417 }
1418 }
1419 break;
1420 }
1421 }
1422 }
1423 }
1424
1425 public static void PickupItemIntoMouse(Item[] inv, int context, int slot, Player player)
1426 {
1427 if (Main.mouseItem.type == 0)
1428 {
1429 Main.mouseItem = inv[slot].Clone();
1430 if (context == 29)
1431 {
1432 Main.mouseItem.SetDefaults(Main.mouseItem.type);
1434 }
1435 Main.mouseItem.stack = 0;
1436 if (inv[slot].favorited && inv[slot].stack == 1)
1437 {
1438 Main.mouseItem.favorited = true;
1439 }
1440 else
1441 {
1442 Main.mouseItem.favorited = false;
1443 }
1444 AnnounceTransfer(new ItemTransferInfo(inv[slot], context, 21));
1445 }
1446 Main.mouseItem.stack++;
1447 if (context != 29)
1448 {
1449 inv[slot].stack--;
1450 }
1451 if (inv[slot].stack <= 0)
1452 {
1453 inv[slot] = new Item();
1454 }
1456 if (context == 3 && Main.netMode == 1)
1457 {
1458 NetMessage.SendData(32, -1, -1, null, player.chest, slot);
1459 }
1460 if ((context == 23 || context == 24) && Main.netMode == 1)
1461 {
1462 NetMessage.SendData(121, -1, -1, null, Main.myPlayer, player.tileEntityAnchor.interactEntityID, slot);
1463 }
1464 if (context == 25 && Main.netMode == 1)
1465 {
1466 NetMessage.SendData(121, -1, -1, null, Main.myPlayer, player.tileEntityAnchor.interactEntityID, slot, 1f);
1467 }
1468 if (context == 26 && Main.netMode == 1)
1469 {
1470 NetMessage.SendData(124, -1, -1, null, Main.myPlayer, player.tileEntityAnchor.interactEntityID, slot);
1471 }
1472 if (context == 27 && Main.netMode == 1)
1473 {
1474 NetMessage.SendData(124, -1, -1, null, Main.myPlayer, player.tileEntityAnchor.interactEntityID, slot, 1f);
1475 }
1476 }
1477
1478 public static void RefreshStackSplitCooldown()
1479 {
1480 if (Main.stackSplit == 0)
1481 {
1482 Main.stackSplit = 30;
1483 }
1484 else
1485 {
1486 Main.stackSplit = Main.stackDelay;
1487 }
1488 }
1489
1490 private static void TryOpenContainer(Item item, Player player)
1491 {
1492 if (ItemID.Sets.BossBag[item.type])
1493 {
1494 player.OpenBossBag(item.type);
1495 }
1496 else if (ItemID.Sets.IsFishingCrate[item.type])
1497 {
1498 player.OpenFishingCrate(item.type);
1499 }
1500 else if (item.type == 3093)
1501 {
1502 player.OpenHerbBag(3093);
1503 }
1504 else if (item.type == 4345)
1505 {
1506 player.OpenCanofWorms(item.type);
1507 }
1508 else if (item.type == 4410)
1509 {
1510 player.OpenOyster(item.type);
1511 }
1512 else if (item.type == 1774)
1513 {
1514 player.OpenGoodieBag(1774);
1515 }
1516 else if (item.type == 3085)
1517 {
1518 if (!player.ConsumeItem(327, reverseOrder: false, includeVoidBag: true))
1519 {
1520 return;
1521 }
1522 player.OpenLockBox(3085);
1523 }
1524 else if (item.type == 4879)
1525 {
1526 if (!player.HasItemInInventoryOrOpenVoidBag(329))
1527 {
1528 return;
1529 }
1530 player.OpenShadowLockbox(4879);
1531 }
1532 else if (item.type == 1869)
1533 {
1534 player.OpenPresent(1869);
1535 }
1536 else
1537 {
1538 if (item.type != 599 && item.type != 600 && item.type != 601)
1539 {
1540 return;
1541 }
1542 player.OpenLegacyPresent(item.type);
1543 }
1544 item.stack--;
1545 if (item.stack == 0)
1546 {
1547 item.SetDefaults();
1548 }
1550 Main.stackSplit = 30;
1551 Main.mouseRightRelease = false;
1553 }
1554
1555 private static void SwapVanityEquip(Item[] inv, int context, int slot, Player player)
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]);
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 }
1602
1603 private static void TryPickupDyeToCursor(int context, Item[] inv, int slot, Player player)
1604 {
1605 bool flag = false;
1606 if (!flag && ((Main.mouseItem.stack < Main.mouseItem.maxStack && Main.mouseItem.type > 0) || Main.mouseItem.IsAir) && inv[slot].type > 0 && (Main.mouseItem.type == inv[slot].type || Main.mouseItem.IsAir))
1607 {
1608 flag = true;
1609 if (Main.mouseItem.IsAir)
1610 {
1611 Main.mouseItem = inv[slot].Clone();
1612 }
1613 else
1614 {
1615 Main.mouseItem.stack++;
1616 }
1617 inv[slot].SetDefaults();
1619 }
1620 if (flag)
1621 {
1622 if (context == 25 && Main.netMode == 1)
1623 {
1624 NetMessage.SendData(121, -1, -1, null, Main.myPlayer, player.tileEntityAnchor.interactEntityID, slot, 1f);
1625 }
1626 if (context == 27 && Main.netMode == 1)
1627 {
1628 NetMessage.SendData(124, -1, -1, null, Main.myPlayer, player.tileEntityAnchor.interactEntityID, slot, 1f);
1629 }
1630 }
1631 }
1632
1633 private static void TryItemSwap(Item item)
1634 {
1635 int type = item.type;
1636 switch (type)
1637 {
1638 case 4131:
1639 case 5325:
1640 item.ChangeItemType((item.type == 5325) ? 4131 : 5325);
1641 AfterItemSwap(type, item.type);
1642 break;
1643 case 5059:
1644 case 5060:
1645 item.ChangeItemType((item.type == 5059) ? 5060 : 5059);
1646 AfterItemSwap(type, item.type);
1647 break;
1648 case 5324:
1649 item.ChangeItemType(5329);
1650 AfterItemSwap(type, item.type);
1651 break;
1652 case 5329:
1653 item.ChangeItemType(5330);
1654 AfterItemSwap(type, item.type);
1655 break;
1656 case 5330:
1657 item.ChangeItemType(5324);
1658 AfterItemSwap(type, item.type);
1659 break;
1660 case 4346:
1661 case 5391:
1662 item.ChangeItemType((item.type == 4346) ? 5391 : 4346);
1663 AfterItemSwap(type, item.type);
1664 break;
1665 case 5323:
1666 case 5455:
1667 item.ChangeItemType((item.type == 5323) ? 5455 : 5323);
1668 AfterItemSwap(type, item.type);
1669 break;
1670 case 4767:
1671 case 5453:
1672 item.ChangeItemType((item.type == 4767) ? 5453 : 4767);
1673 AfterItemSwap(type, item.type);
1674 break;
1675 case 5309:
1676 case 5454:
1677 item.ChangeItemType((item.type == 5309) ? 5454 : 5309);
1678 AfterItemSwap(type, item.type);
1679 break;
1680 case 5358:
1681 item.ChangeItemType(5360);
1682 AfterItemSwap(type, item.type);
1683 break;
1684 case 5360:
1685 item.ChangeItemType(5361);
1686 AfterItemSwap(type, item.type);
1687 break;
1688 case 5361:
1689 item.ChangeItemType(5359);
1690 AfterItemSwap(type, item.type);
1691 break;
1692 case 5359:
1693 item.ChangeItemType(5358);
1694 AfterItemSwap(type, item.type);
1695 break;
1696 case 5437:
1697 item.ChangeItemType(5358);
1698 AfterItemSwap(type, item.type);
1699 break;
1700 }
1701 }
1702
1703 private static void AfterItemSwap(int oldType, int newType)
1704 {
1705 if (newType == 5324 || newType == 5329 || newType == 5330 || newType == 4346 || newType == 5391 || newType == 5358 || newType == 5361 || newType == 5360 || newType == 5359)
1706 {
1708 }
1709 else
1710 {
1712 }
1713 Main.stackSplit = 30;
1714 Main.mouseRightRelease = false;
1716 }
1717
1718 private static void HandleShopSlot(Item[] inv, int slot, bool rightClickIsValid, bool leftClickIsValid)
1719 {
1720 if (Main.cursorOverride == 2)
1721 {
1722 return;
1723 }
1724 _ = Main.instance.shop[Main.npcShop];
1725 bool flag = (Main.mouseRight && rightClickIsValid) || (Main.mouseLeft && leftClickIsValid);
1726 if (!(Main.stackSplit <= 1 && flag) || inv[slot].type <= 0 || (!Main.mouseItem.IsTheSameAs(inv[slot]) && Main.mouseItem.type != 0))
1727 {
1728 return;
1729 }
1730 int num = Main.superFastStack + 1;
1731 Player localPlayer = Main.LocalPlayer;
1732 for (int i = 0; i < num; i++)
1733 {
1734 if (Main.mouseItem.stack >= Main.mouseItem.maxStack && Main.mouseItem.type != 0)
1735 {
1736 continue;
1737 }
1738 localPlayer.GetItemExpectedPrice(inv[slot], out var _, out var calcForBuying);
1739 if (!localPlayer.BuyItem(calcForBuying, inv[slot].shopSpecialCurrency) || inv[slot].stack <= 0)
1740 {
1741 continue;
1742 }
1743 if (i == 0)
1744 {
1745 if (inv[slot].value > 0)
1746 {
1748 }
1749 else
1750 {
1752 }
1753 }
1754 if (Main.mouseItem.type == 0)
1755 {
1756 Main.mouseItem.netDefaults(inv[slot].netID);
1757 if (inv[slot].prefix != 0)
1758 {
1759 Main.mouseItem.Prefix(inv[slot].prefix);
1760 }
1761 Main.mouseItem.stack = 0;
1762 }
1763 if (!inv[slot].buyOnce)
1764 {
1765 Main.shopSellbackHelper.Add(inv[slot]);
1766 }
1767 Main.mouseItem.stack++;
1769 if (inv[slot].buyOnce && --inv[slot].stack <= 0)
1770 {
1771 inv[slot].SetDefaults();
1772 }
1774 }
1775 }
1776
1777 public static void Draw(SpriteBatch spriteBatch, ref Item inv, int context, Vector2 position, Color lightColor = default(Color))
1778 {
1779 singleSlotArray[0] = inv;
1780 Draw(spriteBatch, singleSlotArray, context, 0, position, lightColor);
1781 inv = singleSlotArray[0];
1782 }
1783
1784 public static void Draw(SpriteBatch spriteBatch, Item[] inv, int context, int slot, Vector2 position, Color lightColor = default(Color))
1785 {
1786 Player player = Main.player[Main.myPlayer];
1787 Item item = inv[slot];
1788 float inventoryScale = Main.inventoryScale;
1789 Color color = Color.White;
1790 if (lightColor != Color.Transparent)
1791 {
1792 color = lightColor;
1793 }
1794 bool flag = false;
1795 int num = 0;
1796 int gamepadPointForSlot = GetGamepadPointForSlot(inv, context, slot);
1798 {
1799 flag = UILinkPointNavigator.CurrentPoint == gamepadPointForSlot;
1801 {
1802 flag = false;
1803 }
1804 if (context == 0)
1805 {
1806 num = player.DpadRadial.GetDrawMode(slot);
1807 if (num > 0 && !PlayerInput.CurrentProfile.UsingDpadHotbar())
1808 {
1809 num = 0;
1810 }
1811 }
1812 }
1814 Color color2 = Main.inventoryBack;
1815 bool flag2 = false;
1816 bool highlightThingsForMouse = PlayerInput.SettingsForUI.HighlightThingsForMouse;
1817 if (item.type > 0 && item.stack > 0 && item.favorited && context != 13 && context != 21 && context != 22 && context != 14)
1818 {
1820 if (context == 32)
1821 {
1823 }
1824 }
1825 else if (item.type > 0 && item.stack > 0 && Options.HighlightNewItems && item.newAndShiny && context != 13 && context != 21 && context != 14 && context != 22)
1826 {
1828 float num2 = (float)(int)Main.mouseTextColor / 255f;
1829 num2 = num2 * 0.2f + 0.8f;
1830 color2 = color2.MultiplyRGBA(new Color(num2, num2, num2));
1831 }
1832 else if (!highlightThingsForMouse && item.type > 0 && item.stack > 0 && num != 0 && context != 13 && context != 21 && context != 22)
1833 {
1835 float num3 = (float)(int)Main.mouseTextColor / 255f;
1836 num3 = num3 * 0.2f + 0.8f;
1837 color2 = ((num != 1) ? color2.MultiplyRGBA(new Color(num3 / 2f, num3, num3 / 2f)) : color2.MultiplyRGBA(new Color(num3, num3 / 2f, num3 / 2f)));
1838 }
1839 else if (context == 0 && slot < 10)
1840 {
1842 }
1843 else
1844 {
1845 switch (context)
1846 {
1847 case 28:
1849 color2 = Color.White;
1850 break;
1851 case 16:
1852 case 17:
1853 case 18:
1854 case 19:
1855 case 20:
1857 break;
1858 case 8:
1859 case 10:
1861 color2 = GetColorByLoadout(slot, context);
1862 break;
1863 case 23:
1864 case 24:
1865 case 26:
1867 break;
1868 case 9:
1869 case 11:
1871 color2 = GetColorByLoadout(slot, context);
1872 break;
1873 case 25:
1874 case 27:
1875 case 33:
1877 break;
1878 case 12:
1880 color2 = GetColorByLoadout(slot, context);
1881 break;
1882 case 3:
1884 break;
1885 case 4:
1886 case 32:
1888 break;
1889 case 5:
1890 case 7:
1892 break;
1893 case 6:
1895 break;
1896 case 13:
1897 {
1898 byte b = 200;
1899 if (slot == Main.player[Main.myPlayer].selectedItem)
1900 {
1902 b = byte.MaxValue;
1903 }
1904 color2 = new Color(b, b, b, b);
1905 break;
1906 }
1907 case 14:
1908 case 21:
1909 flag2 = true;
1910 break;
1911 case 15:
1913 break;
1914 case 29:
1915 color2 = new Color(53, 69, 127, 255);
1917 break;
1918 case 30:
1919 flag2 = !flag;
1920 break;
1921 case 22:
1924 {
1927 float num4 = (float)(int)color2.A / 255f;
1928 num4 = ((!(num4 < 0.7f)) ? 1f : Utils.GetLerpValue(0f, 0.7f, num4, clamped: true));
1929 color2 = Color.White * num4;
1930 }
1931 break;
1932 }
1933 }
1934 if ((context == 0 || context == 2) && inventoryGlowTime[slot] > 0 && !inv[slot].favorited && !inv[slot].IsAir)
1935 {
1936 float num5 = Main.invAlpha / 255f;
1937 Color value2 = new Color(63, 65, 151, 255) * num5;
1938 Color value3 = Main.hslToRgb(inventoryGlowHue[slot], 1f, 0.5f) * num5;
1939 float num6 = (float)inventoryGlowTime[slot] / 300f;
1940 num6 *= num6;
1941 color2 = Color.Lerp(value2, value3, num6 / 2f);
1943 }
1944 if ((context == 4 || context == 32 || context == 3) && inventoryGlowTimeChest[slot] > 0 && !inv[slot].favorited && !inv[slot].IsAir)
1945 {
1946 float num7 = Main.invAlpha / 255f;
1947 Color value4 = new Color(130, 62, 102, 255) * num7;
1948 if (context == 3)
1949 {
1950 value4 = new Color(104, 52, 52, 255) * num7;
1951 }
1952 Color value5 = Main.hslToRgb(inventoryGlowHueChest[slot], 1f, 0.5f) * num7;
1953 float num8 = (float)inventoryGlowTimeChest[slot] / 300f;
1954 num8 *= num8;
1955 color2 = Color.Lerp(value4, value5, num8 / 2f);
1957 }
1958 if (flag)
1959 {
1961 color2 = Color.White;
1962 if (item.favorited)
1963 {
1965 }
1966 }
1967 if (context == 28 && Main.MouseScreen.Between(position, position + value.Size() * inventoryScale) && !player.mouseInterface)
1968 {
1970 color2 = Color.White;
1971 }
1972 if (!flag2)
1973 {
1974 spriteBatch.Draw(value, position, null, color2, 0f, default(Vector2), inventoryScale, SpriteEffects.None, 0f);
1975 }
1976 int num9 = -1;
1977 switch (context)
1978 {
1979 case 8:
1980 case 23:
1981 if (slot == 0)
1982 {
1983 num9 = 0;
1984 }
1985 if (slot == 1)
1986 {
1987 num9 = 6;
1988 }
1989 if (slot == 2)
1990 {
1991 num9 = 12;
1992 }
1993 break;
1994 case 26:
1995 num9 = 0;
1996 break;
1997 case 9:
1998 if (slot == 10)
1999 {
2000 num9 = 3;
2001 }
2002 if (slot == 11)
2003 {
2004 num9 = 9;
2005 }
2006 if (slot == 12)
2007 {
2008 num9 = 15;
2009 }
2010 break;
2011 case 10:
2012 case 24:
2013 num9 = 11;
2014 break;
2015 case 11:
2016 num9 = 2;
2017 break;
2018 case 12:
2019 case 25:
2020 case 27:
2021 case 33:
2022 num9 = 1;
2023 break;
2024 case 16:
2025 num9 = 4;
2026 break;
2027 case 17:
2028 num9 = 13;
2029 break;
2030 case 19:
2031 num9 = 10;
2032 break;
2033 case 18:
2034 num9 = 7;
2035 break;
2036 case 20:
2037 num9 = 17;
2038 break;
2039 }
2040 if ((item.type <= 0 || item.stack <= 0) && num9 != -1)
2041 {
2042 Texture2D value6 = TextureAssets.Extra[54].Value;
2043 Rectangle rectangle = value6.Frame(3, 6, num9 % 3, num9 / 3);
2044 rectangle.Width -= 2;
2045 rectangle.Height -= 2;
2046 spriteBatch.Draw(value6, position + value.Size() / 2f * inventoryScale, rectangle, Color.White * 0.35f, 0f, rectangle.Size() / 2f, inventoryScale, SpriteEffects.None, 0f);
2047 }
2048 Vector2 vector = value.Size() * inventoryScale;
2049 if (item.type > 0 && item.stack > 0)
2050 {
2051 float scale = DrawItemIcon(item, context, spriteBatch, position + vector / 2f, inventoryScale, 32f, color);
2052 if (ItemID.Sets.TrapSigned[item.type])
2053 {
2054 spriteBatch.Draw(TextureAssets.Wire.Value, position + new Vector2(40f, 40f) * inventoryScale, new Rectangle(4, 58, 8, 8), color, 0f, new Vector2(4f), 1f, SpriteEffects.None, 0f);
2055 }
2057 {
2058 Vector2 vector2 = new Vector2(-4f, -4f) * inventoryScale;
2059 Texture2D value7 = TextureAssets.Extra[258].Value;
2060 Rectangle rectangle2 = value7.Frame();
2061 spriteBatch.Draw(value7, position + vector2 + new Vector2(40f, 40f) * inventoryScale, rectangle2, color, 0f, rectangle2.Size() / 2f, 1f, SpriteEffects.None, 0f);
2062 }
2063 if (item.type == 5324 || item.type == 5329 || item.type == 5330)
2064 {
2065 Vector2 vector3 = new Vector2(2f, -6f) * inventoryScale;
2066 switch (item.type)
2067 {
2068 case 5324:
2069 {
2070 Texture2D value10 = TextureAssets.Extra[257].Value;
2071 Rectangle rectangle5 = value10.Frame(3, 1, 2);
2072 spriteBatch.Draw(value10, position + vector3 + new Vector2(40f, 40f) * inventoryScale, rectangle5, color, 0f, rectangle5.Size() / 2f, 1f, SpriteEffects.None, 0f);
2073 break;
2074 }
2075 case 5329:
2076 {
2077 Texture2D value9 = TextureAssets.Extra[257].Value;
2078 Rectangle rectangle4 = value9.Frame(3, 1, 1);
2079 spriteBatch.Draw(value9, position + vector3 + new Vector2(40f, 40f) * inventoryScale, rectangle4, color, 0f, rectangle4.Size() / 2f, 1f, SpriteEffects.None, 0f);
2080 break;
2081 }
2082 case 5330:
2083 {
2084 Texture2D value8 = TextureAssets.Extra[257].Value;
2085 Rectangle rectangle3 = value8.Frame(3);
2086 spriteBatch.Draw(value8, position + vector3 + new Vector2(40f, 40f) * inventoryScale, rectangle3, color, 0f, rectangle3.Size() / 2f, 1f, SpriteEffects.None, 0f);
2087 break;
2088 }
2089 }
2090 }
2091 if (item.stack > 1)
2092 {
2093 ChatManager.DrawColorCodedStringWithShadow(spriteBatch, FontAssets.ItemStack.Value, item.stack.ToString(), position + new Vector2(10f, 26f) * inventoryScale, color, 0f, Vector2.Zero, new Vector2(inventoryScale), -1f, inventoryScale);
2094 }
2095 int num10 = -1;
2096 if (context == 13)
2097 {
2098 if (item.DD2Summon)
2099 {
2100 for (int i = 0; i < 58; i++)
2101 {
2102 if (inv[i].type == 3822)
2103 {
2104 num10 += inv[i].stack;
2105 }
2106 }
2107 if (num10 >= 0)
2108 {
2109 num10++;
2110 }
2111 }
2112 if (item.useAmmo > 0)
2113 {
2114 int useAmmo = item.useAmmo;
2115 num10 = 0;
2116 for (int j = 0; j < 58; j++)
2117 {
2118 if (inv[j].ammo == useAmmo)
2119 {
2120 num10 += inv[j].stack;
2121 }
2122 }
2123 }
2124 if (item.fishingPole > 0)
2125 {
2126 num10 = 0;
2127 for (int k = 0; k < 58; k++)
2128 {
2129 if (inv[k].bait > 0)
2130 {
2131 num10 += inv[k].stack;
2132 }
2133 }
2134 }
2135 if (item.tileWand > 0)
2136 {
2137 int tileWand = item.tileWand;
2138 num10 = 0;
2139 for (int l = 0; l < 58; l++)
2140 {
2141 if (inv[l].type == tileWand)
2142 {
2143 num10 += inv[l].stack;
2144 }
2145 }
2146 }
2147 if (item.type == 509 || item.type == 851 || item.type == 850 || item.type == 3612 || item.type == 3625 || item.type == 3611)
2148 {
2149 num10 = 0;
2150 for (int m = 0; m < 58; m++)
2151 {
2152 if (inv[m].type == 530)
2153 {
2154 num10 += inv[m].stack;
2155 }
2156 }
2157 }
2158 }
2159 if (num10 != -1)
2160 {
2161 ChatManager.DrawColorCodedStringWithShadow(spriteBatch, FontAssets.ItemStack.Value, num10.ToString(), position + new Vector2(8f, 30f) * inventoryScale, color, 0f, Vector2.Zero, new Vector2(inventoryScale * 0.8f), -1f, inventoryScale);
2162 }
2163 if (context == 13)
2164 {
2165 string text = string.Concat(slot + 1);
2166 if (text == "10")
2167 {
2168 text = "0";
2169 }
2170 ChatManager.DrawColorCodedStringWithShadow(spriteBatch, FontAssets.ItemStack.Value, text, position + new Vector2(8f, 4f) * inventoryScale, color, 0f, Vector2.Zero, new Vector2(inventoryScale), -1f, inventoryScale);
2171 }
2172 if (context == 13 && item.potion)
2173 {
2174 Vector2 position2 = position + value.Size() * inventoryScale / 2f - TextureAssets.Cd.Value.Size() * inventoryScale / 2f;
2175 Color color3 = item.GetAlpha(color) * ((float)player.potionDelay / (float)player.potionDelayTime);
2176 spriteBatch.Draw(TextureAssets.Cd.Value, position2, null, color3, 0f, default(Vector2), scale, SpriteEffects.None, 0f);
2177 }
2178 if ((context == 10 || context == 18) && item.expertOnly && !Main.expertMode)
2179 {
2180 Vector2 position3 = position + value.Size() * inventoryScale / 2f - TextureAssets.Cd.Value.Size() * inventoryScale / 2f;
2181 Color white = Color.White;
2182 spriteBatch.Draw(TextureAssets.Cd.Value, position3, null, white, 0f, default(Vector2), scale, SpriteEffects.None, 0f);
2183 }
2184 }
2185 else if (context == 6)
2186 {
2187 Texture2D value11 = TextureAssets.Trash.Value;
2188 Vector2 position4 = position + value.Size() * inventoryScale / 2f - value11.Size() * inventoryScale / 2f;
2189 spriteBatch.Draw(value11, position4, null, new Color(100, 100, 100, 100), 0f, default(Vector2), inventoryScale, SpriteEffects.None, 0f);
2190 }
2191 if (context == 0 && slot < 10)
2192 {
2193 float num11 = inventoryScale;
2194 string text2 = string.Concat(slot + 1);
2195 if (text2 == "10")
2196 {
2197 text2 = "0";
2198 }
2199 Color baseColor = Main.inventoryBack;
2200 int num12 = 0;
2201 if (Main.player[Main.myPlayer].selectedItem == slot)
2202 {
2203 baseColor = Color.White;
2204 baseColor.A = 200;
2205 num12 -= 2;
2206 num11 *= 1.4f;
2207 }
2208 ChatManager.DrawColorCodedStringWithShadow(spriteBatch, FontAssets.ItemStack.Value, text2, position + new Vector2(6f, 4 + num12) * inventoryScale, baseColor, 0f, Vector2.Zero, new Vector2(inventoryScale), -1f, inventoryScale);
2209 }
2210 if (gamepadPointForSlot != -1)
2211 {
2212 UILinkPointNavigator.SetPosition(gamepadPointForSlot, position + vector * 0.75f);
2213 }
2214 }
2215
2216 public static Color GetColorByLoadout(int slot, int context)
2217 {
2218 Color color = Color.White;
2219 if (TryGetSlotColor(Main.LocalPlayer.CurrentLoadoutIndex, context, out var color2))
2220 {
2221 color = color2;
2222 }
2223 Color value = new Color(color.ToVector4() * Main.inventoryBack.ToVector4());
2224 float num = Utils.Remap((float)(Main.timeForVisualEffects - _lastTimeForVisualEffectsThatLoadoutWasChanged), 0f, 30f, 0.5f, 0f);
2225 return Color.Lerp(value, Color.White, num * num * num);
2226 }
2227
2232
2233 public static bool TryGetSlotColor(int loadoutIndex, int context, out Color color)
2234 {
2235 color = default(Color);
2236 if (loadoutIndex < 0 || loadoutIndex >= 3)
2237 {
2238 return false;
2239 }
2240 int num = -1;
2241 switch (context)
2242 {
2243 case 8:
2244 case 10:
2245 num = 0;
2246 break;
2247 case 9:
2248 case 11:
2249 num = 1;
2250 break;
2251 case 12:
2252 num = 2;
2253 break;
2254 }
2255 if (num == -1)
2256 {
2257 return false;
2258 }
2259 color = LoadoutSlotColors[loadoutIndex, num];
2260 return true;
2261 }
2262
2263 public static float ShiftHueByLoadout(float hue, int loadoutIndex)
2264 {
2265 return (hue + (float)loadoutIndex / 8f) % 1f;
2266 }
2267
2268 public static Color GetLoadoutColor(int loadoutIndex)
2269 {
2270 return Main.hslToRgb(ShiftHueByLoadout(0.41f, loadoutIndex), 0.7f, 0.5f);
2271 }
2272
2273 public static float DrawItemIcon(Item item, int context, SpriteBatch spriteBatch, Vector2 screenPositionForItemCenter, float scale, float sizeLimit, Color environmentColor)
2274 {
2275 int num = item.type;
2276 if ((uint)(num - 5358) <= 3u && context == 31)
2277 {
2278 num = 5437;
2279 }
2280 Main.instance.LoadItem(num);
2281 Texture2D value = TextureAssets.Item[num].Value;
2282 Rectangle frame = ((Main.itemAnimations[num] == null) ? value.Frame() : Main.itemAnimations[num].GetFrame(value));
2283 DrawItem_GetColorAndScale(item, scale, ref environmentColor, sizeLimit, ref frame, out var itemLight, out var finalDrawScale);
2284 SpriteEffects effects = SpriteEffects.None;
2285 Vector2 origin = frame.Size() / 2f;
2286 spriteBatch.Draw(value, screenPositionForItemCenter, frame, item.GetAlpha(itemLight), 0f, origin, finalDrawScale, effects, 0f);
2287 if (item.color != Color.Transparent)
2288 {
2289 Color newColor = environmentColor;
2290 if (context == 13)
2291 {
2292 newColor.A = byte.MaxValue;
2293 }
2294 spriteBatch.Draw(value, screenPositionForItemCenter, frame, item.GetColor(newColor), 0f, origin, finalDrawScale, effects, 0f);
2295 }
2296 switch (num)
2297 {
2298 case 5140:
2299 case 5141:
2300 case 5142:
2301 case 5143:
2302 case 5144:
2303 case 5145:
2304 {
2305 Texture2D value3 = TextureAssets.GlowMask[item.glowMask].Value;
2306 Color white = Color.White;
2307 spriteBatch.Draw(value3, screenPositionForItemCenter, frame, white, 0f, origin, finalDrawScale, effects, 0f);
2308 break;
2309 }
2310 case 5146:
2311 {
2312 Texture2D value2 = TextureAssets.GlowMask[324].Value;
2313 spriteBatch.Draw(color: new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB), texture: value2, position: screenPositionForItemCenter, sourceRectangle: frame, rotation: 0f, origin: origin, scale: finalDrawScale, effects: effects, layerDepth: 0f);
2314 break;
2315 }
2316 }
2317 return finalDrawScale;
2318 }
2319
2320 public static void DrawItem_GetColorAndScale(Item item, float scale, ref Color currentWhite, float sizeLimit, ref Rectangle frame, out Color itemLight, out float finalDrawScale)
2321 {
2322 itemLight = currentWhite;
2323 float scale2 = 1f;
2324 GetItemLight(ref itemLight, ref scale2, item);
2325 float num = 1f;
2326 if ((float)frame.Width > sizeLimit || (float)frame.Height > sizeLimit)
2327 {
2328 num = ((frame.Width <= frame.Height) ? (sizeLimit / (float)frame.Height) : (sizeLimit / (float)frame.Width));
2329 }
2330 finalDrawScale = scale * num * scale2;
2331 }
2332
2333 private static int GetGamepadPointForSlot(Item[] inv, int context, int slot)
2334 {
2335 Player localPlayer = Main.LocalPlayer;
2336 int result = -1;
2337 switch (context)
2338 {
2339 case 0:
2340 case 1:
2341 case 2:
2342 result = slot;
2343 break;
2344 case 8:
2345 case 9:
2346 case 10:
2347 case 11:
2348 {
2349 int num2 = slot;
2350 if (num2 % 10 == 9 && !localPlayer.CanDemonHeartAccessoryBeShown())
2351 {
2352 num2--;
2353 }
2354 result = 100 + num2;
2355 break;
2356 }
2357 case 12:
2358 if (inv == localPlayer.dye)
2359 {
2360 int num = slot;
2361 if (num % 10 == 9 && !localPlayer.CanDemonHeartAccessoryBeShown())
2362 {
2363 num--;
2364 }
2365 result = 120 + num;
2366 }
2367 break;
2368 case 33:
2369 if (inv == localPlayer.miscDyes)
2370 {
2371 result = 185 + slot;
2372 }
2373 break;
2374 case 19:
2375 result = 180;
2376 break;
2377 case 20:
2378 result = 181;
2379 break;
2380 case 18:
2381 result = 182;
2382 break;
2383 case 17:
2384 result = 183;
2385 break;
2386 case 16:
2387 result = 184;
2388 break;
2389 case 3:
2390 case 4:
2391 case 32:
2392 result = 400 + slot;
2393 break;
2394 case 15:
2395 result = 2700 + slot;
2396 break;
2397 case 6:
2398 result = 300;
2399 break;
2400 case 22:
2402 {
2404 }
2406 {
2407 result = 1500 + UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeSmall + 1;
2408 }
2409 break;
2410 case 7:
2411 result = 1500;
2412 break;
2413 case 5:
2414 result = 303;
2415 break;
2416 case 23:
2417 result = 5100 + slot;
2418 break;
2419 case 24:
2420 result = 5100 + slot;
2421 break;
2422 case 25:
2423 result = 5108 + slot;
2424 break;
2425 case 26:
2426 result = 5000 + slot;
2427 break;
2428 case 27:
2429 result = 5002 + slot;
2430 break;
2431 case 29:
2432 result = 3000 + slot;
2434 {
2436 }
2437 break;
2438 case 30:
2439 result = 15000 + slot;
2440 break;
2441 }
2442 return result;
2443 }
2444
2445 public static void MouseHover(int context = 0)
2446 {
2448 MouseHover(singleSlotArray, context);
2449 }
2450
2451 public static void MouseHover(ref Item inv, int context = 0)
2452 {
2453 singleSlotArray[0] = inv;
2454 MouseHover(singleSlotArray, context);
2455 inv = singleSlotArray[0];
2456 }
2457
2458 public static void MouseHover(Item[] inv, int context = 0, int slot = 0)
2459 {
2460 if (context == 6 && Main.hoverItemName == null)
2461 {
2462 Main.hoverItemName = Lang.inter[3].Value;
2463 }
2464 if (inv[slot].type > 0 && inv[slot].stack > 0)
2465 {
2467 Main.hoverItemName = inv[slot].Name;
2468 if (inv[slot].stack > 1)
2469 {
2470 Main.hoverItemName = Main.hoverItemName + " (" + inv[slot].stack + ")";
2471 }
2472 Main.HoverItem = inv[slot].Clone();
2473 Main.HoverItem.tooltipContext = context;
2474 if (context == 8 && slot <= 2)
2475 {
2476 Main.HoverItem.wornArmor = true;
2477 return;
2478 }
2479 switch (context)
2480 {
2481 case 9:
2482 case 11:
2483 Main.HoverItem.social = true;
2484 break;
2485 case 15:
2486 Main.HoverItem.buy = true;
2487 break;
2488 }
2489 return;
2490 }
2491 if (context == 10 || context == 11 || context == 24)
2492 {
2493 Main.hoverItemName = Lang.inter[9].Value;
2494 }
2495 if (context == 11)
2496 {
2497 Main.hoverItemName = Lang.inter[11].Value + " " + Main.hoverItemName;
2498 }
2499 if (context == 8 || context == 9 || context == 23 || context == 26)
2500 {
2501 if (slot == 0 || slot == 10 || context == 26)
2502 {
2503 Main.hoverItemName = Lang.inter[12].Value;
2504 }
2505 else if (slot == 1 || slot == 11)
2506 {
2507 Main.hoverItemName = Lang.inter[13].Value;
2508 }
2509 else if (slot == 2 || slot == 12)
2510 {
2511 Main.hoverItemName = Lang.inter[14].Value;
2512 }
2513 else if (slot >= 10)
2514 {
2515 Main.hoverItemName = Lang.inter[11].Value + " " + Main.hoverItemName;
2516 }
2517 }
2518 if (context == 12 || context == 25 || context == 27 || context == 33)
2519 {
2520 Main.hoverItemName = Lang.inter[57].Value;
2521 }
2522 if (context == 16)
2523 {
2524 Main.hoverItemName = Lang.inter[90].Value;
2525 }
2526 if (context == 17)
2527 {
2528 Main.hoverItemName = Lang.inter[91].Value;
2529 }
2530 if (context == 19)
2531 {
2532 Main.hoverItemName = Lang.inter[92].Value;
2533 }
2534 if (context == 18)
2535 {
2536 Main.hoverItemName = Lang.inter[93].Value;
2537 }
2538 if (context == 20)
2539 {
2540 Main.hoverItemName = Lang.inter[94].Value;
2541 }
2542 }
2543
2544 public static void SwapEquip(ref Item inv, int context = 0)
2545 {
2546 singleSlotArray[0] = inv;
2547 SwapEquip(singleSlotArray, context, 0);
2548 inv = singleSlotArray[0];
2549 }
2550
2551 public static void SwapEquip(Item[] inv, int context, int slot)
2552 {
2553 Player player = Main.player[Main.myPlayer];
2554 if (isEquipLocked(inv[slot].type) || inv[slot].IsAir)
2555 {
2556 return;
2557 }
2558 bool success;
2559 if (inv[slot].dye > 0)
2560 {
2561 inv[slot] = DyeSwap(inv[slot], out success);
2562 if (success)
2563 {
2564 Main.EquipPageSelected = 0;
2565 AchievementsHelper.HandleOnEquip(player, inv[slot], 12);
2566 }
2567 }
2568 else if (Main.projHook[inv[slot].shoot])
2569 {
2570 inv[slot] = EquipSwap(inv[slot], player.miscEquips, 4, out success);
2571 if (success)
2572 {
2573 Main.EquipPageSelected = 2;
2574 AchievementsHelper.HandleOnEquip(player, inv[slot], 16);
2575 }
2576 }
2577 else if (inv[slot].mountType != -1 && !MountID.Sets.Cart[inv[slot].mountType])
2578 {
2579 inv[slot] = EquipSwap(inv[slot], player.miscEquips, 3, out success);
2580 if (success)
2581 {
2582 Main.EquipPageSelected = 2;
2583 AchievementsHelper.HandleOnEquip(player, inv[slot], 17);
2584 }
2585 }
2586 else if (inv[slot].mountType != -1 && MountID.Sets.Cart[inv[slot].mountType])
2587 {
2588 inv[slot] = EquipSwap(inv[slot], player.miscEquips, 2, out success);
2589 if (success)
2590 {
2591 Main.EquipPageSelected = 2;
2592 }
2593 }
2594 else if (inv[slot].buffType > 0 && Main.lightPet[inv[slot].buffType])
2595 {
2596 inv[slot] = EquipSwap(inv[slot], player.miscEquips, 1, out success);
2597 if (success)
2598 {
2599 Main.EquipPageSelected = 2;
2600 }
2601 }
2602 else if (inv[slot].buffType > 0 && Main.vanityPet[inv[slot].buffType])
2603 {
2604 inv[slot] = EquipSwap(inv[slot], player.miscEquips, 0, out success);
2605 if (success)
2606 {
2607 Main.EquipPageSelected = 2;
2608 }
2609 }
2610 else
2611 {
2612 Item item = inv[slot];
2613 inv[slot] = ArmorSwap(inv[slot], out success);
2614 if (success)
2615 {
2616 Main.EquipPageSelected = 0;
2617 AchievementsHelper.HandleOnEquip(player, item, item.accessory ? 10 : 8);
2618 }
2619 }
2621 if (context == 3 && Main.netMode == 1)
2622 {
2623 NetMessage.SendData(32, -1, -1, null, player.chest, slot);
2624 }
2625 }
2626
2627 public static bool Equippable(ref Item inv, int context = 0)
2628 {
2629 singleSlotArray[0] = inv;
2630 bool result = Equippable(singleSlotArray, context, 0);
2631 inv = singleSlotArray[0];
2632 return result;
2633 }
2634
2635 public static bool Equippable(Item[] inv, int context, int slot)
2636 {
2637 _ = Main.player[Main.myPlayer];
2638 if (inv[slot].dye > 0 || Main.projHook[inv[slot].shoot] || inv[slot].mountType != -1 || (inv[slot].buffType > 0 && Main.lightPet[inv[slot].buffType]) || (inv[slot].buffType > 0 && Main.vanityPet[inv[slot].buffType]) || inv[slot].headSlot >= 0 || inv[slot].bodySlot >= 0 || inv[slot].legSlot >= 0 || inv[slot].accessory)
2639 {
2640 return true;
2641 }
2642 return false;
2643 }
2644
2645 public static bool IsMiscEquipment(Item item)
2646 {
2647 if (item.mountType == -1 && (item.buffType <= 0 || !Main.lightPet[item.buffType]) && (item.buffType <= 0 || !Main.vanityPet[item.buffType]))
2648 {
2649 return Main.projHook[item.shoot];
2650 }
2651 return true;
2652 }
2653
2654 public static bool AccCheck(Item[] itemCollection, Item item, int slot)
2655 {
2656 if (isEquipLocked(item.type))
2657 {
2658 return true;
2659 }
2660 if (slot != -1)
2661 {
2662 if (itemCollection[slot].IsTheSameAs(item))
2663 {
2664 return false;
2665 }
2666 if (itemCollection[slot].wingSlot > 0 && item.wingSlot > 0)
2667 {
2668 return false;
2669 }
2670 }
2671 for (int i = 0; i < itemCollection.Length; i++)
2672 {
2673 if (slot < 10 && i < 10)
2674 {
2675 if (item.wingSlot > 0 && itemCollection[i].wingSlot > 0)
2676 {
2677 return true;
2678 }
2679 if (slot >= 10 && i >= 10 && item.wingSlot > 0 && itemCollection[i].wingSlot > 0)
2680 {
2681 return true;
2682 }
2683 }
2684 if (item.IsTheSameAs(itemCollection[i]))
2685 {
2686 return true;
2687 }
2688 }
2689 return false;
2690 }
2691
2692 private static Item DyeSwap(Item item, out bool success)
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 }
2726 success = true;
2727 return item2;
2728 }
2729
2730 private static Item ArmorSwap(Item item, out bool success)
2731 {
2732 success = false;
2733 if (item.stack < 1)
2734 {
2735 return item;
2736 }
2737 if (item.headSlot == -1 && item.bodySlot == -1 && item.legSlot == -1 && !item.accessory)
2738 {
2739 return item;
2740 }
2741 Player player = Main.player[Main.myPlayer];
2742 int num = ((item.vanity && !item.accessory) ? 10 : 0);
2743 item.favorited = false;
2744 Item result = item;
2745 if (item.headSlot != -1)
2746 {
2747 result = player.armor[num].Clone();
2748 player.armor[num] = item.Clone();
2749 }
2750 else if (item.bodySlot != -1)
2751 {
2752 result = player.armor[num + 1].Clone();
2753 player.armor[num + 1] = item.Clone();
2754 }
2755 else if (item.legSlot != -1)
2756 {
2757 result = player.armor[num + 2].Clone();
2758 player.armor[num + 2] = item.Clone();
2759 }
2760 else if (item.accessory)
2761 {
2762 int num2 = 3;
2763 for (int i = 3; i < 10; i++)
2764 {
2765 if (player.IsItemSlotUnlockedAndUsable(i))
2766 {
2767 num2 = i;
2768 if (player.armor[i].type == 0)
2769 {
2770 accSlotToSwapTo = i - 3;
2771 break;
2772 }
2773 }
2774 }
2775 for (int j = 0; j < player.armor.Length; j++)
2776 {
2777 if (item.IsTheSameAs(player.armor[j]))
2778 {
2779 accSlotToSwapTo = j - 3;
2780 }
2781 if (j < 10 && item.wingSlot > 0 && player.armor[j].wingSlot > 0)
2782 {
2783 accSlotToSwapTo = j - 3;
2784 }
2785 }
2786 if (accSlotToSwapTo > num2)
2787 {
2788 return item;
2789 }
2790 if (accSlotToSwapTo < 0)
2791 {
2792 accSlotToSwapTo = num2 - 3;
2793 }
2794 int num3 = 3 + accSlotToSwapTo;
2795 if (isEquipLocked(player.armor[num3].type))
2796 {
2797 return item;
2798 }
2799 for (int k = 0; k < player.armor.Length; k++)
2800 {
2801 if (item.IsTheSameAs(player.armor[k]))
2802 {
2803 num3 = k;
2804 }
2805 }
2806 result = player.armor[num3].Clone();
2807 player.armor[num3] = item.Clone();
2808 accSlotToSwapTo = 0;
2809 }
2812 success = true;
2813 return result;
2814 }
2815
2816 private static Item EquipSwap(Item item, Item[] inv, int slot, out bool success)
2817 {
2818 success = false;
2819 _ = Main.player[Main.myPlayer];
2820 item.favorited = false;
2821 Item result = inv[slot].Clone();
2822 inv[slot] = item.Clone();
2825 success = true;
2826 return result;
2827 }
2828
2829 public static void DrawMoney(SpriteBatch sb, string text, float shopx, float shopy, int[] coinsArray, bool horizontal = false)
2830 {
2831 Utils.DrawBorderStringFourWay(sb, FontAssets.MouseText.Value, text, shopx, shopy + 40f, Color.White * ((float)(int)Main.mouseTextColor / 255f), Color.Black, Vector2.Zero);
2832 if (horizontal)
2833 {
2834 for (int i = 0; i < 4; i++)
2835 {
2836 Main.instance.LoadItem(74 - i);
2837 if (i == 0)
2838 {
2839 _ = coinsArray[3 - i];
2840 _ = 99;
2841 }
2842 Vector2 position = new Vector2(shopx + ChatManager.GetStringSize(FontAssets.MouseText.Value, text, Vector2.One).X + (float)(24 * i) + 45f, shopy + 50f);
2843 sb.Draw(TextureAssets.Item[74 - i].Value, position, null, Color.White, 0f, TextureAssets.Item[74 - i].Value.Size() / 2f, 1f, SpriteEffects.None, 0f);
2844 Utils.DrawBorderStringFourWay(sb, FontAssets.ItemStack.Value, coinsArray[3 - i].ToString(), position.X - 11f, position.Y, Color.White, Color.Black, new Vector2(0.3f), 0.75f);
2845 }
2846 }
2847 else
2848 {
2849 for (int j = 0; j < 4; j++)
2850 {
2851 Main.instance.LoadItem(74 - j);
2852 int num = ((j == 0 && coinsArray[3 - j] > 99) ? (-6) : 0);
2853 sb.Draw(TextureAssets.Item[74 - j].Value, new Vector2(shopx + 11f + (float)(24 * j), shopy + 75f), null, Color.White, 0f, TextureAssets.Item[74 - j].Value.Size() / 2f, 1f, SpriteEffects.None, 0f);
2854 Utils.DrawBorderStringFourWay(sb, FontAssets.ItemStack.Value, coinsArray[3 - j].ToString(), shopx + (float)(24 * j) + (float)num, shopy + 75f, Color.White, Color.Black, new Vector2(0.3f), 0.75f);
2855 }
2856 }
2857 }
2858
2859 public static void DrawSavings(SpriteBatch sb, float shopx, float shopy, bool horizontal = false)
2860 {
2861 Player player = Main.player[Main.myPlayer];
2862 if (_customCurrencyForSavings != -1)
2863 {
2864 CustomCurrencyManager.DrawSavings(sb, _customCurrencyForSavings, shopx, shopy, horizontal);
2865 return;
2866 }
2867 bool overFlowing;
2868 long num = Utils.CoinsCount(out overFlowing, player.bank.item);
2869 long num2 = Utils.CoinsCount(out overFlowing, player.bank2.item);
2870 long num3 = Utils.CoinsCount(out overFlowing, player.bank3.item);
2871 long num4 = Utils.CoinsCount(out overFlowing, player.bank4.item);
2872 long num5 = Utils.CoinsCombineStacks(out overFlowing, num, num2, num3, num4);
2873 if (num5 > 0)
2874 {
2875 Main.GetItemDrawFrame(4076, out var itemTexture, out var itemFrame);
2876 Main.GetItemDrawFrame(3813, out var itemTexture2, out var itemFrame2);
2877 Main.GetItemDrawFrame(346, out var itemTexture3, out var _);
2878 Main.GetItemDrawFrame(87, out var itemTexture4, out var _);
2879 if (num4 > 0)
2880 {
2881 sb.Draw(itemTexture, Utils.CenteredRectangle(new Vector2(shopx + 92f, shopy + 45f), itemFrame.Size() * 0.65f), null, Color.White);
2882 }
2883 if (num3 > 0)
2884 {
2885 sb.Draw(itemTexture2, Utils.CenteredRectangle(new Vector2(shopx + 92f, shopy + 45f), itemFrame2.Size() * 0.65f), null, Color.White);
2886 }
2887 if (num2 > 0)
2888 {
2889 sb.Draw(itemTexture3, Utils.CenteredRectangle(new Vector2(shopx + 80f, shopy + 50f), itemTexture3.Size() * 0.65f), null, Color.White);
2890 }
2891 if (num > 0)
2892 {
2893 sb.Draw(itemTexture4, Utils.CenteredRectangle(new Vector2(shopx + 70f, shopy + 60f), itemTexture4.Size() * 0.65f), null, Color.White);
2894 }
2895 DrawMoney(sb, Lang.inter[66].Value, shopx, shopy, Utils.CoinsSplit(num5), horizontal);
2896 }
2897 }
2898
2899 public static void GetItemLight(ref Color currentColor, Item item, bool outInTheWorld = false)
2900 {
2901 float scale = 1f;
2902 GetItemLight(ref currentColor, ref scale, item, outInTheWorld);
2903 }
2904
2905 public static void GetItemLight(ref Color currentColor, int type, bool outInTheWorld = false)
2906 {
2907 float scale = 1f;
2908 GetItemLight(ref currentColor, ref scale, type, outInTheWorld);
2909 }
2910
2911 public static void GetItemLight(ref Color currentColor, ref float scale, Item item, bool outInTheWorld = false)
2912 {
2913 GetItemLight(ref currentColor, ref scale, item.type, outInTheWorld);
2914 }
2915
2916 public static Color GetItemLight(ref Color currentColor, ref float scale, int type, bool outInTheWorld = false)
2917 {
2918 if (type < 0 || type > ItemID.Count)
2919 {
2920 return currentColor;
2921 }
2922 if (type == 662 || type == 663 || type == 5444 || type == 5450)
2923 {
2924 currentColor.R = (byte)Main.DiscoR;
2925 currentColor.G = (byte)Main.DiscoG;
2926 currentColor.B = (byte)Main.DiscoB;
2927 currentColor.A = byte.MaxValue;
2928 }
2929 if (type == 5128)
2930 {
2931 currentColor.R = (byte)Main.DiscoR;
2932 currentColor.G = (byte)Main.DiscoG;
2933 currentColor.B = (byte)Main.DiscoB;
2934 currentColor.A = byte.MaxValue;
2935 }
2936 else if (ItemID.Sets.ItemIconPulse[type])
2937 {
2938 scale = Main.essScale;
2939 currentColor.R = (byte)((float)(int)currentColor.R * scale);
2940 currentColor.G = (byte)((float)(int)currentColor.G * scale);
2941 currentColor.B = (byte)((float)(int)currentColor.B * scale);
2942 currentColor.A = (byte)((float)(int)currentColor.A * scale);
2943 }
2944 else if (type == 58 || type == 184 || type == 4143)
2945 {
2946 scale = Main.essScale * 0.25f + 0.75f;
2947 currentColor.R = (byte)((float)(int)currentColor.R * scale);
2948 currentColor.G = (byte)((float)(int)currentColor.G * scale);
2949 currentColor.B = (byte)((float)(int)currentColor.B * scale);
2950 currentColor.A = (byte)((float)(int)currentColor.A * scale);
2951 }
2952 return currentColor;
2953 }
2954
2955 public static void DrawRadialCircular(SpriteBatch sb, Vector2 position, Player.SelectionRadial radial, Item[] items)
2956 {
2957 CircularRadialOpacity = MathHelper.Clamp(CircularRadialOpacity + ((PlayerInput.UsingGamepad && PlayerInput.Triggers.Current.RadialHotbar) ? 0.25f : (-0.15f)), 0f, 1f);
2958 if (CircularRadialOpacity == 0f)
2959 {
2960 return;
2961 }
2963 float num = CircularRadialOpacity * 0.9f;
2964 float num2 = CircularRadialOpacity * 1f;
2965 float num3 = (float)(int)Main.mouseTextColor / 255f;
2966 float num4 = 1f - (1f - num3) * (1f - num3);
2967 num4 *= 0.785f;
2968 Color color = Color.White * num4 * num;
2969 value = TextureAssets.HotbarRadial[1].Value;
2970 float num5 = (float)Math.PI * 2f / (float)radial.RadialCount;
2971 float num6 = -(float)Math.PI / 2f;
2972 for (int i = 0; i < radial.RadialCount; i++)
2973 {
2974 int num7 = radial.Bindings[i];
2975 Vector2 vector = new Vector2(150f, 0f).RotatedBy(num6 + num5 * (float)i) * num2;
2976 float num8 = 0.85f;
2977 if (radial.SelectedBinding == i)
2978 {
2979 num8 = 1.7f;
2980 }
2981 sb.Draw(value, position + vector, null, color * num8, 0f, value.Size() / 2f, num2 * num8, SpriteEffects.None, 0f);
2982 if (num7 != -1)
2983 {
2984 float inventoryScale = Main.inventoryScale;
2985 Main.inventoryScale = num2 * num8;
2986 Draw(sb, items, 14, num7, position + vector + new Vector2(-26f * num2 * num8), Color.White);
2987 Main.inventoryScale = inventoryScale;
2988 }
2989 }
2990 }
2991
2992 public static void DrawRadialQuicks(SpriteBatch sb, Vector2 position)
2993 {
2994 QuicksRadialOpacity = MathHelper.Clamp(QuicksRadialOpacity + ((PlayerInput.UsingGamepad && PlayerInput.Triggers.Current.RadialQuickbar) ? 0.25f : (-0.15f)), 0f, 1f);
2995 if (QuicksRadialOpacity == 0f)
2996 {
2997 return;
2998 }
2999 Player player = Main.player[Main.myPlayer];
3001 Texture2D value2 = TextureAssets.QuicksIcon.Value;
3002 float num = QuicksRadialOpacity * 0.9f;
3003 float num2 = QuicksRadialOpacity * 1f;
3004 float num3 = (float)(int)Main.mouseTextColor / 255f;
3005 float num4 = 1f - (1f - num3) * (1f - num3);
3006 num4 *= 0.785f;
3007 Color color = Color.White * num4 * num;
3008 float num5 = (float)Math.PI * 2f / (float)player.QuicksRadial.RadialCount;
3009 float num6 = -(float)Math.PI / 2f;
3010 Item item = player.QuickHeal_GetItemToUse();
3011 Item item2 = player.QuickMana_GetItemToUse();
3012 Item item3 = null;
3013 Item item4 = null;
3014 if (item == null)
3015 {
3016 item = new Item();
3017 item.SetDefaults(28);
3018 }
3019 if (item2 == null)
3020 {
3021 item2 = new Item();
3022 item2.SetDefaults(110);
3023 }
3024 if (item3 == null)
3025 {
3026 item3 = new Item();
3027 item3.SetDefaults(292);
3028 }
3029 if (item4 == null)
3030 {
3031 item4 = new Item();
3032 item4.SetDefaults(2428);
3033 }
3034 for (int i = 0; i < player.QuicksRadial.RadialCount; i++)
3035 {
3036 Item inv = item4;
3037 if (i == 1)
3038 {
3039 inv = item;
3040 }
3041 if (i == 2)
3042 {
3043 inv = item3;
3044 }
3045 if (i == 3)
3046 {
3047 inv = item2;
3048 }
3049 _ = player.QuicksRadial.Bindings[i];
3050 Vector2 vector = new Vector2(120f, 0f).RotatedBy(num6 + num5 * (float)i) * num2;
3051 float num7 = 0.85f;
3052 if (player.QuicksRadial.SelectedBinding == i)
3053 {
3054 num7 = 1.7f;
3055 }
3056 sb.Draw(value, position + vector, null, color * num7, 0f, value.Size() / 2f, num2 * num7 * 1.3f, SpriteEffects.None, 0f);
3057 float inventoryScale = Main.inventoryScale;
3058 Main.inventoryScale = num2 * num7;
3059 Draw(sb, ref inv, 14, position + vector + new Vector2(-26f * num2 * num7), Color.White);
3060 Main.inventoryScale = inventoryScale;
3061 sb.Draw(value2, position + vector + new Vector2(34f, 20f) * 0.85f * num2 * num7, null, color * num7, 0f, value.Size() / 2f, num2 * num7 * 1.3f, SpriteEffects.None, 0f);
3062 }
3063 }
3064
3065 public static void DrawRadialDpad(SpriteBatch sb, Vector2 position)
3066 {
3067 if (!PlayerInput.UsingGamepad || !PlayerInput.CurrentProfile.UsingDpadHotbar())
3068 {
3069 return;
3070 }
3071 Player player = Main.player[Main.myPlayer];
3072 if (player.chest != -1)
3073 {
3074 return;
3075 }
3077 float num = (float)(int)Main.mouseTextColor / 255f;
3078 float num2 = 1f - (1f - num) * (1f - num);
3079 num2 *= 0.785f;
3080 Color color = Color.White * num2;
3081 sb.Draw(value, position, null, color, 0f, value.Size() / 2f, Main.inventoryScale, SpriteEffects.None, 0f);
3082 for (int i = 0; i < 4; i++)
3083 {
3084 int num3 = player.DpadRadial.Bindings[i];
3085 if (num3 != -1)
3086 {
3087 Draw(sb, player.inventory, 14, num3, position + new Vector2(value.Width / 3, 0f).RotatedBy(-(float)Math.PI / 2f + (float)Math.PI / 2f * (float)i) + new Vector2(-26f * Main.inventoryScale), Color.White);
3088 }
3089 }
3090 }
3091
3092 public static string GetGamepadInstructions(ref Item inv, int context = 0)
3093 {
3094 singleSlotArray[0] = inv;
3095 string gamepadInstructions = GetGamepadInstructions(singleSlotArray, context);
3096 inv = singleSlotArray[0];
3097 return gamepadInstructions;
3098 }
3099
3100 public static bool CanExecuteCommand()
3101 {
3103 }
3104
3105 public static string GetGamepadInstructions(Item[] inv, int context = 0, int slot = 0)
3106 {
3107 Player player = Main.player[Main.myPlayer];
3108 string s = "";
3109 if (inv == null || inv[slot] == null || Main.mouseItem == null)
3110 {
3111 return s;
3112 }
3113 if (context == 0 || context == 1 || context == 2)
3114 {
3115 if (inv[slot].type > 0 && inv[slot].stack > 0)
3116 {
3117 if (Main.mouseItem.type > 0)
3118 {
3119 s += PlayerInput.BuildCommand(Lang.misc[65].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"]);
3120 if (inv[slot].type == Main.mouseItem.type && Main.mouseItem.stack < inv[slot].maxStack && inv[slot].maxStack > 1)
3121 {
3122 s += PlayerInput.BuildCommand(Lang.misc[55].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseRight"]);
3123 }
3124 }
3125 else
3126 {
3127 if (context == 0 && player.chest == -1 && PlayerInput.AllowExecutionOfGamepadInstructions)
3128 {
3129 player.DpadRadial.ChangeBinding(slot);
3130 }
3131 s += PlayerInput.BuildCommand(Lang.misc[54].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"]);
3132 if (inv[slot].maxStack > 1)
3133 {
3134 s += PlayerInput.BuildCommand(Lang.misc[55].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseRight"]);
3135 }
3136 }
3137 if (inv[slot].maxStack == 1 && Equippable(inv, context, slot))
3138 {
3139 s += PlayerInput.BuildCommand(Lang.misc[67].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["Grapple"]);
3140 if (CanExecuteCommand() && PlayerInput.Triggers.JustPressed.Grapple)
3141 {
3142 SwapEquip(inv, context, slot);
3145 }
3146 }
3147 s += PlayerInput.BuildCommand(Lang.misc[83].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["SmartCursor"]);
3148 if (CanExecuteCommand() && PlayerInput.Triggers.JustPressed.SmartCursor)
3149 {
3150 inv[slot].favorited = !inv[slot].favorited;
3151 PlayerInput.LockGamepadButtons("SmartCursor");
3153 }
3154 }
3155 else if (Main.mouseItem.type > 0)
3156 {
3157 s += PlayerInput.BuildCommand(Lang.misc[65].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"]);
3158 }
3159 }
3160 if (context == 3 || context == 4 || context == 32)
3161 {
3162 if (inv[slot].type > 0 && inv[slot].stack > 0)
3163 {
3164 if (Main.mouseItem.type > 0)
3165 {
3166 s += PlayerInput.BuildCommand(Lang.misc[65].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"]);
3167 if (inv[slot].type == Main.mouseItem.type && Main.mouseItem.stack < inv[slot].maxStack && inv[slot].maxStack > 1)
3168 {
3169 s += PlayerInput.BuildCommand(Lang.misc[55].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseRight"]);
3170 }
3171 }
3172 else
3173 {
3174 s += PlayerInput.BuildCommand(Lang.misc[54].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"]);
3175 if (inv[slot].maxStack > 1)
3176 {
3177 s += PlayerInput.BuildCommand(Lang.misc[55].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseRight"]);
3178 }
3179 }
3180 if (inv[slot].maxStack == 1 && Equippable(inv, context, slot))
3181 {
3182 s += PlayerInput.BuildCommand(Lang.misc[67].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["Grapple"]);
3183 if (CanExecuteCommand() && PlayerInput.Triggers.JustPressed.Grapple)
3184 {
3185 SwapEquip(inv, context, slot);
3188 }
3189 }
3190 if (context == 32)
3191 {
3192 s += PlayerInput.BuildCommand(Lang.misc[83].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["SmartCursor"]);
3193 if (CanExecuteCommand() && PlayerInput.Triggers.JustPressed.SmartCursor)
3194 {
3195 inv[slot].favorited = !inv[slot].favorited;
3196 PlayerInput.LockGamepadButtons("SmartCursor");
3198 }
3199 }
3200 }
3201 else if (Main.mouseItem.type > 0)
3202 {
3203 s += PlayerInput.BuildCommand(Lang.misc[65].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"]);
3204 }
3205 }
3206 if (context == 15)
3207 {
3208 if (inv[slot].type > 0 && inv[slot].stack > 0)
3209 {
3210 if (Main.mouseItem.type > 0)
3211 {
3212 if (inv[slot].type == Main.mouseItem.type && Main.mouseItem.stack < inv[slot].maxStack && inv[slot].maxStack > 1)
3213 {
3214 s += PlayerInput.BuildCommand(Lang.misc[91].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseRight"]);
3215 }
3216 }
3217 else
3218 {
3219 s += PlayerInput.BuildCommand(Lang.misc[90].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"], PlayerInput.ProfileGamepadUI.KeyStatus["MouseRight"]);
3220 }
3221 }
3222 else if (Main.mouseItem.type > 0)
3223 {
3224 s += PlayerInput.BuildCommand(Lang.misc[92].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"]);
3225 }
3226 }
3227 if (context == 8 || context == 9 || context == 16 || context == 17 || context == 18 || context == 19 || context == 20)
3228 {
3229 if (inv[slot].type > 0 && inv[slot].stack > 0)
3230 {
3231 if (Main.mouseItem.type > 0)
3232 {
3233 if (Equippable(ref Main.mouseItem, context))
3234 {
3235 s += PlayerInput.BuildCommand(Lang.misc[65].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"]);
3236 }
3237 }
3238 else if (context != 8 || !isEquipLocked(inv[slot].type))
3239 {
3240 s += PlayerInput.BuildCommand(Lang.misc[54].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"]);
3241 }
3242 if (context == 8 && slot >= 3)
3243 {
3244 bool flag = player.hideVisibleAccessory[slot];
3245 s += PlayerInput.BuildCommand(Lang.misc[flag ? 77 : 78].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["Grapple"]);
3246 if (CanExecuteCommand() && PlayerInput.Triggers.JustPressed.Grapple)
3247 {
3248 player.hideVisibleAccessory[slot] = !player.hideVisibleAccessory[slot];
3250 if (Main.netMode == 1)
3251 {
3252 NetMessage.SendData(4, -1, -1, null, Main.myPlayer);
3253 }
3256 }
3257 }
3258 if ((context == 16 || context == 17 || context == 18 || context == 19 || context == 20) && slot < 2)
3259 {
3260 bool flag2 = player.hideMisc[slot];
3261 s += PlayerInput.BuildCommand(Lang.misc[flag2 ? 77 : 78].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["Grapple"]);
3262 if (CanExecuteCommand() && PlayerInput.Triggers.JustPressed.Grapple)
3263 {
3264 if (slot == 0)
3265 {
3266 player.TogglePet();
3267 }
3268 if (slot == 1)
3269 {
3270 player.ToggleLight();
3271 }
3273 if (Main.netMode == 1)
3274 {
3275 NetMessage.SendData(4, -1, -1, null, Main.myPlayer);
3276 }
3279 }
3280 }
3281 }
3282 else
3283 {
3284 if (Main.mouseItem.type > 0 && Equippable(ref Main.mouseItem, context))
3285 {
3286 s += PlayerInput.BuildCommand(Lang.misc[65].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"]);
3287 }
3288 if (context == 8 && slot >= 3)
3289 {
3290 int num = slot;
3291 if (num % 10 == 8 && !player.CanDemonHeartAccessoryBeShown())
3292 {
3293 num++;
3294 }
3295 bool flag3 = player.hideVisibleAccessory[num];
3296 s += PlayerInput.BuildCommand(Lang.misc[flag3 ? 77 : 78].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["Grapple"]);
3297 if (CanExecuteCommand() && PlayerInput.Triggers.JustPressed.Grapple)
3298 {
3299 player.hideVisibleAccessory[num] = !player.hideVisibleAccessory[num];
3301 if (Main.netMode == 1)
3302 {
3303 NetMessage.SendData(4, -1, -1, null, Main.myPlayer);
3304 }
3307 }
3308 }
3309 if ((context == 16 || context == 17 || context == 18 || context == 19 || context == 20) && slot < 2)
3310 {
3311 bool flag4 = player.hideMisc[slot];
3312 s += PlayerInput.BuildCommand(Lang.misc[flag4 ? 77 : 78].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["Grapple"]);
3313 if (CanExecuteCommand() && PlayerInput.Triggers.JustPressed.Grapple)
3314 {
3315 if (slot == 0)
3316 {
3317 player.TogglePet();
3318 }
3319 if (slot == 1)
3320 {
3321 player.ToggleLight();
3322 }
3323 Main.mouseLeftRelease = false;
3325 if (Main.netMode == 1)
3326 {
3327 NetMessage.SendData(4, -1, -1, null, Main.myPlayer);
3328 }
3331 }
3332 }
3333 }
3334 }
3335 switch (context)
3336 {
3337 case 12:
3338 case 25:
3339 case 27:
3340 case 33:
3341 if (inv[slot].type > 0 && inv[slot].stack > 0)
3342 {
3343 if (Main.mouseItem.type > 0)
3344 {
3345 if (Main.mouseItem.dye > 0)
3346 {
3347 s += PlayerInput.BuildCommand(Lang.misc[65].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"]);
3348 }
3349 }
3350 else
3351 {
3352 s += PlayerInput.BuildCommand(Lang.misc[54].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"]);
3353 }
3354 if (context == 12 || context == 25 || context == 27 || context == 33)
3355 {
3356 int num2 = -1;
3357 if (inv == player.dye)
3358 {
3359 num2 = slot;
3360 }
3361 if (inv == player.miscDyes)
3362 {
3363 num2 = 10 + slot;
3364 }
3365 if (num2 != -1)
3366 {
3367 if (num2 < 10)
3368 {
3369 bool flag7 = player.hideVisibleAccessory[slot];
3370 s += PlayerInput.BuildCommand(Lang.misc[flag7 ? 77 : 78].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["Grapple"]);
3371 if (CanExecuteCommand() && PlayerInput.Triggers.JustPressed.Grapple)
3372 {
3373 player.hideVisibleAccessory[slot] = !player.hideVisibleAccessory[slot];
3375 if (Main.netMode == 1)
3376 {
3377 NetMessage.SendData(4, -1, -1, null, Main.myPlayer);
3378 }
3381 }
3382 }
3383 else
3384 {
3385 bool flag8 = player.hideMisc[slot];
3386 s += PlayerInput.BuildCommand(Lang.misc[flag8 ? 77 : 78].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["Grapple"]);
3387 if (CanExecuteCommand() && PlayerInput.Triggers.JustPressed.Grapple)
3388 {
3389 player.hideMisc[slot] = !player.hideMisc[slot];
3391 if (Main.netMode == 1)
3392 {
3393 NetMessage.SendData(4, -1, -1, null, Main.myPlayer);
3394 }
3397 }
3398 }
3399 }
3400 }
3401 }
3402 else if (Main.mouseItem.type > 0 && Main.mouseItem.dye > 0)
3403 {
3404 s += PlayerInput.BuildCommand(Lang.misc[65].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"]);
3405 }
3406 return s;
3407 case 18:
3408 {
3409 if (inv[slot].type > 0 && inv[slot].stack > 0)
3410 {
3411 if (Main.mouseItem.type > 0)
3412 {
3413 if (Main.mouseItem.dye > 0)
3414 {
3415 s += PlayerInput.BuildCommand(Lang.misc[65].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"]);
3416 }
3417 }
3418 else
3419 {
3420 s += PlayerInput.BuildCommand(Lang.misc[54].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"]);
3421 }
3422 }
3423 else if (Main.mouseItem.type > 0 && Main.mouseItem.dye > 0)
3424 {
3425 s += PlayerInput.BuildCommand(Lang.misc[65].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"]);
3426 }
3427 bool enabledSuperCart = player.enabledSuperCart;
3428 s += PlayerInput.BuildCommand(Language.GetTextValue((!enabledSuperCart) ? "UI.EnableSuperCart" : "UI.DisableSuperCart"), false, PlayerInput.ProfileGamepadUI.KeyStatus["Grapple"]);
3429 if (CanExecuteCommand() && PlayerInput.Triggers.JustPressed.Grapple)
3430 {
3431 player.enabledSuperCart = !player.enabledSuperCart;
3433 if (Main.netMode == 1)
3434 {
3435 NetMessage.SendData(4, -1, -1, null, Main.myPlayer);
3436 }
3439 }
3440 return s;
3441 }
3442 case 6:
3443 if (inv[slot].type > 0 && inv[slot].stack > 0)
3444 {
3445 s = ((Main.mouseItem.type <= 0) ? (s + PlayerInput.BuildCommand(Lang.misc[54].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"])) : (s + PlayerInput.BuildCommand(Lang.misc[74].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"])));
3446 }
3447 else if (Main.mouseItem.type > 0)
3448 {
3449 s += PlayerInput.BuildCommand(Lang.misc[74].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"]);
3450 }
3451 return s;
3452 case 5:
3453 case 7:
3454 {
3455 bool flag6 = false;
3456 if (context == 5)
3457 {
3458 flag6 = Main.mouseItem.Prefix(-3) || Main.mouseItem.type == 0;
3459 }
3460 if (context == 7)
3461 {
3462 flag6 = Main.mouseItem.material;
3463 }
3464 if (inv[slot].type > 0 && inv[slot].stack > 0)
3465 {
3466 if (Main.mouseItem.type > 0)
3467 {
3468 if (flag6)
3469 {
3470 s += PlayerInput.BuildCommand(Lang.misc[65].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"]);
3471 }
3472 }
3473 else
3474 {
3475 s += PlayerInput.BuildCommand(Lang.misc[54].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"]);
3476 }
3477 }
3478 else if (Main.mouseItem.type > 0 && flag6)
3479 {
3480 s += PlayerInput.BuildCommand(Lang.misc[65].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["MouseLeft"]);
3481 }
3482 return s;
3483 }
3484 default:
3485 {
3486 string overrideInstructions = GetOverrideInstructions(inv, context, slot);
3487 bool flag5 = Main.mouseItem.type > 0 && (context == 0 || context == 1 || context == 2 || context == 6 || context == 15 || context == 7 || context == 4 || context == 32 || context == 3);
3488 if (context != 8 || !isEquipLocked(inv[slot].type))
3489 {
3490 if (flag5 && string.IsNullOrEmpty(overrideInstructions))
3491 {
3492 s += PlayerInput.BuildCommand(Lang.inter[121].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["SmartSelect"]);
3493 if (CanExecuteCommand() && PlayerInput.Triggers.JustPressed.SmartSelect)
3494 {
3495 player.DropSelectedItem();
3496 PlayerInput.LockGamepadButtons("SmartSelect");
3498 }
3499 }
3500 else if (!string.IsNullOrEmpty(overrideInstructions))
3501 {
3502 ShiftForcedOn = true;
3503 int cursorOverride = Main.cursorOverride;
3504 OverrideHover(inv, context, slot);
3505 if (-1 != Main.cursorOverride)
3506 {
3507 s += PlayerInput.BuildCommand(overrideInstructions, false, PlayerInput.ProfileGamepadUI.KeyStatus["SmartSelect"]);
3508 if (CanDoSimulatedClickAction() && CanExecuteCommand() && PlayerInput.Triggers.JustPressed.SmartSelect)
3509 {
3510 bool mouseLeft = Main.mouseLeft;
3511 Main.mouseLeft = true;
3512 LeftClick(inv, context, slot);
3513 Main.mouseLeft = mouseLeft;
3514 PlayerInput.LockGamepadButtons("SmartSelect");
3516 }
3517 }
3518 Main.cursorOverride = cursorOverride;
3519 ShiftForcedOn = false;
3520 }
3521 }
3522 if (!TryEnteringFastUseMode(inv, context, slot, player, ref s))
3523 {
3524 TryEnteringBuildingMode(inv, context, slot, player, ref s);
3525 }
3526 return s;
3527 }
3528 }
3529 }
3530
3531 private static bool CanDoSimulatedClickAction()
3532 {
3534 {
3536 }
3537 return true;
3538 }
3539
3540 private static bool TryEnteringFastUseMode(Item[] inv, int context, int slot, Player player, ref string s)
3541 {
3542 int num = 0;
3543 if (Main.mouseItem.CanBeQuickUsed)
3544 {
3545 num = 1;
3546 }
3547 if (num == 0 && Main.mouseItem.stack <= 0 && context == 0 && inv[slot].CanBeQuickUsed)
3548 {
3549 num = 2;
3550 }
3551 if (num > 0)
3552 {
3553 s += PlayerInput.BuildCommand(Language.GetTextValue("UI.QuickUseItem"), false, PlayerInput.ProfileGamepadUI.KeyStatus["QuickMount"]);
3554 if (CanExecuteCommand() && PlayerInput.Triggers.JustPressed.QuickMount)
3555 {
3556 switch (num)
3557 {
3558 case 1:
3560 break;
3561 case 2:
3563 break;
3564 }
3565 }
3566 return true;
3567 }
3568 return false;
3569 }
3570
3571 private static bool TryEnteringBuildingMode(Item[] inv, int context, int slot, Player player, ref string s)
3572 {
3573 int num = 0;
3575 {
3576 num = 1;
3577 }
3578 if (num == 0 && Main.mouseItem.stack <= 0 && context == 0 && IsABuildingItem(inv[slot]))
3579 {
3580 num = 2;
3581 }
3582 if (num > 0)
3583 {
3585 if (num == 1)
3586 {
3588 }
3589 if (num == 2)
3590 {
3591 item = inv[slot];
3592 }
3593 if (num != 1 || player.ItemSpace(item).CanTakeItemToPersonalInventory)
3594 {
3595 if (item.damage > 0 && item.ammo == 0)
3596 {
3597 s += PlayerInput.BuildCommand(Lang.misc[60].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["QuickMount"]);
3598 }
3599 else if (item.createTile >= 0 || item.createWall > 0)
3600 {
3601 s += PlayerInput.BuildCommand(Lang.misc[61].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["QuickMount"]);
3602 }
3603 else
3604 {
3605 s += PlayerInput.BuildCommand(Lang.misc[63].Value, false, PlayerInput.ProfileGamepadUI.KeyStatus["QuickMount"]);
3606 }
3607 if (CanExecuteCommand() && PlayerInput.Triggers.JustPressed.QuickMount)
3608 {
3610 }
3611 return true;
3612 }
3613 }
3614 return false;
3615 }
3616
3617 public static bool IsABuildingItem(Item item)
3618 {
3619 if (item.type > 0 && item.stack > 0 && item.useStyle != 0)
3620 {
3621 return item.useTime > 0;
3622 }
3623 return false;
3624 }
3625
3626 public static void SelectEquipPage(Item item)
3627 {
3628 Main.EquipPage = -1;
3629 if (!item.IsAir)
3630 {
3631 if (Main.projHook[item.shoot])
3632 {
3633 Main.EquipPage = 2;
3634 }
3635 else if (item.mountType != -1)
3636 {
3637 Main.EquipPage = 2;
3638 }
3639 else if (item.buffType > 0 && Main.vanityPet[item.buffType])
3640 {
3641 Main.EquipPage = 2;
3642 }
3643 else if (item.buffType > 0 && Main.lightPet[item.buffType])
3644 {
3645 Main.EquipPage = 2;
3646 }
3647 else if (item.dye > 0 && Main.EquipPageSelected == 1)
3648 {
3649 Main.EquipPage = 0;
3650 }
3651 else if (item.legSlot != -1 || item.headSlot != -1 || item.bodySlot != -1 || item.accessory)
3652 {
3653 Main.EquipPage = 0;
3654 }
3655 }
3656 }
3657}
void Draw(Texture2D texture, Vector2 position, Color color)
static float Clamp(float value, float min, float max)
Definition MathHelper.cs:46
const double PI
Definition Math.cs:16
static void PlaySound(int type, Vector2 position, int style=1)
void AddItemToShop(Item newItem)
Definition Chest.cs:742
Item[] item
Definition Chest.cs:41
virtual bool TryGetItemGamepadOverrideInstructions(Item[] inv, int context, int slot, out string instruction)
static void NotifyItemPickup(Player player, Item item)
static void HandleOnEquip(Player player, Item item, int context)
static Asset< DynamicSpriteFont > ItemStack
Definition FontAssets.cs:8
static Asset< DynamicSpriteFont > MouseText
Definition FontAssets.cs:10
static Asset< Texture2D > InventoryBack13
static Asset< Texture2D > InventoryBack7
static Asset< Texture2D > InventoryBack8
static Asset< Texture2D > InventoryBack9
static Asset< Texture2D > InventoryBack
static Asset< Texture2D >[] GlowMask
static Asset< Texture2D > Cd
static Asset< Texture2D > InventoryBack5
static Asset< Texture2D > Trash
static Asset< Texture2D > InventoryBack4
static Asset< Texture2D > InventoryBack14
static Asset< Texture2D >[] HotbarRadial
static Asset< Texture2D > InventoryBack6
static Asset< Texture2D >[] Item
static Asset< Texture2D > InventoryBack18
static Asset< Texture2D >[] Extra
static Asset< Texture2D > InventoryBack3
static Asset< Texture2D > InventoryBack19
static Asset< Texture2D > Wire
static Asset< Texture2D > InventoryBack15
static Asset< Texture2D > InventoryBack17
static Asset< Texture2D > InventoryBack12
static Asset< Texture2D > InventoryBack2
static Asset< Texture2D > InventoryBack10
static Asset< Texture2D > QuicksIcon
static void DrawSavings(SpriteBatch sb, int currencyIndex, float shopx, float shopy, bool horizontal=false)
static void TryEnteringFastUseModeForMouseItem()
static TriggersPack Triggers
static void TryEnteringFastUseModeForInventorySlot(int inventorySlot)
static string BuildCommand(string CommandText, bool Last, params List< string >[] Bindings)
static PlayerInputProfile CurrentProfile
static void LockGamepadButtons(string TriggerName)
static bool AllowExecutionOfGamepadInstructions
static KeyConfiguration ProfileGamepadUI
static bool[] ItemIconPulse
Definition ItemID.cs:1048
static bool[] BossBag
Definition ItemID.cs:1123
static bool[] OpenableBag
Definition ItemID.cs:1125
static bool[] IsFishingCrate
Definition ItemID.cs:1032
static bool[] TrapSigned
Definition ItemID.cs:1040
static bool[] DrawUnsafeIndicator
Definition ItemID.cs:59
static readonly short Count
Definition ItemID.cs:12138
static bool[] Cart
Definition MountID.cs:9
bool IsNotTheSameAs(Item compareItem)
Definition Item.cs:49935
Item Clone()
Definition Item.cs:49916
bool CanBeQuickUsed
Definition Item.cs:401
bool material
Definition Item.cs:267
int stack
Definition Item.cs:149
int shoot
Definition Item.cs:235
int maxStack
Definition Item.cs:151
int headSlot
Definition Item.cs:195
bool Prefix(int prefixWeWant)
Definition Item.cs:487
bool IsAir
Definition Item.cs:377
int buffType
Definition Item.cs:271
int shopSpecialCurrency
Definition Item.cs:281
void OnCreated(ItemCreationContext context)
Definition Item.cs:47625
bool favorited
Definition Item.cs:135
bool accessory
Definition Item.cs:143
string Name
Definition Item.cs:326
bool FitsAmmoSlot()
Definition Item.cs:2332
sbyte wingSlot
Definition Item.cs:213
int legSlot
Definition Item.cs:199
void TurnToAir(bool fullReset=false)
Definition Item.cs:49954
void SetDefaults(int Type=0)
Definition Item.cs:47332
int mountType
Definition Item.cs:275
int bodySlot
Definition Item.cs:197
bool newAndShiny
Definition Item.cs:309
static LocalizedText[] inter
Definition Lang.cs:28
static LocalizedText[] misc
Definition Lang.cs:25
static string GetTextValue(string key)
Definition Language.cs:15
static bool[] vanityPet
Definition Main.cs:778
static bool drawingPlayerChat
Definition Main.cs:1739
static float essScale
Definition Main.cs:620
static int stackDelay
Definition Main.cs:1769
static ItemShopSellbackHelper shopSellbackHelper
Definition Main.cs:1841
static int myPlayer
Definition Main.cs:1801
static int DiscoR
Definition Main.cs:1062
static int netMode
Definition Main.cs:2095
static bool expertMode
Definition Main.cs:2737
static CreativeUI CreativeMenu
Definition Main.cs:369
static bool mouseRight
Definition Main.cs:616
static DrawAnimation[] itemAnimations
Definition Main.cs:1707
static int cursorOverride
Definition Main.cs:2181
static bool mouseLeftRelease
Definition Main.cs:1755
static double timeForVisualEffects
Definition Main.cs:1286
static Main instance
Definition Main.cs:283
static Vector2 MouseScreen
Definition Main.cs:2773
static Microsoft.Xna.Framework.Color inventoryBack
Definition Main.cs:2451
static Item mouseItem
Definition Main.cs:1773
static byte mouseTextColor
Definition Main.cs:1751
static int DiscoG
Definition Main.cs:1066
static float inventoryScale
Definition Main.cs:1779
static bool InReforgeMenu
Definition Main.cs:1908
static Item HoverItem
Definition Main.cs:1910
static bool[] lightPet
Definition Main.cs:780
static bool mouseRightRelease
Definition Main.cs:1757
static Microsoft.Xna.Framework.Input.Keys FavoriteKey
Definition Main.cs:2197
static int npcShop
Definition Main.cs:2833
static KeyboardState keyState
Definition Main.cs:988
static Item reforgeItem
Definition Main.cs:1777
static int DiscoB
Definition Main.cs:1064
static bool InGuideCraftMenu
Definition Main.cs:1906
static string hoverItemName
Definition Main.cs:2449
static int stackSplit
Definition Main.cs:1761
static bool playerInventory
Definition Main.cs:1759
static void GetItemDrawFrame(int item, out Texture2D itemTexture, out Microsoft.Xna.Framework.Rectangle itemFrame)
Definition Main.cs:25221
static Microsoft.Xna.Framework.Color hslToRgb(Vector3 hslVector)
Definition Main.cs:44913
static Player LocalPlayer
Definition Main.cs:2829
static Item guideItem
Definition Main.cs:1775
static Player[] player
Definition Main.cs:1803
static bool[] projHook
Definition Main.cs:772
static int EquipPageSelected
Definition Main.cs:822
static bool mouseLeft
Definition Main.cs:614
static void SendData(int msgType, int remoteClient=-1, int ignoreClient=-1, NetworkText text=null, int number=0, float number2=0f, float number3=0f, float number4=0f, int number5=0, int number6=0, int number7=0)
Definition NetMessage.cs:88
void ChangeBinding(int itemSlot)
Definition Player.cs:472
int GetDrawMode(int itemslot)
Definition Player.cs:525
void OpenLockBox(int lockboxItemType)
Definition Player.cs:8583
void OpenShadowLockbox(int boxType)
Definition Player.cs:8555
bool SellItem(Item item, int stack=-1)
Definition Player.cs:33352
SelectionRadial DpadRadial
Definition Player.cs:583
void OpenOyster(int sourceItemType)
Definition Player.cs:8710
void OpenHerbBag(int bagType)
Definition Player.cs:8616
SelectionRadial QuicksRadial
Definition Player.cs:587
bool mouseInterface
Definition Player.cs:1137
Item QuickMana_GetItemToUse()
Definition Player.cs:4756
bool HasItemInInventoryOrOpenVoidBag(int type)
Definition Player.cs:52329
void GetItemExpectedPrice(Item item, out long calcForSelling, out long calcForBuying)
Definition Player.cs:33543
bool ConsumeItem(int type, bool reverseOrder=false, bool includeVoidBag=false)
Definition Player.cs:8514
BitsByte hideMisc
Definition Player.cs:1369
void ToggleLight()
Definition Player.cs:16979
Item[] miscEquips
Definition Player.cs:1171
void OpenGoodieBag(int itemType)
Definition Player.cs:8731
ItemSpaceStatus ItemSpace(Item newItem)
Definition Player.cs:36958
bool BuyItem(long price, int customCurrency=-1)
Definition Player.cs:33584
bool[] hideVisibleAccessory
Definition Player.cs:1367
bool IsItemSlotUnlockedAndUsable(int slot)
Definition Player.cs:11968
Item[] miscDyes
Definition Player.cs:1173
Item QuickHeal_GetItemToUse()
Definition Player.cs:4689
void OpenPresent(int itemType)
Definition Player.cs:5965
void TogglePet()
Definition Player.cs:16970
int potionDelayTime
Definition Player.cs:2443
void OpenCanofWorms(int sourceItemType)
Definition Player.cs:8696
void DropSelectedItem()
Definition Player.cs:4315
void OpenLegacyPresent(int itemType)
Definition Player.cs:6235
bool enabledSuperCart
Definition Player.cs:1669
bool CanDemonHeartAccessoryBeShown()
Definition Player.cs:3646
void OpenFishingCrate(int crateItemID)
Definition Player.cs:7097
Item[] inventory
Definition Player.cs:1257
void OpenBossBag(int type)
Definition Player.cs:6274
PlayerInteractionAnchor tileEntityAnchor
Definition Player.cs:2469
static void FindRecipes(bool canDelayCheck=false)
Definition Recipe.cs:453
static bool AddChatText(DynamicSpriteFont font, string text, Vector2 baseScale)
static Vector2 DrawColorCodedStringWithShadow(SpriteBatch spriteBatch, DynamicSpriteFont font, TextSnippet[] snippets, Vector2 position, float rotation, Vector2 origin, Vector2 baseScale, out int hoveredSnippet, float maxWidth=-1f, float spread=2f)
static Vector2 GetStringSize(DynamicSpriteFont font, string text, Vector2 baseScale, float maxWidth=-1f)
static bool IsBlockedFromTransferIntoChest(Item item, Item[] container)
Definition ChestUI.cs:1380
static void GetContainerUsageInfo(out bool sync, out Item[] chestinv)
Definition ChestUI.cs:1352
static bool TryPlacingInChest(Item I, bool justCheck, int itemSlotContext)
Definition ChestUI.cs:1275
static void SetPosition(int ID, Vector2 Position)
static readonly int Count
Definition ItemSlot.cs:99
static bool HighlightNewItems
Definition ItemSlot.cs:26
static bool DisableLeftShiftTrashCan
Definition ItemSlot.cs:22
static bool DisableQuickTrash
Definition ItemSlot.cs:24
static Color[,] LoadoutSlotColors
Definition ItemSlot.cs:151
static void Draw(SpriteBatch spriteBatch, ref Item inv, int context, Vector2 position, Color lightColor=default(Color))
Definition ItemSlot.cs:1777
static bool Equippable(Item[] inv, int context, int slot)
Definition ItemSlot.cs:2635
static Item DyeSwap(Item item, out bool success)
Definition ItemSlot.cs:2692
static float[] inventoryGlowHueChest
Definition ItemSlot.cs:141
static float QuicksRadialOpacity
Definition ItemSlot.cs:159
static bool OverrideLeftClick(Item[] inv, int context=0, int slot=0)
Definition ItemSlot.cs:548
static bool isEquipLocked(int type)
Definition ItemSlot.cs:329
static void SetGlow(int index, float hue, bool chest)
Definition ItemSlot.cs:249
delegate void ItemTransferEvent(ItemTransferInfo info)
static void SellOrTrash(Item[] inv, int context, int slot)
Definition ItemSlot.cs:1023
static void HandleShopSlot(Item[] inv, int slot, bool rightClickIsValid, bool leftClickIsValid)
Definition ItemSlot.cs:1718
static Item EquipSwap(Item item, Item[] inv, int slot, out bool success)
Definition ItemSlot.cs:2816
static bool TryEnteringFastUseMode(Item[] inv, int context, int slot, Player player, ref string s)
Definition ItemSlot.cs:3540
static float CircularRadialOpacity
Definition ItemSlot.cs:157
static ItemTransferEvent OnItemTransferred
Definition ItemSlot.cs:177
static Color GetColorByLoadout(int slot, int context)
Definition ItemSlot.cs:2216
static void OverrideHover(ref Item inv, int context=0)
Definition ItemSlot.cs:322
static void DrawRadialDpad(SpriteBatch sb, Vector2 position)
Definition ItemSlot.cs:3065
static int accSlotToSwapTo
Definition ItemSlot.cs:155
static void OverrideHover(Item[] inv, int context=0, int slot=0)
Definition ItemSlot.cs:334
static void DrawMoney(SpriteBatch sb, string text, float shopx, float shopy, int[] coinsArray, bool horizontal=false)
Definition ItemSlot.cs:2829
static bool forceClearGlowsOnChest
Definition ItemSlot.cs:147
static int dyeSlotCount
Definition ItemSlot.cs:153
static float DrawItemIcon(Item item, int context, SpriteBatch spriteBatch, Vector2 screenPositionForItemCenter, float scale, float sizeLimit, Color environmentColor)
Definition ItemSlot.cs:2273
static void SwapEquip(ref Item inv, int context=0)
Definition ItemSlot.cs:2544
static int PickItemMovementAction(Item[] inv, int context, int slot, Item checkItem)
Definition ItemSlot.cs:1158
static bool ShiftForcedOn
Definition ItemSlot.cs:129
static bool DisableTrashing()
Definition ItemSlot.cs:980
static Color GetItemLight(ref Color currentColor, ref float scale, int type, bool outInTheWorld=false)
Definition ItemSlot.cs:2916
static void LeftClick(Item[] inv, int context=0, int slot=0)
Definition ItemSlot.cs:637
static int[] inventoryGlowTime
Definition ItemSlot.cs:139
static bool Equippable(ref Item inv, int context=0)
Definition ItemSlot.cs:2627
static bool NotUsingGamepad
Definition ItemSlot.cs:175
static void PickupItemIntoMouse(Item[] inv, int context, int slot, Player player)
Definition ItemSlot.cs:1425
static void SwapVanityEquip(Item[] inv, int context, int slot, Player player)
Definition ItemSlot.cs:1555
static bool IsMiscEquipment(Item item)
Definition ItemSlot.cs:2645
static void DrawSavings(SpriteBatch sb, float shopx, float shopy, bool horizontal=false)
Definition ItemSlot.cs:2859
static void RightClick(ref Item inv, int context=0)
Definition ItemSlot.cs:1313
static string GetOverrideInstructions(Item[] inv, int context, int slot)
Definition ItemSlot.cs:1067
static void LeftClick(ref Item inv, int context=0)
Definition ItemSlot.cs:630
static void AnnounceTransfer(ItemTransferInfo info)
Definition ItemSlot.cs:241
static void TryPickupDyeToCursor(int context, Item[] inv, int slot, Player player)
Definition ItemSlot.cs:1603
static bool TryGetSlotColor(int loadoutIndex, int context, out Color color)
Definition ItemSlot.cs:2233
static void DrawRadialQuicks(SpriteBatch sb, Vector2 position)
Definition ItemSlot.cs:2992
static void DrawItem_GetColorAndScale(Item item, float scale, ref Color currentWhite, float sizeLimit, ref Rectangle frame, out Color itemLight, out float finalDrawScale)
Definition ItemSlot.cs:2320
static void GetItemLight(ref Color currentColor, int type, bool outInTheWorld=false)
Definition ItemSlot.cs:2905
static void Handle(Item[] inv, int context=0, int slot=0)
Definition ItemSlot.cs:310
static void SelectEquipPage(Item item)
Definition ItemSlot.cs:3626
static bool ShiftInUse
Definition ItemSlot.cs:162
static Item[] singleSlotArray
Definition ItemSlot.cs:131
static string GetGamepadInstructions(ref Item inv, int context=0)
Definition ItemSlot.cs:3092
static bool CanDoSimulatedClickAction()
Definition ItemSlot.cs:3531
static void MouseHover(ref Item inv, int context=0)
Definition ItemSlot.cs:2451
static Item ArmorSwap(Item item, out bool success)
Definition ItemSlot.cs:2730
static bool IsABuildingItem(Item item)
Definition ItemSlot.cs:3617
static string GetGamepadInstructions(Item[] inv, int context=0, int slot=0)
Definition ItemSlot.cs:3105
static void RightClick(Item[] inv, int context=0, int slot=0)
Definition ItemSlot.cs:1320
static void GetItemLight(ref Color currentColor, ref float scale, Item item, bool outInTheWorld=false)
Definition ItemSlot.cs:2911
static void UpdateInterface()
Definition ItemSlot.cs:271
static void RefreshStackSplitCooldown()
Definition ItemSlot.cs:1478
static int[] inventoryGlowTimeChest
Definition ItemSlot.cs:143
static Color GetLoadoutColor(int loadoutIndex)
Definition ItemSlot.cs:2268
static bool ControlInUse
Definition ItemSlot.cs:173
static bool LeftClick_SellOrTrash(Item[] inv, int context, int slot)
Definition ItemSlot.cs:989
static bool TryEnteringBuildingMode(Item[] inv, int context, int slot, Player player, ref string s)
Definition ItemSlot.cs:3571
static void GetItemLight(ref Color currentColor, Item item, bool outInTheWorld=false)
Definition ItemSlot.cs:2899
static bool DrawGoldBGForCraftingMaterial
Definition ItemSlot.cs:127
static bool[] canShareAt
Definition ItemSlot.cs:135
static void AfterItemSwap(int oldType, int newType)
Definition ItemSlot.cs:1703
static int _customCurrencyForSavings
Definition ItemSlot.cs:145
static void MouseHover(int context=0)
Definition ItemSlot.cs:2445
static bool AccCheck(Item[] itemCollection, Item item, int slot)
Definition ItemSlot.cs:2654
static bool CanExecuteCommand()
Definition ItemSlot.cs:3100
static double _lastTimeForVisualEffectsThatLoadoutWasChanged
Definition ItemSlot.cs:149
static void SwapEquip(Item[] inv, int context, int slot)
Definition ItemSlot.cs:2551
static void TryItemSwap(Item item)
Definition ItemSlot.cs:1633
static float[] inventoryGlowHue
Definition ItemSlot.cs:137
static bool[] canFavoriteAt
Definition ItemSlot.cs:133
static void TryOpenContainer(Item item, Player player)
Definition ItemSlot.cs:1490
static int GetGamepadPointForSlot(Item[] inv, int context, int slot)
Definition ItemSlot.cs:2333
static void Draw(SpriteBatch spriteBatch, Item[] inv, int context, int slot, Vector2 position, Color lightColor=default(Color))
Definition ItemSlot.cs:1784
static void DrawRadialCircular(SpriteBatch sb, Vector2 position, Player.SelectionRadial radial, Item[] items)
Definition ItemSlot.cs:2955
static float ShiftHueByLoadout(float hue, int loadoutIndex)
Definition ItemSlot.cs:2263
static void Handle(ref Item inv, int context=0)
Definition ItemSlot.cs:302
static void MouseHover(Item[] inv, int context=0, int slot=0)
Definition ItemSlot.cs:2458
static void RecordLoadoutChange()
Definition ItemSlot.cs:2228
static float Remap(float fromValue, float fromMin, float fromMax, float toMin, float toMax, bool clamped=true)
Definition Utils.cs:233
static int[] CoinsSplit(long count)
Definition Utils.cs:665
static void DrawBorderStringFourWay(SpriteBatch sb, DynamicSpriteFont font, string text, float x, float y, Color textColor, Color borderColor, Vector2 origin, float scale=1f)
Definition Utils.cs:1857
static float GetLerpValue(float from, float to, float t, bool clamped=false)
Definition Utils.cs:203
static long CoinsCombineStacks(out bool overFlowing, params long[] coinCounts)
Definition Utils.cs:679
static long CoinsCount(out bool overFlowing, Item[] inv, params int[] ignoreSlots)
Definition Utils.cs:636
static Rectangle CenteredRectangle(Vector2 center, Vector2 size)
Definition Utils.cs:604
static Color Transparent
Definition Color.cs:76
static Color Lerp(Color value1, Color value2, float amount)
Definition Color.cs:491
static GetItemSettings InventoryEntityToPlayerInventorySettings
ItemTransferInfo(Item itemAfter, int fromContext, int toContext, int transferAmount=0)
Definition ItemSlot.cs:112