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

◆ UpdateItem_VisualEffects()

void Terraria.Item.UpdateItem_VisualEffects ( )
inlineprivate

Definition at line 49220 of file Item.cs.

49221 {
49222 if (type == 5043)
49223 {
49224 float num = (float)Main.rand.Next(90, 111) * 0.01f;
49225 num *= (Main.essScale + 0.5f) / 2f;
49226 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.25f * num, 0.25f * num, 0.25f * num);
49227 }
49228 else if (type == 3191)
49229 {
49230 float num2 = (float)Main.rand.Next(90, 111) * 0.01f;
49231 num2 *= (Main.essScale + 0.5f) / 2f;
49232 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.3f * num2, 0.1f * num2, 0.25f * num2);
49233 }
49234 else if (type == 520 || type == 3454)
49235 {
49236 float num3 = (float)Main.rand.Next(90, 111) * 0.01f;
49237 num3 *= Main.essScale;
49238 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.5f * num3, 0.1f * num3, 0.25f * num3);
49239 }
49240 else if (type == 521 || type == 3455)
49241 {
49242 float num4 = (float)Main.rand.Next(90, 111) * 0.01f;
49243 num4 *= Main.essScale;
49244 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.25f * num4, 0.1f * num4, 0.5f * num4);
49245 }
49246 else if (type == 547 || type == 3453)
49247 {
49248 float num5 = (float)Main.rand.Next(90, 111) * 0.01f;
49249 num5 *= Main.essScale;
49250 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.5f * num5, 0.3f * num5, 0.05f * num5);
49251 }
49252 else if (type == 548)
49253 {
49254 float num6 = (float)Main.rand.Next(90, 111) * 0.01f;
49255 num6 *= Main.essScale;
49256 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.1f * num6, 0.1f * num6, 0.6f * num6);
49257 }
49258 else if (type == 575)
49259 {
49260 float num7 = (float)Main.rand.Next(90, 111) * 0.01f;
49261 num7 *= Main.essScale;
49262 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.1f * num7, 0.3f * num7, 0.5f * num7);
49263 }
49264 else if (type == 549)
49265 {
49266 float num8 = (float)Main.rand.Next(90, 111) * 0.01f;
49267 num8 *= Main.essScale;
49268 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.1f * num8, 0.5f * num8, 0.2f * num8);
49269 }
49270 else if (type == 58 || type == 1734 || type == 1867)
49271 {
49272 float num9 = (float)Main.rand.Next(90, 111) * 0.01f;
49273 num9 *= Main.essScale * 0.5f;
49274 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.5f * num9, 0.1f * num9, 0.1f * num9);
49275 }
49276 else if (type == 184 || type == 1735 || type == 1868 || type == 4143)
49277 {
49278 float num10 = (float)Main.rand.Next(90, 111) * 0.01f;
49279 num10 *= Main.essScale * 0.5f;
49280 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.1f * num10, 0.1f * num10, 0.5f * num10);
49281 }
49282 else if (type == 522)
49283 {
49284 float num11 = (float)Main.rand.Next(90, 111) * 0.01f;
49285 num11 *= Main.essScale * 0.2f;
49286 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.5f * num11, 1f * num11, 0.1f * num11);
49287 }
49288 else if (type == 1332)
49289 {
49290 float num12 = (float)Main.rand.Next(90, 111) * 0.01f;
49291 num12 *= Main.essScale * 0.2f;
49292 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 1f * num12, 1f * num12, 0.1f * num12);
49293 }
49294 else if (type == 3456)
49295 {
49296 Lighting.AddLight(base.Center, new Vector3(0.2f, 0.4f, 0.5f) * Main.essScale);
49297 }
49298 else if (type == 3457)
49299 {
49300 Lighting.AddLight(base.Center, new Vector3(0.4f, 0.2f, 0.5f) * Main.essScale);
49301 }
49302 else if (type == 3458)
49303 {
49304 Lighting.AddLight(base.Center, new Vector3(0.5f, 0.4f, 0.2f) * Main.essScale);
49305 }
49306 else if (type == 3459)
49307 {
49308 Lighting.AddLight(base.Center, new Vector3(0.2f, 0.2f, 0.5f) * Main.essScale);
49309 }
49310 else if (type == 501)
49311 {
49312 if (Main.rand.Next(6) == 0)
49313 {
49314 int num13 = Dust.NewDust(position, width, height, 55, 0f, 0f, 200, color);
49315 Main.dust[num13].velocity *= 0.3f;
49316 Main.dust[num13].scale *= 0.5f;
49317 }
49318 }
49319 else if (type == 3822)
49320 {
49321 Lighting.AddLight(base.Center, 0.1f, 0.3f, 0.1f);
49322 }
49323 else if (type == 1970)
49324 {
49325 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.75f, 0f, 0.75f);
49326 }
49327 else if (type == 1972)
49328 {
49329 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0f, 0f, 0.75f);
49330 }
49331 else if (type == 1971)
49332 {
49333 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.75f, 0.75f, 0f);
49334 }
49335 else if (type == 1973)
49336 {
49337 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0f, 0.75f, 0f);
49338 }
49339 else if (type == 1974)
49340 {
49341 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.75f, 0f, 0f);
49342 }
49343 else if (type == 1975)
49344 {
49345 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.75f, 0.75f, 0.75f);
49346 }
49347 else if (type == 1976)
49348 {
49349 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.75f, 0.375f, 0f);
49350 }
49351 else if (type == 2679)
49352 {
49353 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.6f, 0f, 0.6f);
49354 }
49355 else if (type == 2687)
49356 {
49357 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0f, 0f, 0.6f);
49358 }
49359 else if (type == 2689)
49360 {
49361 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.6f, 0.6f, 0f);
49362 }
49363 else if (type == 2683)
49364 {
49365 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0f, 0.6f, 0f);
49366 }
49367 else if (type == 2685)
49368 {
49369 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.6f, 0f, 0f);
49370 }
49371 else if (type == 2681)
49372 {
49373 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.6f, 0.6f, 0.6f);
49374 }
49375 else if (type == 2677)
49376 {
49377 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.6f, 0.375f, 0f);
49378 }
49379 else if (type == 105)
49380 {
49381 if (!wet)
49382 {
49383 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 1f, 0.95f, 0.8f);
49384 }
49385 }
49386 else if (type == 2701)
49387 {
49388 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.7f, 0.65f, 0.55f);
49389 }
49390 else if (createTile == 4)
49391 {
49392 int torchID = placeStyle;
49394 {
49395 Lighting.AddLight(base.Center, torchID);
49396 }
49397 }
49398 else if (type == 3114)
49399 {
49400 if (!wet)
49401 {
49402 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 1f, 0f, 1f);
49403 }
49404 }
49405 else if (type == 1245)
49406 {
49407 if (!wet)
49408 {
49409 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 1f, 0.5f, 0f);
49410 }
49411 }
49412 else if (type == 433)
49413 {
49414 if (!wet)
49415 {
49416 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.5f * Main.demonTorch + 1f * (1f - Main.demonTorch), 0.3f, 1f * Main.demonTorch + 0.5f * (1f - Main.demonTorch));
49417 }
49418 }
49419 else if (type == 523)
49420 {
49421 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.85f, 1.2f, 0.7f);
49422 }
49423 else if (type == 974)
49424 {
49425 if (!wet)
49426 {
49427 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.75f, 0.85f, 1.4f);
49428 }
49429 }
49430 else if (type == 1333)
49431 {
49432 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 1.25f, 1.25f, 0.7f);
49433 }
49434 else if (type == 4383)
49435 {
49436 if (!wet)
49437 {
49438 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 1.4f, 0.85f, 0.55f);
49439 }
49440 }
49441 else if (type == 5293)
49442 {
49443 if (!wet)
49444 {
49445 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.25f, 0.65f, 1f);
49446 }
49447 }
49448 else if (type == 5353)
49449 {
49450 if (!wet)
49451 {
49452 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.81f, 0.72f, 1f);
49453 }
49454 }
49455 else if (type == 4384)
49456 {
49457 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.25f, 1.3f, 0.8f);
49458 }
49459 else if (type == 3045)
49460 {
49461 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), (float)Main.DiscoR / 255f, (float)Main.DiscoG / 255f, (float)Main.DiscoB / 255f);
49462 }
49463 else if (type == 3004)
49464 {
49465 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.95f, 0.65f, 1.3f);
49466 }
49467 else if (type == 2274)
49468 {
49469 float r = 0.75f;
49470 float g = 1.3499999f;
49471 float b = 1.5f;
49472 if (!wet)
49473 {
49474 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), r, g, b);
49475 }
49476 }
49477 else if (type >= 427 && type <= 432)
49478 {
49479 if (!wet)
49480 {
49481 float r2 = 0f;
49482 float g2 = 0f;
49483 float b2 = 0f;
49484 int num14 = type - 426;
49485 if (num14 == 1)
49486 {
49487 r2 = 0.1f;
49488 g2 = 0.2f;
49489 b2 = 1.1f;
49490 }
49491 if (num14 == 2)
49492 {
49493 r2 = 1f;
49494 g2 = 0.1f;
49495 b2 = 0.1f;
49496 }
49497 if (num14 == 3)
49498 {
49499 r2 = 0f;
49500 g2 = 1f;
49501 b2 = 0.1f;
49502 }
49503 if (num14 == 4)
49504 {
49505 r2 = 0.9f;
49506 g2 = 0f;
49507 b2 = 0.9f;
49508 }
49509 if (num14 == 5)
49510 {
49511 r2 = 1.3f;
49512 g2 = 1.3f;
49513 b2 = 1.3f;
49514 }
49515 if (num14 == 6)
49516 {
49517 r2 = 0.9f;
49518 g2 = 0.9f;
49519 b2 = 0f;
49520 }
49521 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), r2, g2, b2);
49522 }
49523 }
49524 else if (type == 2777 || type == 2778 || type == 2779 || type == 2780 || type == 2781 || type == 2760 || type == 2761 || type == 2762 || type == 3524)
49525 {
49526 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.4f, 0.16f, 0.36f);
49527 }
49528 else if (type == 2772 || type == 2773 || type == 2774 || type == 2775 || type == 2776 || type == 2757 || type == 2758 || type == 2759 || type == 3523)
49529 {
49530 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0f, 0.36f, 0.4f);
49531 }
49532 else if (type == 2782 || type == 2783 || type == 2784 || type == 2785 || type == 2786 || type == 2763 || type == 2764 || type == 2765 || type == 3522)
49533 {
49534 Lighting.AddLight((int)((position.X + (float)(width / 2)) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.5f, 0.25f, 0.05f);
49535 }
49536 else if (type == 3462 || type == 3463 || type == 3464 || type == 3465 || type == 3466 || type == 3381 || type == 3382 || type == 3383 || type == 3525)
49537 {
49538 Lighting.AddLight(base.Center, 0.3f, 0.3f, 0.2f);
49539 }
49540 else if (type == 41)
49541 {
49542 if (!wet)
49543 {
49544 Lighting.AddLight((int)((position.X + (float)width) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 1f, 0.75f, 0.55f);
49545 }
49546 }
49547 else if (type == 988)
49548 {
49549 if (!wet)
49550 {
49551 Lighting.AddLight((int)((position.X + (float)width) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.35f, 0.65f, 1f);
49552 }
49553 }
49554 else if (type == 1326)
49555 {
49556 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 1f, 0.1f, 0.8f);
49557 }
49558 else if (type == 5335)
49559 {
49560 Lighting.AddLight((int)base.Center.X / 16, (int)base.Center.Y / 16, 0.85f, 0.1f, 0.8f);
49561 }
49562 else if (type >= 5140 && type <= 5146)
49563 {
49564 float num15 = 1f;
49565 float num16 = 1f;
49566 float num17 = 1f;
49567 switch (type)
49568 {
49569 case 5140:
49570 num15 *= 0.9f;
49571 num16 *= 0.8f;
49572 num17 *= 0.1f;
49573 break;
49574 case 5141:
49575 num15 *= 0.25f;
49576 num16 *= 0.1f;
49577 num17 *= 0f;
49578 break;
49579 case 5142:
49580 num15 *= 0f;
49581 num16 *= 0.25f;
49582 num17 *= 0f;
49583 break;
49584 case 5143:
49585 num15 *= 0f;
49586 num16 *= 0.16f;
49587 num17 *= 0.34f;
49588 break;
49589 case 5144:
49590 num15 *= 0.3f;
49591 num16 *= 0f;
49592 num17 *= 0.17f;
49593 break;
49594 case 5145:
49595 num15 *= 0.3f;
49596 num16 *= 0f;
49597 num17 *= 0.35f;
49598 break;
49599 case 5146:
49600 num15 *= (float)Main.DiscoR / 255f;
49601 num16 *= (float)Main.DiscoG / 255f;
49602 num17 *= (float)Main.DiscoB / 255f;
49603 break;
49604 }
49605 Lighting.AddLight((int)((position.X + (float)width) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), num15, num16, num17);
49606 }
49607 else if (type == 282)
49608 {
49609 Lighting.AddLight((int)((position.X + (float)width) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.7f, 1f, 0.8f);
49610 }
49611 else if (type == 286)
49612 {
49613 Lighting.AddLight((int)((position.X + (float)width) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.7f, 0.8f, 1f);
49614 }
49615 else if (type == 3112)
49616 {
49617 Lighting.AddLight((int)((position.X + (float)width) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 1f, 0.6f, 0.85f);
49618 }
49619 else if (type == 4776)
49620 {
49621 Lighting.AddLight((int)((position.X + (float)width) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.7f, 0f, 1f);
49622 }
49623 else if (type == 3002)
49624 {
49625 Lighting.AddLight((int)((position.X + (float)width) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 1.05f, 0.95f, 0.55f);
49626 }
49627 else if (type == 331)
49628 {
49629 Lighting.AddLight((int)((position.X + (float)width) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.55f, 0.75f, 0.6f);
49630 }
49631 else if (type == 183)
49632 {
49633 Lighting.AddLight((int)((position.X + (float)width) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.15f, 0.45f, 0.9f);
49634 }
49635 else if (type == 75)
49636 {
49637 Lighting.AddLight((int)((position.X + (float)width) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.8f, 0.7f, 0.1f);
49638 if (timeSinceItemSpawned % 12 == 0)
49639 {
49640 Dust dust = Dust.NewDustPerfect(base.Center + new Vector2(0f, (float)height * 0.2f) + Main.rand.NextVector2CircularEdge(width, (float)height * 0.6f) * (0.3f + Main.rand.NextFloat() * 0.5f), 228, new Vector2(0f, (0f - Main.rand.NextFloat()) * 0.3f - 1.5f), 127);
49641 dust.scale = 0.5f;
49642 dust.fadeIn = 1.1f;
49643 dust.noGravity = true;
49644 dust.noLight = true;
49645 }
49646 }
49647 else if (ItemID.Sets.BossBag[type])
49648 {
49649 Lighting.AddLight((int)((position.X + (float)width) / 16f), (int)((position.Y + (float)(height / 2)) / 16f), 0.4f, 0.4f, 0.4f);
49650 if (timeSinceItemSpawned % 12 == 0)
49651 {
49652 Dust dust2 = Dust.NewDustPerfect(base.Center + new Vector2(0f, (float)height * -0.1f) + Main.rand.NextVector2CircularEdge((float)width * 0.6f, (float)height * 0.6f) * (0.3f + Main.rand.NextFloat() * 0.5f), 279, new Vector2(0f, (0f - Main.rand.NextFloat()) * 0.3f - 1.5f), 127);
49653 dust2.scale = 0.5f;
49654 dust2.fadeIn = 1.1f;
49655 dust2.noGravity = true;
49656 dust2.noLight = true;
49657 dust2.alpha = 0;
49658 }
49659 }
49660 }
Vector2 position
Definition Entity.cs:14
static bool[] Torches
Definition ItemID.cs:1110
static bool[] WaterTorches
Definition ItemID.cs:1112
static bool[] BossBag
Definition ItemID.cs:1123
int createTile
Definition Item.cs:161
int placeStyle
Definition Item.cs:165
Color color
Definition Item.cs:183
int timeSinceItemSpawned
Definition Item.cs:87

References Terraria.Lighting.AddLight(), Terraria.ID.ItemID.Sets.BossBag, Terraria.Item.color, Terraria.Item.createTile, Terraria.Main.demonTorch, Terraria.Main.DiscoB, Terraria.Main.DiscoG, Terraria.Main.DiscoR, Terraria.Main.dust, Terraria.Main.essScale, Terraria.Entity.height, Terraria.Dust.NewDust(), Terraria.Dust.NewDustPerfect(), Terraria.Item.placeStyle, Terraria.Entity.position, Terraria.Main.rand, Terraria.Item.timeSinceItemSpawned, Terraria.ID.ItemID.Sets.Torches, Terraria.Item.type, Terraria.ID.ItemID.Sets.WaterTorches, Terraria.Entity.wet, Terraria.Entity.width, Microsoft.Xna.Framework.Vector2.X, and Microsoft.Xna.Framework.Vector2.Y.

Referenced by Terraria.Item.UpdateItem().