Decompiled source of PizzaClientLagFix v1.3.2

plugins/PizzaClientLagFix/PizzaClientLagFix.dll

Decompiled a day ago
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 System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HG.Reflection;
using IL.RoR2.Projectile;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using On.RoR2.Projectile;
using PizzaClientLagFix.ModCompat;
using PizzaClientLagFix.Networking;
using RoR2;
using RoR2.Projectile;
using UnityEngine;
using UnityEngine.Networking;

[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyInformationalVersion("1.0.0+60b82f78f634befdbb358c629fdc65a45661368d")]
[assembly: AssemblyProduct("PizzaClientLagFix")]
[assembly: AssemblyTitle("PizzaClientLagFix")]
[assembly: AssemblyCompany("PizzaClientLagFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[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
{
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace PizzaClientLagFix
{
	internal static class Log
	{
		private static readonly StringBuilder _sharedStringBuilder;

		private static readonly int _cachedCallerPathPrefixLength;

		private static ManualLogSource _logSource;

		static Log()
		{
			_sharedStringBuilder = new StringBuilder(256);
			_cachedCallerPathPrefixLength = getCallerPathPrefixLength("D:\\Git\\RoR2\\PizzaClientLagFix\\PizzaClientLagFix\\Log.cs");
			static int getCallerPathPrefixLength([CallerFilePath] string callerPath = null)
			{
				int num = callerPath.LastIndexOf("PizzaClientLagFix\\");
				if (num >= 0)
				{
					return num + "PizzaClientLagFix\\".Length;
				}
				Debug.LogError((object)"[PizzaClientLagFix] Logger failed to determine caller path prefix length");
				return 0;
			}
		}

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

		private static StringBuilder AppendCallerPrefix(this StringBuilder stringBuilder, string callerPath, string callerMemberName, int callerLineNumber)
		{
			return stringBuilder.Append(callerPath, _cachedCallerPathPrefixLength, callerPath.Length - _cachedCallerPathPrefixLength).Append(':').Append(callerLineNumber)
				.Append(" (")
				.Append(callerMemberName)
				.Append("):");
		}

		private static StringBuilder buildCallerLogString(string callerPath, string callerMemberName, int callerLineNumber, object data)
		{
			return _sharedStringBuilder.Clear().AppendCallerPrefix(callerPath, callerMemberName, callerLineNumber).Append(' ')
				.Append(data);
		}

		[Conditional("DEBUG")]
		internal static void Debug(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogDebug((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		[Conditional("DEBUG")]
		internal static void Debug_NoCallerPrefix(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogError((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void Error_NoCallerPrefix(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogFatal((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void Fatal_NoCallerPrefix(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogInfo((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void Info_NoCallerPrefix(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogMessage((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void Message_NoCallerPrefix(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			_logSource.LogWarning((object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void Warning_NoCallerPrefix(object data)
		{
			_logSource.LogWarning(data);
		}

		internal static void LogType(LogLevel level, object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			if ((level & 0x20) == 0)
			{
				_logSource.Log(level, (object)buildCallerLogString(callerPath, callerMemberName, callerLineNumber, data));
			}
		}

		[MethodImpl(MethodImplOptions.AggressiveInlining)]
		internal static void LogType_NoCallerPrefix(LogLevel level, object data)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			if ((level & 0x20) == 0)
			{
				_logSource.Log(level, data);
			}
		}
	}
	[BepInPlugin("Gorakh.PizzaClientLagFix", "PizzaClientLagFix", "1.3.2")]
	public class Main : BaseUnityPlugin
	{
		public const string PluginGUID = "Gorakh.PizzaClientLagFix";

		public const string PluginAuthor = "Gorakh";

		public const string PluginName = "PizzaClientLagFix";

		public const string PluginVersion = "1.3.2";

		internal static Main Instance { get; private set; }

		private void Awake()
		{
			Stopwatch stopwatch = Stopwatch.StartNew();
			Log.Init(((BaseUnityPlugin)this).Logger);
			Instance = SingletonHelper.Assign<Main>(Instance, this);
			stopwatch.Stop();
			Log.Info_NoCallerPrefix($"Initialized in {stopwatch.Elapsed.TotalSeconds:F2} seconds");
		}

		private void OnDestroy()
		{
			Instance = SingletonHelper.Unassign<Main>(Instance, this);
		}
	}
	public static class OverlapAttackIgnoreNonAuthorityHitsPatch
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_ProcessHits <0>__OverlapAttack_ProcessHits;
		}

		public static bool Enabled;

		[SystemInitializer(new Type[] { })]
		private static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			object obj = <>O.<0>__OverlapAttack_ProcessHits;
			if (obj == null)
			{
				hook_ProcessHits val = OverlapAttack_ProcessHits;
				<>O.<0>__OverlapAttack_ProcessHits = val;
				obj = (object)val;
			}
			OverlapAttack.ProcessHits += (hook_ProcessHits)obj;
		}

		private static void OverlapAttack_ProcessHits(orig_ProcessHits orig, OverlapAttack self, object boxedHitList)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			if (!Enabled)
			{
				orig.Invoke(self, boxedHitList);
				return;
			}
			try
			{
				List<OverlapInfo> list = (List<OverlapInfo>)boxedHitList;
				_ = list.Count;
				_ = 0;
				for (int num = list.Count - 1; num >= 0; num--)
				{
					HurtBox hurtBox = list[num].hurtBox;
					if (Object.op_Implicit((Object)(object)hurtBox))
					{
						HealthComponent healthComponent = hurtBox.healthComponent;
						if (Object.op_Implicit((Object)(object)healthComponent) && !Util.HasEffectiveAuthority(((Component)healthComponent).gameObject))
						{
							list.RemoveAt(num);
						}
					}
				}
				orig.Invoke(self, (object)list);
			}
			catch (Exception data)
			{
				Log.Error_NoCallerPrefix(data);
				orig.Invoke(self, boxedHitList);
			}
		}
	}
	internal static class ProjectileOverlapAttackClientPredictionHooks
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_MyFixedUpdate <0>__ProjectileOverlapAttack_MyFixedUpdate_EnsurePatchDisabled;

			public static Manipulator <1>__ProjectileOverlapAttack_MyFixedUpdate_AllowClientPrediction;

			public static Func<ProjectileOverlapAttack, ProjectileOverlapAttackClientPrediction> <2>__getClientPrediction;

			public static Func<bool, ProjectileOverlapAttackClientPrediction, bool> <3>__overrideShouldProcessAttack;

			public static Action<ProjectileOverlapAttackClientPrediction> <4>__preFire;

			public static Action <5>__postFire;
		}

		[SystemInitializer(new Type[] { typeof(ProjectileCatalog) })]
		private static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Expected O, but got Unknown
			object obj = <>O.<0>__ProjectileOverlapAttack_MyFixedUpdate_EnsurePatchDisabled;
			if (obj == null)
			{
				hook_MyFixedUpdate val = ProjectileOverlapAttack_MyFixedUpdate_EnsurePatchDisabled;
				<>O.<0>__ProjectileOverlapAttack_MyFixedUpdate_EnsurePatchDisabled = val;
				obj = (object)val;
			}
			ProjectileOverlapAttack.MyFixedUpdate += (hook_MyFixedUpdate)obj;
			object obj2 = <>O.<1>__ProjectileOverlapAttack_MyFixedUpdate_AllowClientPrediction;
			if (obj2 == null)
			{
				Manipulator val2 = ProjectileOverlapAttack_MyFixedUpdate_AllowClientPrediction;
				<>O.<1>__ProjectileOverlapAttack_MyFixedUpdate_AllowClientPrediction = val2;
				obj2 = (object)val2;
			}
			ProjectileOverlapAttack.MyFixedUpdate += (Manipulator)obj2;
			addPredictionToProjectile("BrotherUltLineProjectileRotateLeft");
			addPredictionToProjectile("BrotherUltLineProjectileRotateRight");
			addPredictionToProjectile("BrotherUltLineProjectileStatic");
			addPredictionToProjectile("BrotherSunderWave");
			if (!UmbralMithrixCompat.Enabled)
			{
				return;
			}
			bool flag = !tryAddPredictionToProjectile("P4UltLineLeft");
			bool flag2 = !tryAddPredictionToProjectile("P4UltLineRight");
			bool flag3 = !tryAddPredictionToProjectile("StaticUltLine");
			if (!(flag || flag2 || flag3))
			{
				return;
			}
			PluginInfo value = UmbralMithrixCompat.UmbralPluginInfo.Value;
			if (value == null)
			{
				return;
			}
			BaseUnityPlugin umbralPluginInstance = value.Instance;
			Type umbralPluginType;
			if (Object.op_Implicit((Object)(object)umbralPluginInstance))
			{
				umbralPluginType = ((object)umbralPluginInstance).GetType();
				if (flag)
				{
					tryAddPredictionToUmbralField("leftP4Line");
				}
				if (flag2)
				{
					tryAddPredictionToUmbralField("rightP4Line");
				}
				if (flag3)
				{
					tryAddPredictionToUmbralField("staticUltLine");
				}
			}
			static void addPredictionToPrefab(GameObject prefab)
			{
				prefab.AddComponent<ProjectileOverlapAttackValueNetworker>();
				prefab.AddComponent<ProjectileOverlapAttackClientPrediction>();
			}
			static void addPredictionToProjectile(string projectileName)
			{
				if (!tryAddPredictionToProjectile(projectileName))
				{
					Log.Error("Failed to find projectile '" + projectileName + "'", "D:\\Git\\RoR2\\PizzaClientLagFix\\PizzaClientLagFix\\ProjectileOverlapAttackClientPredictionHooks.cs", "Init", 85);
				}
			}
			static bool tryAddPredictionToProjectile(string projectileName)
			{
				int num = ProjectileCatalog.FindProjectileIndex(projectileName);
				if (num < 0)
				{
					return false;
				}
				addPredictionToPrefab(ProjectileCatalog.GetProjectilePrefab(num));
				return true;
			}
			void tryAddPredictionToUmbralField(string fieldName)
			{
				FieldInfo field = umbralPluginType.GetField(fieldName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				if (field == null)
				{
					Log.Error("Failed to find umbral field '" + fieldName + "'", "D:\\Git\\RoR2\\PizzaClientLagFix\\PizzaClientLagFix\\ProjectileOverlapAttackClientPredictionHooks.cs", "Init", 57);
				}
				else
				{
					object value2 = field.GetValue(umbralPluginInstance);
					GameObject val3 = (GameObject)((value2 is GameObject) ? value2 : null);
					if (val3 == null)
					{
						string text = "null";
						if (value2 != null)
						{
							text = value2.GetType().FullName;
						}
						Log.Error("Unexpected type " + text + " of umbral field '" + field.Name + "'", "D:\\Git\\RoR2\\PizzaClientLagFix\\PizzaClientLagFix\\ProjectileOverlapAttackClientPredictionHooks.cs", "Init", 70);
					}
					else
					{
						addPredictionToPrefab(val3);
					}
				}
			}
		}

		private static void ProjectileOverlapAttack_MyFixedUpdate_EnsurePatchDisabled(orig_MyFixedUpdate orig, ProjectileOverlapAttack self, float deltaTime)
		{
			try
			{
				orig.Invoke(self, deltaTime);
			}
			finally
			{
				OverlapAttackIgnoreNonAuthorityHitsPatch.Enabled = false;
			}
		}

		private static void ProjectileOverlapAttack_MyFixedUpdate_AllowClientPrediction(ILContext il)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			VariableDefinition val2 = new VariableDefinition(il.Import(typeof(ProjectileOverlapAttackClientPrediction)));
			il.Method.Body.Variables.Add(val2);
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<ProjectileOverlapAttack, ProjectileOverlapAttackClientPrediction>>((Func<ProjectileOverlapAttack, ProjectileOverlapAttackClientPrediction>)getClientPrediction);
			val.Emit(OpCodes.Stloc, val2);
			int shouldProccessAttacksVar = -1;
			ILLabel afterCanProcessCheckLabel = null;
			if (!val.TryGotoNext(new Func<Instruction, bool>[3]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<ProjectileController>(x, "CanProcessCollisionEvents"),
				(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref shouldProccessAttacksVar),
				(Instruction x) => ILPatternMatchingExt.MatchBr(x, ref afterCanProcessCheckLabel)
			}))
			{
				Log.Error("Failed to find initial patch location", "D:\\Git\\RoR2\\PizzaClientLagFix\\PizzaClientLagFix\\ProjectileOverlapAttackClientPredictionHooks.cs", "ProjectileOverlapAttack_MyFixedUpdate_AllowClientPrediction", 143);
				return;
			}
			val.Goto(afterCanProcessCheckLabel.Target, (MoveType)1, false);
			val.Emit(OpCodes.Ldloc, shouldProccessAttacksVar);
			val.Emit(OpCodes.Ldloc, val2);
			val.EmitDelegate<Func<bool, ProjectileOverlapAttackClientPrediction, bool>>((Func<bool, ProjectileOverlapAttackClientPrediction, bool>)overrideShouldProcessAttack);
			val.Emit(OpCodes.Stloc, shouldProccessAttacksVar);
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<OverlapAttack>(x, "Fire")
			}))
			{
				val.Emit(OpCodes.Ldloc, val2);
				val.EmitDelegate<Action<ProjectileOverlapAttackClientPrediction>>((Action<ProjectileOverlapAttackClientPrediction>)preFire);
				int index = val.Index;
				val.Index = index + 1;
				val.EmitDelegate<Action>((Action)postFire);
			}
			else
			{
				Log.Error("Failed to find fire patch location", "D:\\Git\\RoR2\\PizzaClientLagFix\\PizzaClientLagFix\\ProjectileOverlapAttackClientPredictionHooks.cs", "ProjectileOverlapAttack_MyFixedUpdate_AllowClientPrediction", 179);
			}
			static ProjectileOverlapAttackClientPrediction getClientPrediction(ProjectileOverlapAttack projectileOverlapAttack)
			{
				return ((Component)projectileOverlapAttack).GetComponent<ProjectileOverlapAttackClientPrediction>();
			}
			static bool overrideShouldProcessAttack(bool shouldProccessAttacks, ProjectileOverlapAttackClientPrediction clientPrediction)
			{
				if (!shouldProccessAttacks)
				{
					return Object.op_Implicit((Object)(object)clientPrediction);
				}
				return true;
			}
			static void postFire()
			{
				OverlapAttackIgnoreNonAuthorityHitsPatch.Enabled = false;
			}
			static void preFire(ProjectileOverlapAttackClientPrediction clientPrediction)
			{
				OverlapAttackIgnoreNonAuthorityHitsPatch.Enabled = Object.op_Implicit((Object)(object)clientPrediction);
			}
		}
	}
}
namespace PizzaClientLagFix.Networking
{
	public class ProjectileOverlapAttackClientPrediction : MonoBehaviour
	{
	}
	public class ProjectileOverlapAttackValueNetworker : NetworkBehaviour
	{
		private ProjectileController _projectileController;

		private ProjectileDamage _projectileDamage;

		private const uint PROC_CHAIN_MASK_DIRTY_BIT = 1u;

		private ProcChainMask _procChainMask;

		private const uint PROC_COEFFICIENT_DIRTY_BIT = 2u;

		private float _procCoefficient = 1f;

		private const uint DAMAGE_DIRTY_BIT = 4u;

		private float _damage;

		private const uint FORCE_DIRTY_BIT = 8u;

		private float _force;

		private const uint CRIT_DIRTY_BIT = 16u;

		private bool _crit;

		private const uint DAMAGE_COLOR_INDEX_DIRTY_BIT = 32u;

		private DamageColorIndex _damageColorIndex;

		private const uint DAMAGE_TYPE_DIRTY_BIT = 64u;

		private DamageTypeCombo _damageType = DamageTypeCombo.Generic;

		private void Awake()
		{
			_projectileController = ((Component)this).GetComponent<ProjectileController>();
			_projectileDamage = ((Component)this).GetComponent<ProjectileDamage>();
			_projectileController.onInitialized += onProjectileInitialized;
		}

		public override void OnStartClient()
		{
			((NetworkBehaviour)this).OnStartClient();
			refreshValues();
		}

		private void FixedUpdate()
		{
			refreshValues();
		}

		private void onProjectileInitialized(ProjectileController projectileController)
		{
			refreshValues();
		}

		private void refreshValues()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			_ = ((NetworkBehaviour)this).syncVarDirtyBits;
			if (Object.op_Implicit((Object)(object)_projectileController))
			{
				ProcChainMask currentValue2 = _projectileController.procChainMask;
				checkValueEquatable<ProcChainMask>(ref _procChainMask, ref currentValue2, 1u);
				_projectileController.procChainMask = currentValue2;
				checkValueEquatable<float>(ref _procCoefficient, ref _projectileController.procCoefficient, 2u);
			}
			if (Object.op_Implicit((Object)(object)_projectileDamage))
			{
				checkValueEquatable<float>(ref _damage, ref _projectileDamage.damage, 4u);
				checkValueEquatable<float>(ref _force, ref _projectileDamage.force, 8u);
				checkValueEquatable<bool>(ref _crit, ref _projectileDamage.crit, 16u);
				checkValue<DamageColorIndex>(ref _damageColorIndex, ref _projectileDamage.damageColorIndex, 32u, (DamageColorIndex a, DamageColorIndex b) => a == b);
				checkValue<DamageTypeCombo>(ref _damageType, ref _projectileDamage.damageType, 64u, (DamageTypeCombo a, DamageTypeCombo b) => ((object)(DamageTypeCombo)(ref a)).Equals((object?)b));
			}
			bool checkValue<T>(ref T authorityValue, ref T currentValue, uint dirtyBit, Func<T, T, bool> comparison)
			{
				if (comparison(authorityValue, currentValue))
				{
					return false;
				}
				if (NetworkServer.active)
				{
					authorityValue = currentValue;
					((NetworkBehaviour)this).SetDirtyBit(dirtyBit);
				}
				else
				{
					currentValue = authorityValue;
				}
				return true;
			}
			bool checkValueEquatable<T>(ref T authorityValue, ref T currentValue, uint dirtyBit) where T : IEquatable<T>
			{
				return checkValue<T>(ref authorityValue, ref currentValue, dirtyBit, (T a, T b) => a.Equals(b));
			}
		}

		public override bool OnSerialize(NetworkWriter writer, bool initialState)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			uint num;
			if (initialState)
			{
				num = uint.MaxValue;
			}
			else
			{
				num = ((NetworkBehaviour)this).syncVarDirtyBits;
				writer.WritePackedUInt32(num);
			}
			bool flag = false;
			if ((num & (true ? 1u : 0u)) != 0)
			{
				NetworkExtensions.Write(writer, _procChainMask);
				flag = true;
			}
			if ((num & 2u) != 0)
			{
				writer.Write(_procCoefficient);
				flag = true;
			}
			if ((num & 4u) != 0)
			{
				writer.Write(_damage);
				flag = true;
			}
			if ((num & 8u) != 0)
			{
				writer.Write(_force);
				flag = true;
			}
			if ((num & 0x10u) != 0)
			{
				writer.Write(_crit);
				flag = true;
			}
			if ((num & 0x20u) != 0)
			{
				NetworkExtensions.Write(writer, _damageColorIndex);
				flag = true;
			}
			if ((num & 0x40u) != 0)
			{
				NetworkExtensions.WriteDamageType(writer, _damageType);
				flag = true;
			}
			return flag || initialState;
		}

		public override void OnDeserialize(NetworkReader reader, bool initialState)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			int num = (initialState ? (-1) : ((int)reader.ReadPackedUInt32()));
			if (((uint)num & (true ? 1u : 0u)) != 0)
			{
				_procChainMask = NetworkExtensions.ReadProcChainMask(reader);
			}
			if (((uint)num & 2u) != 0)
			{
				_procCoefficient = reader.ReadSingle();
			}
			if (((uint)num & 4u) != 0)
			{
				_damage = reader.ReadSingle();
			}
			if (((uint)num & 8u) != 0)
			{
				_force = reader.ReadSingle();
			}
			if (((uint)num & 0x10u) != 0)
			{
				_crit = reader.ReadBoolean();
			}
			if (((uint)num & 0x20u) != 0)
			{
				_damageColorIndex = NetworkExtensions.ReadDamageColorIndex(reader);
			}
			if (((uint)num & 0x40u) != 0)
			{
				_damageType = NetworkExtensions.ReadDamageType(reader);
			}
			refreshValues();
		}

		private void UNetVersion()
		{
		}
	}
}
namespace PizzaClientLagFix.ModCompat
{
	internal static class UmbralMithrixCompat
	{
		private const string UMBRAL_GUID = "com.Nuxlar.UmbralMithrix";

		public static readonly Lazy<PluginInfo> UmbralPluginInfo = new Lazy<PluginInfo>((Func<PluginInfo>)(() => (!Chainloader.PluginInfos.TryGetValue("com.Nuxlar.UmbralMithrix", out var value)) ? null : value));

		public static bool Enabled => Chainloader.PluginInfos.ContainsKey("com.Nuxlar.UmbralMithrix");
	}
}