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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Rendering;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c574138cfea486cfa7104eae1a6f135c166daf8b")]
[assembly: AssemblyProduct("ShopOrb")]
[assembly: AssemblyTitle("ShopOrb")]
[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
{
[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 Empress.GlimfShopLatch
{
[BepInPlugin("Empress.GlimfShopLatch", "GlimfShopLatch", "1.2.1")]
public class ShopLatchPlugin : BaseUnityPlugin
{
[CompilerGenerated]
private sealed class <HostCloseWindow>d__38 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ShopLatchPlugin <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <HostCloseWindow>d__38(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
if (FreeShopActive && Time.time < FreeShopUntil)
{
<>2__current = null;
<>1__state = 1;
return true;
}
FreeShopActive = false;
FreeShopPlayerActor = -1;
Logger.LogInfo((object)"[HOST] Free shop window closed.");
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 const string PluginGuid = "Empress.GlimfShopLatch";
public const string PluginName = "GlimfShopLatch";
public const string PluginVersion = "1.2.1";
internal static ShopLatchPlugin Instance = null;
internal static ConfigEntry<float> C_PreShopDelay = null;
internal static ConfigEntry<float> C_VisitSeconds = null;
internal static ConfigEntry<bool> C_RequirePressE = null;
internal static ConfigEntry<KeyCode> C_ActivateKey = null;
internal static ConfigEntry<bool> C_DroneEnable = null;
internal static ConfigEntry<float> C_DroneLifetime = null;
internal static ConfigEntry<float> C_DronePatrolRadius = null;
internal static ConfigEntry<float> C_DroneSpeed = null;
internal static ConfigEntry<float> C_DroneTurnSpeed = null;
internal static ConfigEntry<float> C_DroneScanRadius = null;
internal static ConfigEntry<int> C_DroneEnemyLayerMask = null;
internal static ConfigEntry<float> C_AudioStartVol = null;
internal static ConfigEntry<float> C_AudioIdleVol = null;
internal static ConfigEntry<float> C_AudioAttackVol = null;
internal static ConfigEntry<int> C_ProjDamage = null;
internal static ConfigEntry<float> C_ProjInterval = null;
internal static ConfigEntry<float> C_ProjSpeed = null;
internal static ConfigEntry<float> C_ProjLife = null;
internal static ConfigEntry<float> C_ProjRadius = null;
internal static bool FreeShopActive;
internal static float FreeShopUntil;
internal static int FreeShopPlayerActor = -1;
internal static bool LocalSceneSwitchOverride;
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; private set; }
private void Awake()
{
//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Expected O, but got Unknown
Instance = this;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
C_PreShopDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Shop", "PreShopDelaySeconds", 10f, "Seconds from latch to Shop warp.");
C_VisitSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Shop", "VisitSeconds", 15f, "How long the solo Shop visit lasts.");
C_RequirePressE = ((BaseUnityPlugin)this).Config.Bind<bool>("Activate", "RequirePressE", true, "Require E press to activate.");
C_ActivateKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Activate", "Key", (KeyCode)101, "Activation key when pressed.");
C_DroneEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("Drone", "EnableDroneMode", true, "If true, pressing E spawns roaming projectile drone instead of shop flow.");
C_DroneLifetime = ((BaseUnityPlugin)this).Config.Bind<float>("Drone", "LifetimeSeconds", 60f, "Active duration before the item breaks.");
C_DronePatrolRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Drone", "PatrolRadius", 40f, "Fallback randomized patrol radius when level points unavailable.");
C_DroneSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Drone", "MoveSpeed", 3.5f, "NavMeshAgent speed.");
C_DroneTurnSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Drone", "TurnSpeed", 360f, "NavMeshAgent angular speed (deg/s).");
C_DroneScanRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Drone", "ScanRadius", 20f, "Enemy scan radius for target acquisition.");
C_DroneEnemyLayerMask = ((BaseUnityPlugin)this).Config.Bind<int>("Drone", "EnemyLayerMask", -1, "Physics layer mask considered 'enemy' (-1 = Everything).");
C_AudioStartVol = ((BaseUnityPlugin)this).Config.Bind<float>("Audio", "StartVolume", 1f, "Volume for start one-shot.");
C_AudioIdleVol = ((BaseUnityPlugin)this).Config.Bind<float>("Audio", "IdleVolume", 0.5f, "Volume for idle loop.");
C_AudioAttackVol = ((BaseUnityPlugin)this).Config.Bind<float>("Audio", "AttackVolume", 0.9f, "Volume for attack one-shots.");
C_ProjDamage = ((BaseUnityPlugin)this).Config.Bind<int>("Projectile", "Damage", 10, "Damage per projectile hit.");
C_ProjInterval = ((BaseUnityPlugin)this).Config.Bind<float>("Projectile", "IntervalSeconds", 2f, "Seconds between shots (only with a target).");
C_ProjSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Projectile", "Speed", 22f, "Projectile travel speed.");
C_ProjLife = ((BaseUnityPlugin)this).Config.Bind<float>("Projectile", "LifetimeSeconds", 3f, "How long before the projectile despawns.");
C_ProjRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Projectile", "Radius", 0.12f, "Sphere collider trigger radius.");
Harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony.PatchAll(typeof(Patch_SemiFunc_IsMasterClientOrSingleplayer));
Harmony.PatchAll(typeof(Patch_SemiFunc_StatSetRunCurrency));
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} loaded.");
}
internal static void WithLocalSceneSwitchOverride(Action run)
{
try
{
LocalSceneSwitchOverride = true;
run();
}
finally
{
LocalSceneSwitchOverride = false;
}
}
internal static void HostOpenFreeShop(Player p, float seconds)
{
if (PhotonNetwork.IsMasterClient)
{
FreeShopActive = true;
FreeShopPlayerActor = ((p != null) ? p.ActorNumber : (-1));
FreeShopUntil = Time.time + seconds;
((MonoBehaviour)Instance).StartCoroutine(Instance.HostCloseWindow());
Logger.LogInfo((object)$"[HOST] Free shop window open for actor {FreeShopPlayerActor} ({seconds:0.0}s).");
}
}
[IteratorStateMachine(typeof(<HostCloseWindow>d__38))]
private IEnumerator HostCloseWindow()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <HostCloseWindow>d__38(0)
{
<>4__this = this
};
}
}
public class LatchShopItem : Trap, IPunObservable
{
[CompilerGenerated]
private sealed class <DisableLaserNextFrame>d__57 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LineRenderer lr;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DisableLaserNextFrame>d__57(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if (Object.op_Implicit((Object)(object)lr))
{
((Renderer)lr).enabled = 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 <IdleAndContinue>d__53 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LatchShopItem <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <IdleAndContinue>d__53(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>4__this._agent.isStopped = true;
<>2__current = (object)new WaitForSeconds(Random.Range(0.8f, 2f));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>4__this.ForceNextPatrolDestination();
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 <Server_BeginDroneAfter>d__47 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public float delay;
public LatchShopItem <>4__this;
private float <end>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Server_BeginDroneAfter>d__47(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if (delay > 0f)
{
<>2__current = (object)new WaitForSeconds(delay);
<>1__state = 1;
return true;
}
goto IL_0060;
case 1:
<>1__state = -1;
goto IL_0060;
case 2:
{
<>1__state = -1;
break;
}
IL_0060:
<>4__this.BeginDroneServerAuthoritative();
((Trap)<>4__this).photonView.RPC("RPC_StartIdleLoop", (RpcTarget)0, Array.Empty<object>());
<end>5__1 = Time.time + Mathf.Max(1f, ShopLatchPlugin.C_DroneLifetime.Value);
break;
}
if (Time.time < <end>5__1)
{
<>4__this.DroneHostTick();
<>2__current = null;
<>1__state = 2;
return true;
}
((Trap)<>4__this).photonView.RPC("RPC_StopIdleLoop", (RpcTarget)0, Array.Empty<object>());
((Trap)<>4__this).photonView.RPC("RPC_BreakAndDie", (RpcTarget)0, Array.Empty<object>());
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 <Server_ShopFlowAfter>d__65 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public float afterSeconds;
public int playerViewIdHint;
public LatchShopItem <>4__this;
private int <playerViewId>5__1;
private float <pre>5__2;
private float <visit>5__3;
private PhotonView <pv>5__4;
private PlayerAvatar <pa2>5__5;
private Player <target>5__6;
private PlayerAvatar <pa>5__7;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Server_ShopFlowAfter>d__65(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<pv>5__4 = null;
<pa2>5__5 = null;
<target>5__6 = null;
<pa>5__7 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Expected O, but got Unknown
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if (afterSeconds > 0f)
{
<>2__current = (object)new WaitForSeconds(afterSeconds);
<>1__state = 1;
return true;
}
goto IL_0069;
case 1:
<>1__state = -1;
goto IL_0069;
case 2:
<>1__state = -1;
<pv>5__4 = PhotonView.Find(<playerViewId>5__1);
if ((Object)(object)<pv>5__4 == (Object)null)
{
return false;
}
<pa2>5__5 = ((Component)<pv>5__4).GetComponent<PlayerAvatar>();
if ((Object)(object)<pa2>5__5 == (Object)null)
{
return false;
}
<target>5__6 = <pv>5__4.Owner;
ShopLatchPlugin.HostOpenFreeShop(<target>5__6, <visit>5__3);
((Trap)<>4__this).photonView.RPC("RPC_ClientEnterShop", <target>5__6, new object[1] { <visit>5__3 });
<>2__current = (object)new WaitForSeconds(<visit>5__3);
<>1__state = 3;
return true;
case 3:
{
<>1__state = -1;
((Trap)<>4__this).photonView.RPC("RPC_ClientExitShop", <target>5__6, Array.Empty<object>());
return false;
}
IL_0069:
<playerViewId>5__1 = playerViewIdHint;
if (<playerViewId>5__1 < 0)
{
<pa>5__7 = (((Object)(object)((Trap)<>4__this).physGrabObject != (Object)null) ? ((Trap)<>4__this).physGrabObject.lastPlayerGrabbing : null);
<playerViewId>5__1 = ((Object.op_Implicit((Object)(object)<pa>5__7) && Object.op_Implicit((Object)(object)<pa>5__7.photonView)) ? <pa>5__7.photonView.ViewID : (-1));
<pa>5__7 = null;
}
if (<playerViewId>5__1 < 0)
{
return false;
}
<pre>5__2 = Mathf.Max(0.1f, ShopLatchPlugin.C_PreShopDelay.Value);
<visit>5__3 = Mathf.Max(1f, ShopLatchPlugin.C_VisitSeconds.Value);
<>2__current = (object)new WaitForSeconds(<pre>5__2);
<>1__state = 2;
return true;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[Header("Audio (assign in prefab)")]
public AudioClip startClip;
public AudioClip idleClip;
public AudioClip attackClip;
private AudioSource _oneShot;
private AudioSource _idle;
private Rigidbody _rb;
private bool _armed;
private bool _droneActive;
private bool _startSfxSent;
private Vector3 _netPos;
private Quaternion _netRot;
private bool _hasNetPose;
private const float PoseSnapDist = 5f;
private const float PoseLerpRate = 10f;
private float _poseSendTimer;
private const float PoseSendInterval = 0.2f;
private NavMeshAgent _agent;
private LineRenderer _laser;
private LineRenderer _scanLine;
private Transform[] _levelPoints;
private Transform _truckPoint;
private Vector3 _lastPos;
private float _stuckTimer;
private bool _movingToPatrol;
private float _repathTimer;
private static readonly Collider[] _overlapBuf = (Collider[])(object)new Collider[64];
private Collider _currentTargetCol;
private Enemy _currentEnemy;
private float _nextAcquireTime;
private float _nextShootTime;
private float _nextAttackSfxTime;
private readonly NavMeshPath _reusablePath = new NavMeshPath();
private float _scanAngleDeg;
private float _scanPulseT;
private bool _ramMode;
private const float RamEnterDist = 0.9f;
private const float RamExitDist = 1.4f;
private const float RamSpeedBoost = 1.35f;
private bool Authority => !PhotonNetwork.InRoom || PhotonNetwork.IsMasterClient;
public override void Start()
{
((Trap)this).Start();
_rb = ((Component)this).GetComponent<Rigidbody>();
_agent = ((Component)this).gameObject.GetComponent<NavMeshAgent>() ?? ((Component)this).gameObject.AddComponent<NavMeshAgent>();
((Behaviour)_agent).enabled = false;
_agent.stoppingDistance = 0f;
_agent.obstacleAvoidanceType = (ObstacleAvoidanceType)4;
_agent.autoBraking = false;
_agent.updateRotation = true;
_agent.autoRepath = true;
_agent.acceleration = 24f;
_agent.radius = 0.1f;
_laser = EnsureChildLineRenderer("LaserLR", 0.03f);
_scanLine = EnsureChildLineRenderer("ScanLineLR", 0.02f);
if (Object.op_Implicit((Object)(object)_laser))
{
((Renderer)_laser).enabled = false;
_laser.positionCount = 2;
_laser.useWorldSpace = true;
}
if (Object.op_Implicit((Object)(object)_scanLine))
{
((Renderer)_scanLine).enabled = false;
_scanLine.positionCount = 2;
_scanLine.useWorldSpace = true;
((Renderer)_scanLine).shadowCastingMode = (ShadowCastingMode)0;
((Renderer)_scanLine).receiveShadows = false;
}
_oneShot = ((Component)this).gameObject.GetComponent<AudioSource>() ?? ((Component)this).gameObject.AddComponent<AudioSource>();
_oneShot.playOnAwake = false;
_oneShot.loop = false;
_oneShot.spatialBlend = 1f;
_oneShot.dopplerLevel = 0f;
_oneShot.rolloffMode = (AudioRolloffMode)0;
_oneShot.minDistance = 8f;
_oneShot.maxDistance = 18f;
_idle = ((Component)this).gameObject.AddComponent<AudioSource>();
_idle.playOnAwake = false;
_idle.loop = true;
_idle.spatialBlend = 1f;
_idle.dopplerLevel = 0f;
_idle.rolloffMode = (AudioRolloffMode)0;
_idle.minDistance = 10f;
_idle.maxDistance = 24f;
LevelGenerator instance = LevelGenerator.Instance;
if (!((Object)(object)instance != (Object)null) || !instance.Generated)
{
return;
}
_truckPoint = (Object.op_Implicit((Object)(object)instance.LevelPathTruck) ? ((Component)instance.LevelPathTruck).transform : null);
if (instance.LevelPathPoints != null)
{
_levelPoints = (from p in instance.LevelPathPoints
where (Object)(object)p != (Object)null
select ((Component)p).transform).ToArray();
}
}
private LineRenderer EnsureChildLineRenderer(string childName, float width)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
Transform val = ((Component)this).transform.Find(childName);
GameObject val2;
if ((Object)(object)val == (Object)null)
{
val2 = new GameObject(childName);
((Object)val2).hideFlags = (HideFlags)61;
val2.transform.SetParent(((Component)this).transform, false);
val2.transform.localPosition = Vector3.zero;
val2.transform.localRotation = Quaternion.identity;
}
else
{
val2 = ((Component)val).gameObject;
}
LineRenderer val3 = val2.GetComponent<LineRenderer>() ?? val2.AddComponent<LineRenderer>();
val3.widthMultiplier = width;
((Renderer)val3).enabled = false;
val3.positionCount = 2;
val3.useWorldSpace = true;
((Renderer)val3).shadowCastingMode = (ShadowCastingMode)0;
((Renderer)val3).receiveShadows = false;
return val3;
}
private void OnDisable()
{
if (Object.op_Implicit((Object)(object)_scanLine))
{
((Renderer)_scanLine).enabled = false;
}
if (Object.op_Implicit((Object)(object)_laser))
{
((Renderer)_laser).enabled = false;
}
}
public override void Update()
{
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
((Trap)this).Update();
if (!_armed)
{
if ((Object)(object)base.physGrabObject != (Object)null && base.physGrabObject.grabbedLocal && (!ShopLatchPlugin.C_RequirePressE.Value || Input.GetKeyDown(ShopLatchPlugin.C_ActivateKey.Value)))
{
TryActivate();
}
return;
}
if (_droneActive && PhotonNetwork.InRoom && PhotonNetwork.IsConnectedAndReady && PhotonNetwork.IsMasterClient)
{
_poseSendTimer += Time.deltaTime;
if (_poseSendTimer >= 0.2f)
{
_poseSendTimer = 0f;
base.photonView.RPC("RPC_Pose", (RpcTarget)1, new object[2]
{
((Component)this).transform.position,
((Component)this).transform.rotation
});
}
}
if (_droneActive && !PhotonNetwork.IsMasterClient && _hasNetPose)
{
if (Vector3.Distance(((Component)this).transform.position, _netPos) > 5f)
{
((Component)this).transform.SetPositionAndRotation(_netPos, _netRot);
}
else
{
((Component)this).transform.position = Vector3.Lerp(((Component)this).transform.position, _netPos, Time.deltaTime * 10f);
((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, _netRot, Time.deltaTime * 10f);
}
}
UpdateScanVisuals(_droneActive && (Object)(object)_currentEnemy != (Object)null);
}
private void TryActivate()
{
if (_armed)
{
return;
}
if (ShopLatchPlugin.C_DroneEnable.Value)
{
if (Authority)
{
BeginActivationMaster();
}
else
{
base.photonView.RPC("RPC_RequestStartDrone", (RpcTarget)2, Array.Empty<object>());
}
return;
}
if (PhotonNetwork.IsMasterClient)
{
((MonoBehaviour)this).StartCoroutine(Server_ShopFlowAfter(0f));
return;
}
PhotonView photonView = base.photonView;
object[] array = new object[1];
PhysGrabObject physGrabObject = base.physGrabObject;
int? obj;
if (physGrabObject == null)
{
obj = null;
}
else
{
PlayerAvatar lastPlayerGrabbing = physGrabObject.lastPlayerGrabbing;
if (lastPlayerGrabbing == null)
{
obj = null;
}
else
{
PhotonView photonView2 = lastPlayerGrabbing.photonView;
obj = ((photonView2 != null) ? new int?(photonView2.ViewID) : null);
}
}
int? num = obj;
array[0] = num.GetValueOrDefault(-1);
photonView.RPC("RPC_RequestBeginShop", (RpcTarget)2, array);
}
private void BeginActivationMaster()
{
if (_armed)
{
return;
}
_armed = true;
if (!_startSfxSent)
{
_startSfxSent = true;
if (PhotonNetwork.InRoom)
{
base.photonView.RPC("RPC_PlayStartSfx", (RpcTarget)0, Array.Empty<object>());
}
else
{
RPC_PlayStartSfx();
}
}
((MonoBehaviour)this).StartCoroutine(Server_BeginDroneAfter(0f));
}
[PunRPC]
private void RPC_RequestStartDrone()
{
if (PhotonNetwork.IsMasterClient)
{
BeginActivationMaster();
}
}
[IteratorStateMachine(typeof(<Server_BeginDroneAfter>d__47))]
private IEnumerator Server_BeginDroneAfter(float delay)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Server_BeginDroneAfter>d__47(0)
{
<>4__this = this,
delay = delay
};
}
private void BeginDroneServerAuthoritative()
{
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: 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)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: 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)
//IL_00ae: 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_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)_rb))
{
_rb.velocity = Vector3.zero;
_rb.angularVelocity = Vector3.zero;
_rb.useGravity = false;
_rb.isKinematic = true;
}
((Behaviour)_agent).enabled = true;
_agent.speed = ShopLatchPlugin.C_DroneSpeed.Value;
_agent.angularSpeed = ShopLatchPlugin.C_DroneTurnSpeed.Value;
Vector3 position = ((Component)this).transform.position;
NavMeshHit val = default(NavMeshHit);
if (NavMesh.SamplePosition(position, ref val, 3f, -1))
{
_agent.Warp(((NavMeshHit)(ref val)).position);
((Component)this).transform.position = ((NavMeshHit)(ref val)).position;
}
else
{
_agent.Warp(((Component)this).transform.position);
}
ForceNextPatrolDestination();
_lastPos = ((Component)this).transform.position;
_droneActive = true;
_nextShootTime = Time.time + 0.25f;
}
private void DroneHostTick()
{
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
//IL_0410: Unknown result type (might be due to invalid IL or missing references)
//IL_0415: Unknown result type (might be due to invalid IL or missing references)
//IL_0253: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Unknown result type (might be due to invalid IL or missing references)
//IL_0275: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_027a: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_0312: Unknown result type (might be due to invalid IL or missing references)
//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_029e: Unknown result type (might be due to invalid IL or missing references)
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
//IL_02da: Unknown result type (might be due to invalid IL or missing references)
//IL_02df: Unknown result type (might be due to invalid IL or missing references)
//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0304: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)_agent) || !_agent.isOnNavMesh)
{
return;
}
if (Time.time >= _nextAcquireTime)
{
_nextAcquireTime = Time.time + 0.15f;
AcquireTarget();
}
if ((Object)(object)_currentEnemy != (Object)null)
{
_agent.autoBraking = true;
_agent.stoppingDistance = 0f;
_agent.obstacleAvoidanceType = (ObstacleAvoidanceType)0;
Vector3 val;
if (!Object.op_Implicit((Object)(object)_currentTargetCol))
{
val = ((Component)_currentEnemy).transform.position;
}
else
{
Bounds bounds = _currentTargetCol.bounds;
val = ((Bounds)(ref bounds)).center;
}
Vector3 val2 = val;
Vector3 val3 = val2 - ((Component)this).transform.position;
val3.y = 0f;
float magnitude = ((Vector3)(ref val3)).magnitude;
if (!_ramMode && magnitude <= 0.9f)
{
_ramMode = true;
}
else if (_ramMode && magnitude >= 1.4f)
{
_ramMode = false;
}
if (_ramMode)
{
if (magnitude > 0.001f)
{
Vector3 val4 = val3 / magnitude;
float num = _agent.speed * 1.35f;
Vector3 val5 = val4 * num * Time.deltaTime;
_agent.isStopped = true;
_agent.updatePosition = false;
_agent.updateRotation = false;
Transform transform = ((Component)this).transform;
transform.position += val5;
_agent.nextPosition = ((Component)this).transform.position;
Quaternion val6 = Quaternion.LookRotation(val4, Vector3.up);
((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, val6, ShopLatchPlugin.C_DroneTurnSpeed.Value * Time.deltaTime);
}
}
else
{
_agent.isStopped = false;
_agent.updatePosition = true;
_agent.updateRotation = true;
Vector3 val7 = val2 + ((((Vector3)(ref val3)).sqrMagnitude > 0.0004f) ? (((Vector3)(ref val3)).normalized * 0.35f) : Vector3.zero);
NavMeshHit val8 = default(NavMeshHit);
if (NavMesh.SamplePosition(val7, ref val8, 2f, -1))
{
_agent.SetDestination(((NavMeshHit)(ref val8)).position);
}
else
{
_agent.SetDestination(val7);
}
if (((Vector3)(ref val3)).sqrMagnitude > 0.01f)
{
Quaternion val9 = Quaternion.LookRotation(((Vector3)(ref val3)).normalized, Vector3.up);
((Component)this).transform.rotation = Quaternion.RotateTowards(((Component)this).transform.rotation, val9, ShopLatchPlugin.C_DroneTurnSpeed.Value * Time.deltaTime);
}
}
TryShootAt(val2);
return;
}
_agent.obstacleAvoidanceType = (ObstacleAvoidanceType)4;
_agent.autoBraking = false;
_ramMode = false;
_agent.isStopped = false;
_agent.updatePosition = true;
_agent.updateRotation = true;
if (_movingToPatrol)
{
if (!_agent.pathPending && _agent.remainingDistance <= 0.4f)
{
_movingToPatrol = false;
_agent.isStopped = true;
((MonoBehaviour)this).StartCoroutine(IdleAndContinue());
}
Vector3 val10 = ((Component)this).transform.position - _lastPos;
float sqrMagnitude = ((Vector3)(ref val10)).sqrMagnitude;
_stuckTimer = ((sqrMagnitude < 0.0004f) ? (_stuckTimer + Time.deltaTime) : 0f);
_lastPos = ((Component)this).transform.position;
if (_stuckTimer > 2f)
{
_stuckTimer = 0f;
ForceNextPatrolDestination();
}
}
else
{
_repathTimer -= Time.deltaTime;
if (_repathTimer <= 0f)
{
_repathTimer = 1.5f;
ForceNextPatrolDestination();
}
}
}
private void AcquireTarget()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Invalid comparison between Unknown and I4
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
_currentTargetCol = null;
_currentEnemy = null;
float value = ShopLatchPlugin.C_DroneScanRadius.Value;
int value2 = ShopLatchPlugin.C_DroneEnemyLayerMask.Value;
int num = Physics.OverlapSphereNonAlloc(((Component)this).transform.position, value, _overlapBuf, value2, (QueryTriggerInteraction)2);
if (num <= 0)
{
return;
}
List<(Collider, Enemy, float)> list = new List<(Collider, Enemy, float)>(8);
Bounds bounds;
for (int i = 0; i < num; i++)
{
Collider val = _overlapBuf[i];
if (Object.op_Implicit((Object)(object)val) && !((Object)(object)((Component)val).transform == (Object)(object)((Component)this).transform) && !((Object)(object)((Component)val).GetComponentInParent<PlayerAvatar>() != (Object)null))
{
EnemyRigidbody componentInParent = ((Component)val).GetComponentInParent<EnemyRigidbody>();
Enemy val2 = (Object.op_Implicit((Object)(object)componentInParent) ? componentInParent.enemy : ((Component)val).GetComponentInParent<Enemy>());
if (!((Object)(object)val2 == (Object)null) && val2.HasHealth && !((Object)(object)val2.Health == (Object)null))
{
Vector3 position = ((Component)this).transform.position;
bounds = val.bounds;
float item = Vector3.Distance(position, ((Bounds)(ref bounds)).center);
list.Add((val, val2, item));
}
}
}
if (list.Count == 0)
{
return;
}
list.Sort(((Collider col, Enemy enemy, float dist) a, (Collider col, Enemy enemy, float dist) b) => a.dist.CompareTo(b.dist));
int num2 = Mathf.Min(12, list.Count);
Collider currentTargetCol = null;
Enemy val3 = null;
float num3 = float.PositiveInfinity;
NavMeshHit val4 = default(NavMeshHit);
for (int j = 0; j < num2; j++)
{
(Collider, Enemy, float) tuple = list[j];
Collider item2 = tuple.Item1;
Enemy item3 = tuple.Item2;
bounds = item2.bounds;
Vector3 center = ((Bounds)(ref bounds)).center;
if (NavMesh.SamplePosition(center, ref val4, 2f, -1) && NavMesh.CalculatePath(((Component)this).transform.position, ((NavMeshHit)(ref val4)).position, -1, _reusablePath) && (int)_reusablePath.status <= 0)
{
float num4 = PathLength(_reusablePath);
if (num4 < num3)
{
num3 = num4;
currentTargetCol = item2;
val3 = item3;
}
}
}
if ((Object)(object)val3 == (Object)null)
{
currentTargetCol = list[0].Item1;
val3 = list[0].Item2;
}
_currentTargetCol = currentTargetCol;
_currentEnemy = val3;
}
private static float PathLength(NavMeshPath path)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
Vector3[] corners = path.corners;
if (corners == null || corners.Length < 2)
{
return float.PositiveInfinity;
}
float num = 0f;
for (int i = 1; i < corners.Length; i++)
{
num += Vector3.Distance(corners[i - 1], corners[i]);
}
return num;
}
private void UpdateScanVisuals(bool hasTarget)
{
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_scanLine == (Object)null)
{
return;
}
if (!_droneActive || !_armed || hasTarget)
{
if (((Renderer)_scanLine).enabled)
{
((Renderer)_scanLine).enabled = false;
}
return;
}
((Renderer)_scanLine).enabled = true;
_scanLine.widthMultiplier = 0.02f;
_scanAngleDeg += 160f * Time.deltaTime;
if (_scanAngleDeg > 360f)
{
_scanAngleDeg -= 360f;
}
_scanPulseT += 2.5f * Time.deltaTime;
float num = Mathf.PingPong(_scanPulseT, 1f);
float num2 = num * 8f;
Vector3 val = ((Component)this).transform.position + Vector3.up * 0.35f;
Vector3 val2 = Quaternion.Euler(0f, _scanAngleDeg, 0f) * ((Component)this).transform.forward;
Vector3 val3 = val + val2 * num2;
RaycastHit val4 = default(RaycastHit);
if (num2 > 0.05f && Physics.Raycast(val, val2, ref val4, num2, -1, (QueryTriggerInteraction)1))
{
val3 = ((RaycastHit)(ref val4)).point;
}
_scanLine.SetPosition(0, val);
_scanLine.SetPosition(1, val3);
}
[IteratorStateMachine(typeof(<IdleAndContinue>d__53))]
private IEnumerator IdleAndContinue()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <IdleAndContinue>d__53(0)
{
<>4__this = this
};
}
private void ForceNextPatrolDestination()
{
//IL_004b: 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_0065: 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_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: 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)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: 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_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
_agent.isStopped = false;
Transform val = ChooseNextLevelPoint();
Vector3 val2;
if ((Object)(object)val != (Object)null)
{
val2 = val.position;
NavMeshHit val3 = default(NavMeshHit);
if (NavMesh.SamplePosition(val2, ref val3, 3f, -1))
{
val2 = ((NavMeshHit)(ref val3)).position;
}
}
else
{
Vector3 val4 = Random.insideUnitSphere * ShopLatchPlugin.C_DronePatrolRadius.Value + ((Component)this).transform.position;
val4.y = ((Component)this).transform.position.y;
NavMeshHit val5 = default(NavMeshHit);
val2 = ((!NavMesh.SamplePosition(val4, ref val5, ShopLatchPlugin.C_DronePatrolRadius.Value, -1)) ? (((Component)this).transform.position + ((Component)this).transform.forward * 4f) : ((NavMeshHit)(ref val5)).position);
}
if (_agent.isOnNavMesh)
{
_agent.SetDestination(val2);
}
else
{
_agent.Warp(val2);
}
_movingToPatrol = true;
_lastPos = ((Component)this).transform.position;
_stuckTimer = 0f;
}
private Transform ChooseNextLevelPoint()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: 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_0075: 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_009b: Unknown result type (might be due to invalid IL or missing references)
if (_levelPoints == null || _levelPoints.Length == 0)
{
return null;
}
Vector3 position = ((Component)this).transform.position;
Transform val = null;
float num = float.NegativeInfinity;
for (int i = 0; i < _levelPoints.Length; i++)
{
Transform val2 = _levelPoints[i];
if ((Object)(object)val2 == (Object)null || ((Object)(object)_truckPoint != (Object)null && Vector3.Distance(val2.position, _truckPoint.position) <= 6f))
{
continue;
}
float num2 = Vector3.Distance(val2.position, position);
if (!(num2 <= 12f))
{
float num3 = num2;
if (num3 > num)
{
num = num3;
val = val2;
}
}
}
if ((Object)(object)val != (Object)null)
{
return val;
}
return _levelPoints[Random.Range(0, _levelPoints.Length)];
}
private void TryShootAt(Vector3 targetPos)
{
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: 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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: 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_0070: 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_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
float time = Time.time;
if (time < _nextShootTime)
{
return;
}
_nextShootTime = time + Mathf.Max(0.1f, ShopLatchPlugin.C_ProjInterval.Value);
Vector3 val = ((Component)this).transform.position + Vector3.up * 0.35f + ((Component)this).transform.forward * 0.45f;
Vector3 val2 = targetPos - val;
if (((Vector3)(ref val2)).sqrMagnitude < 1E-06f)
{
val2 = ((Component)this).transform.forward;
}
val2 = ((Vector3)(ref val2)).normalized;
if (Object.op_Implicit((Object)(object)_laser))
{
((Renderer)_laser).enabled = true;
_laser.SetPosition(0, val);
_laser.SetPosition(1, val + val2 * 0.65f);
((MonoBehaviour)this).StartCoroutine(DisableLaserNextFrame(_laser));
}
if (Object.op_Implicit((Object)(object)attackClip) && time >= _nextAttackSfxTime)
{
_nextAttackSfxTime = time + 0.2f;
if (PhotonNetwork.InRoom)
{
base.photonView.RPC("RPC_PlayAttackSfx", (RpcTarget)0, Array.Empty<object>());
}
else
{
RPC_PlayAttackSfx();
}
}
}
[IteratorStateMachine(typeof(<DisableLaserNextFrame>d__57))]
private static IEnumerator DisableLaserNextFrame(LineRenderer lr)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DisableLaserNextFrame>d__57(0)
{
lr = lr
};
}
[PunRPC]
private void RPC_Pose(Vector3 pos, Quaternion rot)
{
//IL_0002: 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_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
_netPos = pos;
_netRot = rot;
_hasNetPose = true;
}
[PunRPC]
private void RPC_PlayStartSfx()
{
if (Object.op_Implicit((Object)(object)_oneShot) && Object.op_Implicit((Object)(object)startClip))
{
_oneShot.volume = Mathf.Clamp01(ShopLatchPlugin.C_AudioStartVol.Value);
_oneShot.PlayOneShot(startClip);
}
}
[PunRPC]
private void RPC_StartIdleLoop()
{
if (Object.op_Implicit((Object)(object)_idle) && Object.op_Implicit((Object)(object)idleClip))
{
if ((Object)(object)_idle.clip != (Object)(object)idleClip)
{
_idle.clip = idleClip;
}
_idle.volume = Mathf.Clamp01(ShopLatchPlugin.C_AudioIdleVol.Value);
if (!_idle.isPlaying)
{
_idle.Play();
}
}
}
[PunRPC]
private void RPC_StopIdleLoop()
{
if (Object.op_Implicit((Object)(object)_idle) && _idle.isPlaying)
{
_idle.Stop();
}
}
[PunRPC]
private void RPC_PlayAttackSfx()
{
if (Object.op_Implicit((Object)(object)_oneShot) && Object.op_Implicit((Object)(object)attackClip))
{
_oneShot.volume = Mathf.Clamp01(ShopLatchPlugin.C_AudioAttackVol.Value);
_oneShot.PlayOneShot(attackClip);
}
}
[PunRPC]
private void RPC_BreakAndDie()
{
try
{
ParticleSystem componentInChildren = ((Component)this).GetComponentInChildren<ParticleSystem>();
if (Object.op_Implicit((Object)(object)componentInChildren))
{
componentInChildren.Play(true);
}
}
catch
{
}
Object.Destroy((Object)(object)((Component)this).gameObject);
}
[PunRPC]
private void RPC_RequestBeginShop(int playerViewId, PhotonMessageInfo _)
{
if (PhotonNetwork.IsMasterClient)
{
((MonoBehaviour)this).StartCoroutine(Server_ShopFlowAfter(0f, playerViewId));
}
}
[IteratorStateMachine(typeof(<Server_ShopFlowAfter>d__65))]
private IEnumerator Server_ShopFlowAfter(float afterSeconds, int playerViewIdHint = -1)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Server_ShopFlowAfter>d__65(0)
{
<>4__this = this,
afterSeconds = afterSeconds,
playerViewIdHint = playerViewIdHint
};
}
[PunRPC]
private void RPC_ClientEnterShop(float visitSeconds)
{
ShopLatchPlugin.Logger.LogInfo((object)$"Solo Shop visit start ({visitSeconds:0.0}s).");
ShopLatchPlugin.WithLocalSceneSwitchOverride(delegate
{
RunManager.instance.ChangeLevel(false, false, (ChangeLevelType)5);
});
}
[PunRPC]
private void RPC_ClientExitShop()
{
ShopLatchPlugin.Logger.LogInfo((object)"Solo Shop visit end → returning to run level.");
ShopLatchPlugin.WithLocalSceneSwitchOverride(delegate
{
RunManager.instance.ChangeLevel(false, false, (ChangeLevelType)1);
});
}
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
}
}
[HarmonyPatch(typeof(SemiFunc), "IsMasterClientOrSingleplayer")]
internal static class Patch_SemiFunc_IsMasterClientOrSingleplayer
{
[HarmonyPrefix]
private static bool Prefix(ref bool __result)
{
if (ShopLatchPlugin.LocalSceneSwitchOverride)
{
__result = true;
return false;
}
return true;
}
}
[HarmonyPatch(typeof(SemiFunc), "StatSetRunCurrency")]
internal static class Patch_SemiFunc_StatSetRunCurrency
{
[HarmonyPrefix]
private static bool Prefix(ref int __result, int value)
{
if (!PhotonNetwork.IsMasterClient)
{
return true;
}
if (ShopLatchPlugin.FreeShopActive)
{
int num = SemiFunc.StatGetRunCurrency();
if (value < num)
{
__result = num;
return false;
}
}
return true;
}
}
}