Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
SourceCategory.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3
4public class SourceCategory : SourceDataString<SourceCategory.Row>
5{
6 [Serializable]
7 public class Row : BaseRow
8 {
9 public string id;
10
11 public int uid;
12
13 public string name_JP;
14
15 public string name;
16
17 public string _parent;
18
19 public string recipeCat;
20
21 public int slot;
22
23 public int skill;
24
25 public int maxStack;
26
27 public int tileDummy;
28
29 public bool installOne;
30
31 public int ignoreBless;
32
33 public string[] tag;
34
35 public string idThing;
36
37 public string[] recycle;
38
39 public int costSP;
40
41 public int gift;
42
43 public int deliver;
44
45 public int offer;
46
47 public int ticket;
48
49 public int sortVal;
50
51 public int flag;
52
53 [NonSerialized]
54 public Row parent;
55
56 [NonSerialized]
57 public List<Row> children;
58
59 [NonSerialized]
60 public string name_L;
61
62 public override bool UseAlias => false;
63
64 public override string GetAlias => "n";
65
66 public bool IsChildOf(string id)
67 {
68 return IsChildOf(EClass.sources.categories.map[id]);
69 }
70
71 public bool IsChildOf(Row r)
72 {
73 if (r == this)
74 {
75 return true;
76 }
77 if (parent != null)
78 {
79 return parent.IsChildOf(r);
80 }
81 return false;
82 }
83
84 public bool IsChildOf(int _uid)
85 {
86 if (uid == _uid)
87 {
88 return true;
89 }
90 if (parent != null)
91 {
92 return parent.IsChildOf(_uid);
93 }
94 return false;
95 }
96
97 public bool Contatin(int _uid)
98 {
99 if (uid == _uid)
100 {
101 return true;
102 }
103 foreach (Row child in children)
104 {
105 if (child.Contatin(_uid))
106 {
107 return true;
108 }
109 }
110 return false;
111 }
112
113 public Row GetRoot()
114 {
115 if (parent == null)
116 {
117 return this;
118 }
119 return parent.GetRoot();
120 }
121
123 {
124 if (parent == null || parent.parent == null)
125 {
126 return this;
127 }
128 return parent.GetSecondRoot();
129 }
130
131 public string GetIdThing()
132 {
133 if (!idThing.IsEmpty())
134 {
135 return idThing;
136 }
137 return parent.GetIdThing();
138 }
139 }
140
141 public override Row CreateRow()
142 {
143 return new Row
144 {
145 id = SourceData.GetString(0),
146 uid = SourceData.GetInt(1),
147 name_JP = SourceData.GetString(2),
148 name = SourceData.GetString(3),
149 _parent = SourceData.GetString(4),
150 recipeCat = SourceData.GetString(5),
151 slot = Core.GetElement(SourceData.GetStr(6)),
152 skill = Core.GetElement(SourceData.GetStr(7)),
153 maxStack = SourceData.GetInt(8),
154 tileDummy = SourceData.GetInt(9),
155 installOne = SourceData.GetBool(10),
156 ignoreBless = SourceData.GetInt(11),
157 tag = SourceData.GetStringArray(12),
158 idThing = SourceData.GetString(13),
159 recycle = SourceData.GetStringArray(14),
160 costSP = SourceData.GetInt(15),
161 gift = SourceData.GetInt(16),
162 deliver = SourceData.GetInt(17),
163 offer = SourceData.GetInt(18),
164 ticket = SourceData.GetInt(19),
165 sortVal = SourceData.GetInt(20),
166 flag = SourceData.GetInt(21)
167 };
168 }
169
170 public override void SetRow(Row r)
171 {
172 map[r.id] = r;
173 }
174
175 public override void OnInit()
176 {
177 foreach (Row row in rows)
178 {
179 row.children = new List<Row>();
180 }
181 foreach (Row row2 in rows)
182 {
183 if (!row2._parent.IsEmpty())
184 {
185 (row2.parent = map[row2._parent]).children.Add(row2);
186 }
187 }
188 }
189}
@ gift
Definition: Core.cs:14
static int GetElement(string id)
Definition: Core.cs:731
Definition: EClass.cs:5
static SourceManager sources
Definition: EClass.cs:42
bool IsChildOf(Row r)
override bool UseAlias
bool IsChildOf(int _uid)
bool Contatin(int _uid)
List< Row > children
bool IsChildOf(string id)
override string GetAlias
override Row CreateRow()
override void SetRow(Row r)
override void OnInit()
static string[] GetStringArray(int id)
Definition: SourceData.cs:741
static string GetString(int id)
Definition: SourceData.cs:746
static bool GetBool(int id)
Definition: SourceData.cs:716
static int GetInt(int id)
Definition: SourceData.cs:711
static string GetStr(int id, bool useDefault=false)
Definition: SourceData.cs:751
SourceCategory categories