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

◆ GetSwingStats()

Tuple< Vector2, float > Terraria.NPC.GetSwingStats ( int swingMax,
int swingCurrent,
int aimDir,
int itemWidth,
int itemHeight )
inline

Definition at line 71951 of file NPC.cs.

71952 {
71953 //IL_0000: Unknown result type (might be due to invalid IL or missing references)
71954 //IL_0005: Unknown result type (might be due to invalid IL or missing references)
71955 //IL_004f: Unknown result type (might be due to invalid IL or missing references)
71956 //IL_00d6: Unknown result type (might be due to invalid IL or missing references)
71957 //IL_0203: Unknown result type (might be due to invalid IL or missing references)
71958 //IL_0182: Unknown result type (might be due to invalid IL or missing references)
71959 Vector2 zero = Vector2.Zero;
71960 if ((double)swingCurrent < (double)swingMax * 0.333)
71961 {
71962 float num = 10f;
71963 if (itemWidth > 32)
71964 {
71965 num = 14f;
71966 }
71967 if (itemWidth >= 52)
71968 {
71969 num = 24f;
71970 }
71971 if (itemWidth >= 64)
71972 {
71973 num = 28f;
71974 }
71975 if (itemWidth >= 92)
71976 {
71977 num = 38f;
71978 }
71979 zero.X = base.Center.X + ((float)itemWidth * 0.5f - num) * (float)aimDir;
71980 zero.Y = position.Y + 24f;
71981 }
71982 else if ((double)swingCurrent < (double)swingMax * 0.666)
71983 {
71984 float num2 = 10f;
71985 if (itemWidth > 32)
71986 {
71987 num2 = 18f;
71988 }
71989 if (itemWidth >= 52)
71990 {
71991 num2 = 24f;
71992 }
71993 if (itemWidth >= 64)
71994 {
71995 num2 = 28f;
71996 }
71997 if (itemWidth >= 92)
71998 {
71999 num2 = 38f;
72000 }
72001 zero.X = base.Center.X + ((float)itemWidth * 0.5f - num2) * (float)aimDir;
72002 num2 = 10f;
72003 if (itemHeight > 32)
72004 {
72005 num2 = 8f;
72006 }
72007 if (itemHeight > 52)
72008 {
72009 num2 = 12f;
72010 }
72011 if (itemHeight > 64)
72012 {
72013 num2 = 14f;
72014 }
72015 zero.Y = position.Y + num2;
72016 }
72017 else
72018 {
72019 float num3 = 6f;
72020 if (itemWidth > 32)
72021 {
72022 num3 = 14f;
72023 }
72024 if (itemWidth >= 48)
72025 {
72026 num3 = 18f;
72027 }
72028 if (itemWidth >= 52)
72029 {
72030 num3 = 24f;
72031 }
72032 if (itemWidth >= 64)
72033 {
72034 num3 = 28f;
72035 }
72036 if (itemWidth >= 92)
72037 {
72038 num3 = 38f;
72039 }
72040 zero.X = base.Center.X - ((float)itemWidth * 0.5f - num3) * (float)aimDir;
72041 num3 = 10f;
72042 if (itemHeight > 32)
72043 {
72044 num3 = 10f;
72045 }
72046 if (itemHeight > 52)
72047 {
72048 num3 = 12f;
72049 }
72050 if (itemHeight > 64)
72051 {
72052 num3 = 14f;
72053 }
72054 zero.Y = position.Y + num3;
72055 }
72056 float item = ((float)swingCurrent / (float)swingMax - 0.5f) * (float)(-aimDir) * 3.5f - (float)aimDir * 0.3f;
72057 return Tuple.Create<Vector2, float>(zero, item);
72058 }

Referenced by Terraria.NPC.AI_007_TownEntities().

+ Here is the caller graph for this function: