using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("VegetarianTurnipSoup")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VegetarianTurnipSoup")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("72d0e5c2-b8a1-4e7b-94f9-4e7af88d94c6")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
namespace VegetarianTurnipSoup;
[HarmonyPatch(typeof(Localization))]
internal static class PatchLocalization
{
[HarmonyPatch("Translate")]
[HarmonyPostfix]
public static void Translate_Postfix(string word, ref string __result)
{
if (word == "item_turnipstew")
{
__result = VegetarianTurnipSoupPlugin.TurnipSoupName.Value;
}
}
}
[HarmonyPatch(typeof(ObjectDB))]
internal static class PatchObjectDB
{
[HarmonyPatch("Awake")]
[HarmonyPostfix]
public static void Awake_Postfix(ObjectDB __instance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name != "main")
{
return;
}
foreach (Recipe recipe in __instance.m_recipes)
{
if (!(recipe.m_item?.m_itemData.m_shared.m_name == "$item_turnipstew"))
{
continue;
}
Requirement[] resources = recipe.m_resources;
foreach (Requirement val in resources)
{
if (((Object)val.m_resItem).name == "RawMeat")
{
val.m_resItem = __instance.GetItemPrefab("MushroomYellow").GetComponent<ItemDrop>();
}
}
}
}
}
[BepInPlugin("goldenrevolver.VegetarianTurnipSoup", "Vegetarian Turnip Soup", "1.0.1")]
public class VegetarianTurnipSoupPlugin : BaseUnityPlugin
{
public const string NAME = "Vegetarian Turnip Soup";
public const string VERSION = "1.0.1";
public static ConfigEntry<string> TurnipSoupName;
protected void Awake()
{
LoadConfig();
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
}
private void LoadConfig()
{
string text = "General";
TurnipSoupName = ((BaseUnityPlugin)this).Config.Bind<string>(text, "TurnipSoupName", "Turnip soup", "You can translate the name here.");
}
}