Decompiled source of PizzaClientLagFix v1.3.1

plugins/PizzaClientLagFix/PizzaClientLagFix.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
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 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.Networking;
using PizzaClientLagFix.Networking.Wrappers;
using RoR2;
using RoR2.Audio;
using RoR2.Projectile;
using Unity;
using UnityEngine;
using UnityEngine.Networking;

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

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace PizzaClientLagFix
{
	internal static class Log
	{
		internal static ManualLogSource _logSource;

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

		private static string getLogPrefix(string callerPath, string callerMemberName, int callerLineNumber)
		{
			int num = callerPath.LastIndexOf("PizzaClientLagFix");
			if (num >= 0)
			{
				callerPath = callerPath.Substring(num + "PizzaClientLagFix".Length + 1);
			}
			return $"{callerPath}:{callerLineNumber} ({callerMemberName}) ";
		}

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

		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)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		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)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		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)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		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)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
		}

		internal static void Warning_NoCallerPrefix(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	[BepInPlugin("Gorakh.PizzaClientLagFix", "PizzaClientLagFix", "1.3.1")]
	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.1";

		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_0025: 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;
				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>__overrideShouldProcess;

			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;
			tryAddToProjectile("BrotherUltLineProjectileRotateLeft");
			tryAddToProjectile("BrotherUltLineProjectileRotateRight");
			tryAddToProjectile("BrotherSunderWave");
			static void tryAddToProjectile(string projectileName)
			{
				int num = ProjectileCatalog.FindProjectileIndex(projectileName);
				if (num >= 0)
				{
					ProjectileCatalog.GetProjectilePrefab(num).AddComponent<ProjectileOverlapAttackClientPrediction>();
				}
				else
				{
					Log.Error("Failed to find projectile '" + projectileName + "'", "X:\\Git\\RoR2\\PizzaClientLagFix\\PizzaClientLagFix\\ProjectileOverlapAttackClientPredictionHooks.cs", "Init", 33);
				}
			}
		}

		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_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			//IL_0034: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: 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);
			if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<ProjectileController>(x, "CanProcessCollisionEvents")
			}))
			{
				val.Emit(OpCodes.Ldloc, val2);
				val.EmitDelegate<Func<bool, ProjectileOverlapAttackClientPrediction, bool>>((Func<bool, ProjectileOverlapAttackClientPrediction, bool>)overrideShouldProcess);
			}
			else
			{
				Log.Error("Failed to find process events patch location", "X:\\Git\\RoR2\\PizzaClientLagFix\\PizzaClientLagFix\\ProjectileOverlapAttackClientPredictionHooks.cs", "ProjectileOverlapAttack_MyFixedUpdate_AllowClientPrediction", 78);
			}
			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", "X:\\Git\\RoR2\\PizzaClientLagFix\\PizzaClientLagFix\\ProjectileOverlapAttackClientPredictionHooks.cs", "ProjectileOverlapAttack_MyFixedUpdate_AllowClientPrediction", 106);
			}
			static ProjectileOverlapAttackClientPrediction getClientPrediction(ProjectileOverlapAttack projectileOverlapAttack)
			{
				if (NetworkServer.active || !NetworkClient.active)
				{
					return null;
				}
				return ((Component)projectileOverlapAttack).GetComponent<ProjectileOverlapAttackClientPrediction>();
			}
			static bool overrideShouldProcess(bool canProcess, ProjectileOverlapAttackClientPrediction clientPrediction)
			{
				if (!canProcess)
				{
					return Object.op_Implicit((Object)(object)clientPrediction);
				}
				return true;
			}
			static void postFire()
			{
				OverlapAttackIgnoreNonAuthorityHitsPatch.Enabled = false;
			}
			static void preFire(ProjectileOverlapAttackClientPrediction clientPrediction)
			{
				if (Object.op_Implicit((Object)(object)clientPrediction))
				{
					clientPrediction.UpdateClientAttackInfo();
				}
				OverlapAttackIgnoreNonAuthorityHitsPatch.Enabled = Object.op_Implicit((Object)(object)clientPrediction);
			}
		}
	}
}
namespace PizzaClientLagFix.Networking
{
	public struct OverlapAttackInfo : IEquatable<OverlapAttackInfo>
	{
		public GameObject Attacker;

