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

◆ DrawNPCExtras()

void Terraria.Main.DrawNPCExtras ( NPC n,
bool beforeDraw,
float addHeight,
float addY,
Color npcColor,
Vector2 halfSize,
SpriteEffects npcSpriteEffect,
Vector2 screenPosition )
inlineprotected

Definition at line 31338 of file Main.cs.

31339 {
31340 //IL_0688: Unknown result type (might be due to invalid IL or missing references)
31341 //IL_06ba: Unknown result type (might be due to invalid IL or missing references)
31342 //IL_06d4: Unknown result type (might be due to invalid IL or missing references)
31343 //IL_0712: Unknown result type (might be due to invalid IL or missing references)
31344 //IL_072d: Unknown result type (might be due to invalid IL or missing references)
31345 //IL_0733: Unknown result type (might be due to invalid IL or missing references)
31346 //IL_073e: Unknown result type (might be due to invalid IL or missing references)
31347 //IL_0740: Unknown result type (might be due to invalid IL or missing references)
31348 //IL_074b: Unknown result type (might be due to invalid IL or missing references)
31349 //IL_0753: Unknown result type (might be due to invalid IL or missing references)
31350 //IL_00a1: Unknown result type (might be due to invalid IL or missing references)
31351 //IL_00a6: Unknown result type (might be due to invalid IL or missing references)
31352 //IL_0e8c: Unknown result type (might be due to invalid IL or missing references)
31353 //IL_0e91: Unknown result type (might be due to invalid IL or missing references)
31354 //IL_0dad: Unknown result type (might be due to invalid IL or missing references)
31355 //IL_0dc3: Unknown result type (might be due to invalid IL or missing references)
31356 //IL_0dc8: Unknown result type (might be due to invalid IL or missing references)
31357 //IL_0dcd: Unknown result type (might be due to invalid IL or missing references)
31358 //IL_0de3: Unknown result type (might be due to invalid IL or missing references)
31359 //IL_0de8: Unknown result type (might be due to invalid IL or missing references)
31360 //IL_0dea: Unknown result type (might be due to invalid IL or missing references)
31361 //IL_0dec: Unknown result type (might be due to invalid IL or missing references)
31362 //IL_0dfb: Unknown result type (might be due to invalid IL or missing references)
31363 //IL_0e00: Unknown result type (might be due to invalid IL or missing references)
31364 //IL_0e05: Unknown result type (might be due to invalid IL or missing references)
31365 //IL_0e0e: Unknown result type (might be due to invalid IL or missing references)
31366 //IL_0e15: Unknown result type (might be due to invalid IL or missing references)
31367 //IL_0e1f: Unknown result type (might be due to invalid IL or missing references)
31368 //IL_0e26: Unknown result type (might be due to invalid IL or missing references)
31369 //IL_0e30: Unknown result type (might be due to invalid IL or missing references)
31370 //IL_0e35: Unknown result type (might be due to invalid IL or missing references)
31371 //IL_0e3d: Unknown result type (might be due to invalid IL or missing references)
31372 //IL_0e47: Unknown result type (might be due to invalid IL or missing references)
31373 //IL_0e4f: Unknown result type (might be due to invalid IL or missing references)
31374 //IL_0e52: Unknown result type (might be due to invalid IL or missing references)
31375 //IL_10c0: Unknown result type (might be due to invalid IL or missing references)
31376 //IL_10c5: Unknown result type (might be due to invalid IL or missing references)
31377 //IL_10cf: Unknown result type (might be due to invalid IL or missing references)
31378 //IL_10d4: Unknown result type (might be due to invalid IL or missing references)
31379 //IL_07bf: Unknown result type (might be due to invalid IL or missing references)
31380 //IL_07c4: Unknown result type (might be due to invalid IL or missing references)
31381 //IL_12d4: Unknown result type (might be due to invalid IL or missing references)
31382 //IL_12db: Unknown result type (might be due to invalid IL or missing references)
31383 //IL_12e1: Unknown result type (might be due to invalid IL or missing references)
31384 //IL_12e6: Unknown result type (might be due to invalid IL or missing references)
31385 //IL_12ed: Unknown result type (might be due to invalid IL or missing references)
31386 //IL_12f2: Unknown result type (might be due to invalid IL or missing references)
31387 //IL_12f7: Unknown result type (might be due to invalid IL or missing references)
31388 //IL_12f9: Unknown result type (might be due to invalid IL or missing references)
31389 //IL_12fe: Unknown result type (might be due to invalid IL or missing references)
31390 //IL_1300: Unknown result type (might be due to invalid IL or missing references)
31391 //IL_1302: Unknown result type (might be due to invalid IL or missing references)
31392 //IL_0fc2: Unknown result type (might be due to invalid IL or missing references)
31393 //IL_0fc9: Unknown result type (might be due to invalid IL or missing references)
31394 //IL_0fcf: Unknown result type (might be due to invalid IL or missing references)
31395 //IL_0fd4: Unknown result type (might be due to invalid IL or missing references)
31396 //IL_0fdb: Unknown result type (might be due to invalid IL or missing references)
31397 //IL_0fe0: Unknown result type (might be due to invalid IL or missing references)
31398 //IL_0fe5: Unknown result type (might be due to invalid IL or missing references)
31399 //IL_0fe7: Unknown result type (might be due to invalid IL or missing references)
31400 //IL_0fec: Unknown result type (might be due to invalid IL or missing references)
31401 //IL_0fee: Unknown result type (might be due to invalid IL or missing references)
31402 //IL_0ff0: Unknown result type (might be due to invalid IL or missing references)
31403 //IL_07e0: Unknown result type (might be due to invalid IL or missing references)
31404 //IL_07e5: Unknown result type (might be due to invalid IL or missing references)
31405 //IL_07e7: Unknown result type (might be due to invalid IL or missing references)
31406 //IL_07ec: Unknown result type (might be due to invalid IL or missing references)
31407 //IL_131a: Unknown result type (might be due to invalid IL or missing references)
31408 //IL_131f: Unknown result type (might be due to invalid IL or missing references)
31409 //IL_1324: Unknown result type (might be due to invalid IL or missing references)
31410 //IL_132d: Unknown result type (might be due to invalid IL or missing references)
31411 //IL_1334: Unknown result type (might be due to invalid IL or missing references)
31412 //IL_133e: Unknown result type (might be due to invalid IL or missing references)
31413 //IL_1345: Unknown result type (might be due to invalid IL or missing references)
31414 //IL_134f: Unknown result type (might be due to invalid IL or missing references)
31415 //IL_1354: Unknown result type (might be due to invalid IL or missing references)
31416 //IL_135c: Unknown result type (might be due to invalid IL or missing references)
31417 //IL_135e: Unknown result type (might be due to invalid IL or missing references)
31418 //IL_136a: Unknown result type (might be due to invalid IL or missing references)
31419 //IL_1372: Unknown result type (might be due to invalid IL or missing references)
31420 //IL_1375: Unknown result type (might be due to invalid IL or missing references)
31421 //IL_111a: Unknown result type (might be due to invalid IL or missing references)
31422 //IL_1126: Unknown result type (might be due to invalid IL or missing references)
31423 //IL_1008: Unknown result type (might be due to invalid IL or missing references)
31424 //IL_100d: Unknown result type (might be due to invalid IL or missing references)
31425 //IL_1012: Unknown result type (might be due to invalid IL or missing references)
31426 //IL_101b: Unknown result type (might be due to invalid IL or missing references)
31427 //IL_1022: Unknown result type (might be due to invalid IL or missing references)
31428 //IL_102c: Unknown result type (might be due to invalid IL or missing references)
31429 //IL_1033: Unknown result type (might be due to invalid IL or missing references)
31430 //IL_103d: Unknown result type (might be due to invalid IL or missing references)
31431 //IL_1042: Unknown result type (might be due to invalid IL or missing references)
31432 //IL_104a: Unknown result type (might be due to invalid IL or missing references)
31433 //IL_104c: Unknown result type (might be due to invalid IL or missing references)
31434 //IL_1058: Unknown result type (might be due to invalid IL or missing references)
31435 //IL_1060: Unknown result type (might be due to invalid IL or missing references)
31436 //IL_1063: Unknown result type (might be due to invalid IL or missing references)
31437 //IL_02b5: Unknown result type (might be due to invalid IL or missing references)
31438 //IL_02c6: Unknown result type (might be due to invalid IL or missing references)
31439 //IL_02cb: Unknown result type (might be due to invalid IL or missing references)
31440 //IL_02d0: Unknown result type (might be due to invalid IL or missing references)
31441 //IL_113f: Unknown result type (might be due to invalid IL or missing references)
31442 //IL_1145: Unknown result type (might be due to invalid IL or missing references)
31443 //IL_13da: Unknown result type (might be due to invalid IL or missing references)
31444 //IL_13df: Unknown result type (might be due to invalid IL or missing references)
31445 //IL_1185: Unknown result type (might be due to invalid IL or missing references)
31446 //IL_1199: Unknown result type (might be due to invalid IL or missing references)
31447 //IL_119e: Unknown result type (might be due to invalid IL or missing references)
31448 //IL_11a3: Unknown result type (might be due to invalid IL or missing references)
31449 //IL_0411: Unknown result type (might be due to invalid IL or missing references)
31450 //IL_0413: Unknown result type (might be due to invalid IL or missing references)
31451 //IL_0418: Unknown result type (might be due to invalid IL or missing references)
31452 //IL_0427: Unknown result type (might be due to invalid IL or missing references)
31453 //IL_042c: Unknown result type (might be due to invalid IL or missing references)
31454 //IL_0431: Unknown result type (might be due to invalid IL or missing references)
31455 //IL_0985: Unknown result type (might be due to invalid IL or missing references)
31456 //IL_09b4: Unknown result type (might be due to invalid IL or missing references)
31457 //IL_140b: Unknown result type (might be due to invalid IL or missing references)
31458 //IL_11be: Unknown result type (might be due to invalid IL or missing references)
31459 //IL_11c0: Unknown result type (might be due to invalid IL or missing references)
31460 //IL_11c7: Unknown result type (might be due to invalid IL or missing references)
31461 //IL_11cc: Unknown result type (might be due to invalid IL or missing references)
31462 //IL_11d1: Unknown result type (might be due to invalid IL or missing references)
31463 //IL_11d9: Unknown result type (might be due to invalid IL or missing references)
31464 //IL_11ff: Unknown result type (might be due to invalid IL or missing references)
31465 //IL_1216: Unknown result type (might be due to invalid IL or missing references)
31466 //IL_1220: Unknown result type (might be due to invalid IL or missing references)
31467 //IL_1225: Unknown result type (might be due to invalid IL or missing references)
31468 //IL_122a: Unknown result type (might be due to invalid IL or missing references)
31469 //IL_122c: Unknown result type (might be due to invalid IL or missing references)
31470 //IL_1233: Unknown result type (might be due to invalid IL or missing references)
31471 //IL_1238: Unknown result type (might be due to invalid IL or missing references)
31472 //IL_123d: Unknown result type (might be due to invalid IL or missing references)
31473 //IL_1245: Unknown result type (might be due to invalid IL or missing references)
31474 //IL_126b: Unknown result type (might be due to invalid IL or missing references)
31475 //IL_127b: Unknown result type (might be due to invalid IL or missing references)
31476 //IL_1285: Unknown result type (might be due to invalid IL or missing references)
31477 //IL_128a: Unknown result type (might be due to invalid IL or missing references)
31478 //IL_09ef: Unknown result type (might be due to invalid IL or missing references)
31479 //IL_09f6: Unknown result type (might be due to invalid IL or missing references)
31480 //IL_0a00: Unknown result type (might be due to invalid IL or missing references)
31481 //IL_0a07: Unknown result type (might be due to invalid IL or missing references)
31482 //IL_0a11: Unknown result type (might be due to invalid IL or missing references)
31483 //IL_0a16: Unknown result type (might be due to invalid IL or missing references)
31484 //IL_0a1d: Unknown result type (might be due to invalid IL or missing references)
31485 //IL_0a21: Unknown result type (might be due to invalid IL or missing references)
31486 //IL_0a2c: Unknown result type (might be due to invalid IL or missing references)
31487 //IL_0a2f: Unknown result type (might be due to invalid IL or missing references)
31488 //IL_09ce: Unknown result type (might be due to invalid IL or missing references)
31489 //IL_09d9: Unknown result type (might be due to invalid IL or missing references)
31490 //IL_0ad5: Unknown result type (might be due to invalid IL or missing references)
31491 //IL_0ada: Unknown result type (might be due to invalid IL or missing references)
31492 //IL_0aee: Unknown result type (might be due to invalid IL or missing references)
31493 //IL_0b20: Unknown result type (might be due to invalid IL or missing references)
31494 //IL_0b3a: Unknown result type (might be due to invalid IL or missing references)
31495 //IL_0b78: Unknown result type (might be due to invalid IL or missing references)
31496 //IL_0b93: Unknown result type (might be due to invalid IL or missing references)
31497 //IL_0b98: Unknown result type (might be due to invalid IL or missing references)
31498 //IL_0ba0: Unknown result type (might be due to invalid IL or missing references)
31499 //IL_0ba2: Unknown result type (might be due to invalid IL or missing references)
31500 //IL_0bad: Unknown result type (might be due to invalid IL or missing references)
31501 //IL_0bb5: Unknown result type (might be due to invalid IL or missing references)
31502 //IL_05b7: Unknown result type (might be due to invalid IL or missing references)
31503 //IL_05b9: Unknown result type (might be due to invalid IL or missing references)
31504 //IL_14ac: Unknown result type (might be due to invalid IL or missing references)
31505 //IL_14b1: Unknown result type (might be due to invalid IL or missing references)
31506 //IL_14b3: Unknown result type (might be due to invalid IL or missing references)
31507 //IL_14b8: Unknown result type (might be due to invalid IL or missing references)
31508 //IL_14ba: Unknown result type (might be due to invalid IL or missing references)
31509 //IL_14bb: Unknown result type (might be due to invalid IL or missing references)
31510 //IL_0c64: Unknown result type (might be due to invalid IL or missing references)
31511 //IL_0c69: Unknown result type (might be due to invalid IL or missing references)
31512 //IL_0c7d: Unknown result type (might be due to invalid IL or missing references)
31513 //IL_0caf: Unknown result type (might be due to invalid IL or missing references)
31514 //IL_0cc9: Unknown result type (might be due to invalid IL or missing references)
31515 //IL_0d07: Unknown result type (might be due to invalid IL or missing references)
31516 //IL_0d22: Unknown result type (might be due to invalid IL or missing references)
31517 //IL_0d27: Unknown result type (might be due to invalid IL or missing references)
31518 //IL_0d2f: Unknown result type (might be due to invalid IL or missing references)
31519 //IL_0d31: Unknown result type (might be due to invalid IL or missing references)
31520 //IL_0d3c: Unknown result type (might be due to invalid IL or missing references)
31521 //IL_0d44: Unknown result type (might be due to invalid IL or missing references)
31522 //IL_05c9: Unknown result type (might be due to invalid IL or missing references)
31523 //IL_05cc: Unknown result type (might be due to invalid IL or missing references)
31524 //IL_05cd: Unknown result type (might be due to invalid IL or missing references)
31525 //IL_1495: Unknown result type (might be due to invalid IL or missing references)
31526 //IL_149a: Unknown result type (might be due to invalid IL or missing references)
31527 //IL_05fb: Unknown result type (might be due to invalid IL or missing references)
31528 //IL_0602: Unknown result type (might be due to invalid IL or missing references)
31529 //IL_060a: Unknown result type (might be due to invalid IL or missing references)
31530 //IL_0611: Unknown result type (might be due to invalid IL or missing references)
31531 //IL_0619: Unknown result type (might be due to invalid IL or missing references)
31532 //IL_061e: Unknown result type (might be due to invalid IL or missing references)
31533 //IL_0625: Unknown result type (might be due to invalid IL or missing references)
31534 //IL_062d: Unknown result type (might be due to invalid IL or missing references)
31535 //IL_0634: Unknown result type (might be due to invalid IL or missing references)
31536 //IL_063e: Unknown result type (might be due to invalid IL or missing references)
31537 //IL_0646: Unknown result type (might be due to invalid IL or missing references)
31538 //IL_14d3: Unknown result type (might be due to invalid IL or missing references)
31539 //IL_14d8: Unknown result type (might be due to invalid IL or missing references)
31540 //IL_14dd: Unknown result type (might be due to invalid IL or missing references)
31541 //IL_14e1: Unknown result type (might be due to invalid IL or missing references)
31542 //IL_14e8: Unknown result type (might be due to invalid IL or missing references)
31543 //IL_14f2: Unknown result type (might be due to invalid IL or missing references)
31544 //IL_14f9: Unknown result type (might be due to invalid IL or missing references)
31545 //IL_1509: Unknown result type (might be due to invalid IL or missing references)
31546 //IL_150b: Unknown result type (might be due to invalid IL or missing references)
31547 //IL_1510: Unknown result type (might be due to invalid IL or missing references)
31548 //IL_1518: Unknown result type (might be due to invalid IL or missing references)
31549 //IL_151a: Unknown result type (might be due to invalid IL or missing references)
31550 //IL_1520: Unknown result type (might be due to invalid IL or missing references)
31551 //IL_1527: Unknown result type (might be due to invalid IL or missing references)
31552 //IL_152f: Unknown result type (might be due to invalid IL or missing references)
31553 //IL_1532: Unknown result type (might be due to invalid IL or missing references)
31554 if (!beforeDraw && n.UsesPartyHat())
31555 {
31556 int num = n.frame.Y / n.frame.Height;
31558 if (num >= array.Length)
31559 {
31560 num = 0;
31561 }
31562 Texture2D value = TextureAssets.Extra[72].Value;
31563 int num11 = 0;
31564 switch (n.GetPartyHatColor())
31565 {
31566 case PartyHatColor.Pink:
31567 num11 = 16;
31568 break;
31569 case PartyHatColor.Cyan:
31570 num11 = 17;
31571 break;
31572 case PartyHatColor.Purple:
31573 num11 = 18;
31574 break;
31575 case PartyHatColor.White:
31576 num11 = 19;
31577 break;
31578 }
31579 Rectangle rectangle = value.Frame(20, 1, num11 % 20);
31580 rectangle.Width -= 2;
31581 rectangle.Height -= 2;
31582 int num15 = 0;
31583 int num16 = 0;
31584 int num17 = n.spriteDirection;
31585 if (n.type == 663)
31586 {
31587 num15 = 1;
31588 }
31589 if (n.type == 637)
31590 {
31591 num15 = 6;
31592 switch (num)
31593 {
31594 case 19:
31595 case 22:
31596 case 23:
31597 case 24:
31598 case 25:
31599 case 26:
31600 case 27:
31601 num15 -= 2;
31602 break;
31603 case 11:
31604 case 12:
31605 case 13:
31606 case 14:
31607 case 15:
31608 num15 += 2;
31609 break;
31610 }
31611 }
31612 if (n.type == 638)
31613 {
31614 num15 = 12;
31615 }
31616 if (n.type == 656)
31617 {
31618 num15 = 6;
31619 switch (num)
31620 {
31621 case 1:
31622 case 2:
31623 case 3:
31624 num15 -= 2;
31625 break;
31626 case 18:
31627 case 19:
31628 case 20:
31629 case 21:
31630 case 22:
31631 case 23:
31632 case 24:
31633 case 25:
31634 num15 -= 4;
31635 break;
31636 case 8:
31637 num15 -= 2;
31638 break;
31639 }
31640 }
31641 if (NPCID.Sets.IsTownSlime[n.type])
31642 {
31643 num17 *= -1;
31644 switch (n.type)
31645 {
31646 default:
31647 num15 = 1;
31648 break;
31649 case 670:
31650 num15 = -1;
31651 break;
31652 case 681:
31653 num15 = -2;
31654 break;
31655 case 682:
31656 num15 = -1;
31657 num16 = 2;
31658 break;
31659 case 683:
31660 num15 = -1;
31661 num16 = -2;
31662 break;
31663 case 684:
31664 num15 = -4;
31665 break;
31666 case 679:
31667 break;
31668 }
31669 }
31670 if (n.IsShimmerVariant)
31671 {
31672 switch (n.type)
31673 {
31674 case 38:
31675 num15 += 2;
31676 num16 = -2;
31677 break;
31678 case 178:
31679 case 228:
31680 num15 = -4;
31681 num16 = -4;
31682 break;
31683 case 107:
31684 num15 = 2;
31685 num16 = -6;
31686 break;
31687 case 54:
31688 num16 = -6;
31689 break;
31690 case 160:
31691 num16 = -2;
31692 break;
31693 case 108:
31694 case 124:
31695 case 208:
31696 case 209:
31697 case 227:
31698 num16 = -4;
31699 break;
31700 }
31701 }
31702 Vector2 vector = n.Top + new Vector2((float)(-2 * num17), n.gfxOffY);
31703 vector.X += num15 * num17;
31704 vector.Y += array[num];
31705 vector.Y += num16;
31706 vector.Y += NPCID.Sets.HatOffsetY[n.type];
31707 int num18 = 0;
31708 if (n.ai[0] == 5f)
31709 {
31710 num18 = -4;
31711 if (n.type == 38)
31712 {
31713 num18 = -8;
31714 }
31715 if (n.type == 124)
31716 {
31717 num18 = -2;
31718 }
31719 if (n.type == 550)
31720 {
31721 num18 = -4;
31722 }
31723 if (n.type == 588)
31724 {
31725 num18 = -4;
31726 }
31727 if (n.type == 108 || n.type == 178)
31728 {
31729 num18 = -6;
31730 }
31731 if (n.type == 637)
31732 {
31733 num18 = -12;
31734 }
31735 if (n.type == 663)
31736 {
31737 num18 = -8;
31738 }
31739 }
31740 vector.Y += num18;
31741 if (n.type == 229 && n.ai[0] == 12f)
31742 {
31743 vector.X -= num17 * 4;
31744 }
31745 if (n.type == 550 && n.ai[0] == 5f)
31746 {
31747 vector.X += num17 * 7;
31748 }
31749 Vector2 origin = rectangle.Size() - new Vector2((float)(rectangle.Width / 2), 12f);
31750 int num19 = 0;
31751 switch (n.type)
31752 {
31753 case 550:
31754 num19 = -4;
31755 break;
31756 case 588:
31757 num19 = 0;
31758 break;
31759 case 227:
31760 num19 = -4;
31761 break;
31762 case 228:
31763 num19 = -2;
31764 break;
31765 case 17:
31766 case 18:
31767 case 19:
31768 case 20:
31769 case 22:
31770 case 124:
31771 case 229:
31772 case 353:
31773 case 633:
31774 case 637:
31775 case 638:
31776 case 656:
31777 case 670:
31778 case 678:
31779 case 679:
31780 case 680:
31781 case 681:
31782 case 682:
31783 case 683:
31784 case 684:
31785 num19 = -1;
31786 break;
31787 case 37:
31788 case 38:
31789 case 54:
31790 case 107:
31791 case 108:
31792 case 160:
31793 case 207:
31794 case 209:
31795 num19 = -3;
31796 break;
31797 case 178:
31798 case 208:
31799 case 369:
31800 num19 = 1;
31801 break;
31802 }
31803 vector.X += num19 * num17;
31804 vector.X += 4 * num17;
31805 SpriteEffects spriteEffects = npcSpriteEffect;
31806 if (NPCID.Sets.IsTownSlime[n.type])
31807 {
31808 spriteEffects = (SpriteEffects)(spriteEffects ^ 1);
31809 }
31810 float num20 = 1f;
31811 if (n.shimmerTransparency > 0f)
31812 {
31813 num20 *= 1f - n.shimmerTransparency;
31814 }
31815 spriteBatch.Draw(value, new Vector2(vector.X - screenPosition.X, vector.Y - screenPosition.Y), (Rectangle?)rectangle, npcColor * n.Opacity * num20, 0f, origin, n.scale, spriteEffects, 0f);
31816 }
31817 if (!beforeDraw && n.type == 681)
31818 {
31819 spriteBatch.Draw(TextureAssets.Extra[250].Value, new Vector2(n.position.X - screenPosition.X + (float)(n.width / 2) - (float)TextureAssets.Npc[n.type].Width() * n.scale / 2f + halfSize.X * n.scale, n.position.Y - screenPosition.Y + (float)n.height - (float)TextureAssets.Npc[n.type].Height() * n.scale / (float)npcFrameCount[n.type] + 4f + halfSize.Y * n.scale + addHeight + addY + n.gfxOffY), (Rectangle?)n.frame, n.GetAlpha(npcColor), n.rotation, halfSize, n.scale, npcSpriteEffect, 0f);
31820 }
31821 if (NPCID.Sets.AttackType[n.type] == 1 && n.ai[0] == 12f && !beforeDraw)
31822 {
31823 if (n.type == 228 || n.type == 229 || n.type == 209)
31824 {
31825 return;
31826 }
31827 float num21 = n.ai[2];
31828 Vector2 vector4 = OffsetsNPCOffhand[2];
31829 if (n.spriteDirection == 1)
31830 {
31831 vector4.X *= -1f;
31832 }
31833 Vector2 vector5 = n.Bottom - vector4;
31834 if (n.type == 22 && n.ai[2] > -0.1f)
31835 {
31836 vector5.Y += 4f;
31837 }
31838 if (n.type == 368 && hardMode && n.ai[2] > -0.1f)
31839 {
31840 vector5.Y += 4f;
31841 }
31842 if (n.type == 368 && !hardMode && n.ai[2] < -0.1f)
31843 {
31844 vector5.Y -= 8f;
31845 }
31846 float rotation = num21 * ((float)Math.PI / 2f) * (float)n.spriteDirection;
31847 float num2 = 1f;
31848 int itemtype = 0;
31849 int num3 = 4;
31850 if (n.type == 19)
31851 {
31852 itemtype = (hardMode ? 98 : 95);
31853 if (hardMode)
31854 {
31855 vector5.X -= 10 * n.direction;
31856 vector5.Y += 4f;
31857 }
31858 }
31859 else if (n.type == 22)
31860 {
31861 itemtype = 39;
31862 num3 = 18;
31863 }
31864 else if (n.type == 178)
31865 {
31866 itemtype = 434;
31867 }
31868 else if (n.type == 227)
31869 {
31870 itemtype = 3350;
31871 num3 = 16;
31872 num2 = 0.85f;
31873 }
31874 else if (n.type == 368)
31875 {
31876 itemtype = (hardMode ? 2223 : 2269);
31877 if (hardMode)
31878 {
31879 num3 = 18;
31880 }
31881 else
31882 {
31883 if (n.ai[2] < -0.1f)
31884 {
31885 num3 = 28;
31886 }
31887 num2 = 0.75f;
31888 }
31889 }
31890 Vector2 val = DrawPlayerItemPos(1f, itemtype);
31892 int num4 = (int)val.X - num3;
31894 Vector2 origin2 = default(Vector2);
31895 ((Vector2)(ref origin2))._002Ector((float)(-num4), (float)(value2.Height / 2));
31896 if (n.spriteDirection == -1)
31897 {
31898 ((Vector2)(ref origin2))._002Ector((float)(value2.Width + num4), (float)(value2.Height / 2));
31899 }
31900 spriteBatch.Draw(itemTexture, new Vector2((float)(int)(vector5.X - screenPosition.X), (float)(int)(vector5.Y - screenPosition.Y)), (Rectangle?)value2, npcColor, rotation, origin2, n.scale * num2, (SpriteEffects)(npcSpriteEffect ^ 1), 0f);
31901 if (n.type == 22 && n.frame.Y / (TextureAssets.Npc[n.type].Height() / npcFrameCount[n.type]) >= 21)
31902 {
31903 Texture2D value3 = TextureAssets.Extra[52].Value;
31904 if (n.IsShimmerVariant)
31905 {
31906 value3 = TextureAssets.Extra[264].Value;
31907 }
31908 Rectangle value4 = value3.Frame(1, 5, 0, n.frame.Y / (TextureAssets.Npc[n.type].Height() / npcFrameCount[n.type]) - 21);
31909 spriteBatch.Draw(value3, new Vector2(n.position.X - screenPosition.X + (float)(n.width / 2) - (float)TextureAssets.Npc[n.type].Width() * n.scale / 2f + halfSize.X * n.scale, n.position.Y - screenPosition.Y + (float)n.height - (float)TextureAssets.Npc[n.type].Height() * n.scale / (float)npcFrameCount[n.type] + 4f + halfSize.Y * n.scale + addHeight + addY + n.gfxOffY), (Rectangle?)value4, n.GetAlpha(npcColor), n.rotation, halfSize, n.scale, npcSpriteEffect, 0f);
31910 }
31911 else if (n.type == 368 && n.frame.Y / (TextureAssets.Npc[n.type].Height() / npcFrameCount[n.type]) >= 21)
31912 {
31913 Texture2D value5 = TextureAssets.Extra[53].Value;
31914 if (n.IsShimmerVariant)
31915 {
31916 value5 = TextureAssets.Extra[265].Value;
31917 }
31918 Rectangle value6 = value5.Frame(1, 5, 0, n.frame.Y / (TextureAssets.Npc[n.type].Height() / npcFrameCount[n.type]) - 21);
31919 spriteBatch.Draw(value5, new Vector2(n.position.X - screenPosition.X + (float)(n.width / 2) - (float)TextureAssets.Npc[n.type].Width() * n.scale / 2f + halfSize.X * n.scale, n.position.Y - screenPosition.Y + (float)n.height - (float)TextureAssets.Npc[n.type].Height() * n.scale / (float)npcFrameCount[n.type] + 4f + halfSize.Y * n.scale + addHeight + addY + n.gfxOffY), (Rectangle?)value6, n.GetAlpha(npcColor), n.rotation, halfSize, n.scale, npcSpriteEffect, 0f);
31920 }
31921 }
31922 if (NPCID.Sets.AttackType[n.type] == 2 && (n.ai[0] == 14f || (n.ai[0] == 24f && n.frameCounter < 240.0)) && !beforeDraw)
31923 {
31924 Texture2D value7 = TextureAssets.Extra[51].Value;
31925 Vector2 vector6 = n.Bottom + new Vector2(0f, n.gfxOffY + 4f);
31926 Rectangle rectangle2 = value7.Frame(1, 4, 0, (int)n.frameCounter % 48 / 12);
31927 Vector2 origin3 = rectangle2.Size() * new Vector2(0.5f, 1f);
31928 spriteBatch.Draw(value7, new Vector2((float)(int)(vector6.X - screenPosition.X), (float)(int)(vector6.Y - screenPosition.Y)), (Rectangle?)rectangle2, n.GetMagicAuraColor(), 0f, origin3, n.scale, (SpriteEffects)(npcSpriteEffect ^ 1), 0f);
31929 }
31930 if (NPCID.Sets.AttackType[n.type] == 3 && n.ai[0] == 15f)
31931 {
31932 int num5 = 32;
31933 float num6 = 0f;
31934 Vector2 zero = Vector2.Zero;
31935 short num7 = 4;
31936 if (n.type == 207)
31937 {
31938 num7 = 3349;
31939 num6 = 0.15f;
31940 if (beforeDraw)
31941 {
31942 return;
31943 }
31944 if (n.ai[1] > (float)NPCID.Sets.AttackTime[n.type] * 0.66f)
31945 {
31946 zero.Y = 12f;
31947 }
31948 }
31949 else if (n.type == 353)
31950 {
31951 num7 = 3352;
31952 num6 = 0.15f;
31953 if (!beforeDraw)
31954 {
31955 return;
31956 }
31957 if (n.ai[1] > (float)NPCID.Sets.AttackTime[n.type] * 0.66f)
31958 {
31959 zero.Y = 12f;
31960 }
31961 }
31962 else if (n.type == 441)
31963 {
31964 num7 = 3351;
31965 num5 = 28;
31966 num6 = 0.1f;
31967 if (!beforeDraw)
31968 {
31969 return;
31970 }
31971 if (n.ai[1] > (float)NPCID.Sets.AttackTime[n.type] * 0.66f)
31972 {
31973 zero.Y = 12f;
31974 }
31975 }
31978 Tuple<Vector2, float> swingStats = n.GetSwingStats(NPCID.Sets.AttackTime[n.type] * 2, (int)n.ai[1], n.spriteDirection, num5, num5);
31979 Vector2 vector7 = swingStats.Item1 + (swingStats.Item1 - n.Center) * num6 + zero;
31980 Vector2 origin4 = rectangle3.Size() * new Vector2((float)((n.spriteDirection != 1) ? 1 : 0), 1f);
31981 spriteBatch.Draw(itemTexture2, new Vector2((float)(int)(vector7.X - screenPosition.X), (float)(int)(vector7.Y - screenPosition.Y)), (Rectangle?)rectangle3, n.GetAlpha(npcColor), swingStats.Item2, origin4, n.scale, (SpriteEffects)(npcSpriteEffect ^ 1), 0f);
31982 }
31983 if (n.type == 550 && n.ai[0] == 18f)
31984 {
31985 if (beforeDraw)
31986 {
31987 return;
31988 }
31989 instance.LoadItem(353);
31990 Texture2D value8 = TextureAssets.Item[353].Value;
31991 int num8 = 32;
31992 float num9 = 0.15f;
31993 Vector2 zero2 = Vector2.Zero;
31994 Rectangle rectangle4 = value8.Frame(1, 3, 0, 1);
31995 int num10 = (int)n.ai[2];
31996 if (num10 >= 0 && num10 < 255)
31997 {
31998 Player player = Main.player[num10];
31999 bool flag = player.HeldItem.type == 353 && player.direction == Math.Sign(n.Center.X - player.Center.X);
32000 float num22 = player.Hitbox.Distance(n.Center);
32001 float num12 = n.localAI[3];
32002 if (num22 < 46f && flag)
32003 {
32004 n.localAI[3] = 1f;
32005 if (n.localAI[3] != num12)
32006 {
32007 Vector2 vector8 = n.Center + new Vector2((float)(n.spriteDirection * 30), -6f);
32008 Vector2 vector9 = default(Vector2);
32009 ((Vector2)(ref vector9))._002Ector(10f, 10f);
32010 for (int i = 0; i < 30; i++)
32011 {
32012 Dust obj = Dust.NewDustDirect(vector8 - vector9 / 2f, (int)vector9.X, (int)vector9.Y, 4, 0f, 0f, 50, new Color(245, 200, 30, 155), 0.7f);
32013 obj.noGravity = true;
32014 obj.velocity *= 1f;
32015 Dust obj2 = Dust.NewDustDirect(vector8 - vector9 / 2f, (int)vector9.X, (int)vector9.Y, 4, 0f, 0f, 50, new Color(245, 200, 30, 155), 0.6f);
32016 obj2.velocity *= 2f;
32017 }
32018 }
32019 }
32020 else if (n.localAI[3] == 1f)
32021 {
32022 n.localAI[3] = 2f;
32023 }
32024 }
32025 Tuple<Vector2, float> swingStats2 = n.GetSwingStats(40, 12, n.spriteDirection, num8, num8);
32026 Vector2 vector10 = swingStats2.Item1 + (swingStats2.Item1 - n.Center) * num9 + zero2;
32027 Vector2 origin5 = rectangle4.Size() * new Vector2((float)((n.spriteDirection != 1) ? 1 : 0), 1f);
32028 spriteBatch.Draw(value8, new Vector2((float)(int)(vector10.X - screenPosition.X), (float)(int)(vector10.Y - screenPosition.Y)), (Rectangle?)rectangle4, n.GetAlpha(npcColor), swingStats2.Item2, origin5, n.scale, (SpriteEffects)(npcSpriteEffect ^ 1), 0f);
32029 }
32030 if (beforeDraw || n.ai[0] != 23f)
32031 {
32032 return;
32033 }
32034 int num13 = (int)n.ai[2];
32036 {
32037 return;
32038 }
32040 int num14 = 0;
32041 num14 = (((int)n.frameCounter < 6) ? 1 : 2);
32042 if (n.ai[1] < 6f)
32043 {
32044 num14 = 1;
32045 }
32046 if (num14 == 0)
32047 {
32048 return;
32049 }
32050 Vector2 vector2 = Vector2.Zero;
32051 if (num14 == 1)
32052 {
32053 ((Vector2)(ref vector2))._002Ector(10f, 6f);
32054 }
32055 if (num14 == 2)
32056 {
32057 ((Vector2)(ref vector2))._002Ector(16f, 0f);
32058 }
32059 if (!((Enum)npcSpriteEffect).HasFlag((Enum)(object)(SpriteEffects)1))
32060 {
32061 vector2.X *= -1f;
32062 }
32063 if (n.type == 369)
32064 {
32065 vector2.X *= 0.5f;
32066 vector2.Y += 4f;
32067 }
32068 if (n.type == 453)
32069 {
32070 vector2.Y += 8f;
32071 }
32072 if (n.type == 550)
32073 {
32074 if (num13 == 353)
32075 {
32076 rectangle5 = itemTexture3.Frame(1, 3, 0, 1);
32077 }
32078 vector2.Y += 6f;
32079 }
32080 Vector2 vector3 = n.Center + vector2;
32081 Vector2 origin6 = rectangle5.Size() * new Vector2((float)((n.spriteDirection != 1) ? 1 : 0), 1f);
32082 Vector2 position = default(Vector2);
32083 ((Vector2)(ref position))._002Ector((float)(int)(vector3.X - screenPosition.X), (float)(int)(vector3.Y - screenPosition.Y));
32084 Color alpha = n.GetAlpha(npcColor);
32085 spriteBatch.Draw(itemTexture3, position, (Rectangle?)rectangle5, alpha, 0f, origin6, n.scale, (SpriteEffects)(npcSpriteEffect ^ 1), 0f);
32086 }
static Asset< Texture2D >[] Npc
static Asset< Texture2D >[] Item
static Asset< Texture2D >[] Extra
static readonly short Count
Definition ItemID.cs:12719
static int[][] TownNPCsFramingGroups
The vertical offset, in pixels, that this NPC's party hat will draw. Indexed using values from F:Terr...
Definition NPCID.cs:617
static int[] AttackTime
The duration of this town NPC's attack animation in ticks. Defaults to -1.
Definition NPCID.cs:496
static bool[] IsTownSlime
If true for a given NPC type (F:Terraria.NPC.type), then that NPC is categorized as a town slime....
Definition NPCID.cs:232
static int[] AttackType
Determines how a town NPC with the given NPC type (F:Terraria.NPC.type) attacks. For -1,...
Definition NPCID.cs:518
static int[] HatOffsetY
The vertical offset, in pixels, that an NPC's party hat will draw with. Defaults to 0.
Definition NPCID.cs:430
static int[] NPCFramingGroup
The index for F:Terraria.ID.NPCID.Sets.TownNPCsFramingGroups for a given NPC type (F:Terraria....
Definition NPCID.cs:604
static Vector2[] OffsetsNPCOffhand
Definition Main.cs:491
static int[] npcFrameCount
Definition Main.cs:2152
static SpriteBatch spriteBatch
Definition Main.cs:1043
static void GetItemDrawFrame(int item, out Texture2D itemTexture, out Rectangle itemFrame)
Gets the texture and frame of the given item type (F:Terraria.Item.type).
Definition Main.cs:31320
static Main instance
Definition Main.cs:311
static Vector2 screenPosition
The position of the top left corner of the screen in world coordinates. Modify in M:Terraria....
Definition Main.cs:1864
static Vector2 DrawPlayerItemPos(float gravdir, int itemtype)
Definition Main.cs:3266
static bool hardMode
Definition Main.cs:1091
static Player[] player
Definition Main.cs:1960
static void DrawTownAttackSwing(NPC npc, ref Texture2D item, ref Rectangle itemFrame, ref int itemSize, ref float scale, ref Vector2 offset)
static void DrawTownAttackGun(NPC npc, ref Texture2D item, ref Rectangle itemFrame, ref float scale, ref int horizontalHoldoutOffset)
This serves as the central class from which NPC-related functions are carried out....
Definition NPCLoader.cs:26

References Terraria.ID.NPCID.Sets.AttackTime, Terraria.ID.NPCID.Sets.AttackType, Terraria.ID.ItemID.Count, Terraria.Main.DrawPlayerItemPos(), Terraria.ModLoader.NPCLoader.DrawTownAttackGun(), Terraria.ModLoader.NPCLoader.DrawTownAttackSwing(), Terraria.GameContent.TextureAssets.Extra, Terraria.Main.GetItemDrawFrame(), Terraria.Main.hardMode, Terraria.ID.NPCID.Sets.HatOffsetY, Terraria.Main.instance, Terraria.ID.NPCID.Sets.IsTownSlime, Terraria.GameContent.TextureAssets.Item, Terraria.Dust.NewDustDirect(), Terraria.GameContent.TextureAssets.Npc, Terraria.Main.npcFrameCount, Terraria.ID.NPCID.Sets.NPCFramingGroup, Terraria.Main.OffsetsNPCOffhand, Terraria.Main.player, Terraria.Main.screenPosition, Terraria.Main.spriteBatch, and Terraria.ID.NPCID.Sets.TownNPCsFramingGroups.

Referenced by Terraria.Main.DrawNPCDirect_Inner().

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