using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.Mono;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
using Zorro.Core;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("EdibleBingBong")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Edible Bing Bong")]
[assembly: AssemblyTitle("EdibleBingBong")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 EdibleBingBong
{
[BepInPlugin("EdibleBingBong", "Edible Bing Bong", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
private bool alreadyLoaded = false;
private void Awake()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
ManualLogSource logger = Logger;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("EdibleBingBong");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
}
logger.LogInfo(val);
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
SceneManager.sceneLoaded += OnSceneLoaded;
}
private void OnSceneLoaded(Scene scene, LoadSceneMode _)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
ManualLogSource logger = Logger;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(14, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loaded Scene: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Scene)(ref scene)).name);
}
logger.LogInfo(val);
if (!alreadyLoaded)
{
Logger.LogInfo((object)"Loaded the item Database");
alreadyLoaded = true;
ItemDatabase instance = SingletonAsset<ItemDatabase>.Instance;
TweakFoodValues(instance);
}
}
private void OnDestroy()
{
SceneManager.sceneLoaded -= OnSceneLoaded;
}
private static void TweakFoodValues(ItemDatabase itemDatabase)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
bool flag = default(bool);
foreach (KeyValuePair<ushort, Item> item in itemDatabase.itemLookup)
{
Item value = item.Value;
ManualLogSource logger = Logger;
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(11, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Item name: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)value).name);
}
logger.LogInfo(val);
if (((Object)value).name == "BingBong")
{
Logger.LogInfo((object)"Found BingBong");
Action_Consume val2 = ((Component)value).GetComponent<Action_Consume>();
if ((Object)(object)val2 == (Object)null)
{
val2 = ((Component)value).gameObject.AddComponent<Action_Consume>();
}
((ItemAction)val2).OnCastFinished = true;
value.usingTimePrimary = 1.2f;
value.UIData.hasMainInteract = true;
value.UIData.mainInteractPrompt = "Devour";
ItemUseFeedback val3 = ((Component)value).GetComponent<ItemUseFeedback>();
if ((Object)(object)val3 == (Object)null)
{
val3 = ((Component)value).gameObject.AddComponent<ItemUseFeedback>();
}
val3.useAnimation = "Eat";
Action_RestoreHunger val4 = ((Component)value).GetComponent<Action_RestoreHunger>();
if ((Object)(object)val4 == (Object)null)
{
val4 = ((Component)value).gameObject.AddComponent<Action_RestoreHunger>();
}
val4.restorationAmount = 0.1f;
((ItemAction)val4).OnCastFinished = true;
Action_InflictPoison val5 = ((Component)value).GetComponent<Action_InflictPoison>();
if ((Object)(object)val5 == (Object)null)
{
val5 = ((Component)value).gameObject.AddComponent<Action_InflictPoison>();
}
val5.inflictionTime = 10f;
val5.poisonPerSecond = 0.075f;
val5.delay = 5f;
((Behaviour)val5).enabled = true;
((ItemAction)val5).OnConsumed = true;
Action_ModifyStatus val6 = ((Component)value).GetComponent<Action_ModifyStatus>();
if ((Object)(object)val6 == (Object)null)
{
val6 = ((Component)value).gameObject.AddComponent<Action_ModifyStatus>();
}
val6.statusType = (STATUSTYPE)0;
val6.changeAmount = 0.2f;
((Behaviour)val6).enabled = true;
((ItemAction)val6).OnConsumed = true;
}
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "EdibleBingBong";
public const string PLUGIN_NAME = "Edible Bing Bong";
public const string PLUGIN_VERSION = "1.0.0";
}
}