84 lines
4.1 KiB
C#
84 lines
4.1 KiB
C#
namespace Harmony.XUiM_RecipesPatches
|
|
{
|
|
|
|
/*[HarmonyPatch(typeof(XUiM_Recipes))]
|
|
[HarmonyPatch("FilterRecipesByWorkstation")]
|
|
public class FilterRecipesByWorkstationPatch
|
|
{
|
|
public static bool Prefix(XUiM_Recipes __instance, ref List<Recipe> __result, string _workstation, IList<Recipe> recipeList)
|
|
{
|
|
//Log.Out("XUiM_RecipesPatches-FilterRecipesByWorkstation _workstation: " + _workstation);
|
|
|
|
if (_workstation == "cntWoodBurningStove_PickedUp")
|
|
{
|
|
_workstation = "campfire";
|
|
}
|
|
|
|
if (_workstation == null)
|
|
_workstation = "";
|
|
List<Recipe> recipeList1 = new List<Recipe>();
|
|
for (int index1 = 0; index1 < recipeList.Count; ++index1)
|
|
{
|
|
if (recipeList[index1] != null)
|
|
{
|
|
if (_workstation != "")
|
|
{
|
|
Block blockByName = Block.GetBlockByName(_workstation);
|
|
if (blockByName != null && blockByName.Properties.Values.ContainsKey("Workstation.CraftingAreaRecipes"))
|
|
{
|
|
string str = blockByName.Properties.Values["Workstation.CraftingAreaRecipes"];
|
|
|
|
//Log.Out("XUiM_RecipesPatches-FilterRecipesByWorkstation str: " + str);
|
|
|
|
string[] strArray = new string[1] { str };
|
|
if (str.Contains(","))
|
|
strArray = str.Replace(", ", ",").Replace(" ,", ",").Replace(" , ", ",").Split(',', StringSplitOptions.None);
|
|
bool flag = false;
|
|
for (int index2 = 0; index2 < strArray.Length; ++index2)
|
|
{
|
|
//Log.Out("XUiM_RecipesPatches-FilterRecipesByWorkstation index2: " + index2);
|
|
|
|
if (recipeList[index1].craftingArea != null && recipeList[index1].craftingArea.EqualsCaseInsensitive(strArray[index2]))
|
|
{
|
|
//Log.Out("XUiM_RecipesPatches-FilterRecipesByWorkstation 1");
|
|
recipeList1.Add(recipeList[index1]);
|
|
flag = true;
|
|
break;
|
|
}
|
|
if ((recipeList[index1].craftingArea == null || recipeList[index1].craftingArea == "") && strArray[index2].EqualsCaseInsensitive("player"))
|
|
{
|
|
//Log.Out("XUiM_RecipesPatches-FilterRecipesByWorkstation 2");
|
|
recipeList1.Add(recipeList[index1]);
|
|
flag = true;
|
|
break;
|
|
}
|
|
}
|
|
if (!flag && recipeList[index1].craftingArea != null && recipeList[index1].craftingArea.EqualsCaseInsensitive(_workstation))
|
|
{
|
|
//Log.Out("XUiM_RecipesPatches-FilterRecipesByWorkstation 3");
|
|
recipeList1.Add(recipeList[index1]);
|
|
}
|
|
}
|
|
else if (recipeList[index1].craftingArea != null && recipeList[index1].craftingArea.EqualsCaseInsensitive(_workstation))
|
|
{
|
|
//Log.Out("XUiM_RecipesPatches-FilterRecipesByWorkstation 4");
|
|
recipeList1.Add(recipeList[index1]);
|
|
}
|
|
}
|
|
else if (recipeList[index1].craftingArea == null || recipeList[index1].craftingArea == "")
|
|
{
|
|
//Log.Out("XUiM_RecipesPatches-FilterRecipesByWorkstation 5");
|
|
recipeList1.Add(recipeList[index1]);
|
|
}
|
|
}
|
|
}
|
|
|
|
//Log.Out("XUiM_RecipesPatches-FilterRecipesByWorkstation recipeList1.Count: " + recipeList1.Count);
|
|
|
|
__result = recipeList1;
|
|
|
|
return false;
|
|
}
|
|
}*/
|
|
}
|