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

◆ ItemCheck_GetMeleeHitbox()

void Terraria.Player.ItemCheck_GetMeleeHitbox ( Item sItem,
Rectangle heldItemFrame,
out bool dontAttack,
out Rectangle itemRectangle )
inlineprivate

Definition at line 44735 of file Player.cs.

44736 {
44737 //IL_0021: Unknown result type (might be due to invalid IL or missing references)
44738 //IL_0026: Unknown result type (might be due to invalid IL or missing references)
44739 //IL_0035: Unknown result type (might be due to invalid IL or missing references)
44740 //IL_003c: Unknown result type (might be due to invalid IL or missing references)
44741 //IL_00b0: Unknown result type (might be due to invalid IL or missing references)
44742 //IL_00b5: Unknown result type (might be due to invalid IL or missing references)
44743 //IL_0598: Unknown result type (might be due to invalid IL or missing references)
44744 //IL_05ac: Unknown result type (might be due to invalid IL or missing references)
44745 //IL_05b1: Unknown result type (might be due to invalid IL or missing references)
44746 //IL_05b6: Unknown result type (might be due to invalid IL or missing references)
44747 //IL_05b8: Unknown result type (might be due to invalid IL or missing references)
44748 //IL_05bb: Unknown result type (might be due to invalid IL or missing references)
44749 //IL_05c0: Unknown result type (might be due to invalid IL or missing references)
44750 //IL_05c5: Unknown result type (might be due to invalid IL or missing references)
44751 //IL_03ea: Unknown result type (might be due to invalid IL or missing references)
44752 //IL_03f1: Unknown result type (might be due to invalid IL or missing references)
44753 //IL_03f7: Unknown result type (might be due to invalid IL or missing references)
44754 //IL_0434: Unknown result type (might be due to invalid IL or missing references)
44755 //IL_043b: Unknown result type (might be due to invalid IL or missing references)
44756 //IL_0441: Unknown result type (might be due to invalid IL or missing references)
44757 //IL_05d4: Unknown result type (might be due to invalid IL or missing references)
44758 //IL_05d9: Unknown result type (might be due to invalid IL or missing references)
44759 //IL_05db: Unknown result type (might be due to invalid IL or missing references)
44760 //IL_05eb: Unknown result type (might be due to invalid IL or missing references)
44761 //IL_05f0: Unknown result type (might be due to invalid IL or missing references)
44762 //IL_05f5: Unknown result type (might be due to invalid IL or missing references)
44763 //IL_05f9: Unknown result type (might be due to invalid IL or missing references)
44764 //IL_05fe: Unknown result type (might be due to invalid IL or missing references)
44765 //IL_0605: Unknown result type (might be due to invalid IL or missing references)
44766 //IL_0607: Unknown result type (might be due to invalid IL or missing references)
44767 //IL_0611: Unknown result type (might be due to invalid IL or missing references)
44768 //IL_0616: Unknown result type (might be due to invalid IL or missing references)
44769 //IL_062e: Unknown result type (might be due to invalid IL or missing references)
44770 //IL_0634: Unknown result type (might be due to invalid IL or missing references)
44771 //IL_0649: Unknown result type (might be due to invalid IL or missing references)
44772 //IL_064b: Unknown result type (might be due to invalid IL or missing references)
44773 //IL_0668: Unknown result type (might be due to invalid IL or missing references)
44774 //IL_066d: Unknown result type (might be due to invalid IL or missing references)
44775 //IL_047b: Unknown result type (might be due to invalid IL or missing references)
44776 //IL_0482: Unknown result type (might be due to invalid IL or missing references)
44777 //IL_0488: Unknown result type (might be due to invalid IL or missing references)
44778 //IL_04c2: Unknown result type (might be due to invalid IL or missing references)
44779 //IL_04c9: Unknown result type (might be due to invalid IL or missing references)
44780 //IL_04cf: Unknown result type (might be due to invalid IL or missing references)
44781 //IL_0505: Unknown result type (might be due to invalid IL or missing references)
44782 //IL_050c: Unknown result type (might be due to invalid IL or missing references)
44783 //IL_0512: Unknown result type (might be due to invalid IL or missing references)
44784 dontAttack = false;
44785 itemRectangle = new Rectangle((int)itemLocation.X, (int)itemLocation.Y, 32, 32);
44786 if (!Main.dedServ)
44787 {
44788 int num = heldItemFrame.Width;
44789 int num2 = heldItemFrame.Height;
44790 switch (sItem.type)
44791 {
44792 case 5094:
44793 num -= 10;
44794 num2 -= 10;
44795 break;
44796 case 5095:
44797 num -= 10;
44798 num2 -= 10;
44799 break;
44800 case 5096:
44801 num -= 12;
44802 num2 -= 12;
44803 break;
44804 case 5097:
44805 num -= 8;
44806 num2 -= 8;
44807 break;
44808 }
44809 itemRectangle = new Rectangle((int)itemLocation.X, (int)itemLocation.Y, num, num2);
44810 }
44812 itemRectangle.Width = (int)((float)itemRectangle.Width * adjustedItemScale);
44813 itemRectangle.Height = (int)((float)itemRectangle.Height * adjustedItemScale);
44814 if (direction == -1)
44815 {
44816 itemRectangle.X -= itemRectangle.Width;
44817 }
44818 if (gravDir == 1f)
44819 {
44820 itemRectangle.Y -= itemRectangle.Height;
44821 }
44822 if (sItem.useStyle == 1)
44823 {
44824 if ((double)itemAnimation < (double)itemAnimationMax * 0.333)
44825 {
44826 if (direction == -1)
44827 {
44828 itemRectangle.X -= (int)((double)itemRectangle.Width * 1.4 - (double)itemRectangle.Width);
44829 }
44830 itemRectangle.Width = (int)((double)itemRectangle.Width * 1.4);
44831 itemRectangle.Y += (int)((double)itemRectangle.Height * 0.5 * (double)gravDir);
44832 itemRectangle.Height = (int)((double)itemRectangle.Height * 1.1);
44833 }
44834 else if (!((double)itemAnimation < (double)itemAnimationMax * 0.666))
44835 {
44836 if (direction == 1)
44837 {
44838 itemRectangle.X -= (int)((double)itemRectangle.Width * 1.2);
44839 }
44840 itemRectangle.Width *= 2;
44841 itemRectangle.Y -= (int)(((double)itemRectangle.Height * 1.4 - (double)itemRectangle.Height) * (double)gravDir);
44842 itemRectangle.Height = (int)((double)itemRectangle.Height * 1.4);
44843 }
44844 }
44845 else if (sItem.useStyle == 3)
44846 {
44847 if ((double)itemAnimation > (double)itemAnimationMax * 0.666)
44848 {
44849 dontAttack = true;
44850 }
44851 else
44852 {
44853 if (direction == -1)
44854 {
44855 itemRectangle.X -= (int)((double)itemRectangle.Width * 1.4 - (double)itemRectangle.Width);
44856 }
44857 itemRectangle.Width = (int)((double)itemRectangle.Width * 1.4);
44858 itemRectangle.Y += (int)((double)itemRectangle.Height * 0.6);
44859 itemRectangle.Height = (int)((double)itemRectangle.Height * 0.6);
44860 if (sItem.type == 946 || sItem.type == 4707)
44861 {
44862 itemRectangle.Height += 14;
44863 itemRectangle.Width -= 10;
44864 if (direction == -1)
44865 {
44866 itemRectangle.X += 10;
44867 }
44868 }
44869 }
44870 }
44872 if (sItem.type == 1450 && Main.rand.Next(3) == 0)
44873 {
44874 int num3 = -1;
44875 float x = itemRectangle.X + Main.rand.Next(itemRectangle.Width);
44876 float y = itemRectangle.Y + Main.rand.Next(itemRectangle.Height);
44877 if (Main.rand.Next(500) == 0)
44878 {
44879 num3 = Gore.NewGore(new Vector2(x, y), default(Vector2), 415, (float)Main.rand.Next(51, 101) * 0.01f);
44880 }
44881 else if (Main.rand.Next(250) == 0)
44882 {
44883 num3 = Gore.NewGore(new Vector2(x, y), default(Vector2), 414, (float)Main.rand.Next(51, 101) * 0.01f);
44884 }
44885 else if (Main.rand.Next(80) == 0)
44886 {
44887 num3 = Gore.NewGore(new Vector2(x, y), default(Vector2), 413, (float)Main.rand.Next(51, 101) * 0.01f);
44888 }
44889 else if (Main.rand.Next(10) == 0)
44890 {
44891 num3 = Gore.NewGore(new Vector2(x, y), default(Vector2), 412, (float)Main.rand.Next(51, 101) * 0.01f);
44892 }
44893 else if (Main.rand.Next(3) == 0)
44894 {
44895 num3 = Gore.NewGore(new Vector2(x, y), default(Vector2), 411, (float)Main.rand.Next(51, 101) * 0.01f);
44896 }
44897 if (num3 >= 0)
44898 {
44899 Main.gore[num3].velocity.X += direction * 2;
44900 Main.gore[num3].velocity.Y *= 0.3f;
44901 }
44902 }
44903 if (sItem.type == 3542)
44904 {
44905 dontAttack = true;
44906 }
44907 if (sItem.type == 3779)
44908 {
44909 dontAttack = true;
44910 Vector2 vector = itemLocation + new Vector2((float)(direction * 30), -8f);
44911 Vector2 vector2 = vector - position;
44912 for (float num4 = 0f; num4 < 1f; num4 += 0.2f)
44913 {
44914 Vector2 vector3 = Vector2.Lerp(oldPosition + vector2 + new Vector2(0f, gfxOffY), vector, num4);
44915 Dust obj = Main.dust[Dust.NewDust(vector - Vector2.One * 8f, 16, 16, 27, 0f, -2f)];
44916 obj.noGravity = true;
44917 obj.position = vector3;
44918 obj.velocity = new Vector2(0f, (0f - gravDir) * 2f);
44919 obj.scale = 1.2f;
44920 obj.alpha = 200;
44921 }
44922 }
44923 }
Vector2 oldPosition
Definition Entity.cs:35
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
static void UseItemHitbox(Item item, Player player, ref Rectangle hitbox, ref bool noHitbox)
Calls ModItem.UseItemHitbox, then all GlobalItem.UseItemHitbox hooks.
This serves as the central class from which item-related functions are carried out....
Definition ItemLoader.cs:26
int itemAnimationMax
Definition Player.cs:3127
float gfxOffY
An offset from the actual position of the player that will be added to the draw position....
Definition Player.cs:1814
float GetAdjustedItemScale(Item item)
Used to determine what the overall scale of an item should be. M:Terraria.ModLoader....
Definition Player.cs:41782
Vector2 itemLocation
Definition Player.cs:1670

References Terraria.Main.dedServ, Terraria.Entity.direction, Terraria.Main.dust, Terraria.Player.GetAdjustedItemScale(), Terraria.Player.gfxOffY, Terraria.Main.gore, Terraria.Player.gravDir, Terraria.Player.itemAnimation, Terraria.Player.itemAnimationMax, Terraria.Player.itemLocation, Terraria.Dust.NewDust(), Terraria.Gore.NewGore(), Terraria.Entity.oldPosition, Terraria.Entity.position, Terraria.Main.rand, and Terraria.ModLoader.ItemLoader.UseItemHitbox().

Referenced by Terraria.Player.ItemCheck_OwnerOnlyCode().

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