Elin Modding Docs Doc
Loading...
Searching...
No Matches
CardFilter.cs
1using System;
2using System.Collections.Generic;
3
4// Token: 0x020004F2 RID: 1266
5[Serializable]
6public class CardFilter : EClass
7{
8 // Token: 0x060021C3 RID: 8643 RVA: 0x000BAC1C File Offset: 0x000B8E1C
9 public override string ToString()
10 {
11 return this.id;
12 }
13
14 // Token: 0x060021C4 RID: 8644 RVA: 0x000BAC24 File Offset: 0x000B8E24
15 protected virtual bool _ShouldPass(CardRow source)
16 {
17 return true;
18 }
19
20 // Token: 0x060021C5 RID: 8645 RVA: 0x000BAC27 File Offset: 0x000B8E27
21 public virtual bool ContainsTag(CardRow source, string str)
22 {
23 return source.tag.Contains(str);
24 }
25
26 // Token: 0x060021C6 RID: 8646 RVA: 0x000BAC38 File Offset: 0x000B8E38
27 public void Init()
28 {
29 this.BuildList(this.tags, this.strTag);
30 this.BuildList(this.filters, this.strFilter);
31 if (!this.filterCategory.IsEmpty())
32 {
33 foreach (string text in this.filterCategory)
34 {
35 bool flag = text.StartsWith('-');
36 SourceCategory.Row row = EClass.sources.categories.map[flag ? text.Remove(0, 1) : text];
37 this.categories.Add(new CardFilter.FilterCategory
38 {
39 exclude = flag,
40 row = row
41 });
42 if (!flag)
43 {
44 this.categoriesInclude.Add(row);
45 }
46 }
47 }
48 this.isInitialied = true;
49 }
50
51 // Token: 0x060021C7 RID: 8647 RVA: 0x000BACF4 File Offset: 0x000B8EF4
52 public bool Pass(CardRow source)
53 {
54 if (!this.isInitialied)
55 {
56 this.Init();
57 }
58 if (source.chance == 0 || source.isOrigin)
59 {
60 return false;
61 }
62 for (int i = 0; i < this.tags.Count; i++)
63 {
64 CardFilter.FilterItem filterItem = this.tags[i];
65 if (filterItem.exclude)
66 {
67 if (this.ContainsTag(source, filterItem.name))
68 {
69 return false;
70 }
71 }
72 else if (!this.ContainsTag(source, filterItem.name))
73 {
74 return false;
75 }
76 }
77 for (int j = 0; j < this.filters.Count; j++)
78 {
79 CardFilter.FilterItem filterItem2 = this.filters[j];
80 if (filterItem2.exclude)
81 {
82 if (source.filter.Contains(filterItem2.name))
83 {
84 return false;
85 }
86 }
87 else if (!source.filter.Contains(filterItem2.name))
88 {
89 return false;
90 }
91 }
92 if ((this.isChara && !source.isChara) || (!this.isChara && source.isChara))
93 {
94 return false;
95 }
96 if (this.categories.Count > 0)
97 {
98 bool flag = false;
99 foreach (CardFilter.FilterCategory filterCategory in this.categories)
100 {
101 if ((!flag || filterCategory.exclude) && EClass.sources.categories.map[source.category].IsChildOf(filterCategory.row))
102 {
103 if (filterCategory.exclude)
104 {
105 return false;
106 }
107 flag = true;
108 }
109 }
110 if (!flag)
111 {
112 return false;
113 }
114 }
115 return this._ShouldPass(source);
116 }
117
118 // Token: 0x060021C8 RID: 8648 RVA: 0x000BAE98 File Offset: 0x000B9098
119 public void BuildList(List<CardFilter.FilterItem> list, string[] strs)
120 {
121 if (strs == null)
122 {
123 return;
124 }
125 foreach (string text in strs)
126 {
127 list.Add(CardFilter.GetFilterItem(text));
128 }
129 }
130
131 // Token: 0x060021C9 RID: 8649 RVA: 0x000BAECC File Offset: 0x000B90CC
132 public static CardFilter.FilterItem GetFilterItem(string text)
133 {
134 bool flag = text.StartsWith("-");
135 return new CardFilter.FilterItem
136 {
137 exclude = flag,
138 name = (flag ? text.Substring(1) : text)
139 };
140 }
141
142 // Token: 0x0400113E RID: 4414
143 public string id;
144
145 // Token: 0x0400113F RID: 4415
146 public string[] strTag;
147
148 // Token: 0x04001140 RID: 4416
149 public string[] strFilter;
150
151 // Token: 0x04001141 RID: 4417
152 public string[] filterCategory;
153
154 // Token: 0x04001142 RID: 4418
155 public string[] idCard;
156
157 // Token: 0x04001143 RID: 4419
158 public List<CardFilter.FilterItem> tags = new List<CardFilter.FilterItem>();
159
160 // Token: 0x04001144 RID: 4420
161 public List<CardFilter.FilterItem> filters = new List<CardFilter.FilterItem>();
162
163 // Token: 0x04001145 RID: 4421
164 public List<CardFilter.FilterCategory> categories = new List<CardFilter.FilterCategory>();
165
166 // Token: 0x04001146 RID: 4422
167 public List<SourceCategory.Row> categoriesInclude = new List<SourceCategory.Row>();
168
169 // Token: 0x04001147 RID: 4423
170 private bool isInitialied;
171
172 // Token: 0x04001148 RID: 4424
173 public bool isChara;
174
175 // Token: 0x020009F3 RID: 2547
176 public class FilterItem
177 {
178 // Token: 0x04002923 RID: 10531
179 public bool exclude;
180
181 // Token: 0x04002924 RID: 10532
182 public string name;
183 }
184
185 // Token: 0x020009F4 RID: 2548
186 public class FilterCategory
187 {
188 // Token: 0x04002925 RID: 10533
189 public bool exclude;
190
191 // Token: 0x04002926 RID: 10534
192 public SourceCategory.Row row;
193 }
194
195 // Token: 0x020009F5 RID: 2549
196 public enum FilterMode
197 {
198 // Token: 0x04002928 RID: 10536
199 None,
200 // Token: 0x04002929 RID: 10537
201 Exclude,
202 // Token: 0x0400292A RID: 10538
203 Match,
204 // Token: 0x0400292B RID: 10539
205 Equipped
206 }
207}