using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Video;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("ArachnophobiaMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A Lethal Company mod that replaces spiders with cats (model and sounds)")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ArachnophobiaMod")]
[assembly: AssemblyTitle("ArachnophobiaMod")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace ArachnophobiaMod
{
[BepInPlugin("com.github.rashnain.arachnophobiamod", "ArachnophobiaMod", "1.0.1")]
public class Plugin : BaseUnityPlugin
{
private const string GUID = "com.github.rashnain.arachnophobiamod";
private const string Name = "ArachnophobiaMod";
private const string Version = "1.0.1";
private static readonly Harmony Harmony = new Harmony("com.github.rashnain.arachnophobiamod");
internal static ManualLogSource Log;
internal static GameObject Cat;
internal static VideoClip CatVideo;
internal static AudioClip CatStunSFX;
internal static AudioClip CatHitSFX;
internal static AudioClip CatDieSFX;
internal static AudioClip CatAttackSFX;
internal static AudioClip SpoolPlayerSFX;
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
AssetBundle val = AssetBundle.LoadFromMemory(GetResourceBytes("cat"));
Cat = val.LoadAsset<GameObject>("assets/Cat.prefab");
CatVideo = val.LoadAsset<VideoClip>("assets/CatVideo0001-0100.mp4");
CatStunSFX = val.LoadAsset<AudioClip>("assets/StunCat.mp3");
CatHitSFX = val.LoadAsset<AudioClip>("assets/CatHit.mp3");
CatDieSFX = val.LoadAsset<AudioClip>("assets/CatDie.mp3");
CatAttackSFX = val.LoadAsset<AudioClip>("assets/CatAttack.mp3");
SpoolPlayerSFX = val.LoadAsset<AudioClip>("assets/SpoolPlayerInWebWithoutStepSound.mp3");
Harmony.PatchAll();
}
private static byte[] GetResourceBytes(string resourceName)
{
string name = "ArachnophobiaMod.Resources." + resourceName;
using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name);
if (stream == null)
{
return null;
}
byte[] array = new byte[stream.Length];
return (stream.Read(array, 0, array.Length) < array.Length) ? null : array;
}
}
}
namespace ArachnophobiaMod.Patches
{
[HarmonyPatch]
internal class SandSpiderAIPatch
{
private static Dictionary<SandSpiderAI, float> _timeSinceMovingLegs;
[HarmonyPatch(typeof(SandSpiderAI), "Start")]
[HarmonyPrefix]
public static void Start(SandSpiderAI __instance)
{
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
if (_timeSinceMovingLegs == null)
{
_timeSinceMovingLegs = new Dictionary<SandSpiderAI, float>();
}
_timeSinceMovingLegs.Add(__instance, Random.Range(0.1f, 0.9f));
((Renderer)((Component)((Component)__instance).gameObject.transform.Find("MeshContainer/MeshRenderer")).gameObject.GetComponent<SkinnedMeshRenderer>()).enabled = false;
Transform val = ((Component)__instance).gameObject.transform.Find("MeshContainer/AnimContainer/Armature/Head");
((Renderer)((Component)val.Find("LeftFang")).gameObject.GetComponent<MeshRenderer>()).enabled = false;
((Renderer)((Component)val.Find("RightFang")).gameObject.GetComponent<MeshRenderer>()).enabled = false;
GameObject val2 = Object.Instantiate<GameObject>(Plugin.Cat, ((Component)__instance).gameObject.transform.Find("MeshContainer/ScanNode"));
val2.transform.localScale = new Vector3(5f, 2.5f, 5f);
val2.transform.localPosition = new Vector3(0f, 1f, -0.5f);
Material material = ((Renderer)((Component)val).gameObject.GetComponentInChildren<MeshRenderer>()).material;
Material material2 = ((Renderer)val2.GetComponent<MeshRenderer>()).material;
material2.shader = material.shader;
material2.renderQueue = material.renderQueue;
((EnemyAI)__instance).enemyType.stunSFX = Plugin.CatStunSFX;
__instance.hitSpiderSFX = Plugin.CatHitSFX;
((EnemyAI)__instance).dieSFX = Plugin.CatDieSFX;
__instance.attackSFX = Plugin.CatAttackSFX;
__instance.spoolPlayerSFX = Plugin.SpoolPlayerSFX;
}
[HarmonyPatch(typeof(SandSpiderAI), "Update")]
[HarmonyPostfix]
public static void Update(SandSpiderAI __instance)
{
_timeSinceMovingLegs[__instance] += Time.deltaTime;
}
[HarmonyPatch(typeof(SandSpiderAI), "MoveLegsProcedurally")]
[HarmonyPrefix]
public static bool MoveLegsProcedurally(SandSpiderAI __instance)
{
if (_timeSinceMovingLegs[__instance] <= 0.2f)
{
return false;
}
_timeSinceMovingLegs[__instance] = 0f;
return true;
}
[HarmonyPatch(typeof(SandSpiderAI), "KillEnemy")]
[HarmonyPostfix]
public static void KillEnemy(SandSpiderAI __instance, object[] __args)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: 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)
Transform transform = ((Component)((Component)__instance).gameObject.transform.Find("MeshContainer/ScanNode/Cat(Clone)")).transform;
Vector3 localEulerAngles = transform.localEulerAngles;
transform.localEulerAngles = new Vector3(localEulerAngles.x, localEulerAngles.y, -90f);
transform.localPosition = new Vector3(0f, 0f, 0f);
}
}
[HarmonyPatch]
internal class TerminalPatch
{
[HarmonyPatch(typeof(Terminal), "Awake")]
[HarmonyPostfix]
public static void Awake(Terminal __instance)
{
__instance.enemyFiles[12].displayVideo = Plugin.CatVideo;
}
}
}