Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of RareSkeletonRunner v1.1.0
plugins/RareSkeletonMod.dll
Decompiled 4 days agousing System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using UnityEngine; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RareSkeletonMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RareSkeletonMod")] [assembly: AssemblyTitle("RareSkeletonMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace RareSkeletonMod { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.custom.rareskeleton", "Rare Skeleton Runner", "1.1.0")] public class RareSkeletonPlugin : BaseUnityPlugin { private ConfigEntry<int> _oneInXChance; private ConfigEntry<float> _checkIntervalSeconds; private ConfigEntry<KeyboardShortcut> _testTriggerKey; private ConfigEntry<float> _runSpeed; private ConfigEntry<float> _animationFPS; private ConfigEntry<float> _spriteScale; private ConfigEntry<bool> _streamerSafeMode; private ConfigEntry<bool> _useAltAudio; private ConfigEntry<float> _riffVolume; private ConfigEntry<bool> _umbrellaEnabled; private ConfigEntry<float> _umbrellaSpawnMinutes; private ConfigEntry<float> _umbrellaStartSpeedPercent; private ConfigEntry<float> _umbrellaSpeedStepPercent; private ConfigEntry<float> _umbrellaHitDamage; private ConfigEntry<float> _umbrellaSpriteHeight; private ConfigEntry<KeyboardShortcut> _testUmbrellaKey; private Sprite[] _frames; private Sprite _modIconSprite; private Image _skeletonImage; private RectTransform _rectTransform; private Canvas _canvas; private AudioSource _audioSource; private AudioClip _streamerSafeClip; private AudioClip _primaryRiffClip; private AudioClip _altRiffClip; private float _checkTimer; private float _animTimer; private int _currentFrame; private bool _isRunning; private int _direction = 1; private AudioClip _ofsClip; private AudioClip _nearChimeClip; private AudioClip _hitChimeClip; private GameObject _umbrellaObj; private Material _umbrellaMat; private bool _umbrellaActive; private bool _playedNearChimeThisChase; private float _stageElapsedTimer; private float _umbrellaChaseElapsed; private float _umbrellaHitCooldown; private bool _spawnedThisStage; private bool _isCommencement; private float _aspectRatio = 1f; private const float ProximityRadius = 18f; private void Awake() { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) BindConfigSettings(); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "skeleton.png"); string path = Path.Combine(directoryName, "icon.png"); string umbrellaPath = Path.Combine(directoryName, "umbrella.png"); if (File.Exists(path)) { _modIconSprite = LoadSingleSprite(path); } if (!File.Exists(text)) { ((BaseUnityPlugin)this).Logger.LogError((object)("[RareSkeleton] Could not find skeleton.png at: " + text)); return; } LoadSpritesheet(text); SetupCanvas(); SetupAudio(directoryName); SetupUmbrellaVisual(umbrellaPath); SetupRiskOfOptions(); SceneManager.sceneLoaded += OnSceneLoaded; TeleporterInteraction.onTeleporterBeginChargingGlobal += OnTeleporterBeginCharging; Scene activeScene = SceneManager.GetActiveScene(); CheckCurrentScene(((Scene)(ref activeScene)).name); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[RareSkeleton] Loaded successfully! Watching for skeletons and Umbrella Men..."); } private void OnDestroy() { SceneManager.sceneLoaded -= OnSceneLoaded; TeleporterInteraction.onTeleporterBeginChargingGlobal -= OnTeleporterBeginCharging; if ((Object)(object)_umbrellaObj != (Object)null) { Object.Destroy((Object)(object)_umbrellaObj); } } private void OnTeleporterBeginCharging(TeleporterInteraction teleporter) { if (_umbrellaActive) { DespawnUmbrellaMan(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"[RareSkeleton] Teleporter boss activated — Umbrella Man despawned."); } _spawnedThisStage = true; } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { _stageElapsedTimer = 0f; _spawnedThisStage = false; DespawnUmbrellaMan(playOfs: false); CheckCurrentScene(((Scene)(ref scene)).name); } private void CheckCurrentScene(string sceneName) { string text = (sceneName ?? string.Empty).ToLowerInvariant(); _isCommencement = text.Contains("moon"); } private void BindConfigSettings() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Expected O, but got Unknown //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Expected O, but got Unknown //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Expected O, but got Unknown //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Expected O, but got Unknown //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Expected O, but got Unknown //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Expected O, but got Unknown //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Expected O, but got Unknown _oneInXChance = ((BaseUnityPlugin)this).Config.Bind<int>("Rarity", "OneInXChance", 3600, new ConfigDescription("The 1-in-X chance per check interval that the skeleton will appear (Range: 1 to 1,000,000).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 1000000), Array.Empty<object>())); _checkIntervalSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Rarity", "CheckIntervalSeconds", 1f, new ConfigDescription("How often (in seconds) the mod rolls the dice to spawn the skeleton.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 60f), Array.Empty<object>())); _testTriggerKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Controls", "TriggerSkeletonKey", new KeyboardShortcut((KeyCode)289, Array.Empty<KeyCode>()), "Keybind to manually summon the skeleton across your screen at any time."); _testUmbrellaKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Controls", "TriggerUmbrellaKey", new KeyboardShortcut((KeyCode)290, Array.Empty<KeyCode>()), "Keybind to manually test-spawn the 3D Umbrella Man stalker."); _runSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Appearance", "RunSpeed", 250f, new ConfigDescription("How fast the skeleton moves across the screen (in pixels per second).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3000f), Array.Empty<object>())); _animationFPS = ((BaseUnityPlugin)this).Config.Bind<float>("Appearance", "AnimationFPS", 24f, new ConfigDescription("Frame rate of the skeleton's running animation.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 60f), Array.Empty<object>())); _spriteScale = ((BaseUnityPlugin)this).Config.Bind<float>("Appearance", "SpriteScale", 4.5f, new ConfigDescription("Size multiplier for the skeleton sprite.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 15f), Array.Empty<object>())); _streamerSafeMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Audio", "StreamerSafeMode", true, "When enabled, uses built-in copyright-free synthesized audio instead of external custom clips."); _useAltAudio = ((BaseUnityPlugin)this).Config.Bind<bool>("Audio", "UseAltAudio", false, "If enabled, uses alt_riff.mp3 for the skeleton runner when available."); _riffVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Audio", "RiffVolume", 0.8f, new ConfigDescription("Volume for mod audio clips (0.0 = muted, 1.0 = full volume).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); _umbrellaEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Umbrella Man", "Enabled", true, "Toggle the 3D Umbrella Man stalker on or off (automatically skips Commencement and despawns when the Teleporter boss is activated)."); _umbrellaSpawnMinutes = ((BaseUnityPlugin)this).Config.Bind<float>("Umbrella Man", "SpawnDelayMinutes", 5f, new ConfigDescription("Minutes after entering a stage before Umbrella Man spawns (0 = instant spawn on stage entry, 5 = default, 10 = 10 minutes).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); _umbrellaStartSpeedPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Umbrella Man", "StartingMoveSpeedPercent", 10f, new ConfigDescription("Starting speed as a percentage of your player character's move speed (1% = barely moving, 10% = slow creep [default], 100% = full player speed).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 100f), Array.Empty<object>())); _umbrellaSpeedStepPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Umbrella Man", "SpeedAddedEvery30sPercent", 5f, new ConfigDescription("Percentage of player move speed added every 30 seconds (1% = gentle ramp, 10% = aggressive ramp).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), Array.Empty<object>())); _umbrellaHitDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Umbrella Man", "HitDamage", 75f, new ConfigDescription("Heavy damage dealt when the Umbrella Man catches you. Keep moving to dodge!", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 9999f), Array.Empty<object>())); _umbrellaSpriteHeight = ((BaseUnityPlugin)this).Config.Bind<float>("Umbrella Man", "SpriteHeight", 4.5f, new ConfigDescription("Height of the 3D Umbrella Man billboard in world units.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 25f), Array.Empty<object>())); } private void SetupRiskOfOptions() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0065: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: 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_014d: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Expected O, but got Unknown //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Expected O, but got Unknown //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Expected O, but got Unknown //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Expected O, but got Unknown //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Expected O, but got Unknown //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Expected O, but got Unknown //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Expected O, but got Unknown //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Expected O, but got Unknown //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Expected O, but got Unknown //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Expected O, but got Unknown //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Expected O, but got Unknown //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Expected O, but got Unknown //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Expected O, but got Unknown //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Expected O, but got Unknown //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Expected O, but got Unknown //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Expected O, but got Unknown //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Expected O, but got Unknown //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Expected O, but got Unknown //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Expected O, but got Unknown //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Expected O, but got Unknown ModSettingsManager.SetModDescription("Rare skeleton runner + 3D Umbrella Man pursuit mod."); if ((Object)(object)_modIconSprite != (Object)null) { ModSettingsManager.SetModIcon(_modIconSprite); } else if (_frames != null && _frames.Length != 0) { ModSettingsManager.SetModIcon(_frames[0]); } ConfigEntry<int> oneInXChance = _oneInXChance; IntFieldConfig val = new IntFieldConfig(); ((NumericFieldConfig<int>)val).Min = 1; ((NumericFieldConfig<int>)val).Max = 1000000; ModSettingsManager.AddOption((BaseOption)new IntFieldOption(oneInXChance, val)); ModSettingsManager.AddOption((BaseOption)new SliderOption(_checkIntervalSeconds, new SliderConfig { min = 0.1f, max = 60f, FormatString = "{0:0.0}s" })); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(_testTriggerKey)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(_testUmbrellaKey)); ModSettingsManager.AddOption((BaseOption)new SliderOption(_spriteScale, new SliderConfig { min = 0.5f, max = 15f, FormatString = "{0:0.0}x" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(_runSpeed, new SliderConfig { min = 0f, max = 3000f, FormatString = "{0:0} px/s" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(_animationFPS, new SliderConfig { min = 1f, max = 60f, FormatString = "{0:0} FPS" })); ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Test Skeleton Run", "Appearance", "Summons the skeleton across your screen right now.", "Run!", (UnityAction)delegate { if (!_isRunning) { StartSkeletonRun(); } })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_streamerSafeMode)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_useAltAudio)); ModSettingsManager.AddOption((BaseOption)new SliderOption(_riffVolume, new SliderConfig { min = 0f, max = 1f, FormatString = "{0:P0}" })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(_umbrellaEnabled)); ModSettingsManager.AddOption((BaseOption)new SliderOption(_umbrellaSpawnMinutes, new SliderConfig { min = 0f, max = 10f, FormatString = "{0:0.0} min" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(_umbrellaStartSpeedPercent, new SliderConfig { min = 1f, max = 100f, FormatString = "{0:0}%" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(_umbrellaSpeedStepPercent, new SliderConfig { min = 1f, max = 10f, FormatString = "+{0:0}%" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(_umbrellaHitDamage, new SliderConfig { min = 0f, max = 9999f, FormatString = "{0:0}" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(_umbrellaSpriteHeight, new SliderConfig { min = 1f, max = 25f, FormatString = "{0:0.0}m" })); ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Spawn Umbrella Man", "Umbrella Man", "Spawns the Umbrella Man near you to test pursuit and audio.", "Spawn!", (UnityAction)delegate { SpawnUmbrellaMan(); })); } private void SetupAudio(string pluginFolder) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown GameObject val = new GameObject("RareSkeletonAudio"); Object.DontDestroyOnLoad((Object)(object)val); _audioSource = val.AddComponent<AudioSource>(); _audioSource.playOnAwake = false; _streamerSafeClip = GenerateStreamerSafeRiff(); string[] array = new string[3] { "riff.mp3", "riff.wav", "riff.ogg" }; foreach (string path in array) { string path2 = Path.Combine(pluginFolder, path); if (File.Exists(path2)) { ((MonoBehaviour)this).StartCoroutine(LoadAudioFile(path2, delegate(AudioClip clip) { _primaryRiffClip = clip; })); break; } } string path3 = Path.Combine(pluginFolder, "alt_riff.mp3"); if (File.Exists(path3)) { ((MonoBehaviour)this).StartCoroutine(LoadAudioFile(path3, delegate(AudioClip clip) { _altRiffClip = clip; })); } FindAndLoadAudio(pluginFolder, new string[3] { "ofs.wav", "ofs.mp3", "ofs.ogg" }, delegate(AudioClip clip) { _ofsClip = clip; }); FindAndLoadAudio(pluginFolder, new string[3] { "windchime5.mp3", "windchime5-wav.mp3", "windchime5.wav" }, delegate(AudioClip clip) { _nearChimeClip = clip; }); FindAndLoadAudio(pluginFolder, new string[3] { "windchime4.mp3", "windchime4-wav.mp3", "windchime4.wav" }, delegate(AudioClip clip) { _hitChimeClip = clip; }); } private void FindAndLoadAudio(string folder, string[] candidates, Action<AudioClip> assign) { foreach (string path in candidates) { string path2 = Path.Combine(folder, path); if (File.Exists(path2)) { ((MonoBehaviour)this).StartCoroutine(LoadAudioFile(path2, assign)); break; } } } private void SetupUmbrellaVisual(string umbrellaPath) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown _umbrellaObj = GameObject.CreatePrimitive((PrimitiveType)5); ((Object)_umbrellaObj).name = "UmbrellaManStalker"; Object.DontDestroyOnLoad((Object)(object)_umbrellaObj); Collider component = _umbrellaObj.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Shader val = Shader.Find("Unlit/Transparent Cutout"); if ((Object)(object)val == (Object)null) { val = Shader.Find("Sprites/Default"); } _umbrellaMat = new Material(val); if (_umbrellaMat.HasProperty("_Cutoff")) { _umbrellaMat.SetFloat("_Cutoff", 0.1f); } if (_umbrellaMat.HasProperty("_Cull")) { _umbrellaMat.SetInt("_Cull", 0); } if (File.Exists(umbrellaPath)) { byte[] array = File.ReadAllBytes(umbrellaPath); Texture2D val2 = new Texture2D(2, 2, (TextureFormat)4, false); ImageConversion.LoadImage(val2, array); ((Texture)val2).filterMode = (FilterMode)0; ((Texture)val2).wrapMode = (TextureWrapMode)1; _umbrellaMat.mainTexture = (Texture)(object)val2; _aspectRatio = ((((Texture)val2).height > 0) ? ((float)((Texture)val2).width / (float)((Texture)val2).height) : 1f); ((BaseUnityPlugin)this).Logger.LogInfo((object)$"[RareSkeleton] Loaded umbrella.png ({((Texture)val2).width}x{((Texture)val2).height})"); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[RareSkeleton] Could not find umbrella.png at: " + umbrellaPath)); _umbrellaMat.color = Color.white; } MeshRenderer component2 = _umbrellaObj.GetComponent<MeshRenderer>(); ((Renderer)component2).material = _umbrellaMat; ((Renderer)component2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component2).receiveShadows = false; _umbrellaObj.SetActive(false); } private AudioClip GenerateStreamerSafeRiff() { int num = 44100; float[] array = new float[5] { 146.83f, 196f, 174.61f, 146.83f, 146.83f }; float[] array2 = new float[5] { 0.16f, 0.16f, 0.16f, 0.16f, 0.42f }; float[] array3 = new float[5] { 0.04f, 0.04f, 0.04f, 0.06f, 0.05f }; float num2 = 0f; for (int i = 0; i < array.Length; i++) { num2 += array2[i] + array3[i]; } int num3 = Mathf.CeilToInt(num2 * (float)num); float[] array4 = new float[num3]; int num4 = 0; for (int j = 0; j < array.Length; j++) { int num5 = Mathf.CeilToInt(array2[j] * (float)num); int num6 = Mathf.CeilToInt(array3[j] * (float)num); float num7 = array[j]; for (int k = 0; k < num5 && num4 + k < num3; k++) { float num8 = (float)k / (float)num; float num9 = (float)k / (float)num5; float num10 = Mathf.Min(1f, num9 * 15f) * (1f - num9 * 0.7f); float num11 = Mathf.Sin(MathF.PI * 2f * num7 * num8); float num12 = Mathf.Sin(MathF.PI * 2f * num7 * 2f * num8) * 0.35f; array4[num4 + k] = Mathf.Clamp((num11 + num12) * num10 * 0.45f, -1f, 1f); } num4 += num5 + num6; } AudioClip obj = AudioClip.Create("StreamerSafeRiff", num3, 1, num, false); obj.SetData(array4, 0); return obj; } private IEnumerator LoadAudioFile(string path, Action<AudioClip> onLoaded) { AudioType val = (AudioType)13; string text = Path.GetExtension(path).ToLowerInvariant(); if (text == ".wav") { val = (AudioType)20; } else if (text == ".ogg") { val = (AudioType)14; } string absoluteUri = new Uri(path).AbsoluteUri; UnityWebRequest uwr = UnityWebRequestMultimedia.GetAudioClip(absoluteUri, val); try { yield return uwr.SendWebRequest(); if ((int)uwr.result == 1) { AudioClip content = DownloadHandlerAudioClip.GetContent(uwr); if ((Object)(object)content != (Object)null) { ((Object)content).name = Path.GetFileName(path); onLoaded?.Invoke(content); ((BaseUnityPlugin)this).Logger.LogInfo((object)("[RareSkeleton] Loaded custom audio: " + ((Object)content).name)); } } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[RareSkeleton] Failed to load audio at " + path + ": " + uwr.error)); } } finally { ((IDisposable)uwr)?.Dispose(); } } private Sprite LoadSingleSprite(string path) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) byte[] array = File.ReadAllBytes(path); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); ImageConversion.LoadImage(val, array); return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } private void LoadSpritesheet(string path) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) byte[] array = File.ReadAllBytes(path); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); ImageConversion.LoadImage(val, array); ((Texture)val).filterMode = (FilterMode)0; int num = 4; int num2 = 4; float num3 = (float)((Texture)val).width / (float)num; float num4 = (float)((Texture)val).height / (float)num2; Vector2Int[] array2 = (Vector2Int[])(object)new Vector2Int[14] { new Vector2Int(0, 0), new Vector2Int(1, 0), new Vector2Int(2, 0), new Vector2Int(0, 1), new Vector2Int(1, 1), new Vector2Int(2, 1), new Vector2Int(3, 1), new Vector2Int(0, 2), new Vector2Int(1, 2), new Vector2Int(2, 2), new Vector2Int(3, 2), new Vector2Int(0, 3), new Vector2Int(1, 3), new Vector2Int(2, 3) }; _frames = (Sprite[])(object)new Sprite[array2.Length]; Rect val2 = default(Rect); for (int i = 0; i < array2.Length; i++) { int x = ((Vector2Int)(ref array2[i])).x; int y = ((Vector2Int)(ref array2[i])).y; float num5 = (float)x * num3; float num6 = (float)(num2 - 1 - y) * num4; ((Rect)(ref val2))..ctor(num5, num6, num3, num4); _frames[i] = Sprite.Create(val, val2, new Vector2(0.5f, 0.5f)); } } private void SetupCanvas() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown GameObject val = new GameObject("RareSkeletonCanvas"); Object.DontDestroyOnLoad((Object)(object)val); _canvas = val.AddComponent<Canvas>(); _canvas.renderMode = (RenderMode)0; _canvas.sortingOrder = 32767; GameObject val2 = new GameObject("SkeletonRunner"); val2.transform.SetParent(val.transform, false); _skeletonImage = val2.AddComponent<Image>(); ((Graphic)_skeletonImage).raycastTarget = false; _skeletonImage.sprite = _frames[0]; ((Behaviour)_skeletonImage).enabled = false; _rectTransform = val2.GetComponent<RectTransform>(); UpdateSpriteSize(); } private void UpdateSpriteSize() { //IL_0039: 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) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) if (_frames != null && _frames.Length != 0 && (Object)(object)_rectTransform != (Object)null) { float value = _spriteScale.Value; RectTransform rectTransform = _rectTransform; Rect rect = _frames[0].rect; float num = ((Rect)(ref rect)).width * value; rect = _frames[0].rect; rectTransform.sizeDelta = new Vector2(num, ((Rect)(ref rect)).height * value); } } private void Update() { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) KeyboardShortcut value; if (_frames != null && (Object)(object)_skeletonImage != (Object)null) { value = _testTriggerKey.Value; if (((KeyboardShortcut)(ref value)).IsDown() && !_isRunning) { StartSkeletonRun(); } if (!_isRunning) { _checkTimer += Time.unscaledDeltaTime; if (_checkTimer >= _checkIntervalSeconds.Value) { _checkTimer = 0f; if (Random.Range(0, _oneInXChance.Value) == 0) { StartSkeletonRun(); } } } else { AnimateAndMove(); } } value = _testUmbrellaKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { SpawnUmbrellaMan(); } UpdateUmbrellaStalker(); } private CharacterBody GetLocalPlayerBody() { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); if (firstLocalUser != null && (Object)(object)firstLocalUser.cachedBody != (Object)null) { return firstLocalUser.cachedBody; } return null; } private bool IsTeleporterActive() { TeleporterInteraction instance = TeleporterInteraction.instance; if ((Object)(object)instance != (Object)null) { if (!instance.isCharging) { return instance.isCharged; } return true; } return false; } private void UpdateUmbrellaStalker() { //IL_013e: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) if (!_umbrellaEnabled.Value || _isCommencement || IsTeleporterActive()) { if (_umbrellaActive) { DespawnUmbrellaMan(); } return; } CharacterBody localPlayerBody = GetLocalPlayerBody(); if ((Object)(object)localPlayerBody == (Object)null) { return; } if (!_umbrellaActive) { if (!_spawnedThisStage) { float num = _umbrellaSpawnMinutes.Value * 60f; if (_stageElapsedTimer >= num) { _spawnedThisStage = true; SpawnUmbrellaMan(); } else { _stageElapsedTimer += Time.deltaTime; } } } else { if ((Object)(object)_umbrellaObj == (Object)null) { return; } _umbrellaChaseElapsed += Time.deltaTime; if (_umbrellaHitCooldown > 0f) { _umbrellaHitCooldown -= Time.deltaTime; } int num2 = Mathf.FloorToInt(_umbrellaChaseElapsed / 30f); float num3 = _umbrellaStartSpeedPercent.Value + _umbrellaSpeedStepPercent.Value * (float)num2; float num4 = Mathf.Max(1f, localPlayerBody.moveSpeed) * (num3 / 100f); float value = _umbrellaSpriteHeight.Value; float num5 = value * _aspectRatio; _umbrellaObj.transform.localScale = new Vector3(num5, value, 1f); Vector3 corePosition = localPlayerBody.corePosition; Vector3 position = _umbrellaObj.transform.position; Vector3 val = corePosition - position; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude > 0.01f) { Vector3 val2 = val / magnitude; _umbrellaObj.transform.position = position + val2 * num4 * Time.deltaTime; } Camera main = Camera.main; if ((Object)(object)main != (Object)null) { _umbrellaObj.transform.LookAt(((Component)main).transform.position, Vector3.up); _umbrellaObj.transform.Rotate(0f, 180f, 0f); } if (!_playedNearChimeThisChase && magnitude <= 18f) { _playedNearChimeThisChase = true; if ((Object)(object)_audioSource != (Object)null && _riffVolume.Value > 0f) { AudioClip val3 = (_streamerSafeMode.Value ? _streamerSafeClip : (_nearChimeClip ?? _streamerSafeClip)); if ((Object)(object)val3 != (Object)null) { _audioSource.PlayOneShot(val3, _riffVolume.Value); } } } float num6 = Mathf.Max(1.5f, num5 * 0.4f); if (magnitude <= num6 && _umbrellaHitCooldown <= 0f) { _umbrellaHitCooldown = 1.5f; ApplyUmbrellaHit(localPlayerBody); } } } private void PlayOfsClip() { if ((Object)(object)_audioSource != (Object)null && _riffVolume.Value > 0f) { AudioClip val = (_streamerSafeMode.Value ? _streamerSafeClip : (_ofsClip ?? _streamerSafeClip)); if ((Object)(object)val != (Object)null) { _audioSource.PlayOneShot(val, _riffVolume.Value); } } } private void SpawnUmbrellaMan() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_00c2: 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) CharacterBody localPlayerBody = GetLocalPlayerBody(); if (!((Object)(object)localPlayerBody == (Object)null) && !((Object)(object)_umbrellaObj == (Object)null)) { _umbrellaActive = true; _playedNearChimeThisChase = false; _umbrellaChaseElapsed = 0f; _umbrellaHitCooldown = 0f; float num = Random.Range(0f, MathF.PI * 2f); float num2 = 42f; Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(Mathf.Cos(num) * num2, 2.5f, Mathf.Sin(num) * num2); Vector3 val2 = localPlayerBody.corePosition + val; RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val2 + Vector3.up * 15f, Vector3.down, ref val3, 60f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask))) { val2 = ((RaycastHit)(ref val3)).point + Vector3.up * (_umbrellaSpriteHeight.Value * 0.5f); } _umbrellaObj.transform.position = val2; _umbrellaObj.SetActive(true); PlayOfsClip(); } } private void ApplyUmbrellaHit(CharacterBody playerBody) { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00c1: 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_00cb: 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_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_00ea: Expected O, but got Unknown if ((Object)(object)_audioSource != (Object)null && _riffVolume.Value > 0f) { AudioClip val = (_streamerSafeMode.Value ? _streamerSafeClip : (_hitChimeClip ?? _streamerSafeClip)); if ((Object)(object)val != (Object)null) { _audioSource.PlayOneShot(val, _riffVolume.Value); } } HealthComponent healthComponent = playerBody.healthComponent; if ((Object)(object)healthComponent != (Object)null && healthComponent.alive && _umbrellaHitDamage.Value > 0f) { DamageInfo val2 = new DamageInfo { attacker = null, inflictor = null, damage = _umbrellaHitDamage.Value, position = playerBody.corePosition, force = Vector3.zero, procCoefficient = 0f, damageType = DamageTypeCombo.op_Implicit((DamageType)1), crit = false }; healthComponent.TakeDamage(val2); } Vector3 val3 = playerBody.corePosition - _umbrellaObj.transform.position; val3.y = 0f; if (((Vector3)(ref val3)).sqrMagnitude > 0.001f) { Transform transform = _umbrellaObj.transform; transform.position -= ((Vector3)(ref val3)).normalized * 12f; } } private void DespawnUmbrellaMan(bool playOfs = true) { bool umbrellaActive = _umbrellaActive; _umbrellaActive = false; if ((Object)(object)_umbrellaObj != (Object)null) { _umbrellaObj.SetActive(false); } if (umbrellaActive && playOfs) { PlayOfsClip(); } } private void StartSkeletonRun() { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_00ef: Unknown result type (might be due to invalid IL or missing references) _isRunning = true; _currentFrame = 0; _animTimer = 0f; _skeletonImage.sprite = _frames[0]; ((Behaviour)_skeletonImage).enabled = true; UpdateSpriteSize(); PlaySelectedAudio(); _direction = ((Random.value > 0.5f) ? 1 : (-1)); ((Transform)_rectTransform).localScale = new Vector3((float)_direction, 1f, 1f); float num = (float)Screen.width / 2f; float x = _rectTransform.sizeDelta.x; float num2 = ((_direction == 1) ? (0f - num - x * 0.25f) : (num + x * 0.25f)); float num3 = (float)Screen.height / 2f - _rectTransform.sizeDelta.y / 2f; float num4 = Random.Range(0f - num3, num3); _rectTransform.anchoredPosition = new Vector2(num2, num4); } private void PlaySelectedAudio() { if (!((Object)(object)_audioSource == (Object)null) && !(_riffVolume.Value <= 0f)) { AudioClip val = null; val = (_streamerSafeMode.Value ? _streamerSafeClip : ((_useAltAudio.Value && (Object)(object)_altRiffClip != (Object)null) ? _altRiffClip : ((!((Object)(object)_primaryRiffClip != (Object)null)) ? _streamerSafeClip : _primaryRiffClip))); if ((Object)(object)val != (Object)null) { _audioSource.PlayOneShot(val, _riffVolume.Value); } } } private void AnimateAndMove() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) _animTimer += Time.unscaledDeltaTime; if (_animTimer >= 1f / _animationFPS.Value) { _animTimer = 0f; _currentFrame++; if (_currentFrame >= _frames.Length) { _isRunning = false; ((Behaviour)_skeletonImage).enabled = false; return; } _skeletonImage.sprite = _frames[_currentFrame]; } Vector2 anchoredPosition = _rectTransform.anchoredPosition; anchoredPosition.x += _runSpeed.Value * (float)_direction * Time.unscaledDeltaTime; _rectTransform.anchoredPosition = anchoredPosition; float num = (float)Screen.width / 2f; float x = _rectTransform.sizeDelta.x; if ((_direction == 1 && anchoredPosition.x > num + x) || (_direction == -1 && anchoredPosition.x < 0f - num - x)) { _isRunning = false; ((Behaviour)_skeletonImage).enabled = false; } } } }