Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
BestiaryEntry.cs
Go to the documentation of this file.
1using System;
3using Terraria.ID;
5
7
8public class BestiaryEntry
9{
11
13
14 public List<IBestiaryInfoElement> Info { get; private set; }
15
17 {
19 }
20
21 public static BestiaryEntry Enemy(int npcNetId)
22 {
25 {
30 };
32 if (nPC.rarity != 0)
33 {
34 list.Add(new RareSpawnBestiaryInfoElement(nPC.rarity));
35 }
37 if (nPC.boss || NPCID.Sets.ShouldBeCountedAsBoss[nPC.type])
38 {
40 uIInfoProvider = new CommonEnemyUICollectionInfoProvider(nPC.GetBestiaryCreditId(), quickUnlock: true);
41 }
42 else
43 {
44 uIInfoProvider = new CommonEnemyUICollectionInfoProvider(nPC.GetBestiaryCreditId(), quickUnlock: false);
45 }
46 string key = Lang.GetNPCName(nPC.netID).Key;
47 key = key.Replace("NPCName.", "");
48 string text = "Bestiary_FlavorText.npc_" + key;
49 if (Language.Exists(text))
50 {
52 }
53 return new BestiaryEntry
54 {
56 Info = list,
58 };
59 }
60
61 public static BestiaryEntry TownNPC(int npcNetId)
62 {
65 {
70 };
71 string key = Lang.GetNPCName(nPC.netID).Key;
72 key = key.Replace("NPCName.", "");
73 string text = "Bestiary_FlavorText.npc_" + key;
74 if (Language.Exists(text))
75 {
77 }
78 return new BestiaryEntry
79 {
81 Info = list,
82 UIInfoProvider = new TownNPCUICollectionInfoProvider(nPC.GetBestiaryCreditId())
83 };
84 }
85
86 public static BestiaryEntry Critter(int npcNetId)
87 {
90 {
95 };
96 string key = Lang.GetNPCName(nPC.netID).Key;
97 key = key.Replace("NPCName.", "");
98 string text = "Bestiary_FlavorText.npc_" + key;
99 if (Language.Exists(text))
100 {
102 }
103 return new BestiaryEntry
104 {
106 Info = list,
107 UIInfoProvider = new CritterUICollectionInfoProvider(nPC.GetBestiaryCreditId())
108 };
109 }
110
119
120 public void AddTags(params IBestiaryInfoElement[] elements)
121 {
122 Info.AddRange(elements);
123 }
124}
void AddRange(IEnumerable< KeyValuePair< TKey, TValue > > collection)
void Add(TKey key, TValue value)
static BestiaryEntry Critter(int npcNetId)
IBestiaryUICollectionInfoProvider UIInfoProvider
static BestiaryEntry TownNPC(int npcNetId)
void AddTags(params IBestiaryInfoElement[] elements)
static BestiaryEntry Biome(string nameLanguageKey, string texturePath, Func< bool > unlockCondition)
static BestiaryEntry Enemy(int npcNetId)
static Dictionary< int, int > NpcBestiaryRarityStars
static Dictionary< int, NPC > NpcsByNetId
static bool[] ShouldBeCountedAsBoss
Definition NPCID.cs:4244
static LocalizedText GetNPCName(int netID)
Definition Lang.cs:148
static bool Exists(string key)
Definition Language.cs:45