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

◆ NPCLoot()

void Terraria.NPC.NPCLoot ( )
inline

Definition at line 84474 of file NPC.cs.

84475 {
84476 //IL_006c: Unknown result type (might be due to invalid IL or missing references)
84477 //IL_01c4: Unknown result type (might be due to invalid IL or missing references)
84478 if (Main.netMode == 1 || (Main.getGoodWorld && !downedBoss3 && (type == 31 || type == 294 || type == 296 || type == 295 || type == 32 || type == 34 || type == 71)))
84479 {
84480 return;
84481 }
84482 Player closestPlayer = Main.player[Player.FindClosest(position, width, height)];
84485 {
84487 {
84488 Main.BestiaryTracker.Kills.RegisterKill(this);
84489 }
84491 }
84492 if ((type == 23 && Main.hardMode) || (SpawnedFromStatue && NPCID.Sets.NoEarlymodeLootWhenSpawnedFromStatue[type] && !Main.hardMode) || (SpawnedFromStatue && NPCID.Sets.StatueSpawnedDropRarity[type] != -1f && (Main.rand.NextFloat() >= NPCID.Sets.StatueSpawnedDropRarity[type] || !AnyInteractions())) || !NPCLoader.PreKill(this))
84493 {
84494 return;
84495 }
84499 NPCLoader.OnKill(this);
84501 if (!num && downedMechBoss1 && downedMechBoss2 && downedMechBoss3 && Main.hardMode)
84502 {
84503 if (Main.netMode == 0)
84504 {
84505 Main.NewText(Lang.misc[32].Value, 50, byte.MaxValue, 130);
84506 }
84507 else if (Main.netMode == 2)
84508 {
84509 ChatHelper.BroadcastChatMessage(NetworkText.FromKey(Lang.misc[32].Key), new Color(50, 255, 130));
84510 }
84511 }
84514 }
static void BroadcastChatMessage(NetworkText text, Color color, int excludedPlayer=-1)
Definition ChatHelper.cs:51
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
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
static float[] StatueSpawnedDropRarity
If != -1f for a given NPC type (F:Terraria.NPC.type), then if that NPC was spawned from a statue (F:T...
Definition NPCID.cs:344
static bool[] NoEarlymodeLootWhenSpawnedFromStatue
If true for a given NPC type (F:Terraria.NPC.type), then if that NPC was spawned from a statue (F:Ter...
Definition NPCID.cs:350
static NetworkText FromKey(string key, params object[] substitutions)
Creates a NetworkText object from a localization key and optional substitutions. The receiving client...
Represents text that will be sent over the network in multiplayer and displayed to the receiving user...
static void OnKill(NPC npc)
Definition NPCLoader.cs:767
static bool PreKill(NPC npc)
Definition NPCLoader.cs:746
This serves as the central class from which NPC-related functions are carried out....
Definition NPCLoader.cs:26
static bool downedMechBoss2
Denotes whether or not the Twins have been defeated at least once in the current world.
Definition NPC.cs:959
void CountKillForAchievements()
Definition NPC.cs:85453
bool SpawnedFromStatue
Definition NPC.cs:484
void NPCLoot_DropMoney(Player closestPlayer)
Definition NPC.cs:85239
static bool downedMechBoss3
Denotes whether or not Skeletron Prime has been defeated at least once in the current world.
Definition NPC.cs:964
void CountKillForBannersAndDropThem()
Definition NPC.cs:85389
void NPCLoot_DropItems(Player closestPlayer)
Definition NPC.cs:84534
bool GetWereThereAnyInteractions()
Returns true if any player has damaged this NPC. Individual player participation can be determined by...
Definition NPC.cs:85444
void NPCLoot_DropHeals(Player closestPlayer)
Definition NPC.cs:84739
int type
The NPC ID of this NPC. The NPC ID is a unique number assigned to each NPC loaded into the game....
Definition NPC.cs:990
bool AnyInteractions()
Returns true if any player has damaged this NPC. Individual player participation can be determined by...
Definition NPC.cs:84401
void DoDeathEvents(Player closestPlayer)
Definition NPC.cs:84838
void DoDeathEvents_BeforeLoot(Player closestPlayer)
Definition NPC.cs:84525
static bool downedBoss3
Denotes whether or not Skeletron has been defeated at least once in the current world.
Definition NPC.cs:801
bool IsNPCValidForBestiaryKillCredit()
Definition NPC.cs:84516
static bool downedMechBoss1
Denotes whether or not the Destroyer has been defeated at least once in the current world.
Definition NPC.cs:954

References Terraria.NPC.AnyInteractions(), Terraria.Main.BestiaryTracker, Terraria.Chat.ChatHelper.BroadcastChatMessage(), Terraria.NPC.CountKillForAchievements(), Terraria.NPC.CountKillForBannersAndDropThem(), Terraria.NPC.DoDeathEvents(), Terraria.NPC.DoDeathEvents_BeforeLoot(), Terraria.NPC.downedBoss3, Terraria.NPC.downedMechBoss1, Terraria.NPC.downedMechBoss2, Terraria.NPC.downedMechBoss3, Terraria.Player.FindClosest(), Terraria.Localization.NetworkText.FromKey(), Terraria.Main.getGoodWorld, Terraria.NPC.GetWereThereAnyInteractions(), Terraria.Main.hardMode, Terraria.Entity.height, Terraria.NPC.IsNPCValidForBestiaryKillCredit(), Terraria.Lang.misc, Terraria.Main.netMode, Terraria.Main.NewText(), Terraria.ID.NPCID.Sets.NoEarlymodeLootWhenSpawnedFromStatue, Terraria.NPC.NPCLoot_DropHeals(), Terraria.NPC.NPCLoot_DropItems(), Terraria.NPC.NPCLoot_DropMoney(), Terraria.ModLoader.NPCLoader.OnKill(), Terraria.Main.player, Terraria.Entity.position, Terraria.ModLoader.NPCLoader.PreKill(), Terraria.Main.rand, Terraria.NPC.SpawnedFromStatue, Terraria.ID.NPCID.Sets.StatueSpawnedDropRarity, Terraria.NPC.type, and Terraria.Entity.width.

Referenced by Terraria.NPC.checkDead(), and Terraria.NPC.DropEoWLoot().

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