Elin Decompiled Documentation EA 23.329 Nightly
Loading...
Searching...
No Matches
CustomBiographyContent Class Reference
Inheritance diagram for CustomBiographyContent:
CustomFileContent CustomContent EClass

Public Member Functions

override void OnSetLang (string lang)
 
void RefreshCharaBio (Chara chara)
 
- Public Member Functions inherited from CustomFileContent
bool HasFileChanged ()
 
virtual void OnSetLang (string lang)
 
void Load ()
 
- Public Member Functions inherited from CustomContent
virtual void OnGameLoad (GameIOContext context)
 
virtual void OnGameSave (GameIOContext context)
 
override string ToString ()
 

Static Public Member Functions

static CustomBiographyContent CreateFromId (string biographyId, ModPackage owner=null)
 
- Static Public Member Functions inherited from EClass
static int rndSeed (int a, int seed)
 
static int rnd (long a)
 
static int rnd (int a)
 
static int curve (long _a, int start, int step, int rate=75)
 
static int sqrt (int a)
 
static int rndHalf (int a)
 
static float rndf (float a)
 
static int rndSqrt (int a)
 
static void Wait (float a, Card c)
 
static void Wait (float a, Point p)
 
static int Bigger (int a, int b)
 
static int Smaller (int a, int b)
 

Public Attributes

string background
 
int birthDay
 
int birthMonth
 
int birthYear
 
string birthLocation
 
string birthPlace
 
string dad
 
string mom
 
string likeThing
 
string likeHobby
 
string favCategory
 
string favFood
 

Protected Member Functions

override void LoadContent ()
 
abstract void LoadContent ()
 

Private Attributes

int[] _tempLangKey = new int[4]
 
bool _initialized
 

Static Private Attributes

const int FallbackWordKey = -100
 
static int _lastWordKey = -101
 

Additional Inherited Members

- Static Public Attributes inherited from EClass
static Core core
 
- Properties inherited from CustomFileContent
DateTime LastModified = DateTime.MinValue [get, set]
 
FileInfo File [get, set]
 
- Properties inherited from CustomContent
string ContentId [get, protected set]
 
EMod Owner [get, protected set]
 
- Properties inherited from EClass
static Game game [get]
 
static bool AdvMode [get]
 
static Player player [get]
 
static Chara pc [get]
 
static UI ui [get]
 
static Map _map [get]
 
static Zone _zone [get]
 
static FactionBranch Branch [get]
 
static FactionBranch BranchOrHomeBranch [get]
 
static Faction Home [get]
 
static Faction Wilds [get]
 
static Scene scene [get]
 
static BaseGameScreen screen [get]
 
static GameSetting setting [get]
 
static GameData gamedata [get]
 
static ColorProfile Colors [get]
 
static World world [get]
 
static SourceManager sources [get]
 
static SourceManager editorSources [get]
 
static SoundManager Sound [get]
 
static CoreDebug debug [get]
 

Detailed Description

Definition at line 7 of file CustomBiographyContent.cs.

Member Function Documentation

◆ CreateFromId()

static CustomBiographyContent CustomBiographyContent.CreateFromId ( string  biographyId,
ModPackage  owner = null 
)
inlinestatic

Definition at line 41 of file CustomBiographyContent.cs.

42 {
43 var (fileInfo, eMod) = PackageIterator.GetFilesEx("Data/bio_" + biographyId + ".json").LastOrDefault();
44 if (fileInfo == null)
45 {
46 return null;
47 }
48 if (owner == null)
49 {
50 owner = eMod as ModPackage;
51 }
52 return new CustomBiographyContent
53 {
54 ContentId = "Biography/" + biographyId,
55 Owner = owner,
56 File = fileInfo
57 };
58 }
string ContentId
Definition: CustomContent.cs:6

References CustomContent.ContentId, CustomFileContent.File, and CustomContent.Owner.

Referenced by CustomCharaContent.CreateFromRow(), and OnSetLang().

◆ LoadContent()

