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

◆ ItemCheck_Inner()

void Terraria.Player.ItemCheck_Inner ( )
inlineprivate

Definition at line 41833 of file Player.cs.

41834 {
41835 //IL_0486: Unknown result type (might be due to invalid IL or missing references)
41836 //IL_048b: Unknown result type (might be due to invalid IL or missing references)
41837 //IL_05da: Unknown result type (might be due to invalid IL or missing references)
41838 //IL_05cd: Unknown result type (might be due to invalid IL or missing references)
41839 //IL_04e3: Unknown result type (might be due to invalid IL or missing references)
41840 //IL_04f0: Unknown result type (might be due to invalid IL or missing references)
41841 //IL_0614: Unknown result type (might be due to invalid IL or missing references)
41842 //IL_09b4: Unknown result type (might be due to invalid IL or missing references)
41843 //IL_09d8: Unknown result type (might be due to invalid IL or missing references)
41844 //IL_09de: Unknown result type (might be due to invalid IL or missing references)
41845 //IL_0b01: Unknown result type (might be due to invalid IL or missing references)
41846 //IL_0b1c: Unknown result type (might be due to invalid IL or missing references)
41847 //IL_0b22: Unknown result type (might be due to invalid IL or missing references)
41848 //IL_0b24: Unknown result type (might be due to invalid IL or missing references)
41849 //IL_0b33: Unknown result type (might be due to invalid IL or missing references)
41850 //IL_0b38: Unknown result type (might be due to invalid IL or missing references)
41851 //IL_0b3d: Unknown result type (might be due to invalid IL or missing references)
41852 //IL_0c93: Unknown result type (might be due to invalid IL or missing references)
41853 //IL_0cae: Unknown result type (might be due to invalid IL or missing references)
41854 //IL_0cb4: Unknown result type (might be due to invalid IL or missing references)
41855 //IL_0cb6: Unknown result type (might be due to invalid IL or missing references)
41856 //IL_0cc5: Unknown result type (might be due to invalid IL or missing references)
41857 //IL_0cca: Unknown result type (might be due to invalid IL or missing references)
41858 //IL_0ccf: Unknown result type (might be due to invalid IL or missing references)
41859 //IL_0b58: Unknown result type (might be due to invalid IL or missing references)
41860 //IL_0b5d: Unknown result type (might be due to invalid IL or missing references)
41861 //IL_0b5f: Unknown result type (might be due to invalid IL or missing references)
41862 //IL_0b76: Unknown result type (might be due to invalid IL or missing references)
41863 //IL_0b7c: Unknown result type (might be due to invalid IL or missing references)
41864 //IL_0a27: Unknown result type (might be due to invalid IL or missing references)
41865 //IL_0a63: Unknown result type (might be due to invalid IL or missing references)
41866 //IL_0a69: Unknown result type (might be due to invalid IL or missing references)
41867 //IL_0e32: Unknown result type (might be due to invalid IL or missing references)
41868 //IL_0e37: Unknown result type (might be due to invalid IL or missing references)
41869 //IL_0cea: Unknown result type (might be due to invalid IL or missing references)
41870 //IL_0cef: Unknown result type (might be due to invalid IL or missing references)
41871 //IL_0cf1: Unknown result type (might be due to invalid IL or missing references)
41872 //IL_0d05: Unknown result type (might be due to invalid IL or missing references)
41873 //IL_0d0b: Unknown result type (might be due to invalid IL or missing references)
41874 //IL_0a95: Unknown result type (might be due to invalid IL or missing references)
41875 //IL_0ab9: Unknown result type (might be due to invalid IL or missing references)
41876 //IL_0abf: Unknown result type (might be due to invalid IL or missing references)
41877 //IL_0f9c: Unknown result type (might be due to invalid IL or missing references)
41878 //IL_0e64: Unknown result type (might be due to invalid IL or missing references)
41879 //IL_0e69: Unknown result type (might be due to invalid IL or missing references)
41880 //IL_0e6d: Unknown result type (might be due to invalid IL or missing references)
41881 //IL_0e72: Unknown result type (might be due to invalid IL or missing references)
41882 //IL_11b5: Unknown result type (might be due to invalid IL or missing references)
41883 //IL_1041: Unknown result type (might be due to invalid IL or missing references)
41884 //IL_0e7a: Unknown result type (might be due to invalid IL or missing references)
41885 //IL_0e7f: Unknown result type (might be due to invalid IL or missing references)
41886 //IL_0e96: Unknown result type (might be due to invalid IL or missing references)
41887 //IL_0e9c: Unknown result type (might be due to invalid IL or missing references)
41888 //IL_0eb0: Unknown result type (might be due to invalid IL or missing references)
41889 //IL_0eb2: Unknown result type (might be due to invalid IL or missing references)
41890 //IL_0eb9: Unknown result type (might be due to invalid IL or missing references)
41891 //IL_0ec3: Unknown result type (might be due to invalid IL or missing references)
41892 //IL_0ec8: Unknown result type (might be due to invalid IL or missing references)
41893 //IL_125a: Unknown result type (might be due to invalid IL or missing references)
41894 //IL_0fb8: Unknown result type (might be due to invalid IL or missing references)
41895 //IL_0ff2: Unknown result type (might be due to invalid IL or missing references)
41896 //IL_1003: Unknown result type (might be due to invalid IL or missing references)
41897 //IL_100d: Unknown result type (might be due to invalid IL or missing references)
41898 //IL_1012: Unknown result type (might be due to invalid IL or missing references)
41899 //IL_11d1: Unknown result type (might be due to invalid IL or missing references)
41900 //IL_120b: Unknown result type (might be due to invalid IL or missing references)
41901 //IL_121c: Unknown result type (might be due to invalid IL or missing references)
41902 //IL_1226: Unknown result type (might be due to invalid IL or missing references)
41903 //IL_122b: Unknown result type (might be due to invalid IL or missing references)
41904 //IL_105c: Unknown result type (might be due to invalid IL or missing references)
41905 //IL_1096: Unknown result type (might be due to invalid IL or missing references)
41906 //IL_10a7: Unknown result type (might be due to invalid IL or missing references)
41907 //IL_10b1: Unknown result type (might be due to invalid IL or missing references)
41908 //IL_10b6: Unknown result type (might be due to invalid IL or missing references)
41909 //IL_14ff: Unknown result type (might be due to invalid IL or missing references)
41910 //IL_150c: Unknown result type (might be due to invalid IL or missing references)
41911 //IL_1512: Unknown result type (might be due to invalid IL or missing references)
41912 //IL_1514: Unknown result type (might be due to invalid IL or missing references)
41913 //IL_1519: Unknown result type (might be due to invalid IL or missing references)
41914 //IL_1275: Unknown result type (might be due to invalid IL or missing references)
41915 //IL_12af: Unknown result type (might be due to invalid IL or missing references)
41916 //IL_12c0: Unknown result type (might be due to invalid IL or missing references)
41917 //IL_12ca: Unknown result type (might be due to invalid IL or missing references)
41918 //IL_12cf: Unknown result type (might be due to invalid IL or missing references)
41919 //IL_10ff: Unknown result type (might be due to invalid IL or missing references)
41920 //IL_1121: Unknown result type (might be due to invalid IL or missing references)
41921 //IL_1132: Unknown result type (might be due to invalid IL or missing references)
41922 //IL_113c: Unknown result type (might be due to invalid IL or missing references)
41923 //IL_1141: Unknown result type (might be due to invalid IL or missing references)
41924 //IL_155a: Unknown result type (might be due to invalid IL or missing references)
41925 //IL_157e: Unknown result type (might be due to invalid IL or missing references)
41926 //IL_1581: Unknown result type (might be due to invalid IL or missing references)
41927 //IL_1586: Unknown result type (might be due to invalid IL or missing references)
41928 //IL_158b: Unknown result type (might be due to invalid IL or missing references)
41929 //IL_158d: Unknown result type (might be due to invalid IL or missing references)
41930 //IL_15a1: Unknown result type (might be due to invalid IL or missing references)
41931 //IL_15a7: Unknown result type (might be due to invalid IL or missing references)
41932 //IL_15bd: Unknown result type (might be due to invalid IL or missing references)
41933 //IL_15bf: Unknown result type (might be due to invalid IL or missing references)
41934 //IL_15da: Unknown result type (might be due to invalid IL or missing references)
41935 //IL_15df: Unknown result type (might be due to invalid IL or missing references)
41936 //IL_12fe: Unknown result type (might be due to invalid IL or missing references)
41937 //IL_1320: Unknown result type (might be due to invalid IL or missing references)
41938 //IL_1331: Unknown result type (might be due to invalid IL or missing references)
41939 //IL_133b: Unknown result type (might be due to invalid IL or missing references)
41940 //IL_1340: Unknown result type (might be due to invalid IL or missing references)
41941 if (CCed)
41942 {
41943 channel = false;
41945 return;
41946 }
41948 Item item = inventory[selectedItem];
41949 ItemCheckContext context = default(ItemCheckContext);
41950 bool flag = false;
41951 if (Main.myPlayer == whoAmI)
41952 {
41954 {
41955 controlUseItem = true;
41956 flag = true;
41957 }
41958 if (!cursorItemIconEnabled && item.stack > 0 && item.fishingPole > 0)
41959 {
41960 Fishing_GetBait(out var bait);
41961 if (bait != null)
41962 {
41963 cursorItemIconEnabled = true;
41964 cursorItemIconID = bait.type;
41966 }
41967 }
41968 if (!cursorItemIconEnabled && item.stack > 0 && (item.type == 779 || item.type == 5134))
41969 {
41970 for (int i = 54; i < 58; i++)
41971 {
41972 if (inventory[i].ammo == item.useAmmo && inventory[i].stack > 0)
41973 {
41974 cursorItemIconEnabled = true;
41976 cursorItemIconPush = 10;
41977 break;
41978 }
41979 }
41981 {
41982 for (int j = 0; j < 54; j++)
41983 {
41984 if (inventory[j].ammo == item.useAmmo && inventory[j].stack > 0)
41985 {
41986 cursorItemIconEnabled = true;
41988 cursorItemIconPush = 10;
41989 break;
41990 }
41991 }
41992 }
41993 }
41994 }
41995 if (itemAnimation > 0)
41996 {
41997 itemAnimation--;
41998 if (itemAnimation == 0 && whoAmI == Main.myPlayer)
41999 {
42001 }
42002 }
42003 if (itemTime > 0)
42004 {
42005 itemTime--;
42006 if (ItemTimeIsZero && whoAmI == Main.myPlayer && !JustDroppedAnItem)
42007 {
42008 int type = item.type;
42009 if (type == 65 || type == 724 || type == 989 || type == 1226)
42010 {
42012 }
42013 }
42014 }
42016 {
42017 selectItemOnNextUse = false;
42018 int oldSelect = selectedItem;
42020 if (selectedItem != oldSelect)
42021 {
42022 item = inventory[selectedItem];
42023 releaseUseItem = true;
42024 itemTime = (itemTimeMax = 0);
42025 }
42026 }
42028 int weaponDamage = GetWeaponDamage(item);
42031 if (itemAnimation < 0)
42032 {
42033 itemAnimation = 0;
42034 }
42035 if (itemTime < 0)
42036 {
42037 itemTime = 0;
42038 }
42039 if (itemAnimation == 0 && reuseDelay > 0)
42040 {
42042 }
42044 if (itemAnimation == 0 && altFunctionUse == 2)
42045 {
42046 altFunctionUse = 0;
42047 }
42048 bool flag2 = true;
42049 if (gravDir == -1f && GolfHelper.IsPlayerHoldingClub(this))
42050 {
42051 flag2 = false;
42052 }
42053 if (flag2 && controlUseItem && releaseUseItem && itemAnimation == 0 && item.useStyle != 0)
42054 {
42055 if (altFunctionUse == 1)
42056 {
42057 altFunctionUse = 2;
42058 }
42059 if (item.shoot == 0)
42060 {
42061 itemRotation = 0f;
42062 }
42063 bool flag3 = ItemCheck_CheckCanUse(item);
42064 if (item.potion && flag3)
42065 {
42066 ApplyPotionDelay(item);
42067 }
42068 if (item.mana > 0 && flag3 && whoAmI == Main.myPlayer && item.buffType != 0 && item.buffTime != 0)
42069 {
42070 AddBuff(item.buffType, item.buffTime);
42071 }
42072 if (item.shoot <= 0 || !ProjectileID.Sets.MinionTargettingFeature[item.shoot] || altFunctionUse != 2)
42073 {
42075 }
42076 if (whoAmI == Main.myPlayer && gravDir == 1f && item.mountType != -1 && mount.CanMount(item.mountType, this))
42077 {
42078 mount.SetMount(item.mountType, this);
42079 }
42080 if ((item.shoot <= 0 || !ProjectileID.Sets.MinionTargettingFeature[item.shoot] || altFunctionUse != 2) && flag3 && whoAmI == Main.myPlayer && item.shoot >= 0 && (ProjectileID.Sets.LightPet[item.shoot] || Main.projPet[item.shoot]))
42081 {
42083 }
42084 if (flag3)
42085 {
42087 }
42088 }
42089 bool flag4 = controlUseItem;
42090 if (mount.Active && mount.Type == 8)
42091 {
42093 }
42094 if (!flag4)
42095 {
42096 channel = false;
42097 }
42098 Item item2 = ((itemAnimation > 0) ? lastVisualizedSelectedItem : item);
42099 Rectangle drawHitbox = Item.GetDrawHitbox(item2.type, this);
42100 compositeFrontArm.enabled = false;
42101 compositeBackArm.enabled = false;
42102 if (itemAnimation > 0)
42103 {
42104 if (item.mana > 0)
42105 {
42107 }
42108 if (Main.dedServ)
42109 {
42110 itemHeight = item.height;
42111 itemWidth = item.width;
42112 }
42113 else
42114 {
42115 itemHeight = drawHitbox.Height;
42116 itemWidth = drawHitbox.Width;
42117 }
42118 }
42120 ItemLoader.HoldItem(item, this);
42121 if (itemAnimation > 0)
42122 {
42124 }
42125 else
42126 {
42128 }
42129 if (!JustDroppedAnItem)
42130 {
42134 _ = whoAmI;
42135 _ = Main.myPlayer;
42137 if (ItemTimeIsZero && itemAnimation > 0)
42138 {
42139 if (ItemLoader.UseItem(item, this) == true)
42140 {
42141 ApplyItemTime(item, 1f, false);
42142 }
42143 if (item.hairDye >= 0)
42144 {
42145 ApplyItemTime(item);
42146 if (whoAmI == Main.myPlayer)
42147 {
42148 hairDye = item.hairDye;
42149 NetMessage.SendData(4, -1, -1, null, whoAmI);
42150 }
42151 }
42152 if (item.healLife > 0 || item.healMana > 0)
42153 {
42154 ApplyLifeAndOrMana(item);
42155 ApplyItemTime(item);
42156 if (Main.myPlayer == whoAmI && item.type == 126 && breath == 0)
42157 {
42159 }
42160 }
42161 if (item.buffType > 0)
42162 {
42163 if (whoAmI == Main.myPlayer && item.buffType != 90 && item.buffType != 27)
42164 {
42165 AddBuff(item.buffType, item.buffTime);
42166 }
42167 ApplyItemTime(item);
42168 }
42169 if (item.type == 678)
42170 {
42171 if (Main.getGoodWorld)
42172 {
42173 ApplyItemTime(item);
42174 if (whoAmI == Main.myPlayer)
42175 {
42176 for (int k = 0; k < 3; k++)
42177 {
42178 int type2 = 0;
42179 int timeToAdd = 108000;
42180 switch (Main.rand.Next(18))
42181 {
42182 case 0:
42183 type2 = 16;
42184 break;
42185 case 1:
42186 type2 = 111;
42187 break;
42188 case 2:
42189 type2 = 114;
42190 break;
42191 case 3:
42192 type2 = 8;
42193 break;
42194 case 4:
42195 type2 = 105;
42196 break;
42197 case 5:
42198 type2 = 17;
42199 break;
42200 case 6:
42201 type2 = 116;
42202 break;
42203 case 7:
42204 type2 = 5;
42205 break;
42206 case 8:
42207 type2 = 113;
42208 break;
42209 case 9:
42210 type2 = 7;
42211 break;
42212 case 10:
42213 type2 = 6;
42214 break;
42215 case 11:
42216 type2 = 104;
42217 break;
42218 case 12:
42219 type2 = 115;
42220 break;
42221 case 13:
42222 type2 = 2;
42223 break;
42224 case 14:
42225 type2 = 9;
42226 break;
42227 case 15:
42228 type2 = 3;
42229 break;
42230 case 16:
42231 type2 = 117;
42232 break;
42233 case 17:
42234 type2 = 1;
42235 break;
42236 }
42238 }
42239 }
42240 }
42241 else
42242 {
42243 ApplyItemTime(item);
42244 if (whoAmI == Main.myPlayer)
42245 {
42246 AddBuff(20, 216000);
42247 AddBuff(22, 216000);
42248 AddBuff(23, 216000);
42249 AddBuff(24, 216000);
42250 AddBuff(30, 216000);
42251 AddBuff(31, 216000);
42252 AddBuff(32, 216000);
42253 AddBuff(33, 216000);
42254 AddBuff(35, 216000);
42255 AddBuff(36, 216000);
42256 AddBuff(68, 216000);
42257 }
42258 }
42259 }
42260 }
42261 if ((item.type == 50 || item.type == 3124 || item.type == 3199 || item.type == 5358) && itemAnimation > 0)
42262 {
42263 if (Main.rand.Next(2) == 0)
42264 {
42265 Dust.NewDust(position, width, height, 15, 0f, 0f, 150, default(Color), 1.1f);
42266 }
42267 if (ItemTimeIsZero)
42268 {
42269 ApplyItemTime(item);
42270 }
42271 else if (itemTime == itemTimeMax / 2)
42272 {
42273 for (int l = 0; l < 70; l++)
42274 {
42275 Dust.NewDust(position, width, height, 15, velocity.X * 0.5f, velocity.Y * 0.5f, 150, default(Color), 1.5f);
42276 }
42278 Spawn(PlayerSpawnContext.RecallFromItem);
42279 for (int m = 0; m < 70; m++)
42280 {
42281 Dust.NewDust(position, width, height, 15, 0f, 0f, 150, default(Color), 1.5f);
42282 }
42283 }
42284 }
42285 if ((item.type == 4263 || item.type == 5360) && itemAnimation > 0)
42286 {
42287 Vector2 vector = Vector2.UnitY.RotatedBy((float)itemAnimation * ((float)Math.PI * 2f) / 30f) * new Vector2(15f, 0f);
42288 for (int n = 0; n < 2; n++)
42289 {
42290 if (Main.rand.Next(3) == 0)
42291 {
42292 Dust dust = Dust.NewDustPerfect(base.Bottom + vector, Dust.dustWater());
42293 dust.velocity.Y *= 0f;
42294 dust.velocity.Y -= 4.5f;
42295 dust.velocity.X *= 1.5f;
42296 dust.scale = 0.8f;
42297 dust.alpha = 130;
42298 dust.noGravity = true;
42299 dust.fadeIn = 1.1f;
42300 }
42301 }
42302 if (ItemTimeIsZero)
42303 {
42304 ApplyItemTime(item);
42305 }
42306 else if (itemTime == item.useTime / 2)
42307 {
42308 if (Main.netMode == 0)
42309 {
42310 MagicConch();
42311 }
42312 else if (Main.netMode == 1 && whoAmI == Main.myPlayer)
42313 {
42314 NetMessage.SendData(73, -1, -1, null, 1);
42315 }
42316 }
42317 }
42318 if ((item.type == 4819 || item.type == 5361) && itemAnimation > 0)
42319 {
42320 Vector2 vector2 = Vector2.UnitY.RotatedBy((float)itemAnimation * ((float)Math.PI * 2f) / 30f) * new Vector2(15f, 0f);
42321 for (int num = 0; num < 2; num++)
42322 {
42323 if (Main.rand.Next(3) == 0)
42324 {
42325 Dust dust2 = Dust.NewDustPerfect(base.Bottom + vector2, 35);
42326 dust2.velocity.Y *= 0f;
42327 dust2.velocity.Y -= 4.5f;
42328 dust2.velocity.X *= 1.5f;
42329 dust2.scale = 0.8f;
42330 dust2.alpha = 130;
42331 dust2.noGravity = true;
42332 dust2.fadeIn = 1.1f;
42333 }
42334 }
42335 if (ItemTimeIsZero)
42336 {
42337 ApplyItemTime(item);
42338 }
42339 else if (itemTime == item.useTime / 2)
42340 {
42341 if (Main.netMode == 0)
42342 {
42343 DemonConch();
42344 }
42345 else if (Main.netMode == 1 && whoAmI == Main.myPlayer)
42346 {
42347 NetMessage.SendData(73, -1, -1, null, 2);
42348 }
42349 }
42350 }
42351 if (item.type == 5359 && itemAnimation > 0)
42352 {
42353 if (Main.rand.Next(2) == 0)
42354 {
42355 int num8 = Main.rand.Next(4);
42356 Color color = Color.Green;
42357 switch (num8)
42358 {
42359 case 0:
42360 case 1:
42361 ((Color)(ref color))._002Ector(100, 255, 100);
42362 break;
42363 case 2:
42364 color = Color.Yellow;
42365 break;
42366 case 3:
42367 color = Color.White;
42368 break;
42369 }
42370 Dust dust3 = Dust.NewDustPerfect(Main.rand.NextVector2FromRectangle(base.Hitbox), 267);
42371 dust3.noGravity = true;
42372 dust3.color = color;
42373 dust3.velocity *= 2f;
42374 dust3.scale = 0.8f + Main.rand.NextFloat() * 0.6f;
42375 }
42376 if (ItemTimeIsZero)
42377 {
42378 ApplyItemTime(item);
42379 }
42380 else if (itemTime == item.useTime / 2)
42381 {
42382 if (Main.netMode == 0)
42383 {
42385 }
42386 else if (Main.netMode == 1 && whoAmI == Main.myPlayer)
42387 {
42388 NetMessage.SendData(73, -1, -1, null, 3);
42389 }
42390 }
42391 }
42392 if (item.type == 2350 && itemAnimation > 0)
42393 {
42394 if (ItemTimeIsZero)
42395 {
42396 ApplyItemTime(item);
42398 for (int num9 = 0; num9 < 10; num9++)
42399 {
42400 Dust obj = Main.dust[Dust.NewDust(position, width, height, 15, velocity.X * 0.2f, velocity.Y * 0.2f, 150, Color.Cyan, 1.2f)];
42401 obj.velocity *= 0.5f;
42402 }
42403 }
42404 else if (itemTime == 20)
42405 {
42407 for (int num10 = 0; num10 < 70; num10++)
42408 {
42409 Dust obj2 = Main.dust[Dust.NewDust(position, width, height, 15, velocity.X * 0.2f, velocity.Y * 0.2f, 150, Color.Cyan, 1.2f)];
42410 obj2.velocity *= 0.5f;
42411 }
42413 bool flag5 = immune;
42414 int num11 = immuneTime;
42415 Spawn(PlayerSpawnContext.RecallFromItem);
42416 immune = flag5;
42417 immuneTime = num11;
42418 for (int num12 = 0; num12 < 70; num12++)
42419 {
42420 Dust obj3 = Main.dust[Dust.NewDust(position, width, height, 15, 0f, 0f, 150, Color.Cyan, 1.2f)];
42421 obj3.velocity *= 0.5f;
42422 }
42423 if (ItemLoader.ConsumeItem(item, this) && item.stack > 0)
42424 {
42425 item.stack--;
42426 }
42427 }
42428 }
42429 if (item.type == 4870 && itemAnimation > 0)
42430 {
42431 if (ItemTimeIsZero)
42432 {
42433 ApplyItemTime(item);
42435 for (int num13 = 0; num13 < 10; num13++)
42436 {
42437 Dust obj4 = Main.dust[Dust.NewDust(position, width, height, 15, velocity.X * 0.2f, velocity.Y * 0.2f, 150, Color.Cyan, 1.2f)];
42438 obj4.velocity *= 0.5f;
42439 }
42440 }
42441 else if (itemTime == 20)
42442 {
42444 for (int num14 = 0; num14 < 70; num14++)
42445 {
42446 Dust obj5 = Main.dust[Dust.NewDust(position, width, height, 15, velocity.X * 0.2f, velocity.Y * 0.2f, 150, Color.Cyan, 1.2f)];
42447 obj5.velocity *= 0.5f;
42448 }
42449 if (whoAmI == Main.myPlayer)
42450 {
42452 }
42453 for (int num15 = 0; num15 < 70; num15++)
42454 {
42455 Dust obj6 = Main.dust[Dust.NewDust(position, width, height, 15, 0f, 0f, 150, Color.Cyan, 1.2f)];
42456 obj6.velocity *= 0.5f;
42457 }
42458 if (ItemLoader.ConsumeItem(item, this) && item.stack > 0)
42459 {
42460 item.stack--;
42461 }
42462 }
42463 }
42464 if (item.type == 2351 && itemAnimation > 0)
42465 {
42466 if (ItemTimeIsZero)
42467 {
42468 ApplyItemTime(item);
42469 }
42470 else if (itemTime == 2)
42471 {
42472 if (Main.netMode == 0)
42473 {
42475 }
42476 else if (Main.netMode == 1 && whoAmI == Main.myPlayer)
42477 {
42478 NetMessage.SendData(73);
42479 }
42480 if (ItemLoader.ConsumeItem(item, this) && item.stack > 0)
42481 {
42482 item.stack--;
42483 }
42484 }
42485 }
42486 if (item.type == 2756 && itemAnimation > 0)
42487 {
42488 if (ItemTimeIsZero)
42489 {
42490 ApplyItemTime(item);
42491 }
42492 else if (itemTime == 2)
42493 {
42494 if (whoAmI == Main.myPlayer)
42495 {
42496 Male = !Male;
42497 if (Main.netMode == 1)
42498 {
42499 NetMessage.SendData(4, -1, -1, null, whoAmI);
42500 }
42501 }
42502 if (ItemLoader.ConsumeItem(item, this) && item.stack > 0)
42503 {
42504 item.stack--;
42505 }
42506 }
42507 else
42508 {
42509 float num2 = itemTimeMax;
42510 num2 = (num2 - (float)itemTime) / num2;
42511 float num3 = 44f;
42512 float num4 = (float)Math.PI * 3f;
42513 Vector2 vector3 = Utils.RotatedBy(new Vector2(15f, 0f), num4 * num2);
42514 vector3.X *= direction;
42515 Vector2 vector4 = default(Vector2);
42516 for (int num5 = 0; num5 < 2; num5++)
42517 {
42518 int type3 = 221;
42519 if (num5 == 1)
42520 {
42521 vector3.X *= -1f;
42522 type3 = 219;
42523 }
42524 ((Vector2)(ref vector4))._002Ector(vector3.X, num3 * (1f - num2) - num3 + (float)(height / 2));
42525 vector4 += base.Center;
42526 int num6 = Dust.NewDust(vector4, 0, 0, type3, 0f, 0f, 100);
42527 Main.dust[num6].position = vector4;
42528 Main.dust[num6].noGravity = true;
42529 Main.dust[num6].velocity = Vector2.Zero;
42530 Main.dust[num6].scale = 1.3f;
42531 Main.dust[num6].customData = this;
42532 }
42533 }
42534 }
42535 if (whoAmI == Main.myPlayer)
42536 {
42537 if ((itemTimeMax != 0 && itemTime == itemTimeMax) | (!item.IsAir && item.IsNotTheSameAs(lastVisualizedSelectedItem)))
42538 {
42540 }
42541 }
42542 else
42543 {
42545 }
42546 if (whoAmI == Main.myPlayer)
42547 {
42548 if (!dontConsumeWand && itemTimeMax != 0 && itemTime == itemTimeMax && item.tileWand > 0)
42549 {
42550 int tileWand = item.tileWand;
42551 for (int num7 = 0; num7 < 58; num7++)
42552 {
42553 if (tileWand == inventory[num7].type && inventory[num7].stack > 0)
42554 {
42556 {
42557 inventory[num7].stack--;
42558 }
42559 if (inventory[num7].stack <= 0)
42560 {
42561 inventory[num7] = new Item();
42562 }
42563 break;
42564 }
42565 }
42566 }
42567 if (itemTimeMax != 0 && itemTime == itemTimeMax && item.consumable && !context.SkipItemConsumption)
42568 {
42569 bool flag6 = true;
42570 if (item.ranged)
42571 {
42572 if (huntressAmmoCost90 && Main.rand.Next(10) == 0)
42573 {
42574 flag6 = false;
42575 }
42576 if (chloroAmmoCost80 && Main.rand.Next(5) == 0)
42577 {
42578 flag6 = false;
42579 }
42580 if (ammoCost80 && Main.rand.Next(5) == 0)
42581 {
42582 flag6 = false;
42583 }
42584 if (ammoCost75 && Main.rand.Next(4) == 0)
42585 {
42586 flag6 = false;
42587 }
42588 }
42589 if (item.CountsAsClass(DamageClass.Throwing))
42590 {
42591 if (ThrownCost50 && Main.rand.Next(100) < 50)
42592 {
42593 flag6 = false;
42594 }
42595 if (ThrownCost33 && Main.rand.Next(100) < 33)
42596 {
42597 flag6 = false;
42598 }
42599 }
42600 if (item.IsACoin)
42601 {
42602 flag6 = true;
42603 }
42604 bool? flag7 = ItemID.Sets.ForceConsumption[item.type];
42605 if (flag7.HasValue)
42606 {
42607 flag6 = flag7.Value;
42608 }
42609 if (flag6 && ItemLoader.ConsumeItem(item, this))
42610 {
42611 if (item.stack > 0)
42612 {
42613 item.stack--;
42614 }
42615 if (item.stack <= 0)
42616 {
42618 Main.blockMouse = true;
42619 }
42620 }
42621 }
42622 if (item.stack <= 0 && itemAnimation == 0)
42623 {
42624 inventory[selectedItem] = new Item();
42625 }
42626 if (selectedItem == 58 && itemAnimation != 0)
42627 {
42628 Main.mouseItem = item.Clone();
42629 }
42630 }
42631 }
42632 if (itemAnimation == 0)
42633 {
42634 JustDroppedAnItem = false;
42635 }
42636 if (whoAmI == Main.myPlayer && flag)
42637 {
42639 }
42640 }
static SlotId PlaySound(in SoundStyle? style, Vector2? position=null, SoundUpdateCallback? updateCallback=null)
Attempts to play a sound style with the provided sound style (if it's not null), and returns a valid ...
int whoAmI
The index of this Entity within its specific array. These arrays track the entities in the world....
Definition Entity.cs:16
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
int width
The width of this Entity's hitbox, in pixels.
Definition Entity.cs:46
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
static void HandleSpecialEvent(Player player, int eventID)
static bool IsPlayerHoldingClub(Player player)
static ? bool[] ForceConsumption
If true for a given item type (F:Terraria.Item.type), then that item will always be consumed on use i...
Definition ItemID.cs:275
static bool[] MinionTargettingFeature
If true for a given projectile type (F:Terraria.Projectile.type), then any item that shoots that proj...
static bool[] LightPet
If true for a given projectile type (F:Terraria.Projectile.type), then that projectile is a light pet...
static readonly SoundStyle Item3
Definition SoundID.cs:683
SoundStyle? UseSound
The sound this item makes when used. Set this to an existing T:Terraria.ID.SoundID entry or assign to...
Definition Item.cs:534
Item Clone()
Definition Item.cs:51739
int tileWand
The numerical ID of the item this item consumes when used. If greater than 0, this item cannot be us...
Definition Item.cs:203
int stack
The current stack of the item. F:Terraria.Item.maxStack indicates the max possible stack.
Definition Item.cs:396
int useAmmo
The Ammo ID this weapon will consume. Ammo items with F:Terraria.Item.ammo set to this same AmmoID wi...
Definition Item.cs:618
int type
The Item ID of this item. The Item ID is a unique number assigned to each Item loaded into the game....
Definition Item.cs:345
static DamageClass Throwing
Class provided for modders who want to coordinate throwing accessories and items. Not used by any van...
T:Terraria.ModLoader.DamageClass is used to determine the application of item effects,...
static void HoldItem(Item item, Player player)
Calls ModItem.HoldItem and all GlobalItem.HoldItem hooks.
static bool ConsumeItem(Item item, Player player)
If ModItem.ConsumeItem or any of the GlobalItem.ConsumeItem hooks returns false, sets consume to fals...
static ? bool UseItem(Item item, Player player)
Returns false if any of ModItem.UseItem or GlobalItem.UseItem return false. Returns true if anything ...
This serves as the central class from which item-related functions are carried out....
Definition ItemLoader.cs:26
bool CanMount(int m, Player mountingPlayer)
Definition Mount.cs:6652
bool Active
Definition Mount.cs:348
void SetMount(int m, Player mountedPlayer, bool faceLeft=false)
Definition Mount.cs:6395
void ItemCheck_EmitDrinkParticles(Item sItem)
Definition Player.cs:42878
void ItemCheck_ApplyManaRegenDelay(Item sItem)
Definition Player.cs:51425
bool selectItemOnNextUse
Causes M:Terraria.Player.SmartSelectLookup to run the next time an item animation is finished,...
Definition Player.cs:3326
void MagicConch()
Definition Player.cs:56812
void Shellphone_Spawn()
Definition Player.cs:56900
int itemAnimationMax
Definition Player.cs:3127
bool cursorItemIconEnabled
Definition Player.cs:2002
int cursorItemIconID
Definition Player.cs:2006
void ItemCheck_HandleMount()
Definition Player.cs:53496
void ApplyPotionDelay(Item sItem)
Definition Player.cs:52671
float itemRotation
Definition Player.cs:1664
void EmitMaxManaEffect()
Definition Player.cs:50418
bool ItemTimeIsZero
Definition Player.cs:4402
void ApplyReuseDelay()
Definition Player.cs:53420
bool ThrownCost50
If true, player has a 50% chance of not consuming the thrown item. Only applies to consumable items ...
Definition Player.cs:4592
void ApplyLifeAndOrMana(Item item)
Definition Player.cs:52702
Item lastVisualizedSelectedItem
Definition Player.cs:1771
bool releaseUseItem
Definition Player.cs:1926
void SmartSelectLookup()
Definition Player.cs:15778
int GetWeaponDamage(Item sItem, bool forTooltip=false)
Definition Player.cs:53945
bool ItemCheck_CheckCanUse(Item sItem)
Definition Player.cs:52757
bool JustDroppedAnItem
Definition Player.cs:2603
void UpdatePlacementPreview(Item sItem)
Definition Player.cs:42642
void DoPotionOfReturnTeleportationAndSetTheComebackPoint()
Definition Player.cs:36438
bool ThrownCost33
If true, player has a 33% chance of not consuming the thrown item. Only applies to consumable items ...
Definition Player.cs:4584
void RemoveAllGrapplingHooks()
Definition Player.cs:31755
void TeleportationPotion()
Definition Player.cs:57003
Mount mount
This player's T:Terraria.Mount. Do not overwrite this value. Instead, call M:Terraria....
Definition Player.cs:2323
void ItemCheck_ApplyHoldStyle(float mountOffset, Item sItem, Rectangle heldItemFrame)
Definition Player.cs:51034
void ItemCheck_ApplyUseStyle(float mountOffset, Item sItem, Rectangle heldItemFrame)
Definition Player.cs:51554
void ItemCheck_EmitFoodParticles(Item sItem)
Definition Player.cs:42849
void ItemCheck_HackHoldStyles(Item sItem)
Definition Player.cs:53427
bool dontConsumeWand
Definition Player.cs:1073
void ApplyItemTime(Item sItem, float multiplier=1f, bool? callUseItem=null)
Definition Player.cs:4907
void ItemCheck_HandleMPItemAnimation(Item sItem)
Definition Player.cs:53464
void FreeUpPetsAndMinions(Item sItem)
Definition Player.cs:52550
void ItemCheck_OwnerOnlyCode(ref ItemCheckContext context, Item sItem, int weaponDamage, Rectangle heldItemFrame)
Definition Player.cs:42684
void ItemCheck_ApplyPetBuffs(Item sItem)
Definition Player.cs:53683
void AddBuff(int type, int timeToAdd, bool quiet=true, bool foodHack=false)
Gives the player the provided buff. This accounts for if the player is immune to the buff....
Definition Player.cs:5700
bool huntressAmmoCost90
Definition Player.cs:2166
bool chloroAmmoCost80
Definition Player.cs:2164
float HeightOffsetHitboxCenter
Definition Player.cs:3605
void DemonConch()
Definition Player.cs:56930
void Spawn(PlayerSpawnContext context)
Definition Player.cs:36486
int cursorItemIconPush
Definition Player.cs:2008
void ItemCheck_StartActualUse(Item sItem)
Definition Player.cs:52518
bool CCed
Checks if the player is currently "crowd controlled", meaning the player is F:Terraria....
Definition Player.cs:3716
void ItemCheck_EmitHeldItemLight(Item sItem)
Definition Player.cs:50437
Item[] inventory
The player's normal inventory. Indexes 0-9 hold the hotbar items, 10-49 the rest of the main inventor...
Definition Player.cs:1767
bool controlUseTile
Definition Player.cs:1906
bool controlUseItem
Definition Player.cs:1904
void Fishing_GetBait(out Item bait)
Definition Player.cs:41407

References Terraria.Mount.Active, Terraria.Player.AddBuff(), Terraria.Player.altFunctionUse, Terraria.Player.ammoCost75, Terraria.Player.ammoCost80, Terraria.Player.ApplyItemTime(), Terraria.Player.ApplyLifeAndOrMana(), Terraria.Player.ApplyPotionDelay(), Terraria.Player.ApplyReuseDelay(), Terraria.Player.breath, Terraria.Item.buffTime, Terraria.Item.buffType, Terraria.Mount.CanMount(), Terraria.Player.CCed, Terraria.Player.channel, Terraria.Player.chloroAmmoCost80, Terraria.Item.Clone(), Terraria.Item.consumable, Terraria.ModLoader.ItemLoader.ConsumeItem(), Terraria.Player.controlUseItem, Terraria.Player.controlUseTile, Terraria.Item.CountsAsClass(), Terraria.Player.cursorItemIconEnabled, Terraria.Player.cursorItemIconID, Terraria.Player.cursorItemIconPush, Terraria.Main.dedServ, Terraria.Player.DemonConch(), Terraria.Entity.direction, Terraria.Player.dontConsumeWand, Terraria.Player.DoPotionOfReturnTeleportationAndSetTheComebackPoint(), Terraria.Main.dust, Terraria.Dust.dustWater(), Terraria.Player.EmitMaxManaEffect(), Terraria.Player.Fishing_GetBait(), Terraria.Item.fishingPole, Terraria.ID.ItemID.Sets.ForceConsumption, Terraria.Player.FreeUpPetsAndMinions(), Terraria.Item.GetDrawHitbox(), Terraria.Main.getGoodWorld, Terraria.Player.GetWeaponDamage(), Terraria.Player.gravDir, Terraria.Item.hairDye, Terraria.Player.hairDye, Terraria.GameContent.Achievements.AchievementsHelper.HandleSpecialEvent(), Terraria.Item.healLife, Terraria.Item.healMana, Terraria.Entity.height, Terraria.Player.HeightOffsetHitboxCenter, Terraria.Player.HeldItem, Terraria.ModLoader.ItemLoader.HoldItem(), Terraria.Player.huntressAmmoCost90, Terraria.Player.immune, Terraria.Player.immuneTime, Terraria.Player.inventory, Terraria.Item.IsACoin, Terraria.Item.IsNotTheSameAs(), Terraria.GameContent.Golf.GolfHelper.IsPlayerHoldingClub(), Terraria.ID.SoundID.Item3, Terraria.Player.itemAnimation, Terraria.Player.itemAnimationMax, Terraria.Player.ItemCheck_ApplyHoldStyle(), Terraria.Player.ItemCheck_ApplyManaRegenDelay(), Terraria.Player.ItemCheck_ApplyPetBuffs(), Terraria.Player.ItemCheck_ApplyUseStyle(), Terraria.Player.ItemCheck_CheckCanUse(), Terraria.Player.ItemCheck_EmitDrinkParticles(), Terraria.Player.ItemCheck_EmitFoodParticles(), Terraria.Player.ItemCheck_EmitHeldItemLight(), Terraria.Player.ItemCheck_HackHoldStyles(), Terraria.Player.ItemCheck_HandleMount(), Terraria.Player.ItemCheck_HandleMPItemAnimation(), Terraria.Player.ItemCheck_OwnerOnlyCode(), Terraria.Player.ItemCheck_StartActualUse(), Terraria.Player.itemHeight, Terraria.Player.itemRotation, Terraria.Player.itemTime, Terraria.Player.ItemTimeIsZero, Terraria.Player.itemTimeMax, Terraria.Player.itemWidth, Terraria.Player.JustDroppedAnItem, Terraria.Player.lastVisualizedSelectedItem, Terraria.ID.ProjectileID.Sets.LightPet, Terraria.Player.MagicConch(), Terraria.Player.Male, Terraria.Item.mana, Terraria.ID.ProjectileID.Sets.MinionTargettingFeature, Terraria.Player.mount, Terraria.Item.mountType, Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.Dust.NewDust(), Terraria.Dust.NewDustPerfect(), Terraria.Audio.SoundEngine.PlaySound(), Terraria.Entity.position, Terraria.Item.potion, Terraria.Main.projPet, Terraria.Main.rand, Terraria.Item.ranged, Terraria.Player.releaseUseItem, Terraria.Player.RemoveAllGrapplingHooks(), Terraria.Player.reuseDelay, Terraria.Utils.RotatedBy(), Terraria.Player.selectedItem, Terraria.Player.selectItemOnNextUse, Terraria.NetMessage.SendData(), Terraria.Mount.SetMount(), Terraria.Player.Shellphone_Spawn(), Terraria.Item.shoot, Terraria.GameInput.PlayerInput.ShouldFastUseItem, Terraria.Player.SmartSelectLookup(), Terraria.Player.Spawn(), Terraria.Item.stack, Terraria.Player.TeleportationPotion(), Terraria.ModLoader.DamageClass.Throwing, Terraria.Player.ThrownCost33, Terraria.Player.ThrownCost50, Terraria.Item.tileWand, Terraria.GameInput.PlayerInput.TryEndingFastUse(), Terraria.Item.type, Terraria.Mount.Type, Terraria.Player.UpdatePlacementPreview(), Terraria.Item.useAmmo, Terraria.ModLoader.ItemLoader.UseItem(), Terraria.Item.UseSound, Terraria.Item.useStyle, Terraria.Item.useTime, Terraria.Entity.velocity, Terraria.Entity.whoAmI, and Terraria.Entity.width.

Referenced by Terraria.Player.ItemCheck().

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