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 BrynzaAPI.Interop;
using EntityStates;
using HG.Reflection;
using HarmonyLib;
using IL.EntityStates;
using IL.RoR2;
using IL.RoR2.CameraModes;
using IL.RoR2.Projectile;
using IL.RoR2.Skills;
using IL.RoR2.UI;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using MonoMod.Utils;
using On.EntityStates;
using On.RoR2;
using On.RoR2.UI;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using RoR2.CameraModes;
using RoR2.ConVar;
using RoR2.ContentManagement;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("BrynzaAPI")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f74e726415bbbf8eebd1ac22d3fbb279a1314ebf")]
[assembly: AssemblyProduct("BrynzaAPI")]
[assembly: AssemblyTitle("BrynzaAPI")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
[module: UnverifiableCode]
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 BrynzaAPI
{
[Serializable]
[BepInPlugin("com.brynzananas.brynzaapi", "Brynza API", "1.2.0")]
[BepInDependency("com.bepis.r2api", "5.0.10")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class BrynzaAPI : BaseUnityPlugin
{
public delegate void OnHitGroundServerDelegate(CharacterMotor characterMotor, ref HitGroundInfo hitGroundInfo);
public struct ModMetaData
{
public string Guid;
public string Name;
}
public delegate void OnConfigApplied(int configId, INetworkConfig networkConfig);
public interface INetworkConfig
{
int id { get; set; }
OnConfigApplied OnConfigApplied { get; set; }
Type parameterType { get; }
}
public class NetworkConfig<T> : INetworkConfig
{
public NetworkConfig<bool> enableConfig;
public ConfigEntry<T> configEntry;
private T configValue;
private OnConfigApplied onConfigApplied;
public int configId;
public T Value
{
get
{
if (enableConfig != null && !enableConfig.Value)
{
return DefaultValue;
}
return configValue;
}
set
{
configValue = value;
}
}
public T DefaultValue => (T)((ConfigEntryBase)configEntry).DefaultValue;
public Type parameterType => typeof(T);
public OnConfigApplied OnConfigApplied
{
get
{
return onConfigApplied;
}
set
{
onConfigApplied = value;
}
}
public int id
{
get
{
return configId;
}
set
{
configId = value;
}
}
}
public class RequestSyncConfigsNetMessage : INetMessage, ISerializableObject
{
public void Deserialize(NetworkReader reader)
{
}
public void OnReceived()
{
SetConfigValues();
}
public void Serialize(NetworkWriter writer)
{
}
}
public class SyncConfigsNetMessage : INetMessage, ISerializableObject
{
private int configId;
private string input;
public SyncConfigsNetMessage(int id, string input)
{
configId = id;
this.input = input;
}
public SyncConfigsNetMessage()
{
}
public void Deserialize(NetworkReader reader)
{
configId = reader.ReadInt32();
input = reader.ReadString();
}
public void OnReceived()
{
INetworkConfig networkConfig = networkConfigs[configId];
if (networkConfig.parameterType == typeof(float))
{
NetworkConfig<float> networkConfig2 = networkConfig as NetworkConfig<float>;
networkConfig2.Value = float.Parse(input);
if (!NetworkServer.active)
{
ConfigEntry<float> configEntry = networkConfig2.configEntry;
configEntry.Value += 1f;
ConfigEntry<float> configEntry2 = networkConfig2.configEntry;
configEntry2.Value -= 1f;
}
}
if (networkConfig.parameterType == typeof(int))
{
NetworkConfig<int> networkConfig3 = networkConfig as NetworkConfig<int>;
networkConfig3.Value = int.Parse(input);
if (!NetworkServer.active)
{
ConfigEntry<int> configEntry3 = networkConfig3.configEntry;
configEntry3.Value += 1;
ConfigEntry<int> configEntry4 = networkConfig3.configEntry;
configEntry4.Value -= 1;
}
}
if (networkConfig.parameterType == typeof(bool))
{
NetworkConfig<bool> networkConfig4 = networkConfig as NetworkConfig<bool>;
networkConfig4.Value = bool.Parse(input);
if (!NetworkServer.active)
{
networkConfig4.configEntry.Value = !networkConfig4.configEntry.Value;
networkConfig4.configEntry.Value = !networkConfig4.configEntry.Value;
}
}
if (networkConfig.OnConfigApplied != null)
{
networkConfig.OnConfigApplied(configId, networkConfig);
}
}
public void Serialize(NetworkWriter writer)
{
writer.Write(configId);
writer.Write(input);
}
}
[CompilerGenerated]
private static class <>O
{
public static Manipulator <0>__SkillDef_OnFixedUpdate;
public static Manipulator <1>__SkillDef_OnExecute;
public static Manipulator <2>__CrosshairManager_UpdateCrosshair1;
public static Manipulator <3>__CameraModePlayerBasic_UpdateInternal;
public static EventHandler <4>__ConfigEntry_SettingChanged;
}
public const string ModGuid = "com.brynzananas.brynzaapi";
public const string ModName = "Brynza API";
public const string ModVer = "1.2.0";
public static Dictionary<CharacterMotor, List<OnHitGroundServerDelegate>> onHitGroundServerDictionary = new Dictionary<CharacterMotor, List<OnHitGroundServerDelegate>>();
public static bool riskOfOptionsLoaded = false;
public static ConfigFile ConfigMain;
public static Dictionary<string, List<INetworkConfig>> modConfigs = new Dictionary<string, List<INetworkConfig>>();
private bool hooksEnabled = false;
public static List<INetworkConfig> networkConfigs = new List<INetworkConfig>();
public void Awake()
{
ConfigMain = ((BaseUnityPlugin)this).Config;
NetworkingAPI.RegisterMessageType<SyncConfigsNetMessage>();
NetworkingAPI.RegisterMessageType<RequestSyncConfigsNetMessage>();
riskOfOptionsLoaded = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
SetHooks();
}
public void OnDestroy()
{
UnsetHooks();
}
private void SetHooks()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Expected O, but got Unknown
//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_0053: Expected O, but got Unknown
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Expected O, but got Unknown
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Expected O, but got Unknown
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Expected O, but got Unknown
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Expected O, but got Unknown
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Expected O, but got Unknown
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Expected O, but got Unknown
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Expected O, but got Unknown
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Expected O, but got Unknown
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Expected O, but got Unknown
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Expected O, but got Unknown
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Expected O, but got Unknown
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Expected O, but got Unknown
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Expected O, but got Unknown
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Expected O, but got Unknown
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Expected O, but got Unknown
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Expected O, but got Unknown
if (!hooksEnabled)
{
hooksEnabled = true;
object obj = <>O.<0>__SkillDef_OnFixedUpdate;
if (obj == null)
{
Manipulator val = SkillDef_OnFixedUpdate;
<>O.<0>__SkillDef_OnFixedUpdate = val;
obj = (object)val;
}
SkillDef.OnFixedUpdate += (Manipulator)obj;
object obj2 = <>O.<1>__SkillDef_OnExecute;
if (obj2 == null)
{
Manipulator val2 = SkillDef_OnExecute;
<>O.<1>__SkillDef_OnExecute = val2;
obj2 = (object)val2;
}
SkillDef.OnExecute += (Manipulator)obj2;
object obj3 = <>O.<2>__CrosshairManager_UpdateCrosshair1;
if (obj3 == null)
{
Manipulator val3 = CrosshairManager_UpdateCrosshair1;
<>O.<2>__CrosshairManager_UpdateCrosshair1 = val3;
obj3 = (object)val3;
}
CrosshairManager.UpdateCrosshair += (Manipulator)obj3;
object obj4 = <>O.<3>__CameraModePlayerBasic_UpdateInternal;
if (obj4 == null)
{
Manipulator val4 = CameraModePlayerBasic_UpdateInternal;
<>O.<3>__CameraModePlayerBasic_UpdateInternal = val4;
obj4 = (object)val4;
}
CameraModePlayerBasic.UpdateInternal += (Manipulator)obj4;
CameraModePlayerBasic.CollectLookInputInternal += new Manipulator(CameraModePlayerBasic_CollectLookInputInternal);
GenericCharacterMain.HandleMovements += new hook_HandleMovements(GenericCharacterMain_HandleMovements);
GenericSkill.Awake += new Manipulator(GenericSkill_Awake);
CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats1);
CharacterMotor.PreMove += new Manipulator(CharacterMotor_PreMove);
ProjectileExplosion.DetonateServer += new Manipulator(ProjectileExplosion_DetonateServer);
GenericCharacterMain.ApplyJumpVelocity += new Manipulator(GenericCharacterMain_ApplyJumpVelocity);
GlobalEventManager.OnCharacterHitGroundServer += new hook_OnCharacterHitGroundServer(GlobalEventManager_OnCharacterHitGroundServer);
ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
Run.Start += new hook_Start(Run_Start);
RoR2Application.OnLoad += new hook_OnLoad(RoR2Application_OnLoad);
CharacterSelectController.OnEnable += new hook_OnEnable(CharacterSelectController_OnEnable);
CharacterMotor.OnDisable += new hook_OnDisable(CharacterMotor_OnDisable);
FogDamageController.MyFixedUpdate += new Manipulator(FogDamageController_MyFixedUpdate);
}
}
private void FogDamageController_MyFixedUpdate(ILContext il)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
Instruction val2 = null;
ILLabel val3 = null;
int i = 6;
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<HealthComponent>(x, "TakeDamage")
}))
{
val2 = val.Next;
if (val.TryGotoPrev(new Func<Instruction, bool>[2]
{
(Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref i),
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<CharacterBody>(x, "get_healthComponent")
}))
{
int index = val.Index;
val.Index = index + 1;
val.Emit(OpCodes.Ldloc, i);
val.Emit(OpCodes.Brtrue_S, val2);
}
else
{
Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook 2 failed!"));
}
}
else
{
Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook 1 failed!"));
}
}
private void CharacterMotor_OnDisable(orig_OnDisable orig, CharacterMotor self)
{
orig.Invoke(self);
if (NetworkServer.active && onHitGroundServerDictionary.ContainsKey(self))
{
onHitGroundServerDictionary.Remove(self);
}
}
private void GlobalEventManager_OnCharacterHitGroundServer(orig_OnCharacterHitGroundServer orig, GlobalEventManager self, CharacterBody characterBody, HitGroundInfo hitGroundInfo)
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
CharacterMotor characterMotor = characterBody.characterMotor;
if ((Object)(object)characterMotor != (Object)null && onHitGroundServerDictionary.ContainsKey(characterMotor))
{
List<OnHitGroundServerDelegate> list = onHitGroundServerDictionary[characterMotor];
for (int i = 0; i < list.Count; i++)
{
list[i]?.Invoke(characterMotor, ref hitGroundInfo);
}
}
orig.Invoke(self, characterBody, hitGroundInfo);
}
private void GenericCharacterMain_ApplyJumpVelocity(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0041: 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_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
ILLabel val2 = null;
if (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 2)
}))
{
val.Emit(OpCodes.Ldarg_0);
val.Emit(OpCodes.Ldloc_0);
val.Emit(OpCodes.Ldarg_1);
val.Emit(OpCodes.Ldarg_2);
val.EmitDelegate<Func<CharacterMotor, Vector3, CharacterBody, float, float>>((Func<CharacterMotor, Vector3, CharacterBody, float, float>)delegate(CharacterMotor cm, Vector3 vector, CharacterBody cb, float horizontalBonus)
{
bool bunnyHop = cm.GetBunnyHop();
float result2 = 1f;
if (bunnyHop)
{
Vector3 val3 = default(Vector3);
((Vector3)(ref val3))..ctor(cm.velocity.x, 0f, cm.velocity.z);
float num = ((Vector3)(ref vector)).sqrMagnitude * horizontalBonus * horizontalBonus;
result2 = ((num != 0f) ? (MathF.Max(num - ((Vector3)(ref val3)).sqrMagnitude, 0f) / num) : 1f);
}
return result2;
});
val.Emit(OpCodes.Call, (MethodBase)AccessTools.Method(typeof(Vector3), "op_Multiply", new Type[2]
{
typeof(Vector3),
typeof(float)
}, (Type[])null));
val.Emit(OpCodes.Ldarg_0);
val.EmitDelegate<Func<CharacterMotor, Vector3>>((Func<CharacterMotor, Vector3>)delegate(CharacterMotor cm)
{
//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_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
Vector3 result = Vector3.zero;
if (cm.GetBunnyHop())
{
result = cm.velocity;
}
return result;
});
val.Emit(OpCodes.Call, (MethodBase)AccessTools.Method(typeof(Vector3), "op_Addition", (Type[])null, (Type[])null));
}
else
{
Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
}
}
private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
{
addContentPackProvider.Invoke((IContentPackProvider)(object)new ContentPacks());
}
private void CharacterMotor_OnLanded(orig_OnLanded orig, CharacterMotor self)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
self.body.SetBuffCount(Assets.StrafeBuff.buffIndex, 0);
}
private void ProjectileExplosion_DetonateServer(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
ILLabel val2 = null;
if (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<ProjectileExplosion>(x, "OnBlastAttackResult")
}))
{
val.Index += 1;
val.Emit(OpCodes.Ldarg_0);
val.Emit(OpCodes.Ldloc_1);
val.Emit(OpCodes.Ldloc_2);
val.EmitDelegate<Action<ProjectileExplosion, BlastAttack, Result>>((Action<ProjectileExplosion, BlastAttack, Result>)delegate(ProjectileExplosion pe, BlastAttack ba, Result bar)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
IOnProjectileExplosionDetonate[] components = ((Component)pe).GetComponents<IOnProjectileExplosionDetonate>();
IOnProjectileExplosionDetonate[] array = components;
foreach (IOnProjectileExplosionDetonate onProjectileExplosionDetonate in array)
{
onProjectileExplosionDetonate.OnProjectileExplosionDetonate(ba, bar);
}
});
}
else
{
Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
}
}
private void CharacterMotor_PreMove(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Expected O, but got Unknown
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: 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)
//IL_013e: 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)
//IL_0170: Expected O, but got Unknown
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Expected O, but got Unknown
//IL_027e: Unknown result type (might be due to invalid IL or missing references)
//IL_028a: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
ILLabel val2 = null;
if (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStfld<CharacterMotor>(x, "velocity")
}))
{
ILCursor obj = val;
int index = obj.Index;
obj.Index = index + 1;
val.Emit(OpCodes.Ldarg_0);
val.Emit(OpCodes.Ldloc_1);
val.Emit(OpCodes.Ldarg_1);
val.EmitDelegate<Action<CharacterMotor, Vector3, float>>((Action<CharacterMotor, Vector3, float>)delegate(CharacterMotor cb, Vector3 wishDirection, float deltaTime)
{
//IL_009d: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: 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_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: 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: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
if (cb.GetStrafe())
{
Vector3 val5 = default(Vector3);
((Vector3)(ref val5))..ctor(cb.velocity.x, 0f, cb.velocity.z);
float num = Vector3.Dot(((Vector3)(ref val5)).normalized, wishDirection);
if ((double)num < 0.1)
{
cb.velocity += new Vector3(wishDirection.x * cb.walkSpeed * 10f, 0f, wishDirection.z * cb.walkSpeed * 10f) * deltaTime;
}
}
Vector3 velocityOverride = cb.GetVelocityOverride();
if (velocityOverride != Vector3.zero)
{
cb.velocity = velocityOverride;
}
});
}
else
{
Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
}
val = new ILCursor(il);
if (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 2)
}))
{
ILCursor obj2 = val;
int index = obj2.Index;
obj2.Index = index + 1;
val.Emit(OpCodes.Ldloc_1);
val.Emit(OpCodes.Ldloc_2);
val.Emit(OpCodes.Ldarg_0);
val.EmitDelegate<Func<Vector3, Vector3, CharacterMotor, Vector3>>((Func<Vector3, Vector3, CharacterMotor, Vector3>)sus);
val.Emit(OpCodes.Stloc_2);
}
else
{
Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
}
val = new ILCursor(il);
if (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, 0)
}))
{
ILCursor obj3 = val;
int index = obj3.Index;
obj3.Index = index + 1;
val.Emit(OpCodes.Ldloc_0);
val.Emit(OpCodes.Ldarg_0);
val.EmitDelegate<Func<float, CharacterMotor, float>>((Func<float, CharacterMotor, float>)amogus);
val.Emit(OpCodes.Stloc_0);
}
else
{
Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
}
val = new ILCursor(il);
if (val.TryGotoNext(new Func<Instruction, bool>[2]
{
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1),
(Instruction x) => ILPatternMatchingExt.MatchMul(x)
}))
{
ILCursor obj4 = val;
int index = obj4.Index;
obj4.Index = index + 1;
val.Emit(OpCodes.Ldloc_1);
val.Emit(OpCodes.Ldarg_0);
val.EmitDelegate<Func<Vector3, CharacterMotor, float>>((Func<Vector3, CharacterMotor, float>)amogus);
val.Emit(OpCodes.Mul);
}
else
{
Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
}
static float amogus(float originalAirControl, CharacterMotor characterMotor)
{
float consistentAcceleration = characterMotor.GetConsistentAcceleration();
return (consistentAcceleration != 0f) ? (consistentAcceleration * characterMotor.walkSpeed) : originalAirControl;
}
static float amogus(Vector3 wishDirection, CharacterMotor characterMotor)
{
if (characterMotor.GetFluidMaxDistanceDelta())
{
return 1f;
}
return 1f;
}
static Vector3 sus(Vector3 wishDirection, Vector3 vector31, CharacterMotor characterMotor)
{
//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_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: 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_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: 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)
Vector3 velocity = characterMotor.velocity;
if (!characterMotor.isGrounded && characterMotor.GetKeepVelocityOnMoving())
{
Vector3 val3;
if (characterMotor.isFlying)
{
val3 = characterMotor.velocity + vector31;
return ((Vector3)(ref val3)).normalized * MathF.Max(((Vector3)(ref characterMotor.velocity)).magnitude, ((Vector3)(ref vector31)).magnitude);
}
Vector3 val4 = default(Vector3);
((Vector3)(ref val4))..ctor(characterMotor.velocity.x, 0f, characterMotor.velocity.z);
val3 = val4 + vector31;
return ((Vector3)(ref val3)).normalized * MathF.Max(((Vector3)(ref val4)).magnitude, ((Vector3)(ref vector31)).magnitude);
}
return vector31;
}
}
private void CharacterBody_RecalculateStats1(orig_RecalculateStats orig, CharacterBody self)
{
orig.Invoke(self);
if (!Object.op_Implicit((Object)(object)self.skillLocator))
{
return;
}
List<GenericSkill> list = new List<GenericSkill>();
if (self.skillLocator.allSkills != null)
{
list.AddRange(self.skillLocator.allSkills);
}
foreach (GenericSkill item in list)
{
if ((Object)(object)item != (Object)null)
{
GenericSkill linkedSkill = item.GetLinkedSkill();
if ((Object)(object)linkedSkill != (Object)null)
{
item.cooldownScale = linkedSkill.cooldownScale;
item.flatCooldownReduction = linkedSkill.flatCooldownReduction;
item.bonusStockFromBody = linkedSkill.bonusStockFromBody;
item.RecalculateValues();
}
}
}
}
private float GenericSkill_CalculateFinalRechargeInterval1(orig_CalculateFinalRechargeInterval orig, GenericSkill self)
{
List<GenericSkill> extraSkills = self.GetExtraSkills();
if (extraSkills != null && extraSkills.Count > 0)
{
foreach (GenericSkill item in extraSkills)
{
if (!((Object)(object)item == (Object)(object)self))
{
item.cooldownScale = self.cooldownScale;
item.flatCooldownReduction = self.flatCooldownReduction;
item.temporaryCooldownPenalty = self.temporaryCooldownPenalty;
item.CalculateFinalRechargeInterval();
}
}
}
return orig.Invoke(self);
}
private void GenericSkill_CalculateFinalRechargeInterval(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
ILCursor val = new ILCursor(il);
ILLabel val2 = null;
if (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCall<GenericSkill>(x, "get_cooldownScale")
}))
{
val.Remove();
val.EmitDelegate<Func<GenericSkill, float>>((Func<GenericSkill, float>)delegate(GenericSkill cb)
{
GenericSkill linkedSkill3 = cb.GetLinkedSkill();
return ((Object)(object)linkedSkill3 != (Object)null) ? linkedSkill3.cooldownScale : cb.cooldownScale;
});
}
else
{
Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
}
if (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCall<GenericSkill>(x, "get_flatCooldownReduction")
}))
{
val.Remove();
val.EmitDelegate<Func<GenericSkill, float>>((Func<GenericSkill, float>)delegate(GenericSkill cb)
{
GenericSkill linkedSkill2 = cb.GetLinkedSkill();
return ((Object)(object)linkedSkill2 != (Object)null) ? linkedSkill2.flatCooldownReduction : cb.flatCooldownReduction;
});
}
else
{
Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
}
if (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCall<GenericSkill>(x, "get_temporaryCooldownPenalty")
}))
{
val.Remove();
val.EmitDelegate<Func<GenericSkill, float>>((Func<GenericSkill, float>)delegate(GenericSkill cb)
{
GenericSkill linkedSkill = cb.GetLinkedSkill();
return ((Object)(object)linkedSkill != (Object)null) ? linkedSkill.temporaryCooldownPenalty : cb.temporaryCooldownPenalty;
});
}
else
{
Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
}
}
private void GenericSkill_RecalculateMaxStock1(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
ILCursor val = new ILCursor(il);
ILLabel val2 = null;
if (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdfld<GenericSkill>(x, "bonusStockFromBody")
}))
{
val.Remove();
val.EmitDelegate<Func<GenericSkill, int>>((Func<GenericSkill, int>)delegate(GenericSkill cb)
{
GenericSkill linkedSkill = cb.GetLinkedSkill();
return ((Object)(object)linkedSkill != (Object)null) ? linkedSkill.bonusStockFromBody : cb.bonusStockFromBody;
});
}
else
{
Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
}
}
private void GenericSkill_RecalculateMaxStock(orig_RecalculateMaxStock orig, GenericSkill self)
{
orig.Invoke(self);
List<GenericSkill> extraSkills = self.GetExtraSkills();
if (extraSkills == null || extraSkills.Count <= 0)
{
return;
}
foreach (GenericSkill item in extraSkills)
{
if (!((Object)(object)item == (Object)(object)self))
{
item.bonusStockFromBody = self.bonusStockFromBody;
item.RecalculateMaxStock();
}
}
}
private void UnsetHooks()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
//IL_004b: 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)
//IL_0056: Expected O, but got Unknown
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Expected O, but got Unknown
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Expected O, but got Unknown
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Expected O, but got Unknown
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Expected O, but got Unknown
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Expected O, but got Unknown
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Expected O, but got Unknown
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Expected O, but got Unknown
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Expected O, but got Unknown
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Expected O, but got Unknown
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Expected O, but got Unknown
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Expected O, but got Unknown
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Expected O, but got Unknown
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Expected O, but got Unknown
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Expected O, but got Unknown
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Expected O, but got Unknown
if (hooksEnabled)
{
hooksEnabled = false;
object obj = <>O.<0>__SkillDef_OnFixedUpdate;
if (obj == null)
{
Manipulator val = SkillDef_OnFixedUpdate;
<>O.<0>__SkillDef_OnFixedUpdate = val;
obj = (object)val;
}
SkillDef.OnFixedUpdate -= (Manipulator)obj;
object obj2 = <>O.<1>__SkillDef_OnExecute;
if (obj2 == null)
{
Manipulator val2 = SkillDef_OnExecute;
<>O.<1>__SkillDef_OnExecute = val2;
obj2 = (object)val2;
}
SkillDef.OnExecute -= (Manipulator)obj2;
object obj3 = <>O.<2>__CrosshairManager_UpdateCrosshair1;
if (obj3 == null)
{
Manipulator val3 = CrosshairManager_UpdateCrosshair1;
<>O.<2>__CrosshairManager_UpdateCrosshair1 = val3;
obj3 = (object)val3;
}
CrosshairManager.UpdateCrosshair -= (Manipulator)obj3;
object obj4 = <>O.<3>__CameraModePlayerBasic_UpdateInternal;
if (obj4 == null)
{
Manipulator val4 = CameraModePlayerBasic_UpdateInternal;
<>O.<3>__CameraModePlayerBasic_UpdateInternal = val4;
obj4 = (object)val4;
}
CameraModePlayerBasic.UpdateInternal -= (Manipulator)obj4;
CameraModePlayerBasic.CollectLookInputInternal -= new Manipulator(CameraModePlayerBasic_CollectLookInputInternal);
GenericCharacterMain.HandleMovements += new hook_HandleMovements(GenericCharacterMain_HandleMovements);
GenericSkill.Awake -= new Manipulator(GenericSkill_Awake);
CharacterBody.RecalculateStats -= new hook_RecalculateStats(CharacterBody_RecalculateStats1);
CharacterMotor.PreMove -= new Manipulator(CharacterMotor_PreMove);
ProjectileExplosion.DetonateServer -= new Manipulator(ProjectileExplosion_DetonateServer);
GenericCharacterMain.ApplyJumpVelocity -= new Manipulator(GenericCharacterMain_ApplyJumpVelocity);
GlobalEventManager.OnCharacterHitGroundServer -= new hook_OnCharacterHitGroundServer(GlobalEventManager_OnCharacterHitGroundServer);
ContentManager.collectContentPackProviders -= new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
Run.Start -= new hook_Start(Run_Start);
RoR2Application.OnLoad -= new hook_OnLoad(RoR2Application_OnLoad);
CharacterSelectController.OnEnable -= new hook_OnEnable(CharacterSelectController_OnEnable);
CharacterMotor.OnDisable -= new hook_OnDisable(CharacterMotor_OnDisable);
FogDamageController.MyFixedUpdate -= new Manipulator(FogDamageController_MyFixedUpdate);
}
}
private void GenericSkill_Awake(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
ILLabel val2 = null;
if (val.TryGotoNext(new Func<Instruction, bool>[5]
{
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchCall<GenericSkill>(x, "get_skillFamily"),
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<SkillFamily>(x, "get_defaultSkillDef"),
(Instruction x) => ILPatternMatchingExt.MatchCall<GenericSkill>(x, "set_defaultSkillDef")
}))
{
val.RemoveRange(5);
val.Emit(OpCodes.Ldarg_0);
val.EmitDelegate<Action<GenericSkill>>((Action<GenericSkill>)delegate(GenericSkill cb)
{
cb.defaultSkillDef = (Object.op_Implicit((Object)(object)cb.skillFamily) ? cb.skillFamily.defaultSkillDef : null);
});
}
else
{
Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
}
}
private void GenericCharacterMain_HandleMovements(orig_HandleMovements orig, GenericCharacterMain self)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)((EntityState)self).characterBody) && CharacterBodyAPI.HasModdedBodyFlag(((EntityState)self).characterBody, Assets.SprintAllTime))
{
self.sprintInputReceived = true;
}
orig.Invoke(self);
}
private void CameraModePlayerBasic_CollectLookInputInternal(ILContext il)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
//IL_007a: 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_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
ILLabel iLLabel = null;
if (val.TryGotoNext(new Func<Instruction, bool>[3]
{
(Instruction x) => ILPatternMatchingExt.MatchLdsfld<CameraRigController>(x, "enableSprintSensitivitySlowdown"),
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<BoolConVar>(x, "get_value"),
(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref iLLabel)
}))
{
val.Emit(OpCodes.Ldarg_2);
val.Emit<CameraModeContext>(OpCodes.Ldflda, "targetInfo");
val.Emit<TargetInfo>(OpCodes.Ldfld, "body");
val.EmitDelegate<Func<CharacterBody, bool>>((Func<CharacterBody, bool>)((CharacterBody cb) => Object.op_Implicit((Object)(object)cb) && CharacterBodyAPI.HasModdedBodyFlag(cb, Assets.SprintAllTime)));
val.Emit(OpCodes.Brtrue_S, (object)iLLabel);
}
else
{
Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
}
}
private static void SkillDef_OnExecute(ILContext il)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
ILLabel iLLabel = null;
if (val.TryGotoNext(new Func<Instruction, bool>[3]
{
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchLdfld<SkillDef>(x, "cancelSprintingOnActivation"),
(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref iLLabel)
}))
{
val.Emit(OpCodes.Ldarg_1);
val.EmitDelegate<Func<GenericSkill, bool>>((Func<GenericSkill, bool>)((GenericSkill cb) => CharacterBodyAPI.HasModdedBodyFlag(cb.characterBody, Assets.SprintAllTime)));
val.Emit(OpCodes.Brtrue_S, (object)iLLabel);
}
else
{
Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
}
}
private static void SkillDef_OnFixedUpdate(ILContext il)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
ILLabel iLLabel = null;
if (val.TryGotoNext(new Func<Instruction, bool>[4]
{
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1),
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<GenericSkill>(x, "get_characterBody"),
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<CharacterBody>(x, "get_isSprinting"),
(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref iLLabel)
}))
{
val.Emit(OpCodes.Ldarg_1);
val.EmitDelegate<Func<GenericSkill, bool>>((Func<GenericSkill, bool>)((GenericSkill cb) => CharacterBodyAPI.HasModdedBodyFlag(cb.characterBody, Assets.SprintAllTime)));
val.Emit(OpCodes.Brtrue_S, (object)iLLabel);
}
else
{
Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
}
}
private static void CameraModePlayerBasic_UpdateInternal(ILContext il)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
ILLabel iLLabel = null;
if (val.TryGotoNext(new Func<Instruction, bool>[4]
{
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 2),
(Instruction x) => ILPatternMatchingExt.MatchLdflda<CameraModeContext>(x, "targetInfo"),
(Instruction x) => ILPatternMatchingExt.MatchLdfld<TargetInfo>(x, "isSprinting"),
(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref iLLabel)
}))
{
val.Emit(OpCodes.Ldarg_2);
val.EmitDelegate<<>F{00000001}<CameraModeContext, bool>>((<>F{00000001}<CameraModeContext, bool>)sus);
val.Emit(OpCodes.Brtrue_S, (object)iLLabel);
}
else
{
Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
}
static bool sus(ref CameraModeContext cameraModeContext)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)cameraModeContext.targetInfo.body != (Object)null)
{
return CharacterBodyAPI.HasModdedBodyFlag(cameraModeContext.targetInfo.body, Assets.SprintAllTime);
}
return true;
}
}
private static void CrosshairManager_UpdateCrosshair1(ILContext il)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
ILLabel iLLabel = null;
ILLabel iLLabel2 = null;
if (val.TryGotoNext(new Func<Instruction, bool>[4]
{
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0),
(Instruction x) => ILPatternMatchingExt.MatchLdfld<CrosshairManager>(x, "cameraRigController"),
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<CameraRigController>(x, "get_hasOverride"),
(Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref iLLabel)
}) && val.TryGotoNext(new Func<Instruction, bool>[3]
{
(Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1),
(Instruction x) => ILPatternMatchingExt.MatchCallvirt<CharacterBody>(x, "get_isSprinting"),
(Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref iLLabel2)
}))
{
val.Emit(OpCodes.Ldarg_1);
val.EmitDelegate<Func<CharacterBody, bool>>((Func<CharacterBody, bool>)((CharacterBody cb) => CharacterBodyAPI.HasModdedBodyFlag(cb, Assets.SprintAllTime)));
val.Emit(OpCodes.Brtrue_S, (object)iLLabel);
}
else
{
Debug.LogError((object)(((MemberReference)il.Method).Name + " IL Hook failed!"));
}
}
private void CharacterSelectController_OnEnable(orig_OnEnable orig, CharacterSelectController self)
{
orig.Invoke(self);
SetConfigValues();
}
private IEnumerator RoR2Application_OnLoad(orig_OnLoad orig, RoR2Application self)
{
SetConfigValues();
return orig.Invoke(self);
}
public static void CreateResetToDefaultButtonInRiskOfOptionsConfigMenu(string name, string category, string description, string buttonText)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Expected O, but got Unknown
ModMetaData modMetaData = Assembly.GetCallingAssembly().GetModMetaData();
ModSettingsManager.AddOption((BaseOption)new GenericButtonOption(name, category, description, buttonText, new UnityAction(OnButtonPressed)), modMetaData.Guid, modMetaData.Name);
void OnButtonPressed()
{
if (modConfigs.ContainsKey(modMetaData.Guid))
{
foreach (INetworkConfig item in modConfigs[modMetaData.Guid])
{
if (item.parameterType == typeof(float))
{
NetworkConfig<float> networkConfig = (NetworkConfig<float>)item;
networkConfig.configEntry.Value = networkConfig.DefaultValue;
networkConfig.Value = networkConfig.DefaultValue;
}
if (item.parameterType == typeof(int))
{
NetworkConfig<int> networkConfig2 = (NetworkConfig<int>)item;
networkConfig2.configEntry.Value = networkConfig2.DefaultValue;
networkConfig2.Value = networkConfig2.DefaultValue;
}
if (item.parameterType == typeof(bool))
{
NetworkConfig<bool> networkConfig3 = (NetworkConfig<bool>)item;
networkConfig3.configEntry.Value = networkConfig3.DefaultValue;
networkConfig3.Value = networkConfig3.DefaultValue;
}
}
}
}
}
public static NetworkConfig<T> CreateConfig<T>(ConfigFile configFile, string section, string key, T defaultValue, string description, OnConfigApplied onConfigApplied = null, NetworkConfig<bool> enableConfig = null, bool generateRiskOfOptionsOption = true)
{
ConfigEntry<T> configEntry = configFile.Bind<T>(section, key, defaultValue, description);
return CreateConfig<T>(configEntry, onConfigApplied, enableConfig, generateRiskOfOptionsOption);
}
public static NetworkConfig<T> CreateConfig<T>(ConfigEntry<T> configEntry, OnConfigApplied onConfigApplied = null, NetworkConfig<bool> enableConfig = null, bool generateRiskOfOptionsOption = true)
{
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Expected O, but got Unknown
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Expected O, but got Unknown
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Expected O, but got Unknown
NetworkConfig<T> networkConfig = new NetworkConfig<T>();
networkConfig.id = networkConfigs.Count;
networkConfig.enableConfig = enableConfig;
networkConfig.OnConfigApplied = onConfigApplied;
networkConfig.configEntry = configEntry;
networkConfig.configEntry.SettingChanged += ConfigEntry_SettingChanged;
networkConfigs.Add(networkConfig);
ModMetaData modMetaData = Assembly.GetCallingAssembly().GetModMetaData();
if (modConfigs.ContainsKey(modMetaData.Guid))
{
modConfigs[modMetaData.Guid].Add(networkConfig);
}
else
{
List<INetworkConfig> list = new List<INetworkConfig>();
list.Add(networkConfig);
modConfigs.Add(modMetaData.Guid, list);
}
if (riskOfOptionsLoaded && generateRiskOfOptionsOption)
{
if (configEntry is ConfigEntry<float>)
{
ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(networkConfig.configEntry as ConfigEntry<float>), modMetaData.Guid, modMetaData.Name);
}
if (configEntry is ConfigEntry<int>)
{
ModSettingsManager.AddOption((BaseOption)new IntFieldOption(networkConfig.configEntry as ConfigEntry<int>), modMetaData.Guid, modMetaData.Name);
}
if (configEntry is ConfigEntry<bool>)
{
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(networkConfig.configEntry as ConfigEntry<bool>), modMetaData.Guid, modMetaData.Name);
}
}
return networkConfig;
}
private static void ConfigEntry_SettingChanged(object sender, EventArgs e)
{
SetConfigValues();
}
private void Run_Start(orig_Start orig, Run self)
{
orig.Invoke(self);
if (NetworkServer.active)
{
SetConfigValues();
}
else
{
NetMessageExtensions.Send((INetMessage)(object)new RequestSyncConfigsNetMessage(), (NetworkDestination)2);
}
}
public static void SetConfigValues()
{
if (!NetworkServer.active)
{
return;
}
foreach (INetworkConfig networkConfig in networkConfigs)
{
if (networkConfig.parameterType == typeof(float))
{
NetMessageExtensions.Send((INetMessage)(object)new SyncConfigsNetMessage(networkConfigs.IndexOf(networkConfig), (networkConfig as NetworkConfig<float>).configEntry.Value.ToString()), (NetworkDestination)1);
}
if (networkConfig.parameterType == typeof(int))
{
NetMessageExtensions.Send((INetMessage)(object)new SyncConfigsNetMessage(networkConfigs.IndexOf(networkConfig), (networkConfig as NetworkConfig<int>).configEntry.Value.ToString()), (NetworkDestination)1);
}
if (networkConfig.parameterType == typeof(bool))
{
NetMessageExtensions.Send((INetMessage)(object)new SyncConfigsNetMessage(networkConfigs.IndexOf(networkConfig), (networkConfig as NetworkConfig<bool>).configEntry.Value.ToString()), (NetworkDestination)1);
}
}
}
}
public class AddBuffNetMessage : INetMessage, ISerializableObject
{
private NetworkInstanceId instanceId;
private int buffIndex;
private int amount;
private float buffTime;
public AddBuffNetMessage(NetworkInstanceId networkInstanceId, int buffIndex, int amount, float buffTime)
{
//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)
instanceId = networkInstanceId;
this.buffIndex = buffIndex;
this.amount = amount;
this.buffTime = buffTime;
}
public AddBuffNetMessage(NetworkInstanceId networkInstanceId, BuffIndex buffIndex, int amount, float buffTime)
{
//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_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected I4, but got Unknown
instanceId = networkInstanceId;
this.buffIndex = (int)buffIndex;
this.amount = amount;
this.buffTime = buffTime;
}
public AddBuffNetMessage(NetworkInstanceId networkInstanceId, BuffDef buffDef, int amount, float buffTime)
{
//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_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected I4, but got Unknown
instanceId = networkInstanceId;
buffIndex = (int)buffDef.buffIndex;
this.amount = amount;
this.buffTime = buffTime;
}
public AddBuffNetMessage()
{
}
public void Deserialize(NetworkReader reader)
{
//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)
instanceId = reader.ReadNetworkId();
buffIndex = reader.ReadInt32();
amount = reader.ReadInt32();
buffTime = reader.ReadSingle();
}
public void OnReceived()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
if (!NetworkServer.active)
{
return;
}
GameObject val = Util.FindNetworkObject(instanceId);
if ((Object)(object)val == (Object)null)
{
return;
}
CharacterBody component = val.GetComponent<CharacterBody>();
if ((Object)(object)component == (Object)null)
{
return;
}
bool flag = amount <= 0;
if (flag)
{
amount *= -1;
}
for (int i = 0; i < amount; i++)
{
if (flag)
{
component.RemoveBuff((BuffIndex)buffIndex);
}
else if (buffTime > 0f)
{
component.AddTimedBuff((BuffIndex)buffIndex, buffTime);
}
else
{
component.AddBuff((BuffIndex)buffIndex);
}
}
}
public void Serialize(NetworkWriter writer)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
writer.Write(instanceId);
writer.Write(buffIndex);
writer.Write(amount);
writer.Write(buffTime);
}
}
public class TimeScaleChangeNetMessage : INetMessage, ISerializableObject
{
public float timeScaleChangeAmount;
public TimeScaleChangeNetMessage(float value)
{
timeScaleChangeAmount = value;
}
public TimeScaleChangeNetMessage()
{
}
public void Deserialize(NetworkReader reader)
{
timeScaleChangeAmount = reader.ReadSingle();
}
public void OnReceived()
{
Time.timeScale = timeScaleChangeAmount;
}
public void Serialize(NetworkWriter writer)
{
writer.Write(timeScaleChangeAmount);
}
}
public class Assets
{
public struct EntityStateMachineAdditionInfo
{
public string entityStateMachineName;
public Type initialStateType;
public Type mainStateType;
}
public static ModdedBodyFlag SprintAllTime = CharacterBodyAPI.ReserveBodyFlag();
public static ModdedBodyFlag ImmuneToVoidFog = CharacterBodyAPI.ReserveBodyFlag();
public static BuffDef BunnyHopBuff = Utils.CreateBuff("bapiBunnyHop", null, Color.white, canStack: false, isDebuff: false, isCooldown: false, isHidden: true, ignoreGrowthNectar: true);
public static BuffDef StrafeBuff = Utils.CreateBuff("bapiStrafing", null, Color.white, canStack: false, isDebuff: false, isCooldown: false, isHidden: true, ignoreGrowthNectar: true);
}
public interface IOnProjectileExplosionDetonate
{
void OnProjectileExplosionDetonate(BlastAttack blastAttack, Result result);
}
[RequireComponent(typeof(ProjectileExplosion))]
public class RocketJumpComponent : MonoBehaviour, IOnProjectileExplosionDetonate
{
public enum RocketJumpFiltering
{
OnlySelf,
OnlyTeammates,
Everyone
}
public float force = 3000f;
public AnimationCurve verticalForceReduction = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
public float radiusMultiplier = 1.25f;
public bool disableAirControl = true;
public bool applyStrafing = true;
public RocketJumpFiltering rocketJumpFiltering;
public void OnProjectileExplosionDetonate(BlastAttack blastAttack, Result result)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
//IL_0275: Unknown result type (might be due to invalid IL or missing references)
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: Unknown result type (might be due to invalid IL or missing references)
Collider[] array = Physics.OverlapSphere(blastAttack.position, blastAttack.radius * radiusMultiplier);
List<CharacterBody> list = new List<CharacterBody>();
Collider[] array2 = array;
Vector3 val3 = default(Vector3);
foreach (Collider val in array2)
{
CharacterBody body = ((Component)val).GetComponent<CharacterBody>();
if (!Object.op_Implicit((Object)(object)body) || list.Contains(body))
{
continue;
}
list.Add(body);
bool flag = false;
switch (rocketJumpFiltering)
{
case RocketJumpFiltering.Everyone:
flag = true;
break;
case RocketJumpFiltering.OnlyTeammates:
if (Object.op_Implicit((Object)(object)body.teamComponent) && body.teamComponent.teamIndex == blastAttack.teamIndex)
{
flag = true;
}
break;
case RocketJumpFiltering.OnlySelf:
if (Object.op_Implicit((Object)(object)blastAttack.attacker) && (Object)(object)((Component)body).gameObject == (Object)(object)blastAttack.attacker)
{
flag = true;
}
break;
}
if (!flag)
{
continue;
}
Bounds bounds = val.bounds;
Vector3 val2 = ((Bounds)(ref bounds)).center - blastAttack.position;
Vector3 normalized = ((Vector3)(ref val2)).normalized;
((Vector3)(ref val3))..ctor(normalized.x, 0f, normalized.z);
float num = Vector3.Angle(normalized, val3);
float num2 = num / 90f;
float num3 = verticalForceReduction.Evaluate(num2);
normalized.y *= verticalForceReduction.Evaluate(num2);
if (Object.op_Implicit((Object)(object)body.characterMotor))
{
if (body.characterMotor.velocity.y < 0f)
{
body.characterMotor.velocity.y = 0f;
}
body.characterMotor.ApplyForce(normalized * force, true, disableAirControl);
}
else if (Object.op_Implicit((Object)(object)body.rigidbody))
{
if (body.characterMotor.velocity.y < 0f)
{
body.rigidbody.velocity = new Vector3(body.rigidbody.velocity.x, 0f, body.rigidbody.velocity.y);
}
body.rigidbody.AddForce(normalized * force, (ForceMode)1);
}
if (applyStrafing && Object.op_Implicit((Object)(object)body.characterMotor) && body.GetBuffCount(Assets.StrafeBuff) <= 0)
{
body.AddBuff(Assets.StrafeBuff);
body.characterMotor.AddOnHitGroundServerDelegate(sus);
}
void sus(CharacterMotor characterMotor, ref HitGroundInfo hitGroundInfo)
{
body.characterMotor.RemoveOnHitGroundServerDelegate(sus);
body.RemoveBuff(Assets.StrafeBuff);
}
}
}
}
[RequireComponent(typeof(ProjectileController))]
[RequireComponent(typeof(Rigidbody))]
public class GuidedProjectile : MonoBehaviour
{
public Rigidbody rigidbody;
public ProjectileController projectileController;
public float guidingPower = 15f;
[HideInInspector]
public InputBankTest inputBankTest;
public void Start()
{
ProjectileController obj = projectileController;
inputBankTest = ((obj != null) ? obj.owner.GetComponent<InputBankTest>() : null);
}
public void FixedUpdate()
{
//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)
//IL_006d: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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)
if (Object.op_Implicit((Object)(object)inputBankTest) && Object.op_Implicit((Object)(object)rigidbody))
{
Vector3 val = inputBankTest.aimDirection;
RaycastHit val2 = default(RaycastHit);
if (inputBankTest.GetAimRaycast(1024f, ref val2))
{
val = ((RaycastHit)(ref val2)).point - ((Component)this).transform.position;
}
rigidbody.velocity = Vector3.RotateTowards(rigidbody.velocity, val, 0.2631579f, 0f);
}
}
}
public static class Utils
{
public static BuffDef CreateBuff(string name, Sprite icon, Color color, bool canStack, bool isDebuff, bool isCooldown, bool isHidden, bool ignoreGrowthNectar)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
((Object)val).name = name;
val.buffColor = color;
val.canStack = canStack;
val.isDebuff = isDebuff;
val.ignoreGrowthNectar = ignoreGrowthNectar;
val.iconSprite = icon;
val.isHidden = isHidden;
val.isCooldown = isCooldown;
ContentPacks.buffs.Add(val);
return val;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static int SuperRoll(float chance)
{
int num = (int)MathF.Floor(chance / 100f);
if (Util.CheckRoll(chance - (float)(num * 100), 0f, (CharacterMaster)null))
{
num++;
}
return num;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float ConvertAmplificationPercentageIntoReductionPercentage(float amplificationPercentage, float maxChance)
{
return (1f - maxChance / (maxChance + amplificationPercentage)) * maxChance;
}
public static EntityStateMachine AddEntityStateMachine(CharacterBody characterBody, Assets.EntityStateMachineAdditionInfo entityStateMachineAdditionInfo)
{
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
NetworkStateMachine component = ((Component)characterBody).GetComponent<NetworkStateMachine>();
List<EntityStateMachine> list = (Object.op_Implicit((Object)(object)component) ? component.stateMachines.ToList() : null);
EntityStateMachine val = ((Component)characterBody).gameObject.AddComponent<EntityStateMachine>();
SerializableEntityStateType mainStateType = default(SerializableEntityStateType);
((SerializableEntityStateType)(ref mainStateType))..ctor(entityStateMachineAdditionInfo.mainStateType ?? typeof(Idle));
SerializableEntityStateType initialStateType = default(SerializableEntityStateType);
((SerializableEntityStateType)(ref initialStateType))..ctor(entityStateMachineAdditionInfo.initialStateType ?? typeof(Idle));
val.mainStateType = mainStateType;
val.initialStateType = initialStateType;
val.customName = entityStateMachineAdditionInfo.entityStateMachineName;
if (Object.op_Implicit((Object)(object)component))
{
list.Add(val);
val.networkIndex = component.stateMachines.Length;
val.networker = component;
val.networkIdentity = component.networkIdentity;
}
if (Object.op_Implicit((Object)(object)component))
{
component.stateMachines = list.ToArray();
}
return val;
}
public static List<EntityStateMachine> AddEntityStateMachines(CharacterBody characterBody, List<Assets.EntityStateMachineAdditionInfo> entityStateMachineAdditionInfos)
{
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
NetworkStateMachine component = ((Component)characterBody).GetComponent<NetworkStateMachine>();
List<EntityStateMachine> list = (Object.op_Implicit((Object)(object)component) ? component.stateMachines.ToList() : null);
List<EntityStateMachine> list2 = new List<EntityStateMachine>();
SerializableEntityStateType mainStateType = default(SerializableEntityStateType);
SerializableEntityStateType initialStateType = default(SerializableEntityStateType);
foreach (Assets.EntityStateMachineAdditionInfo entityStateMachineAdditionInfo in entityStateMachineAdditionInfos)
{
EntityStateMachine val = ((Component)characterBody).gameObject.AddComponent<EntityStateMachine>();
((SerializableEntityStateType)(ref mainStateType))..ctor(entityStateMachineAdditionInfo.mainStateType ?? typeof(Idle));
((SerializableEntityStateType)(ref initialStateType))..ctor(entityStateMachineAdditionInfo.initialStateType ?? typeof(Idle));
val.mainStateType = mainStateType;
val.initialStateType = initialStateType;
val.customName = entityStateMachineAdditionInfo.entityStateMachineName;
list2.Add(val);
if (Object.op_Implicit((Object)(object)component))
{
list.Add(val);
val.networkIndex = component.stateMachines.Length;
val.networker = component;
val.networkIdentity = component.networkIdentity;
}
}
if (Object.op_Implicit((Object)(object)component))
{
component.stateMachines = list.ToArray();
}
return list2;
}
public static void ChangeTimescaleForAllClients(float value)
{
new TimeScaleChangeNetMessage(value);
}
}
public class ContentPacks : IContentPackProvider
{
internal ContentPack contentPack = new ContentPack();
public static List<GameObject> bodies = new List<GameObject>();
public static List<BuffDef> buffs = new List<BuffDef>();
public static List<SkillDef> skills = new List<SkillDef>();
public static List<SkillFamily> skillFamilies = new List<SkillFamily>();
public static List<GameObject> projectiles = new List<GameObject>();
public static List<GameObject> networkPrefabs = new List<GameObject>();
public static List<SurvivorDef> survivors = new List<SurvivorDef>();
public static List<Type> states = new List<Type>();
public static List<NetworkSoundEventDef> sounds = new List<NetworkSoundEventDef>();
public static List<UnlockableDef> unlockableDefs = new List<UnlockableDef>();
public static List<GameObject> masters = new List<GameObject>();
public static List<ItemDef> items = new List<ItemDef>();
public static List<EquipmentDef> equipments = new List<EquipmentDef>();
public static List<EliteDef> elites = new List<EliteDef>();
public string identifier => "com.brynzananas.brynzaapi.ContentProvider";
public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
{
args.ReportProgress(1f);
yield break;
}
public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
{
ContentPack.Copy(contentPack, args.output);
args.ReportProgress(1f);
yield break;
}
public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
{
contentPack.identifier = identifier;
contentPack.skillDefs.Add(skills.ToArray());
contentPack.skillFamilies.Add(skillFamilies.ToArray());
contentPack.bodyPrefabs.Add(bodies.ToArray());
contentPack.buffDefs.Add(buffs.ToArray());
contentPack.projectilePrefabs.Add(projectiles.ToArray());
contentPack.survivorDefs.Add(survivors.ToArray());
contentPack.entityStateTypes.Add(states.ToArray());
contentPack.networkSoundEventDefs.Add(sounds.ToArray());
contentPack.networkedObjectPrefabs.Add(networkPrefabs.ToArray());
contentPack.unlockableDefs.Add(unlockableDefs.ToArray());
contentPack.masterPrefabs.Add(masters.ToArray());
contentPack.itemDefs.Add(items.ToArray());
contentPack.equipmentDefs.Add(equipments.ToArray());
contentPack.eliteDefs.Add(elites.ToArray());
yield break;
}
}
public static class Extensions
{
public static void AddExtraSkill(this GenericSkill skill, GenericSkill extraSkill)
{
BrynzaInterop.AddExtraSkill(skill, extraSkill);
}
public static List<GenericSkill> GetExtraSkills(this GenericSkill skill)
{
return BrynzaInterop.GetExtraSkills(skill);
}
public static void RemoveExtraSkill(this GenericSkill skill, GenericSkill extraSkill)
{
BrynzaInterop.RemoveExtraSkill(skill, extraSkill);
}
public static void LinkSkill(this GenericSkill genericSkill, GenericSkill linkSKill)
{
BrynzaInterop.LinkSkill(genericSkill, (object)linkSKill);
}
public static GenericSkill GetLinkedSkill(this GenericSkill genericSkill)
{
return BrynzaInterop.GetLinkedSkill(genericSkill);
}
public static void AddBonusSkill(this SkillLocator skillLocator, GenericSkill bonusSkill)
{
BrynzaInterop.AddBonusSkill(skillLocator, bonusSkill);
}
public static void RemoveBonusSkill(this SkillLocator skillLocator, GenericSkill bonusSkill)
{
BrynzaInterop.RemoveBonusSkill(skillLocator, bonusSkill);
}
public static List<GenericSkill> GetBonusSkills(this SkillLocator skillLocator)
{
return BrynzaInterop.GetBonusSkills(skillLocator);
}
public static void SetVelocityOverride(this CharacterMotor characterMotor, Vector3 vector3)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
BrynzaInterop.SetVelocityOverride(characterMotor, vector3);
}
public static Vector3 GetVelocityOverride(this CharacterMotor characterMotor)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return BrynzaInterop.GetVelocityOverride(characterMotor);
}
public static void SetKeepVelocityOnMoving(this CharacterMotor characterMotor, bool flag)
{
BrynzaInterop.SetKeepVelocityOnMoving(characterMotor, flag);
}
public static bool GetKeepVelocityOnMoving(this CharacterMotor characterMotor)
{
return BrynzaInterop.GetKeepVelocityOnMoving(characterMotor);
}
public static void SetConsistentAcceleration(this CharacterMotor characterMotor, float value)
{
BrynzaInterop.SetConsistentAcceleration(characterMotor, value);
}
public static float GetConsistentAcceleration(this CharacterMotor characterMotor)
{
return BrynzaInterop.GetConsistentAcceleration(characterMotor);
}
[Obsolete("Doesn't work as intended", true)]
public static void SetFluidMaxDistanceDelta(this CharacterMotor characterMotor, bool flag)
{
BrynzaInterop.SetFluidMaxDistanceDelta(characterMotor, flag);
}
public static bool GetFluidMaxDistanceDelta(this CharacterMotor characterMotor)
{
return BrynzaInterop.GetFluidMaxDistanceDelta(characterMotor);
}
public static void SetStrafe(this CharacterMotor characterMotor, bool flag)
{
BrynzaInterop.SetStrafe(characterMotor, flag);
}
public static bool GetStrafe(this CharacterMotor characterMotor)
{
return BrynzaInterop.GetStrafe(characterMotor) || (Object.op_Implicit((Object)(object)characterMotor) && Object.op_Implicit((Object)(object)characterMotor.body) && characterMotor.body.GetBuffCount(Assets.StrafeBuff) > 0);
}
public static void SetBunnyHop(this CharacterMotor characterMotor, bool flag)
{
BrynzaInterop.SetBunnyHop(characterMotor, flag);
}
public static bool GetBunnyHop(this CharacterMotor characterMotor)
{
return BrynzaInterop.GetBunnyHop(characterMotor) || (Object.op_Implicit((Object)(object)characterMotor) && Object.op_Implicit((Object)(object)characterMotor.body) && characterMotor.body.GetBuffCount(Assets.BunnyHopBuff) > 0);
}
public static void AddOnHitGroundServerDelegate(this CharacterMotor characterMotor, BrynzaAPI.OnHitGroundServerDelegate hitGroundServerDelegate)
{
BrynzaAPI.onHitGroundServerDictionary.AddValueToListInDictionary(characterMotor, hitGroundServerDelegate);
}
public static void RemoveOnHitGroundServerDelegate(this CharacterMotor characterMotor, BrynzaAPI.OnHitGroundServerDelegate hitGroundServerDelegate)
{
BrynzaAPI.onHitGroundServerDictionary.RemoveValueFromListInDictionary(characterMotor, hitGroundServerDelegate);
}
public static T GetOrAddComponent<T>(this GameObject gameObject) where T : Component
{
return gameObject.GetComponent<T>() ?? gameObject.AddComponent<T>();
}
public static T GetOrAddComponent<T>(this Component component) where T : Component
{
return component.gameObject.GetOrAddComponent<T>();
}
public static T GetOrAddComponent<T>(this Transform transform) where T : Component
{
return ((Component)transform).gameObject.GetOrAddComponent<T>();
}
public static void AddBuffAuthotiry(this CharacterBody characterBody, BuffDef buffDef, int amount)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
characterBody.AddBuffAuthotiry(buffDef.buffIndex, amount);
}
public static void AddBuffAuthotiry(this CharacterBody characterBody, BuffIndex buffIndex, int amount)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
characterBody.AddOrRemoveBuffAuthotiry(buffIndex, amount);
}
public static void RemoveBuffAuthotiry(this CharacterBody characterBody, BuffDef buffDef, int amount)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
characterBody.RemoveBuffAuthotiry(buffDef.buffIndex, amount);
}
public static void RemoveBuffAuthotiry(this CharacterBody characterBody, BuffIndex buffIndex, int amount)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
characterBody.AddOrRemoveBuffAuthotiry(buffIndex, -amount);
}
public static void AddBuffAuthotiry(this CharacterBody characterBody, BuffDef buffDef)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
characterBody.AddBuffAuthotiry(buffDef.buffIndex);
}
public static void AddBuffAuthotiry(this CharacterBody characterBody, BuffIndex buffIndex)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
characterBody.AddOrRemoveBuffAuthotiry(buffIndex, 1);
}
public static void RemoveBuffAuthotiry(this CharacterBody characterBody, BuffDef buffDef)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
characterBody.RemoveBuffAuthotiry(buffDef.buffIndex);
}
public static void RemoveBuffAuthotiry(this CharacterBody characterBody, BuffIndex buffIndex)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
characterBody.AddOrRemoveBuffAuthotiry(buffIndex, -1);
}
public static void AddOrRemoveBuffAuthotiry(this CharacterBody characterBody, BuffDef buffDef, int amount)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
characterBody.AddOrRemoveBuffAuthotiry(buffDef.buffIndex, amount);
}
public static void AddOrRemoveBuffAuthotiry(this CharacterBody characterBody, BuffIndex buffIndex, int amount)
{
//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)
NetMessageExtensions.Send((INetMessage)(object)new AddBuffNetMessage(((NetworkBehaviour)characterBody).netId, buffIndex, amount, -1f), (NetworkDestination)2);
}
public static void AddTimedBuffAuthotiry(this CharacterBody characterBody, BuffDef buffDef, int amount, float duration)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
characterBody.AddTimedBuffAuthotiry(buffDef.buffIndex, amount, duration);
}
public static void AddTimedBuffAuthotiry(this CharacterBody characterBody, BuffIndex buffIndex, int amount, float duration)
{
//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)
NetMessageExtensions.Send((INetMessage)(object)new AddBuffNetMessage(((NetworkBehaviour)characterBody).netId, buffIndex, amount, duration), (NetworkDestination)2);
}
public static void ChangeTimescaleForAllClients(this Time time, float value)
{
Utils.ChangeTimescaleForAllClients(value);
}
public static bool MatchStfldOut<T>(this Instruction instr, string name, out ILLabel iLLabel)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
FieldReference val = default(FieldReference);
if (ILPatternMatchingExt.MatchStfld(instr, ref val))
{
iLLabel = (ILLabel)instr.Operand;
return Extensions.Is((MemberReference)(object)val, typeof(T), name);
}
iLLabel = null;
return false;
}
public static void AddValueToListInDictionary<T1, T2>(this Dictionary<T1, List<T2>> keyValuePairs, T1 t1, T2 t2)
{
if (keyValuePairs.ContainsKey(t1))
{
keyValuePairs[t1].Add(t2);
return;
}
List<T2> value = new List<T2>(1) { t2 };
keyValuePairs.Add(t1, value);
}
public static void RemoveValueFromListInDictionary<T1, T2>(this Dictionary<T1, List<T2>> keyValuePairs, T1 t1, T2 t2)
{
if (keyValuePairs.ContainsKey(t1))
{
keyValuePairs[t1].Remove(t2);
if (keyValuePairs[t1].Count <= 0)
{
keyValuePairs.Remove(t1);
}
}
}
internal static BrynzaAPI.ModMetaData GetModMetaData(this Assembly assembly)
{
BrynzaAPI.ModMetaData result = default(BrynzaAPI.ModMetaData);
Type[] exportedTypes = assembly.GetExportedTypes();
Type[] array = exportedTypes;
foreach (Type element in array)
{
BepInPlugin customAttribute = ((MemberInfo)element).GetCustomAttribute<BepInPlugin>();
if (customAttribute != null)
{
result.Guid = customAttribute.GUID;
result.Name = customAttribute.Name;
}
}
return result;
}
}
}