using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
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: AssemblyVersion("0.0.0.0")]
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 A_1)
{
Version = A_1;
}
}
}
namespace EightLegMod
{
[BepInPlugin("BozakJay.EightLegMod", "EightLegMod", "1.0.0")]
public class EightLegModBase : BaseUnityPlugin
{
private const string modGUID = "BozakJay.EightLegMod";
private const string modName = "EightLegMod";
private const string modVersion = "1.0.0";
private static readonly Harmony Harmony = new Harmony("BozakJay.EightLegMod");
internal static ManualLogSource Log;
internal static GameObject ChineseMan;
internal static VideoClip ChineseManVideo;
internal static AudioClip ChineseManStunSFX;
internal static AudioClip ChineseManHitSFX;
internal static AudioClip ChineseManDieSFX;
internal static AudioClip ChineseManAttackSFX;
internal static AudioClip SpoolPlayerSFX;
internal static AudioClip[] footstepSFX = (AudioClip[])(object)new AudioClip[1];
private static EightLegModBase Instance;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
AssetBundle val = AssetBundle.LoadFromMemory(GetResourceBytes("ChineseMan"));
ChineseMan = val.LoadAsset<GameObject>("Assets/ChineseManPre.prefab");
ChineseManVideo = val.LoadAsset<VideoClip>("assets/ChineseManVideo.mp4");
ChineseManStunSFX = val.LoadAsset<AudioClip>("Assets/ChineseMan_stun.wav");
ChineseManHitSFX = val.LoadAsset<AudioClip>("Assets/ChineseMan_hit.wav");
ChineseManDieSFX = val.LoadAsset<AudioClip>("Assets/ChineseMan_die.wav");
ChineseManAttackSFX = val.LoadAsset<AudioClip>("Assets/ChineseMan_hiss.wav");
SpoolPlayerSFX = val.LoadAsset<AudioClip>("Assets/ChineseMan_hiss.wav");
footstepSFX[0] = val.LoadAsset<AudioClip>("Assets/ChineseMan_walk.wav");
Harmony.PatchAll();
}
private static byte[] GetResourceBytes(string resourceName)
{
string name = "EightLegMod.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 EightLegMod.Patches
{
[HarmonyPatch]
internal class SandSpiderAIPatch
{
private static Dictionary<SandSpiderAI, float> _timeSinceMovingLegs;
public static float degreesPerSecond = 20f;
[HarmonyPatch(typeof(SandSpiderAI), "Start")]
[HarmonyPrefix]
public static void Start(SandSpiderAI __instance)
{
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: 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>(EightLegModBase.ChineseMan, ((Component)__instance).gameObject.transform.Find("MeshContainer/ScanNode"));
((Component)__instance).transform.rotation = Quaternion.identity;
val2.transform.rotation = Quaternion.Euler(-90f, 0f, 0f);
val2.transform.localScale = new Vector3(5f, 5f, 5f);
val2.transform.localPosition = new Vector3(0f, 0.5f, 0f);
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 = EightLegModBase.ChineseManStunSFX;
__instance.hitSpiderSFX = EightLegModBase.ChineseManHitSFX;
((EnemyAI)__instance).dieSFX = EightLegModBase.ChineseManDieSFX;
__instance.attackSFX = EightLegModBase.ChineseManAttackSFX;
__instance.spoolPlayerSFX = EightLegModBase.SpoolPlayerSFX;
__instance.footstepSFX = EightLegModBase.footstepSFX;
}
[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)
{
//IL_002c: 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_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: 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_006b: Unknown result type (might be due to invalid IL or missing references)
Transform transform = ((Component)((Component)__instance).gameObject.transform.Find("MeshContainer/ScanNode/spiderPre(Clone)")).transform;
transform.rotation = Quaternion.Euler(90f, 0f, 0f);
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 = EightLegModBase.ChineseManVideo;
}
}
}
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}