Elin Decompiled Documentation EA 23.351.2 Nightly
Loading...
Searching...
No Matches
RecipeSource.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2
3public class RecipeSource : EClass
4{
5 public RenderRow row;
6
7 public string type;
8
9 public string id;
10
11 public int colorIng;
12
13 public bool isBridge;
14
15 public bool isBridgePillar;
16
17 public bool isChara;
18
19 public bool noListing;
20
21 public bool isRandom;
22
23 public bool alwaysKnown;
24
25 public bool noRandomRecipe;
26
27 public static List<Recipe.Ingredient> DefaultIngredients = new List<Recipe.Ingredient>
28 {
30 {
31 id = "log",
32 req = 1
33 }
34 };
35
36 public string recipeCat
37 {
38 get
39 {
40 if (!isBridge && !isBridgePillar)
41 {
42 return row.Category.recipeCat;
43 }
44 return "foundation";
45 }
46 }
47
48 public string Name => row.GetName() + (isBridgePillar ? (" " + "recipeBridgePillar".lang()) : (isBridge ? (" " + "recipeBridge".lang()) : ""));
49
50 public bool IsQuickCraft
51 {
52 get
53 {
54 if (!row.factory.IsEmpty())
55 {
56 return row.factory[0] == "self";
57 }
58 return false;
59 }
60 }
61
62 public bool NeedFactory
63 {
64 get
65 {
66 if (!row.factory.IsEmpty() && row.factory[0] != "self" && row.factory[0] != "x" && row.factory[0] != "none")
67 {
68 return row.factory[0] != "None";
69 }
70 return false;
71 }
72 }
73
74 public string NameFactory
75 {
76 get
77 {
78 if (!NeedFactory)
79 {
80 return EClass.sources.elements.map[6012].GetName();
81 }
82 if (!EClass.sources.cards.map.TryGetValue(idFactory, out var value))
83 {
84 return idFactory;
85 }
86 return value.GetName();
87 }
88 }
89
90 public string idFactory
91 {
92 get
93 {
94 if (!row.factory.IsEmpty())
95 {
96 if (!isBridge)
97 {
98 if (!isBridgePillar)
99 {
100 return row.factory[0];
101 }
102 return "tool_carving";
103 }
104 return "factory_platform";
105 }
106 return null;
107 }
108 }
109
110 public bool ShouldList()
111 {
112 if (noListing)
113 {
114 if (id == "f90" && EClass.game.IsSurvival)
115 {
116 return true;
117 }
118 return false;
119 }
120 return true;
121 }
122
123 public string GetDetail()
124 {
125 return row.GetDetail();
126 }
127
128 public bool IsCraftable()
129 {
130 if (idFactory.IsEmpty() || idFactory == "x" || idFactory == "none")
131 {
132 return false;
133 }
134 return true;
135 }
136
138 {
140 }
141
143 {
144 if (row.components.Length == 0)
145 {
146 return DefaultIngredients;
147 }
148 if (row.components[0] == "-")
149 {
150 return DefaultIngredients;
151 }
152 if (row.recipeKey.Length != 0)
153 {
154 if (row.recipeKey[0] == "*")
155 {
156 alwaysKnown = true;
157 }
158 else if (row.recipeKey[0] == "-")
159 {
160 noRandomRecipe = true;
161 }
162 }
163 string[] components = row.components;
164 List<Recipe.Ingredient> list = new List<Recipe.Ingredient>();
165 if (!components.IsEmpty() && components[0] != "-")
166 {
167 for (int i = 0; i < components.Length; i++)
168 {
169 string[] array = components[i].Split('|');
170 string[] array2 = array[0].Split('/');
171 string[] array3 = array2[0].Split('@');
172 bool optional = false;
173 bool useCat = false;
174 while (true)
175 {
176 switch (array3[0][0])
177 {
178 case '$':
179 colorIng = i;
180 array3[0] = array3[0].Remove(0, 1);
181 break;
182 case '#':
183 useCat = true;
184 array3[0] = array3[0].Remove(0, 1);
185 break;
186 case '+':
187 goto IL_0132;
188 }
189 break;
190 IL_0132:
191 optional = true;
192 array3[0] = array3[0].Remove(0, 1);
193 }
194 Recipe.Ingredient ingredient = new Recipe.Ingredient
195 {
196 id = array3[0],
197 tag = ((array3.Length > 1) ? array3[1] : null),
198 req = ((array2.Length <= 1) ? 1 : int.Parse(array2[1])),
199 optional = optional,
200 useCat = useCat
201 };
202 if (array.Length > 1)
203 {
204 for (int j = 1; j < array.Length; j++)
205 {
206 ingredient.idOther.Add(array[j]);
207 }
208 }
209 list.Add(ingredient);
210 }
211 }
212 return list;
213 }
214
215 public string GetIDIngredient()
216 {
217 string[] components = row.components;
218 if (!components.IsEmpty() && components[0] != "-")
219 {
220 int num = 0;
221 if (num < components.Length)
222 {
223 string[] array = components[num].Split('/')[0].Split('@');
224 char c = array[0][0];
225 if (c == '#' || c == '$' || c == '+')
226 {
227 array[0] = array[0].Remove(0, 1);
228 }
229 return array[0];
230 }
231 }
232 return null;
233 }
234
235 public int GetSPCost(Card factory)
236 {
237 Element reqSkill = GetReqSkill();
238 int num = row.Category.costSP + reqSkill.Value / 10;
239 int num2 = EClass.pc.Evalue(reqSkill.id);
240 if (num2 < reqSkill.Value)
241 {
242 num += (reqSkill.Value - num2) * 2 / 3;
243 }
244 return num;
245 }
246}
Definition: Card.cs:11
int Evalue(int ele)
Definition: Card.cs:2704
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
static SourceManager sources
Definition: EClass.cs:43
static Chara pc
Definition: EClass.cs:15
int id
Definition: ELEMENT.cs:259
int Value
Definition: ELEMENT.cs:301
static Element Create(int id, int v=0)
Definition: ELEMENT.cs:1163
bool IsSurvival
Definition: Game.cs:276
bool alwaysKnown
Definition: RecipeSource.cs:23
Element GetReqSkill()
RenderRow row
Definition: RecipeSource.cs:5
List< Recipe.Ingredient > GetIngredients()
bool IsQuickCraft
Definition: RecipeSource.cs:51
string recipeCat
Definition: RecipeSource.cs:37
string idFactory
Definition: RecipeSource.cs:91
string NameFactory
Definition: RecipeSource.cs:75
string GetDetail()
bool isBridgePillar
Definition: RecipeSource.cs:15
string type
Definition: RecipeSource.cs:7
bool ShouldList()
int GetSPCost(Card factory)
bool noRandomRecipe
Definition: RecipeSource.cs:25
bool NeedFactory
Definition: RecipeSource.cs:63
bool IsCraftable()
string GetIDIngredient()
static List< Recipe.Ingredient > DefaultIngredients
Definition: RecipeSource.cs:27
List< string > idOther
Definition: Recipe.cs:41
Definition: Recipe.cs:7
string[] factory
Definition: RenderRow.cs:54
SourceCategory.Row Category
Definition: RenderRow.cs:123
string[] components
Definition: RenderRow.cs:52
string[] recipeKey
Definition: RenderRow.cs:56
int LV
Definition: RenderRow.cs:22
Dictionary< string, CardRow > map
Definition: SourceCard.cs:9
TraitCrafter GetModelCrafter(string id)
Definition: SourceCard.cs:32
string GetDetail()
Definition: SourceData.cs:678
virtual string GetName()
Definition: SourceData.cs:673
SourceCard cards
SourceElement elements
Definition: Trait.cs:7
static TraitSelfFactory SelfFactory
Definition: Trait.cs:26