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.Config;
using HarmonyLib;
using SkinwalkerMod.Properties;
using Steamworks;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Networking;
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 class LogoManager : MonoBehaviour
{
private AssetBundle bundle;
private readonly Logo[] logos = new Logo[5]
{
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" }
}
};
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.SkinwalkerMod", "Skinwalker Mod", "5.0.0")]
internal class PluginLoader : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("RugbugRedfern.SkinwalkerMod");
private const string modGUID = "RugbugRedfern.SkinwalkerMod";
private const string modVersion = "5.0.0";
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.SkinwalkerMod");
SkinwalkerLogger.Log("SKINWALKER MOD STARTING UP 5.0.0");
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)
{
AudioClip sample = SkinwalkerModPersistent.Instance.GetSample();
if ((Object)(object)sample != (Object)null)
{
SkinwalkerLogger.Log(((Object)this).name + " played voice line 1");
audioSource.PlayOneShot(sample);
}
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;
}
}
private T CopyComponent<T>(T original, GameObject destination) where T : Component
{
Type type = ((object)original).GetType();
Component val = destination.AddComponent(type);
FieldInfo[] fields = type.GetFields();
FieldInfo[] array = fields;
foreach (FieldInfo fieldInfo in array)
{
fieldInfo.SetValue(val, fieldInfo.GetValue(original));
}
return (T)(object)((val is T) ? val : null);
}
}
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 string audioFolder;
private List<AudioClip> cachedAudio = new List<AudioClip>();
private float nextTimeToCheckFolder = 30f;
private float nextTimeToCheckEnemies = 30f;
private const float folderScanInterval = 8f;
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");
audioFolder = Path.Combine(Application.dataPath, "..", "Dissonance_Diagnostics");
EnableRecording();
if (!Directory.Exists(audioFolder))
{
Directory.CreateDirectory(audioFolder);
}
}
private void Start()
{
try
{
if (Directory.Exists(audioFolder))
{
Directory.Delete(audioFolder, recursive: true);
}
}
catch (Exception message)
{
SkinwalkerLogger.Log(message);
}
}
private void OnApplicationQuit()
{
DisableRecording();
}
private void EnableRecording()
{
DebugSettings.Instance.EnablePlaybackDiagnostics = true;
DebugSettings.Instance.RecordFinalAudio = true;
}
private void Update()
{
if (Time.realtimeSinceStartup > nextTimeToCheckFolder)
{
nextTimeToCheckFolder = Time.realtimeSinceStartup + 8f;
if (!Directory.Exists(audioFolder))
{
SkinwalkerLogger.Log("Audio folder not present. Don't worry about it, it will be created automatically when you play with friends. (" + audioFolder + ")");
return;
}
string[] files = Directory.GetFiles(audioFolder);
SkinwalkerLogger.Log($"Got audio file paths ({files.Length})");
string[] array = files;
foreach (string path in array)
{
((MonoBehaviour)this).StartCoroutine(LoadWavFile(path, delegate(AudioClip audioClip)
{
cachedAudio.Add(audioClip);
}));
}
}
if (!(Time.realtimeSinceStartup > nextTimeToCheckEnemies))
{
return;
}
nextTimeToCheckEnemies = Time.realtimeSinceStartup + 5f;
EnemyAI[] array2 = Object.FindObjectsOfType<EnemyAI>(true);
EnemyAI[] array3 = array2;
SkinwalkerBehaviour skinwalkerBehaviour = default(SkinwalkerBehaviour);
foreach (EnemyAI val in array3)
{
SkinwalkerLogger.Log("IsEnemyEnabled " + ((Object)val).name + " " + 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 IEnumerator LoadWavFile(string path, Action<AudioClip> callback)
{
UnityWebRequest www = UnityWebRequestMultimedia.GetAudioClip(path, (AudioType)20);
try
{
yield return www.SendWebRequest();
if ((int)www.result == 1)
{
SkinwalkerLogger.Log("Loaded clip from path " + path);
AudioClip audioClip = DownloadHandlerAudioClip.GetContent(www);
if (audioClip.length > 0.9f)
{
callback(audioClip);
}
try
{
File.Delete(path);
}
catch (Exception e)
{
SkinwalkerLogger.LogWarning(e);
}
}
}
finally
{
((IDisposable)www)?.Dispose();
}
}
private void DisableRecording()
{
DebugSettings.Instance.EnablePlaybackDiagnostics = false;
DebugSettings.Instance.RecordFinalAudio = false;
if (Directory.Exists(audioFolder))
{
Directory.Delete(audioFolder, recursive: true);
}
}
public AudioClip GetSample()
{
while (cachedAudio.Count > 200)
{
cachedAudio.RemoveAt(Random.Range(0, cachedAudio.Count));
}
if (cachedAudio.Count > 0)
{
int index = Random.Range(0, cachedAudio.Count - 1);
AudioClip result = cachedAudio[index];
cachedAudio.RemoveAt(index);
return result;
}
return null;
}
public void ClearCache()
{
cachedAudio.Clear();
}
}
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");
SkinwalkerModPersistent.Instance?.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()
{
}
}
}