Decompiled source of PingOrdering v1.1.2

PingOrdering.dll

Decompiled 2 months ago
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.Configuration;
using EntityStates;
using EntityStates.AI;
using EntityStates.AI.Walker;
using IL.RoR2.UI;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Navigation;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

[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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("PingOrdering")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+dc3c63f8043ea2277dec5f28ddcc3914ebce0876")]
[assembly: AssemblyProduct("PingOrdering")]
[assembly: AssemblyTitle("PingOrdering")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace PingOrdering;

public class AwaitOrders : BaseAIState
{
	public enum Orders
	{
		None,
		Move,
		Attack,
		Assist
	}

	public Orders order;

	public Vector3? targetPosition;

	public GameObject target;

	public float sprintThreshold;

	public PingIndicator ping;

	public AwaitOrders(PingIndicator ing = null)
	{
		ping = ing;
	}

	public override void OnEnter()
	{
		//IL_00eb: 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_0105: 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_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_0193: Unknown result type (might be due to invalid IL or missing references)
		//IL_01da: Unknown result type (might be due to invalid IL or missing references)
		//IL_01df: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0200: Unknown result type (might be due to invalid IL or missing references)
		//IL_0205: Unknown result type (might be due to invalid IL or missing references)
		//IL_0271: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_034b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0370: Unknown result type (might be due to invalid IL or missing references)
		//IL_0375: Unknown result type (might be due to invalid IL or missing references)
		//IL_0379: Unknown result type (might be due to invalid IL or missing references)
		//IL_037e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0382: Unknown result type (might be due to invalid IL or missing references)
		//IL_038f: Unknown result type (might be due to invalid IL or missing references)
		//IL_039c: Unknown result type (might be due to invalid IL or missing references)
		((BaseAIState)this).OnEnter();
		if (!Object.op_Implicit((Object)(object)((BaseAIState)this).ai) || !Object.op_Implicit((Object)(object)((BaseAIState)this).body))
		{
			((EntityState)this).outer.SetNextStateToMain();
			AIOrdersPlugin.subordinateDict[((BaseAIState)this).characterMaster.minionOwnership.ownerMaster].Remove(this);
			return;
		}
		if (!Object.op_Implicit((Object)(object)ping))
		{
			ping = Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("Prefabs/PingIndicator")).GetComponent<PingIndicator>();
			PingIndicator obj = ping;
			MinionOwnership minionOwnership = ((BaseAIState)this).characterMaster.minionOwnership;
			object pingOwner;
			if (minionOwnership == null)
			{
				pingOwner = null;
			}
			else
			{
				CharacterMaster ownerMaster = minionOwnership.ownerMaster;
				pingOwner = ((ownerMaster != null) ? ((Component)ownerMaster).gameObject : null);
			}
			obj.pingOwner = (GameObject)pingOwner;
			PingIndicator obj2 = ping;
			CharacterBody body = ((BaseAIState)this).body;
			Vector3? obj3;
			if (body == null)
			{
				obj3 = null;
			}
			else
			{
				Transform transform = body.transform;
				obj3 = ((transform != null) ? new Vector3?(transform.position) : null);
			}
			obj2.pingOrigin = (Vector3)(((??)obj3) ?? ((EntityState)this).transform.position);
			ping.pingNormal = Vector3.zero;
			ping.pingTarget = ((Component)((BaseAIState)this).body).gameObject;
			((Component)ping).transform.position = ((BaseAIState)this).body.transform.position;
			ping.positionIndicator.targetTransform = ((BaseAIState)this).body.transform;
			ping.positionIndicator.defaultPosition = ((BaseAIState)this).body.transform.position;
			ping.targetTransformToFollow = ((BaseAIState)this).body.coreTransform;
			ping.pingDuration = float.PositiveInfinity;
			ping.fixedTimer = float.PositiveInfinity;
			ping.pingColor = Color.cyan;
			((Graphic)ping.pingText).color = ping.textBaseColor * ping.pingColor;
			TextMeshPro pingText = ping.pingText;
			MinionOwnership minionOwnership2 = ((BaseAIState)this).characterMaster.minionOwnership;
			((TMP_Text)pingText).text = Util.GetBestMasterName((minionOwnership2 != null) ? minionOwnership2.ownerMaster : null);
			((Behaviour)ping.pingObjectScaleCurve).enabled = false;
			((Behaviour)ping.pingObjectScaleCurve).enabled = true;
			ping.pingHighlight.highlightColor = (HighlightColor)451;
			Highlight pingHighlight = ping.pingHighlight;
			ModelLocator modelLocator = ((BaseAIState)this).body.modelLocator;
			object targetRenderer;
			if (modelLocator == null)
			{
				targetRenderer = null;
			}
			else
			{
				Transform modelTransform = modelLocator.modelTransform;
				targetRenderer = ((modelTransform == null) ? null : ((Component)modelTransform).GetComponentInChildren<CharacterModel>()?.baseRendererInfos?.First((RendererInfo r) => !r.ignoreOverlays).renderer);
			}
			pingHighlight.targetRenderer = (Renderer)targetRenderer;
			ping.pingHighlight.strength = 1f;
			ping.pingHighlight.isOn = true;
			GameObject[] enemyPingGameObjects = ping.enemyPingGameObjects;
			foreach (GameObject val in enemyPingGameObjects)
			{
				val.SetActive(true);
				SpriteRenderer component = val.GetComponent<SpriteRenderer>();
				if (Object.op_Implicit((Object)(object)component))
				{
					component.color = Color.cyan;
				}
				ParticleSystem component2 = val.GetComponent<ParticleSystem>();
				if (Object.op_Implicit((Object)(object)component2))
				{
					MainModule main = component2.main;
					MinMaxGradient startColor = ((MainModule)(ref main)).startColor;
					((MinMaxGradient)(ref startColor)).colorMax = Color.cyan;
					((MinMaxGradient)(ref startColor)).colorMin = Color.cyan;
					((MinMaxGradient)(ref startColor)).color = Color.cyan;
				}
			}
		}
		AISkillDriver? obj4 = ((IEnumerable<AISkillDriver>)((BaseAIState)this).ai.skillDrivers).FirstOrDefault((Func<AISkillDriver, bool>)((AISkillDriver drive) => drive.shouldSprint));
		sprintThreshold = ((obj4 != null) ? obj4.minDistanceSqr : float.PositiveInfinity);
	}

	public override void FixedUpdate()
	{
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ef: Expected O, but got Unknown
		//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_02db: Expected O, but got Unknown
		//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_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_017a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_0199: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b3: 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_0200: Unknown result type (might be due to invalid IL or missing references)
		//IL_020b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0216: Unknown result type (might be due to invalid IL or missing references)
		//IL_021b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: Unknown result type (might be due to invalid IL or missing references)
		((BaseAIState)this).FixedUpdate();
		if (!Object.op_Implicit((Object)(object)((BaseAIState)this).ai))
		{
			((EntityState)this).outer.SetNextStateToMain();
			AIOrdersPlugin.subordinateDict[((BaseAIState)this).characterMaster.minionOwnership.ownerMaster].Remove(this);
			return;
		}
		if (!Object.op_Implicit((Object)(object)target) && !targetPosition.HasValue)
		{
			((BaseAIState)this).AimAt(ref base.bodyInputs, ((BaseAIState)this).ai.leader);
		}
		switch (order)
		{
		case Orders.None:
			break;
		case Orders.Attack:
			((BaseAIState)this).ai.currentEnemy.gameObject = target;
			((BaseAIState)this).ai.enemyAttention = ((BaseAIState)this).ai.enemyAttentionDuration;
			((EntityState)this).outer.SetNextState((EntityState)new Combat());
			break;
		case Orders.Move:
		{
			if (!Object.op_Implicit((Object)(object)((BaseAIState)this).body) || ((BaseAIState)this).body.moveSpeed == 0f)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
			Agent broadNavigationAgent = ((BaseAIState)this).ai.broadNavigationAgent;
			((Agent)(ref broadNavigationAgent)).currentPosition = ((BaseAIState)this).ai.body.footPosition;
			((BaseAIState)this).ai.SetGoalPosition(targetPosition);
			LocalNavigator localNavigator = ((BaseAIState)this).ai.localNavigator;
			AgentOutput output = ((Agent)(ref broadNavigationAgent)).output;
			localNavigator.targetPosition = (Vector3)(((??)((AgentOutput)(ref output)).nextPosition) ?? ((BaseAIState)this).ai.localNavigator.targetPosition);
			output = ((Agent)(ref broadNavigationAgent)).output;
			if (!((AgentOutput)(ref output)).targetReachable)
			{
				((Agent)(ref broadNavigationAgent)).InvalidatePath();
			}
			((BaseAIState)this).ai.localNavigator.Update(BaseAIState.cvAIUpdateInterval.value);
			base.bodyInputs.moveVector = ((BaseAIState)this).ai.localNavigator.moveVector;
			Vector3 val = ((BaseAIState)this).body.footPosition - targetPosition.Value;
			float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude;
			base.bodyInputs.pressSprint = sqrMagnitude > sprintThreshold;
			if (((BaseAIState)this).ai.localNavigator.wasObstructedLastUpdate)
			{
				((BaseAIState)this).ModifyInputsForJumpIfNeccessary(ref base.bodyInputs);
			}
			float num = ((BaseAIState)this).body.radius * ((BaseAIState)this).body.radius * 4f;
			if (sqrMagnitude < num)
			{
				((EntityState)this).outer.SetNextStateToMain();
			}
			break;
		}
		case Orders.Assist:
			((BaseAIState)this).ai.buddy.gameObject = target;
			((BaseAIState)this).ai.customTarget.gameObject = target;
			((EntityState)this).outer.SetNextState((EntityState)new Combat());
			break;
		}
	}

	public override void OnExit()
	{
		((BaseAIState)this).OnExit();
		if (Object.op_Implicit((Object)(object)ping))
		{
			ping.fixedTimer = 0f;
		}
	}

	public void SubmitOrder(Orders command, GameObject target, Vector3? targetPosition = null)
	{
		//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)
		order = command;
		this.target = target;
		this.targetPosition = targetPosition;
		if (targetPosition.HasValue)
		{
			Agent broadNavigationAgent = ((BaseAIState)this).ai.broadNavigationAgent;
			((Agent)(ref broadNavigationAgent)).goalPosition = targetPosition;
			((Agent)(ref broadNavigationAgent)).InvalidatePath();
		}
	}
}
[BepInPlugin("xyz.yekoc.PingOrdering", "Ping Ordering", "1.1.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class AIOrdersPlugin : BaseUnityPlugin
{
	[Serializable]
	[CompilerGenerated]
	private sealed class <>c
	{
		public static readonly <>c <>9 = new <>c();

		public static hook_Update <>9__2_0;

		public static Func<Instruction, bool> <>9__2_4;

		public static Func<Instruction, bool> <>9__2_5;

		public static Func<PingIndicator, bool> <>9__2_6;

		public static Func<Instruction, bool> <>9__2_7;

		public static Func<Instruction, bool> <>9__2_8;

		public static Func<PingIndicator, bool> <>9__2_9;

		public static Manipulator <>9__2_1;

		public static hook_GetColor <>9__2_2;

		internal void <Awake>b__2_0(orig_Update orig, PlayerCharacterMasterController self)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			KeyboardShortcut value = attentionButton.Value;
			if (!((KeyboardShortcut)(ref value)).IsPressed() || !self.hasEffectiveAuthority)
			{
				return;
			}
			MinionGroup val = MinionGroup.FindGroup(((NetworkBehaviour)self.master).netId);
			if (val == null)
			{
				return;
			}
			MinionOwnership[] members = val.members;
			foreach (MinionOwnership val2 in members)
			{
				if (!Object.op_Implicit((Object)(object)((val2 != null) ? ((Component)val2).gameObject : null)))
				{
					continue;
				}
				AwaitOrders awaitOrders = new AwaitOrders();
				if (!subordinateDict.ContainsKey(self.master))
				{
					subordinateDict.Add(self.master, new List<AwaitOrders>());
				}
				subordinateDict[self.master].Add(awaitOrders);
				if (val2 == null)
				{
					continue;
				}
				GameObject gameObject = ((Component)val2).gameObject;
				if (gameObject != null)
				{
					EntityStateMachine component = gameObject.GetComponent<EntityStateMachine>();
					if (component != null)
					{
						component.SetState((EntityState)(object)awaitOrders);
					}
				}
			}
		}

		internal void <Awake>b__2_1(ILContext il)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			ILCursor val = new ILCursor(il);
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "PLAYER_PING_ENEMY")
			});
			val.Index += 6;
			ILLabel val2 = val.MarkLabel();
			val.GotoPrev(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "PLAYER_PING_ENEMY")
			});
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<PingIndicator, bool>>((Func<PingIndicator, bool>)delegate(PingIndicator self)
			{
				//IL_006c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0072: Unknown result type (might be due to invalid IL or missing references)
				//IL_0175: Unknown result type (might be due to invalid IL or missing references)
				//IL_017a: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
				<>c__DisplayClass2_0 <>c__DisplayClass2_ = new <>c__DisplayClass2_0
				{
					self = self
				};
				CharacterMaster component2 = <>c__DisplayClass2_.self.pingOwner.GetComponent<CharacterMaster>();
				CharacterMaster master = <>c__DisplayClass2_.self.pingTarget.GetComponent<CharacterBody>().master;
				if (subordinateDict.ContainsKey(component2) && subordinateDict[component2].Any())
				{
					<>c__DisplayClass2_1 CS$<>8__locals1 = new <>c__DisplayClass2_1
					{
						CS$<>8__locals1 = <>c__DisplayClass2_,
						flag = TeamManager.IsTeamEnemy(component2.teamIndex, master.teamIndex)
					};
					subordinateDict[component2].ForEach(delegate(AwaitOrders m)
					{
						m.SubmitOrder(CS$<>8__locals1.flag ? AwaitOrders.Orders.Attack : AwaitOrders.Orders.Assist, CS$<>8__locals1.CS$<>8__locals1.self.pingTarget);
					});
					subordinateDict.Remove(component2);
					CS$<>8__locals1.CS$<>8__locals1.self.pingDuration = 1f;
					return true;
				}
				BaseAI component3 = ((Component)master).GetComponent<BaseAI>();
				object obj;
				if (component3 == null)
				{
					obj = null;
				}
				else
				{
					CharacterBody characterBody = component3.leader.characterBody;
					obj = ((characterBody != null) ? characterBody.master : null);
				}
				if ((Object)obj == (Object)(object)component2)
				{
					<>c__DisplayClass2_.self.pingOwner.GetComponent<PingerController>().pingIndicator = null;
					PingerController component4 = <>c__DisplayClass2_.self.pingOwner.GetComponent<PingerController>();
					component4.pingStock++;
					subordinateDict.Add(component2, new List<AwaitOrders>
					{
						new AwaitOrders(<>c__DisplayClass2_.self)
					});
					((Component)master).GetComponent<EntityStateMachine>().SetState((EntityState)(object)subordinateDict[component2][0]);
					<>c__DisplayClass2_.self.pingColor = Color.cyan;
					<>c__DisplayClass2_.self.pingDuration = float.PositiveInfinity;
					<>c__DisplayClass2_.self.enemyPingGameObjects[0].GetComponent<SpriteRenderer>().color = Color.cyan;
					<>c__DisplayClass2_.self.pingHighlight.highlightColor = (HighlightColor)451;
					return true;
				}
				return false;
			});
			val.Emit(OpCodes.Brtrue, (object)val2);
			val.Index = 0;
			val.GotoNext(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "PLAYER_PING_DEFAULT")
			});
			val.Index += 5;
			val2 = val.MarkLabel();
			val.GotoPrev(new Func<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "PLAYER_PING_DEFAULT")
			});
			val.Emit(OpCodes.Ldarg_0);
			val.EmitDelegate<Func<PingIndicator, bool>>((Func<PingIndicator, bool>)delegate(PingIndicator self)
			{
				<>c__DisplayClass2_2 CS$<>8__locals0 = new <>c__DisplayClass2_2
				{
					self = self
				};
				CharacterMaster component = CS$<>8__locals0.self.pingOwner.GetComponent<CharacterMaster>();
				if (subordinateDict.ContainsKey(component))
				{
					subordinateDict[component].ForEach(delegate(AwaitOrders m)
					{
						//IL_0009: Unknown result type (might be due to invalid IL or missing references)
						m.SubmitOrder(AwaitOrders.Orders.Move, null, CS$<>8__locals0.self.pingOrigin);
					});
					subordinateDict.Remove(component);
					CS$<>8__locals0.self.pingDuration = 1f;
					return true;
				}
				return false;
			});
			val.Emit(OpCodes.Brtrue, (object)val2);
		}

		internal bool <Awake>b__2_4(Instruction x)
		{
			return ILPatternMatchingExt.MatchLdstr(x, "PLAYER_PING_ENEMY");
		}

		internal bool <Awake>b__2_5(Instruction x)
		{
			return ILPatternMatchingExt.MatchLdstr(x, "PLAYER_PING_ENEMY");
		}

		internal bool <Awake>b__2_6(PingIndicator self)
		{
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			<>c__DisplayClass2_0 <>c__DisplayClass2_ = new <>c__DisplayClass2_0
			{
				self = self
			};
			CharacterMaster component = <>c__DisplayClass2_.self.pingOwner.GetComponent<CharacterMaster>();
			CharacterMaster master = <>c__DisplayClass2_.self.pingTarget.GetComponent<CharacterBody>().master;
			if (subordinateDict.ContainsKey(component) && subordinateDict[component].Any())
			{
				<>c__DisplayClass2_1 CS$<>8__locals0 = new <>c__DisplayClass2_1
				{
					CS$<>8__locals1 = <>c__DisplayClass2_,
					flag = TeamManager.IsTeamEnemy(component.teamIndex, master.teamIndex)
				};
				subordinateDict[component].ForEach(delegate(AwaitOrders m)
				{
					m.SubmitOrder(CS$<>8__locals0.flag ? AwaitOrders.Orders.Attack : AwaitOrders.Orders.Assist, CS$<>8__locals0.CS$<>8__locals1.self.pingTarget);
				});
				subordinateDict.Remove(component);
				CS$<>8__locals0.CS$<>8__locals1.self.pingDuration = 1f;
				return true;
			}
			BaseAI component2 = ((Component)master).GetComponent<BaseAI>();
			object obj;
			if (component2 == null)
			{
				obj = null;
			}
			else
			{
				CharacterBody characterBody = component2.leader.characterBody;
				obj = ((characterBody != null) ? characterBody.master : null);
			}
			if ((Object)obj == (Object)(object)component)
			{
				<>c__DisplayClass2_.self.pingOwner.GetComponent<PingerController>().pingIndicator = null;
				PingerController component3 = <>c__DisplayClass2_.self.pingOwner.GetComponent<PingerController>();
				component3.pingStock++;
				subordinateDict.Add(component, new List<AwaitOrders>
				{
					new AwaitOrders(<>c__DisplayClass2_.self)
				});
				((Component)master).GetComponent<EntityStateMachine>().SetState((EntityState)(object)subordinateDict[component][0]);
				<>c__DisplayClass2_.self.pingColor = Color.cyan;
				<>c__DisplayClass2_.self.pingDuration = float.PositiveInfinity;
				<>c__DisplayClass2_.self.enemyPingGameObjects[0].GetComponent<SpriteRenderer>().color = Color.cyan;
				<>c__DisplayClass2_.self.pingHighlight.highlightColor = (HighlightColor)451;
				return true;
			}
			return false;
		}

		internal bool <Awake>b__2_7(Instruction x)
		{
			return ILPatternMatchingExt.MatchLdstr(x, "PLAYER_PING_DEFAULT");
		}

		internal bool <Awake>b__2_8(Instruction x)
		{
			return ILPatternMatchingExt.MatchLdstr(x, "PLAYER_PING_DEFAULT");
		}

		internal bool <Awake>b__2_9(PingIndicator self)
		{
			<>c__DisplayClass2_2 CS$<>8__locals0 = new <>c__DisplayClass2_2
			{
				self = self
			};
			CharacterMaster component = CS$<>8__locals0.self.pingOwner.GetComponent<CharacterMaster>();
			if (subordinateDict.ContainsKey(component))
			{
				subordinateDict[component].ForEach(delegate(AwaitOrders m)
				{
					//IL_0009: Unknown result type (might be due to invalid IL or missing references)
					m.SubmitOrder(AwaitOrders.Orders.Move, null, CS$<>8__locals0.self.pingOrigin);
				});
				subordinateDict.Remove(component);
				CS$<>8__locals0.self.pingDuration = 1f;
				return true;
			}
			return false;
		}

		internal Color <Awake>b__2_2(orig_GetColor orig, Highlight self)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: 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)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Invalid comparison between Unknown and I4
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: 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_0049: 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)
			Color val = orig.Invoke(self);
			if (val == Color.magenta && (int)self.highlightColor == 451)
			{
				return Color.cyan + new Color(0.01f, 0f, 0f);
			}
			return val;
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass2_0
	{
		public PingIndicator self;
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass2_1
	{
		public bool flag;

		public <>c__DisplayClass2_0 CS$<>8__locals1;

		internal void <Awake>b__10(AwaitOrders m)
		{
			m.SubmitOrder(flag ? AwaitOrders.Orders.Attack : AwaitOrders.Orders.Assist, CS$<>8__locals1.self.pingTarget);
		}
	}

	[CompilerGenerated]
	private sealed class <>c__DisplayClass2_2
	{
		public PingIndicator self;

		internal void <Awake>b__11(AwaitOrders m)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			m.SubmitOrder(AwaitOrders.Orders.Move, null, self.pingOrigin);
		}
	}

	public static Dictionary<CharacterMaster, List<AwaitOrders>> subordinateDict = new Dictionary<CharacterMaster, List<AwaitOrders>>();

	public static ConfigEntry<KeyboardShortcut> attentionButton;

	private void Awake()
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: 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)
		//IL_0067: Expected O, but got Unknown
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Expected O, but got Unknown
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Expected O, but got Unknown
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b1: Expected O, but got Unknown
		attentionButton = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Controls", "Order All", new KeyboardShortcut((KeyCode)102, Array.Empty<KeyCode>()), "Calls the attention of all subordiantes.");
		if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"))
		{
			RoOptionize();
		}
		object obj = <>c.<>9__2_0;
		if (obj == null)
		{
			hook_Update val = delegate(orig_Update orig, PlayerCharacterMasterController self)
			{
				//IL_000e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_0034: Unknown result type (might be due to invalid IL or missing references)
				orig.Invoke(self);
				KeyboardShortcut value = attentionButton.Value;
				if (((KeyboardShortcut)(ref value)).IsPressed() && self.hasEffectiveAuthority)
				{
					MinionGroup val8 = MinionGroup.FindGroup(((NetworkBehaviour)self.master).netId);
					if (val8 != null)
					{
						MinionOwnership[] members = val8.members;
						foreach (MinionOwnership val9 in members)
						{
							if (Object.op_Implicit((Object)(object)((val9 != null) ? ((Component)val9).gameObject : null)))
							{
								AwaitOrders awaitOrders = new AwaitOrders();
								if (!subordinateDict.ContainsKey(self.master))
								{
									subordinateDict.Add(self.master, new List<AwaitOrders>());
								}
								subordinateDict[self.master].Add(awaitOrders);
								if (val9 != null)
								{
									GameObject gameObject = ((Component)val9).gameObject;
									if (gameObject != null)
									{
										EntityStateMachine component5 = gameObject.GetComponent<EntityStateMachine>();
										if (component5 != null)
										{
											component5.SetState((EntityState)(object)awaitOrders);
										}
									}
								}
							}
						}
					}
				}
			};
			<>c.<>9__2_0 = val;
			obj = (object)val;
		}
		PlayerCharacterMasterController.Update += (hook_Update)obj;
		object obj2 = <>c.<>9__2_1;
		if (obj2 == null)
		{
			Manipulator val2 = delegate(ILContext il)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_0138: Unknown result type (might be due to invalid IL or missing references)
				//IL_016a: Unknown result type (might be due to invalid IL or missing references)
				ILCursor val6 = new ILCursor(il);
				val6.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "PLAYER_PING_ENEMY")
				});
				val6.Index += 6;
				ILLabel val7 = val6.MarkLabel();
				val6.GotoPrev(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "PLAYER_PING_ENEMY")
				});
				val6.Emit(OpCodes.Ldarg_0);
				val6.EmitDelegate<Func<PingIndicator, bool>>((Func<PingIndicator, bool>)delegate(PingIndicator self)
				{
					//IL_006c: Unknown result type (might be due to invalid IL or missing references)
					//IL_0072: Unknown result type (might be due to invalid IL or missing references)
					//IL_0175: Unknown result type (might be due to invalid IL or missing references)
					//IL_017a: Unknown result type (might be due to invalid IL or missing references)
					//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
					//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
					CharacterMaster component2 = self.pingOwner.GetComponent<CharacterMaster>();
					CharacterMaster master = self.pingTarget.GetComponent<CharacterBody>().master;
					if (subordinateDict.ContainsKey(component2) && subordinateDict[component2].Any())
					{
						bool flag = TeamManager.IsTeamEnemy(component2.teamIndex, master.teamIndex);
						subordinateDict[component2].ForEach(delegate(AwaitOrders m)
						{
							m.SubmitOrder(flag ? AwaitOrders.Orders.Attack : AwaitOrders.Orders.Assist, self.pingTarget);
						});
						subordinateDict.Remove(component2);
						self.pingDuration = 1f;
						return true;
					}
					BaseAI component3 = ((Component)master).GetComponent<BaseAI>();
					object obj4;
					if (component3 == null)
					{
						obj4 = null;
					}
					else
					{
						CharacterBody characterBody = component3.leader.characterBody;
						obj4 = ((characterBody != null) ? characterBody.master : null);
					}
					if ((Object)obj4 == (Object)(object)component2)
					{
						self.pingOwner.GetComponent<PingerController>().pingIndicator = null;
						PingerController component4 = self.pingOwner.GetComponent<PingerController>();
						component4.pingStock++;
						subordinateDict.Add(component2, new List<AwaitOrders>
						{
							new AwaitOrders(self)
						});
						((Component)master).GetComponent<EntityStateMachine>().SetState((EntityState)(object)subordinateDict[component2][0]);
						self.pingColor = Color.cyan;
						self.pingDuration = float.PositiveInfinity;
						self.enemyPingGameObjects[0].GetComponent<SpriteRenderer>().color = Color.cyan;
						self.pingHighlight.highlightColor = (HighlightColor)451;
						return true;
					}
					return false;
				});
				val6.Emit(OpCodes.Brtrue, (object)val7);
				val6.Index = 0;
				val6.GotoNext(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "PLAYER_PING_DEFAULT")
				});
				val6.Index += 5;
				val7 = val6.MarkLabel();
				val6.GotoPrev(new Func<Instruction, bool>[1]
				{
					(Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "PLAYER_PING_DEFAULT")
				});
				val6.Emit(OpCodes.Ldarg_0);
				val6.EmitDelegate<Func<PingIndicator, bool>>((Func<PingIndicator, bool>)delegate(PingIndicator self)
				{
					CharacterMaster component = self.pingOwner.GetComponent<CharacterMaster>();
					if (subordinateDict.ContainsKey(component))
					{
						subordinateDict[component].ForEach(delegate(AwaitOrders m)
						{
							//IL_0009: Unknown result type (might be due to invalid IL or missing references)
							m.SubmitOrder(AwaitOrders.Orders.Move, null, self.pingOrigin);
						});
						subordinateDict.Remove(component);
						self.pingDuration = 1f;
						return true;
					}
					return false;
				});
				val6.Emit(OpCodes.Brtrue, (object)val7);
			};
			<>c.<>9__2_1 = val2;
			obj2 = (object)val2;
		}
		PingIndicator.RebuildPing += (Manipulator)obj2;
		object obj3 = <>c.<>9__2_2;
		if (obj3 == null)
		{
			hook_GetColor val3 = delegate(orig_GetColor orig, Highlight self)
			{
				//IL_0003: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: 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)
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0021: Invalid comparison between Unknown and I4
				//IL_004c: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: 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_0049: 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)
				Color val5 = orig.Invoke(self);
				return (val5 == Color.magenta && (int)self.highlightColor == 451) ? (Color.cyan + new Color(0.01f, 0f, 0f)) : val5;
			};
			<>c.<>9__2_2 = val3;
			obj3 = (object)val3;
		}
		Highlight.GetColor += (hook_GetColor)obj3;
		ContentManager.collectContentPackProviders += (CollectContentPackProvidersDelegate)delegate(AddContentPackProviderDelegate del)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			SimpleContentPackProvider val4 = new SimpleContentPackProvider();
			val4.identifier = "PingOrdering";
			val4.generateContentPackAsyncImplementation = (GenerateContentPackAsyncDelegate)Delegate.Combine((Delegate?)(object)val4.generateContentPackAsyncImplementation, (Delegate?)new GenerateContentPackAsyncDelegate(whycantthisbealambda));
			val4.finalizeAsyncImplementation = (FinalizeAsyncDelegate)Delegate.Combine((Delegate?)(object)val4.finalizeAsyncImplementation, (Delegate?)new FinalizeAsyncDelegate(rapidclapping));
			val4.loadStaticContentImplementation = (LoadStaticContentAsyncDelegate)Delegate.Combine((Delegate?)(object)val4.loadStaticContentImplementation, (Delegate?)new LoadStaticContentAsyncDelegate(wow));
			del.Invoke((IContentPackProvider)(object)val4);
		};
	}

	private IEnumerator whycantthisbealambda(GetContentPackAsyncArgs args)
	{
		args.output.entityStateTypes.Add(new Type[1] { typeof(AwaitOrders) });
		args.ReportProgress(1f);
		yield break;
	}

	private IEnumerator wow(LoadStaticContentAsyncArgs args)
	{
		args.ReportProgress(1f);
		yield break;
	}

	private IEnumerator rapidclapping(FinalizeAsyncArgs args)
	{
		args.ReportProgress(1f);
		yield break;
	}

	private void OnDestroy()
	{
	}

	[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
	private void RoOptionize()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Expected O, but got Unknown
		ModSettingsManager.AddOption((BaseOption)new KeyBindOption(attentionButton));
	}
}