using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Agents;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using Enemies;
using GTFO.API;
using GameData;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using LevelGeneration;
using Microsoft.CodeAnalysis;
using SNetwork;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("ObserverClone")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ObserverClone")]
[assembly: AssemblyTitle("ObserverClone")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
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;
}
}
}
namespace ObserverClone
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("ObserverClone", "ObserverClone", "0.0.1")]
public class Plugin : BasePlugin
{
public static class ObserverClone
{
[CompilerGenerated]
private sealed class <Tagger>d__1 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public CarryItemPickup_Core observer;
private bool <pickedup>5__2;
private float <placedtime>5__3;
private float <pingtime>5__4;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Tagger>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Invalid comparison between Unknown and I4
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_0280: Expected O, but got Unknown
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: 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)
bool flag2;
switch (<>1__state)
{
default:
return false;
case 0:
{
<>1__state = -1;
<pickedup>5__2 = false;
<placedtime>5__3 = 0f;
<pingtime>5__4 = 0f;
ManualLogSource l = L;
if (l != null)
{
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(34, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("observer tagging running for item ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)observer).name);
}
l.LogInfo(val);
}
goto IL_0079;
}
case 1:
<>1__state = -1;
goto IL_0079;
case 2:
{
<>1__state = -1;
return false;
}
IL_0079:
flag2 = true;
if ((int)observer.PickupItemStatus == 1)
{
<pickedup>5__2 = true;
<placedtime>5__3 = 0f;
<pingtime>5__4 = 0f;
}
if (<pickedup>5__2 && (int)observer.PickupItemStatus == 0 && SNet.IsMaster)
{
if (<placedtime>5__3 > 0f && Clock.Time - <placedtime>5__3 < 3f)
{
flag2 = false;
}
if (<pingtime>5__4 > 0f && Clock.Time - <pingtime>5__4 < 3f)
{
flag2 = false;
}
if (<placedtime>5__3 == 0f)
{
<placedtime>5__3 = Clock.Time;
flag2 = false;
}
if (flag2)
{
if (<pingtime>5__4 == 0f)
{
<pingtime>5__4 = Clock.Time;
}
if (<pingtime>5__4 > 0f && Clock.Time - <pingtime>5__4 > 3f)
{
<pingtime>5__4 = Clock.Time;
}
Enumerator<LG_Zone> enumerator = Builder.CurrentFloor.allZones.GetEnumerator();
while (enumerator.MoveNext())
{
Enumerator<LG_Area> enumerator2 = enumerator.Current.m_areas.GetEnumerator();
while (enumerator2.MoveNext())
{
Enumerator<EnemyAgent> enumerator3 = enumerator2.Current.m_courseNode.m_enemiesInNode.GetEnumerator();
while (enumerator3.MoveNext())
{
EnemyAgent current = enumerator3.Current;
if (!(Vector3.Distance(((Component)observer).transform.position, current.Position) < 12f))
{
continue;
}
bool flag3 = true;
Enumerator<NavMarker> enumerator4 = GuiManager.NavMarkerLayer.m_markersActive.GetEnumerator();
while (enumerator4.MoveNext())
{
NavMarker current2 = enumerator4.Current;
if ((Object)(object)current2 != (Object)null && current2.m_hasTrackingTrans && (Object)(object)current2.m_trackingTrans == (Object)(object)((Agent)current).AimTargetBody)
{
flag3 = false;
}
}
if (flag3)
{
ToolSyncManager.WantToTagEnemy(current);
}
}
}
}
}
}
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
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();
}
}
public static void Initialize()
{
Il2CppArrayBase<CarryItemPickup_Core> componentsInChildren = ((Component)Builder.CurrentFloor).GetComponentsInChildren<CarryItemPickup_Core>();
if (componentsInChildren == null)
{
return;
}
foreach (CarryItemPickup_Core item in componentsInChildren)
{
if (((GameDataBlockBase<ItemDataBlock>)(object)((Item)item).ItemDataBlock).name.ToLower().Contains("observer"))
{
CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(Tagger(item)), (Action)null);
}
}
}
[IteratorStateMachine(typeof(<Tagger>d__1))]
public static IEnumerator Tagger(CarryItemPickup_Core observer)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Tagger>d__1(0)
{
observer = observer
};
}
}
internal static ManualLogSource? L;
public override void Load()
{
L = ((BasePlugin)this).Log;
EventAPI.OnExpeditionStarted += ObserverClone.Initialize;
}
}
[GeneratedCode("VersionInfoGenerator", "2.0.0+git50a4b1a-master")]
[CompilerGenerated]
internal static class VersionInfo
{
public const string RootNamespace = "ObserverClone";
public const string Version = "1.0.0";
public const string VersionPrerelease = null;
public const string VersionMetadata = null;
public const string SemVer = "1.0.0";
public const string GitRevShort = null;
public const string GitRevLong = null;
public const string GitBranch = null;
public const string GitTag = null;
public const bool GitIsDirty = false;
}
}