Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Profiles.cs
Go to the documentation of this file.
5
7
8public class Profiles
9{
11 {
13
18
19 public int RollVariation()
20 {
21 return 0;
22 }
23
24 public string GetNameForVariant(NPC npc)
25 {
26 int num = 0;
27 if (_profiles.IndexInRange(npc.townNpcVariationIndex))
28 {
29 num = npc.townNpcVariationIndex;
30 }
31 return _profiles[num].GetNameForVariant(npc);
32 }
33
35 {
36 int num = 0;
37 if (_profiles.IndexInRange(npc.townNpcVariationIndex))
38 {
39 num = npc.townNpcVariationIndex;
40 }
41 return _profiles[num].GetTextureNPCShouldUse(npc);
42 }
43
44 public int GetHeadTextureIndex(NPC npc)
45 {
46 int num = 0;
47 if (_profiles.IndexInRange(npc.townNpcVariationIndex))
48 {
49 num = npc.townNpcVariationIndex;
50 }
51 return _profiles[num].GetHeadTextureIndex(npc);
52 }
53 }
54
56 {
57 private string _rootFilePath;
58
60
62
64
66 {
69 if (!Main.dedServ)
70 {
73 {
74 _defaultParty = Main.Assets.Request<Texture2D>(npcFileTitleFilePath + (includeDefault ? "_Default_Party" : "_Party"), (AssetRequestMode)0);
75 }
76 else
77 {
79 }
80 }
81 }
82
83 public int RollVariation()
84 {
85 return 0;
86 }
87
88 public string GetNameForVariant(NPC npc)
89 {
90 return NPC.getNewNPCName(npc.type);
91 }
92
94 {
96 {
97 return _defaultNoAlt;
98 }
99 if (npc.altTexture == 1)
100 {
101 return _defaultParty;
102 }
103 return _defaultNoAlt;
104 }
105
106 public int GetHeadTextureIndex(NPC npc)
107 {
109 }
110 }
111
113 {
114 private string _rootFilePath;
115
117
119
121
123
138
139 public int RollVariation()
140 {
141 return 0;
142 }
143
144 public string GetNameForVariant(NPC npc)
145 {
146 return NPC.getNewNPCName(npc.type);
147 }
148
150 {
151 if (npc.altTexture == 3 && _defaultCredits != null)
152 {
153 return _defaultCredits;
154 }
155 if (npc.IsABestiaryIconDummy)
156 {
157 return _defaultNoAlt;
158 }
159 if (npc.altTexture == 2)
160 {
161 return _defaultTransformed;
162 }
163 return _defaultNoAlt;
164 }
165
166 public int GetHeadTextureIndex(NPC npc)
167 {
169 }
170 }
171
173 {
174 private string _rootFilePath;
175
176 private string _npcBaseName;
177
178 private int[] _variantHeadIDs;
179
180 private string[] _variants;
181
183
185 {
190 string[] variants = _variants;
191 foreach (string text in variants)
192 {
193 string text2 = _rootFilePath + "_" + text;
194 if (!Main.dedServ)
195 {
197 }
198 }
199 }
200
202 {
203 foreach (string text in variantTextureNames)
204 {
205 string text2 = _rootFilePath + "_" + text + "_Party";
206 if (!Main.dedServ)
207 {
209 }
210 }
211 return this;
212 }
213
214 public int RollVariation()
215 {
216 return Main.rand.Next(_variants.Length);
217 }
218
219 public string GetNameForVariant(NPC npc)
220 {
222 }
223
225 {
226 string text = _rootFilePath + "_" + _variants[npc.townNpcVariationIndex];
227 if (npc.IsABestiaryIconDummy)
228 {
229 return _variantTextures[text];
230 }
231 if (npc.altTexture == 1 && _variantTextures.ContainsKey(text + "_Party"))
232 {
233 return _variantTextures[text + "_Party"];
234 }
235 return _variantTextures[text];
236 }
237
238 public int GetHeadTextureIndex(NPC npc)
239 {
241 }
242 }
243}
Asset< Texture2D > GetTextureNPCShouldUse(NPC npc)
Definition Profiles.cs:93
LegacyNPCProfile(string npcFileTitleFilePath, int defaultHeadIndex, bool includeDefault=true, bool uniquePartyTexture=true)
Definition Profiles.cs:65
Asset< Texture2D > GetTextureNPCShouldUse(NPC npc)
Definition Profiles.cs:34
StackedNPCProfile(params ITownNPCProfile[] profilesInOrderOfVariants)
Definition Profiles.cs:14
Asset< Texture2D > GetTextureNPCShouldUse(NPC npc)
Definition Profiles.cs:149
TransformableNPCProfile(string npcFileTitleFilePath, int defaultHeadIndex, bool includeCredits=true)
Definition Profiles.cs:124
VariantNPCProfile(string npcFileTitleFilePath, string npcBaseName, int[] variantHeadIds, params string[] variantTextureNames)
Definition Profiles.cs:184
Asset< Texture2D > GetTextureNPCShouldUse(NPC npc)
Definition Profiles.cs:224
VariantNPCProfile SetPartyTextures(params string[] variantTextureNames)
Definition Profiles.cs:201
Dictionary< string, Asset< Texture2D > > _variantTextures
Definition Profiles.cs:182
static LocalizedText RandomFromCategory(string categoryName, UnifiedRandom random=null)
Definition Language.cs:70
static bool dedServ
Definition Main.cs:1226
static UnifiedRandom rand
Definition Main.cs:1387
static IAssetRepository Assets
Definition Main.cs:209
bool ForcePartyHatOn
Definition NPC.cs:35
int townNpcVariationIndex
Definition NPC.cs:101
int type
Definition NPC.cs:445
int altTexture
Definition NPC.cs:99
static string getNewNPCName(int npcType)
Definition NPC.cs:1417
bool IsABestiaryIconDummy
Definition NPC.cs:33
static UnifiedRandom genRand
Definition WorldGen.cs:1215
Asset< Texture2D > GetTextureNPCShouldUse(NPC npc)