override void CustomBiographyContent.LoadContent ( )
inlineprotectedvirtual

Implements CustomFileContent.

Definition at line 154 of file CustomBiographyContent.cs.

155 {
156 CustomBiographyContent customBiographyContent = IO.LoadFile<CustomBiographyContent>(base.File.FullName);
157 background = customBiographyContent.background;
158 birthDay = customBiographyContent.birthDay;
159 birthMonth = customBiographyContent.birthMonth;
160 birthYear = customBiographyContent.birthYear;
161 birthLocation = customBiographyContent.birthLocation;
162 birthPlace = customBiographyContent.birthPlace;
163 dad = customBiographyContent.dad;
164 mom = customBiographyContent.mom;
165 likeThing = customBiographyContent.likeThing;
166 likeHobby = customBiographyContent.likeHobby;
167 favCategory = customBiographyContent.favCategory;
168 favFood = customBiographyContent.favFood;
169 _initialized = false;
170 }
Definition: IO.cs:10

References _initialized, background, birthDay, birthLocation, birthMonth, birthPlace, birthYear, dad, favCategory, favFood, likeHobby, likeThing, and mom.

◆ OnSetLang()

override void CustomBiographyContent.OnSetLang ( string  lang)
inlinevirtual

Reimplemented from CustomFileContent.

Definition at line 60 of file CustomBiographyContent.cs.

61 {
62 CustomBiographyContent customBiographyContent = CreateFromId(base.ContentId.Split('/')[^1]);
63 if (customBiographyContent != null)
64 {
65 base.File = customBiographyContent.File;
66 base.LastModified = DateTime.MinValue;
67 }
68 }
static CustomBiographyContent CreateFromId(string biographyId, ModPackage owner=null)

References CreateFromId(), and CustomFileContent.File.

◆ RefreshCharaBio()

void CustomBiographyContent.RefreshCharaBio ( Chara  chara)
inline

Definition at line 70 of file CustomBiographyContent.cs.

71 {
72 Load();
73 if (_initialized)
74 {
75 return;
76 }
77 Biography bio = chara.bio;
78 if (birthDay != 0)
79 {
80 bio.birthDay = birthDay;
81 }
82 if (birthMonth != 0)
83 {
84 bio.birthMonth = birthMonth;
85 }
86 if (birthYear != 0)
87 {
88 bio.birthYear = birthYear;
89 }
90 Dictionary<int, LangWord.Row> langWord = EClass.sources.langWord.map;
91 if (!langWord.ContainsKey(-100))
92 {
93 _lastWordKey = -100;
94 Dictionary<int, LangWord.Row> dictionary = langWord;
96 {
97 id = -100
98 };
99 LangWord.Row row = obj;
100 dictionary[-100] = obj;
101 row.name = (row.name_JP = (row.name_L = ""));
102 }
103 if (!birthPlace.IsEmpty())
104 {
105 bio.idHome = SetTempWord(birthPlace, 0);
106 }
107 if (!birthLocation.IsEmpty())
108 {
109 bio.idLoc = SetTempWord(birthLocation, 1);
110 }
111 if (!dad.IsEmpty())
112 {
113 bio.idAdvDad = -100;
114 bio.idDad = SetTempWord(dad, 2);
115 }
116 if (!mom.IsEmpty())
117 {
118 bio.idAdvMom = -100;
119 bio.idMom = SetTempWord(mom, 3);
120 }
121 if (!likeThing.IsEmpty() && EClass.sources.cards.map.ContainsKey(likeThing))
122 {
123 bio.idLike = likeThing;
124 }
125 if (!likeHobby.IsEmpty())
126 {
127 int element = Core.GetElement(likeHobby);
128 if (element != EClass.sources.elements.rows[0].id)
129 {
130 bio.idHobby = element;
131 }
132 }
133 _initialized = true;
134 int SetTempWord(string text, int tempIndex)
135 {
136 int num = _tempLangKey[tempIndex];
137 if (num == 0 || !langWord.ContainsKey(num))
138 {
139 while (langWord.ContainsKey(_lastWordKey))
140 {
141 _lastWordKey--;
142 }
143 num = _lastWordKey;
144 }
145 LangWord.Row row3 = (langWord[num] = new LangWord.Row
146 {
147 id = num
148 });
149 row3.name = (row3.name_JP = (row3.name_L = text));
150 return _tempLangKey[tempIndex] = num;
151 }
152 }
Biography bio
Definition: Card.cs:45
Definition: Core.cs:14
static int GetElement(string id)
Definition: Core.cs:743
Definition: EClass.cs:6
static SourceManager sources
Definition: EClass.cs:43
Dictionary< string, CardRow > map
Definition: SourceCard.cs:9
SourceCard cards
LangWord langWord
SourceElement elements

