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");
95 recipeSource.id = row.RecipeID + suffix;
96 recipeSource.isBridge = type ==
"Bridge";
97 recipeSource.isBridgePillar = type ==
"BridgePillar";
98 recipeSource.type = type;
99 recipeSource.row = row;
103 recipeSource.noListing =
true;
105 list.Add(recipeSource);
106 dict[recipeSource.
id] = recipeSource;
113 return dict.TryGetValue(
id);
118 return dict.TryGetValue(
id);
121 public void Add(
string id,
bool showEffect =
true)
128 if (recipeSource ==
null)
144 EClass.
pc.
Say(
"learnRecipe" + ((num == 1) ?
"New" :
""),
dict[
id].Name.ToTitleCase(), num.ToString() ??
"");
156 recipeSource =
Get(
id +
"-p");
157 if (recipeSource !=
null && !
knownRecipes.ContainsKey(recipeSource.
id))
159 Add(recipeSource.
id, showEffect:
false);
161 recipeSource =
Get(
id.Replace(
"-p",
""));
162 if (recipeSource !=
null && !
knownRecipes.ContainsKey(recipeSource.
id))
164 Add(recipeSource.
id, showEffect:
false);
168 recipeSource =
Get(
id +
"-b");
169 if (recipeSource !=
null && !
knownRecipes.ContainsKey(recipeSource.
id))
171 Add(recipeSource.
id, showEffect:
false);
173 recipeSource =
Get(
id.Replace(
"-b",
""));
174 if (recipeSource !=
null && !
knownRecipes.ContainsKey(recipeSource.
id))
176 Add(recipeSource.
id, showEffect:
false);
193 List<RecipeSource>
list =
new List<RecipeSource>();
196 if (
item.isBridgePillar || (factory ==
null &&
item.idFactory !=
"self") || (factory !=
null && !factory.trait.Contains(
item)) ||
item.isChara ||
item.noListing)
203 if (
item.row.recipeKey !=
null &&
item.row.recipeKey.Length != 0 &&
item.row.recipeKey[0][0] ==
'*')
208 if (!(
id ==
"waystone"))
244 Msg.
Say(
"learnRecipeSleep");
252 string randomRecipe =
GetRandomRecipe(lvBonus, idCat, onlyUnlearned:
true);
253 if (randomRecipe !=
null)
255 Msg.
Say(
"learnRecipeIdea");
262 if (idRecipe.IsEmpty())
285 if (idRecipe.IsEmpty())
309 Msg.
Say(
"learnRecipeIdea");
316 List<RecipeSource>
list =
new List<RecipeSource>();
329 List<RecipeSource>
list =
new List<RecipeSource>();
335 list.Add(recipeSource);
341 public static string GetRandomRecipe(
int lvBonus,
string cat =
null,
bool onlyUnlearned =
false)
345 if (recipeSource ==
null)
349 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