2using System.Collections.Generic;
18 public static List<RecipeSource>
list =
new List<RecipeSource>();
20 public static Dictionary<string, RecipeSource>
dict =
new Dictionary<string, RecipeSource>();
29 public Dictionary<string, int>
knownRecipes =
new Dictionary<string, int>();
35 public HashSet<string>
newRecipes =
new HashSet<string>();
38 public Dictionary<string, List<int>>
lastIngredients =
new Dictionary<string, List<int>>();
46 Debug.Log(
"Rebuilding recipe list");
61 Create(row2,
"BridgePillar",
"-p");
66 if (!row3.tag.Contains(
"noFloor"))
73 if (!row4.tag.Contains(
"noBridge") && !row4.factory.IsEmpty() && row4.factory[0] !=
"x")
75 Create(row4,
"Bridge",
"-b");
96 recipeSource.id = row.RecipeID + suffix;
97 recipeSource.isBridge = type ==
"Bridge";
98 recipeSource.isBridgePillar = type ==
"BridgePillar";
99 recipeSource.type = type;
100 recipeSource.row = row;
104 recipeSource.noListing =
true;
106 list.Add(recipeSource);
107 dict[recipeSource.
id] = recipeSource;
115 list.Remove(recipeSource);
116 dict.Remove(recipeSource.
id);
117 Debug.LogWarning(
$"Failed to create recipe '{row.RecipeID}' '{type}{suffix}'\n{ex}");
123 return dict.TryGetValue(
id);
128 return dict.TryGetValue(
id);
131 public void Add(
string id,
bool showEffect =
true)
138 if (recipeSource ==
null)
154 EClass.
pc.
Say(
"learnRecipe" + ((num == 1) ?
"New" :
""),
dict[
id].Name.ToTitleCase(), num.ToString() ??
"");
166 recipeSource =
Get(
id +
"-p");
167 if (recipeSource !=
null && !
knownRecipes.ContainsKey(recipeSource.
id))
169 Add(recipeSource.
id, showEffect:
false);
171 recipeSource =
Get(
id.Replace(
"-p",
""));
172 if (recipeSource !=
null && !
knownRecipes.ContainsKey(recipeSource.
id))
174 Add(recipeSource.
id, showEffect:
false);
178 recipeSource =
Get(
id +
"-b");
179 if (recipeSource !=
null && !
knownRecipes.ContainsKey(recipeSource.
id))
181 Add(recipeSource.
id, showEffect:
false);
183 recipeSource =
Get(
id.Replace(
"-b",
""));
184 if (recipeSource !=
null && !
knownRecipes.ContainsKey(recipeSource.
id))
186 Add(recipeSource.
id, showEffect:
false);
203 List<RecipeSource>
list =
new List<RecipeSource>();
206 if (
item.isBridgePillar || (factory ==
null &&
item.idFactory !=
"self") || (factory !=
null && !factory.trait.Contains(
item)) ||
item.isChara ||
item.noListing)
213 if (
item.row.recipeKey !=
null &&
item.row.recipeKey.Length != 0 &&
item.row.recipeKey[0][0] ==
'*')
218 if (!(
id ==
"waystone"))
254 Msg.
Say(
"learnRecipeSleep");
262 string randomRecipe =
GetRandomRecipe(lvBonus, idCat, onlyUnlearned:
true);
263 if (randomRecipe !=
null)
265 Msg.
Say(
"learnRecipeIdea");
272 if (idRecipe.IsEmpty())
295 if (idRecipe.IsEmpty())
319 Msg.
Say(
"learnRecipeIdea");
326 List<RecipeSource>
list =
new List<RecipeSource>();
339 List<RecipeSource>
list =
new List<RecipeSource>();
345 list.Add(recipeSource);
351 public static string GetRandomRecipe(
int lvBonus,
string cat =
null,
bool onlyUnlearned =
false)
355 if (recipeSource ==
null)
359 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