Elin Modding Docs Doc
Loading...
Searching...
No Matches
SourceThingV.cs
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Reflection;
5
6// Token: 0x0200002E RID: 46
7public class SourceThingV : SourceDataString<SourceThingV.Row>
8{
9 // Token: 0x06000163 RID: 355 RVA: 0x0000D304 File Offset: 0x0000B504
10 public override SourceThingV.Row CreateRow()
11 {
12 return new SourceThingV.Row
13 {
14 id = SourceData.GetString(0),
15 _origin = SourceData.GetString(1),
16 name_JP = SourceData.GetString(2),
17 unit_JP = SourceData.GetString(3),
18 name = SourceData.GetString(4),
19 unit = SourceData.GetString(5),
20 tiles = SourceData.GetIntArray(6),
21 skins = SourceData.GetIntArray(7),
22 parse = SourceData.GetStringArray(8),
23 vals = SourceData.GetStringArray(9),
24 trait = SourceData.GetStringArray(11),
25 LV = SourceData.GetInt(12),
26 chance = SourceData.GetInt(13),
27 value = SourceData.GetInt(14),
28 weight = SourceData.GetInt(15),
29 recipeKey = SourceData.GetStringArray(16),
30 factory = SourceData.GetStringArray(17),
31 components = SourceData.GetStringArray(18),
32 defMat = SourceData.GetString(19),
33 category = SourceData.GetString(20),
34 tag = SourceData.GetStringArray(21),
35 detail_JP = SourceData.GetString(22),
36 detail = SourceData.GetString(23)
37 };
38 }
39
40 // Token: 0x06000164 RID: 356 RVA: 0x0000D438 File Offset: 0x0000B638
41 public override void SetRow(SourceThingV.Row r)
42 {
43 this.map[r.id] = r;
44 }
45
46 // Token: 0x06000165 RID: 357 RVA: 0x0000D44C File Offset: 0x0000B64C
47 public override void RestorePref()
48 {
49 foreach (SourceThing.Row row in EClass.sources.things.rows)
50 {
51 SourceThing.Row row2 = EClass.sources.things._rows.TryGetValue(row.id, null);
52 SourcePref sourcePref = (row2 != null) ? row2.pref : null;
53 if (sourcePref == null && EClass.sources.asset.renames.ContainsKey(row.id))
54 {
55 SourceThing.Row row3 = EClass.sources.things._rows.TryGetValue(EClass.sources.asset.renames[row.id], null);
56 sourcePref = ((row3 != null) ? row3.pref : null);
57 }
58 row.pref = (sourcePref ?? new SourcePref());
59 }
60 Dictionary<string, SourceThing.Row> dictionary = new Dictionary<string, SourceThing.Row>();
61 foreach (SourceThing.Row row4 in EClass.sources.things.rows)
62 {
63 dictionary[row4.id] = row4;
64 }
65 foreach (SourceThing.Row row5 in EClass.sources.things.rows)
66 {
67 if (!row5.pref.UsePref && !row5._origin.IsEmpty())
68 {
69 SourceThing.Row row6 = dictionary[row5._origin];
70 row5.pref = IO.DeepCopy<SourcePref>(row6.pref);
71 row5.pref.flags |= PrefFlag.UsePref;
72 }
73 }
74 }
75
76 // Token: 0x06000166 RID: 358 RVA: 0x0000D62C File Offset: 0x0000B82C
77 public override void ValidatePref()
78 {
79 foreach (SourceThing.Row row in EClass.sources.things.rows)
80 {
81 row.pref.Validate();
82 }
83 }
84
85 // Token: 0x06000167 RID: 359 RVA: 0x0000D68C File Offset: 0x0000B88C
86 public override void OnAfterImportData()
87 {
88 Dictionary<string, SourceThing.Row> dictionary = new Dictionary<string, SourceThing.Row>();
89 foreach (SourceThing.Row row in EClass.sources.things.rows)
90 {
91 dictionary[row.id] = row;
92 }
93 System.Reflection.FieldInfo[] fields = EClass.sources.things.rows[0].GetType().GetFields();
94 foreach (SourceThingV.Row row2 in this.rows)
95 {
96 SourceThing.Row row3 = new SourceThing.Row();
97 SourceThing.Row o = dictionary[row2._origin];
98 foreach (System.Reflection.FieldInfo fieldInfo in fields)
99 {
100 if (!(fieldInfo.Name == "parse"))
101 {
102 row3.SetField(fieldInfo.Name, o.GetField(fieldInfo.Name));
103 }
104 }
105 row3.id = row2.id;
106 row3._origin = row2._origin;
107 if (row2.LV != 0)
108 {
109 row3.LV = row2.LV;
110 }
111 if (row2.chance != -1)
112 {
113 row3.chance = row2.chance;
114 }
115 if (row2.value != -1)
116 {
117 row3.value = row2.value;
118 }
119 else
120 {
121 row3.value += EClass.rnd(row3.value / 2);
122 }
123 if (row2.weight != -1)
124 {
125 row3.weight = row2.weight;
126 }
127 if (!row2.tiles.IsEmpty())
128 {
129 row3.tiles = row2.tiles;
130 }
131 if (!row2.skins.IsEmpty())
132 {
133 row3.skins = row2.skins;
134 }
135 if (!row2.name.IsEmpty())
136 {
137 row3.name = row2.name;
138 }
139 if (!row2.name_JP.IsEmpty())
140 {
141 row3.name_JP = row2.name_JP;
142 }
143 if (!row2.detail.IsEmpty())
144 {
145 row3.detail = row2.detail;
146 }
147 if (!row2.detail_JP.IsEmpty())
148 {
149 row3.detail_JP = row2.detail_JP;
150 }
151 if (!row2.unit.IsEmpty())
152 {
153 row3.unit = row2.unit;
154 }
155 if (!row2.unit_JP.IsEmpty())
156 {
157 row3.unit_JP = row2.unit_JP;
158 }
159 if (!row2.vals.IsEmpty())
160 {
161 row3.vals = row2.vals;
162 }
163 if (!row2.components.IsEmpty())
164 {
165 row3.components = row2.components;
166 }
167 if (!row2.defMat.IsEmpty())
168 {
169 row3.defMat = row2.defMat;
170 }
171 if (!row2.trait.IsEmpty())
172 {
173 row3.trait = row2.trait;
174 }
175 if (!row2.category.IsEmpty())
176 {
177 row3.category = row2.category;
178 }
179 if (!row2.factory.IsEmpty())
180 {
181 row3.factory = row2.factory;
182 }
183 if (!row2.tag.IsEmpty())
184 {
185 row3.tag = row2.tag;
186 }
187 row3.recipeKey = row2.recipeKey;
188 if (!row2.parse.IsEmpty())
189 {
190 string origin = row2._origin;
191 if (origin == "lamp_ceil2" || origin == "window" || origin == "windowL")
192 {
193 row3.idExtra = row2.parse[0];
194 }
195 else
196 {
197 string[] parse = row2.parse;
198 for (int i = 0; i < parse.Length; i++)
199 {
200 string[] array2 = parse[i].Split('/', StringSplitOptions.None);
201 string text = array2[0];
202 uint num = <PrivateImplementationDetails>.ComputeStringHash(text);
203 if (num <= 1260025160U)
204 {
205 if (num <= 455432284U)
206 {
207 if (num != 235771284U)
208 {
209 if (num == 455432284U)
210 {
211 if (text == "alt")
212 {
213 row3.altTiles = new int[]
214 {
215 array2[1].ToInt()
216 };
217 row3.ignoreAltFix = true;
218 }
219 }
220 }
221 else if (text == "sound")
222 {
223 row3.idSound = array2[1];
224 }
225 }
226 else if (num != 1031692888U)
227 {
228 if (num != 1035877158U)
229 {
230 if (num == 1260025160U)
231 {
232 if (text == "ex")
233 {
234 row3.idActorEx = array2[1];
235 }
236 }
237 }
238 else if (text == "unique")
239 {
240 row3.quality = 4;
241 }
242 }
243 else if (text == "color")
244 {
245 row3.colorMod = 100;
246 }
247 }
248 else if (num <= 2981401199U)
249 {
250 if (num != 1468549011U)
251 {
252 if (num != 2121067537U)
253 {
254 if (num == 2981401199U)
255 {
256 if (text == "anime")
257 {
258 SourceThing.Row row4 = row3;
259 int[] anime;
260 if (array2.Length <= 4)
261 {
262 if (array2.Length <= 3)
263 {
264 int[] array3 = new int[2];
265 array3[0] = array2[1].ToInt();
266 anime = array3;
267 array3[1] = array2[2].ToInt();
268 }
269 else
270 {
271 int[] array4 = new int[3];
272 array4[0] = array2[1].ToInt();
273 array4[1] = array2[2].ToInt();
274 anime = array4;
275 array4[2] = array2[3].ToInt();
276 }
277 }
278 else
279 {
280 int[] array5 = new int[4];
281 array5[0] = array2[1].ToInt();
282 array5[1] = array2[2].ToInt();
283 array5[2] = array2[3].ToInt();
284 anime = array5;
285 array5[3] = array2[4].ToInt();
286 }
287 row4.anime = anime;
288 }
289 }
290 }
291 else if (text == "naming")
292 {
293 row3.naming = array2[1];
294 }
295 }
296 else if (text == "ele")
297 {
298 int[] second = new int[]
299 {
300 Core.GetCurrent().sources.elements.alias[array2[1]].id,
301 array2[2].ToInt()
302 };
303 row3.elements = row3.elements.Concat(second).ToArray<int>();
304 }
305 }
306 else if (num != 3822567969U)
307 {
308 if (num != 3933629262U)
309 {
310 if (num == 4009327117U)
311 {
312 if (text == "render")
313 {
314 row3._idRenderData = array2[1];
315 }
316 }
317 }
318 else if (text == "no_color")
319 {
320 row3.colorMod = 0;
321 }
322 }
323 else if (text == "tiletype")
324 {
325 row3._tileType = array2[1];
326 }
327 }
328 }
329 }
330 this.OnImportRow(row2, row3);
331 row3.OnImportData(EClass.sources.things);
332 EClass.sources.things.rows.Add(row3);
333 }
334 this.rows.Clear();
335 }
336
337 // Token: 0x06000168 RID: 360 RVA: 0x0000DE0C File Offset: 0x0000C00C
338 public virtual void OnImportRow(SourceThingV.Row _r, SourceThing.Row c)
339 {
340 }
341
342 // Token: 0x1700003C RID: 60
343 // (get) Token: 0x06000169 RID: 361 RVA: 0x0000DE0E File Offset: 0x0000C00E
344 public override string[] ImportFields
345 {
346 get
347 {
348 return new string[]
349 {
350 "unit"
351 };
352 }
353 }
354
355 // Token: 0x020007B7 RID: 1975
356 [Serializable]
357 public class Row : SourceThing.Row
358 {
359 // Token: 0x17001110 RID: 4368
360 // (get) Token: 0x060037A8 RID: 14248 RVA: 0x0012B584 File Offset: 0x00129784
361 public override bool UseAlias
362 {
363 get
364 {
365 return false;
366 }
367 }
368
369 // Token: 0x17001111 RID: 4369
370 // (get) Token: 0x060037A9 RID: 14249 RVA: 0x0012B587 File Offset: 0x00129787
371 public override string GetAlias
372 {
373 get
374 {
375 return "n";
376 }
377 }
378
379 // Token: 0x04002166 RID: 8550
380 public string[] parse;
381 }
382}