using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DigitalRuby.ThunderAndLightning;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using NeutronaWand;
using NeutronaWand.Components;
using NeutronaWand.Features;
using NeutronaWand.Patches;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Pool;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("NeutronaWand")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NeutronaWand")]
[assembly: AssemblyTitle("NeutronaWand")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
}
}
}
[HarmonyPatch(typeof(PatcherTool), "Start")]
public static class NeutronaWandPatch
{
[HarmonyPostfix]
private static void Postfix(PatcherTool __instance)
{
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
try
{
if ((Object)(object)Plugin.NeutronaWandPrefab != (Object)null)
{
MeshFilter componentInChildren = Plugin.NeutronaWandPrefab.GetComponentInChildren<MeshFilter>();
MeshRenderer componentInChildren2 = Plugin.NeutronaWandPrefab.GetComponentInChildren<MeshRenderer>();
MeshFilter componentInChildren3 = ((Component)__instance).GetComponentInChildren<MeshFilter>();
MeshRenderer componentInChildren4 = ((Component)__instance).GetComponentInChildren<MeshRenderer>();
if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren3 != (Object)null)
{
componentInChildren3.mesh = componentInChildren.sharedMesh;
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)"Successfully replaced PatcherTool mesh");
}
}
else
{
ManualLogSource? logger2 = Plugin.Logger;
if (logger2 != null)
{
logger2.LogError((object)"Could not find MeshFilter components");
}
}
if ((Object)(object)componentInChildren2 != (Object)null && (Object)(object)componentInChildren4 != (Object)null)
{
((Renderer)componentInChildren4).materials = ((Renderer)componentInChildren2).sharedMaterials;
ManualLogSource? logger3 = Plugin.Logger;
if (logger3 != null)
{
logger3.LogInfo((object)"Successfully replaced PatcherTool materials");
}
}
else
{
ManualLogSource? logger4 = Plugin.Logger;
if (logger4 != null)
{
logger4.LogError((object)"Could not find MeshRenderer components");
}
}
BoxCollider val = default(BoxCollider);
if (((Component)__instance).TryGetComponent<BoxCollider>(ref val))
{
BoxCollider obj = val;
Bounds bounds = componentInChildren.sharedMesh.bounds;
obj.center = ((Bounds)(ref bounds)).center;
BoxCollider obj2 = val;
bounds = componentInChildren.sharedMesh.bounds;
obj2.size = ((Bounds)(ref bounds)).size;
}
}
else
{
ManualLogSource? logger5 = Plugin.Logger;
if (logger5 != null)
{
logger5.LogError((object)"NeutronaWandPrefab is null!");
}
}
}
catch (Exception arg)
{
ManualLogSource? logger6 = Plugin.Logger;
if (logger6 != null)
{
logger6.LogError((object)$"Error in NeutronaWandPatch: {arg}");
}
}
}
}
namespace NeutronaWand
{
[HarmonyPatch(typeof(Terminal), "ParseWord")]
internal class TerminalParseWordPatch
{
private static bool Prefix(Terminal __instance, string playerWord, ref TerminalKeyword __result, int specificityRequired = 2)
{
Debug.Log((object)("[Terminal] Attempting to parse: '" + playerWord + "'"));
if (playerWord.Length < specificityRequired)
{
Debug.Log((object)("[Terminal] Word too short: '" + playerWord + "'"));
return true;
}
TerminalKeyword[] allKeywords = __instance.terminalNodes.allKeywords;
foreach (TerminalKeyword val in allKeywords)
{
string text = val.word.ToLower();
string value = playerWord.ToLower();
if (text.StartsWith(value))
{
__result = val;
Debug.Log((object)("[Terminal] Matched '" + playerWord + "' to keyword '" + val.word + "'"));
return false;
}
}
Debug.Log((object)("[Terminal] No match found for: '" + playerWord + "'"));
return true;
}
}
[HarmonyPatch(typeof(Terminal), "Start")]
internal class PatcherToolTerminalPatch
{
[HarmonyPostfix]
[HarmonyPriority(200)]
private static void Postfix(Terminal __instance)
{
Debug.Log((object)"[NeutronaWand] Starting terminal modification...");
bool flag = false;
bool flag2 = false;
Item[] buyableItemsList = __instance.buyableItemsList;
foreach (Item val in buyableItemsList)
{
if (val.itemName.ToLower() == "zap gun" || val.itemName.ToLower() == "patcher tool")
{
Debug.Log((object)"[NeutronaWand] Found item to rename, updating...");
val.itemName = "NeutronaWand";
val.creditsWorth = 30;
flag = true;
}
}
if ((Object)(object)__instance.terminalNodes != (Object)null && __instance.terminalNodes.allKeywords != null)
{
TerminalKeyword[] allKeywords = __instance.terminalNodes.allKeywords;
foreach (TerminalKeyword val2 in allKeywords)
{
if (val2.word.ToLower() == "zap gun" || val2.word.ToLower() == "patcher tool")
{
Debug.Log((object)"[NeutronaWand] Found keyword to update...");
val2.word = "NeutronaWand";
flag2 = true;
}
}
}
Debug.Log((object)$"[NeutronaWand] Modification complete - Item renamed: {flag}, Keyword renamed: {flag2}");
if ((Object)(object)__instance.terminalNodes != (Object)null && __instance.terminalNodes.allKeywords != null)
{
Debug.Log((object)"[NeutronaWand] Current keywords:");
TerminalKeyword[] allKeywords2 = __instance.terminalNodes.allKeywords;
foreach (TerminalKeyword val3 in allKeywords2)
{
Debug.Log((object)("[NeutronaWand] - " + val3.word));
}
}
}
}
[BepInPlugin("GinjeesPacks.neutronawand", "NeutronaWand", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public const string GUID = "GinjeesPacks.neutronawand";
public const string NAME = "NeutronaWand";
public const string VERSION = "1.0.0";
public static ManualLogSource? Logger;
public static GameObject? NeutronaWandPrefab;
public static Texture2D? SpookyCompanyLogo;
public static ConfigEntry<bool>? EnableDressGirlx2;
private readonly Harmony harmony = new Harmony("GinjeesPacks.neutronawand");
public static Plugin? Instance { get; private set; }
private void Awake()
{
try
{
Instance = this;
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"NeutronaWand Plugin Awake called.");
SetupConfig();
LoadAssetBundle();
LoadSpookyLogo();
CustomMenuMusicPatch.Initialize();
harmony.PatchAll();
DressGirlGlowingFootsteps.Initialize();
Logger.LogInfo((object)"Plugin NeutronaWand is loaded!");
}
catch (Exception arg)
{
ManualLogSource? logger = Logger;
if (logger != null)
{
logger.LogError((object)$"Failed to initialize plugin: {arg}");
}
throw;
}
}
private void SetupConfig()
{
EnableDressGirlx2 = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "DressGirlx2", true, "When one girl is killed 2 spawn");
ManualLogSource? logger = Logger;
if (logger != null)
{
logger.LogInfo((object)("Config initialized. DressGirlx2 is " + (EnableDressGirlx2.Value ? "enabled" : "disabled")));
}
}
private void LoadSpookyLogo()
{
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
try
{
string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
string text = Path.Combine(directoryName, "spookycompanytransparent.png");
ManualLogSource? logger = Logger;
if (logger != null)
{
logger.LogInfo((object)("Looking for Spooky Company logo at: " + text));
}
if (!File.Exists(text))
{
ManualLogSource? logger2 = Logger;
if (logger2 != null)
{
logger2.LogError((object)("Spooky Company logo not found at: " + text));
}
return;
}
byte[] array = File.ReadAllBytes(text);
Texture2D val = new Texture2D(2, 2);
ImageConversion.LoadImage(val, array);
SpookyCompanyLogo = val;
MenuManagerLogoOverridePatch.spookyLogo = val;
ManualLogSource? logger3 = Logger;
if (logger3 != null)
{
logger3.LogInfo((object)"Spooky Company logo loaded successfully!");
}
}
catch (Exception ex)
{
ManualLogSource? logger4 = Logger;
if (logger4 != null)
{
logger4.LogError((object)("Error loading Spooky Company logo: " + ex.Message));
}
}
}
private void LoadAssetBundle()
{
try
{
string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
string text = Path.Combine(directoryName, "neutronawand");
ManualLogSource? logger = Logger;
if (logger != null)
{
logger.LogInfo((object)("Looking for asset bundle at: " + text));
}
if (!File.Exists(text))
{
ManualLogSource? logger2 = Logger;
if (logger2 != null)
{
logger2.LogError((object)("Asset bundle not found at: " + text));
}
return;
}
AssetBundle val = AssetBundle.LoadFromFile(text);
if ((Object)(object)val == (Object)null)
{
ManualLogSource? logger3 = Logger;
if (logger3 != null)
{
logger3.LogError((object)"Failed to load asset bundle!");
}
return;
}
NeutronaWandPrefab = val.LoadAsset<GameObject>("neutronawand");
if ((Object)(object)NeutronaWandPrefab == (Object)null)
{
ManualLogSource? logger4 = Logger;
if (logger4 != null)
{
logger4.LogError((object)"Failed to load NeutronaWand prefab from asset bundle!");
}
}
else
{
ManualLogSource? logger5 = Logger;
if (logger5 != null)
{
logger5.LogInfo((object)"Asset bundle loaded successfully and prefab assigned.");
}
}
}
catch (Exception ex)
{
ManualLogSource? logger6 = Logger;
if (logger6 != null)
{
logger6.LogError((object)("Error loading asset bundle: " + ex.Message));
}
}
}
}
}
namespace NeutronaWand.Features
{
public class DressGirlGlowingFootsteps
{
public static class Config
{
public static float DistanceFalloff = 20f;
public static float SecondsUntilFade = 60f;
public static Vector3 Color = new Vector3(0.1f, 1f, 0.1f);
public static float UpdateRate = 0.1f;
}
public class FootstepManager : MonoBehaviour
{
public readonly List<GlowingFootstep.Data> FootstepData = new List<GlowingFootstep.Data>();
public readonly FootstepPool PooledObjects = new FootstepPool();
private static Material _catwalkMaterial;
public static Material CatwalkMaterial
{
get
{
if ((Object)(object)_catwalkMaterial == (Object)null)
{
GameObject obj = GameObject.Find("Environment/HangarShip/CatwalkShip");
object catwalkMaterial;
if (obj == null)
{
catwalkMaterial = null;
}
else
{
Renderer component = obj.GetComponent<Renderer>();
catwalkMaterial = ((component != null) ? component.material : null);
}
_catwalkMaterial = (Material)catwalkMaterial;
}
return _catwalkMaterial;
}
}
public void Start()
{
((MonoBehaviour)this).InvokeRepeating("UpdateAllFootstepData", 1f, Config.UpdateRate);
}
public void AddNewFootstep(GlowingFootstep.Data footstepData)
{
FootstepData.Add(footstepData);
}
public void UpdateAllFootstepData()
{
if ((Object)(object)CatwalkMaterial == (Object)null)
{
return;
}
for (int i = 0; i < FootstepData.Count; i++)
{
GlowingFootstep.Data data = FootstepData[i];
data.UpdateFootstepData(Config.UpdateRate);
if (data.IsEnabled && data.ShouldDraw)
{
data.Linked.SyncColorIntensity(data);
}
if (!data.IsEnabled && data.ShouldDraw)
{
GlowingFootstep glowingFootstep = ((ObjectPool<GlowingFootstep>)(object)PooledObjects).Get();
data.IsEnabled = true;
data.Linked = glowingFootstep;
glowingFootstep.SyncAll(data);
}
if (data.IsEnabled && !data.ShouldDraw)
{
((ObjectPool<GlowingFootstep>)(object)PooledObjects).Release(data.Linked);
data.IsEnabled = false;
}
FootstepData[i] = data;
}
FootstepData.RemoveAll((GlowingFootstep.Data d) => !d.IsEnabled && !d.ShouldDraw && (double)d.TimeLeftAlive <= 0.0);
}
}
public class FootstepPool : ObjectPool<GlowingFootstep>
{
public FootstepPool()
: base((Func<GlowingFootstep>)CreateNewFootstep, (Action<GlowingFootstep>)delegate(GlowingFootstep fs)
{
((Component)fs).gameObject.SetActive(true);
}, (Action<GlowingFootstep>)delegate(GlowingFootstep fs)
{
((Component)fs).gameObject.SetActive(false);
}, (Action<GlowingFootstep>)DestroyFootstep, true, 10, 10000)
{
}
private static GlowingFootstep CreateNewFootstep()
{
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)$"Creating new footstep object in pool. Object count {((ObjectPool<GlowingFootstep>)(object)footyManager.PooledObjects).CountAll} & active {((ObjectPool<GlowingFootstep>)(object)footyManager.PooledObjects).CountActive}");
}
GameObject val = new GameObject("DressGirl Glow Step", new Type[1] { typeof(GlowingFootstep) });
val.transform.SetParent(((Component)footyManager).transform);
return val.GetComponent<GlowingFootstep>();
}
private static void DestroyFootstep(GlowingFootstep footstep)
{
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)$"Destroying footstep object in pool. Object count {((ObjectPool<GlowingFootstep>)(object)footyManager.PooledObjects).CountAll} & active {((ObjectPool<GlowingFootstep>)(object)footyManager.PooledObjects).CountActive}");
}
Object.Destroy((Object)(object)((Component)footstep).gameObject);
}
}
public class GlowingFootstep : MonoBehaviour
{
public class Data
{
public Vector3 Position;
public Quaternion Rotation;
public float TimeLeftAlive;
public int Strength;
public bool LeftFoot;
public Vector3 Color;
public bool ShouldDraw;
public bool IsEnabled;
public GlowingFootstep Linked;
public float LastDistance;
public void UpdateFootstepData(float delta)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
{
LastDistance = Vector3.Distance(Position, GameNetworkManager.Instance.localPlayerController.playerEye.position);
float distanceFalloff = Config.DistanceFalloff;
if (LastDistance <= distanceFalloff)
{
ShouldDraw = true;
}
if (LastDistance > distanceFalloff || (double)TimeLeftAlive <= 0.0)
{
ShouldDraw = false;
}
}
else
{
ShouldDraw = false;
}
float num = 5f;
float num2 = Config.SecondsUntilFade * 0.5f;
if (TimeLeftAlive < num2)
{
num = 7.5f;
}
TimeLeftAlive -= delta * num;
}
}
private Material _materialReference;
private GameObject _subPlane;
private static readonly int EmissiveExposureWeight = Shader.PropertyToID("_EmissiveExposureWeight");
private static readonly int EmissiveColorMode = Shader.PropertyToID("_EmissiveColorMode");
private static readonly int EmissiveColor = Shader.PropertyToID("_EmissiveColor");
private static readonly int BaseColorMap = Shader.PropertyToID("_BaseColorMap");
private static readonly int NormalMap = Shader.PropertyToID("_NormalMap");
private static readonly int MainTex = Shader.PropertyToID("_MainTex");
private void CreateFootShape(bool isLeftFoot)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_003e: 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_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: 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_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
_subPlane = new GameObject("FootShape");
_subPlane.transform.SetParent(((Component)this).transform, false);
GameObject val = CreateQuad("Sole", new Vector3(0f, 0f, 0f), new Vector2(1f, 2.05f));
val.transform.SetParent(_subPlane.transform, false);
GameObject val2 = CreateQuad("Ball", new Vector3(0f, 0f, 0.7f), new Vector2(1.4f, 1f));
val2.transform.SetParent(_subPlane.transform, false);
GameObject val3 = CreateQuad("Heel", new Vector3(0f, 0f, -0.7f), new Vector2(1.25f, 0.9f));
val3.transform.SetParent(_subPlane.transform, false);
if (!isLeftFoot)
{
_subPlane.transform.localScale = new Vector3(-1f, 1f, 1f);
}
_subPlane.transform.localScale = Vector3.Scale(_subPlane.transform.localScale, new Vector3(1f, 1f, 1f) / 18f);
}
private GameObject CreateQuad(string name, Vector3 position, Vector2 size)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: 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)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Expected O, but got Unknown
GameObject val = new GameObject(name);
val.transform.localPosition = position;
MeshFilter val2 = val.AddComponent<MeshFilter>();
MeshRenderer val3 = val.AddComponent<MeshRenderer>();
Mesh val4 = new Mesh();
float num = size.x / 2f;
float num2 = size.y / 2f;
Vector3[] vertices = (Vector3[])(object)new Vector3[4]
{
new Vector3(0f - num, 0f, 0f - num2),
new Vector3(num, 0f, 0f - num2),
new Vector3(0f - num, 0f, num2),
new Vector3(num, 0f, num2)
};
int[] triangles = new int[6] { 0, 2, 1, 2, 3, 1 };
Vector2[] uv = (Vector2[])(object)new Vector2[4]
{
new Vector2(0f, 0f),
new Vector2(1f, 0f),
new Vector2(0f, 1f),
new Vector2(1f, 1f)
};
val4.vertices = vertices;
val4.triangles = triangles;
val4.uv = uv;
val4.RecalculateNormals();
val2.mesh = val4;
((Renderer)val3).material = new Material(_materialReference);
return val;
}
public void Awake()
{
_materialReference = CreateNewMaterial();
}
public void SyncAll(Data footstepData)
{
if ((Object)(object)_subPlane == (Object)null)
{
CreateFootShape(footstepData.LeftFoot);
}
SyncTransform(footstepData);
SyncMaterial(footstepData);
SyncColorIntensity(footstepData);
}
private void SyncTransform(Data footstepData)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
Transform transform = ((Component)this).transform;
transform.position = footstepData.Position;
transform.rotation = footstepData.Rotation;
}
private void SyncMaterial(Data footstepData)
{
_materialReference.SetTexture(MainTex, (Texture)null);
_materialReference.SetTexture(BaseColorMap, (Texture)null);
}
public void SyncColorIntensity(Data footstepData)
{
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
float num = Mathf.Clamp(footstepData.TimeLeftAlive, 0f, 30f) / 30f;
float num2 = Mathf.Min(num, Mathf.Pow(Mathf.Clamp(2f - footstepData.LastDistance / Config.DistanceFalloff, 0f, 1f), 4f));
Renderer[] componentsInChildren = _subPlane.GetComponentsInChildren<Renderer>();
foreach (Renderer val in componentsInChildren)
{
val.material.SetVector(EmissiveColor, new Vector4(footstepData.Color.x, footstepData.Color.y, footstepData.Color.z, 1f) * num2);
}
}
private static Material CreateNewMaterial()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
Material val = new Material(FootstepManager.CatwalkMaterial);
val.SetTexture(NormalMap, (Texture)null);
val.SetFloat(EmissiveColorMode, 1f);
val.SetFloat(EmissiveExposureWeight, 1f);
val.mainTextureScale = Vector2.one;
val.color = Color.white;
return val;
}
}
[HarmonyPatch(typeof(Terminal), "Start")]
public static class Terminal_Start_Patch
{
[HarmonyPostfix]
public static void CreateFootstepManager(Terminal __instance)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
if (!((Object)(object)footyManager != (Object)null))
{
GameObject val = new GameObject("DressGirl Footstep Manager", new Type[1] { typeof(FootstepManager) });
footyManager = val.GetComponent<FootstepManager>();
Object.DontDestroyOnLoad((Object)(object)((Component)footyManager).gameObject);
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)"DressGirl Footstep Manager created");
}
}
}
}
[HarmonyPatch(typeof(DressGirlAI), "Update")]
public static class DressGirlAI_Update_Patch
{
private static Dictionary<ulong, float> _leftFoots = new Dictionary<ulong, float>();
private static Dictionary<ulong, Vector3> _lastPositions = new Dictionary<ulong, Vector3>();
private static Dictionary<ulong, float> _footstepTimers = new Dictionary<ulong, float>();
private static float footstepInterval = 0.5f;
[HarmonyPostfix]
public static void AddFootstepsForDressGirl(DressGirlAI __instance)
{
//IL_0087: 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_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: 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_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01de: 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_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: 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)
try
{
if (!((NetworkBehaviour)__instance).IsOwner || (Object)(object)footyManager == (Object)null || ((EnemyAI)__instance).isEnemyDead)
{
return;
}
ulong networkObjectId = ((NetworkBehaviour)__instance).NetworkObjectId;
if (!_lastPositions.ContainsKey(networkObjectId))
{
_lastPositions[networkObjectId] = ((Component)__instance).transform.position;
_leftFoots[networkObjectId] = -1f;
_footstepTimers[networkObjectId] = 0f;
}
Vector3 position = ((Component)__instance).transform.position;
float num = Vector3.Distance(_lastPositions[networkObjectId], position);
bool flag = num > 0.01f;
_footstepTimers[networkObjectId] += Time.deltaTime;
if (flag && _footstepTimers[networkObjectId] >= footstepInterval)
{
_footstepTimers[networkObjectId] = 0f;
Transform transform = ((Component)__instance).transform;
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(new Ray(transform.position + transform.right * 0.1f * _leftFoots[networkObjectId], Vector3.down), ref val, 10f, LayerMask.GetMask(new string[3] { "Room", "Railing", "Default" })))
{
GlowingFootstep.Data footstepData = new GlowingFootstep.Data
{
Color = Config.Color,
LeftFoot = ((double)_leftFoots[networkObjectId] <= 0.0),
Strength = ((((EnemyAI)__instance).currentBehaviourStateIndex == 1) ? 3 : 2),
TimeLeftAlive = Config.SecondsUntilFade,
Position = ((RaycastHit)(ref val)).point + new Vector3(0f, 0.001f, 0f),
Rotation = Quaternion.LookRotation(((Component)__instance).transform.forward * -1f, ((RaycastHit)(ref val)).normal)
};
footyManager.AddNewFootstep(footstepData);
_leftFoots[networkObjectId] *= -1f;
}
}
_lastPositions[networkObjectId] = position;
}
catch (Exception arg)
{
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogError((object)$"Error in DressGirlAI_Update_Patch: {arg}");
}
}
}
}
public static FootstepManager footyManager;
public static void Initialize()
{
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)"Initializing DressGirl Glowing Footsteps feature");
}
}
}
}
namespace NeutronaWand.Patches
{
[HarmonyPatch]
public static class CustomMenuMusicPatch
{
private static AudioClip customMenuMusic;
private static bool musicLoaded;
private static bool patchApplied;
public static void Initialize()
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Expected O, but got Unknown
try
{
string location = Assembly.GetExecutingAssembly().Location;
string directoryName = Path.GetDirectoryName(location);
string text = Path.Combine(directoryName, "MenuMusic1.wav");
if (File.Exists(text))
{
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)("Custom music file found at: " + text));
}
WWW val = new WWW("file://" + text);
try
{
while (!val.isDone)
{
Thread.Sleep(5);
}
if (string.IsNullOrEmpty(val.error))
{
customMenuMusic = val.GetAudioClip(false, false);
((Object)customMenuMusic).name = "MenuMusic1";
musicLoaded = true;
ManualLogSource? logger2 = Plugin.Logger;
if (logger2 != null)
{
logger2.LogInfo((object)"Custom menu music loaded successfully!");
}
}
else
{
ManualLogSource? logger3 = Plugin.Logger;
if (logger3 != null)
{
logger3.LogError((object)("Error loading audio file: " + val.error));
}
}
return;
}
finally
{
((IDisposable)val)?.Dispose();
}
}
ManualLogSource? logger4 = Plugin.Logger;
if (logger4 != null)
{
logger4.LogError((object)("Custom music file not found at: " + text));
}
}
catch (Exception arg)
{
ManualLogSource? logger5 = Plugin.Logger;
if (logger5 != null)
{
logger5.LogError((object)$"Error initializing custom music: {arg}");
}
}
}
[HarmonyPatch(typeof(MenuManager), "PlayMenuMusicDelayed")]
[HarmonyPrefix]
public static bool PlayMenuMusicDelayed_Prefix(MenuManager __instance, ref IEnumerator __result)
{
if ((Object)(object)customMenuMusic != (Object)null && musicLoaded)
{
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)"Replacing menu music with custom track");
}
__result = CustomPlayMenuMusicDelayed(__instance);
return false;
}
ManualLogSource? logger2 = Plugin.Logger;
if (logger2 != null)
{
logger2.LogWarning((object)"Custom music not loaded, using original menu music");
}
return true;
}
[HarmonyPatch(typeof(MenuManager), "Start")]
[HarmonyPostfix]
public static void Start_Postfix(MenuManager __instance)
{
if (!__instance.isInitScene && (Object)(object)customMenuMusic != (Object)null && musicLoaded && !patchApplied)
{
patchApplied = true;
((MonoBehaviour)__instance).StartCoroutine(ReplaceMenuMusicDelayed(__instance));
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)"Applied menu music patch in Start method");
}
}
}
private static IEnumerator CustomPlayMenuMusicDelayed(MenuManager menuManager)
{
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)"Starting custom menu music playback sequence");
}
if ((Object)(object)GameNetworkManager.Instance != (Object)null && GameNetworkManager.Instance.firstTimeInMenu)
{
GameNetworkManager.Instance.firstTimeInMenu = false;
menuManager.MenuAudio.PlayOneShot(menuManager.openMenuSound, 1f);
yield return (object)new WaitForSeconds(0.3f);
}
else
{
menuManager.menuAnimator.SetTrigger("skipOpening");
}
yield return (object)new WaitForSeconds(0.1f);
menuManager.MenuAudio.Stop();
menuManager.MenuAudio.clip = customMenuMusic;
menuManager.MenuAudio.Play();
ManualLogSource? logger2 = Plugin.Logger;
if (logger2 != null)
{
logger2.LogInfo((object)"Custom menu music started playing");
}
}
private static IEnumerator ReplaceMenuMusicDelayed(MenuManager menuManager)
{
yield return (object)new WaitForSeconds(0.5f);
if ((Object)(object)menuManager.MenuAudio.clip != (Object)(object)customMenuMusic && (Object)(object)customMenuMusic != (Object)null)
{
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)"Backup method: Replacing menu music");
}
menuManager.MenuAudio.Stop();
menuManager.MenuAudio.clip = customMenuMusic;
menuManager.MenuAudio.Play();
}
}
}
[HarmonyPatch(typeof(DressGirlAI))]
public class DressGirlAI_ShockablePatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void MakeShockable(DressGirlAI __instance)
{
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)__instance != (Object)null)
{
((Component)__instance).gameObject.layer = LayerMask.NameToLayer("Enemies");
((Component)__instance).gameObject.layer = LayerMask.NameToLayer("Enemies") | LayerMask.NameToLayer("EnemyDetection");
if ((Object)(object)((Component)__instance).gameObject.GetComponent<Collider>() == (Object)null)
{
CapsuleCollider val = ((Component)__instance).gameObject.AddComponent<CapsuleCollider>();
val.height = 2f;
val.radius = 1.3f;
val.center = new Vector3(0f, 1f, 0f);
((Collider)val).isTrigger = true;
}
if (!Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent<DressGirlShockable>()))
{
((Component)__instance).gameObject.AddComponent<DressGirlShockable>();
}
}
}
}
public class DressGirlShockable : NetworkBehaviour, IShockableWithGun
{
private DressGirlAI dressGirl = null;
private bool isBeingShocked;
private void Awake()
{
dressGirl = ((Component)this).GetComponent<DressGirlAI>();
((Component)this).gameObject.layer = LayerMask.NameToLayer("Enemies");
}
public bool CanBeShocked()
{
return (Object)(object)dressGirl != (Object)null && !((EnemyAI)dressGirl).isEnemyDead && (dressGirl.staringInHaunt || ((EnemyAI)dressGirl).currentBehaviourStateIndex == 1 || !dressGirl.disappearingFromStare);
}
public NetworkObject GetNetworkObject()
{
return ((NetworkBehaviour)dressGirl).NetworkObject;
}
public Vector3 GetShockablePosition()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: 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_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
return ((Component)this).transform.position + Vector3.up * 2f;
}
public Transform GetShockableTransform()
{
return ((Component)this).transform;
}
public float GetDifficultyMultiplier()
{
return 0.5f;
}
public void ShockWithGun(PlayerControllerB player)
{
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
if (!isBeingShocked && (Object)(object)dressGirl != (Object)null && !((EnemyAI)dressGirl).isEnemyDead)
{
isBeingShocked = true;
if (NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost)
{
((EnemyAI)dressGirl).EnableEnemyMesh(true, true);
StopAllAnimations();
((MonoBehaviour)this).StartCoroutine(DressGirlAI_ZapLevitateKillPatch.LevitateThenKill(dressGirl, player, 2f, 1.7f));
}
else
{
NetworkObjectReference playerRef = default(NetworkObjectReference);
((NetworkObjectReference)(ref playerRef))..ctor(((NetworkBehaviour)player).NetworkObject);
RequestKillServerRpc(playerRef);
}
}
}
private void StopAllAnimations()
{
if ((Object)(object)dressGirl != (Object)null && (Object)(object)((EnemyAI)dressGirl).creatureAnimator != (Object)null)
{
((EnemyAI)dressGirl).agent.speed = 0f;
((EnemyAI)dressGirl).creatureAnimator.SetBool("Walk", false);
((EnemyAI)dressGirl).creatureAnimator.SetBool("Attacking", false);
((EnemyAI)dressGirl).creatureAnimator.SetBool("Chasing", false);
((EnemyAI)dressGirl).creatureAnimator.SetBool("Staring", false);
((EnemyAI)dressGirl).creatureAnimator.Play("Idle");
dressGirl.staringInHaunt = false;
dressGirl.disappearingFromStare = false;
}
}
[ServerRpc(RequireOwnership = false)]
private void RequestKillServerRpc(NetworkObjectReference playerRef)
{
NetworkObject val = default(NetworkObject);
if (((NetworkObjectReference)(ref playerRef)).TryGet(ref val, (NetworkManager)null))
{
PlayerControllerB component = ((Component)val).GetComponent<PlayerControllerB>();
if ((Object)(object)component != (Object)null)
{
StopAllAnimations();
((MonoBehaviour)this).StartCoroutine(DressGirlAI_ZapLevitateKillPatch.LevitateThenKill(dressGirl, component, 2f, 1.7f));
}
}
}
[ClientRpc]
private void SyncAnimationStopClientRpc()
{
StopAllAnimations();
}
public void StopShockingWithGun()
{
isBeingShocked = false;
}
}
[HarmonyPatch(typeof(DressGirlAI))]
[HarmonyPatch("OnCollideWithPlayer")]
[HarmonyPriority(200)]
public class DressGirlAI_ZapLevitateKillPatch
{
private static float LEVITATE_HEIGHT = 5f;
private const float LEVITATE_DURATION = 4f;
private static bool flashApplied = false;
private static bool enemyKilled = false;
private static bool Prefix(Collider other, DressGirlAI __instance)
{
if ((Object)(object)((Component)other).GetComponent<NeutronaWandDamageMarker>() != (Object)null || (Object)(object)((Component)other).GetComponent<PatcherTool>() != (Object)null)
{
if (NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost)
{
((MonoBehaviour)__instance).StartCoroutine(LevitateThenKill(__instance, StartOfRound.Instance.localPlayerController, 4f, LEVITATE_HEIGHT));
}
return false;
}
return true;
}
public static IEnumerator LevitateThenKill(DressGirlAI instance, PlayerControllerB shootingPlayer, float liftDuration, float upwardForce)
{
float slowedLiftDuration = liftDuration * 2f;
if (!NetworkManager.Singleton.IsServer && !NetworkManager.Singleton.IsHost)
{
yield break;
}
if ((Object)(object)((EnemyAI)instance).agent != (Object)null)
{
_ = ((Behaviour)((EnemyAI)instance).agent).enabled;
((Behaviour)((EnemyAI)instance).agent).enabled = false;
}
flashApplied = false;
enemyKilled = false;
((EnemyAI)instance).EnableEnemyMesh(true, true);
instance.staringInHaunt = false;
instance.disappearingFromStare = false;
((EnemyAI)instance).creatureAnimator.SetBool("Walk", false);
((EnemyAI)instance).creatureAnimator.SetBool("Attacking", false);
((EnemyAI)instance).creatureAnimator.SetBool("Chasing", false);
((EnemyAI)instance).creatureAnimator.SetBool("Staring", false);
((EnemyAI)instance).creatureAnimator.Play("Idle");
Vector3 startPos = ((Component)instance).transform.position;
float initialYPos = startPos.y;
Vector3 targetPos = new Vector3(startPos.x, initialYPos + upwardForce, startPos.z);
Rigidbody rb = ((Component)instance).gameObject.GetComponent<Rigidbody>();
bool wasKinematic = false;
if ((Object)(object)rb != (Object)null)
{
wasKinematic = rb.isKinematic;
rb.isKinematic = true;
}
List<Collider> colliders = new List<Collider>(((Component)instance).gameObject.GetComponents<Collider>());
foreach (Collider collider2 in colliders)
{
collider2.enabled = false;
}
float levitateTime = 0f;
float spinSpeed = 2880f;
while (levitateTime < slowedLiftDuration)
{
float t = levitateTime / slowedLiftDuration;
float smoothT = Mathf.SmoothStep(0f, 1f, t);
Vector3 newPosition = Vector3.Lerp(startPos, targetPos, smoothT);
((Component)instance).transform.position = newPosition;
((Component)instance).transform.Rotate(Vector3.up, spinSpeed * Time.deltaTime);
if (Mathf.Abs(((Component)instance).transform.position.y - newPosition.y) > 0.01f)
{
Vector3 correctedPos = ((Component)instance).transform.position;
correctedPos.y = newPosition.y;
((Component)instance).transform.position = correctedPos;
}
levitateTime += Time.deltaTime;
yield return null;
}
((Component)instance).transform.position = targetPos;
if ((Object)(object)HUDManager.Instance != (Object)null)
{
HUDManager.Instance.flashFilter = 0.85f;
try
{
GameObject flashLight = new GameObject("ZapDeathLight");
Light light = flashLight.AddComponent<Light>();
light.type = (LightType)2;
light.color = new Color(0.2f, 1f, 0f);
light.intensity = 5f;
light.range = 10f;
flashLight.transform.position = ((Component)instance).transform.position;
((MonoBehaviour)instance).StartCoroutine(FadeAndDestroyLight(flashLight));
}
catch (Exception)
{
}
}
float postFlashDuration = 1.5f;
float postFlashTimer = 0f;
while (postFlashTimer < postFlashDuration)
{
if (((Component)instance).transform.position.y < targetPos.y - 0.01f)
{
Vector3 correctedPos2 = ((Component)instance).transform.position;
correctedPos2.y = targetPos.y;
((Component)instance).transform.position = correctedPos2;
}
((Component)instance).transform.Rotate(Vector3.up, spinSpeed * Time.deltaTime);
postFlashTimer += Time.deltaTime;
yield return null;
}
GrabbableObject val = shootingPlayer?.currentlyHeldObjectServer;
PatcherTool patcherTool = (PatcherTool)(object)((val is PatcherTool) ? val : null);
if (patcherTool != null)
{
patcherTool.StopShockingServerRpc();
patcherTool.StopShockingAnomalyOnClient(false);
}
((EnemyAI)instance).isEnemyDead = true;
((EnemyAI)instance).KillEnemyServerRpc(true);
((EnemyAI)instance).EnableEnemyMesh(false, true);
((Component)instance).gameObject.SetActive(false);
if ((Object)(object)rb != (Object)null)
{
rb.isKinematic = wasKinematic;
}
foreach (Collider collider in colliders)
{
collider.enabled = true;
}
}
private static IEnumerator FadeAndDestroyLight(GameObject lightObject)
{
if ((Object)(object)lightObject == (Object)null)
{
yield break;
}
Light light = lightObject.GetComponent<Light>();
if (!((Object)(object)light == (Object)null))
{
float duration = 0.5f;
float startIntensity = light.intensity;
float timer = 0f;
while (timer < duration && !((Object)(object)light == (Object)null))
{
float t = timer / duration;
light.intensity = Mathf.Lerp(startIntensity, 0f, t);
timer += Time.deltaTime;
yield return null;
}
if ((Object)(object)lightObject != (Object)null)
{
Object.Destroy((Object)(object)lightObject);
}
}
}
}
[HarmonyPatch]
public static class DressGirlSpawnPatch
{
private static Dictionary<int, int> dressGirlsKilledOnMoon = new Dictionary<int, int>();
private static bool hasSpawnedInitialDressGirl = false;
private static EnemyType dressGirlEnemyType;
private static List<DressGirlAI> spawnedDressGirls = new List<DressGirlAI>();
[HarmonyPatch(typeof(RoundManager), "FinishGeneratingLevel")]
[HarmonyPostfix]
public static void FinishGeneratingLevel_Postfix(RoundManager __instance)
{
if (Plugin.EnableDressGirlx2 == null || !Plugin.EnableDressGirlx2.Value)
{
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)"DressGirlx2 feature is disabled in config");
}
return;
}
hasSpawnedInitialDressGirl = false;
spawnedDressGirls.Clear();
int currentLevelID = StartOfRound.Instance.currentLevelID;
if (!dressGirlsKilledOnMoon.ContainsKey(currentLevelID))
{
dressGirlsKilledOnMoon[currentLevelID] = 0;
}
else
{
dressGirlsKilledOnMoon[currentLevelID] = 0;
}
if (((NetworkBehaviour)RoundManager.Instance).IsServer)
{
ManualLogSource? logger2 = Plugin.Logger;
if (logger2 != null)
{
logger2.LogInfo((object)$"Starting DressGirl spawn setup for level {currentLevelID}");
}
((MonoBehaviour)__instance).StartCoroutine(WaitForNavMeshAndSpawnDressGirl());
}
}
private static IEnumerator WaitForNavMeshAndSpawnDressGirl()
{
if (Plugin.EnableDressGirlx2 == null || !Plugin.EnableDressGirlx2.Value)
{
yield break;
}
yield return (object)new WaitUntil((Func<bool>)(() => RoundManager.Instance.bakedNavMesh));
if ((Object)(object)dressGirlEnemyType == (Object)null)
{
SelectableLevel[] levels = StartOfRound.Instance.levels;
foreach (SelectableLevel level in levels)
{
foreach (SpawnableEnemyWithRarity enemy in level.Enemies)
{
if ((Object)(object)enemy.enemyType.enemyPrefab.GetComponent<DressGirlAI>() != (Object)null)
{
dressGirlEnemyType = enemy.enemyType;
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)"Found DressGirl enemy type");
}
break;
}
}
if ((Object)(object)dressGirlEnemyType != (Object)null)
{
break;
}
}
if ((Object)(object)dressGirlEnemyType == (Object)null)
{
ManualLogSource? logger2 = Plugin.Logger;
if (logger2 != null)
{
logger2.LogError((object)"Could not find DressGirl enemy type!");
}
yield break;
}
}
ManualLogSource? logger3 = Plugin.Logger;
if (logger3 != null)
{
logger3.LogInfo((object)"Waiting 1 minute before spawning initial DressGirl");
}
yield return (object)new WaitForSeconds(60f);
if (Plugin.EnableDressGirlx2 == null || !Plugin.EnableDressGirlx2.Value)
{
yield break;
}
if (!hasSpawnedInitialDressGirl)
{
SpawnDressGirl(1);
hasSpawnedInitialDressGirl = true;
ManualLogSource? logger4 = Plugin.Logger;
if (logger4 != null)
{
logger4.LogInfo((object)"Spawned initial DressGirl after 1 minute delay");
}
}
((MonoBehaviour)RoundManager.Instance).StartCoroutine(MonitorDressGirlDeaths());
}
private static IEnumerator MonitorDressGirlDeaths()
{
while (Plugin.EnableDressGirlx2 != null && Plugin.EnableDressGirlx2.Value)
{
for (int i = spawnedDressGirls.Count - 1; i >= 0; i--)
{
if ((Object)(object)spawnedDressGirls[i] == (Object)null || ((EnemyAI)spawnedDressGirls[i]).isEnemyDead)
{
int currentLevelID = StartOfRound.Instance.currentLevelID;
dressGirlsKilledOnMoon[currentLevelID]++;
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)$"DressGirl killed! Total killed on moon {currentLevelID}: {dressGirlsKilledOnMoon[currentLevelID]}");
}
((MonoBehaviour)RoundManager.Instance).StartCoroutine(SpawnAdditionalDressGirls());
spawnedDressGirls.RemoveAt(i);
}
}
yield return (object)new WaitForSeconds(1f);
}
}
private static IEnumerator SpawnAdditionalDressGirls()
{
if (Plugin.EnableDressGirlx2 == null || !Plugin.EnableDressGirlx2.Value)
{
yield break;
}
yield return (object)new WaitForSeconds(3f);
if (Plugin.EnableDressGirlx2 != null && Plugin.EnableDressGirlx2.Value)
{
SpawnDressGirl(2);
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)"Spawned 2 additional DressGirls");
}
}
}
private static void SpawnDressGirl(int count)
{
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: 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_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)dressGirlEnemyType == (Object)null || !((NetworkBehaviour)RoundManager.Instance).IsServer || Plugin.EnableDressGirlx2 == null || !Plugin.EnableDressGirlx2.Value)
{
return;
}
for (int i = 0; i < count; i++)
{
if (GameNetworkManager.Instance.localPlayerController.isInsideFactory)
{
GameObject[] array = GameObject.FindGameObjectsWithTag("AINode");
if (array.Length == 0)
{
continue;
}
for (int j = 0; j < 10; j++)
{
int num = Random.Range(0, array.Length);
Vector3 position = array[num].transform.position;
bool flag = true;
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
foreach (PlayerControllerB val in allPlayerScripts)
{
if (val.isPlayerControlled && Vector3.Distance(position, ((Component)val).transform.position) < 15f)
{
flag = false;
break;
}
}
if (flag)
{
NetworkObjectReference enemyRef = RoundManager.Instance.SpawnEnemyGameObject(position, 0f, -1, dressGirlEnemyType);
TrackSpawnedDressGirl(enemyRef);
break;
}
}
continue;
}
GameObject[] array2 = GameObject.FindGameObjectsWithTag("OutsideAINode");
if (array2.Length == 0)
{
continue;
}
for (int l = 0; l < 10; l++)
{
int num2 = Random.Range(0, array2.Length);
Vector3 position2 = array2[num2].transform.position;
bool flag2 = true;
PlayerControllerB[] allPlayerScripts2 = StartOfRound.Instance.allPlayerScripts;
foreach (PlayerControllerB val2 in allPlayerScripts2)
{
if (val2.isPlayerControlled && Vector3.Distance(position2, ((Component)val2).transform.position) < 20f)
{
flag2 = false;
break;
}
}
if (flag2)
{
NetworkObjectReference enemyRef2 = RoundManager.Instance.SpawnEnemyGameObject(position2, 0f, -1, dressGirlEnemyType);
TrackSpawnedDressGirl(enemyRef2);
break;
}
}
}
}
private static void TrackSpawnedDressGirl(NetworkObjectReference enemyRef)
{
NetworkObject val = default(NetworkObject);
if (!((NetworkObjectReference)(ref enemyRef)).TryGet(ref val, (NetworkManager)null))
{
return;
}
DressGirlAI component = ((Component)val).GetComponent<DressGirlAI>();
if ((Object)(object)component != (Object)null)
{
spawnedDressGirls.Add(component);
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)"Successfully spawned and tracked DressGirl");
}
}
}
}
[HarmonyPatch(typeof(EnemyAI))]
[HarmonyPatch("Start")]
public class Enemy_ShockablePatch
{
static Enemy_ShockablePatch()
{
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)"Enemy_ShockablePatch class initialized");
}
}
[HarmonyPostfix]
private static void MakeShockable(EnemyAI __instance)
{
SpringManAI val = (SpringManAI)(object)((__instance is SpringManAI) ? __instance : null);
if (val != null && !Object.op_Implicit((Object)(object)((Component)val).gameObject.GetComponent<SpringManShockable>()))
{
((Component)val).gameObject.AddComponent<SpringManShockable>();
}
NutcrackerEnemyAI val2 = (NutcrackerEnemyAI)(object)((__instance is NutcrackerEnemyAI) ? __instance : null);
if (val2 != null && !Object.op_Implicit((Object)(object)((Component)val2).gameObject.GetComponent<NutcrackerShockable>()))
{
((Component)val2).gameObject.AddComponent<NutcrackerShockable>();
}
JesterAI val3 = (JesterAI)(object)((__instance is JesterAI) ? __instance : null);
if (val3 != null && !Object.op_Implicit((Object)(object)((Component)val3).gameObject.GetComponent<JesterShockable>()))
{
((Component)val3).gameObject.AddComponent<JesterShockable>();
}
}
}
public class SpringManShockable : MonoBehaviour, IShockableWithGun
{
private SpringManAI? springMan;
private void Awake()
{
if ((Object)(object)((Component)this).gameObject != (Object)null)
{
springMan = ((Component)this).GetComponent<SpringManAI>();
}
}
public bool CanBeShocked()
{
return (Object)(object)springMan != (Object)null && !((EnemyAI)springMan).isEnemyDead;
}
public float GetDifficultyMultiplier()
{
return 1f;
}
public NetworkObject? GetNetworkObject()
{
if ((Object)(object)springMan == (Object)null)
{
return null;
}
return ((NetworkBehaviour)springMan).NetworkObject;
}
public Vector3 GetShockablePosition()
{
//IL_0036: 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_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//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_0031: 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_003e: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)((Component)this).transform != (Object)null)
{
return ((Component)this).transform.position + Vector3.up * 2f;
}
return Vector3.zero;
}
public Transform GetShockableTransform()
{
return ((Component)this).transform;
}
public void ShockWithGun(PlayerControllerB shockedByPlayer)
{
if ((Object)(object)springMan != (Object)null && CanBeShocked() && (Object)(object)shockedByPlayer != (Object)null)
{
((EnemyAI)springMan).HitEnemy(999, shockedByPlayer, false, -1);
}
}
public void StopShockingWithGun()
{
}
}
public class NutcrackerShockable : MonoBehaviour, IShockableWithGun
{
private NutcrackerEnemyAI? nutcracker;
private void Awake()
{
if ((Object)(object)((Component)this).gameObject != (Object)null)
{
nutcracker = ((Component)this).GetComponent<NutcrackerEnemyAI>();
}
}
public bool CanBeShocked()
{
return (Object)(object)nutcracker != (Object)null && !((EnemyAI)nutcracker).isEnemyDead;
}
public float GetDifficultyMultiplier()
{
return 1f;
}
public NetworkObject? GetNetworkObject()
{
if ((Object)(object)nutcracker == (Object)null)
{
return null;
}
return ((NetworkBehaviour)nutcracker).NetworkObject;
}
public Vector3 GetShockablePosition()
{
//IL_0036: 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_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//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_0031: 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_003e: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)((Component)this).transform != (Object)null)
{
return ((Component)this).transform.position + Vector3.up * 2f;
}
return Vector3.zero;
}
public Transform GetShockableTransform()
{
return ((Component)this).transform;
}
public void ShockWithGun(PlayerControllerB shockedByPlayer)
{
if ((Object)(object)nutcracker != (Object)null && CanBeShocked() && (Object)(object)shockedByPlayer != (Object)null)
{
((EnemyAI)nutcracker).HitEnemy(999, shockedByPlayer, false, -1);
}
}
public void StopShockingWithGun()
{
}
}
public class JesterShockable : MonoBehaviour, IShockableWithGun
{
private JesterAI? jester;
private void Awake()
{
if ((Object)(object)((Component)this).gameObject != (Object)null)
{
jester = ((Component)this).GetComponent<JesterAI>();
}
}
public bool CanBeShocked()
{
return (Object)(object)jester != (Object)null && !((EnemyAI)jester).isEnemyDead;
}
public float GetDifficultyMultiplier()
{
return 1f;
}
public NetworkObject? GetNetworkObject()
{
if ((Object)(object)jester == (Object)null)
{
return null;
}
return ((NetworkBehaviour)jester).NetworkObject;
}
public Vector3 GetShockablePosition()
{
//IL_0036: 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_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//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_0031: 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_003e: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)((Component)this).transform != (Object)null)
{
return ((Component)this).transform.position + Vector3.up * 2f;
}
return Vector3.zero;
}
public Transform GetShockableTransform()
{
return ((Component)this).transform;
}
public void ShockWithGun(PlayerControllerB shockedByPlayer)
{
if ((Object)(object)jester != (Object)null && CanBeShocked() && (Object)(object)shockedByPlayer != (Object)null)
{
((EnemyAI)jester).HitEnemy(999, shockedByPlayer, false, -1);
}
}
public void StopShockingWithGun()
{
}
}
[HarmonyPatch]
public static class MenuManagerLogoOverridePatch
{
public static Texture2D? spookyLogo;
[HarmonyPatch(typeof(MenuManager), "Awake")]
[HarmonyPostfix]
[HarmonyPriority(0)]
public static void Awake_Postfix(MenuManager __instance)
{
//IL_0064: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
if (__instance.isInitScene)
{
return;
}
try
{
if ((Object)(object)spookyLogo == (Object)null)
{
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogError((object)"Spooky logo texture is null!");
}
return;
}
Sprite sprite = Sprite.Create(spookyLogo, new Rect(0f, 0f, (float)((Texture)spookyLogo).width, (float)((Texture)spookyLogo).height), new Vector2(0.5f, 0.5f));
GameObject gameObject = ((Component)((Component)__instance).transform.parent).gameObject;
Transform val = gameObject.transform.Find("MenuContainer/MainButtons/HeaderImage");
if ((Object)(object)val != (Object)null)
{
((Component)val).gameObject.GetComponent<Image>().sprite = sprite;
}
Transform val2 = gameObject.transform.Find("MenuContainer/LoadingScreen");
if ((Object)(object)val2 != (Object)null)
{
val2.localScale = new Vector3(1.02f, 1.06f, 1.02f);
Transform val3 = val2.Find("Image");
if ((Object)(object)val3 != (Object)null)
{
((Component)val3).GetComponent<Image>().sprite = sprite;
}
}
ManualLogSource? logger2 = Plugin.Logger;
if (logger2 != null)
{
logger2.LogInfo((object)"Spooky Company logo applied successfully!");
}
}
catch (Exception arg)
{
ManualLogSource? logger3 = Plugin.Logger;
if (logger3 != null)
{
logger3.LogError((object)$"Failed to replace logo: {arg}");
}
}
}
}
[HarmonyPatch]
public static class SpookyMenuColorPatch
{
public static Color SpookyGreen = new Color(0f, 1f, 0f);
[HarmonyPatch(typeof(MenuManager), "Start")]
[HarmonyPostfix]
[HarmonyPriority(0)]
public static void Start_Postfix(MenuManager __instance)
{
if (!__instance.isInitScene)
{
((MonoBehaviour)__instance).StartCoroutine(ApplySpookyTheme(__instance));
}
}
private static IEnumerator ApplySpookyTheme(MenuManager menuManager)
{
yield return (object)new WaitForSeconds(0.3f);
try
{
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)"Applying Spooky Company theme...");
}
if ((Object)(object)menuManager.versionNumberText != (Object)null)
{
((Graphic)menuManager.versionNumberText).color = SpookyGreen;
ManualLogSource? logger2 = Plugin.Logger;
if (logger2 != null)
{
logger2.LogInfo((object)"Changed version text color");
}
}
ChangeMenuButtonColors(menuManager);
ChangeBorderElements(menuManager);
if ((Object)(object)menuManager.menuNotificationText != (Object)null)
{
((Graphic)menuManager.menuNotificationText).color = SpookyGreen;
}
if ((Object)(object)menuManager.menuNotificationButtonText != (Object)null)
{
((Graphic)menuManager.menuNotificationButtonText).color = SpookyGreen;
}
if ((Object)(object)menuManager.loadingText != (Object)null)
{
((Graphic)menuManager.loadingText).color = SpookyGreen;
}
if ((Object)(object)menuManager.launchedInLanModeText != (Object)null)
{
((Graphic)menuManager.launchedInLanModeText).color = SpookyGreen;
}
if ((Object)(object)menuManager.tipTextHostSettings != (Object)null)
{
((Graphic)menuManager.tipTextHostSettings).color = SpookyGreen;
}
if ((Object)(object)menuManager.logText != (Object)null)
{
((Graphic)menuManager.logText).color = SpookyGreen;
}
if ((Object)(object)menuManager.privatePublicDescription != (Object)null)
{
((Graphic)menuManager.privatePublicDescription).color = SpookyGreen;
}
if ((Object)(object)menuManager.changesNotAppliedText != (Object)null)
{
((Graphic)menuManager.changesNotAppliedText).color = SpookyGreen;
}
if ((Object)(object)menuManager.settingsBackButton != (Object)null)
{
((Graphic)menuManager.settingsBackButton).color = SpookyGreen;
}
if ((Object)(object)menuManager.leaderboardHeaderText != (Object)null)
{
((Graphic)menuManager.leaderboardHeaderText).color = SpookyGreen;
}
if ((Object)(object)menuManager.leaderboardLoadingText != (Object)null)
{
((Graphic)menuManager.leaderboardLoadingText).color = SpookyGreen;
}
if ((Object)(object)menuManager.submittedRankText != (Object)null)
{
((Graphic)menuManager.submittedRankText).color = SpookyGreen;
}
ManualLogSource? logger3 = Plugin.Logger;
if (logger3 != null)
{
logger3.LogInfo((object)"Spooky Company theme applied successfully!");
}
}
catch (Exception ex)
{
ManualLogSource? logger4 = Plugin.Logger;
if (logger4 != null)
{
logger4.LogError((object)$"Failed to apply Spooky Company theme: {ex}");
}
}
}
private static void ChangeMenuButtonColors(MenuManager menuManager)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
try
{
Transform transform = menuManager.menuButtons.transform;
TextMeshProUGUI[] componentsInChildren = ((Component)transform).GetComponentsInChildren<TextMeshProUGUI>(true);
foreach (TextMeshProUGUI val in componentsInChildren)
{
((Graphic)val).color = SpookyGreen;
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)("Changed color of text: " + ((TMP_Text)val).text));
}
}
Image[] componentsInChildren2 = ((Component)transform).GetComponentsInChildren<Image>(true);
foreach (Image val2 in componentsInChildren2)
{
if (((Object)val2).name.Contains("Background"))
{
continue;
}
if (((Object)val2).name.Contains("Highlight"))
{
float a = ((Graphic)val2).color.a;
((Graphic)val2).color = new Color(SpookyGreen.r, SpookyGreen.g, SpookyGreen.b, a);
ManualLogSource? logger2 = Plugin.Logger;
if (logger2 != null)
{
logger2.LogInfo((object)("Changed highlight color: " + ((Object)val2).name));
}
}
else if (((Object)val2).name.Contains("Chevron") || ((Object)val2).name.Contains("Arrow") || ((Object)val2).name == ">")
{
((Graphic)val2).color = SpookyGreen;
ManualLogSource? logger3 = Plugin.Logger;
if (logger3 != null)
{
logger3.LogInfo((object)("Changed indicator color: " + ((Object)val2).name));
}
}
}
}
catch (Exception arg)
{
ManualLogSource? logger4 = Plugin.Logger;
if (logger4 != null)
{
logger4.LogError((object)$"Error changing menu button colors: {arg}");
}
}
}
private static void ChangeBorderElements(MenuManager menuManager)
{
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
try
{
Image[] array = Object.FindObjectsOfType<Image>(true);
foreach (Image val in array)
{
if (((Object)val).name.Contains("Corner") || ((Object)val).name.Contains("Border") || ((Object)val).name.Contains("Frame") || ((Object)val).name.Contains("Edge"))
{
((Graphic)val).color = SpookyGreen;
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)("Changed border element: " + ((Object)val).name));
}
}
}
GameObject gameObject = ((Component)((Component)menuManager).transform.parent).gameObject;
string[] array2 = new string[8] { "CornerTL", "CornerTR", "CornerBL", "CornerBR", "BorderTopLeft", "BorderTopRight", "BorderBottomLeft", "BorderBottomRight" };
string[] array3 = array2;
foreach (string text in array3)
{
Transform val2 = gameObject.transform.Find(text);
if (!((Object)(object)val2 != (Object)null))
{
continue;
}
Image component = ((Component)val2).GetComponent<Image>();
if ((Object)(object)component != (Object)null)
{
((Graphic)component).color = SpookyGreen;
ManualLogSource? logger2 = Plugin.Logger;
if (logger2 != null)
{
logger2.LogInfo((object)("Changed corner: " + text));
}
}
}
}
catch (Exception arg)
{
ManualLogSource? logger3 = Plugin.Logger;
if (logger3 != null)
{
logger3.LogError((object)$"Error changing border elements: {arg}");
}
}
}
}
[HarmonyPatch(typeof(PatcherTool))]
internal class PatcherToolPatch
{
public static readonly Dictionary<PatcherTool, LightningBoltScript> SecondaryBeams = new Dictionary<PatcherTool, LightningBoltScript>();
public static readonly Dictionary<PatcherTool, LightningBoltScript> TertiaryBeams = new Dictionary<PatcherTool, LightningBoltScript>();
public static readonly Dictionary<PatcherTool, LightningBoltScript> QuaternaryBeams = new Dictionary<PatcherTool, LightningBoltScript>();
public static readonly Dictionary<PatcherTool, LightningBoltScript> QuinaryBeams = new Dictionary<PatcherTool, LightningBoltScript>();
private static readonly Color SecondaryColor = new Color(0.1f, 0.4f, 0.8f, 1f);
private static readonly Color SecondaryGlow = new Color(0.3f, 0.6f, 1f, 1f) * 2f;
private static readonly Color TertiaryColor = new Color(1f, 0.2f, 0.2f, 1f);
private static readonly Color TertiaryGlow = new Color(1f, 0.4f, 0.4f, 1f) * 2f;
private static readonly Color QuaternaryColor = new Color(0.2f, 1f, 0f, 1f);
private static readonly Color QuaternaryGlow = new Color(0.4f, 1f, 0.2f, 1f) * 2f;
private static readonly Color QuinaryColor = new Color(0.5f, 0f, 1f, 1f);
private static readonly Color QuinaryGlow = new Color(0.7f, 0.2f, 1f, 1f) * 2f;
private const float SecondaryOffset = 0.1f;
private const float TertiaryOffset = 0.2f;
private const float QuaternaryOffset = 0.3f;
private const float QuinaryOffset = 0.4f;
[HarmonyPostfix]
[HarmonyPatch("BeginShockingAnomalyOnClient")]
private static void BeginShockingPatch(PatcherTool __instance)
{
//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_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_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: 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_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
try
{
if ((Object)(object)__instance?.lightningObject == (Object)null)
{
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogError((object)"BeginShockingPatch: Missing lightningObject");
}
return;
}
ManualLogSource? logger2 = Plugin.Logger;
if (logger2 != null)
{
logger2.LogInfo((object)"BeginShockingPatch called");
}
LightningSplineScript component = __instance.lightningObject.GetComponent<LightningSplineScript>();
if ((Object)(object)component != (Object)null)
{
((LightningBoltScript)component).LightningTintColor = Color32.op_Implicit(new Color32((byte)100, (byte)200, (byte)100, (byte)0));
((LightningBoltScript)component).GlowTintColor = Color32.op_Implicit(new Color32((byte)50, (byte)150, (byte)50, (byte)0));
LightningBoltScript component2 = __instance.lightningObject.GetComponent<LightningBoltScript>();
if ((Object)(object)component2 != (Object)null)
{
component2.LightningTintColor = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)140, (byte)0, (byte)0));
component2.GlowTintColor = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)0, (byte)0, (byte)0));
}
if (!SecondaryBeams.ContainsKey(__instance))
{
SecondaryBeams[__instance] = CreateCustomBeam(__instance, "SecondaryBeam", SecondaryColor, SecondaryGlow, 0.1f);
}
if (!TertiaryBeams.ContainsKey(__instance))
{
TertiaryBeams[__instance] = CreateCustomBeam(__instance, "TertiaryBeam", TertiaryColor, TertiaryGlow, 0.2f);
}
if (!QuaternaryBeams.ContainsKey(__instance))
{
QuaternaryBeams[__instance] = CreateCustomBeam(__instance, "QuaternaryBeam", QuaternaryColor, QuaternaryGlow, 0.3f);
}
if (!QuinaryBeams.ContainsKey(__instance))
{
QuinaryBeams[__instance] = CreateCustomBeam(__instance, "QuinaryBeam", QuinaryColor, QuinaryGlow, 0.4f);
}
}
}
catch (Exception ex)
{
ManualLogSource? logger3 = Plugin.Logger;
if (logger3 != null)
{
logger3.LogError((object)("Error in BeginShockingPatch: " + ex.Message));
}
}
}
[HarmonyPostfix]
[HarmonyPatch("LateUpdate")]
private static void LateUpdatePatch(PatcherTool __instance)
{
if (!((Object)(object)__instance == (Object)null) && __instance.isShocking && __instance.shockedTargetScript != null)
{
UpdateBeam(__instance, SecondaryBeams, 0.1f);
UpdateBeam(__instance, TertiaryBeams, 0.2f);
UpdateBeam(__instance, QuaternaryBeams, 0.3f);
UpdateBeam(__instance, QuinaryBeams, 0.4f);
}
}
[HarmonyPostfix]
[HarmonyPatch("StopShockingAnomalyOnClient")]
private static void StopShockingPatch(PatcherTool __instance)
{
PatcherTool __instance2 = __instance;
try
{
if (!((Object)(object)__instance2 == (Object)null))
{
SafeDeactivateBeam(SecondaryBeams);
SafeDeactivateBeam(TertiaryBeams);
SafeDeactivateBeam(QuaternaryBeams);
SafeDeactivateBeam(QuinaryBeams);
}
}
catch (Exception ex)
{
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogError((object)("Error in StopShockingPatch: " + ex.Message));
}
}
void SafeDeactivateBeam(Dictionary<PatcherTool, LightningBoltScript> beams)
{
if (beams.TryGetValue(__instance2, out LightningBoltScript value) && (Object)(object)((value != null) ? ((Component)value).gameObject : null) != (Object)null)
{
((Component)value).gameObject.SetActive(false);
try
{
MethodInfo method = typeof(LightningBoltScript).GetMethod("OnDisable", BindingFlags.Instance | BindingFlags.NonPublic);
if (method != null)
{
method.Invoke(value, null);
}
}
catch (Exception ex2)
{
ManualLogSource? logger2 = Plugin.Logger;
if (logger2 != null)
{
logger2.LogWarning((object)("Could not call OnDisable: " + ex2.Message));
}
}
}
}
}
private static LightningBoltScript CreateCustomBeam(PatcherTool instance, string beamName, Color tintColor, Color glowColor, float horizontalOffset)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected O, but got Unknown
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: 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)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Expected O, but got Unknown
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Expected O, but got Unknown
try
{
GameObject val = new GameObject(beamName);
val.transform.SetParent(((Component)instance).transform, false);
LightningBoltScript val2 = val.AddComponent<LightningBoltScript>();
if ((Object)(object)instance.lightningObject != (Object)null)
{
LightningBoltScript component = instance.lightningObject.GetComponent<LightningBoltScript>();
if ((Object)(object)component != (Object)null)
{
val2.Camera = component.Camera;
val2.CameraMode = component.CameraMode;
val2.UseWorldSpace = component.UseWorldSpace;
val2.CompensateForParentTransform = component.CompensateForParentTransform;
val2.MultiThreaded = component.MultiThreaded;
val2.LevelOfDetailDistance = component.LevelOfDetailDistance;
val2.UseGameTime = component.UseGameTime;
val2.SortLayerName = component.SortLayerName;
val2.SortOrderInLayer = component.SortOrderInLayer;
val2.SoftParticlesFactor = component.SoftParticlesFactor;
val2.RenderQueue = component.RenderQueue;
val2.LightningStartedCallback = component.LightningStartedCallback;
val2.LightningEndedCallback = component.LightningEndedCallback;
val2.LightAddedCallback = component.LightAddedCallback;
val2.LightRemovedCallback = component.LightRemovedCallback;
val2.LightningTexture = component.LightningTexture;
val2.LightningGlowTexture = component.LightningGlowTexture;
val2.LightningOriginParticleSystem = component.LightningOriginParticleSystem;
val2.LightningDestinationParticleSystem = component.LightningDestinationParticleSystem;
val2.SourceBlendMode = component.SourceBlendMode;
val2.DestinationBlendMode = component.DestinationBlendMode;
val2.SourceBlendModeGlow = component.SourceBlendModeGlow;
val2.DestinationBlendModeGlow = component.DestinationBlendModeGlow;
val2.JitterMultiplier = component.JitterMultiplier;
val2.Turbulence = component.Turbulence;
val2.TurbulenceVelocity = component.TurbulenceVelocity;
val2.IntensityFlicker = component.IntensityFlicker;
val2.QualitySetting = component.QualitySetting;
val2.MainTrunkTintColor = component.MainTrunkTintColor;
val2.LightningMaterialMesh = new Material(component.LightningMaterialMesh);
val2.LightningMaterialMeshNoGlow = new Material(component.LightningMaterialMeshNoGlow);
}
}
val2.LightningTintColor = tintColor;
val2.GlowTintColor = glowColor;
MethodInfo method = typeof(LightningBoltScript).GetMethod("Start", BindingFlags.Instance | BindingFlags.NonPublic);
if (method != null)
{
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)("Calling Start() method on " + beamName));
}
method.Invoke(val2, null);
}
else
{
ManualLogSource? logger2 = Plugin.Logger;
if (logger2 != null)
{
logger2.LogWarning((object)"Could not find Start method on LightningBoltScript");
}
}
val.SetActive(false);
return val2;
}
catch (Exception ex)
{
ManualLogSource? logger3 = Plugin.Logger;
if (logger3 != null)
{
logger3.LogError((object)("Error in CreateCustomBeam: " + ex.Message + "\n" + ex.StackTrace));
}
return null;
}
}
private static void UpdateBeam(PatcherTool __instance, Dictionary<PatcherTool, LightningBoltScript> beams, float offset)
{
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_0259: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_028b: Unknown result type (might be due to invalid IL or missing references)
//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
try
{
if ((Object)(object)__instance == (Object)null || !__instance.isShocking || !beams.TryGetValue(__instance, out LightningBoltScript value) || !((Object)(object)((value != null) ? ((Component)value).gameObject : null) != (Object)null) || !((Object)(object)((Component)__instance).transform != (Object)null) || __instance.shockedTargetScript == null)
{
return;
}
if (!((Component)value).gameObject.activeInHierarchy)
{
((Component)value).gameObject.SetActive(true);
}
LightningBoltScript component = __instance.lightningObject.GetComponent<LightningBoltScript>();
if (!((Object)(object)component != (Object)null) || component.HasActiveBolts)
{
}
LightningBoltParameters orCreateParameters = LightningBoltParameters.GetOrCreateParameters();
orCreateParameters.Generations = 6;
orCreateParameters.ChaosFactor = 0.075f;
orCreateParameters.ChaosFactorForks = 0f;
orCreateParameters.TrunkWidth = 0.1f;
orCreateParameters.LifeTime = 0.1f;
orCreateParameters.Intensity = 1f;
orCreateParameters.GlowIntensity = 0.1f;
orCreateParameters.GlowWidthMultiplier = 1f;
orCreateParameters.Forkedness = 0f;
orCreateParameters.FadePercent = 0f;
orCreateParameters.FadeInMultiplier = 1f;
orCreateParameters.FadeOutMultiplier = 1f;
orCreateParameters.GrowthMultiplier = 0f;
orCreateParameters.EndWidthMultiplier = 1f;
orCreateParameters.GenerationWhereForksStopSubtractor = 5;
if ((Object)(object)__instance.lightningObject != (Object)null)
{
LightningBoltScript component2 = __instance.lightningObject.GetComponent<LightningBoltScript>();
if (!((Object)(object)component2 != (Object)null))
{
}
}
float num = 0.31f;
float num2 = -0.27f;
Vector3 val = __instance.aimDirection.right * offset;
Vector3 val2 = Vector3.up * num2;
Vector3 start = __instance.aimDirection.position + __instance.aimDirection.forward * num + val + val2;
orCreateParameters.Start = start;
orCreateParameters.End = __instance.shockedTargetScript.GetShockablePosition() + val;
orCreateParameters.Points.Clear();
if ((Object)(object)__instance.lightningBend1 != (Object)null && (Object)(object)__instance.lightningBend2 != (Object)null)
{
orCreateParameters.Points.Add(orCreateParameters.Start);
orCreateParameters.Points.Add(__instance.lightningBend1.position + val);
orCreateParameters.Points.Add(__instance.lightningBend2.position + val);
orCreateParameters.Points.Add(orCreateParameters.End);
}
else
{
orCreateParameters.Points.Add(orCreateParameters.Start);
orCreateParameters.Points.Add(orCreateParameters.End);
}
if (Vector3.Distance(orCreateParameters.Start, orCreateParameters.End) > 0.1f)
{
value.CreateLightningBolt(orCreateParameters);
}
else
{
LightningBoltParameters.ReturnParametersToCache(orCreateParameters);
}
}
catch (Exception ex)
{
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogError((object)("Error in UpdateBeam: " + ex.Message + "\n" + ex.StackTrace));
}
}
}
}
}
namespace NeutronaWand.Components
{
public class NeutronaWandDamageMarker : MonoBehaviour
{
private void Awake()
{
ManualLogSource? logger = Plugin.Logger;
if (logger != null)
{
logger.LogInfo((object)"NeutronaWandDamageMarker component initialized");
}
}
}
}