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

◆ CatchNPC()

static void Terraria.NPC.CatchNPC ( int i,
int who = -1 )
inlinestaticpackage

Definition at line 85529 of file NPC.cs.

85530 {
85531 //IL_0110: Unknown result type (might be due to invalid IL or missing references)
85532 //IL_0122: Unknown result type (might be due to invalid IL or missing references)
85533 //IL_0092: Unknown result type (might be due to invalid IL or missing references)
85534 //IL_009c: Unknown result type (might be due to invalid IL or missing references)
85535 //IL_00a1: Unknown result type (might be due to invalid IL or missing references)
85536 //IL_00a6: Unknown result type (might be due to invalid IL or missing references)
85537 //IL_00a7: Unknown result type (might be due to invalid IL or missing references)
85538 //IL_00dc: Unknown result type (might be due to invalid IL or missing references)
85539 //IL_00e3: Unknown result type (might be due to invalid IL or missing references)
85540 if (!Main.npc[i].active)
85541 {
85542 return;
85543 }
85544 if (who == -1)
85545 {
85546 who = Main.myPlayer;
85547 }
85548 if (Main.netMode == 1)
85549 {
85550 Main.npc[i].active = false;
85551 NetMessage.SendData(70, -1, -1, null, i, who);
85552 }
85553 else if (Main.npc[i].catchItem > 0)
85554 {
85555 if (Main.npc[i].type == 687)
85556 {
85557 Main.npc[i].TryTeleportingCaughtMysticFrog();
85558 }
85559 else if (Main.npc[i].SpawnedFromStatue)
85560 {
85561 Vector2 vector = Main.npc[i].Center - new Vector2(20f);
85562 Utils.PoofOfSmoke(vector);
85563 Main.npc[i].active = false;
85564 NetMessage.SendData(23, -1, -1, null, i);
85565 NetMessage.SendData(106, -1, -1, null, (int)vector.X, vector.Y);
85566 }
85567 else
85568 {
85569 int itemWhoAmI = Item.NewItem(GetSpawnSource_NPCCatch(who, Main.npc[i]), (int)Main.player[who].Center.X, (int)Main.player[who].Center.Y, 0, 0, Main.npc[i].catchItem, 1, noBroadcast: true, 0, noGrabDelay: true);
85570 NetMessage.SendData(21, -1, -1, null, itemWhoAmI, 1f);
85571 Main.npc[i].active = false;
85572 NetMessage.SendData(23, -1, -1, null, i);
85573 }
85574 }
85575 }
static IEntitySource GetSpawnSource_NPCCatch(int whoCaughtIt, Entity caughtEntity)
Definition NPC.cs:107533

References Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.Item.NewItem(), Terraria.Main.npc, Terraria.Main.player, Terraria.Utils.PoofOfSmoke(), and Terraria.NetMessage.SendData().

Referenced by Terraria.MessageBuffer.GetData().

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