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

◆ GetPickedUpByMonsters_Money()

void Terraria.Item.GetPickedUpByMonsters_Money ( int i)
inlineprivate

Definition at line 50772 of file Item.cs.

50773 {
50774 //IL_0147: Unknown result type (might be due to invalid IL or missing references)
50775 //IL_0221: Unknown result type (might be due to invalid IL or missing references)
50776 Rectangle rectangle = default(Rectangle);
50777 ((Rectangle)(ref rectangle))._002Ector((int)position.X, (int)position.Y, width, height);
50778 Rectangle rectangle2 = default(Rectangle);
50779 for (int j = 0; j < 200; j++)
50780 {
50781 NPC nPC = Main.npc[j];
50782 if (!nPC.active || nPC.lifeMax <= 5 || nPC.friendly || nPC.immortal || nPC.dontTakeDamage || NPCID.Sets.CantTakeLunchMoney[nPC.type])
50783 {
50784 continue;
50785 }
50786 float num = stack;
50787 float num2 = 1f;
50788 if (type == 72)
50789 {
50790 num2 = 100f;
50791 }
50792 if (type == 73)
50793 {
50794 num2 = 10000f;
50795 }
50796 if (type == 74)
50797 {
50798 num2 = 1000000f;
50799 }
50800 num *= num2;
50801 float num3 = nPC.extraValue;
50802 int num4 = nPC.realLife;
50803 if (num4 >= 0 && Main.npc[num4].active)
50804 {
50805 num3 = Main.npc[num4].extraValue;
50806 }
50807 else
50808 {
50809 num4 = -1;
50810 }
50811 if (!(num3 < num) || !(num3 + num < 999000000f))
50812 {
50813 continue;
50814 }
50815 ((Rectangle)(ref rectangle2))._002Ector((int)nPC.position.X, (int)nPC.position.Y, nPC.width, nPC.height);
50816 if (((Rectangle)(ref rectangle)).Intersects(rectangle2))
50817 {
50818 float num5 = (float)Main.rand.Next(50, 76) * 0.01f;
50819 if (type == 71)
50820 {
50821 num5 += (float)Main.rand.Next(51) * 0.01f;
50822 }
50823 if (type == 72)
50824 {
50825 num5 += (float)Main.rand.Next(26) * 0.01f;
50826 }
50827 if (num5 > 1f)
50828 {
50829 num5 = 1f;
50830 }
50831 int num6 = (int)((float)stack * num5);
50832 if (num6 < 1)
50833 {
50834 num6 = 1;
50835 }
50836 if (num6 > stack)
50837 {
50838 num6 = stack;
50839 }
50840 stack -= num6;
50841 int num7 = (int)((float)num6 * num2);
50842 int number = j;
50843 if (num4 >= 0)
50844 {
50845 number = num4;
50846 }
50847 nPC.extraValue += num7;
50848 if (Main.netMode == 0)
50849 {
50850 nPC.moneyPing(position);
50851 }
50852 else
50853 {
50854 NetMessage.SendData(92, -1, -1, null, number, num7, position.X, position.Y);
50855 }
50856 if (stack <= 0)
50857 {
50858 SetDefaults();
50859 active = false;
50860 }
50861 NetMessage.SendData(21, -1, -1, null, i);
50862 }
50863 }
50864 }
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
bool active
If true, the Entity actually exists within the game world. Within the specific entity array,...
Definition Entity.cs:21
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
static bool[] CantTakeLunchMoney
If true for a given NPC type (F:Terraria.NPC.type), then that NPC cannot pick up dropped coins in Exp...
Definition NPCID.cs:256
int stack
The current stack of the item. F:Terraria.Item.maxStack indicates the max possible stack.
Definition Item.cs:396
void SetDefaults(int Type=0)
Definition Item.cs:48800
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

References Terraria.Entity.active, Terraria.ID.NPCID.Sets.CantTakeLunchMoney, Terraria.Entity.height, Terraria.Main.netMode, Terraria.Main.npc, Terraria.Entity.position, Terraria.Main.rand, Terraria.NetMessage.SendData(), Terraria.Item.SetDefaults(), Terraria.Item.stack, Terraria.Item.type, and Terraria.Entity.width.

Referenced by Terraria.Item.UpdateItem().

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