Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
SourceElement.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using System.Reflection;
4using UnityEngine;
5using UnityEngine.UI;
6
7public class SourceElement : SourceDataInt<SourceElement.Row>
8{
9 [Serializable]
10 public class Row : BaseRow
11 {
12 public int id;
13
14 public string alias;
15
16 public string name_JP;
17
18 public string name;
19
20 public string altname_JP;
21
22 public string altname;
23
24 public string aliasParent;
25
26 public string aliasRef;
27
28 public string aliasMtp;
29
30 public float parentFactor;
31
32 public int lvFactor;
33
34 public int encFactor;
35
36 public string encSlot;
37
38 public int mtp;
39
40 public int LV;
41
42 public int chance;
43
44 public int value;
45
46 public int[] cost;
47
48 public int geneSlot;
49
50 public int sort;
51
52 public string target;
53
54 public string[] proc;
55
56 public string type;
57
58 public string group;
59
60 public string category;
61
62 public string categorySub;
63
64 public string[] abilityType;
65
66 public string[] tag;
67
68 public string thing;
69
70 public int eleP;
71
72 public int cooldown;
73
74 public int charge;
75
76 public float radius;
77
78 public int max;
79
80 public string[] req;
81
82 public string idTrainer;
83
84 public int partySkill;
85
86 public string tagTrainer;
87
88 public string levelBonus_JP;
89
90 public string levelBonus;
91
92 public string[] foodEffect;
93
94 public string[] langAct;
95
96 public string detail_JP;
97
98 public string detail;
99
100 public string textPhase_JP;
101
102 public string textPhase;
103
104 public string textExtra_JP;
105
106 public string textExtra;
107
108 public string textInc_JP;
109
110 public string textInc;
111
112 public string textDec_JP;
113
114 public string textDec;
115
116 public string[] textAlt_JP;
117
118 public string[] textAlt;
119
120 public string[] adjective_JP;
121
122 public string[] adjective;
123
124 [NonSerialized]
125 public bool isAttribute;
126
127 [NonSerialized]
129
130 [NonSerialized]
131 public bool isSkill;
132
133 [NonSerialized]
134 public bool isSpell;
135
136 [NonSerialized]
137 public bool isTrait;
138
139 public int idMold;
140
141 [NonSerialized]
142 public string name_L;
143
144 [NonSerialized]
145 public string altname_L;
146
147 [NonSerialized]
148 public string detail_L;
149
150 [NonSerialized]
151 public string textPhase_L;
152
153 [NonSerialized]
154 public string textExtra_L;
155
156 [NonSerialized]
157 public string textInc_L;
158
159 [NonSerialized]
160 public string textDec_L;
161
162 [NonSerialized]
163 public string levelBonus_L;
164
165 [NonSerialized]
166 public string[] textAlt_L;
167
168 [NonSerialized]
169 public string[] adjective_L;
170
171 public override bool UseAlias => true;
172
173 public override string GetAlias => alias;
174
175 public bool IsWeaponEnc
176 {
177 get
178 {
179 if (!tag.Contains("weaponEnc") && !(categorySub == "eleConvert") && !(categorySub == "eleAttack"))
180 {
181 return category == "ability";
182 }
183 return true;
184 }
185 }
186
187 public override string GetName()
188 {
189 if (idMold != 0)
190 {
191 return EClass.sources.elements.map[idMold].alias.lang(EClass.sources.elements.alias[aliasRef].GetAltname(0));
192 }
193 return base.GetName();
194 }
195
196 public Sprite GetSprite()
197 {
198 return SpriteSheet.Get("Media/Graphics/Icon/Element/icon_ability", alias) ?? SpriteSheet.Get("Media/Graphics/Icon/Element/icon_ability", type) ?? EClass.core.refs.icons.defaultAbility;
199 }
200
201 public void SetImage(Image image)
202 {
203 image.sprite = GetSprite() ?? EClass.core.refs.icons.defaultAbility;
204 if (!aliasRef.IsEmpty())
205 {
206 image.color = EClass.setting.elements[aliasRef].colorSprite;
207 }
208 else
209 {
210 image.color = Color.white;
211 }
212 }
213
214 public string GetAltname(int i)
215 {
216 return GetText("altname").Split(',').TryGet(i);
217 }
218
220 {
221 if (id == 10)
222 {
223 return true;
224 }
225 if (isTrait)
226 {
228 {
229 return false;
230 }
231 return true;
232 }
234 {
235 return false;
236 }
237 if (!t.IsEquipment)
238 {
239 return IsWeaponEnc;
240 }
241 return true;
242 }
243
245 {
246 if (encSlot.IsEmpty())
247 {
248 return false;
249 }
250 if (encSlot == "global")
251 {
252 return true;
253 }
254 int slot = cat.slot;
255 if (slot == 0)
256 {
257 return IsWeaponEnc;
258 }
259 string text = encSlot;
260 if (!(text == "all"))
261 {
262 if (text == "weapon")
263 {
264 return cat.IsChildOf("weapon");
265 }
266 return encSlot.Contains(EClass.sources.elements.map[slot].alias);
267 }
268 return true;
269 }
270 }
271
272 [NonSerialized]
273 public List<Row> hobbies = new List<Row>();
274
275 public override string[] ImportFields => new string[8] { "altname", "textPhase", "textExtra", "textInc", "textDec", "textAlt", "adjective", "levelBonus" };
276
277 public override Row CreateRow()
278 {
279 return new Row
280 {
281 id = SourceData.GetInt(0),
282 alias = SourceData.GetString(1),
283 name_JP = SourceData.GetString(2),
284 name = SourceData.GetString(3),
285 altname_JP = SourceData.GetString(4),
286 altname = SourceData.GetString(5),
287 aliasParent = SourceData.GetString(6),
288 aliasRef = SourceData.GetString(7),
289 aliasMtp = SourceData.GetString(8),
290 parentFactor = SourceData.GetFloat(9),
291 lvFactor = SourceData.GetInt(10),
292 encFactor = SourceData.GetInt(11),
293 encSlot = SourceData.GetString(12),
294 mtp = SourceData.GetInt(13),
295 LV = SourceData.GetInt(14),
296 chance = SourceData.GetInt(15),
297 value = SourceData.GetInt(16),
298 cost = SourceData.GetIntArray(17),
299 geneSlot = SourceData.GetInt(18),
300 sort = SourceData.GetInt(19),
301 target = SourceData.GetString(20),
302 proc = SourceData.GetStringArray(21),
303 type = SourceData.GetString(22),
304 group = SourceData.GetString(23),
305 category = SourceData.GetString(24),
306 categorySub = SourceData.GetString(25),
307 abilityType = SourceData.GetStringArray(26),
308 tag = SourceData.GetStringArray(27),
309 thing = SourceData.GetString(28),
310 eleP = SourceData.GetInt(29),
311 cooldown = SourceData.GetInt(30),
312 charge = SourceData.GetInt(31),
313 radius = SourceData.GetFloat(32),
314 max = SourceData.GetInt(33),
315 req = SourceData.GetStringArray(34),
316 idTrainer = SourceData.GetString(35),
317 partySkill = SourceData.GetInt(36),
318 tagTrainer = SourceData.GetString(37),
319 levelBonus_JP = SourceData.GetString(38),
320 levelBonus = SourceData.GetString(39),
321 foodEffect = SourceData.GetStringArray(40),
322 langAct = SourceData.GetStringArray(42),
323 detail_JP = SourceData.GetString(43),
324 detail = SourceData.GetString(44),
325 textPhase_JP = SourceData.GetString(45),
326 textPhase = SourceData.GetString(46),
327 textExtra_JP = SourceData.GetString(47),
328 textExtra = SourceData.GetString(48),
329 textInc_JP = SourceData.GetString(49),
330 textInc = SourceData.GetString(50),
331 textDec_JP = SourceData.GetString(51),
332 textDec = SourceData.GetString(52),
333 textAlt_JP = SourceData.GetStringArray(53),
334 textAlt = SourceData.GetStringArray(54),
335 adjective_JP = SourceData.GetStringArray(55),
336 adjective = SourceData.GetStringArray(56)
337 };
338 }
339
340 public override void SetRow(Row r)
341 {
342 map[r.id] = r;
343 }
344
345 public override void OnInit()
346 {
347 foreach (Row row in rows)
348 {
349 if (row.id >= 100 && row.id < 400)
350 {
351 hobbies.Add(row);
352 }
353 row.isAttribute = row.category == "attribute";
354 row.isPrimaryAttribute = row.isAttribute && row.tag.Contains("primary");
355 row.isSkill = row.category == "skill";
356 row.isSpell = row.categorySub == "spell";
357 row.isTrait = row.tag.Contains("trait");
358 }
359 }
360
361 public override void OnAfterImportData()
362 {
364 foreach (Row row in rows)
365 {
366 map[row.id] = row;
367 alias[row.GetAlias] = row;
368 }
369 int num = 50000;
370 int num2 = 0;
371 for (int i = 910; i < 927; i++)
372 {
373 Row ele = EClass.sources.elements.map[i];
374 AddRow(ele, num + num2 + 100, "ball_");
375 AddRow(ele, num + num2 + 200, "breathe_");
376 AddRow(ele, num + num2 + 300, "bolt_");
377 AddRow(ele, num + num2 + 400, "hand_");
378 AddRow(ele, num + num2 + 500, "arrow_");
379 AddRow(ele, num + num2 + 600, "funnel_");
380 AddRow(ele, num + num2 + 700, "miasma_");
381 AddRow(ele, num + num2 + 800, "weapon_");
382 AddRow(ele, num + num2 + 900, "puddle_");
383 num2++;
384 }
385 }
386
387 public void AddRow(Row ele, int id, string idOrg)
388 {
389 Row row = EClass.sources.elements.alias[idOrg];
390 System.Reflection.FieldInfo[] fields = row.GetType().GetFields();
391 Row row2 = new Row();
392 System.Reflection.FieldInfo[] array = fields;
393 foreach (System.Reflection.FieldInfo fieldInfo in array)
394 {
395 row2.SetField(fieldInfo.Name, row.GetField<object>(fieldInfo.Name));
396 }
397 row2.id = id;
398 row2.idMold = row.id;
399 row2.alias = row.alias + ele.alias.Remove(0, 3);
400 row2.aliasRef = ele.alias;
401 row2.aliasParent = ele.aliasParent;
402 row2.chance = row.chance * ele.chance / 100;
403 row2.LV = row.LV;
404 row2.OnImportData(EClass.sources.elements);
405 rows.Add(row2);
406 }
407}
bool IsThrownWeapon
Definition: Card.cs:2105
bool IsEquipmentOrRangedOrAmmo
Definition: Card.cs:2090
bool IsEquipment
Definition: Card.cs:2049
Sprite defaultAbility
Definition: CoreRef.cs:114
Icons icons
Definition: CoreRef.cs:339
Definition: Core.cs:14
CoreRef refs
Definition: Core.cs:51
static Core SetCurrent(Core _current=null)
Definition: Core.cs:579
Definition: EClass.cs:5
static Core core
Definition: EClass.cs:6
static SourceManager sources
Definition: EClass.cs:42
static GameSetting setting
Definition: EClass.cs:34
UD_String_ElementRef elements
Definition: GameSetting.cs:315
static float GetFloat(int id)
Definition: SourceData.cs:726
static string[] GetStringArray(int id)
Definition: SourceData.cs:741
static string GetString(int id)
Definition: SourceData.cs:746
static int GetInt(int id)
Definition: SourceData.cs:711
static int[] GetIntArray(int id)
Definition: SourceData.cs:736
override string GetAlias
bool IsEncAppliable(SourceCategory.Row cat)
string[] abilityType
override string GetName()
override bool UseAlias
void SetImage(Image image)
bool IsMaterialEncAppliable(Thing t)
string GetAltname(int i)
override void OnInit()
override void OnAfterImportData()
List< Row > hobbies
override Row CreateRow()
void AddRow(Row ele, int id, string idOrg)
override void SetRow(Row r)
override string[] ImportFields
SourceElement elements
static Sprite Get(string id)
Definition: SpriteSheet.cs:28
Definition: Thing.cs:8