		public GameObject Inflictor;

		public TeamIndex TeamIndex;

		public AttackerFiltering AttackerFiltering;

		public Vector3 ForceVector;

		public float PushAwayForce;

		public float Damage;

		public bool IsCrit;

		public ProcChainMaskWrapper ProcChainMask;

		public float ProcCoefficient;

		public NetworkSoundEventIndex ImpactSound;

		public DamageColorIndex DamageColorIndex;

		public DamageTypeComboWrapper DamageType;

		public int MaximumOverlapTargets;

		public float RetriggerTimeout;

		public OverlapAttackInfo(OverlapAttack src)
		{
			//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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			Attacker = src.attacker;
			Inflictor = src.inflictor;
			TeamIndex = src.teamIndex;
			AttackerFiltering = src.attackerFiltering;
			ForceVector = src.forceVector;
			PushAwayForce = src.pushAwayForce;
			Damage = src.damage;
			IsCrit = src.isCrit;
			ProcChainMask = src.procChainMask;
			ProcCoefficient = src.procCoefficient;
			ImpactSound = src.impactSound;
			DamageColorIndex = src.damageColorIndex;
			DamageType = src.damageType;
			MaximumOverlapTargets = src.maximumOverlapTargets;
			RetriggerTimeout = src.retriggerTimeout;
		}

		public readonly void ApplyTo(OverlapAttack attack)
		{
			//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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_006c: 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_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			attack.attacker = Attacker;
			attack.inflictor = Inflictor;
			attack.teamIndex = TeamIndex;
			attack.attackerFiltering = AttackerFiltering;
			attack.forceVector = ForceVector;
			attack.pushAwayForce = PushAwayForce;
			attack.damage = Damage;
			attack.isCrit = IsCrit;
			attack.procChainMask = ProcChainMask;
			attack.procCoefficient = ProcCoefficient;
			attack.impactSound = ImpactSound;
			attack.damageColorIndex = DamageColorIndex;
			attack.damageType = DamageType;
			attack.maximumOverlapTargets = MaximumOverlapTargets;
			attack.retriggerTimeout = RetriggerTimeout;
		}

		public override readonly bool Equals(object obj)
		{
			if (obj is OverlapAttackInfo other)
			{
				return Equals(other);
			}
			return false;
		}

