using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LobbyCompatibility.Enums;
using LobbyCompatibility.Features;
using Microsoft.CodeAnalysis;
using PiggysVarietyMod.Dependencies;
using PiggysVarietyMod.Utils;
using TestAccount666.PiggysVarietyMod.NetcodePatcher;
using TestAccountCore;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TestAccount666.PiggysVarietyMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Add various vanilla style things.")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0+4ccb3b12b674ca9e7e0b61970a1ab6384d54f3c1")]
[assembly: AssemblyProduct("PiggysVarietyMod")]
[assembly: AssemblyTitle("TestAccount666.PiggysVarietyMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
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 PiggysVarietyMod
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency("TestAccount666.TestAccountCore", "1.16.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInIncompatibility("Piggy.PiggyVarietyMod")]
[BepInPlugin("TestAccount666.PiggysVarietyMod", "PiggysVarietyMod", "1.2.0")]
public class PiggysVarietyMod : BaseUnityPlugin
{
public static readonly ItemInputs INPUT_ACTIONS_INSTANCE = new ItemInputs();
public static PiggysVarietyMod Instance { get; private set; } = null;
internal static ManualLogSource Logger { get; private set; } = null;
internal static Harmony? Harmony { get; set; }
internal static void Patch()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
if (Harmony == null)
{
Harmony = new Harmony("TestAccount666.PiggysVarietyMod");
}
Logger.LogDebug((object)"Patching...");
Harmony.PatchAll();
Logger.LogDebug((object)"Finished patching!");
}
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
if (DependencyChecker.IsLobbyCompatibilityInstalled())
{
Logger.LogInfo((object)"Found LobbyCompatibility Mod, initializing support :)");
LobbyCompatibilitySupport.Initialize();
}
Assembly executingAssembly = Assembly.GetExecutingAssembly();
Netcode.ExecuteNetcodePatcher(executingAssembly);
LoadAssetBundle("PiggyVarietyMod.AssetBundle", executingAssembly);
Patch();
Logger.LogInfo((object)"TestAccount666.PiggysVarietyMod v1.2.0 has loaded!");
}
private void LoadAssetBundle(string fileName, Assembly assembly)
{
AssetLoader.LoadBundle(assembly, fileName);
AssetLoader.LoadItems(((BaseUnityPlugin)this).Config);
AssetLoader.LoadShopItems(((BaseUnityPlugin)this).Config);
AssetLoader.LoadHallwayHazards(((BaseUnityPlugin)this).Config);
}
internal static void Unpatch()
{
Logger.LogDebug((object)"Unpatching...");
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
Logger.LogDebug((object)"Finished unpatching!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "TestAccount666.PiggysVarietyMod";
public const string PLUGIN_NAME = "PiggysVarietyMod";
public const string PLUGIN_VERSION = "1.2.0";
}
}
namespace PiggysVarietyMod.Utils
{
public class ItemInputs : LcInputActions
{
[InputAction(/*Could not decode attribute arguments.*/)]
public InputAction RifleReloadKey { get; set; }
[InputAction(/*Could not decode attribute arguments.*/)]
public InputAction FireKey { get; set; }
[InputAction(/*Could not decode attribute arguments.*/)]
public InputAction SwitchFireModeKey { get; set; }
[InputAction(/*Could not decode attribute arguments.*/)]
public InputAction InspectKey { get; set; }
}
public static class ReferenceResolver
{
public static bool TryGetPlayer(int playerIndex, out PlayerControllerB player)
{
if (playerIndex < 0 || playerIndex >= StartOfRound.Instance.allPlayerScripts.Length)
{
player = null;
return false;
}
player = StartOfRound.Instance.allPlayerScripts[playerIndex];
return Object.op_Implicit((Object)(object)player);
}
public static bool TryGetEnemy(Collider collider, out EnemyAI enemyAI)
{
EnemyAICollisionDetect val = default(EnemyAICollisionDetect);
if (!((Component)collider).TryGetComponent<EnemyAICollisionDetect>(ref val) || !Object.op_Implicit((Object)(object)val.mainScript))
{
enemyAI = null;
return false;
}
enemyAI = val.mainScript;
return true;
}
public static bool TryGetEnemy(NetworkObjectReference enemyReference, out EnemyAI enemyAI)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
NetworkObject val = NetworkObjectReference.op_Implicit(enemyReference);
if (Object.op_Implicit((Object)(object)val))
{
return ((Component)val).TryGetComponent<EnemyAI>(ref enemyAI);
}
enemyAI = null;
return false;
}
}
}
namespace PiggysVarietyMod.Items
{
internal class RifleScript : GrabbableObject
{
[CompilerGenerated]
private sealed class <EndInspectCoroutine>d__68 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public float t;
public RifleScript <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <EndInspectCoroutine>d__68(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(t);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>4__this.isInspecting = false;
<>4__this.cantFire = false;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <FinishReloadCoroutine>d__57 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public float t;
public RifleScript <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <FinishReloadCoroutine>d__57(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(t);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>4__this.ammosLoaded = <>4__this.clipSize;
<>4__this.isReloading = false;
<>4__this.cantFire = false;
<>4__this.ResetBloom();
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <FinishSwitchFireModeCoroutine>d__63 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public float t;
public RifleScript <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <FinishSwitchFireModeCoroutine>d__63(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(t);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>4__this.automatic = !<>4__this.automatic;
<>4__this.cantFire = false;
<>4__this.isSwitchingFireMode = false;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <ResetCantFireCoroutine>d__49 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public float t;
public RifleScript <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ResetCantFireCoroutine>d__49(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(t);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>4__this.cantFire = false;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public int gunCompatibleAmmoID = 485;
public int clipSize = 30;
public float fireRate = 0.085f;
public bool automatic = true;
private const string _BASE_AMMO_TIP = "Reload : [R]";
private const string _BASE_MODE_TIP = "Switch Fire Mode [C]";
public float baseSpread = 0.01f;
public float bloomIncrease = 0.005f;
public float maxBloom = 0.04f;
private float _currentBloom;
public float recoilVertical = 2f;
public float recoilHorizontal = 0.6f;
public float recoilReturnSpeed = 6f;
private float _currentRecoilX;
private float _currentRecoilY;
private float _fireCooldown;
public int ammosLoaded;
public int ammoSlotToUse;
public bool isReloading;
public bool isInspecting;
public bool isSwitchingFireMode;
public bool cantFire;
public Animator gunAnimator;
public RuntimeAnimatorController rifleLocalAnimator;
public RuntimeAnimatorController rifleRemoteAnimator;
private static readonly Dictionary<ulong, RuntimeAnimatorController> _SAVED_ANIMATORS = new Dictionary<ulong, RuntimeAnimatorController>();
private AnimatorStateInfo _savedState;
private float _savedNormalizedTime;
private bool _savedCrouching;
private bool _savedWalking;
private bool _savedJumping;
private bool _savedSprinting;
private bool _animatorReplaced = false;
public ParticleSystem shootParticle;
public AudioSource audioSource;
public AudioClip SFX_FireM4;
public AudioClip SFX_ReloadM4;
public AudioClip SFX_TriggerM4;
public AudioClip SFX_SwitchFireModeM4;
private static void DebugLog(string msg)
{
Debug.Log((object)("[PiggyVarietyMod:RifleScript] " + msg));
}
public override void Start()
{
ammosLoaded = clipSize;
_currentBloom = baseSpread;
((GrabbableObject)this).Start();
}
public override void Update()
{
((GrabbableObject)this).Update();
if (!((Object)(object)base.playerHeldBy == (Object)null) && !((Object)(object)base.playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController) && !base.isPocketed)
{
_fireCooldown -= Time.deltaTime;
HandleInput();
UpdateRecoilCamera();
DisplayRifleTooltip();
}
}
public override void GrabItem()
{
EnableRifleAnimator();
((GrabbableObject)this).GrabItem();
}
public override void EquipItem()
{
EnableRifleAnimator();
((GrabbableObject)this).EquipItem();
}
public override void PocketItem()
{
DisableRifleAnimator();
((GrabbableObject)this).PocketItem();
}
public override void DiscardItem()
{
DisableRifleAnimator();
((GrabbableObject)this).DiscardItem();
}
private void HandleInput()
{
if (ShouldBlockInput())
{
return;
}
ItemInputs iNPUT_ACTIONS_INSTANCE = PiggysVarietyMod.INPUT_ACTIONS_INSTANCE;
bool flag = iNPUT_ACTIONS_INSTANCE.FireKey.IsPressed();
bool flag2 = iNPUT_ACTIONS_INSTANCE.FireKey.WasPressedThisFrame();
if (flag2 && ammosLoaded <= 0)
{
audioSource.PlayOneShot(SFX_TriggerM4);
}
if (automatic)
{
if (flag)
{
TryShoot();
}
}
else if (flag2)
{
TryShoot();
}
if (iNPUT_ACTIONS_INSTANCE.RifleReloadKey.WasPressedThisFrame())
{
TryReload();
}
if (iNPUT_ACTIONS_INSTANCE.SwitchFireModeKey.WasPressedThisFrame())
{
TrySwitchFireMode();
}
if (iNPUT_ACTIONS_INSTANCE.InspectKey.WasPressedThisFrame())
{
TryInspect();
}
}
private bool ShouldBlockInput()
{
if ((Object)(object)base.playerHeldBy == (Object)null)
{
return true;
}
if (base.playerHeldBy.isGrabbingObjectAnimation)
{
return true;
}
if (base.playerHeldBy.isTypingChat)
{
return true;
}
if (base.playerHeldBy.inTerminalMenu)
{
return true;
}
if (base.playerHeldBy.inSpecialInteractAnimation)
{
return true;
}
if ((Object)(object)base.playerHeldBy.hoveringOverTrigger != (Object)null)
{
return true;
}
if (base.playerHeldBy.quickMenuManager.isMenuOpen)
{
return true;
}
if (base.playerHeldBy.inSpecialMenu)
{
return true;
}
return false;
}
private void TryShoot()
{
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)base.playerHeldBy == (Object)null) && !cantFire && !isReloading && !isInspecting && !isSwitchingFireMode && !(_fireCooldown > 0f) && ammosLoaded > 0)
{
_fireCooldown = fireRate;
cantFire = true;
((MonoBehaviour)this).StartCoroutine(ResetCantFireCoroutine(0.1f));
Vector3 position = ((Component)base.playerHeldBy.gameplayCamera).transform.position;
Vector3 shootDirection = GetShootDirection();
ShootServerRpc(position, shootDirection);
ApplyCameraRecoil();
IncreaseBloom();
}
}
[IteratorStateMachine(typeof(<ResetCantFireCoroutine>d__49))]
private IEnumerator ResetCantFireCoroutine(float t)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ResetCantFireCoroutine>d__49(0)
{
<>4__this = this,
t = t
};
}
[ServerRpc(RequireOwnership = false)]
public void ShootServerRpc(Vector3 gunPosition, Vector3 gunForward)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: 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_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3816867504u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref gunPosition);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref gunForward);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3816867504u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
ShootClientRpc(gunPosition, gunForward);
}
}
}
[ClientRpc]
public void ShootClientRpc(Vector3 gunPosition, Vector3 gunForward)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: 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_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2076814580u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref gunPosition);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref gunForward);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2076814580u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
Shoot(gunPosition, gunForward);
}
}
}
public void Shoot(Vector3 gunPosition, Vector3 gunForward)
{
//IL_0083: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)base.playerHeldBy == (Object)null)
{
return;
}
float num = 80f;
shootParticle.Play(true);
base.playerHeldBy.playerBodyAnimator.Play("ShootM4", 4, 0f);
audioSource.PlayOneShot(SFX_FireM4);
ammosLoaded--;
if ((Object)(object)base.playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
return;
}
RaycastHit[] array = Physics.RaycastAll(gunPosition, gunForward, num, StartOfRound.Instance.collidersRoomMaskDefaultAndPlayers | 0x80000, (QueryTriggerInteraction)2);
if (array.Length == 0)
{
return;
}
Array.Sort(array, (RaycastHit x, RaycastHit y) => ((RaycastHit)(ref x)).distance.CompareTo(((RaycastHit)(ref y)).distance));
RaycastHit[] array2 = array;
PlayerControllerB val2 = default(PlayerControllerB);
IHittable val3 = default(IHittable);
for (int i = 0; i < array2.Length; i++)
{
RaycastHit val = array2[i];
GameObject gameObject = ((Component)((RaycastHit)(ref val)).collider).gameObject;
if (gameObject.TryGetComponent<PlayerControllerB>(ref val2) && (Object)(object)val2 == (Object)(object)base.playerHeldBy)
{
continue;
}
if (gameObject.TryGetComponent<IHittable>(ref val3))
{
EnemyAICollisionDetect val4 = (EnemyAICollisionDetect)(object)((val3 is EnemyAICollisionDetect) ? val3 : null);
if (val4 != null)
{
DebugLog("Hitting Enemy = " + (object)val4);
val4.mainScript.HitEnemyOnLocalClient(1, gunForward, base.playerHeldBy, true, -1);
break;
}
PlayerControllerB val5 = (PlayerControllerB)(object)((val3 is PlayerControllerB) ? val3 : null);
if (val5 != null)
{
DebugLog("Hitting Player = " + (object)val5);
val3.Hit(1, gunForward, base.playerHeldBy, true, -1);
}
else
{
val3.Hit(1, gunForward, base.playerHeldBy, true, -1);
}
}
else
{
EnemyAI componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<EnemyAI>();
if ((Object)(object)componentInParent != (Object)null)
{
componentInParent.HitEnemyOnLocalClient(1, gunForward, base.playerHeldBy, true, 1);
}
}
break;
}
}
private void TryReload()
{
if (!((Object)(object)base.playerHeldBy == (Object)null) && !isReloading && !isInspecting && !isSwitchingFireMode && ammosLoaded < clipSize)
{
int num = FindAmmoInInventory();
if (num != -1)
{
ammoSlotToUse = num;
isReloading = true;
cantFire = true;
ReloadServerRpc(ammoSlotToUse);
}
}
}
[ServerRpc(RequireOwnership = false)]
public void ReloadServerRpc(int ammoSlotIndex)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: 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_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(50184615u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, ammoSlotIndex);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 50184615u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
ReloadClientRpc(ammoSlotIndex);
}
}
}
[ClientRpc]
public void ReloadClientRpc(int ammoSlotIndex)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: 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_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1885630641u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, ammoSlotIndex);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1885630641u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
StartReload(ammoSlotIndex);
}
}
}
public void StartReload(int ammoSlotIndex)
{
ammoSlotToUse = ammoSlotIndex;
isReloading = true;
cantFire = true;
base.playerHeldBy.playerBodyAnimator.Play("ReloadM4", 4, 0f);
gunAnimator.Play("Reload", 0, 0f);
audioSource.PlayOneShot(SFX_ReloadM4);
base.playerHeldBy.DestroyItemInSlotAndSync(ammoSlotToUse);
ammoSlotToUse = -1;
float clipLength = GetClipLength("ReloadM4");
((MonoBehaviour)this).StartCoroutine(FinishReloadCoroutine(clipLength));
}
[IteratorStateMachine(typeof(<FinishReloadCoroutine>d__57))]
private IEnumerator FinishReloadCoroutine(float t)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <FinishReloadCoroutine>d__57(0)
{
<>4__this = this,
t = t
};
}
private int FindAmmoInInventory()
{
for (int i = 0; i < base.playerHeldBy.ItemSlots.Length; i++)
{
if ((Object)(object)base.playerHeldBy.ItemSlots[i] != (Object)null)
{
GunAmmo component = ((Component)base.playerHeldBy.ItemSlots[i]).GetComponent<GunAmmo>();
if ((Object)(object)component != (Object)null && component.ammoType == gunCompatibleAmmoID)
{
return i;
}
}
}
return -1;
}
private void TrySwitchFireMode()
{
if (!((Object)(object)base.playerHeldBy == (Object)null) && !isReloading && !isInspecting && !isSwitchingFireMode)
{
isSwitchingFireMode = true;
cantFire = true;
SwitchFireModeServerRpc();
}
}
[ServerRpc(RequireOwnership = false)]
private void SwitchFireModeServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4047799981u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4047799981u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
SwitchFireModeClientRpc();
}
}
}
[ClientRpc]
private void SwitchFireModeClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(163424506u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 163424506u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
StartSwitchFireMode();
}
}
}
private void StartSwitchFireMode()
{
isSwitchingFireMode = true;
cantFire = true;
base.playerHeldBy.playerBodyAnimator.Play("SwitchFireModeM4", 4, 0f);
audioSource.PlayOneShot(SFX_SwitchFireModeM4);
float t = GetClipLength("SwitchFireModeM4") / 2f;
((MonoBehaviour)this).StartCoroutine(FinishSwitchFireModeCoroutine(t));
}
[IteratorStateMachine(typeof(<FinishSwitchFireModeCoroutine>d__63))]
private IEnumerator FinishSwitchFireModeCoroutine(float t)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <FinishSwitchFireModeCoroutine>d__63(0)
{
<>4__this = this,
t = t
};
}
private void TryInspect()
{
if (!((Object)(object)base.playerHeldBy == (Object)null) && !isReloading && !isInspecting && !isSwitchingFireMode)
{
isInspecting = true;
cantFire = true;
InspectServerRpc();
}
}
[ServerRpc(RequireOwnership = false)]
private void InspectServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2805837038u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2805837038u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
InspectClientRpc();
}
}
}
[ClientRpc]
private void InspectClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1173771251u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1173771251u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
StartInspect();
}
}
}
private void StartInspect()
{
isInspecting = true;
cantFire = true;
base.playerHeldBy.playerBodyAnimator.Play("InspectM4", 4, 0f);
float clipLength = GetClipLength("InspectM4");
((MonoBehaviour)this).StartCoroutine(EndInspectCoroutine(clipLength));
}
[IteratorStateMachine(typeof(<EndInspectCoroutine>d__68))]
private IEnumerator EndInspectCoroutine(float t)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <EndInspectCoroutine>d__68(0)
{
<>4__this = this,
t = t
};
}
private Vector3 GetShootDirection()
{
//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_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: 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)
Camera gameplayCamera = base.playerHeldBy.gameplayCamera;
Vector3 forward = ((Component)gameplayCamera).transform.forward;
forward.x += Random.Range(0f - _currentBloom, _currentBloom);
forward.y += Random.Range(0f - _currentBloom, _currentBloom);
return ((Vector3)(ref forward)).normalized;
}
private void IncreaseBloom()
{
_currentBloom = Mathf.Clamp(_currentBloom + bloomIncrease, baseSpread, maxBloom);
}
private void ResetBloom()
{
_currentBloom = baseSpread;
}
private void ApplyCameraRecoil()
{
if (!((Object)(object)base.playerHeldBy == (Object)null))
{
_currentRecoilY += recoilVertical;
_currentRecoilX += Random.Range(0f - recoilHorizontal, recoilHorizontal);
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
}
}
private void UpdateRecoilCamera()
{
//IL_006a: 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)
if (!((Object)(object)base.playerHeldBy == (Object)null))
{
PlayerControllerB playerHeldBy = base.playerHeldBy;
playerHeldBy.cameraUp -= _currentRecoilY * Time.deltaTime * 8f;
base.playerHeldBy.cameraUp = Mathf.Clamp(base.playerHeldBy.cameraUp, -80f, 80f);
base.playerHeldBy.thisPlayerBody.Rotate(Vector3.up * (_currentRecoilX * Time.deltaTime * 8f));
_currentRecoilX = Mathf.Lerp(_currentRecoilX, 0f, Time.deltaTime * recoilReturnSpeed);
_currentRecoilY = Mathf.Lerp(_currentRecoilY, 0f, Time.deltaTime * recoilReturnSpeed);
}
}
private void DisplayRifleTooltip()
{
string text = (automatic ? "Auto" : "Semi");
base.itemProperties.toolTips[2] = string.Format("{0} [{1}]", "Reload : [R]", ammosLoaded);
base.itemProperties.toolTips[3] = "Switch Fire Mode [C] [" + text + "]";
HUDManager.Instance.ChangeControlTipMultiple(base.itemProperties.toolTips, false, base.itemProperties);
}
private void SaveAnimatorState(Animator anim)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
_savedState = anim.GetCurrentAnimatorStateInfo(0);
_savedNormalizedTime = ((AnimatorStateInfo)(ref _savedState)).normalizedTime;
_savedCrouching = anim.GetBool("crouching");
_savedWalking = anim.GetBool("Walking");
_savedJumping = anim.GetBool("Jumping");
_savedSprinting = anim.GetBool("Sprinting");
}
private void RestoreAnimatorState(Animator anim)
{
anim.Play(((AnimatorStateInfo)(ref _savedState)).fullPathHash, 0, _savedNormalizedTime);
anim.SetBool("crouching", _savedCrouching);
anim.SetBool("Walking", _savedWalking);
anim.SetBool("Jumping", _savedJumping);
anim.SetBool("Sprinting", _savedSprinting);
base.playerHeldBy.playerBodyAnimator.Play("HoldM4", 4, 0f);
}
private void EnableRifleAnimator()
{
if (!_animatorReplaced && !((Object)(object)base.playerHeldBy == (Object)null))
{
if (!_SAVED_ANIMATORS.ContainsKey(base.playerHeldBy.playerClientId))
{
_SAVED_ANIMATORS[base.playerHeldBy.playerClientId] = base.playerHeldBy.playerBodyAnimator.runtimeAnimatorController;
}
SaveAnimatorState(base.playerHeldBy.playerBodyAnimator);
if ((Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
base.playerHeldBy.playerBodyAnimator.runtimeAnimatorController = rifleLocalAnimator;
}
else
{
base.playerHeldBy.playerBodyAnimator.runtimeAnimatorController = rifleRemoteAnimator;
}
base.playerHeldBy.playerBodyAnimator.Rebind();
base.playerHeldBy.playerBodyAnimator.Update(0f);
RestoreAnimatorState(base.playerHeldBy.playerBodyAnimator);
_animatorReplaced = true;
}
}
private void DisableRifleAnimator()
{
if (_animatorReplaced && !((Object)(object)base.playerHeldBy == (Object)null))
{
SaveAnimatorState(base.playerHeldBy.playerBodyAnimator);
if (_SAVED_ANIMATORS.TryGetValue(base.playerHeldBy.playerClientId, out RuntimeAnimatorController value))
{
base.playerHeldBy.playerBodyAnimator.runtimeAnimatorController = value;
_SAVED_ANIMATORS.Remove(base.playerHeldBy.playerClientId);
}
base.playerHeldBy.playerBodyAnimator.Rebind();
base.playerHeldBy.playerBodyAnimator.Update(0f);
RestoreAnimatorState(base.playerHeldBy.playerBodyAnimator);
_animatorReplaced = false;
}
}
private float GetClipLength(string clipName)
{
if ((Object)(object)base.playerHeldBy == (Object)null || (Object)(object)base.playerHeldBy.playerBodyAnimator == (Object)null || (Object)(object)base.playerHeldBy.playerBodyAnimator.runtimeAnimatorController == (Object)null)
{
return -1f;
}
AnimationClip[] animationClips = base.playerHeldBy.playerBodyAnimator.runtimeAnimatorController.animationClips;
foreach (AnimationClip val in animationClips)
{
if (((Object)val).name == clipName)
{
return val.length;
}
}
return -1f;
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Expected O, but got Unknown
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Expected O, but got Unknown
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(3816867504u, new RpcReceiveHandler(__rpc_handler_3816867504), "ShootServerRpc");
((NetworkBehaviour)this).__registerRpc(2076814580u, new RpcReceiveHandler(__rpc_handler_2076814580), "ShootClientRpc");
((NetworkBehaviour)this).__registerRpc(50184615u, new RpcReceiveHandler(__rpc_handler_50184615), "ReloadServerRpc");
((NetworkBehaviour)this).__registerRpc(1885630641u, new RpcReceiveHandler(__rpc_handler_1885630641), "ReloadClientRpc");
((NetworkBehaviour)this).__registerRpc(4047799981u, new RpcReceiveHandler(__rpc_handler_4047799981), "SwitchFireModeServerRpc");
((NetworkBehaviour)this).__registerRpc(163424506u, new RpcReceiveHandler(__rpc_handler_163424506), "SwitchFireModeClientRpc");
((NetworkBehaviour)this).__registerRpc(2805837038u, new RpcReceiveHandler(__rpc_handler_2805837038), "InspectServerRpc");
((NetworkBehaviour)this).__registerRpc(1173771251u, new RpcReceiveHandler(__rpc_handler_1173771251), "InspectClientRpc");
((GrabbableObject)this).__initializeRpcs();
}
private static void __rpc_handler_3816867504(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
Vector3 gunPosition = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref gunPosition);
Vector3 gunForward = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref gunForward);
target.__rpc_exec_stage = (__RpcExecStage)1;
((RifleScript)(object)target).ShootServerRpc(gunPosition, gunForward);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2076814580(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
Vector3 gunPosition = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref gunPosition);
Vector3 gunForward = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref gunForward);
target.__rpc_exec_stage = (__RpcExecStage)1;
((RifleScript)(object)target).ShootClientRpc(gunPosition, gunForward);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_50184615(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int ammoSlotIndex = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref ammoSlotIndex);
target.__rpc_exec_stage = (__RpcExecStage)1;
((RifleScript)(object)target).ReloadServerRpc(ammoSlotIndex);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1885630641(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: 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)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int ammoSlotIndex = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref ammoSlotIndex);
target.__rpc_exec_stage = (__RpcExecStage)1;
((RifleScript)(object)target).ReloadClientRpc(ammoSlotIndex);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_4047799981(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((RifleScript)(object)target).SwitchFireModeServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_163424506(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((RifleScript)(object)target).SwitchFireModeClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2805837038(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((RifleScript)(object)target).InspectServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1173771251(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((RifleScript)(object)target).InspectClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "RifleScript";
}
}
}
namespace PiggysVarietyMod.Hazards.TeslaGate
{
public class TeslaGate : NetworkBehaviour
{
private static readonly int _POWERED_ANIMATOR_HASH = Animator.StringToHash("Powered");
private static readonly int _SPEED_ANIMATOR_HASH = Animator.StringToHash("Speed");
public Animator animator;
public AudioSource shutDownSound;
private float _randomSpeed = -1f;
private bool _initialized;
public override void OnNetworkSpawn()
{
if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
{
if (!_initialized)
{
_randomSpeed = Random.Range(0.96f, 1.04f);
}
UseRandomOffsetClientRpc(_randomSpeed);
}
}
private void LateUpdate()
{
if (animator.GetBool(_POWERED_ANIMATOR_HASH) && RoundManager.Instance.powerOffPermanently)
{
animator.SetBool(_POWERED_ANIMATOR_HASH, false);
shutDownSound.Play();
}
}
[ClientRpc]
public void UseRandomOffsetClientRpc(float randomSpeed)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Invalid comparison between Unknown and I4
//IL_005f: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: 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)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3322670014u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref randomSpeed, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3322670014u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
base.__rpc_exec_stage = (__RpcExecStage)0;
if (!_initialized)
{
_randomSpeed = randomSpeed;
animator.SetFloat(_SPEED_ANIMATOR_HASH, _randomSpeed);
_initialized = true;
}
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(3322670014u, new RpcReceiveHandler(__rpc_handler_3322670014), "UseRandomOffsetClientRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_3322670014(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: 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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
float randomSpeed = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref randomSpeed, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((TeslaGate)(object)target).UseRandomOffsetClientRpc(randomSpeed);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "TeslaGate";
}
}
public class TeslaKillTrigger : MonoBehaviour
{
private void OnTriggerStay(Collider other)
{
//IL_005c: 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)
if (ReferenceResolver.TryGetEnemy(other, out EnemyAI enemyAI))
{
OnEnemyTrigger(enemyAI);
return;
}
PlayerControllerB componentInChildren = ((Component)other).GetComponentInChildren<PlayerControllerB>();
if (Object.op_Implicit((Object)(object)componentInChildren))
{
PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
if (!((Object)(object)componentInChildren != (Object)(object)localPlayerController))
{
componentInChildren.DamagePlayer(componentInChildren.health, true, true, (CauseOfDeath)11, 0, false, default(Vector3));
}
}
}
private static void OnEnemyTrigger(EnemyAI enemyAI)
{
StartOfRound instance = StartOfRound.Instance;
if ((instance == null || ((NetworkBehaviour)instance).IsHost || ((NetworkBehaviour)instance).IsServer) && Object.op_Implicit((Object)(object)enemyAI) && enemyAI != null && !enemyAI.isEnemyDead)
{
EnemyType enemyType = enemyAI.enemyType;
if (enemyType != null && enemyType.canDie)
{
enemyAI.KillEnemyClientRpc(false);
}
}
}
}
}
namespace PiggysVarietyMod.Dependencies
{
internal static class DependencyChecker
{
internal static bool IsLobbyCompatibilityInstalled()
{
return Chainloader.PluginInfos.Values.Any((PluginInfo metadata) => metadata.Metadata.GUID.Contains("LobbyCompatibility"));
}
}
internal static class LobbyCompatibilitySupport
{
internal static void Initialize()
{
PluginHelper.RegisterPlugin("TestAccount666.PiggysVarietyMod", new Version("1.2.0"), (CompatibilityLevel)2, (VersionStrictness)2);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace __GEN
{
internal class NetworkVariableSerializationHelper
{
[RuntimeInitializeOnLoadMethod]
internal static void InitializeSerialization()
{
}
}
}
namespace TestAccount666.PiggysVarietyMod.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}