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

◆ CountKillForBannersAndDropThem()

void Terraria.NPC.CountKillForBannersAndDropThem ( )
inlineprivate

Definition at line 85389 of file NPC.cs.

85390 {
85391 //IL_0177: Unknown result type (might be due to invalid IL or missing references)
85392 //IL_017c: Unknown result type (might be due to invalid IL or missing references)
85393 //IL_0163: Unknown result type (might be due to invalid IL or missing references)
85394 //IL_019e: Unknown result type (might be due to invalid IL or missing references)
85395 //IL_01a6: Unknown result type (might be due to invalid IL or missing references)
85396 //IL_0191: Unknown result type (might be due to invalid IL or missing references)
85397 //IL_0196: Unknown result type (might be due to invalid IL or missing references)
85398 int num = Item.NPCtoBanner(BannerID());
85399 if (num <= 0 || ExcludedFromDeathTally())
85400 {
85401 return;
85402 }
85403 killCount[num]++;
85404 if (Main.netMode == 2)
85405 {
85406 NetMessage.SendData(83, -1, -1, null, num);
85407 }
85408 int num2 = ItemID.Sets.KillsToBanner[Item.BannerToItem(num)];
85409 if (killCount[num] % num2 == 0 && num > 0)
85410 {
85411 int num3 = Item.BannerToNPC(num);
85412 int num4 = lastInteraction;
85413 if (!Main.player[num4].active || Main.player[num4].dead)
85414 {
85416 }
85417 NetworkText networkText = NetworkText.FromKey("Game.EnemiesDefeatedAnnouncement", killCount[num], NetworkText.FromKey(Lang.GetNPCName(num3).Key));
85418 if (num4 >= 0 && num4 < 255)
85419 {
85420 networkText = NetworkText.FromKey("Game.EnemiesDefeatedByAnnouncement", Main.player[num4].name, killCount[num], NetworkText.FromKey(Lang.GetNPCName(num3).Key));
85421 }
85422 if (Main.netMode == 0)
85423 {
85424 Main.NewText(networkText.ToString(), 250, 250, 0);
85425 }
85426 else if (Main.netMode == 2)
85427 {
85428 ChatHelper.BroadcastChatMessage(networkText, new Color(250, 250, 0));
85429 }
85430 int num5 = Item.BannerToItem(num);
85431 Vector2 vector = position;
85432 if (num4 >= 0 && num4 < 255)
85433 {
85434 vector = Main.player[num4].position;
85435 }
85436 Item.NewItem(GetItemSource_Loot(), (int)vector.X, (int)vector.Y, width, height, num5);
85437 }
85438 }
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 int[] KillsToBanner
Determines the number of NPC kills required to obtain the given item type (F:Terraria....
Definition ItemID.cs:1262
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 int[] killCount
Definition NPC.cs:470
int BannerID()
Definition NPC.cs:2612
bool ExcludedFromDeathTally()
Definition NPC.cs:85372
int lastInteraction
The F:Terraria.Entity.whoAmI of the T:Terraria.Player that last damaged this NPC. Used to award Banne...
Definition NPC.cs:536
IEntitySource GetItemSource_Loot()
Definition NPC.cs:107573
int FindClosestPlayer()
Definition NPC.cs:82893

References Terraria.Item.BannerToItem(), Terraria.Item.BannerToNPC(), Terraria.Chat.ChatHelper.BroadcastChatMessage(), Terraria.Localization.NetworkText.FromKey(), Terraria.Lang.GetNPCName(), Terraria.ID.ItemID.Sets.KillsToBanner, Terraria.Main.netMode, Terraria.Item.NewItem(), Terraria.Main.NewText(), Terraria.Item.NPCtoBanner(), Terraria.Main.player, and Terraria.NetMessage.SendData().

Referenced by Terraria.NPC.AI_003_Fighters(), and Terraria.NPC.NPCLoot().

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