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

◆ DropItemForEachInteractingPlayerOnThePlayer()

static void Terraria.GameContent.ItemDropRules.CommonCode.DropItemForEachInteractingPlayerOnThePlayer ( NPC npc,
int itemId,
UnifiedRandom rng,
int chanceNumerator,
int chanceDenominator,
int stack = 1,
bool interactionRequired = true )
inlinestatic

Definition at line 92 of file CommonCode.cs.

93 {
94 //IL_0049: Unknown result type (might be due to invalid IL or missing references)
95 //IL_004f: Unknown result type (might be due to invalid IL or missing references)
97 {
98 return;
99 }
100 if (Main.netMode == 2)
101 {
102 for (int i = 0; i < 255; i++)
103 {
104 Player player = Main.player[i];
105 if (player.active && (npc.playerInteraction[i] || !interactionRequired) && rng.Next(chanceDenominator) < chanceNumerator)
106 {
107 int itemIndex = Item.NewItem(npc.GetItemSource_Loot(), player.position, player.Size, itemId, stack, noBroadcast: false, -1);
109 }
110 }
111 }
112 else if (rng.Next(chanceDenominator) < chanceNumerator)
113 {
114 _DropItemFromNPC(npc, itemId, stack);
115 }
116 npc.value = 0f;
117 }
static void _DropItemFromNPC(NPC npc, int itemId, int stack, bool scattered=false)
Definition CommonCode.cs:17
static void ModifyItemDropFromNPC(NPC npc, int itemIndex)
This serves as the central class from which item-related functions are carried out....
Definition ItemLoader.cs:26

References Terraria.GameContent.ItemDropRules.CommonCode._DropItemFromNPC(), Terraria.Entity.active, Terraria.NPC.GetItemSource_Loot(), Terraria.ModLoader.ItemLoader.ItemCount, Terraria.GameContent.ItemDropRules.CommonCode.ModifyItemDropFromNPC(), Terraria.Main.netMode, Terraria.Item.NewItem(), Terraria.Utilities.UnifiedRandom.Next(), Terraria.Main.player, Terraria.NPC.playerInteraction, Terraria.Entity.position, and Terraria.Entity.Size.

Referenced by Terraria.GameContent.ItemDropRules.DropPerPlayerOnThePlayer.TryDroppingItem().

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