Elin Decompiled Documentation EA 23.183 Nightly Patch 1
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 bool IsUnderAge(Chara c)
267 {
268 return GetAge(c) < 18;
269 }
270
271 public string TextAge(Chara c)
272 {
273 return Lang.Parse("age", (GetAge(c) >= 1000) ? "???" : (GetAge(c).ToString() ?? ""));
274 }
275
276 public int GetAge(Chara c)
277 {
278 if (c.c_lockedAge != 0)
279 {
280 return c.c_lockedAge - 1;
281 }
282 if (c.IsUnique)
283 {
284 string[] array = c.source.bio.Split('/');
285 if (array.Length > 1)
286 {
287 return int.Parse(array[1]);
288 }
289 }
290 return EClass.world.date.year - birthYear;
291 }
292
293 public void SetAge(Chara c, int a)
294 {
295 if (c.IsUnique)
296 {
297 c.c_lockedAge = a + 1;
298 string[] array = c.source.bio.Split('/');
299 if (array.Length > 1)
300 {
301 SetBirthYear(c, int.Parse(array[1]));
302 }
303 }
304 else if (c.c_lockedAge == 0)
305 {
306 SetBirthYear(c, a);
307 }
308 else
309 {
310 c.c_lockedAge = a + 1;
311 }
312 }
313
314 public void SetBirthYear(Chara c, int a)
315 {
316 birthYear = EClass.world.date.year - a;
317 }
318
319 public void Generate(Chara c)
320 {
321 string bio = c.source.bio;
322 _ = c.Chara.race;
323 stability = Rand.rndNormal(100);
324 law = Rand.rndNormal(100);
325 affection = Rand.rndNormal(100);
326 dominance = Rand.rndNormal(100);
328 idInterest = EClass.rnd(Enum.GetNames(typeof(Interest)).Length);
329 if (idFemale.Contains(c.id) || c.race.id == "roran")
330 {
331 SetGender(1);
332 }
333 else
334 {
336 }
337 RerollBio(c);
338 c.SetRandomTone();
339 c.SetRandomTalk();
340 bool flag = c.IsHuman;
341 if (!bio.IsEmpty())
342 {
343 string[] array = bio.Split('/');
344 SetGender((array[0] == "f") ? 1 : 2);
345 if (array.Length > 1)
346 {
347 if (!c.source.HasTag(CTAG.randomPortrait))
348 {
349 flag = false;
350 }
351 SetBirthYear(c, int.Parse(array[1]));
352 c.pccData = IO.LoadFile<PCCData>(CorePath.packageCore + "Data/PCC/" + c.id + ".txt");
353 }
354 if (array.Length > 2)
355 {
356 height = int.Parse(array[2]);
357 }
358 if (array.Length > 3)
359 {
360 weight = int.Parse(array[3]);
361 }
362 if (array.Length > 4)
363 {
364 c.c_idTone = array[4];
365 }
366 if (array.Length > 5 && !array[5].IsEmpty())
367 {
368 c.c_idTalk = array[5];
369 }
370 }
371 if (c.trait is TraitGuildClerk)
372 {
373 flag = true;
374 }
375 if (flag && !c.HasTag(CTAG.noPortrait))
376 {
377 SetPortrait(c);
378 }
379 if (c.id == "prostitute" && GetAge(c) < 15)
380 {
381 SetBirthYear(c, 15);
382 }
383 SourceThing.Row row = EClass.sources.things.rows.RandomItem();
384 idLike = row.id;
385 idHobby = EClass.sources.elements.hobbies.RandomItem().id;
386 }
387
388 public void RerollBio(Chara c, int ageIndex = 0, bool keepParent = false)
389 {
390 GenerateBirthday(c, ageIndex);
392 if (!keepParent)
393 {
394 GenerateDad();
395 GenerateMom();
396 idHome = RndBio("home");
397 idLoc = RndBio("loc");
398 }
399 }
400
401 public void GenerateBirthday(Chara c, int ageIndex = 0)
402 {
403 SourceRace.Row race = c.race;
404 int num = race.age[0];
405 int num2 = race.age[1];
406 if (ageIndex != 0)
407 {
408 int num3 = (num2 - num) / 4;
409 SetBirthYear(c, Rand.Range(num + num3 * (ageIndex - 1), num + num3 * ageIndex));
410 }
411 else
412 {
413 SetBirthYear(c, Rand.Range(num, num2));
414 }
415 birthDay = EClass.rnd(30) + 1;
416 birthMonth = EClass.rnd(12) + 1;
417 }
418
420 {
421 SourceRace.Row race = c.race;
422 height = race.height + EClass.rnd(race.height / 5 + 1) - EClass.rnd(race.height / 5 + 1);
423 if (c.source.tag.Contains("mini"))
424 {
425 height /= 10;
426 }
427 if (c.source.tag.Contains("mini"))
428 {
429 height /= 10;
430 }
431 weight = height * height * (EClass.rnd(6) + 18) / 10000;
432 }
433
434 public void GenerateDad()
435 {
436 idDad = RndBio("parent");
437 idAdvDad = RndBio("adv");
438 }
439
440 public void GenerateMom()
441 {
442 idMom = RndBio("parent");
443 idAdvMom = RndBio("adv");
444 }
445
446 private int RndBio(string group)
447 {
448 return WordGen.GetID(group);
449 }
450
451 private string StrBio(int id)
452 {
453 object obj;
454 if (!EClass.sources.langWord.map.ContainsKey(id))
455 {
456 obj = id.ToString();
457 if (obj == null)
458 {
459 return "";
460 }
461 }
462 else
463 {
464 obj = EClass.sources.langWord.map[id].GetText().Split(',')[0];
465 }
466 return (string)obj;
467 }
468
469 public void SetGender(int g)
470 {
471 gender = g;
472 if (gender > 2)
473 {
474 gender = 0;
475 }
476 }
477
478 public void SetPortrait(Chara c)
479 {
480 switch (c.id)
481 {
482 case "shojo":
483 c.c_idPortrait = Portrait.GetRandomPortrait("special_f-littlegirl");
484 break;
485 case "sister":
486 case "sister_shark":
487 case "sister_penguin":
488 c.c_idPortrait = Portrait.GetRandomPortrait("special_f-littlesister");
489 break;
490 case "citizen_exile":
491 c.c_idPortrait = "special_n-exile";
492 break;
493 default:
494 c.c_idPortrait = Portrait.GetRandomPortrait(gender, c.GetIdPortraitCat());
495 break;
496 }
497 }
498
499 public string TextBio(Chara c)
500 {
501 return c.race.GetText().ToTitleCase(wholeText: true) + " " + TextAge(c) + " " + Lang._gender(gender);
502 }
503
504 public string TextBio2(Chara c)
505 {
506 return Lang.Parse("heightWeight", height.ToString() ?? "", weight.ToString() ?? "") + " " + ((c.material.alias == "meat") ? "" : c.material.GetName().ToTitleCase(wholeText: true));
507 }
508
509 public string TextBioSlave(Chara c)
510 {
511 return " (" + Lang.GetList("genders_animal")[c.bio.gender] + " " + TextAge(c) + ")";
512 }
513
514 public string TextBirthDate(Chara c, bool _age = false)
515 {
516 return Lang.Parse("birthText", (birthYear >= 0) ? (birthYear.ToString() ?? "") : "???", birthMonth.ToString() ?? "", birthDay.ToString() ?? "") + (_age ? (" (" + TextAge(c) + ")") : "");
517 }
518
519 public string TextAppearance()
520 {
521 return Lang.Parse("heightWeight", height.ToString() ?? "", weight.ToString() ?? "");
522 }
523}
CTAG
Definition: CTAG.cs:2
Interest
Definition: Interest.cs:2
int birthYear
Definition: Biography.cs:89
string StrBio(int id)
Definition: Biography.cs:451
void GenerateMom()
Definition: Biography.cs:440
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:499
static string[] idFemale
Definition: Biography.cs:6
void SetGender(int g)
Definition: Biography.cs:469
string nameBirthplace
Definition: Biography.cs:264
void GenerateDad()
Definition: Biography.cs:434
int idDad
Definition: Biography.cs:113
int birthDay
Definition: Biography.cs:65
void GenerateAppearance(Chara c)
Definition: Biography.cs:419
string nameDad
Definition: Biography.cs:260
string[] strs
Definition: Biography.cs:12
string TextBirthDate(Chara c, bool _age=false)
Definition: Biography.cs:514
int GetAge(Chara c)
Definition: Biography.cs:276
int height
Definition: Biography.cs:53
int weight
Definition: Biography.cs:41
void SetAge(Chara c, int a)
Definition: Biography.cs:293
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:446
int[] ints
Definition: Biography.cs:9
void RerollBio(Chara c, int ageIndex=0, bool keepParent=false)
Definition: Biography.cs:388
int idMom
Definition: Biography.cs:125
string nameLoc
Definition: Biography.cs:258
string TextBio2(Chara c)
Definition: Biography.cs:504
bool IsUnderAge(Chara c)
Definition: Biography.cs:266
int idInterest
Definition: Biography.cs:245
int extroversion
Definition: Biography.cs:233
void SetBirthYear(Chara c, int a)
Definition: Biography.cs:314
int idHome
Definition: Biography.cs:101
int stability
Definition: Biography.cs:185
void Generate(Chara c)
Definition: Biography.cs:319
string nameMom
Definition: Biography.cs:262
int gender
Definition: Biography.cs:29
string TextAppearance()
Definition: Biography.cs:519
string TextAge(Chara c)
Definition: Biography.cs:271
void SetPortrait(Chara c)
Definition: Biography.cs:478
string idLike
Definition: Biography.cs:17
string TextBioSlave(Chara c)
Definition: Biography.cs:509
void GenerateBirthday(Chara c, int ageIndex=0)
Definition: Biography.cs:401
int idHobby
Definition: Biography.cs:173
int birthMonth
Definition: Biography.cs:77
int dominance
Definition: Biography.cs:221
string id
Definition: CardRow.cs:7
int c_lockedAge
Definition: Card.cs:1327
virtual Chara Chara
Definition: Card.cs:2032
string id
Definition: Card.cs:33
bool IsUnique
Definition: Card.cs:2053
SourceMaterial.Row material
Definition: Card.cs:2013
Biography bio
Definition: Card.cs:42
void SetRandomTone()
Definition: Card.cs:6612
bool HasTag(CTAG tag)
Definition: Card.cs:2557
void SetRandomTalk()
Definition: Card.cs:6603
Definition: Chara.cs:10
new TraitChara trait
Definition: Chara.cs:501
bool IsHuman
Definition: Chara.cs:877
SourceChara.Row source
Definition: Chara.cs:156
string GetIdPortraitCat()
Definition: Chara.cs:7716
SourceRace.Row race
Definition: Chara.cs:462
Definition: EClass.cs:5
static int rnd(long a)
Definition: EClass.cs:58
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[] GetList(string id)
Definition: Lang.cs:114
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