using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading.Tasks;
using System.Timers;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using SCP999Mod.Patches;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("SCP999Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SCP999Mod")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8f5e3554-359c-481e-b308-0860a9fed6af")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace SCP999Mod
{
[BepInPlugin("Tomato.SCP999", "SCP-999 Mod", "1.5.0")]
public class SCP999Mod : BaseUnityPlugin
{
private const string modGUID = "Tomato.SCP999";
private const string modName = "SCP-999 Mod";
private const string modVersion = "1.5.0";
private readonly Harmony harmony = new Harmony("Tomato.SCP999");
private static SCP999Mod Instance;
internal ManualLogSource mls;
internal static List<AudioClip> SoundFx;
internal static AssetBundle Bundle;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Tomato.SCP999");
mls.LogInfo((object)"SCP-999 mod loaded");
SoundFx = new List<AudioClip>();
harmony.PatchAll(typeof(SCP999Mod));
string location = ((BaseUnityPlugin)Instance).Info.Location;
location = location.TrimEnd("SCP999Mod.dll".ToCharArray());
Bundle = AssetBundle.LoadFromFile(location + "scp999");
if ((Object)(object)Bundle != (Object)null)
{
mls.LogInfo((object)"SCP-999 Asset Bundle loaded!");
SoundFx = Bundle.LoadAllAssets<AudioClip>().ToList();
}
else
{
mls.LogInfo((object)"SCP-999 Asset Bundle failed to load!");
}
harmony.PatchAll(typeof(EnemyDamagePatches));
harmony.PatchAll(typeof(BlobPatches));
harmony.PatchAll(typeof(BlobSoundPatches));
}
}
}
namespace SCP999Mod.Properties
{
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
ResourceManager resourceManager = new ResourceManager("SCP999Mod.Properties.Resources", typeof(Resources).Assembly);
resourceMan = resourceManager;
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal static string _999Sounds => ResourceManager.GetString("999Sounds", resourceCulture);
internal Resources()
{
}
}
}
namespace SCP999Mod.Patches
{
[HarmonyPatch(typeof(BlobAI))]
internal class BlobPatches
{
private static int _gradientColorProperty = Shader.PropertyToID("_Gradient_Color");
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void StartPrefix(BlobAI __instance)
{
//IL_000c: 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_0016: Unknown result type (might be due to invalid IL or missing references)
__instance.thisSlimeMaterial.SetColor(_gradientColorProperty, Color.yellow - Color.black);
}
}
[HarmonyPatch(typeof(BlobAI))]
internal class BlobSoundPatches
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void StartPrefix(BlobAI __instance)
{
__instance.jiggleSFX = SCP999Mod.SoundFx[0];
__instance.agitatedSFX = SCP999Mod.SoundFx[0];
__instance.idleSFX = SCP999Mod.SoundFx[0];
}
}
[HarmonyPatch]
internal class EnemyDamagePatches
{
private static Timer _delayTimer;
private static bool isSpeedChanged;
private static IEnumerable<MethodBase> TargetMethods()
{
return typeof(BlobAI).GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
}
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator ilGenerator)
{
MethodInfo damagePlayerMethod = AccessTools.Method(typeof(PlayerControllerB), "DamagePlayer", (Type[])null, (Type[])null);
MethodInfo damagePlayerRedirect = AccessTools.Method(typeof(EnemyDamagePatches), "InterceptBlobDamage", (Type[])null, (Type[])null);
foreach (CodeInstruction instruction in instructions)
{
if (instruction.opcode == OpCodes.Callvirt && instruction.operand == damagePlayerMethod)
{
yield return new CodeInstruction(OpCodes.Call, (object)damagePlayerRedirect);
}
else
{
yield return instruction;
}
}
}
private static void InterceptBlobDamage(PlayerControllerB player, int damageNumber, bool hasDamageSFX, bool callRPC, CauseOfDeath causeOfDeath, int deathAnimation, bool fallDamage, Vector3 force)
{
changePlayerSpeedUP(player);
Task.Delay(5000).ContinueWith(delegate
{
changePlayerSpeedDOWN(player);
});
}
private static void changePlayerSpeedUP(PlayerControllerB player)
{
player.movementSpeed = 6f;
}
private static void changePlayerSpeedDOWN(PlayerControllerB player)
{
player.movementSpeed = 4.6f;
}
}
}