Decompiled source of WolfWithPotionEffect v1.1.0

plugins/WolfWithPotionEffect/WolfWithPotionEffect.dll

Decompiled 8 months ago
using System;
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.Logging;
using Fusion;
using Microsoft.CodeAnalysis;
using On;
using UnityEngine;
using WolfWithPotionEffect.Patchs;

[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.6.2", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("WolfWithPotionEffect")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+10d38c7920375651b4e171b02f5999b5ff5e0ec0")]
[assembly: AssemblyProduct("WolfWithPotionEffect")]
[assembly: AssemblyTitle("WolfWithPotionEffect")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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 WolfWithPotionEffect
{
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInPlugin("LloydHawkeye.WolfWithPotionEffect", "WolfWithPotionEffect", "1.1.0")]
	[BepInProcess("Lycans.exe")]
	public class WolfWithPotionEffect : BaseUnityPlugin
	{
		public const string PLUGIN_GUID = "LloydHawkeye.WolfWithPotionEffect";

		public const string PLUGIN_AUTHOR = "LloydHawkeye";

		public const string PLUGIN_NAME = "WolfWithPotionEffect";

		public const string PLUGIN_VERSION = "1.1.0";

		private void Awake()
		{
			Log.Init(((BaseUnityPlugin)this).Logger);
			PlayerControllerPatch.Patch();
			LocalCameraHandlerPatch.Patch();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "WolfWithPotionEffect";

		public const string PLUGIN_NAME = "WolfWithPotionEffect";

		public const string PLUGIN_VERSION = "1.1.0";
	}
}
namespace WolfWithPotionEffect.Patchs
{
	internal class LocalCameraHandlerPatch
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_UpdateAnchorOffset <0>__LocalCameraHandler_UpdateAnchorOffset;
		}

		public static void Patch()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__LocalCameraHandler_UpdateAnchorOffset;
			if (obj == null)
			{
				hook_UpdateAnchorOffset val = LocalCameraHandler_UpdateAnchorOffset;
				<>O.<0>__LocalCameraHandler_UpdateAnchorOffset = val;
				obj = (object)val;
			}
			LocalCameraHandler.UpdateAnchorOffset += (hook_UpdateAnchorOffset)obj;
		}

		private static void LocalCameraHandler_UpdateAnchorOffset(orig_UpdateAnchorOffset orig, LocalCameraHandler self)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			if ((int)GameManager.LocalGameState == 0 || !((Object)(object)self.PovPlayer != (Object)null) || NetworkBool.op_Implicit(self.PovPlayer.IsDead))
			{
				return;
			}
			int movementAction = self.PovPlayer.MovementAction;
			bool flag = NetworkBool.op_Implicit(self.PovPlayer.IsWolf);
			bool flag2 = NetworkBool.op_Implicit(self.PovPlayer.PlayerEffectManager.Giant);
			if (movementAction != self._movementStatus || flag != self._isWolf || flag2 != self._giant)
			{
				float num = ((movementAction == 1) ? (self._baseCameraOffset - 0.5f) : self._baseCameraOffset);
				if (flag && !flag2)
				{
					num += 0.25f;
				}
				else if (flag2)
				{
					num = ((movementAction == 1) ? 7.2f : 10.2f);
				}
				else if (flag && flag2)
				{
					num = ((movementAction == 1) ? 7.2f : 10.2f);
				}
				Vector3 localPosition = self.localCameraAnchorPoint.localPosition;
				((Vector3)(ref localPosition))..ctor(localPosition.x, num, localPosition.z);
				self.localCameraAnchorPoint.localPosition = localPosition;
				self._movementStatus = movementAction;
				self._isWolf = flag;
				self._giant = flag2;
			}
		}
	}
	internal class PlayerControllerPatch
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_UpdateWolf <0>__PlayerController_UpdateWolf;
		}

		public static void Patch()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__PlayerController_UpdateWolf;
			if (obj == null)
			{
				hook_UpdateWolf val = PlayerController_UpdateWolf;
				<>O.<0>__PlayerController_UpdateWolf = val;
				obj = (object)val;
			}
			PlayerController.UpdateWolf += (hook_UpdateWolf)obj;
		}

		private static void PlayerController_UpdateWolf(orig_UpdateWolf orig, PlayerController self)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkBool.op_Implicit(self.IsWolf))
			{
				if ((Object)(object)self.Item != (Object)null)
				{
					self.Item.Cancel();
				}
				self.PlayerEffectManager.glowingLight.color = Color.red;
			}
			if (!NetworkBool.op_Implicit(self.IsWolf))
			{
				Color color = ColorManager.GetColor((int)self.Index);
				self.PlayerEffectManager.glowingLight.color = color;
			}
			PlayerController povPlayer = PlayerController.Local.LocalCameraHandler.PovPlayer;
			if ((Object)(object)povPlayer == (Object)(object)self)
			{
				GameManager.LightingManager.DisplayWolfLight(NetworkBool.op_Implicit(self.IsWolf));
				GameManager.LightingManager.DisplayNightLight(NetworkBool.op_Implicit(self.IsWolf));
			}
			if (!NetworkBool.op_Implicit(povPlayer.PlayerEffectManager.Paranoia))
			{
				self.UpdateModel(NetworkBool.op_Implicit(self.IsWolf));
			}
			self.UpdateCollider();
			self.UpdateCameraAnchorOffset();
		}
	}
}