Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
QuestTrackCraft.cs
Go to the documentation of this file.
1using System;
2using System.Collections.Generic;
3using Newtonsoft.Json;
4
5public class QuestTrackCraft : Quest
6{
7 [JsonProperty]
8 public string idRecipe;
9
11
13
15
16 public override bool CanAbandon => true;
17
18 public override string GetTitle()
19 {
20 return "trackCraft_title".lang(recipe.Name, recipe.NameFactory);
21 }
22
23 public void SetRecipe(Recipe r)
24 {
25 idRecipe = r.id;
26 }
27
28 public override string GetDetail(bool onJournal = false)
29 {
30 if (ingredients == null)
31 {
33 }
34 string text = "";
35 for (int i = 0; i < ingredients.Count; i++)
36 {
37 Recipe.Ingredient ingredient = ingredients[i];
38 if (!text.IsEmpty())
39 {
40 text += Environment.NewLine;
41 }
42 ThingStack thingStack = EClass._map.Stocked.ListThingStack(ingredient, StockSearchMode.All);
43 _ = thingStack.list;
44 Thing thing = null;
45 foreach (Thing item in thingStack.list)
46 {
47 if (thing == null || item.Num > thing.Num)
48 {
49 thing = item;
50 }
51 }
52 int num = thing?.Num ?? 0;
53 if (num >= ingredient.req)
54 {
55 text += "trackCraft_met".lang().TagColor(FontColor.Good);
56 }
57 text = text + (ingredient.optional ? "+" : "") + ingredient.GetName() + " " + num + " / " + ingredient.req;
58 }
59 return text;
60 }
61}
FontColor
Definition: FontColor.cs:2
StockSearchMode
Definition: EClass.cs:5
static Map _map
Definition: EClass.cs:18
PropsStocked Stocked
Definition: Map.cs:121
ThingStack ListThingStack(Recipe.Ingredient ing, StockSearchMode searchMode)
Definition: Props.cs:204
override string GetDetail(bool onJournal=false)
void SetRecipe(Recipe r)
override string GetTitle()
RecipeSource recipe
List< Recipe.Ingredient > ingredients
override bool CanAbandon
RecipeSource _recipe
Definition: Quest.cs:7
static RecipeSource Get(string id)
List< Recipe.Ingredient > GetIngredients()
string NameFactory
Definition: RecipeSource.cs:73
Definition: Recipe.cs:7
string id
Definition: Recipe.cs:161
List< Thing > list
Definition: ThingStack.cs:5
Definition: Thing.cs:8