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 Sandevistan Cyberware Effect v1.3.0
SandevistanMod.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; 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 RoR2; using UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.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 SandevistanMod { public enum SandevistanColorMode { EdgerunnersGradient, CyberpunkCyan, ArasakaRed, MilitechGold, NetrunnerPurple, CustomSingle, CustomGradient } public enum SandevistanLanguage { Russian, English } [BepInPlugin("com.kotme.sandevistan", "Sandevistan Cyberware Effect", "1.3.1")] public class SandevistanPlugin : BaseUnityPlugin { public const string PluginGUID = "com.kotme.sandevistan"; public const string PluginName = "Sandevistan Cyberware Effect"; public const string PluginVersion = "1.3.1"; public static ConfigEntry<SandevistanLanguage> MenuLanguage; public static ConfigEntry<float> BonusSpeedPercentThreshold; public static ConfigEntry<bool> OnlyPlayers; public static ConfigEntry<bool> AlwaysActiveTestMode; public static ConfigEntry<bool> EnableManualKey; public static ConfigEntry<KeyCode> ManualActivationKey; public static ConfigEntry<float> ManualDuration; public static ConfigEntry<SandevistanColorMode> ColorMode; public static ConfigEntry<float> CustomColor1R; public static ConfigEntry<float> CustomColor1G; public static ConfigEntry<float> CustomColor1B; public static ConfigEntry<float> CustomColor2R; public static ConfigEntry<float> CustomColor2G; public static ConfigEntry<float> CustomColor2B; public static ConfigEntry<float> EmissionIntensity; public static ConfigEntry<float> SpawnInterval; public static ConfigEntry<float> AfterimageLifetime; public static ConfigEntry<float> MinMoveDistance; public static ConfigEntry<float> InitialAlpha; public static ConfigEntry<float> GhostScaleMultiplier; public static ConfigEntry<bool> EnableScreenVignette; public static ConfigEntry<bool> EnableActivationSound; private GameObject _managerObject; public static SandevistanPlugin Instance { get; private set; } private void Awake() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) Instance = this; InitConfig(); EnsureManagerExists(); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(EnsureManagerExists)); RoR2Application.onUpdate += OnRoR2Update; CharacterBody.onBodyStartGlobal += OnBodyStartGlobal; ((BaseUnityPlugin)this).Logger.LogInfo((object)string.Format("{0} v{1} loaded! Press [F6] for settings or [{2}] to test.", "Sandevistan Cyberware Effect", "1.3.1", ManualActivationKey.Value)); } private void OnDestroy() { RoR2Application.onLoad = (Action)Delegate.Remove(RoR2Application.onLoad, new Action(EnsureManagerExists)); RoR2Application.onUpdate -= OnRoR2Update; CharacterBody.onBodyStartGlobal -= OnBodyStartGlobal; } private void EnsureManagerExists() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown if ((Object)(object)_managerObject == (Object)null) { _managerObject = new GameObject("SandevistanGlobalManager"); Object.DontDestroyOnLoad((Object)(object)_managerObject); _managerObject.AddComponent<SandevistanGlobalManager>(); } } private void OnRoR2Update() { EnsureManagerExists(); if ((Object)(object)SandevistanGlobalManager.Instance != (Object)null) { SandevistanGlobalManager.Instance.TickUpdate(); } } private void OnBodyStartGlobal(CharacterBody body) { if (!((Object)(object)body == (Object)null) && !((Object)(object)((Component)body).gameObject == (Object)null)) { bool flag = body.isPlayerControlled || ((Object)(object)body.master != (Object)null && (Object)(object)body.master.playerCharacterMasterController != (Object)null); if ((!OnlyPlayers.Value || flag) && (Object)(object)((Component)body).GetComponent<SandevistanController>() == (Object)null) { ((Component)body).gameObject.AddComponent<SandevistanController>(); } } } private void InitConfig() { MenuLanguage = ((BaseUnityPlugin)this).Config.Bind<SandevistanLanguage>("General", "Language", SandevistanLanguage.Russian, "UI Language in F6 Menu (Russian / English)."); BonusSpeedPercentThreshold = ((BaseUnityPlugin)this).Config.Bind<float>("General", "BonusSpeedPercentThreshold", 100f, "Bonus movement speed percentage required to trigger Sandevistan (100 = +100% bonus speed)."); AlwaysActiveTestMode = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "AlwaysActiveTestMode", false, "Test mode: Sandevistan trail is always active regardless of movement speed."); EnableManualKey = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableManualKey", true, "Allow manual activation by pressing a hotkey."); ManualActivationKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "ManualActivationKey", (KeyCode)118, "Hotkey for manual Sandevistan activation."); ManualDuration = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ManualDuration", 8f, "Duration of manual Sandevistan activation in seconds."); OnlyPlayers = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "OnlyPlayers", true, "Apply the effect only to player-controlled characters."); ColorMode = ((BaseUnityPlugin)this).Config.Bind<SandevistanColorMode>("Colors", "ColorMode", SandevistanColorMode.EdgerunnersGradient, "Color preset or custom color mode for the Sandevistan trail."); CustomColor1R = ((BaseUnityPlugin)this).Config.Bind<float>("Colors", "CustomColor1_R", 0f, "Primary Custom Color Red (0.0 - 1.0)."); CustomColor1G = ((BaseUnityPlugin)this).Config.Bind<float>("Colors", "CustomColor1_G", 1f, "Primary Custom Color Green (0.0 - 1.0)."); CustomColor1B = ((BaseUnityPlugin)this).Config.Bind<float>("Colors", "CustomColor1_B", 0.65f, "Primary Custom Color Blue (0.0 - 1.0)."); CustomColor2R = ((BaseUnityPlugin)this).Config.Bind<float>("Colors", "CustomColor2_R", 0.75f, "Secondary Custom Color Red (0.0 - 1.0)."); CustomColor2G = ((BaseUnityPlugin)this).Config.Bind<float>("Colors", "CustomColor2_G", 0.1f, "Secondary Custom Color Green (0.0 - 1.0)."); CustomColor2B = ((BaseUnityPlugin)this).Config.Bind<float>("Colors", "CustomColor2_B", 1f, "Secondary Custom Color Blue (0.0 - 1.0)."); EmissionIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Colors", "EmissionIntensity", 2.5f, "Neon glow intensity of afterimages (0.5 - 6.0)."); SpawnInterval = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "SpawnInterval", 0.035f, "Time interval in seconds between spawning 3D afterimages."); AfterimageLifetime = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "AfterimageLifetime", 0.45f, "Lifetime in seconds of each 3D afterimage."); MinMoveDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "MinMoveDistance", 0.12f, "Minimum distance moved required to spawn a new afterimage."); InitialAlpha = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "InitialAlpha", 0.85f, "Initial opacity/intensity of each afterimage (0.1 - 1.0)."); GhostScaleMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Visuals", "GhostScaleMultiplier", 1f, "Scale multiplier of the afterimage relative to character size (1.0 = exact 1:1 size)."); EnableScreenVignette = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "EnableScreenVignette", true, "Show a pulsing neon border around the screen while Sandevistan is active."); EnableActivationSound = ((BaseUnityPlugin)this).Config.Bind<bool>("Visuals", "EnableActivationSound", true, "Play a sound effect when Sandevistan activates."); } } public class SandevistanGlobalManager : MonoBehaviour { public static Shader CachedGhostShader; public static float CurrentBonusSpeedPercent = 0f; public static float CurrentMoveSpeed = 0f; public static float CurrentBaseSpeed = 0f; public static bool IsSandevistanCurrentlyActive = false; public static float ManualActiveTimer = 0f; public static int ActiveGhostsCount = 0; private bool _showMenu; private Rect _windowRect = new Rect(40f, 40f, 520f, 680f); private Vector2 _scrollPos = Vector2.zero; private float _scanTimer; private int _lastProcessedFrame = -1; private Texture2D _windowBgTex; private Texture2D _vignetteTex; private static readonly Color[] EdgerunnersPalette = (Color[])(object)new Color[6] { new Color(0.1f, 1f, 0.4f, 1f), new Color(0.8f, 1f, 0.1f, 1f), new Color(0f, 0.95f, 0.95f, 1f), new Color(0.15f, 0.45f, 1f, 1f), new Color(0.68f, 0.15f, 1f, 1f), new Color(1f, 0.1f, 0.55f, 1f) }; private static readonly Color[] CyberpunkCyanPalette = (Color[])(object)new Color[3] { new Color(0f, 0.95f, 1f, 1f), new Color(0.05f, 0.6f, 1f, 1f), new Color(0.25f, 1f, 0.85f, 1f) }; private static readonly Color[] ArasakaRedPalette = (Color[])(object)new Color[3] { new Color(1f, 0.08f, 0.18f, 1f), new Color(1f, 0.35f, 0.05f, 1f), new Color(0.85f, 0f, 0.35f, 1f) }; private static readonly Color[] MilitechGoldPalette = (Color[])(object)new Color[3] { new Color(1f, 0.92f, 0.1f, 1f), new Color(1f, 0.55f, 0f, 1f), new Color(0.85f, 1f, 0.25f, 1f) }; private static readonly Color[] NetrunnerPurplePalette = (Color[])(object)new Color[3] { new Color(0.65f, 0.1f, 1f, 1f), new Color(1f, 0.1f, 0.7f, 1f), new Color(0.35f, 0.2f, 1f, 1f) }; public static SandevistanGlobalManager Instance { get; private set; } private void Awake() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) Instance = this; FindBestShader(); _windowBgTex = MakeSolidTexture(new Color(0.05f, 0.07f, 0.11f, 0.95f)); _vignetteTex = MakeSolidTexture(Color.white); } public static Shader FindBestShader() { if ((Object)(object)CachedGhostShader != (Object)null) { return CachedGhostShader; } try { CachedGhostShader = LegacyResourcesAPI.Load<Shader>("Shaders/Deferred/HGStandard"); } catch { } if ((Object)(object)CachedGhostShader == (Object)null) { try { Material val = LegacyResourcesAPI.Load<Material>("Materials/matHuntressFlashBright"); if ((Object)(object)val != (Object)null && (Object)(object)val.shader != (Object)null) { CachedGhostShader = val.shader; } } catch { } } return CachedGhostShader; } public static Color EvaluatePaletteColor(int stepIndex) { //IL_0032: 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) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) SandevistanColorMode value = SandevistanPlugin.ColorMode.Value; switch (value) { case SandevistanColorMode.CustomSingle: return new Color(SandevistanPlugin.CustomColor1R.Value, SandevistanPlugin.CustomColor1G.Value, SandevistanPlugin.CustomColor1B.Value, 1f); case SandevistanColorMode.CustomGradient: { Color val = new Color(SandevistanPlugin.CustomColor1R.Value, SandevistanPlugin.CustomColor1G.Value, SandevistanPlugin.CustomColor1B.Value, 1f); Color val2 = default(Color); ((Color)(ref val2))..ctor(SandevistanPlugin.CustomColor2R.Value, SandevistanPlugin.CustomColor2G.Value, SandevistanPlugin.CustomColor2B.Value, 1f); float num4 = Mathf.PingPong((float)stepIndex * 0.2f, 1f); return Color.Lerp(val, val2, num4); } default: { Color[] array = EdgerunnersPalette; switch (value) { case SandevistanColorMode.CyberpunkCyan: array = CyberpunkCyanPalette; break; case SandevistanColorMode.ArasakaRed: array = ArasakaRedPalette; break; case SandevistanColorMode.MilitechGold: array = MilitechGoldPalette; break; case SandevistanColorMode.NetrunnerPurple: array = NetrunnerPurplePalette; break; } float num = (float)stepIndex / 2.5f % (float)array.Length; int num2 = Mathf.FloorToInt(num) % array.Length; int num3 = (num2 + 1) % array.Length; return Color.Lerp(array[num2], array[num3], num - (float)Mathf.FloorToInt(num)); } } } private static Texture2D MakeSolidTexture(Color color) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false); val.SetPixel(0, 0, color); val.Apply(); return val; } private void Update() { TickUpdate(); } public void TickUpdate() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) if (_lastProcessedFrame == Time.frameCount) { return; } _lastProcessedFrame = Time.frameCount; if (Input.GetKeyDown((KeyCode)287)) { _showMenu = !_showMenu; if (!_showMenu && (Object)(object)SandevistanPlugin.Instance != (Object)null) { ((BaseUnityPlugin)SandevistanPlugin.Instance).Config.Save(); } } if (SandevistanPlugin.EnableManualKey.Value && Input.GetKeyDown(SandevistanPlugin.ManualActivationKey.Value)) { ManualActiveTimer = SandevistanPlugin.ManualDuration.Value; } if (ManualActiveTimer > 0f) { ManualActiveTimer -= Time.unscaledDeltaTime; } _scanTimer += Time.unscaledDeltaTime; if (_scanTimer >= 0.4f) { _scanTimer = 0f; AttachControllers(); } } private void AttachControllers() { ReadOnlyCollection<CharacterBody> readOnlyInstancesList = CharacterBody.readOnlyInstancesList; if (readOnlyInstancesList == null) { return; } for (int i = 0; i < readOnlyInstancesList.Count; i++) { CharacterBody val = readOnlyInstancesList[i]; if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)null)) { bool flag = val.isPlayerControlled || ((Object)(object)val.master != (Object)null && (Object)(object)val.master.playerCharacterMasterController != (Object)null); if ((!SandevistanPlugin.OnlyPlayers.Value || flag) && (Object)(object)((Component)val).GetComponent<SandevistanController>() == (Object)null) { ((Component)val).gameObject.AddComponent<SandevistanController>(); } } } } private void OnGUI() { //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0186: Expected O, but got Unknown //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) if (SandevistanPlugin.EnableScreenVignette.Value && IsSandevistanCurrentlyActive && (Object)(object)_vignetteTex != (Object)null) { Color val = EvaluatePaletteColor(Mathf.FloorToInt(Time.unscaledTime * 8f)); float num = 0.14f + Mathf.Sin(Time.unscaledTime * 8f) * 0.05f; GUI.color = new Color(val.r, val.g, val.b, num); int num2 = 10; GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)num2), (Texture)(object)_vignetteTex); GUI.DrawTexture(new Rect(0f, (float)(Screen.height - num2), (float)Screen.width, (float)num2), (Texture)(object)_vignetteTex); GUI.DrawTexture(new Rect(0f, (float)num2, (float)num2, (float)(Screen.height - num2 * 2)), (Texture)(object)_vignetteTex); GUI.DrawTexture(new Rect((float)(Screen.width - num2), (float)num2, (float)num2, (float)(Screen.height - num2 * 2)), (Texture)(object)_vignetteTex); GUI.color = Color.white; } if (_showMenu) { Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; if ((Object)(object)_windowBgTex != (Object)null) { GUI.DrawTexture(_windowRect, (Texture)(object)_windowBgTex); } string text = ((SandevistanPlugin.MenuLanguage.Value == SandevistanLanguage.Russian) ? "SANDEVISTAN OS // НАСТРОЙКИ ИМПЛАНТА [F6]" : "SANDEVISTAN OS // CYBERWARE SETTINGS [F6]"); _windowRect = GUILayout.Window(88889, _windowRect, new WindowFunction(DrawWindow), text, Array.Empty<GUILayoutOption>()); } } private void DrawWindow(int id) { //IL_00aa: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_0599: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_08ec: Unknown result type (might be due to invalid IL or missing references) bool flag = SandevistanPlugin.MenuLanguage.Value == SandevistanLanguage.Russian; GUILayout.BeginHorizontal(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>()); GUILayout.Label(flag ? "<b>Язык интерфейса / Language:</b>" : "<b>Language / Язык интерфейса:</b>", Array.Empty<GUILayoutOption>()); if (GUILayout.Button(flag ? ">> РУССКИЙ <<" : "РУССКИЙ", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) })) { SandevistanPlugin.MenuLanguage.Value = SandevistanLanguage.Russian; } if (GUILayout.Button((!flag) ? ">> ENGLISH <<" : "ENGLISH", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) })) { SandevistanPlugin.MenuLanguage.Value = SandevistanLanguage.English; } GUILayout.EndHorizontal(); _scrollPos = GUILayout.BeginScrollView(_scrollPos, Array.Empty<GUILayoutOption>()); GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>()); string arg = ((!IsSandevistanCurrentlyActive) ? (flag ? "<color=#FFCC00>ОЖИДАНИЕ СКОРОСТИ</color>" : "<color=#FFCC00>STANDBY (WAITING FOR SPEED)</color>") : (flag ? "<color=#00FF88>АКТИВЕН</color>" : "<color=#00FF88>ACTIVE</color>")); GUILayout.Label(flag ? $"<b>Статус импланта:</b> {arg} | Фантомов в мире: <b>{ActiveGhostsCount}</b>" : $"<b>Implant Status:</b> {arg} | Active Ghosts: <b>{ActiveGhostsCount}</b>", Array.Empty<GUILayoutOption>()); GUILayout.Label(flag ? $"Бонус скорости: <b>+{CurrentBonusSpeedPercent:F0}%</b> (База: {CurrentBaseSpeed:F1} | Текущая: {CurrentMoveSpeed:F1})" : $"Bonus Speed: <b>+{CurrentBonusSpeedPercent:F0}%</b> (Base: {CurrentBaseSpeed:F1} | Current: {CurrentMoveSpeed:F1})", Array.Empty<GUILayoutOption>()); GUILayout.Label(flag ? $"Порог срабатывания: <b>+{SandevistanPlugin.BonusSpeedPercentThreshold.Value:F0}%</b>" : $"Activation Threshold: <b>+{SandevistanPlugin.BonusSpeedPercentThreshold.Value:F0}%</b>", Array.Empty<GUILayoutOption>()); if (ManualActiveTimer > 0f) { GUILayout.Label(flag ? $"<color=#00FFFF>Ручной запуск активен: {ManualActiveTimer:F1} сек.</color>" : $"<color=#00FFFF>Manual Override Active: {ManualActiveTimer:F1} sec.</color>", Array.Empty<GUILayoutOption>()); } GUILayout.EndVertical(); GUILayout.Space(4f); GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>()); SandevistanPlugin.AlwaysActiveTestMode.Value = GUILayout.Toggle(SandevistanPlugin.AlwaysActiveTestMode.Value, flag ? " <b>Тестовый режим (Сандевистан включён всегда)</b>" : " <b>Test Mode (Always Active)</b>", Array.Empty<GUILayoutOption>()); SandevistanPlugin.EnableManualKey.Value = GUILayout.Toggle(SandevistanPlugin.EnableManualKey.Value, flag ? $" <b>Ручная активация по клавише [{SandevistanPlugin.ManualActivationKey.Value}] ({SandevistanPlugin.ManualDuration.Value:F0} сек.)</b>" : $" <b>Manual Activation via Key [{SandevistanPlugin.ManualActivationKey.Value}] ({SandevistanPlugin.ManualDuration.Value:F0} sec.)</b>", Array.Empty<GUILayoutOption>()); if (GUILayout.Button(flag ? "ТЕСТ: ВКЛЮЧИТЬ САНДЕВИСТАН НА 10 СЕКУНД" : "TEST: ACTIVATE SANDEVISTAN FOR 10 SECONDS", Array.Empty<GUILayoutOption>())) { ManualActiveTimer = 10f; } GUILayout.EndVertical(); GUILayout.Space(4f); GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>()); GUILayout.Label(flag ? "<b>ЦВЕТОВАЯ СХЕМА САНДЕВИСТАНА:</b>" : "<b>SANDEVISTAN COLOR MODE:</b>", Array.Empty<GUILayoutOption>()); string[] array = new string[7] { "1. Edgerunners (Классический градиент)", "2. Cyberpunk Cyan (Голубой неон)", "3. Arasaka Red (Красный багровый)", "4. Militech Gold (Золотой жёлтый)", "5. Netrunner Purple (Фиолетовый неон)", "6. Свой одиночный цвет (RGB)", "7. Свой градиент из 2 цветов (RGB)" }; string[] array2 = new string[7] { "1. Edgerunners (Classic Gradient)", "2. Cyberpunk Cyan (Electric Blue)", "3. Arasaka Red (Crimson Neon)", "4. Militech Gold (Cyber Yellow)", "5. Netrunner Purple (Violet Neon)", "6. Custom Single Color (RGB)", "7. Custom 2-Color Gradient (RGB)" }; int value = (int)SandevistanPlugin.ColorMode.Value; int num = GUILayout.SelectionGrid(value, flag ? array : array2, 1, Array.Empty<GUILayoutOption>()); if (num != value) { SandevistanPlugin.ColorMode.Value = (SandevistanColorMode)num; } if (SandevistanPlugin.ColorMode.Value == SandevistanColorMode.CustomSingle || SandevistanPlugin.ColorMode.Value == SandevistanColorMode.CustomGradient) { GUILayout.Space(4f); GUILayout.Label(flag ? "<b>Основной цвет (Цвет 1):</b>" : "<b>Primary Color (Color 1):</b>", Array.Empty<GUILayoutOption>()); SandevistanPlugin.CustomColor1R.Value = DrawColorSlider("R", SandevistanPlugin.CustomColor1R.Value); SandevistanPlugin.CustomColor1G.Value = DrawColorSlider("G", SandevistanPlugin.CustomColor1G.Value); SandevistanPlugin.CustomColor1B.Value = DrawColorSlider("B", SandevistanPlugin.CustomColor1B.Value); GUI.color = new Color(SandevistanPlugin.CustomColor1R.Value, SandevistanPlugin.CustomColor1G.Value, SandevistanPlugin.CustomColor1B.Value, 1f); GUILayout.Box("", (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(14f), GUILayout.ExpandWidth(true) }); GUI.color = Color.white; } if (SandevistanPlugin.ColorMode.Value == SandevistanColorMode.CustomGradient) { GUILayout.Space(4f); GUILayout.Label(flag ? "<b>Второй цвет градиента (Цвет 2):</b>" : "<b>Secondary Gradient Color (Color 2):</b>", Array.Empty<GUILayoutOption>()); SandevistanPlugin.CustomColor2R.Value = DrawColorSlider("R", SandevistanPlugin.CustomColor2R.Value); SandevistanPlugin.CustomColor2G.Value = DrawColorSlider("G", SandevistanPlugin.CustomColor2G.Value); SandevistanPlugin.CustomColor2B.Value = DrawColorSlider("B", SandevistanPlugin.CustomColor2B.Value); GUI.color = new Color(SandevistanPlugin.CustomColor2R.Value, SandevistanPlugin.CustomColor2G.Value, SandevistanPlugin.CustomColor2B.Value, 1f); GUILayout.Box("", (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Height(14f), GUILayout.ExpandWidth(true) }); GUI.color = Color.white; } GUILayout.Space(4f); GUILayout.Label(flag ? $"<b>Яркость неонового свечения: {SandevistanPlugin.EmissionIntensity.Value:F1}x</b>" : $"<b>Neon Glow Intensity: {SandevistanPlugin.EmissionIntensity.Value:F1}x</b>", Array.Empty<GUILayoutOption>()); SandevistanPlugin.EmissionIntensity.Value = GUILayout.HorizontalSlider(SandevistanPlugin.EmissionIntensity.Value, 0.5f, 6f, Array.Empty<GUILayoutOption>()); GUILayout.EndVertical(); GUILayout.Space(4f); GUILayout.BeginVertical(GUIStyle.op_Implicit("box"), Array.Empty<GUILayoutOption>()); GUILayout.Label(flag ? $"<b>Порог бонусной скорости: +{SandevistanPlugin.BonusSpeedPercentThreshold.Value:F0}%</b>" : $"<b>Bonus Speed Threshold: +{SandevistanPlugin.BonusSpeedPercentThreshold.Value:F0}%</b>", Array.Empty<GUILayoutOption>()); SandevistanPlugin.BonusSpeedPercentThreshold.Value = Mathf.Round(GUILayout.HorizontalSlider(SandevistanPlugin.BonusSpeedPercentThreshold.Value, 0f, 300f, Array.Empty<GUILayoutOption>()) / 5f) * 5f; GUILayout.Label(flag ? $"<b>Интервал создания копий: {SandevistanPlugin.SpawnInterval.Value:F3} сек.</b>" : $"<b>Afterimage Spawn Interval: {SandevistanPlugin.SpawnInterval.Value:F3} sec.</b>", Array.Empty<GUILayoutOption>()); SandevistanPlugin.SpawnInterval.Value = GUILayout.HorizontalSlider(SandevistanPlugin.SpawnInterval.Value, 0.015f, 0.15f, Array.Empty<GUILayoutOption>()); GUILayout.Label(flag ? $"<b>Время жизни фантома: {SandevistanPlugin.AfterimageLifetime.Value:F2} сек.</b>" : $"<b>Afterimage Lifetime: {SandevistanPlugin.AfterimageLifetime.Value:F2} sec.</b>", Array.Empty<GUILayoutOption>()); SandevistanPlugin.AfterimageLifetime.Value = GUILayout.HorizontalSlider(SandevistanPlugin.AfterimageLifetime.Value, 0.15f, 1.5f, Array.Empty<GUILayoutOption>()); GUILayout.Label(flag ? $"<b>Масштаб копии (1.00 = точный размер 1:1): {SandevistanPlugin.GhostScaleMultiplier.Value:F2}x</b>" : $"<b>Ghost Scale (1.00 = exact 1:1 size): {SandevistanPlugin.GhostScaleMultiplier.Value:F2}x</b>", Array.Empty<GUILayoutOption>()); SandevistanPlugin.GhostScaleMultiplier.Value = GUILayout.HorizontalSlider(SandevistanPlugin.GhostScaleMultiplier.Value, 0.2f, 2f, Array.Empty<GUILayoutOption>()); SandevistanPlugin.EnableScreenVignette.Value = GUILayout.Toggle(SandevistanPlugin.EnableScreenVignette.Value, flag ? " Неоновая рамка по краям экрана" : " Screen Neon Vignette Border", Array.Empty<GUILayoutOption>()); SandevistanPlugin.EnableActivationSound.Value = GUILayout.Toggle(SandevistanPlugin.EnableActivationSound.Value, flag ? " Звуковой эффект при активации" : " Activation Sound Effect", Array.Empty<GUILayoutOption>()); GUILayout.EndVertical(); GUILayout.EndScrollView(); GUILayout.Space(6f); if (GUILayout.Button(flag ? "Сохранить настройки и закрыть [F6]" : "Save Settings & Close [F6]", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { _showMenu = false; if ((Object)(object)SandevistanPlugin.Instance != (Object)null) { ((BaseUnityPlugin)SandevistanPlugin.Instance).Config.Save(); } } GUI.DragWindow(new Rect(0f, 0f, 10000f, 25f)); } private float DrawColorSlider(string label, float val) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label($"{label}: {(int)(val * 255f)}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(55f) }); float result = GUILayout.HorizontalSlider(val, 0f, 1f, Array.Empty<GUILayoutOption>()); GUILayout.EndHorizontal(); return result; } } public class SandevistanController : MonoBehaviour { private CharacterBody _body; private SkinnedMeshRenderer[] _renderers; private float _spawnTimer; private float _rescanTimer; private Vector3 _lastPos; private int _colorStepIndex; private bool _wasActive; private void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) _body = ((Component)this).GetComponent<CharacterBody>(); _lastPos = ((Component)this).transform.position; RefreshRenderers(); } private void RefreshRenderers() { if (!((Object)(object)_body == (Object)null)) { if ((Object)(object)_body.modelLocator != (Object)null && (Object)(object)_body.modelLocator.modelTransform != (Object)null) { _renderers = ((Component)_body.modelLocator.modelTransform).GetComponentsInChildren<SkinnedMeshRenderer>(false); } else { _renderers = ((Component)this).GetComponentsInChildren<SkinnedMeshRenderer>(false); } } } private void Update() { //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_body == (Object)null || (Object)(object)_body.healthComponent == (Object)null || !_body.healthComponent.alive) { if (_wasActive) { _wasActive = false; if ((Object)(object)_body != (Object)null && _body.isPlayerControlled) { SandevistanGlobalManager.IsSandevistanCurrentlyActive = false; } } return; } float num = Mathf.Max(0.01f, _body.baseMoveSpeed); float moveSpeed = _body.moveSpeed; float num2 = (moveSpeed / num - 1f) * 100f; if (_body.isPlayerControlled) { SandevistanGlobalManager.CurrentBaseSpeed = num; SandevistanGlobalManager.CurrentMoveSpeed = moveSpeed; SandevistanGlobalManager.CurrentBonusSpeedPercent = num2; } bool num3 = num2 >= SandevistanPlugin.BonusSpeedPercentThreshold.Value; bool flag = SandevistanPlugin.AlwaysActiveTestMode.Value || SandevistanGlobalManager.ManualActiveTimer > 0f; bool flag2 = num3 || flag; if (_body.isPlayerControlled) { SandevistanGlobalManager.IsSandevistanCurrentlyActive = flag2; } if (flag2 && !_wasActive && SandevistanPlugin.EnableActivationSound.Value) { Util.PlaySound("Play_huntress_shift_end", ((Component)_body).gameObject); } _wasActive = flag2; if (!flag2) { return; } if (_renderers == null || _renderers.Length == 0) { _rescanTimer += Time.deltaTime; if (_rescanTimer >= 0.5f) { _rescanTimer = 0f; RefreshRenderers(); } return; } _spawnTimer += Time.deltaTime; if (_spawnTimer >= SandevistanPlugin.SpawnInterval.Value && Vector3.Distance(((Component)this).transform.position, _lastPos) >= SandevistanPlugin.MinMoveDistance.Value) { _spawnTimer = 0f; _lastPos = ((Component)this).transform.position; SpawnSnapshot(); } } private void SpawnSnapshot() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown //IL_01c9: 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_00bd: Expected O, but got Unknown //IL_00ee: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0141: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) if (_renderers == null || _renderers.Length == 0) { return; } _colorStepIndex++; Color col = SandevistanGlobalManager.EvaluatePaletteColor(_colorStepIndex); float value = SandevistanPlugin.AfterimageLifetime.Value; float value2 = SandevistanPlugin.InitialAlpha.Value; float value3 = SandevistanPlugin.GhostScaleMultiplier.Value; GameObject val = new GameObject("Sandevistan_Ghost"); List<Mesh> list = new List<Mesh>(); List<Renderer> list2 = new List<Renderer>(); for (int i = 0; i < _renderers.Length; i++) { SkinnedMeshRenderer val2 = _renderers[i]; if (!((Object)(object)val2 == (Object)null) && ((Renderer)val2).enabled && ((Component)val2).gameObject.activeInHierarchy && !((Object)(object)val2.sharedMesh == (Object)null)) { Mesh val3 = new Mesh(); bool flag = val2.bones != null && val2.bones.Length != 0; val2.BakeMesh(val3, false); list.Add(val3); GameObject val4 = new GameObject("GhostPart"); val4.transform.SetParent(val.transform, false); val4.transform.SetPositionAndRotation(((Component)val2).transform.position, ((Component)val2).transform.rotation); val4.transform.localScale = (flag ? Vector3.one : ((Component)val2).transform.lossyScale) * value3; val4.AddComponent<MeshFilter>().sharedMesh = val3; MeshRenderer val5 = val4.AddComponent<MeshRenderer>(); ((Renderer)val5).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val5).receiveShadows = false; Material orCreateMaterial = SandevistanAfterimage.GetOrCreateMaterial(); if ((Object)(object)orCreateMaterial != (Object)null) { ((Renderer)val5).sharedMaterial = orCreateMaterial; } list2.Add((Renderer)(object)val5); } } if (list.Count == 0) { Object.Destroy((Object)(object)val); } else { val.AddComponent<SandevistanAfterimage>().Init(list, list2, col, value2, value); } } } public class SandevistanAfterimage : MonoBehaviour { private List<Mesh> _meshes; private List<Renderer> _rends; private Color _color; private float _initAlpha; private float _lifetime; private float _elapsed; private static Material _sharedMat; private static MaterialPropertyBlock _block; private static readonly int ColorId = Shader.PropertyToID("_Color"); private static readonly int EmColorId = Shader.PropertyToID("_EmColor"); private static readonly int EmPowerId = Shader.PropertyToID("_EmPower"); private static readonly int EmissionColorId = Shader.PropertyToID("_EmissionColor"); private static readonly int TintColorId = Shader.PropertyToID("_TintColor"); public static Material GetOrCreateMaterial() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown if ((Object)(object)_sharedMat != (Object)null) { return _sharedMat; } Shader val = SandevistanGlobalManager.FindBestShader(); if ((Object)(object)val == (Object)null) { return null; } _sharedMat = new Material(val) { name = "SandevistanGhostMaterial" }; if (_sharedMat.HasProperty("_MainTex")) { _sharedMat.SetTexture("_MainTex", (Texture)(object)Texture2D.whiteTexture); } if (_sharedMat.HasProperty("_EmTex")) { _sharedMat.SetTexture("_EmTex", (Texture)(object)Texture2D.whiteTexture); } if (_sharedMat.HasProperty("_Smoothness")) { _sharedMat.SetFloat("_Smoothness", 0f); } if (_sharedMat.HasProperty("_EmPower")) { _sharedMat.SetFloat("_EmPower", 2.5f); } return _sharedMat; } public void Init(List<Mesh> meshes, List<Renderer> rends, Color col, float alpha, float life) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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) //IL_004b: Expected O, but got Unknown _meshes = meshes; _rends = rends; _color = col; _initAlpha = alpha; _lifetime = Mathf.Max(0.05f, life); _elapsed = 0f; if (_block == null) { _block = new MaterialPropertyBlock(); } SandevistanGlobalManager.ActiveGhostsCount++; ApplyFade(1f); } private void Update() { _elapsed += Time.deltaTime; float num = _elapsed / _lifetime; if (num >= 1f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } float factor = Mathf.Pow(1f - num, 1.4f); ApplyFade(factor); } private void ApplyFade(float factor) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00c4: 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) if (_rends == null || _block == null) { return; } float num = _initAlpha * factor; float num2 = SandevistanPlugin.EmissionIntensity.Value * factor; Color val = default(Color); ((Color)(ref val))..ctor(_color.r * factor, _color.g * factor, _color.b * factor, num); Color val2 = default(Color); ((Color)(ref val2))..ctor(_color.r, _color.g, _color.b, num); _block.Clear(); _block.SetColor(ColorId, val); _block.SetColor(EmColorId, val2); _block.SetFloat(EmPowerId, num2); _block.SetColor(EmissionColorId, val2 * num2); _block.SetColor(TintColorId, val); for (int i = 0; i < _rends.Count; i++) { if ((Object)(object)_rends[i] != (Object)null) { _rends[i].SetPropertyBlock(_block); } } } private void OnDestroy() { SandevistanGlobalManager.ActiveGhostsCount = Mathf.Max(0, SandevistanGlobalManager.ActiveGhostsCount - 1); if (_meshes == null) { return; } for (int i = 0; i < _meshes.Count; i++) { if ((Object)(object)_meshes[i] != (Object)null) { Object.Destroy((Object)(object)_meshes[i]); } } _meshes.Clear(); } } }