using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using HarmonyLib.Tools;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("PoopMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+06e1f6157f3da7a06c0fe45c619f40d5e5e9b8fb")]
[assembly: AssemblyProduct("PoopMod")]
[assembly: AssemblyTitle("PoopMod")]
[assembly: AssemblyVersion("1.0.0.0")]
[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.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;
}
}
[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 ValheimMods.PoopMod
{
[BepInPlugin("com.0perator3rror.PoopMod", "PoopMod", "1.0.0")]
public sealed class Plugin : BaseUnityPlugin
{
public const string ModGuid = "com.0perator3rror.PoopMod";
public const string ModName = "PoopMod";
public const string ModVersion = "1.0.0";
internal static ManualLogSource Log;
private void Awake()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
Log = ((BaseUnityPlugin)this).Logger;
HarmonyFileLog.Enabled = true;
Log.LogInfo((object)"PoopMod loading...");
new Harmony("com.0perator3rror.PoopMod").PatchAll();
Log.LogInfo((object)"PoopMod patches applied.");
}
}
}
namespace ValheimMods.PoopMod.Patches
{
[HarmonyPatch(typeof(Object))]
public static class PukeOffset
{
private const string TargetPrefabName = "fx_puke";
[HarmonyPatch("Instantiate", new Type[]
{
typeof(Object),
typeof(Vector3),
typeof(Quaternion)
})]
[HarmonyPrefix]
private static void Prefix_Object(Object original, ref Vector3 position, Quaternion rotation)
{
OffsetIfPuke(original, ref position);
}
[HarmonyPatch("Instantiate", new Type[]
{
typeof(GameObject),
typeof(Vector3),
typeof(Quaternion)
})]
[HarmonyPrefix]
private static void Prefix_GameObject(GameObject original, ref Vector3 position, Quaternion rotation)
{
OffsetIfPuke((Object)(object)original, ref position);
}
private static void OffsetIfPuke(Object original, ref Vector3 position)
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
GameObject val = (GameObject)(object)((original is GameObject) ? original : null);
if (val == null || !string.Equals(((Object)val).name, "fx_puke", StringComparison.OrdinalIgnoreCase))
{
return;
}
Player localPlayer = Player.m_localPlayer;
if (!((Object)(object)localPlayer == (Object)null))
{
Transform transform = ((Component)localPlayer).transform;
Vector3 val2 = position - transform.position;
if (!(((Vector3)(ref val2)).sqrMagnitude > 9f))
{
position = position - transform.forward * 0.17f - transform.up * 0.35f - transform.right * 0.05f;
Plugin.Log.LogInfo((object)"[PoopMod] Offset fx_puke spawn");
}
}
}
}
}