1using System.Collections.Generic;
9 public static List<RecipeSource>
list =
new List<RecipeSource>();
11 public static Dictionary<string, RecipeSource>
dict =
new Dictionary<string, RecipeSource>();
20 public Dictionary<string, int>
knownRecipes =
new Dictionary<string, int>();
26 public HashSet<string>
newRecipes =
new HashSet<string>();
29 public Dictionary<string, List<int>>
lastIngredients =
new Dictionary<string, List<int>>();
37 Debug.Log(
"Rebuilding recipe list");
52 Create(row2,
"BridgePillar",
"-p");
57 if (!row3.tag.Contains(
"noFloor"))
64 if (!row4.tag.Contains(
"noBridge") && !row4.factory.IsEmpty() && row4.factory[0] !=
"x")
66 Create(row4,
"Bridge",
"-b");
83 recipeSource.id = row.RecipeID + suffix;
84 recipeSource.isBridge = type ==
"Bridge";
85 recipeSource.isBridgePillar = type ==
"BridgePillar";
86 recipeSource.type = type;
87 recipeSource.row = row;
89 list.Add(recipeSource);
90 dict[recipeSource.
id] = recipeSource;
97 return dict.TryGetValue(
id);
102 return dict.TryGetValue(
id);
105 public void Add(
string id,
bool showEffect =
true)
112 if (recipeSource ==
null)
128 EClass.
pc.
Say(
"learnRecipe" + ((num == 1) ?
"New" :
""),
dict[
id].Name.ToTitleCase(), num.ToString() ??
"");
140 recipeSource =
Get(
id +
"-p");
141 if (recipeSource !=
null && !
knownRecipes.ContainsKey(recipeSource.
id))
143 Add(recipeSource.
id, showEffect:
false);
145 recipeSource =
Get(
id.Replace(
"-p",
""));
146 if (recipeSource !=
null && !
knownRecipes.ContainsKey(recipeSource.
id))
148 Add(recipeSource.
id, showEffect:
false);
152 recipeSource =
Get(
id +
"-b");
153 if (recipeSource !=
null && !
knownRecipes.ContainsKey(recipeSource.
id))
155 Add(recipeSource.
id, showEffect:
false);
157 recipeSource =
Get(
id.Replace(
"-b",
""));
158 if (recipeSource !=
null && !
knownRecipes.ContainsKey(recipeSource.
id))
160 Add(recipeSource.
id, showEffect:
false);
177 List<RecipeSource>
list =
new List<RecipeSource>();
180 if (
item.isBridgePillar || (factory ==
null &&
item.idFactory !=
"self") || (factory !=
null && !factory.trait.Contains(
item)) ||
item.isChara ||
item.noListing)
187 if (
item.row.recipeKey !=
null &&
item.row.recipeKey.Length != 0 &&
item.row.recipeKey[0][0] ==
'*')
192 if (!(
id ==
"waystone"))
228 Msg.
Say(
"learnRecipeSleep");
236 string randomRecipe =
GetRandomRecipe(lvBonus, idCat, onlyUnlearned:
true);
237 if (randomRecipe !=
null)
239 Msg.
Say(
"learnRecipeIdea");
246 if (idRecipe.IsEmpty())
265 if (idRecipe.IsEmpty())
288 Msg.
Say(
"learnRecipeIdea");
295 List<RecipeSource>
list =
new List<RecipeSource>();
308 List<RecipeSource>
list =
new List<RecipeSource>();
314 list.Add(recipeSource);
320 public static string GetRandomRecipe(
int lvBonus,
string cat =
null,
bool onlyUnlearned =
false)
324 if (recipeSource ==
null)
328 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)
bool CanCeomUpWithRecipe(string idRecipe)
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)
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