		public readonly bool Equals(OverlapAttackInfo other)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Attacker == (Object)(object)other.Attacker && (Object)(object)Inflictor == (Object)(object)other.Inflictor && TeamIndex == other.TeamIndex && AttackerFiltering == other.AttackerFiltering && ForceVector == other.ForceVector && PushAwayForce == other.PushAwayForce && Damage == other.Damage && IsCrit == other.IsCrit && ProcChainMask == other.ProcChainMask && ProcCoefficient == other.ProcCoefficient && ImpactSound == other.ImpactSound && DamageColorIndex == other.DamageColorIndex && DamageType == other.DamageType && MaximumOverlapTargets == other.MaximumOverlapTargets)
			{
				return RetriggerTimeout == other.RetriggerTimeout;
			}
			return false;
		}

		public override readonly int GetHashCode()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			HashCode hashCode = default(HashCode);
			hashCode.Add<GameObject>(Attacker);
			hashCode.Add<GameObject>(Inflictor);
			hashCode.Add<TeamIndex>(TeamIndex);
			hashCode.Add<AttackerFiltering>(AttackerFiltering);
			hashCode.Add<Vector3>(ForceVector);
			hashCode.Add(PushAwayForce);
			hashCode.Add(Damage);
			hashCode.Add(IsCrit);
			hashCode.Add(ProcChainMask);
			hashCode.Add(ProcCoefficient);
			hashCode.Add<NetworkSoundEventIndex>(ImpactSound);
			hashCode.Add<DamageColorIndex>(DamageColorIndex);
			hashCode.Add(DamageType);
			hashCode.Add(MaximumOverlapTargets);
			hashCode.Add(RetriggerTimeout);
			return hashCode.ToHashCode();
		}

		public static bool operator ==(OverlapAttackInfo left, OverlapAttackInfo right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(OverlapAttackInfo left, OverlapAttackInfo right)
		{
			return !(left == right);
		}
	}
	[DisallowMultipleComponent]
	public class ProjectileOverlapAttackClientPrediction : NetworkBehaviour
	{
		private ProjectileController _projectileController;

		private ProjectileOverlapAttack _projectileOverlapAttack;

		[SyncVar]
		private bool _overlapAttackInfoHasValue;

		[SyncVar(hook = "syncOverlapAttackInfo")]
		private OverlapAttackInfo _overlapAttackInfo;

		public bool Network_overlapAttackInfoHasValue
		{
			get
			{
				return _overlapAttackInfoHasValue;
			}
			[param: In]
			set
			{
				((NetworkBehaviour)this).SetSyncVar<bool>(value, ref _overlapAttackInfoHasValue, 1u);
			}
		}

		public OverlapAttackInfo Network_overlapAttackInfo
		{
			get
			{
				return _overlapAttackInfo;
			}
			[param: In]
			set
			{
				ref OverlapAttackInfo overlapAttackInfo = ref _overlapAttackInfo;
				if (NetworkServer.localClientActive && !((NetworkBehaviour)this).syncVarHookGuard)
				{
					((NetworkBehaviour)this).syncVarHookGuard = true;
					syncOverlapAttackInfo(value);
					((NetworkBehaviour)this).syncVarHookGuard = false;
				}
				((NetworkBehaviour)this).SetSyncVar<OverlapAttackInfo>(value, ref overlapAttackInfo, 2u);
			}
		}

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

		private void OnEnable()
		{
			if (NetworkServer.active)
			{
				updateServerAttackInfo();
			}
		}

		public override void OnStartClient()
		{
			((NetworkBehaviour)this).OnStartClient();
			if (_overlapAttackInfoHasValue)
			{
				UpdateClientAttackInfo();
			}
		}

		private void onProjectileInitialized(ProjectileController projectileController)
		{
			if (NetworkServer.active)
			{
				if (_projectileOverlapAttack.attack == null && !((Behaviour)_projectileOverlapAttack).enabled)
				{
					_projectileOverlapAttack.Start();
				}
				updateServerAttackInfo();
			}
		}

		private void Update()
		{
			if (NetworkServer.active)
			{
				updateServerAttackInfo();
			}
		}

		[Server]
		private void updateServerAttackInfo()
		{
			if (!NetworkServer.active)
			{
				Debug.LogWarning((object)"[Server] function 'System.Void PizzaClientLagFix.Networking.ProjectileOverlapAttackClientPrediction::updateServerAttackInfo()' called on client");
			}
			else if (Object.op_Implicit((Object)(object)_projectileOverlapAttack) && _projectileOverlapAttack.attack != null)
			{
				Network_overlapAttackInfo = new OverlapAttackInfo(_projectileOverlapAttack.attack);
				Network_overlapAttackInfoHasValue = true;
			}
		}

		[Client]
		public void UpdateClientAttackInfo()
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			if (!NetworkClient.active)
			{
				Debug.LogWarning((object)"[Client] function 'System.Void PizzaClientLagFix.Networking.ProjectileOverlapAttackClientPrediction::UpdateClientAttackInfo()' called on server");
			}
			else
			{
				if (NetworkServer.active || !Object.op_Implicit((Object)(object)_projectileOverlapAttack))
				{
					return;
				}
				if (!_overlapAttackInfoHasValue)
				{
					Log.Warning("Cannot update client attack info: Nothing has been received from the server", "X:\\Git\\RoR2\\PizzaClientLagFix\\PizzaClientLagFix\\Networking\\ProjectileOverlapAttackClientPrediction.cs", "UpdateClientAttackInfo", 91);
					return;
				}
				ProjectileOverlapAttack projectileOverlapAttack = _projectileOverlapAttack;
				if (projectileOverlapAttack.attack == null)
				{
					projectileOverlapAttack.attack = new OverlapAttack();
				}
				_overlapAttackInfo.ApplyTo(_projectileOverlapAttack.attack);
			}
		}

		private void syncOverlapAttackInfo(OverlapAttackInfo overlapAttackInfo)
		{
			Network_overlapAttackInfo = overlapAttackInfo;
			if (!NetworkServer.active)
			{
				Network_overlapAttackInfoHasValue = true;
				UpdateClientAttackInfo();
			}
		}

		private void UNetVersion()
		{
		}

		public override bool OnSerialize(NetworkWriter writer, bool forceAll)
		{
			if (forceAll)
			{
				writer.Write(_overlapAttackInfoHasValue);
				GeneratedNetworkCode._WriteOverlapAttackInfo_None(writer, _overlapAttackInfo);
				return true;
			}
			bool flag = false;
			if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0)
			{
				if (!flag)
				{
					writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
					flag = true;
				}
				writer.Write(_overlapAttackInfoHasValue);
			}
			if ((((NetworkBehaviour)this).syncVarDirtyBits & 2u) != 0)
			{
				if (!flag)
				{
					writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
					flag = true;
				}
				GeneratedNetworkCode._WriteOverlapAttackInfo_None(writer, _overlapAttackInfo);
			}
			if (!flag)
			{
				writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
			}
			return flag;
		}

		public override void OnDeserialize(NetworkReader reader, bool initialState)
		{
			if (initialState)
			{
				_overlapAttackInfoHasValue = reader.ReadBoolean();
				_overlapAttackInfo = GeneratedNetworkCode._ReadOverlapAttackInfo_None(reader);
				return;
			}
			int num = (int)reader.ReadPackedUInt32();
			if (((uint)num & (true ? 1u : 0u)) != 0)
			{
				_overlapAttackInfoHasValue = reader.ReadBoolean();
			}
			if (((uint)num & 2u) != 0)
			{
				syncOverlapAttackInfo(GeneratedNetworkCode._ReadOverlapAttackInfo_None(reader));
			}
		}
	}
}
namespace PizzaClientLagFix.Networking.Wrappers
{
	public struct DamageTypeComboWrapper : IEquatable<DamageTypeComboWrapper>
	{
		public ulong DamageTypeMask;

