Elin Decompiled Documentation EA 23.342.1 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, string charaId=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 ()
 

Properties

string BioId [get, private set]
 
- 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]
 

Private Attributes

int[] _tempLangKey = new int[4]
 

Static Private Attributes

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

Additional Inherited Members

- Static Public Attributes inherited from EClass
static Core core
 

Detailed Description

Definition at line 7 of file CustomBiographyContent.cs.

Member Function Documentation

◆ CreateFromId()

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

Definition at line 42 of file CustomBiographyContent.cs.

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

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

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

◆ LoadContent()

override void CustomBiographyContent.LoadContent ( )
inlineprotectedvirtual

Implements CustomFileContent.

Definition at line 151 of file CustomBiographyContent.cs.

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

References 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 62 of file CustomBiographyContent.cs.

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

References BioId, CreateFromId(), and CustomFileContent.File.

◆ RefreshCharaBio()

void CustomBiographyContent.RefreshCharaBio ( Chara  chara)
inline

Definition at line 72 of file CustomBiographyContent.cs.

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

◆ _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().

Property Documentation

◆ BioId

string CustomBiographyContent.BioId
getprivate set

Definition at line 40 of file CustomBiographyContent.cs.

40{ get; private set; }

Referenced by CreateFromId(), and OnSetLang().


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