Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of R2API Teams v1.0.2
plugins/R2API.Teams/R2API.Teams.dll
Decompiled 3 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HG; using HarmonyLib; using IL.EntityStates.GrandParentBoss; using IL.EntityStates.VultureHunter.Weapon; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using MonoMod.Utils; using On.RoR2; using R2API.AutoVersionGen; using R2API.Utils; 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("R2API.Teams")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2+72fb4acded8caa7a86ab495cc2762c4ae961b47b")] [assembly: AssemblyProduct("R2API.Teams")] [assembly: AssemblyTitle("R2API.Teams")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.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 System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] [DebuggerNonUserCode] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } } namespace R2API { internal static class Log { private static ManualLogSource _logSource; public static void Init(ManualLogSource logSource) { _logSource = logSource; } [MethodImpl(MethodImplOptions.AggressiveInlining)] [Conditional("DEBUG")] public static void Debug(object data) { _logSource.LogDebug(data); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Info(object data) { _logSource.LogInfo(data); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Message(object data) { _logSource.LogMessage(data); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Warning(object data) { _logSource.LogWarning(data); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Error(object data) { _logSource.LogError(data); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void Fatal(object data) { _logSource.LogFatal(data); } } [AutoVersion] public static class TeamsAPI { private class TeamManagerModdedTeamsHelper : MonoBehaviour { public byte[] ModdedTeamsDirtyBits; internal void SetDirtyBit(int moddedTeamIndex) { CompressedFlagArrayUtilities.AddImmutable(ref ModdedTeamsDirtyBits, moddedTeamIndex); } internal void ClearDirtyBits() { ModdedTeamsDirtyBits = null; } } public class TeamBehavior { public string Name { get; } public TeamClassification Classification { get; } public virtual LayerIndex TeamLayer { get { //IL_0010: 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) if ((Classification & TeamClassification.Player) == 0) { return LayerIndex.enemyBody; } return LayerIndex.playerBody; } } public virtual LayerIndex TeamFakeLayer { get { //IL_0010: 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) if ((Classification & TeamClassification.Player) == 0) { return LayerIndex.fakeActor; } return LayerIndex.playerFakeActor; } } public virtual bool CanPickup => Classification == TeamClassification.Player; public TeamBehavior(string name, TeamClassification teamClassification) { if (string.IsNullOrWhiteSpace(name)) { throw new ArgumentException("'name' cannot be null or whitespace.", "name"); } Name = name; Classification = teamClassification; } } [Flags] public enum TeamClassification { None = 0, Neutral = 1, Enemy = 2, Player = 4 } [CompilerGenerated] private static class <>O { public static Manipulator <0>__ReplaceTeamIndexCount; public static hook_Start <1>__TeamManager_Start; public static Manipulator <2>__TeamManager_SetTeamExperience; public static hook_OnSerialize <3>__TeamManager_OnSerialize; public static hook_OnDeserialize <4>__TeamManager_OnDeserialize; public static hook_GetAppropriateLayerForTeam <5>__LayerIndex_GetAppropriateLayerForTeam; public static hook_GetAppropriateFakeLayerForTeam <6>__LayerIndex_GetAppropriateFakeLayerForTeam; public static hook_HasTeam <7>__TeamMask_HasTeam; public static hook_AddTeam <8>__TeamMask_AddTeam; public static hook_RemoveTeam <9>__TeamMask_RemoveTeam; public static Manipulator <10>__GenericPickupController_AttemptGrant; public static Manipulator <11>__ReplaceTeamArraySize; public static Func<TeamIndex, bool> <12>__IsValidTeam; public static Func<TeamIndex, TeamIndex> <13>__getPretendTeamForPickup; public static Func<TeamIndex, bool> <14>__IsModdedTeam; public static Action<TeamManager, TeamIndex> <15>__setModdedTeamDirtyBit; } [CompilerGenerated] private sealed class <TeamsEnumerator>d__39 : IEnumerable<TeamIndex>, IEnumerable, IEnumerator<TeamIndex>, IEnumerator, IDisposable { private int <>1__state; private TeamIndex <>2__current; private int <>l__initialThreadId; private int <i>5__2; TeamIndex IEnumerator<TeamIndex>.Current { [DebuggerHidden] get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return <>2__current; } } [DebuggerHidden] public <TeamsEnumerator>d__39(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <i>5__2 = 0; break; case 1: <>1__state = -1; <i>5__2++; break; } if (<i>5__2 < TeamCount) { <>2__current = (TeamIndex)(sbyte)<i>5__2; <>1__state = 1; return true; } 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(); } [DebuggerHidden] IEnumerator<TeamIndex> IEnumerable<TeamIndex>.GetEnumerator() { if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; return this; } return new <TeamsEnumerator>d__39(0); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<TeamIndex>)this).GetEnumerator(); } } public const string PluginGUID = "com.bepis.r2api.teams"; public const string PluginName = "R2API.Teams"; private static readonly int _vanillaTeamsCount = TeamCatalog.teamDefs.Length; private static readonly int _allVanillaTeamsDirtyBits = (1 << _vanillaTeamsCount) - 1; private static byte[] _allModdedTeamsDirtyBits = Array.Empty<byte>(); private static TeamBehavior[] _moddedTeamBehaviors = new TeamBehavior[4]; private static EnumValueHandle _teamCountHandle; private static bool _hooksEnabled; private static readonly List<IDetour> _hookInstances = new List<IDetour>(); public const string PluginVersion = "1.0.2"; public static int TeamCountLimit => 126; public static int TeamCount => TeamCatalog.teamDefs.Length; public static int ModdedTeamCountLimit => TeamCountLimit - _vanillaTeamsCount; public static int ModdedTeamCount => Math.Max(0, TeamCount - _vanillaTeamsCount); internal static void Init() { _ = TeamCatalog.teamDefs; } internal static void SetHooks() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00b8: 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_00c3: Expected O, but got Unknown //IL_00d8: 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_00e3: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //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) //IL_0163: Expected O, but got Unknown //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Expected O, but got Unknown //IL_01d8: 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_01e3: Expected O, but got Unknown //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Expected O, but got Unknown //IL_0218: 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: Expected O, but got Unknown //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Expected O, but got Unknown //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Expected O, but got Unknown //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Expected O, but got Unknown //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Expected O, but got Unknown //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Expected O, but got Unknown //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Expected O, but got Unknown //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Expected O, but got Unknown //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Expected O, but got Unknown //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Expected O, but got Unknown //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Expected O, but got Unknown //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Expected O, but got Unknown //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Expected O, but got Unknown //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Expected O, but got Unknown //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Expected O, but got Unknown //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Expected O, but got Unknown //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Expected O, but got Unknown //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Expected O, but got Unknown //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Expected O, but got Unknown //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Expected O, but got Unknown //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Expected O, but got Unknown //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Expected O, but got Unknown //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_0537: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Expected O, but got Unknown //IL_058f: Unknown result type (might be due to invalid IL or missing references) //IL_0599: Expected O, but got Unknown //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_0589: Unknown result type (might be due to invalid IL or missing references) //IL_058f: Expected O, but got Unknown //IL_05e4: Unknown result type (might be due to invalid IL or missing references) //IL_05ee: Expected O, but got Unknown //IL_05d9: Unknown result type (might be due to invalid IL or missing references) //IL_05de: Unknown result type (might be due to invalid IL or missing references) //IL_05e4: Expected O, but got Unknown //IL_0610: Unknown result type (might be due to invalid IL or missing references) //IL_061a: Expected O, but got Unknown //IL_0605: Unknown result type (might be due to invalid IL or missing references) //IL_060a: Unknown result type (might be due to invalid IL or missing references) //IL_0610: Expected O, but got Unknown //IL_0684: Unknown result type (might be due to invalid IL or missing references) //IL_068e: Expected O, but got Unknown //IL_0679: Unknown result type (might be due to invalid IL or missing references) //IL_067e: Unknown result type (might be due to invalid IL or missing references) //IL_0684: Expected O, but got Unknown //IL_06b0: Unknown result type (might be due to invalid IL or missing references) //IL_06ba: Expected O, but got Unknown //IL_06a5: Unknown result type (might be due to invalid IL or missing references) //IL_06aa: Unknown result type (might be due to invalid IL or missing references) //IL_06b0: Expected O, but got Unknown if (_hooksEnabled) { return; } object obj = <>O.<0>__ReplaceTeamIndexCount; if (obj == null) { Manipulator val = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val; obj = (object)val; } Offspring.FindTargetFarthest += (Manipulator)obj; object obj2 = <>O.<0>__ReplaceTeamIndexCount; if (obj2 == null) { Manipulator val2 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val2; obj2 = (object)val2; } Calldown.Call += (Manipulator)obj2; object obj3 = <>O.<0>__ReplaceTeamIndexCount; if (obj3 == null) { Manipulator val3 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val3; obj3 = (object)val3; } AffixBeadAttachment.ClearEnemyLunarRuinDamage += (Manipulator)obj3; object obj4 = <>O.<0>__ReplaceTeamIndexCount; if (obj4 == null) { Manipulator val4 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val4; obj4 = (object)val4; } BuffWard.FixedUpdate += (Manipulator)obj4; object obj5 = <>O.<0>__ReplaceTeamIndexCount; if (obj5 == null) { Manipulator val5 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val5; obj5 = (object)val5; } FogDamageController.MyFixedUpdate += (Manipulator)obj5; object obj6 = <>O.<0>__ReplaceTeamIndexCount; if (obj6 == null) { Manipulator val6 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val6; obj6 = (object)val6; } GhostGunController.FindTarget += (Manipulator)obj6; object obj7 = <>O.<0>__ReplaceTeamIndexCount; if (obj7 == null) { Manipulator val7 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val7; obj7 = (object)val7; } GoldTitanManager.CalcTitanPowerAndBestTeam += (Manipulator)obj7; object obj8 = <>O.<0>__ReplaceTeamIndexCount; if (obj8 == null) { Manipulator val8 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val8; obj8 = (object)val8; } HoldoutZoneController.UpdateHealingNovas += (Manipulator)obj8; object obj9 = <>O.<0>__ReplaceTeamIndexCount; if (obj9 == null) { Manipulator val9 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val9; obj9 = (object)val9; } SharedSufferingManager.AreAnyPoolsDirty += (Manipulator)obj9; object obj10 = <>O.<0>__ReplaceTeamIndexCount; if (obj10 == null) { Manipulator val10 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val10; obj10 = (object)val10; } SharedSufferingManager.CleanAllDirtyPools += (Manipulator)obj10; object obj11 = <>O.<0>__ReplaceTeamIndexCount; if (obj11 == null) { Manipulator val11 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val11; obj11 = (object)val11; } SharedSufferingManager.DealDamage += (Manipulator)obj11; object obj12 = <>O.<0>__ReplaceTeamIndexCount; if (obj12 == null) { Manipulator val12 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val12; obj12 = (object)val12; } SharedSufferingManager.HandleSharedSufferingPooledDamageMessage += (Manipulator)obj12; object obj13 = <>O.<0>__ReplaceTeamIndexCount; if (obj13 == null) { Manipulator val13 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val13; obj13 = (object)val13; } SharedSufferingManager.ResetDamagePools += (Manipulator)obj13; object obj14 = <>O.<0>__ReplaceTeamIndexCount; if (obj14 == null) { Manipulator val14 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val14; obj14 = (object)val14; } SharedSufferingPooledDamageMessage.Serialize += (Manipulator)obj14; object obj15 = <>O.<0>__ReplaceTeamIndexCount; if (obj15 == null) { Manipulator val15 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val15; obj15 = (object)val15; } TargetNearbyHealthComponents.SearchForTargets += (Manipulator)obj15; object obj16 = <>O.<0>__ReplaceTeamIndexCount; if (obj16 == null) { Manipulator val16 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val16; obj16 = (object)val16; } TeamComponent.TeamIsValid += (Manipulator)obj16; object obj17 = <>O.<0>__ReplaceTeamIndexCount; if (obj17 == null) { Manipulator val17 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val17; obj17 = (object)val17; } TeamManager.GetTeamCurrentLevelExperience += (Manipulator)obj17; object obj18 = <>O.<0>__ReplaceTeamIndexCount; if (obj18 == null) { Manipulator val18 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val18; obj18 = (object)val18; } TeamManager.GetTeamExperience += (Manipulator)obj18; object obj19 = <>O.<0>__ReplaceTeamIndexCount; if (obj19 == null) { Manipulator val19 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val19; obj19 = (object)val19; } TeamManager.GetTeamLevel += (Manipulator)obj19; object obj20 = <>O.<0>__ReplaceTeamIndexCount; if (obj20 == null) { Manipulator val20 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val20; obj20 = (object)val20; } TeamManager.GetTeamNextLevelExperience += (Manipulator)obj20; object obj21 = <>O.<0>__ReplaceTeamIndexCount; if (obj21 == null) { Manipulator val21 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val21; obj21 = (object)val21; } TeamManager.GiveTeamItem += (Manipulator)obj21; object obj22 = <>O.<0>__ReplaceTeamIndexCount; if (obj22 == null) { Manipulator val22 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val22; obj22 = (object)val22; } TeamManager.GiveTeamMoney_TeamIndex_int += (Manipulator)obj22; object obj23 = <>O.<0>__ReplaceTeamIndexCount; if (obj23 == null) { Manipulator val23 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val23; obj23 = (object)val23; } TeamManager.SetTeamLevel += (Manipulator)obj23; object obj24 = <>O.<0>__ReplaceTeamIndexCount; if (obj24 == null) { Manipulator val24 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val24; obj24 = (object)val24; } TeamManager.Start += (Manipulator)obj24; object obj25 = <>O.<0>__ReplaceTeamIndexCount; if (obj25 == null) { Manipulator val25 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val25; obj25 = (object)val25; } Util.GetEnemyEasyTarget += (Manipulator)obj25; object obj26 = <>O.<1>__TeamManager_Start; if (obj26 == null) { hook_Start val26 = TeamManager_Start; <>O.<1>__TeamManager_Start = val26; obj26 = (object)val26; } TeamManager.Start += (hook_Start)obj26; object obj27 = <>O.<2>__TeamManager_SetTeamExperience; if (obj27 == null) { Manipulator val27 = TeamManager_SetTeamExperience; <>O.<2>__TeamManager_SetTeamExperience = val27; obj27 = (object)val27; } TeamManager.SetTeamExperience += (Manipulator)obj27; object obj28 = <>O.<3>__TeamManager_OnSerialize; if (obj28 == null) { hook_OnSerialize val28 = TeamManager_OnSerialize; <>O.<3>__TeamManager_OnSerialize = val28; obj28 = (object)val28; } TeamManager.OnSerialize += (hook_OnSerialize)obj28; object obj29 = <>O.<4>__TeamManager_OnDeserialize; if (obj29 == null) { hook_OnDeserialize val29 = TeamManager_OnDeserialize; <>O.<4>__TeamManager_OnDeserialize = val29; obj29 = (object)val29; } TeamManager.OnDeserialize += (hook_OnDeserialize)obj29; object obj30 = <>O.<5>__LayerIndex_GetAppropriateLayerForTeam; if (obj30 == null) { hook_GetAppropriateLayerForTeam val30 = LayerIndex_GetAppropriateLayerForTeam; <>O.<5>__LayerIndex_GetAppropriateLayerForTeam = val30; obj30 = (object)val30; } LayerIndex.GetAppropriateLayerForTeam += (hook_GetAppropriateLayerForTeam)obj30; object obj31 = <>O.<6>__LayerIndex_GetAppropriateFakeLayerForTeam; if (obj31 == null) { hook_GetAppropriateFakeLayerForTeam val31 = LayerIndex_GetAppropriateFakeLayerForTeam; <>O.<6>__LayerIndex_GetAppropriateFakeLayerForTeam = val31; obj31 = (object)val31; } LayerIndex.GetAppropriateFakeLayerForTeam += (hook_GetAppropriateFakeLayerForTeam)obj31; object obj32 = <>O.<7>__TeamMask_HasTeam; if (obj32 == null) { hook_HasTeam val32 = TeamMask_HasTeam; <>O.<7>__TeamMask_HasTeam = val32; obj32 = (object)val32; } TeamMask.HasTeam += (hook_HasTeam)obj32; object obj33 = <>O.<8>__TeamMask_AddTeam; if (obj33 == null) { hook_AddTeam val33 = TeamMask_AddTeam; <>O.<8>__TeamMask_AddTeam = val33; obj33 = (object)val33; } TeamMask.AddTeam += (hook_AddTeam)obj33; object obj34 = <>O.<9>__TeamMask_RemoveTeam; if (obj34 == null) { hook_RemoveTeam val34 = TeamMask_RemoveTeam; <>O.<9>__TeamMask_RemoveTeam = val34; obj34 = (object)val34; } TeamMask.RemoveTeam += (hook_RemoveTeam)obj34; object obj35 = <>O.<10>__GenericPickupController_AttemptGrant; if (obj35 == null) { Manipulator val35 = GenericPickupController_AttemptGrant; <>O.<10>__GenericPickupController_AttemptGrant = val35; obj35 = (object)val35; } GenericPickupController.AttemptGrant += (Manipulator)obj35; MethodInfo methodInfo = null; MethodInfo methodInfo2 = SymbolExtensions.GetMethodInfo<FogDamageController>((Expression<Action<FogDamageController>>)((FogDamageController _) => _.GetAffectedBodies())); if (methodInfo2 != null) { methodInfo = AccessTools.EnumeratorMoveNext((MethodBase)methodInfo2); } if (methodInfo != null) { List<IDetour> hookInstances = _hookInstances; MethodInfo methodInfo3 = methodInfo; object obj36 = <>O.<0>__ReplaceTeamIndexCount; if (obj36 == null) { Manipulator val36 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val36; obj36 = (object)val36; } hookInstances.Add((IDetour)new ILHook((MethodBase)methodInfo3, (Manipulator)obj36)); } else { Log.Error("Failed to find FogDamageController.GetAffectedBodies enumerator MoveNext method for patches"); } ConstructorInfo constructorInfo = AccessTools.DeclaredConstructor(typeof(HoldoutZoneController), (Type[])null, false); if (constructorInfo != null) { List<IDetour> hookInstances2 = _hookInstances; object obj37 = <>O.<11>__ReplaceTeamArraySize; if (obj37 == null) { Manipulator val37 = ReplaceTeamArraySize; <>O.<11>__ReplaceTeamArraySize = val37; obj37 = (object)val37; } hookInstances2.Add((IDetour)new ILHook((MethodBase)constructorInfo, (Manipulator)obj37)); } else { Log.Error("Failed to find HoldoutZoneController constructor for patches"); } ConstructorInfo constructorInfo2 = AccessTools.DeclaredConstructor(typeof(TeamManager), (Type[])null, false); if (constructorInfo2 != null) { List<IDetour> hookInstances3 = _hookInstances; object obj38 = <>O.<11>__ReplaceTeamArraySize; if (obj38 == null) { Manipulator val38 = ReplaceTeamArraySize; <>O.<11>__ReplaceTeamArraySize = val38; obj38 = (object)val38; } hookInstances3.Add((IDetour)new ILHook((MethodBase)constructorInfo2, (Manipulator)obj38)); } else { Log.Error("Failed to find TeamManager constructor for patches"); } ConstructorInfo constructorInfo3 = AccessTools.DeclaredConstructor(typeof(SharedSufferingManager), (Type[])null, false); if (constructorInfo3 != null) { List<IDetour> hookInstances4 = _hookInstances; object obj39 = <>O.<0>__ReplaceTeamIndexCount; if (obj39 == null) { Manipulator val39 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val39; obj39 = (object)val39; } hookInstances4.Add((IDetour)new ILHook((MethodBase)constructorInfo3, (Manipulator)obj39)); List<IDetour> hookInstances5 = _hookInstances; object obj40 = <>O.<11>__ReplaceTeamArraySize; if (obj40 == null) { Manipulator val40 = ReplaceTeamArraySize; <>O.<11>__ReplaceTeamArraySize = val40; obj40 = (object)val40; } hookInstances5.Add((IDetour)new ILHook((MethodBase)constructorInfo3, (Manipulator)obj40)); } else { Log.Error("Failed to find SharedSufferingManager constructor for patches"); } List<ConstructorInfo> declaredConstructors = AccessTools.GetDeclaredConstructors(typeof(SharedSufferingPooledDamageMessage), (bool?)null); if (declaredConstructors.Count > 0) { foreach (ConstructorInfo item in declaredConstructors) { List<IDetour> hookInstances6 = _hookInstances; object obj41 = <>O.<0>__ReplaceTeamIndexCount; if (obj41 == null) { Manipulator val41 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val41; obj41 = (object)val41; } hookInstances6.Add((IDetour)new ILHook((MethodBase)item, (Manipulator)obj41)); List<IDetour> hookInstances7 = _hookInstances; object obj42 = <>O.<11>__ReplaceTeamArraySize; if (obj42 == null) { Manipulator val42 = ReplaceTeamArraySize; <>O.<11>__ReplaceTeamArraySize = val42; obj42 = (object)val42; } hookInstances7.Add((IDetour)new ILHook((MethodBase)item, (Manipulator)obj42)); } } else { Log.Error("Failed to find SharedSufferingManager.SharedSufferingPooledDamageMessage constructor for patches"); } _hooksEnabled = true; } internal static void UnsetHooks() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00b8: 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_00c3: Expected O, but got Unknown //IL_00d8: 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_00e3: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //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) //IL_0163: Expected O, but got Unknown //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Expected O, but got Unknown //IL_01d8: 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_01e3: Expected O, but got Unknown //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Expected O, but got Unknown //IL_0218: 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: Expected O, but got Unknown //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Expected O, but got Unknown //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Expected O, but got Unknown //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Expected O, but got Unknown //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Expected O, but got Unknown //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Expected O, but got Unknown //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Expected O, but got Unknown //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Expected O, but got Unknown //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Expected O, but got Unknown //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Expected O, but got Unknown //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Expected O, but got Unknown //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Expected O, but got Unknown //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Expected O, but got Unknown //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Expected O, but got Unknown //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Expected O, but got Unknown //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Expected O, but got Unknown //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Expected O, but got Unknown //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Expected O, but got Unknown //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Expected O, but got Unknown //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Expected O, but got Unknown //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Expected O, but got Unknown if (!_hooksEnabled) { return; } object obj = <>O.<0>__ReplaceTeamIndexCount; if (obj == null) { Manipulator val = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val; obj = (object)val; } Offspring.FindTargetFarthest -= (Manipulator)obj; object obj2 = <>O.<0>__ReplaceTeamIndexCount; if (obj2 == null) { Manipulator val2 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val2; obj2 = (object)val2; } Calldown.Call -= (Manipulator)obj2; object obj3 = <>O.<0>__ReplaceTeamIndexCount; if (obj3 == null) { Manipulator val3 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val3; obj3 = (object)val3; } AffixBeadAttachment.ClearEnemyLunarRuinDamage -= (Manipulator)obj3; object obj4 = <>O.<0>__ReplaceTeamIndexCount; if (obj4 == null) { Manipulator val4 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val4; obj4 = (object)val4; } BuffWard.FixedUpdate -= (Manipulator)obj4; object obj5 = <>O.<0>__ReplaceTeamIndexCount; if (obj5 == null) { Manipulator val5 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val5; obj5 = (object)val5; } FogDamageController.MyFixedUpdate -= (Manipulator)obj5; object obj6 = <>O.<0>__ReplaceTeamIndexCount; if (obj6 == null) { Manipulator val6 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val6; obj6 = (object)val6; } GhostGunController.FindTarget -= (Manipulator)obj6; object obj7 = <>O.<0>__ReplaceTeamIndexCount; if (obj7 == null) { Manipulator val7 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val7; obj7 = (object)val7; } GoldTitanManager.CalcTitanPowerAndBestTeam -= (Manipulator)obj7; object obj8 = <>O.<0>__ReplaceTeamIndexCount; if (obj8 == null) { Manipulator val8 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val8; obj8 = (object)val8; } HoldoutZoneController.UpdateHealingNovas -= (Manipulator)obj8; object obj9 = <>O.<0>__ReplaceTeamIndexCount; if (obj9 == null) { Manipulator val9 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val9; obj9 = (object)val9; } SharedSufferingManager.AreAnyPoolsDirty -= (Manipulator)obj9; object obj10 = <>O.<0>__ReplaceTeamIndexCount; if (obj10 == null) { Manipulator val10 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val10; obj10 = (object)val10; } SharedSufferingManager.CleanAllDirtyPools -= (Manipulator)obj10; object obj11 = <>O.<0>__ReplaceTeamIndexCount; if (obj11 == null) { Manipulator val11 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val11; obj11 = (object)val11; } SharedSufferingManager.DealDamage -= (Manipulator)obj11; object obj12 = <>O.<0>__ReplaceTeamIndexCount; if (obj12 == null) { Manipulator val12 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val12; obj12 = (object)val12; } SharedSufferingManager.HandleSharedSufferingPooledDamageMessage -= (Manipulator)obj12; object obj13 = <>O.<0>__ReplaceTeamIndexCount; if (obj13 == null) { Manipulator val13 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val13; obj13 = (object)val13; } SharedSufferingManager.ResetDamagePools -= (Manipulator)obj13; object obj14 = <>O.<0>__ReplaceTeamIndexCount; if (obj14 == null) { Manipulator val14 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val14; obj14 = (object)val14; } SharedSufferingPooledDamageMessage.Serialize -= (Manipulator)obj14; object obj15 = <>O.<0>__ReplaceTeamIndexCount; if (obj15 == null) { Manipulator val15 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val15; obj15 = (object)val15; } TargetNearbyHealthComponents.SearchForTargets -= (Manipulator)obj15; object obj16 = <>O.<0>__ReplaceTeamIndexCount; if (obj16 == null) { Manipulator val16 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val16; obj16 = (object)val16; } TeamComponent.TeamIsValid -= (Manipulator)obj16; object obj17 = <>O.<0>__ReplaceTeamIndexCount; if (obj17 == null) { Manipulator val17 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val17; obj17 = (object)val17; } TeamManager.GetTeamCurrentLevelExperience -= (Manipulator)obj17; object obj18 = <>O.<0>__ReplaceTeamIndexCount; if (obj18 == null) { Manipulator val18 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val18; obj18 = (object)val18; } TeamManager.GetTeamExperience -= (Manipulator)obj18; object obj19 = <>O.<0>__ReplaceTeamIndexCount; if (obj19 == null) { Manipulator val19 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val19; obj19 = (object)val19; } TeamManager.GetTeamLevel -= (Manipulator)obj19; object obj20 = <>O.<0>__ReplaceTeamIndexCount; if (obj20 == null) { Manipulator val20 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val20; obj20 = (object)val20; } TeamManager.GetTeamNextLevelExperience -= (Manipulator)obj20; object obj21 = <>O.<0>__ReplaceTeamIndexCount; if (obj21 == null) { Manipulator val21 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val21; obj21 = (object)val21; } TeamManager.GiveTeamItem -= (Manipulator)obj21; object obj22 = <>O.<0>__ReplaceTeamIndexCount; if (obj22 == null) { Manipulator val22 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val22; obj22 = (object)val22; } TeamManager.GiveTeamMoney_TeamIndex_int -= (Manipulator)obj22; object obj23 = <>O.<0>__ReplaceTeamIndexCount; if (obj23 == null) { Manipulator val23 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val23; obj23 = (object)val23; } TeamManager.OnDeserialize -= (Manipulator)obj23; object obj24 = <>O.<0>__ReplaceTeamIndexCount; if (obj24 == null) { Manipulator val24 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val24; obj24 = (object)val24; } TeamManager.OnSerialize -= (Manipulator)obj24; object obj25 = <>O.<0>__ReplaceTeamIndexCount; if (obj25 == null) { Manipulator val25 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val25; obj25 = (object)val25; } TeamManager.SetTeamLevel -= (Manipulator)obj25; object obj26 = <>O.<0>__ReplaceTeamIndexCount; if (obj26 == null) { Manipulator val26 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val26; obj26 = (object)val26; } TeamManager.Start -= (Manipulator)obj26; object obj27 = <>O.<0>__ReplaceTeamIndexCount; if (obj27 == null) { Manipulator val27 = ReplaceTeamIndexCount; <>O.<0>__ReplaceTeamIndexCount = val27; obj27 = (object)val27; } Util.GetEnemyEasyTarget -= (Manipulator)obj27; object obj28 = <>O.<1>__TeamManager_Start; if (obj28 == null) { hook_Start val28 = TeamManager_Start; <>O.<1>__TeamManager_Start = val28; obj28 = (object)val28; } TeamManager.Start -= (hook_Start)obj28; object obj29 = <>O.<2>__TeamManager_SetTeamExperience; if (obj29 == null) { Manipulator val29 = TeamManager_SetTeamExperience; <>O.<2>__TeamManager_SetTeamExperience = val29; obj29 = (object)val29; } TeamManager.SetTeamExperience -= (Manipulator)obj29; object obj30 = <>O.<3>__TeamManager_OnSerialize; if (obj30 == null) { hook_OnSerialize val30 = TeamManager_OnSerialize; <>O.<3>__TeamManager_OnSerialize = val30; obj30 = (object)val30; } TeamManager.OnSerialize -= (hook_OnSerialize)obj30; object obj31 = <>O.<4>__TeamManager_OnDeserialize; if (obj31 == null) { hook_OnDeserialize val31 = TeamManager_OnDeserialize; <>O.<4>__TeamManager_OnDeserialize = val31; obj31 = (object)val31; } TeamManager.OnDeserialize -= (hook_OnDeserialize)obj31; object obj32 = <>O.<5>__LayerIndex_GetAppropriateLayerForTeam; if (obj32 == null) { hook_GetAppropriateLayerForTeam val32 = LayerIndex_GetAppropriateLayerForTeam; <>O.<5>__LayerIndex_GetAppropriateLayerForTeam = val32; obj32 = (object)val32; } LayerIndex.GetAppropriateLayerForTeam -= (hook_GetAppropriateLayerForTeam)obj32; object obj33 = <>O.<6>__LayerIndex_GetAppropriateFakeLayerForTeam; if (obj33 == null) { hook_GetAppropriateFakeLayerForTeam val33 = LayerIndex_GetAppropriateFakeLayerForTeam; <>O.<6>__LayerIndex_GetAppropriateFakeLayerForTeam = val33; obj33 = (object)val33; } LayerIndex.GetAppropriateFakeLayerForTeam -= (hook_GetAppropriateFakeLayerForTeam)obj33; object obj34 = <>O.<7>__TeamMask_HasTeam; if (obj34 == null) { hook_HasTeam val34 = TeamMask_HasTeam; <>O.<7>__TeamMask_HasTeam = val34; obj34 = (object)val34; } TeamMask.HasTeam -= (hook_HasTeam)obj34; object obj35 = <>O.<8>__TeamMask_AddTeam; if (obj35 == null) { hook_AddTeam val35 = TeamMask_AddTeam; <>O.<8>__TeamMask_AddTeam = val35; obj35 = (object)val35; } TeamMask.AddTeam -= (hook_AddTeam)obj35; object obj36 = <>O.<9>__TeamMask_RemoveTeam; if (obj36 == null) { hook_RemoveTeam val36 = TeamMask_RemoveTeam; <>O.<9>__TeamMask_RemoveTeam = val36; obj36 = (object)val36; } TeamMask.RemoveTeam -= (hook_RemoveTeam)obj36; object obj37 = <>O.<10>__GenericPickupController_AttemptGrant; if (obj37 == null) { Manipulator val37 = GenericPickupController_AttemptGrant; <>O.<10>__GenericPickupController_AttemptGrant = val37; obj37 = (object)val37; } GenericPickupController.AttemptGrant -= (Manipulator)obj37; foreach (IDetour hookInstance in _hookInstances) { ((IDisposable)hookInstance)?.Dispose(); } _hookInstances.Clear(); _hooksEnabled = false; } private static void ReplaceTeamArraySize(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0038: 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) ILCursor val = new ILCursor(il); MethodInfo methodInfo = AccessTools.PropertyGetter(typeof(TeamsAPI), "TeamCount"); int num = 0; TypeReference val2 = default(TypeReference); while (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, _vanillaTeamsCount), (Instruction x) => ILPatternMatchingExt.MatchNewarr(x, ref val2) })) { int index = val.Index; val.Index = index + 1; val.MoveAfterLabels(); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Call, (MethodBase)methodInfo); num++; } if (num == 0) { Log.Error("Failed to find any TeamIndex.Count array size patch locations for " + ((MemberReference)il.Method).FullName); } } private static void ReplaceTeamIndexCount(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int num = 0; ILLabel val2 = default(ILLabel); while (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, _vanillaTeamsCount), (Instruction x) => matchCompareOrBranch(x) })) { Instruction next = val.Next.Next; val.EmitDelegate<Func<TeamIndex, bool>>((Func<TeamIndex, bool>)IsValidTeam); OpCode opCode = next.OpCode; if ((int)((OpCode)(ref opCode)).FlowControl == 3) { bool flag = ILPatternMatchingExt.MatchBlt(next, ref val2) || ILPatternMatchingExt.MatchBltUn(next, ref val2) || ILPatternMatchingExt.MatchBneUn(next, ref val2); val.Emit(flag ? OpCodes.Brtrue : OpCodes.Brfalse, next.Operand); } else if (!ILPatternMatchingExt.MatchClt(next) && !ILPatternMatchingExt.MatchCltUn(next)) { val.Emit(OpCodes.Not); } ILLabel val3 = val.DefineLabel(); val.Emit(OpCodes.Br, (object)val3); val.Emit(OpCodes.Ldc_I4_M1); val.Index += 2; val.MarkLabel(val3); num++; } if (num == 0) { Log.Error("Failed to find any TeamIndex.Count patch locations for " + ((MemberReference)il.Method).FullName); } static bool matchCompareOrBranch(Instruction x) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_000f: Invalid comparison between Unknown and I4 //IL_0012: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: 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_004d: 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_005f: Unknown result type (might be due to invalid IL or missing references) OpCode opCode2 = x.OpCode; if ((int)((OpCode)(ref opCode2)).FlowControl != 3 && !(x.OpCode == OpCodes.Ceq) && !(x.OpCode == OpCodes.Cgt) && !(x.OpCode == OpCodes.Cgt_Un) && !(x.OpCode == OpCodes.Clt)) { return x.OpCode == OpCodes.Clt_Un; } return true; } } private static int LayerIndex_GetAppropriateLayerForTeam(orig_GetAppropriateLayerForTeam orig, TeamIndex teamIndex) { //IL_0001: 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_002b: Unknown result type (might be due to invalid IL or missing references) int result = orig.Invoke(teamIndex); int moddedTeamIndex = GetModdedTeamIndex(teamIndex); if (moddedTeamIndex >= 0 && moddedTeamIndex < ModdedTeamCount) { TeamBehavior safe = ArrayUtils.GetSafe<TeamBehavior>(_moddedTeamBehaviors, moddedTeamIndex); if (safe != null) { result = safe.TeamLayer.intVal; } } return result; } private static void GenericPickupController_AttemptGrant(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown ILCursor val = new ILCursor(il); ILCursor[] array = default(ILCursor[]); ILLabel val2 = default(ILLabel); if (!val.TryFindNext(ref array, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, (MethodBase)Reflection.GetPropertyGetter(typeof(TeamComponent), "teamIndex")), (Instruction x) => ILPatternMatchingExt.MatchBneUn(x, ref val2) })) { Log.Error("Failed to find pickup permission patch location for " + ((MemberReference)il.Method).FullName); } val.Goto(array[0].Next, (MoveType)2, false); val.EmitDelegate<Func<TeamIndex, TeamIndex>>((Func<TeamIndex, TeamIndex>)getPretendTeamForPickup); static TeamIndex getPretendTeamForPickup(TeamIndex realTeamIndex) { //IL_0000: 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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (!IsModdedTeam(realTeamIndex)) { return realTeamIndex; } TeamBehavior teamBehavior = GetTeamBehavior(realTeamIndex); if (teamBehavior != null && teamBehavior.CanPickup) { return (TeamIndex)1; } return realTeamIndex; } } private static LayerIndex LayerIndex_GetAppropriateFakeLayerForTeam(orig_GetAppropriateFakeLayerForTeam orig, TeamIndex teamIndex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0031: 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_0030: Unknown result type (might be due to invalid IL or missing references) LayerIndex result = orig.Invoke(teamIndex); int moddedTeamIndex = GetModdedTeamIndex(teamIndex); if (moddedTeamIndex >= 0 && moddedTeamIndex < ModdedTeamCount) { TeamBehavior safe = ArrayUtils.GetSafe<TeamBehavior>(_moddedTeamBehaviors, moddedTeamIndex); if (safe != null) { result = safe.TeamFakeLayer; } } return result; } private static bool TeamMask_HasTeam(orig_HasTeam orig, ref TeamMask self, TeamIndex teamIndex) { //IL_0002: 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) bool result = orig.Invoke(ref self, teamIndex); int moddedTeamIndex = GetModdedTeamIndex(teamIndex); if (moddedTeamIndex >= 0 && moddedTeamIndex < ModdedTeamCount) { result = GetModdedTeamMaskBit(in self, moddedTeamIndex); } return result; } private static void TeamMask_AddTeam(orig_AddTeam orig, ref TeamMask self, TeamIndex teamIndex) { //IL_0002: 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) orig.Invoke(ref self, teamIndex); int moddedTeamIndex = GetModdedTeamIndex(teamIndex); if (moddedTeamIndex >= 0 && moddedTeamIndex < ModdedTeamCount) { SetModdedTeamMaskBit(ref self, moddedTeamIndex, bitState: true); } } private static void TeamMask_RemoveTeam(orig_RemoveTeam orig, ref TeamMask self, TeamIndex teamIndex) { //IL_0002: 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) orig.Invoke(ref self, teamIndex); int moddedTeamIndex = GetModdedTeamIndex(teamIndex); if (moddedTeamIndex >= 0 && moddedTeamIndex < ModdedTeamCount) { SetModdedTeamMaskBit(ref self, moddedTeamIndex, bitState: false); } } private static void TeamManager_Start(orig_Start orig, TeamManager self) { UnityObjectExtensions.EnsureComponent<TeamManagerModdedTeamsHelper>(((Component)self).gameObject); orig.Invoke(self); } private static void TeamManager_SetTeamExperience(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ParameterDefinition val2 = ((IEnumerable<ParameterDefinition>)((MethodReference)il.Method).Parameters).FirstOrDefault((Func<ParameterDefinition, bool>)((ParameterDefinition p) => Extensions.Is((MemberReference)(object)((ParameterReference)p).ParameterType, (MemberInfo)typeof(TeamIndex)))); if (val2 == null) { Log.Error("TeamManager.SetTeamExperience hook failed to find TeamIndex parameter"); return; } if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<NetworkBehaviour>(x, "SetDirtyBit") })) { Log.Error("Failed to find TeamManager.SetTeamExperience SetDirtyBit call"); return; } ILLabel val3 = val.MarkLabel(); if (!val.TryGotoPrev((MoveType)1, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0) })) { Log.Error("Failed to find TeamManager.SetTeamExperience SetDirtyBit patch location"); return; } ILLabel val4 = val.MarkLabel(); val.MoveBeforeLabels(); val.Emit(OpCodes.Ldarg, val2); val.EmitDelegate<Func<TeamIndex, bool>>((Func<TeamIndex, bool>)IsModdedTeam); val.Emit(OpCodes.Brfalse, (object)val4); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg, val2); val.EmitDelegate<Action<TeamManager, TeamIndex>>((Action<TeamManager, TeamIndex>)setModdedTeamDirtyBit); val.Emit(OpCodes.Br, (object)val3); static void setModdedTeamDirtyBit(TeamManager self, TeamIndex teamIndex) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) TeamManagerModdedTeamsHelper teamManagerModdedTeamsHelper = default(TeamManagerModdedTeamsHelper); if (((Component)self).TryGetComponent<TeamManagerModdedTeamsHelper>(ref teamManagerModdedTeamsHelper)) { teamManagerModdedTeamsHelper.SetDirtyBit(GetModdedTeamIndex(teamIndex)); } else { Log.Error($"TeamManager wants to set dirty bit of modded team '{teamIndex}', but modded teams helper is not attached!"); } } } private static bool TeamManager_OnSerialize(orig_OnSerialize orig, TeamManager self, NetworkWriter writer, bool initialState) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) bool result = orig.Invoke(self, writer, initialState); TeamManagerModdedTeamsHelper teamManagerModdedTeamsHelper = default(TeamManagerModdedTeamsHelper); if (((Component)self).TryGetComponent<TeamManagerModdedTeamsHelper>(ref teamManagerModdedTeamsHelper)) { byte[] array; if (initialState) { array = null; } else { array = teamManagerModdedTeamsHelper.ModdedTeamsDirtyBits ?? Array.Empty<byte>(); CompressedFlagArrayUtilities.WriteToNetworkWriter(array, writer, ModdedTeamCount); } for (int i = 0; i < ModdedTeamCount; i++) { if (initialState || CompressedFlagArrayUtilities.Has(array, i)) { writer.WritePackedUInt64(self.teamExperience[GetTeamIndex(i)]); } } result = true; teamManagerModdedTeamsHelper.ClearDirtyBits(); } return result; } private static void TeamManager_OnDeserialize(orig_OnDeserialize orig, TeamManager self, NetworkReader reader, bool initialState) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, reader, initialState); TeamManagerModdedTeamsHelper teamManagerModdedTeamsHelper = default(TeamManagerModdedTeamsHelper); if (!((Component)self).TryGetComponent<TeamManagerModdedTeamsHelper>(ref teamManagerModdedTeamsHelper)) { return; } byte[] array = (initialState ? null : CompressedFlagArrayUtilities.ReadFromNetworkReader(reader, ModdedTeamCount)); for (int i = 0; i < ModdedTeamCount; i++) { if (initialState || CompressedFlagArrayUtilities.Has(array, i)) { ulong num = reader.ReadPackedUInt64(); self.SetTeamExperience(GetTeamIndex(i), num); } } } private static bool GetModdedTeamMaskBit(in TeamMask teamMask, int moddedTeamIndex) { return CompressedFlagArrayUtilities.Has(TeamsInterop.GetModdedMask(ref teamMask), moddedTeamIndex); } private static void SetModdedTeamMaskBit(ref TeamMask teamMask, int moddedTeamIndex, bool bitState) { ref byte[] moddedMaskRef = ref TeamsInterop.GetModdedMaskRef(ref teamMask); if (bitState) { CompressedFlagArrayUtilities.AddImmutable(ref moddedMaskRef, moddedTeamIndex); } else { CompressedFlagArrayUtilities.RemoveImmutable(ref moddedMaskRef, moddedTeamIndex); } } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static int GetModdedTeamIndex(TeamIndex teamIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected I4, but got Unknown return teamIndex - _vanillaTeamsCount; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static TeamIndex GetTeamIndex(int moddedTeamIndex) { return (TeamIndex)(sbyte)(_vanillaTeamsCount + moddedTeamIndex); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsModdedTeam(TeamIndex teamIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if ((int)teamIndex != -1 && (byte)teamIndex >= (byte)_vanillaTeamsCount) { return (byte)teamIndex < TeamCount; } return false; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool IsValidTeam(TeamIndex teamIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) if ((int)teamIndex != -1) { return (byte)teamIndex < TeamCount; } return false; } [IteratorStateMachine(typeof(<TeamsEnumerator>d__39))] public static IEnumerable<TeamIndex> TeamsEnumerator() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <TeamsEnumerator>d__39(-2); } public static TeamIndex RegisterTeam(TeamDef teamDef, TeamBehavior teamBehavior) { //IL_008c: 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_010c: 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) //IL_011e: Unknown result type (might be due to invalid IL or missing references) if (teamDef == null) { throw new ArgumentNullException("teamDef"); } if (teamBehavior == null) { throw new ArgumentNullException("teamBehavior"); } if (RoR2Application.loadFinished) { throw new InvalidOperationException("Cannot register a new team post initialization"); } int num = TeamCatalog.teamDefs.Length; int num2 = num + 1; if (num >= TeamCountLimit) { Log.Fatal($"Failed to add team '{teamBehavior.Name}': Modded team limit of {ModdedTeamCountLimit} has been reached."); return (TeamIndex)(-1); } if (Enum.TryParse<TeamIndex>(teamBehavior.Name, out TeamIndex result)) { Log.Error("Attempting to register team with name '" + teamBehavior.Name + "' multiple times, previously assigned TeamIndex will be returned, TeamDef and TeamBehavior will be discarded"); return result; } if (Enum.TryParse<TeamIndex>(teamBehavior.Name, ignoreCase: true, out TeamIndex result2)) { Log.Warning($"Registering team '{teamBehavior.Name}' with the same case-insensitive name as an existing team '{result2}', consider re-naming your team to avoid name clashes."); } SetHooks(); ArrayUtils.EnsureCapacity<TeamDef>(ref TeamCatalog.teamDefs, num2); TeamCatalog.Register((TeamIndex)(sbyte)num, teamDef); ArrayUtils.EnsureCapacity<Team>(ref TeamComponent.teamsList, num2); ((Team)(ref TeamComponent.teamsList[num])).Init((TeamIndex)(sbyte)num); if (EnumPatcher.IsValid(ref _teamCountHandle)) { EnumPatcher.RemoveEnumValueEntry(ref _teamCountHandle); } EnumPatcher.SetEnumValue<TeamIndex>(teamBehavior.Name, (TeamIndex)(sbyte)num); _teamCountHandle = EnumPatcher.SetEnumValue<TeamIndex>("Count", (TeamIndex)(sbyte)num2); ((TeamMask)(ref TeamMask.all)).AddTeam((TeamIndex)(sbyte)num); if ((teamBehavior.Classification & TeamClassification.Neutral) == 0) { ((TeamMask)(ref TeamMask.allButNeutral)).AddTeam((TeamIndex)(sbyte)num); } int moddedTeamIndex = GetModdedTeamIndex((TeamIndex)(sbyte)num); if (moddedTeamIndex >= _moddedTeamBehaviors.Length) { Array.Resize(ref _moddedTeamBehaviors, Math.Clamp(_moddedTeamBehaviors.Length * 2, moddedTeamIndex + 1, ModdedTeamCountLimit)); } _moddedTeamBehaviors[moddedTeamIndex] = teamBehavior; CompressedFlagArrayUtilities.AddImmutable(ref _allModdedTeamsDirtyBits, moddedTeamIndex); return (TeamIndex)(sbyte)num; } public static TeamBehavior GetTeamBehavior(TeamIndex teamIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) int moddedTeamIndex = GetModdedTeamIndex(teamIndex); if (moddedTeamIndex < 0) { return null; } return ArrayUtils.GetSafe<TeamBehavior>(_moddedTeamBehaviors, moddedTeamIndex); } } [BepInPlugin("com.bepis.r2api.teams", "R2API.Teams", "1.0.2")] public sealed class TeamsPlugin : BaseUnityPlugin { private void Awake() { Log.Init(((BaseUnityPlugin)this).Logger); TeamsAPI.Init(); } private void OnDestroy() { TeamsAPI.UnsetHooks(); } } } namespace R2API.AutoVersionGen { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] internal class AutoVersionAttribute : Attribute { } } namespace R2API.Utils { public static class TeamsAPINetworkExtensions { public static void Write(this NetworkWriter writer, in TeamMask teamMask) { writer.Write(teamMask.a); if (TeamsAPI.ModdedTeamCount > 0) { CompressedFlagArrayUtilities.WriteToNetworkWriter(TeamsInterop.GetModdedMask(ref teamMask) ?? Array.Empty<byte>(), writer, TeamsAPI.ModdedTeamCount); } } public static TeamMask ReadTeamMask(this NetworkReader reader) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) TeamMask result = default(TeamMask); result.a = reader.ReadByte(); if (TeamsAPI.ModdedTeamCount > 0) { byte[] array = CompressedFlagArrayUtilities.ReadFromNetworkReader(reader, TeamsAPI.ModdedTeamCount); if (array != null && array.Length != 0) { TeamsInterop.SetModdedMask(ref result, array); } } return result; } } }
plugins/R2API.Teams/R2API.Teams.Interop.dll
Decompiled 3 weeks agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using Microsoft.CodeAnalysis; using RoR2; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: InternalsVisibleTo("R2API.Teams")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("R2API.Teams.Interop")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+72fb4acded8caa7a86ab495cc2762c4ae961b47b")] [assembly: AssemblyProduct("R2API.Teams.Interop")] [assembly: AssemblyTitle("R2API.Teams.Interop")] [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 R2API { internal static class TeamsInterop { public static byte[] GetModdedMask(in TeamMask teamMask) { return teamMask.r2api_moddedMask; } public static ref byte[] GetModdedMaskRef(ref TeamMask teamMask) { return ref teamMask.r2api_moddedMask; } public static void SetModdedMask(ref TeamMask teamMask, byte[] value) { teamMask.r2api_moddedMask = value; } } }
patchers/R2API.Teams/R2API.Teams.Patcher.dll
Decompiled 3 weeks agousing System; 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 Microsoft.CodeAnalysis; using Mono.Cecil; [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("R2API.Teams.Patcher")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+72fb4acded8caa7a86ab495cc2762c4ae961b47b")] [assembly: AssemblyProduct("R2API.Teams.Patcher")] [assembly: AssemblyTitle("R2API.Teams.Patcher")] [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 R2API { internal static class TeamsPatcher { public static IEnumerable<string> TargetDLLs { get; } = new <>z__ReadOnlySingleElementList<string>("RoR2.dll"); public static void Patch(AssemblyDefinition assembly) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown TypeDefinition type = assembly.MainModule.GetType("RoR2", "TeamMask"); if (type != null) { type.Fields.Add(new FieldDefinition("r2api_moddedMask", (FieldAttributes)6, assembly.MainModule.ImportReference(typeof(byte[])))); } } } } [CompilerGenerated] internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T> { object IEnumerator.Current => _item; T IEnumerator<T>.Current => _item; public Enumerator(T item) { _item = item; } bool IEnumerator.MoveNext() { if (!_moveNextCalled) { return _moveNextCalled = true; } return false; } void IEnumerator.Reset() { _moveNextCalled = false; } void IDisposable.Dispose() { } } int ICollection.Count => 1; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => 1; T IReadOnlyList<T>.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } } int ICollection<T>.Count => 1; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } public <>z__ReadOnlySingleElementList(T item) { _item = item; } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.CopyTo(Array array, int index) { array.SetValue(_item, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return EqualityComparer<T>.Default.Equals(_item, (T)value); } int IList.IndexOf(object value) { if (!EqualityComparer<T>.Default.Equals(_item, (T)value)) { return -1; } return 0; } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return new Enumerator(_item); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return EqualityComparer<T>.Default.Equals(_item, item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { array[arrayIndex] = _item; } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { if (!EqualityComparer<T>.Default.Equals(_item, item)) { return -1; } return 0; } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } }