using System;
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 Microsoft.CodeAnalysis;
using On.RoR2;
using RoR2;
using UnityEngine;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TeamSelecter")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TeamSelecter")]
[assembly: AssemblyTitle("TeamSelecter")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace TeamSelecter
{
[BepInPlugin("BTP.TeamSelecter", "TeamSelecter", "1.0.0")]
public class TeamSelecter : BaseUnityPlugin
{
public const string PluginGUID = "BTP.TeamSelecter";
public const string PluginAuthor = "BTP";
public const string PluginName = "TeamSelecter";
public const string PluginVersion = "1.0.0";
public void Awake()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
Console.RunCmd += new hook_RunCmd(Console_RunCmd);
GenericPickupController.OnInteractionBegin += new hook_OnInteractionBegin(GenericPickupController_OnInteractionBegin);
TeamComponent.SetupIndicator += new hook_SetupIndicator(TeamComponent_SetupIndicator);
}
private void TeamComponent_SetupIndicator(orig_SetupIndicator orig, TeamComponent self)
{
if (Object.op_Implicit((Object)(object)self.body) && !self.body.isPlayerControlled)
{
orig.Invoke(self);
}
}
private void GenericPickupController_OnInteractionBegin(orig_OnInteractionBegin orig, GenericPickupController self, Interactor activator)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: 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_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: 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_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
CharacterBody val = default(CharacterBody);
if (!((Component)activator).TryGetComponent<CharacterBody>(ref val) || !val.isPlayerControlled)
{
return;
}
PickupDef pickupDef = PickupCatalog.GetPickupDef(self.pickupIndex);
if (pickupDef != null)
{
GrantContext val2 = default(GrantContext);
val2.body = val;
val2.controller = self;
GrantContext val3 = val2;
AttemptGrantDelegate attemptGrant = pickupDef.attemptGrant;
if (attemptGrant != null)
{
attemptGrant.Invoke(ref val3);
}
self.consumed = val3.shouldDestroy;
if (val3.shouldNotify)
{
GenericPickupController.SendPickupMessage(val.master, pickupDef.pickupIndex);
}
if (Object.op_Implicit((Object)(object)self.chestGeneratedFrom) && DelusionChestController.isDelusionEnable)
{
self.chestGeneratedFrom.CallRpcSetDelusionPickupIndex(self.pickupIndex);
}
if (val3.shouldDestroy)
{
Object.Destroy((Object)(object)((Component)self).gameObject);
}
}
}
private void Console_RunCmd(orig_RunCmd orig, Console self, CmdSender sender, string concommandName, List<string> userArgs)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: 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_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Invalid comparison between Unknown and I4
//IL_00b9: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: 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_00c1: 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)
orig.Invoke(self, sender, concommandName, userArgs);
if (!NetworkServer.active || !Object.op_Implicit((Object)(object)Run.instance) || !concommandName.Equals("say", StringComparison.InvariantCultureIgnoreCase))
{
return;
}
string text = userArgs.FirstOrDefault();
if (string.IsNullOrWhiteSpace(text) || !text.StartsWith("/"))
{
return;
}
string[] array = text.Split(' ');
if (array.Length == 2 && array[0].Equals("/join", StringComparison.InvariantCultureIgnoreCase))
{
TeamIndex val = (TeamIndex)(array[1] switch
{
"Player" => 1,
"Monster" => 2,
"Lunar" => 3,
"Void" => 4,
_ => -1,
});
if ((int)val != -1)
{
CharacterMaster cachedValue = sender.networkUser.cachedMaster.cachedValue;
cachedValue.teamIndex = val;
cachedValue.GetBody().teamComponent.teamIndex = val;
}
}
}
}
}