using System;
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.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("VentureValheim.NoPuke")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("VentureValheim.NoPuke")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8E4407DA-E41A-47DF-8AA8-81A55954CE12")]
[assembly: AssemblyFileVersion("0.2.2")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.2.2.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace VentureValheim.NoPuke
{
[BepInPlugin("com.orianaventure.mod.NoPuke", "NoPuke", "0.2.2")]
public class NoPukePlugin : BaseUnityPlugin
{
private const string ModName = "NoPuke";
private const string ModVersion = "0.2.2";
private const string Author = "com.orianaventure.mod";
private const string ModGUID = "com.orianaventure.mod.NoPuke";
private readonly Harmony HarmonyInstance = new Harmony("com.orianaventure.mod.NoPuke");
public static readonly ManualLogSource NoPukeLogger = Logger.CreateLogSource("NoPuke");
public void Awake()
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
HarmonyInstance.PatchAll(executingAssembly);
}
}
public class NoPuke
{
[HarmonyPatch(typeof(ObjectDB), "Awake")]
public static class Patch_ObjectDB_Awake
{
private static void Postfix()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Expected O, but got Unknown
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name.Equals("main"))
{
StatusEffect statusEffect = ObjectDB.instance.GetStatusEffect(StringExtensionMethods.GetStableHashCode("Puke"));
if ((Object)(object)statusEffect != (Object)null)
{
statusEffect.m_startEffects = new EffectList();
}
else
{
NoPukePlugin.NoPukeLogger.LogWarning((object)"Could not disable puke animations and effects.");
}
if (GetItemDrop("bonemass_attack_aoe", out ItemDrop item))
{
item.m_itemData.m_shared.m_startEffect = new EffectList();
}
else
{
NoPukePlugin.NoPukeLogger.LogWarning((object)"Could not disable bonemass puke animations and effects.");
}
NoPukePlugin.NoPukeLogger.LogInfo((object)"Done disabling puke animations and effects.");
}
}
}
private static readonly NoPuke _instance = new NoPuke();
public static NoPuke Instance => _instance;
private NoPuke()
{
}
public static bool GetItemDrop(string name, out ItemDrop item)
{
item = null;
if (!Utility.IsNullOrWhiteSpace(name))
{
GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(StringExtensionMethods.GetStableHashCode(name));
if ((Object)(object)itemPrefab == (Object)null)
{
itemPrefab = ObjectDB.instance.GetItemPrefab(name);
}
if ((Object)(object)itemPrefab != (Object)null)
{
item = itemPrefab.GetComponent<ItemDrop>();
if ((Object)(object)item != (Object)null)
{
return true;
}
}
}
return false;
}
}
}