using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Dissonance;
using Dissonance.Audio;
using Dissonance.Config;
using HarmonyLib;
using NAudio.Wave;
using SkinwalkerMod.Properties;
using Steamworks;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.SceneManagement;
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: AssemblyTitle("SkinwalkerMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SkinwalkerMod")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("fd4979a2-cef0-46af-8bf8-97e630b11475")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
internal class <Module>
{
static <Module>()
{
NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<bool>();
NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<bool>();
NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>();
NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>();
}
}
namespace SkinwalkerMod
{
internal static class AudioAggregator
{
private const int MAX_AUDIO_RECORDINGS = 200;
private const float MIN_CLIP_LENGTH = 0.9f;
private static List<AudioRecording> audioRecordings = new List<AudioRecording>();
private static Dictionary<string, List<AudioRecording>> playerRecordingIndex = new Dictionary<string, List<AudioRecording>>();
internal static void AddAudioRecording(AudioRecording recording)
{
if (!(recording.clip.length < 0.9f))
{
audioRecordings.Add(recording);
if (!playerRecordingIndex.ContainsKey(recording.playerName))
{
playerRecordingIndex[recording.playerName] = new List<AudioRecording>();
}
playerRecordingIndex[recording.playerName].Add(recording);
if (audioRecordings.Count > 200)
{
RemoveRecording(Random.Range(0, audioRecordings.Count));
}
}
}
internal static void ClearCache()
{
audioRecordings = new List<AudioRecording>();
}
internal static AudioRecording GetSampleForPlayer(string playerName)
{
if (playerRecordingIndex.TryGetValue(playerName, out var value) && value.Count > 0)
{
return RemoveRecording(value[Random.Range(0, value.Count)]);
}
return null;
}
internal static AudioRecording GetSample()
{
if (audioRecordings.Count > 0)
{
return RemoveRecording(Random.Range(0, audioRecordings.Count));
}
return null;
}
internal static AudioRecording RemoveRecording(AudioRecording recordingToRemove)
{
audioRecordings.Remove(recordingToRemove);
playerRecordingIndex[recordingToRemove.playerName].Remove(recordingToRemove);
return recordingToRemove;
}
internal static AudioRecording RemoveRecording(int index)
{
AudioRecording recordingToRemove = audioRecordings[index];
return RemoveRecording(recordingToRemove);
}
}
public class AudioRecording
{
public AudioClip clip;
public string playerName;
public AudioRecording(AudioClip clip, string playerName)
{
this.clip = clip;
this.playerName = playerName;
}
}
[HarmonyPatch(typeof(AudioFileWriter))]
internal static class AudioFileWriterPatches
{
[Serializable]
internal class RawAudioRecording
{
public MemoryStream stream;
public string fileName;
public RawAudioRecording(MemoryStream stream, string fileName)
{
this.stream = stream;
this.fileName = fileName;
}
public void CreateClip()
{
byte[] array = stream.ToArray();
byte[] array2 = new byte[(array.Length - 58) / 2];
int num = 0;
for (int i = 58; i < array.Length; i += 4)
{
byte[] bytes = BitConverter.GetBytes((short)Math.Floor(BitConverter.ToSingle(array, i) * 32767f));
array2[num] = bytes[0];
array2[num + 1] = bytes[1];
num += 2;
}
AudioClip clip = ByteArrayToAudioClipUpdated(array2, "recording", 1, 48000);
AudioAggregator.AddAudioRecording(new AudioRecording(clip, new FileInfo(fileName).Name.Split(new char[1] { '_' })[1]));
}
}
internal static Dictionary<AudioFileWriter, RawAudioRecording> audioRecordings = new Dictionary<AudioFileWriter, RawAudioRecording>();
private static readonly Type waveFileWriterType = Type.GetType("NAudio.Wave.WaveFileWriter, DissonanceVoip");
private static readonly Type lockedValueType = Type.GetType("Dissonance.Threading.LockedValue`1, DissonanceVoip").MakeGenericType(waveFileWriterType);
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyPrefix]
private static bool Constructor(AudioFileWriter __instance, string filename, WaveFormat format)
{
if (filename == null)
{
throw new ArgumentNullException(filename);
}
if (format == null)
{
throw new ArgumentNullException(((object)format).ToString());
}
try
{
MemoryStream memoryStream = new MemoryStream();
SetField("_lock", Activator.CreateInstance(lockedValueType, Activator.CreateInstance(waveFileWriterType, memoryStream, format)));
audioRecordings[__instance] = new RawAudioRecording(memoryStream, filename);
}
catch (Exception arg)
{
SkinwalkerLogger.LogError($"Attempting to create `AudioFileWriter` failed (audio logging will be disabled).\nException: {arg}");
SetField("_error", true);
}
return false;
void SetField(string name, object value)
{
typeof(AudioFileWriter).GetField(name, BindingFlags.Instance | BindingFlags.NonPublic).SetValue(__instance, value);
}
}
[HarmonyPatch("Dispose")]
[HarmonyPrefix]
private static bool Dispose(AudioFileWriter __instance)
{
if (audioRecordings.TryGetValue(__instance, out var value))
{
value.CreateClip();
audioRecordings.Remove(__instance);
}
else
{
SkinwalkerLogger.LogError("AudioFileWriter was disposed of when it was not in the dictionary.");
}
return true;
}
private static AudioClip ByteArrayToAudioClipUpdated(byte[] byteArray, string clipName, int channels, int frequency)
{
int num = 2;
AudioClip val = AudioClip.Create(clipName, byteArray.Length / (channels * num), channels, frequency, false);
float[] array = new float[byteArray.Length / num];
int num2 = 32767;
for (int i = 0; i < array.Length; i++)
{
short num3 = BitConverter.ToInt16(byteArray, i * num);
array[i] = (float)num3 / (float)num2;
}
val.SetData(array, 0);
return val;
}
}
internal class LogoManager : MonoBehaviour
{
private AssetBundle bundle;
private readonly Logo[] logos = new Logo[6]
{
new Logo
{
fileName = "Teo",
playerNames = new string[9] { "SAMMY", "paddy", "Ozias", "Teo", "Rugbug Redfern", "WuluKing", "Boolie", "TeaEditor", "FlashGamesNemesis" }
},
new Logo
{
fileName = "OfflineTV",
playerNames = new string[3] { "Masayoshi", "QUARTERJADE", "DisguisedToast" }
},
new Logo
{
fileName = "Neuro",
playerNames = new string[1] { "vedal" }
},
new Logo
{
fileName = "Mogul",
playerNames = new string[2] { "ludwig", "AirCoots" }
},
new Logo
{
fileName = "Imp",
playerNames = new string[1] { "camila" }
},
new Logo
{
fileName = "Iron",
playerNames = new string[1] { "ironmouse" }
}
};
private Image cachedHeader;
private Image cachedLogoHeader;
private void Awake()
{
try
{
bundle = AssetBundle.LoadFromMemory(Resources.logos);
SceneManager.sceneLoaded += OnSceneLoaded;
}
catch (Exception ex)
{
SkinwalkerLogger.LogError("LogoManager Awake Error: " + ex.Message);
}
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
try
{
if (!(((Scene)(ref scene)).name == "MainMenu"))
{
return;
}
cachedHeader = GameObject.Find("HeaderImage").GetComponent<Image>();
cachedLogoHeader = ((Component)GameObject.Find("Canvas/MenuContainer").transform.GetChild(0).GetChild(1)).GetComponent<Image>();
string value = SteamClient.Name.ToString();
Logo[] array = logos;
foreach (Logo logo in array)
{
string[] playerNames = logo.playerNames;
foreach (string text in playerNames)
{
if (text.Equals(value, StringComparison.OrdinalIgnoreCase))
{
((MonoBehaviour)this).StartCoroutine(I_ChangeLogo(bundle.LoadAsset<Sprite>("Assets/Logos/" + logo.fileName + ".png")));
return;
}
}
}
}
catch (Exception ex)
{
SkinwalkerLogger.LogError("LogoManager OnSceneLoaded Error: " + ex.Message + ". If you launched in LAN mode, then this is just gonna happen, it doesn't break anything so don't worry about it.");
}
}
private IEnumerator I_ChangeLogo(Sprite sprite)
{
for (int i = 0; i < 20; i++)
{
if ((Object)(object)cachedHeader == (Object)null)
{
break;
}
if ((Object)(object)cachedLogoHeader == (Object)null)
{
break;
}
SetHeaderImage(sprite);
yield return null;
}
}
private void SetHeaderImage(Sprite sprite)
{
if (!((Object)(object)sprite == (Object)null))
{
cachedHeader.sprite = sprite;
cachedLogoHeader.sprite = sprite;
}
}
}
internal class Logo
{
public string fileName;
public string[] playerNames;
}
[BepInPlugin("RugbugRedfern.SkinwalkerModExperimental", "Skinwalker Mod Experimental", "3.0.1")]
internal class PluginLoader : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("RugbugRedfern.SkinwalkerModExperimental");
private const string modGUID = "RugbugRedfern.SkinwalkerModExperimental";
private const string modVersion = "3.0.1";
private static bool initialized;
public static PluginLoader Instance { get; private set; }
private void Awake()
{
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Expected O, but got Unknown
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Expected O, but got Unknown
if (initialized)
{
return;
}
initialized = true;
Instance = this;
harmony.PatchAll(Assembly.GetExecutingAssembly());
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
SkinwalkerLogger.Initialize("RugbugRedfern.SkinwalkerModExperimental");
SkinwalkerLogger.Log("SKINWALKER MOD STARTING UP 3.0.1");
SkinwalkerConfig.InitConfig();
SceneManager.sceneLoaded += SkinwalkerNetworkManagerHandler.ClientConnectInitializer;
GameObject val = new GameObject("Skinwalker Mod");
val.AddComponent<SkinwalkerModPersistent>();
((Object)val).hideFlags = (HideFlags)61;
Object.DontDestroyOnLoad((Object)(object)val);
Logs.SetLogLevel((LogCategory)1, (LogLevel)4);
Logs.SetLogLevel((LogCategory)3, (LogLevel)4);
Logs.SetLogLevel((LogCategory)2, (LogLevel)4);
GameObject val2 = new GameObject("Logo Manager");
val2.AddComponent<LogoManager>();
((Object)val2).hideFlags = (HideFlags)61;
Object.DontDestroyOnLoad((Object)(object)val2);
}
public void BindConfig<T>(ref ConfigEntry<T> config, string section, string key, T defaultValue, string description = "")
{
config = ((BaseUnityPlugin)this).Config.Bind<T>(section, key, defaultValue, description);
}
}
internal class SkinwalkerBehaviour : MonoBehaviour
{
private AudioSource audioSource;
public const float PLAY_INTERVAL_MIN = 15f;
public const float PLAY_INTERVAL_MAX = 40f;
private const float MAX_DIST = 100f;
private float nextTimeToPlayAudio;
private EnemyAI ai;
public void Initialize(EnemyAI ai)
{
this.ai = ai;
audioSource = ai.creatureVoice;
SetNextTime();
}
private void Update()
{
if (Time.time > nextTimeToPlayAudio)
{
SetNextTime();
AttemptPlaySound();
}
}
private void AttemptPlaySound()
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Expected O, but got Unknown
//IL_0127: 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_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
float num = -1f;
if (Object.op_Implicit((Object)(object)ai) && !ai.isEnemyDead)
{
if (((Object)((Component)ai).gameObject).name == "DressGirl(Clone)")
{
DressGirlAI val = (DressGirlAI)ai;
if ((Object)(object)val.hauntingPlayer != (Object)(object)StartOfRound.Instance.localPlayerController)
{
SkinwalkerLogger.Log(((Object)this).name + " played voice line no (not haunted) EnemyAI: " + (object)ai);
return;
}
if (!val.staringInHaunt && !((EnemyAI)val).moveTowardsDestination)
{
SkinwalkerLogger.Log(((Object)this).name + " played voice line no (not visible) EnemyAI: " + (object)ai);
return;
}
}
Vector3 val2 = (StartOfRound.Instance.localPlayerController.isPlayerDead ? ((Component)StartOfRound.Instance.spectateCamera).transform.position : ((Component)StartOfRound.Instance.localPlayerController).transform.position);
if ((Object)(object)StartOfRound.Instance == (Object)null || (Object)(object)StartOfRound.Instance.localPlayerController == (Object)null || (num = Vector3.Distance(val2, ((Component)this).transform.position)) < 100f)
{
AudioRecording sample = AudioAggregator.GetSample();
if (sample != null)
{
audioSource.PlayOneShot(sample.clip);
SkinwalkerLogger.Log(((Object)this).name + " played voice line 1");
}
else
{
SkinwalkerLogger.Log(((Object)this).name + " played voice line 0");
}
}
else
{
SkinwalkerLogger.Log(((Object)this).name + " played voice line no (too far away) " + num);
}
}
else
{
SkinwalkerLogger.Log(((Object)this).name + " played voice line no (dead) EnemyAI: " + (object)ai);
}
}
private void SetNextTime()
{
if (SkinwalkerNetworkManager.Instance.VoiceLineFrequency.Value <= 0f)
{
nextTimeToPlayAudio = Time.time + 100000000f;
}
else
{
nextTimeToPlayAudio = Time.time + Random.Range(15f, 40f) / SkinwalkerNetworkManager.Instance.VoiceLineFrequency.Value;
}
}
}
internal class SkinwalkerConfig
{
public static ConfigEntry<bool> VoiceEnabled_BaboonHawk;
public static ConfigEntry<bool> VoiceEnabled_Bracken;
public static ConfigEntry<bool> VoiceEnabled_BunkerSpider;
public static ConfigEntry<bool> VoiceEnabled_Centipede;
public static ConfigEntry<bool> VoiceEnabled_CoilHead;
public static ConfigEntry<bool> VoiceEnabled_EyelessDog;
public static ConfigEntry<bool> VoiceEnabled_ForestGiant;
public static ConfigEntry<bool> VoiceEnabled_GhostGirl;
public static ConfigEntry<bool> VoiceEnabled_GiantWorm;
public static ConfigEntry<bool> VoiceEnabled_HoardingBug;
public static ConfigEntry<bool> VoiceEnabled_Hygrodere;
public static ConfigEntry<bool> VoiceEnabled_Jester;
public static ConfigEntry<bool> VoiceEnabled_Masked;
public static ConfigEntry<bool> VoiceEnabled_Nutcracker;
public static ConfigEntry<bool> VoiceEnabled_SporeLizard;
public static ConfigEntry<bool> VoiceEnabled_Thumper;
public static ConfigEntry<bool> VoiceEnabled_OtherEnemies;
public static ConfigEntry<float> VoiceLineFrequency;
public static void InitConfig()
{
PluginLoader.Instance.BindConfig(ref VoiceLineFrequency, "Voice Settings", "VoiceLineFrequency", 1f, "1 is the default, and voice lines will occur every " + 15f.ToString("0") + " to " + 40f.ToString("0") + " seconds per enemy. Setting this to 2 means they will occur twice as often, 0.5 means half as often, etc.");
PluginLoader.Instance.BindConfig(ref VoiceEnabled_BaboonHawk, "Monster Voices", "Baboon Hawk", defaultValue: true);
PluginLoader.Instance.BindConfig(ref VoiceEnabled_Bracken, "Monster Voices", "Bracken", defaultValue: true);
PluginLoader.Instance.BindConfig(ref VoiceEnabled_BunkerSpider, "Monster Voices", "Bunker Spider", defaultValue: true);
PluginLoader.Instance.BindConfig(ref VoiceEnabled_Centipede, "Monster Voices", "Centipede", defaultValue: true);
PluginLoader.Instance.BindConfig(ref VoiceEnabled_CoilHead, "Monster Voices", "Coil Head", defaultValue: true);
PluginLoader.Instance.BindConfig(ref VoiceEnabled_EyelessDog, "Monster Voices", "Eyeless Dog", defaultValue: true);
PluginLoader.Instance.BindConfig(ref VoiceEnabled_ForestGiant, "Monster Voices", "Forest Giant", defaultValue: false);
PluginLoader.Instance.BindConfig(ref VoiceEnabled_GhostGirl, "Monster Voices", "Ghost Girl", defaultValue: true);
PluginLoader.Instance.BindConfig(ref VoiceEnabled_GiantWorm, "Monster Voices", "Giant Worm", defaultValue: false);
PluginLoader.Instance.BindConfig(ref VoiceEnabled_HoardingBug, "Monster Voices", "Hoarding Bug", defaultValue: true);
PluginLoader.Instance.BindConfig(ref VoiceEnabled_Hygrodere, "Monster Voices", "Hygrodere", defaultValue: false);
PluginLoader.Instance.BindConfig(ref VoiceEnabled_Jester, "Monster Voices", "Jester", defaultValue: true);
PluginLoader.Instance.BindConfig(ref VoiceEnabled_Masked, "Monster Voices", "Masked", defaultValue: true);
PluginLoader.Instance.BindConfig(ref VoiceEnabled_Nutcracker, "Monster Voices", "Nutcracker", defaultValue: true);
PluginLoader.Instance.BindConfig(ref VoiceEnabled_SporeLizard, "Monster Voices", "Spore Lizard", defaultValue: true);
PluginLoader.Instance.BindConfig(ref VoiceEnabled_Thumper, "Monster Voices", "Thumper", defaultValue: true);
PluginLoader.Instance.BindConfig(ref VoiceEnabled_OtherEnemies, "Monster Voices", "Other Enemies (Including Modded)", defaultValue: true);
SkinwalkerLogger.Log("VoiceEnabled_BaboonHawk" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_BaboonHawk.Value}]");
SkinwalkerLogger.Log("VoiceEnabled_Bracken" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Bracken.Value}]");
SkinwalkerLogger.Log("VoiceEnabled_BunkerSpider" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_BunkerSpider.Value}]");
SkinwalkerLogger.Log("VoiceEnabled_Centipede" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Centipede.Value}]");
SkinwalkerLogger.Log("VoiceEnabled_CoilHead" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_CoilHead.Value}]");
SkinwalkerLogger.Log("VoiceEnabled_EyelessDog" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_EyelessDog.Value}]");
SkinwalkerLogger.Log("VoiceEnabled_ForestGiant" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_ForestGiant.Value}]");
SkinwalkerLogger.Log("VoiceEnabled_GhostGirl" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_GhostGirl.Value}]");
SkinwalkerLogger.Log("VoiceEnabled_GiantWorm" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_GiantWorm.Value}]");
SkinwalkerLogger.Log("VoiceEnabled_HoardingBug" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_HoardingBug.Value}]");
SkinwalkerLogger.Log("VoiceEnabled_Hygrodere" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Hygrodere.Value}]");
SkinwalkerLogger.Log("VoiceEnabled_Jester" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Jester.Value}]");
SkinwalkerLogger.Log("VoiceEnabled_Masked" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Masked.Value}]");
SkinwalkerLogger.Log("VoiceEnabled_Nutcracker" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Nutcracker.Value}]");
SkinwalkerLogger.Log("VoiceEnabled_SporeLizard" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_SporeLizard.Value}]");
SkinwalkerLogger.Log("VoiceEnabled_Thumper" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_Thumper.Value}]");
SkinwalkerLogger.Log("VoiceEnabled_OtherEnemies" + $" VALUE LOADED FROM CONFIG: [{VoiceEnabled_OtherEnemies.Value}]");
SkinwalkerLogger.Log("VoiceLineFrequency" + $" VALUE LOADED FROM CONFIG: [{VoiceLineFrequency.Value}]");
}
}
internal static class SkinwalkerLogger
{
internal static ManualLogSource logSource;
public static void Initialize(string modGUID)
{
logSource = Logger.CreateLogSource(modGUID);
}
public static void Log(object message)
{
logSource.LogInfo(message);
}
public static void LogError(object message)
{
logSource.LogError(message);
}
public static void LogWarning(object message)
{
logSource.LogWarning(message);
}
}
public class SkinwalkerModPersistent : MonoBehaviour
{
private float nextTimeToCheckEnemies = 30f;
private const float enemyScanInterval = 5f;
public static SkinwalkerModPersistent Instance { get; private set; }
private void Awake()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
((Component)this).transform.position = Vector3.zero;
SkinwalkerLogger.Log("Skinwalker Mod Object Initialized");
DebugSettings.Instance.EnablePlaybackDiagnostics = true;
DebugSettings.Instance.RecordFinalAudio = true;
string path = Path.Combine(Application.dataPath, "..", "Dissonance_Diagnostics");
if (Directory.Exists(path))
{
Directory.Delete(path, recursive: true);
}
}
private void Update()
{
if (!(Time.realtimeSinceStartup > nextTimeToCheckEnemies))
{
return;
}
nextTimeToCheckEnemies = Time.realtimeSinceStartup + 5f;
EnemyAI[] array = Object.FindObjectsOfType<EnemyAI>(true);
EnemyAI[] array2 = array;
SkinwalkerBehaviour skinwalkerBehaviour = default(SkinwalkerBehaviour);
foreach (EnemyAI val in array2)
{
if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)null))
{
SkinwalkerLogger.Log("IsEnemyEnabled check: " + ((Object)val).name);
SkinwalkerLogger.Log(IsEnemyEnabled(val));
if (IsEnemyEnabled(val) && !((Component)val).TryGetComponent<SkinwalkerBehaviour>(ref skinwalkerBehaviour))
{
((Component)val).gameObject.AddComponent<SkinwalkerBehaviour>().Initialize(val);
}
}
}
}
private bool IsEnemyEnabled(EnemyAI enemy)
{
if ((Object)(object)enemy == (Object)null)
{
return false;
}
return ((Object)((Component)enemy).gameObject).name switch
{
"MaskedPlayerEnemy(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Masked.Value,
"NutcrackerEnemy(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Nutcracker.Value,
"BaboonHawkEnemy(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_BaboonHawk.Value,
"Flowerman(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Bracken.Value,
"SandSpider(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_BunkerSpider.Value,
"RedLocustBees(Clone)" => false,
"Centipede(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Centipede.Value,
"SpringMan(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_CoilHead.Value,
"MouthDog(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_EyelessDog.Value,
"ForestGiant(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_ForestGiant.Value,
"DressGirl(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_GhostGirl.Value,
"SandWorm(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_GiantWorm.Value,
"HoarderBug(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_HoardingBug.Value,
"Blob(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Hygrodere.Value,
"JesterEnemy(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Jester.Value,
"PufferEnemy(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_SporeLizard.Value,
"Crawler(Clone)" => SkinwalkerNetworkManager.Instance.VoiceEnabled_Thumper.Value,
"DocileLocustBees(Clone)" => false,
"DoublewingedBird(Clone)" => false,
_ => SkinwalkerNetworkManager.Instance.VoiceEnabled_OtherEnemies.Value,
};
}
}
internal static class SkinwalkerNetworkManagerHandler
{
internal static void ClientConnectInitializer(Scene sceneName, LoadSceneMode sceneEnum)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
if (((Scene)(ref sceneName)).name == "SampleSceneRelay")
{
GameObject val = new GameObject("SkinwalkerNetworkManager");
val.AddComponent<NetworkObject>();
val.AddComponent<SkinwalkerNetworkManager>();
Debug.Log((object)"Initialized SkinwalkerNetworkManager");
}
}
}
internal class SkinwalkerNetworkManager : NetworkBehaviour
{
public NetworkVariable<bool> VoiceEnabled_BaboonHawk = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
public NetworkVariable<bool> VoiceEnabled_Bracken = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
public NetworkVariable<bool> VoiceEnabled_BunkerSpider = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
public NetworkVariable<bool> VoiceEnabled_Centipede = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
public NetworkVariable<bool> VoiceEnabled_CoilHead = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
public NetworkVariable<bool> VoiceEnabled_EyelessDog = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
public NetworkVariable<bool> VoiceEnabled_ForestGiant = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
public NetworkVariable<bool> VoiceEnabled_GhostGirl = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
public NetworkVariable<bool> VoiceEnabled_GiantWorm = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
public NetworkVariable<bool> VoiceEnabled_HoardingBug = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
public NetworkVariable<bool> VoiceEnabled_Hygrodere = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
public NetworkVariable<bool> VoiceEnabled_Jester = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
public NetworkVariable<bool> VoiceEnabled_Masked = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
public NetworkVariable<bool> VoiceEnabled_Nutcracker = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
public NetworkVariable<bool> VoiceEnabled_SporeLizard = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
public NetworkVariable<bool> VoiceEnabled_Thumper = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
public NetworkVariable<bool> VoiceEnabled_OtherEnemies = new NetworkVariable<bool>(true, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
public NetworkVariable<float> VoiceLineFrequency = new NetworkVariable<float>(1f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
public static SkinwalkerNetworkManager Instance { get; private set; }
private void Awake()
{
Instance = this;
if (GameNetworkManager.Instance.isHostingGame)
{
VoiceEnabled_BaboonHawk.Value = SkinwalkerConfig.VoiceEnabled_BaboonHawk.Value;
VoiceEnabled_Bracken.Value = SkinwalkerConfig.VoiceEnabled_Bracken.Value;
VoiceEnabled_BunkerSpider.Value = SkinwalkerConfig.VoiceEnabled_BunkerSpider.Value;
VoiceEnabled_Centipede.Value = SkinwalkerConfig.VoiceEnabled_Centipede.Value;
VoiceEnabled_CoilHead.Value = SkinwalkerConfig.VoiceEnabled_CoilHead.Value;
VoiceEnabled_EyelessDog.Value = SkinwalkerConfig.VoiceEnabled_EyelessDog.Value;
VoiceEnabled_ForestGiant.Value = SkinwalkerConfig.VoiceEnabled_ForestGiant.Value;
VoiceEnabled_GhostGirl.Value = SkinwalkerConfig.VoiceEnabled_GhostGirl.Value;
VoiceEnabled_GiantWorm.Value = SkinwalkerConfig.VoiceEnabled_GiantWorm.Value;
VoiceEnabled_HoardingBug.Value = SkinwalkerConfig.VoiceEnabled_HoardingBug.Value;
VoiceEnabled_Hygrodere.Value = SkinwalkerConfig.VoiceEnabled_Hygrodere.Value;
VoiceEnabled_Jester.Value = SkinwalkerConfig.VoiceEnabled_Jester.Value;
VoiceEnabled_Masked.Value = SkinwalkerConfig.VoiceEnabled_Masked.Value;
VoiceEnabled_Nutcracker.Value = SkinwalkerConfig.VoiceEnabled_Nutcracker.Value;
VoiceEnabled_SporeLizard.Value = SkinwalkerConfig.VoiceEnabled_SporeLizard.Value;
VoiceEnabled_Thumper.Value = SkinwalkerConfig.VoiceEnabled_Thumper.Value;
VoiceEnabled_OtherEnemies.Value = SkinwalkerConfig.VoiceEnabled_OtherEnemies.Value;
VoiceLineFrequency.Value = SkinwalkerConfig.VoiceLineFrequency.Value;
SkinwalkerLogger.Log("HOST SENDING CONFIG TO CLIENTS");
}
SkinwalkerLogger.Log("SkinwalkerNetworkManager Awake");
}
public override void OnDestroy()
{
((NetworkBehaviour)this).OnDestroy();
SkinwalkerLogger.Log("SkinwalkerNetworkManager OnDestroy");
AudioAggregator.ClearCache();
}
protected override void __initializeVariables()
{
if (VoiceEnabled_BaboonHawk == null)
{
throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_BaboonHawk cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)VoiceEnabled_BaboonHawk).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_BaboonHawk, "VoiceEnabled_BaboonHawk");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_BaboonHawk);
if (VoiceEnabled_Bracken == null)
{
throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Bracken cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)VoiceEnabled_Bracken).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Bracken, "VoiceEnabled_Bracken");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Bracken);
if (VoiceEnabled_BunkerSpider == null)
{
throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_BunkerSpider cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)VoiceEnabled_BunkerSpider).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_BunkerSpider, "VoiceEnabled_BunkerSpider");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_BunkerSpider);
if (VoiceEnabled_Centipede == null)
{
throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Centipede cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)VoiceEnabled_Centipede).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Centipede, "VoiceEnabled_Centipede");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Centipede);
if (VoiceEnabled_CoilHead == null)
{
throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_CoilHead cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)VoiceEnabled_CoilHead).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_CoilHead, "VoiceEnabled_CoilHead");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_CoilHead);
if (VoiceEnabled_EyelessDog == null)
{
throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_EyelessDog cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)VoiceEnabled_EyelessDog).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_EyelessDog, "VoiceEnabled_EyelessDog");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_EyelessDog);
if (VoiceEnabled_ForestGiant == null)
{
throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_ForestGiant cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)VoiceEnabled_ForestGiant).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_ForestGiant, "VoiceEnabled_ForestGiant");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_ForestGiant);
if (VoiceEnabled_GhostGirl == null)
{
throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_GhostGirl cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)VoiceEnabled_GhostGirl).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_GhostGirl, "VoiceEnabled_GhostGirl");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_GhostGirl);
if (VoiceEnabled_GiantWorm == null)
{
throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_GiantWorm cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)VoiceEnabled_GiantWorm).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_GiantWorm, "VoiceEnabled_GiantWorm");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_GiantWorm);
if (VoiceEnabled_HoardingBug == null)
{
throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_HoardingBug cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)VoiceEnabled_HoardingBug).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_HoardingBug, "VoiceEnabled_HoardingBug");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_HoardingBug);
if (VoiceEnabled_Hygrodere == null)
{
throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Hygrodere cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)VoiceEnabled_Hygrodere).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Hygrodere, "VoiceEnabled_Hygrodere");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Hygrodere);
if (VoiceEnabled_Jester == null)
{
throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Jester cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)VoiceEnabled_Jester).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Jester, "VoiceEnabled_Jester");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Jester);
if (VoiceEnabled_Masked == null)
{
throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Masked cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)VoiceEnabled_Masked).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Masked, "VoiceEnabled_Masked");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Masked);
if (VoiceEnabled_Nutcracker == null)
{
throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Nutcracker cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)VoiceEnabled_Nutcracker).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Nutcracker, "VoiceEnabled_Nutcracker");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Nutcracker);
if (VoiceEnabled_SporeLizard == null)
{
throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_SporeLizard cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)VoiceEnabled_SporeLizard).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_SporeLizard, "VoiceEnabled_SporeLizard");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_SporeLizard);
if (VoiceEnabled_Thumper == null)
{
throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_Thumper cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)VoiceEnabled_Thumper).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_Thumper, "VoiceEnabled_Thumper");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_Thumper);
if (VoiceEnabled_OtherEnemies == null)
{
throw new Exception("SkinwalkerNetworkManager.VoiceEnabled_OtherEnemies cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)VoiceEnabled_OtherEnemies).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceEnabled_OtherEnemies, "VoiceEnabled_OtherEnemies");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceEnabled_OtherEnemies);
if (VoiceLineFrequency == null)
{
throw new Exception("SkinwalkerNetworkManager.VoiceLineFrequency cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)VoiceLineFrequency).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)VoiceLineFrequency, "VoiceLineFrequency");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)VoiceLineFrequency);
((NetworkBehaviour)this).__initializeVariables();
}
protected internal override string __getTypeName()
{
return "SkinwalkerNetworkManager";
}
}
}
namespace SkinwalkerMod.Properties
{
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
ResourceManager resourceManager = new ResourceManager("SkinwalkerMod.Properties.Resources", typeof(Resources).Assembly);
resourceMan = resourceManager;
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal static byte[] logos
{
get
{
object @object = ResourceManager.GetObject("logos", resourceCulture);
return (byte[])@object;
}
}
internal Resources()
{
}
}
}