using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BSCP.Patches;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using MonoMod.RuntimeDetour.HookGen;
using On;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Zethtar.BSCP")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a980a023aa24514586d04502a31f67d8a225aebd")]
[assembly: AssemblyProduct("BSCP")]
[assembly: AssemblyTitle("Zethtar.BSCP")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BSCP
{
[ContentWarningPlugin("Zethtar.BSCP", "1.0.0", false)]
[BepInPlugin("Zethtar.BSCP", "BSCP", "1.0.0")]
public class BSCP : BaseUnityPlugin
{
public static BSCP Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
internal static BSCPConfig BoundConfig { get; private set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
BoundConfig = new BSCPConfig(((BaseUnityPlugin)this).Config);
HookAll();
Logger.LogInfo((object)"Zethtar.BSCP v1.0.0 has loaded!");
}
internal static void HookAll()
{
Logger.LogDebug((object)"Hooking...");
BigSlapPatch.Init();
Logger.LogDebug((object)"Finished Hooking!");
}
internal static void UnhookAll()
{
Logger.LogDebug((object)"Unhooking...");
HookEndpointManager.RemoveAllOwnedBy((object)Assembly.GetExecutingAssembly());
Logger.LogDebug((object)"Finished Unhooking!");
}
}
internal class BSCPConfig
{
public readonly ConfigEntry<float> movementMultiplier;
public readonly ConfigEntry<float> sprintMultiplier;
public readonly ConfigEntry<bool> enableTemporaryFreeze;
public readonly ConfigEntry<float> freezeTime;
public BSCPConfig(ConfigFile cfg)
{
cfg.SaveOnConfigSet = false;
movementMultiplier = cfg.Bind<float>("General", "MovementMultiplier", 1f, "Base Movement Multiplier");
sprintMultiplier = cfg.Bind<float>("General", "SprintMultiplier", 0.75f, "Sprint Multiplier (when chasing a player). This multiplier is a multiplier to the actual sprint multiplier of the monster. So with a SprintMultiplier of 0.75, the final multiplier will be 4.5 * 0.75 = 3.375. Big slaps would run 3.375 times faster than they walk.");
enableTemporaryFreeze = cfg.Bind<bool>("General.Freeze", "EnableTemporaryFreeze", false, "If enabled, Big Slaps will be frozen for {freezeTime} seconds when it spawns, giving players a chance to run for the diving bell. A sound will also be played on spawn to warn players");
freezeTime = cfg.Bind<float>("General.Freeze", "FreezeTime", 60f, "Duration of the freeze in seconds");
cfg.Save();
cfg.SaveOnConfigSet = true;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Zethtar.BSCP";
public const string PLUGIN_NAME = "BSCP";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace BSCP.Patches
{
public class BigSlapPatch
{
[CompilerGenerated]
private static class <>O
{
public static hook_Start <0>__BigSlap_Start_Nerf;
public static hook_Start <1>__BigSlap_Start_WarnAndFreeze;
public static hook_ComputeState <2>__BigSlap_ComputeState_WarnAndFreeze;
}
private static Dictionary<Bot_BigSlap, float> containedMonsters = new Dictionary<Bot_BigSlap, float>();
internal static void Init()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
object obj = <>O.<0>__BigSlap_Start_Nerf;
if (obj == null)
{
hook_Start val = BigSlap_Start_Nerf;
<>O.<0>__BigSlap_Start_Nerf = val;
obj = (object)val;
}
Bot_BigSlap.Start += (hook_Start)obj;
if (BSCP.BoundConfig.enableTemporaryFreeze.Value)
{
object obj2 = <>O.<1>__BigSlap_Start_WarnAndFreeze;
if (obj2 == null)
{
hook_Start val2 = BigSlap_Start_WarnAndFreeze;
<>O.<1>__BigSlap_Start_WarnAndFreeze = val2;
obj2 = (object)val2;
}
Bot_BigSlap.Start += (hook_Start)obj2;
object obj3 = <>O.<2>__BigSlap_ComputeState_WarnAndFreeze;
if (obj3 == null)
{
hook_ComputeState val3 = BigSlap_ComputeState_WarnAndFreeze;
<>O.<2>__BigSlap_ComputeState_WarnAndFreeze = val3;
obj3 = (object)val3;
}
Bot_BigSlap.ComputeState += (hook_ComputeState)obj3;
}
}
private static void BigSlap_Start_Nerf(orig_Start orig, Bot_BigSlap self)
{
orig.Invoke(self);
GameObject gameObject = ((Component)((Component)self).transform.parent).gameObject;
PlayerController component = gameObject.GetComponent<PlayerController>();
if ((Object)(object)component != (Object)null)
{
component.movementForce *= BSCP.BoundConfig.movementMultiplier.Value;
component.sprintMultiplier *= BSCP.BoundConfig.sprintMultiplier.Value;
}
else
{
BSCP.Logger.LogError((object)"Failed to find BigSlap.PlayerController");
}
}
private static void BigSlap_Start_WarnAndFreeze(orig_Start orig, Bot_BigSlap self)
{
orig.Invoke(self);
containedMonsters.TryAdd(self, Time.time + BSCP.BoundConfig.freezeTime.Value);
PlayWarningSound(self);
}
private static void PlayWarningSound(Bot_BigSlap self)
{
//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_0050: 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_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)
//IL_0060: 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_0067: 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_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
Transform parent = ((Component)self).transform.parent;
SFX_PlayOneShot[] componentsInChildren = ((Component)parent).gameObject.GetComponentsInChildren<SFX_PlayOneShot>();
SFX_PlayOneShot[] array = componentsInChildren;
foreach (SFX_PlayOneShot val in array)
{
if (((Object)((Component)val).gameObject).name == "VoiceNotice")
{
Vector3 val2 = Player.localPlayer.HeadPosition();
Vector3 val3 = parent.position - val2;
Vector3 normalized = ((Vector3)(ref val3)).normalized;
Vector3 position = val2 + 5f * normalized;
PlaySFX(val, position);
}
}
}
private static void PlaySFX(SFX_PlayOneShot sfx, Vector3 position)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)sfx.sfx))
{
SFX_Player.instance.PlaySFX(sfx.sfx, position, (Transform)null, (SFX_Settings)null, 1f, false, false, true, 0f, 0);
}
SFX_Instance[] sfxs = sfx.sfxs;
foreach (SFX_Instance val in sfxs)
{
SFX_Player.instance.PlaySFX(val, position, (Transform)null, (SFX_Settings)null, 1f, false, false, true, 0f, 0);
}
}
private static void BigSlap_ComputeState_WarnAndFreeze(orig_ComputeState orig, Bot_BigSlap self)
{
if (containedMonsters.TryGetValue(self, out var value))
{
if (value < Time.time)
{
containedMonsters.Remove(self);
orig.Invoke(self);
}
}
else
{
orig.Invoke(self);
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}