Elin Modding Docs Doc
Loading...
Searching...
No Matches
ElementSelecter.cs
1using System;
2using System.Collections.Generic;
3using UnityEngine;
4
5// Token: 0x02000357 RID: 855
6public class ElementSelecter : EClass
7{
8 // Token: 0x06001A8C RID: 6796 RVA: 0x000A5320 File Offset: 0x000A3520
9 public int Select(int lv)
10 {
11 if (this.listSource.Count == 0 || Application.isEditor)
12 {
13 this.listSource.Clear();
14 foreach (SourceElement.Row row in EClass.sources.elements.rows)
15 {
16 if (row.thing.Contains(this.type) && row.chance != 0 && !(row.aliasRef == "mold"))
17 {
18 this.listSource.Add(row);
19 }
20 }
21 }
22 this.list.Clear();
23 foreach (SourceElement.Row row2 in this.listSource)
24 {
25 if (row2.LV <= lv + this.lvMod)
26 {
27 if (!row2.aliasRef.IsEmpty() && row2.tag.Contains("domain"))
28 {
29 if (!this.useDomain && EClass.rnd(4) != 0)
30 {
31 continue;
32 }
33 SourceElement.Row row3 = EClass.sources.elements.alias[row2.aliasRef];
34 if ((this.useDomain && !EClass.player.domains.Contains(row3.id) && EClass.rnd(10) > 1) || !row3.tag.Contains(row2.alias.Split('_', StringSplitOptions.None)[0]))
35 {
36 continue;
37 }
38 }
39 this.list.Add(row2);
40 }
41 }
42 if (this.list.Count == 0)
43 {
44 return this.listSource.RandomItemWeighted((SourceElement.Row r) => (float)r.chance).id;
45 }
46 return this.list.RandomItemWeighted((SourceElement.Row r) => (float)r.chance).id;
47 }
48
49 // Token: 0x040010B6 RID: 4278
50 public List<SourceElement.Row> listSource = new List<SourceElement.Row>();
51
52 // Token: 0x040010B7 RID: 4279
53 public List<SourceElement.Row> list = new List<SourceElement.Row>();
54
55 // Token: 0x040010B8 RID: 4280
56 public string type = "B";
57
58 // Token: 0x040010B9 RID: 4281
59 public bool useDomain;
60
61 // Token: 0x040010BA RID: 4282
62 public int lvMod;
63}