Elin Decompiled Documentation EA 23.344.1 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 if (recipe == null)
21 {
22 return "???";
23 }
24 return "trackCraft_title".lang(recipe.Name, recipe.NameFactory);
25 }
26
27 public void SetRecipe(Recipe r)
28 {
29 idRecipe = r.id;
30 }
31
32 public override string GetDetail(bool onJournal = false)
33 {
34 if (recipe == null)
35 {
36 return "???";
37 }
38 if (ingredients == null)
39 {
41 }
42 string text = "";
43 for (int i = 0; i < ingredients.Count; i++)
44 {
45 Recipe.Ingredient ingredient = ingredients[i];
46 if (!text.IsEmpty())
47 {
48 text += Environment.NewLine;
49 }
50 ThingStack thingStack = EClass._map.Stocked.ListThingStack(ingredient, StockSearchMode.All);
51 _ = thingStack.list;
52 Thing thing = null;
53 foreach (Thing item in thingStack.list)
54 {
55 if (thing == null || item.Num > thing.Num)
56 {
57 thing = item;
58 }
59 }
60 int num = thing?.Num ?? 0;
61 if (num >= ingredient.req)
62 {
63 text += "trackCraft_met".lang().TagColor(FontColor.Good);
64 }
65 text = text + (ingredient.optional ? "+" : "") + ingredient.GetName() + " " + num + " / " + ingredient.req;
66 }
67 return text;
68 }
69}
FontColor
Definition: FontColor.cs:2
StockSearchMode
Definition: EClass.cs:6
static Map _map
Definition: EClass.cs:19
PropsStocked Stocked
Definition: Map.cs:126
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:75
Definition: Recipe.cs:7
string id
Definition: Recipe.cs:178
List< Thing > list
Definition: ThingStack.cs:5
Definition: Thing.cs:8