		public DamageTypeComboWrapper(DamageTypeCombo damageType)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			DamageTypeMask = damageType.damageTypeCombined;
		}

		public override readonly bool Equals(object obj)
		{
			if (obj is DamageTypeComboWrapper other)
			{
				return Equals(other);
			}
			return false;
		}

		public readonly bool Equals(DamageTypeComboWrapper other)
		{
			return DamageTypeMask == other.DamageTypeMask;
		}

		public override readonly int GetHashCode()
		{
			return DamageTypeMask.GetHashCode();
		}

		public static bool operator ==(DamageTypeComboWrapper left, DamageTypeComboWrapper right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(DamageTypeComboWrapper left, DamageTypeComboWrapper right)
		{
			return !(left == right);
		}

		public static implicit operator DamageTypeCombo(DamageTypeComboWrapper wrapper)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			return DamageTypeCombo.op_Implicit(wrapper.DamageTypeMask);
		}

		public static implicit operator DamageTypeComboWrapper(DamageTypeCombo damageType)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return new DamageTypeComboWrapper(damageType);
		}
	}
	public struct ProcChainMaskWrapper : IEquatable<ProcChainMaskWrapper>
	{
		public uint Mask;

		public ProcChainMaskWrapper(ProcChainMask procChainMask)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			Mask = procChainMask.mask;
		}

		public override readonly bool Equals(object obj)
		{
			if (obj is ProcChainMaskWrapper other)
			{
				return Equals(other);
			}
			return false;
		}

		public readonly bool Equals(ProcChainMaskWrapper other)
		{
			return Mask == other.Mask;
		}

		public override readonly int GetHashCode()
		{
			return Mask.GetHashCode();
		}

		public static bool operator ==(ProcChainMaskWrapper left, ProcChainMaskWrapper right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(ProcChainMaskWrapper left, ProcChainMaskWrapper right)
		{
			return !(left == right);
		}

		public static implicit operator ProcChainMask(ProcChainMaskWrapper wrapper)
		{
			//IL_0002: 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)
			ProcChainMask result = default(ProcChainMask);
			result.mask = wrapper.Mask;
			return result;
		}

		public static implicit operator ProcChainMaskWrapper(ProcChainMask mask)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			return new ProcChainMaskWrapper(mask);
		}
	}
}
namespace Unity
{
	[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
	public class GeneratedNetworkCode
	{
		public static void _WriteProcChainMaskWrapper_None(NetworkWriter writer, ProcChainMaskWrapper value)
		{
			writer.WritePackedUInt32(value.Mask);
		}

		public static void _WriteDamageTypeComboWrapper_None(NetworkWriter writer, DamageTypeComboWrapper value)
		{
			writer.WritePackedUInt64(value.DamageTypeMask);
		}

		public static void _WriteOverlapAttackInfo_None(NetworkWriter writer, OverlapAttackInfo value)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected I4, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Expected I4, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Expected I4, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected I4, but got Unknown
			writer.Write(value.Attacker);
			writer.Write(value.Inflictor);
			writer.Write((int)value.TeamIndex);
			writer.Write((int)value.AttackerFiltering);
			writer.Write(value.ForceVector);
			writer.Write(value.PushAwayForce);
			writer.Write(value.Damage);
			writer.Write(value.IsCrit);
			_WriteProcChainMaskWrapper_None(writer, value.ProcChainMask);
			writer.Write(value.ProcCoefficient);
			writer.Write((int)value.ImpactSound);
			writer.Write((int)value.DamageColorIndex);
			_WriteDamageTypeComboWrapper_None(writer, value.DamageType);
			writer.WritePackedUInt32((uint)value.MaximumOverlapTargets);
			writer.Write(value.RetriggerTimeout);
		}

		public static ProcChainMaskWrapper _ReadProcChainMaskWrapper_None(NetworkReader reader)
		{
			ProcChainMaskWrapper result = default(ProcChainMaskWrapper);
			result.Mask = reader.ReadPackedUInt32();
			return result;
		}

		public static DamageTypeComboWrapper _ReadDamageTypeComboWrapper_None(NetworkReader reader)
		{
			DamageTypeComboWrapper result = default(DamageTypeComboWrapper);
			result.DamageTypeMask = reader.ReadPackedUInt64();
			return result;
		}

		public static OverlapAttackInfo _ReadOverlapAttackInfo_None(NetworkReader reader)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			OverlapAttackInfo result = default(OverlapAttackInfo);
			result.Attacker = reader.ReadGameObject();
			result.Inflictor = reader.ReadGameObject();
			result.TeamIndex = (TeamIndex)reader.ReadInt32();
			result.AttackerFiltering = (AttackerFiltering)reader.ReadInt32();
			result.ForceVector = reader.ReadVector3();
			result.PushAwayForce = reader.ReadSingle();
			result.Damage = reader.ReadSingle();
			result.IsCrit = reader.ReadBoolean();
			result.ProcChainMask = _ReadProcChainMaskWrapper_None(reader);
			result.ProcCoefficient = reader.ReadSingle();
			result.ImpactSound = (NetworkSoundEventIndex)reader.ReadInt32();
			result.DamageColorIndex = (DamageColorIndex)reader.ReadInt32();
			result.DamageType = _ReadDamageTypeComboWrapper_None(reader);
			result.MaximumOverlapTargets = (int)reader.ReadPackedUInt32();
			result.RetriggerTimeout = reader.ReadSingle();
			return result;
		}
	}
}