1using System.Collections.Generic;
17 public static List<RecipeSource>
list =
new List<RecipeSource>();
19 public static Dictionary<string, RecipeSource>
dict =
new Dictionary<string, RecipeSource>();
28 public Dictionary<string, int>
knownRecipes =
new Dictionary<string, int>();
34 public HashSet<string>
newRecipes =
new HashSet<string>();
37 public Dictionary<string, List<int>>
lastIngredients =
new Dictionary<string, List<int>>();
45 Debug.Log(
"Rebuilding recipe list");
60 Create(row2,
"BridgePillar",
"-p");
65 if (!row3.tag.Contains(
"noFloor"))
72 if (!row4.tag.Contains(
"noBridge") && !row4.factory.IsEmpty() && row4.factory[0] !=
"x")
74 Create(row4,
"Bridge",
"-b");
91 recipeSource.id = row.RecipeID + suffix;
92 recipeSource.isBridge = type ==
"Bridge";
93 recipeSource.isBridgePillar = type ==
"BridgePillar";
94 recipeSource.type = type;
95 recipeSource.row = row;
97 list.Add(recipeSource);
98 dict[recipeSource.
id] = recipeSource;
105 return dict.TryGetValue(
id);
110 return dict.TryGetValue(
id);
113 public void Add(
string id,
bool showEffect =
true)
120 if (recipeSource ==
null)
136 EClass.
pc.
Say(
"learnRecipe" + ((num == 1) ?
"New" :
""),
dict[
id].Name.ToTitleCase(), num.ToString() ??
"");
148 recipeSource =
Get(
id +
"-p");
149 if (recipeSource !=
null && !
knownRecipes.ContainsKey(recipeSource.
id))
151 Add(recipeSource.
id, showEffect:
false);
153 recipeSource =
Get(
id.Replace(
"-p",
""));
154 if (recipeSource !=
null && !
knownRecipes.ContainsKey(recipeSource.
id))
156 Add(recipeSource.
id, showEffect:
false);
160 recipeSource =
Get(
id +
"-b");
161 if (recipeSource !=
null && !
knownRecipes.ContainsKey(recipeSource.
id))
163 Add(recipeSource.
id, showEffect:
false);
165 recipeSource =
Get(
id.Replace(
"-b",
""));
166 if (recipeSource !=
null && !
knownRecipes.ContainsKey(recipeSource.
id))
168 Add(recipeSource.
id, showEffect:
false);
185 List<RecipeSource>
list =
new List<RecipeSource>();
188 if (
item.isBridgePillar || (factory ==
null &&
item.idFactory !=
"self") || (factory !=
null && !factory.trait.Contains(
item)) ||
item.isChara ||
item.noListing)
195 if (
item.row.recipeKey !=
null &&
item.row.recipeKey.Length != 0 &&
item.row.recipeKey[0][0] ==
'*')
200 if (!(
id ==
"waystone"))
236 Msg.
Say(
"learnRecipeSleep");
244 string randomRecipe =
GetRandomRecipe(lvBonus, idCat, onlyUnlearned:
true);
245 if (randomRecipe !=
null)
247 Msg.
Say(
"learnRecipeIdea");
254 if (idRecipe.IsEmpty())
277 if (idRecipe.IsEmpty())
301 Msg.
Say(
"learnRecipeIdea");
308 List<RecipeSource>
list =
new List<RecipeSource>();
321 List<RecipeSource>
list =
new List<RecipeSource>();
327 list.Add(recipeSource);
333 public static string GetRandomRecipe(
int lvBonus,
string cat =
null,
bool onlyUnlearned =
false)
337 if (recipeSource ==
null)
341 return recipeSource?.
id;
SoundSource PlaySound(string id, float v=1f, bool spatial=true)
void ShowEmo(Emo _emo=Emo.none, float duration=0f, bool skipSame=true)
void Say(string lang, string ref1=null, string ref2=null)
static SourceManager sources
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
static void SetSeed(int a=-1)
Dictionary< string, List< int > > lastIngredients
HashSet< string > craftedRecipes
static List< RecipeSource > list
void ComeUpWithRecipe(string idRecipe, int chanceForRandomRecipe=0)
static RecipeSource Get(string id)
static RecipeSource GetLearnedRecipe(string cat=null)
static Dictionary< string, RecipeSource > dict
HashSet< string > knownIngredients
static void Create(RenderRow row, string type, string suffix="")
static RecipeSource GetUnlearnedRecipe(int lvBonus, string cat, bool onlyUnlearned)
LearnState GetRecipeLearnState(string idRecipe)
void OnSleep(bool ehe=false)
Dictionary< string, int > knownRecipes
List< RecipeSource > ListSources(Thing factory, List< RecipeSource > newRecipes=null)
void Add(string id, bool showEffect=true)
HashSet< string > hoveredRecipes
static string GetRandomRecipe(int lvBonus, string cat=null, bool onlyUnlearned=false)
void ComeUpWithRandomRecipe(string idCat=null, int lvBonus=0)
RecipeSource GetSource(string id)
HashSet< string > newRecipes
static Recipe Create(RecipeSource _source, int idMat=-1, Thing ing=null)
virtual void BuildIngredientList()
SourceCategory.Row Category
SourceCellEffect cellEffects
void Foreach(Action< Thing > action, bool onlyAccessible=true)
static TileTypePillar Pillar