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 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 R2API;
using R2API.Utils;
using RoR2;
using RoR2.CameraModes;
using RoR2.ConVar;
using RoR2.ContentManagement;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
[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+cab65333c243d4db99daa50c3155bc85ca57d628")]
[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.1.0")]
[BepInDependency("com.bepis.r2api", "5.0.10")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
public class BrynzaAPI : BaseUnityPlugin
{
public delegate void OnHitGroundDelegate(CharacterMotor characterMotor, ref HitGroundInfo hitGroundInfo);
[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 const string ModGuid = "com.brynzananas.brynzaapi";
public const string ModName = "Brynza API";
public const string ModVer = "1.1.0";
public static Dictionary<CharacterMotor, List<OnHitGroundDelegate>> onHitGroundServerDictionary = new Dictionary<CharacterMotor, List<OnHitGroundDelegate>>();
private bool hooksEnabled = false;
public void Awake()
{
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_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);
}
}
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<OnHitGroundDelegate> 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_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);
}
}
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!"));
}
}
}
public class Assets
{
public struct EntityStateMachineAddition
{
public string entityStateMachineName;
public Type initialStateType;
public Type mainStateType;
}
public static ModdedBodyFlag SprintAllTime = 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);
}
public class RocketJumpComponent : MonoBehaviour, IOnProjectileExplosionDetonate
{
public enum RocketJumpFiltering
{
OnlySelf,
OnlyTeammates,
Everyone
}
public float force = 3000f;
public AnimationCurve verticalForceReduction;
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_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_021f: Unknown result type (might be due to invalid IL or missing references)
//IL_0227: Unknown result type (might be due to invalid IL or missing references)
//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
//IL_0295: Unknown result type (might be due to invalid IL or missing references)
//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
Collider[] array = Physics.OverlapSphere(blastAttack.position, blastAttack.radius * radiusMultiplier, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.playerBody)).mask) + LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.enemyBody)).mask), (QueryTriggerInteraction)0);
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);
BrynzaAPI.onHitGroundServerDictionary.AddValueToListInDictionary(body.characterMotor, sus);
}
void sus(CharacterMotor characterMotor, ref HitGroundInfo hitGroundInfo)
{
BrynzaAPI.onHitGroundServerDictionary.RemoveValueFromListInDictionary(body.characterMotor, sus);
body.RemoveBuff(Assets.StrafeBuff);
}
}
}
}
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.EntityStateMachineAddition entityStateMachineAddition)
{
//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(entityStateMachineAddition.mainStateType ?? typeof(Idle));
SerializableEntityStateType initialStateType = default(SerializableEntityStateType);
((SerializableEntityStateType)(ref initialStateType))..ctor(entityStateMachineAddition.initialStateType ?? typeof(Idle));
val.mainStateType = mainStateType;
val.initialStateType = initialStateType;
val.customName = entityStateMachineAddition.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.EntityStateMachineAddition> entityStateMachineAdditions)
{
//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.EntityStateMachineAddition entityStateMachineAddition in entityStateMachineAdditions)
{
EntityStateMachine val = ((Component)characterBody).gameObject.AddComponent<EntityStateMachine>();
((SerializableEntityStateType)(ref mainStateType))..ctor(entityStateMachineAddition.mainStateType ?? typeof(Idle));
((SerializableEntityStateType)(ref initialStateType))..ctor(entityStateMachineAddition.initialStateType ?? typeof(Idle));
val.mainStateType = mainStateType;
val.initialStateType = initialStateType;
val.customName = entityStateMachineAddition.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 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);
}
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.OnHitGroundDelegate hitGroundDelegate)
{
BrynzaAPI.onHitGroundServerDictionary.AddValueToListInDictionary(characterMotor, hitGroundDelegate);
}
public static void RemoveOnHitGroundServerDelegate(this CharacterMotor characterMotor, BrynzaAPI.OnHitGroundDelegate hitGroundDelegate)
{
BrynzaAPI.onHitGroundServerDictionary.RemoveValueFromListInDictionary(characterMotor, hitGroundDelegate);
}
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 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);
}
}
}
}
}