References _initialized, _lastWordKey, _tempLangKey, Card.bio, birthDay, birthLocation, birthMonth, birthPlace, birthYear, SourceManager.cards, dad, SourceManager.elements, Core.GetElement(), SourceManager.langWord, likeHobby, likeThing, CustomFileContent.Load(), SourceCard.map, mom, and EClass.sources.

Member Data Documentation

◆ _initialized

bool CustomBiographyContent._initialized
private

Definition at line 39 of file CustomBiographyContent.cs.

Referenced by LoadContent(), and RefreshCharaBio().

◆ _lastWordKey

int CustomBiographyContent._lastWordKey = -101
staticprivate

Definition at line 11 of file CustomBiographyContent.cs.

Referenced by RefreshCharaBio().

◆ _tempLangKey

int [] CustomBiographyContent._tempLangKey = new int[4]
private

Definition at line 37 of file CustomBiographyContent.cs.

Referenced by RefreshCharaBio().

◆ background

string CustomBiographyContent.background

Definition at line 13 of file CustomBiographyContent.cs.

Referenced by LoadContent().

◆ birthDay

int CustomBiographyContent.birthDay

Definition at line 15 of file CustomBiographyContent.cs.

Referenced by LoadContent(), and RefreshCharaBio().

◆ birthLocation

string CustomBiographyContent.birthLocation

Definition at line 21 of file CustomBiographyContent.cs.

Referenced by LoadContent(), and RefreshCharaBio().

◆ birthMonth

int CustomBiographyContent.birthMonth

Definition at line 17 of file CustomBiographyContent.cs.

Referenced by LoadContent(), and RefreshCharaBio().

◆ birthPlace

string CustomBiographyContent.birthPlace

Definition at line 23 of file CustomBiographyContent.cs.

Referenced by LoadContent(), and RefreshCharaBio().

◆ birthYear

int CustomBiographyContent.birthYear

Definition at line 19 of file CustomBiographyContent.cs.

Referenced by LoadContent(), and RefreshCharaBio().

◆ dad

string CustomBiographyContent.dad

Definition at line 25 of file CustomBiographyContent.cs.

Referenced by LoadContent(), and RefreshCharaBio().

◆ FallbackWordKey

const int CustomBiographyContent.FallbackWordKey = -100
staticprivate

Definition at line 9 of file CustomBiographyContent.cs.

◆ favCategory

string CustomBiographyContent.favCategory

Definition at line 33 of file CustomBiographyContent.cs.

Referenced by LoadContent().

◆ favFood

string CustomBiographyContent.favFood

Definition at line 35 of file CustomBiographyContent.cs.

Referenced by LoadContent().

◆ likeHobby

string CustomBiographyContent.likeHobby

Definition at line 31 of file CustomBiographyContent.cs.

Referenced by LoadContent(), and RefreshCharaBio().

◆ likeThing

string CustomBiographyContent.likeThing

Definition at line 29 of file CustomBiographyContent.cs.

Referenced by LoadContent(), and RefreshCharaBio().

◆ mom

string CustomBiographyContent.mom

Definition at line 27 of file CustomBiographyContent.cs.

Referenced by LoadContent(), and RefreshCharaBio().


The documentation for this class was generated from the following file: