using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using SuperFantasyKingdom;
using SuperFantasyKingdom.Buildings;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("BakeryUsesWheat")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyInformationalVersion("1.1.1+b823ae10082a55c8f271cb8b08bef34628a7a155")]
[assembly: AssemblyProduct("Bakery Uses Wheat")]
[assembly: AssemblyTitle("BakeryUsesWheat")]
[assembly: AssemblyVersion("1.1.1.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BakeryUsesWheat
{
[BepInPlugin("ownly.bakeryuseswheat", "Bakery Uses Wheat", "1.1.1")]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID).PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Bakery Uses Wheat loaded: bakery bakes bread straight from wheat");
}
}
[HarmonyPatch(typeof(BuildingResource), "Init")]
internal static class Patch_Bakery
{
private static void Prefix(BuildingResource __instance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Invalid comparison between Unknown and I4
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Invalid comparison between Unknown and I4
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
if ((int)((Building)__instance).GetBuildingType() != 18)
{
return;
}
BuildingCrafting val = (BuildingCrafting)(object)((__instance is BuildingCrafting) ? __instance : null);
if (val != null)
{
List<CraftingRecipe> craftingRecipes = ((BuildingCity)val).GetCraftingRecipes(false);
if (craftingRecipes != null)
{
for (int i = 0; i < craftingRecipes.Count; i++)
{
ResourceAmount[] ingredients = craftingRecipes[i].ingredients;
if (ingredients == null)
{
continue;
}
for (int j = 0; j < ingredients.Length; j++)
{
if ((int)ingredients[j].type == 8)
{
ingredients[j].type = (ResourceType)7;
}
}
}
}
}
ResourceStorage storage = ((Building)__instance).GetStorage();
if (!((Object)(object)storage != (Object)null))
{
return;
}
List<ResourceAmount> value = Traverse.Create((object)storage).Field("storage").GetValue<List<ResourceAmount>>();
if (value == null)
{
return;
}
for (int k = 0; k < value.Count; k++)
{
if ((int)value[k].type == 8)
{
value[k] = new ResourceAmount((ResourceType)7, value[k].amount);
}
}
}
}
}