Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
Biography.cs
Go to the documentation of this file.
1using System;
2using Newtonsoft.Json;
3
4public class Biography : EClass
5{
6 public static string[] idFemale = new string[5] { "shojo", "sister", "sister_cat", "younglady", "sister_undead" };
7
8 [JsonProperty]
9 public int[] ints = new int[20];
10
11 [JsonProperty]
12 public string[] strs = new string[3];
13
14 public int[] personalities = new int[5];
15
16 public string idLike
17 {
18 get
19 {
20 return strs[0];
21 }
22 set
23 {
24 strs[0] = value;
25 }
26 }
27
28 public int gender
29 {
30 get
31 {
32 return ints[0];
33 }
34 set
35 {
36 ints[0] = value;
37 }
38 }
39
40 public int weight
41 {
42 get
43 {
44 return ints[2];
45 }
46 set
47 {
48 ints[2] = value;
49 }
50 }
51
52 public int height
53 {
54 get
55 {
56 return ints[3];
57 }
58 set
59 {
60 ints[3] = value;
61 }
62 }
63
64 public int birthDay
65 {
66 get
67 {
68 return ints[4];
69 }
70 set
71 {
72 ints[4] = value;
73 }
74 }
75
76 public int birthMonth
77 {
78 get
79 {
80 return ints[5];
81 }
82 set
83 {
84 ints[5] = value;
85 }
86 }
87
88 public int birthYear
89 {
90 get
91 {
92 return ints[6];
93 }
94 set
95 {
96 ints[6] = value;
97 }
98 }
99
100 public int idHome
101 {
102 get
103 {
104 return ints[7];
105 }
106 set
107 {
108 ints[7] = value;
109 }
110 }
111
112 public int idDad
113 {
114 get
115 {
116 return ints[8];
117 }
118 set
119 {
120 ints[8] = value;
121 }
122 }
123
124 public int idMom
125 {
126 get
127 {
128 return ints[9];
129 }
130 set
131 {
132 ints[9] = value;
133 }
134 }
135
136 public int idLoc
137 {
138 get
139 {
140 return ints[10];
141 }
142 set
143 {
144 ints[10] = value;
145 }
146 }
147
148 public int idAdvDad
149 {
150 get
151 {
152 return ints[11];
153 }
154 set
155 {
156 ints[11] = value;
157 }
158 }
159
160 public int idAdvMom
161 {
162 get
163 {
164 return ints[12];
165 }
166 set
167 {
168 ints[12] = value;
169 }
170 }
171
172 public int idHobby
173 {
174 get
175 {
176 return ints[13];
177 }
178 set
179 {
180 ints[13] = value;
181 }
182 }
183
184 public int stability
185 {
186 get
187 {
188 return ints[14];
189 }
190 set
191 {
192 ints[14] = value;
193 }
194 }
195
196 public int law
197 {
198 get
199 {
200 return ints[15];
201 }
202 set
203 {
204 ints[15] = value;
205 }
206 }
207
208 public int affection
209 {
210 get
211 {
212 return ints[16];
213 }
214 set
215 {
216 ints[16] = value;
217 }
218 }
219
220 public int dominance
221 {
222 get
223 {
224 return ints[17];
225 }
226 set
227 {
228 ints[17] = value;
229 }
230 }
231
232 public int extroversion
233 {
234 get
235 {
236 return ints[18];
237 }
238 set
239 {
240 ints[18] = value;
241 }
242 }
243
244 public int idInterest
245 {
246 get
247 {
248 return ints[19];
249 }
250 set
251 {
252 ints[19] = value;
253 }
254 }
255
256 public string nameHome => StrBio(idHome);
257
258 public string nameLoc => StrBio(idLoc);
259
260 public string nameDad => "textParent".lang(StrBio(idAdvDad), StrBio(idDad));
261
262 public string nameMom => "textParent".lang(StrBio(idAdvMom), StrBio(idMom));
263
264 public string nameBirthplace => "birthLoc2".lang(nameHome, nameLoc);
265
266 public int age
267 {
268 get
269 {
270 return EClass.world.date.year - birthYear;
271 }
272 set
273 {
274 birthYear = EClass.world.date.year - value;
275 }
276 }
277
278 public bool IsUnderAge => age < 18;
279
280 public string TextAge(Chara c)
281 {
282 object obj;
283 if (age < 1000)
284 {
285 obj = (c.IsUnique ? GetOriginalAge(c) : age).ToString();
286 if (obj == null)
287 {
288 return "";
289 }
290 }
291 else
292 {
293 obj = "???";
294 }
295 return (string)obj;
296 }
297
298 public int GetOriginalAge(Chara c)
299 {
300 string[] array = c.source.bio.Split('/');
301 if (array.Length > 1)
302 {
303 return int.Parse(array[1]);
304 }
305 return age;
306 }
307
308 public void Generate(Chara c)
309 {
310 string bio = c.source.bio;
311 _ = c.Chara.race;
312 stability = Rand.rndNormal(100);
313 law = Rand.rndNormal(100);
314 affection = Rand.rndNormal(100);
315 dominance = Rand.rndNormal(100);
317 idInterest = EClass.rnd(Enum.GetNames(typeof(Interest)).Length);
318 if (idFemale.Contains(c.id) || c.race.id == "roran")
319 {
320 SetGender(1);
321 }
322 else
323 {
325 }
326 RerollBio(c);
327 c.SetRandomTone();
328 c.SetRandomTalk();
329 bool flag = c.IsHuman;
330 if (!bio.IsEmpty())
331 {
332 string[] array = bio.Split('/');
333 SetGender((array[0] == "f") ? 1 : 2);
334 if (array.Length > 1)
335 {
336 if (!c.source.HasTag(CTAG.randomPortrait))
337 {
338 flag = false;
339 }
340 age = int.Parse(array[1]);
341 c.pccData = IO.LoadFile<PCCData>(CorePath.packageCore + "Data/PCC/" + c.id + ".txt");
342 }
343 if (array.Length > 2)
344 {
345 height = int.Parse(array[2]);
346 }
347 if (array.Length > 3)
348 {
349 weight = int.Parse(array[3]);
350 }
351 if (array.Length > 4)
352 {
353 c.c_idTone = array[4];
354 }
355 if (array.Length > 5 && !array[5].IsEmpty())
356 {
357 c.c_idTalk = array[5];
358 }
359 }
360 if (c.trait is TraitGuildClerk)
361 {
362 flag = true;
363 }
364 if (flag && !c.HasTag(CTAG.noPortrait))
365 {
366 SetPortrait(c);
367 }
368 if (c.id == "prostitute" && age < 15)
369 {
370 age = 15;
371 }
372 SourceThing.Row row = EClass.sources.things.rows.RandomItem();
373 idLike = row.id;
374 idHobby = EClass.sources.elements.hobbies.RandomItem().id;
375 }
376
377 public void RerollBio(Chara c, int ageIndex = 0, bool keepParent = false)
378 {
379 GenerateBirthday(c, ageIndex);
381 if (!keepParent)
382 {
383 GenerateDad();
384 GenerateMom();
385 idHome = RndBio("home");
386 idLoc = RndBio("loc");
387 }
388 }
389
390 public void GenerateBirthday(Chara c, int ageIndex = 0)
391 {
392 SourceRace.Row race = c.race;
393 int num = race.age[0];
394 int num2 = race.age[1];
395 if (ageIndex != 0)
396 {
397 int num3 = (num2 - num) / 4;
398 age = Rand.Range(num + num3 * (ageIndex - 1), num + num3 * ageIndex);
399 }
400 else
401 {
402 age = Rand.Range(num, num2);
403 }
404 birthDay = EClass.rnd(30) + 1;
405 birthMonth = EClass.rnd(12) + 1;
406 }
407
409 {
410 SourceRace.Row race = c.race;
411 height = race.height + EClass.rnd(race.height / 5 + 1) - EClass.rnd(race.height / 5 + 1);
412 weight = height * height * (EClass.rnd(6) + 18) / 10000;
413 }
414
415 public void GenerateDad()
416 {
417 idDad = RndBio("parent");
418 idAdvDad = RndBio("adv");
419 }
420
421 public void GenerateMom()
422 {
423 idMom = RndBio("parent");
424 idAdvMom = RndBio("adv");
425 }
426
427 private int RndBio(string group)
428 {
429 return WordGen.GetID(group);
430 }
431
432 private string StrBio(int id)
433 {
434 object obj;
435 if (!EClass.sources.langWord.map.ContainsKey(id))
436 {
437 obj = id.ToString();
438 if (obj == null)
439 {
440 return "";
441 }
442 }
443 else
444 {
445 obj = EClass.sources.langWord.map[id].GetText().Split(',')[0];
446 }
447 return (string)obj;
448 }
449
450 public void SetGender(int g)
451 {
452 gender = g;
453 if (gender > 2)
454 {
455 gender = 0;
456 }
457 }
458
459 public void SetPortrait(Chara c)
460 {
461 string id = c.id;
462 if (!(id == "shojo"))
463 {
464 if (id == "sister")
465 {
466 c.c_idPortrait = Portrait.GetRandomPortrait("special_f-littlesister");
467 }
468 else
469 {
470 c.c_idPortrait = Portrait.GetRandomPortrait(gender, c.GetIdPortraitCat());
471 }
472 }
473 else
474 {
475 c.c_idPortrait = Portrait.GetRandomPortrait("special_f-littlegirl");
476 }
477 }
478
479 public string TextBio(Chara c)
480 {
481 return c.race.GetText().ToTitleCase(wholeText: true) + " " + Lang.Parse("age", TextAge(c)) + " " + Lang._gender(gender);
482 }
483
484 public string TextBio2(Chara c)
485 {
486 return Lang.Parse("heightWeight", height.ToString() ?? "", weight.ToString() ?? "") + " " + ((c.material.alias == "meat") ? "" : c.material.GetName().ToTitleCase(wholeText: true));
487 }
488
489 public string TextBirthDate(Chara c, bool _age = false)
490 {
491 return Lang.Parse("birthText", (birthYear >= 0) ? (birthYear.ToString() ?? "") : "???", birthMonth.ToString() ?? "", birthDay.ToString() ?? "") + (_age ? (" (" + Lang.Parse("age", TextAge(c)) + ")") : "");
492 }
493
494 public string TextAppearance()
495 {
496 return Lang.Parse("heightWeight", height.ToString() ?? "", weight.ToString() ?? "");
497 }
498}
CTAG
Definition: CTAG.cs:2
Interest
Definition: Interest.cs:2
int birthYear
Definition: Biography.cs:89
string StrBio(int id)
Definition: Biography.cs:432
void GenerateMom()
Definition: Biography.cs:421
int idAdvMom
Definition: Biography.cs:161
int affection
Definition: Biography.cs:209
int idLoc
Definition: Biography.cs:137
string TextBio(Chara c)
Definition: Biography.cs:479
static string[] idFemale
Definition: Biography.cs:6
void SetGender(int g)
Definition: Biography.cs:450
string nameBirthplace
Definition: Biography.cs:264
void GenerateDad()
Definition: Biography.cs:415
int idDad
Definition: Biography.cs:113
int birthDay
Definition: Biography.cs:65
int GetOriginalAge(Chara c)
Definition: Biography.cs:298
void GenerateAppearance(Chara c)
Definition: Biography.cs:408
string nameDad
Definition: Biography.cs:260
string[] strs
Definition: Biography.cs:12
string TextBirthDate(Chara c, bool _age=false)
Definition: Biography.cs:489
int height
Definition: Biography.cs:53
int weight
Definition: Biography.cs:41
int idAdvDad
Definition: Biography.cs:149
string nameHome
Definition: Biography.cs:256
int[] personalities
Definition: Biography.cs:14
int RndBio(string group)
Definition: Biography.cs:427
int[] ints
Definition: Biography.cs:9
void RerollBio(Chara c, int ageIndex=0, bool keepParent=false)
Definition: Biography.cs:377
int idMom
Definition: Biography.cs:125
string nameLoc
Definition: Biography.cs:258
string TextBio2(Chara c)
Definition: Biography.cs:484
int idInterest
Definition: Biography.cs:245
int extroversion
Definition: Biography.cs:233
int idHome
Definition: Biography.cs:101
int stability
Definition: Biography.cs:185
void Generate(Chara c)
Definition: Biography.cs:308
string nameMom
Definition: Biography.cs:262
int gender
Definition: Biography.cs:29
string TextAppearance()
Definition: Biography.cs:494
string TextAge(Chara c)
Definition: Biography.cs:280
void SetPortrait(Chara c)
Definition: Biography.cs:459
string idLike
Definition: Biography.cs:17
bool IsUnderAge
Definition: Biography.cs:278
void GenerateBirthday(Chara c, int ageIndex=0)
Definition: Biography.cs:390
int idHobby
Definition: Biography.cs:173
int birthMonth
Definition: Biography.cs:77
int dominance
Definition: Biography.cs:221
string id
Definition: CardRow.cs:7
virtual Chara Chara
Definition: Card.cs:1946
string id
Definition: Card.cs:31
SourceMaterial.Row material
Definition: Card.cs:1927
void SetRandomTone()
Definition: Card.cs:6155
bool HasTag(CTAG tag)
Definition: Card.cs:2455
void SetRandomTalk()
Definition: Card.cs:6146
Definition: Chara.cs:10
new TraitChara trait
Definition: Chara.cs:488
bool IsHuman
Definition: Chara.cs:835
SourceChara.Row source
Definition: Chara.cs:143
string GetIdPortraitCat()
Definition: Chara.cs:7320
SourceRace.Row race
Definition: Chara.cs:449
Definition: EClass.cs:5
static int rnd(int a)
Definition: EClass.cs:50
static SourceManager sources
Definition: EClass.cs:42
Definition: Gender.cs:2
static int GetRandom()
Definition: Gender.cs:19
Definition: Lang.cs:6
static string _gender(int id)
Definition: Lang.cs:177
static string Parse(string idLang, string val1, string val2=null, string val3=null, string val4=null, string val5=null)
Definition: Lang.cs:147
static string GetRandomPortrait(string idDict)
Definition: Portrait.cs:105
Definition: Rand.cs:4
static int Range(int min, int max)
Definition: Rand.cs:42
static int rndNormal(int max)
Definition: Rand.cs:77
List< Row > hobbies
SourceThing things
LangWord langWord
SourceElement elements