Decompiled source of Joive BGMod BepInEx v1.2.0
BGMod-BepInEx-Joive.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BGMod.Config; using BGMod.Core; using BGMod.ESP; using BGMod.Features; using BGMod.HUD; using BGMod.Patches; using BGMod.Performance; using BGMod.UI; using BGMod.Utils; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Lightbug.CharacterControllerPro.Core; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("Joive")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("A BepInEx version of BGMod for Burglin Gnomes by Joive.")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0")] [assembly: AssemblyProduct("BGMod")] [assembly: AssemblyTitle("BGMod-BepInEx-Joive")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.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 BGMod { [BepInPlugin("joive.bgmod", "BGMod", "1.2.0")] public sealed class BGModPlugin : BaseUnityPlugin { private Harmony harmony; private bool shuttingDown; public static BGModPlugin Instance { get; private set; } public ModuleManager Modules { get; private set; } public MenuModule Menu { get; private set; } private void Awake() { Instance = this; ModLog.Initialize(((BaseUnityPlugin)this).Logger); ModConfig.Initialize(((BaseUnityPlugin)this).Config); Modules = new ModuleManager(); Modules.Register(new PerformanceModule()); Modules.Register(new HUDModule()); Modules.Register(new ESPModule()); Modules.Register(new GnomeModule()); Modules.Register(new OnlineModule()); Modules.Register(new GameModule()); Modules.Register(new ItemGiverModule()); Modules.Register(new SpawnerModule()); Modules.Register(new ResourcesModule()); Modules.Register(new WorldModule()); Modules.Register(new ItemESPModule()); Modules.Register(new HumanESPModule()); Modules.Register(new ChaosModule()); Menu = new MenuModule(Modules); Modules.Register(Menu); Modules.Initialize(); ApplyPatches(); SceneManager.sceneLoaded += OnSceneLoaded; ModLog.Msg("BGMod BepInEx 1.2.0 initialized."); ModLog.Msg("Game version: " + VersionInfo.GetGameVersionString()); ModLog.Msg("Loaded modules: " + string.Join(", ", Modules.EnabledModuleNames)); } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { Modules?.OnSceneWasInitialized(((Scene)(ref scene)).buildIndex, ((Scene)(ref scene)).name); } private void Update() { try { if (!ModConfig.EnableMod.Value) { Menu?.OnUpdate(); } else { Modules?.OnUpdate(); } } catch (Exception ex) { ModLog.Error("Update failed: " + ex.Message); } } private void OnGUI() { try { if (!ModConfig.EnableMod.Value) { Menu?.OnGUI(); } else { Modules?.OnGUI(); } } catch (Exception ex) { ModLog.Error("OnGUI failed: " + ex.Message); } } private void OnApplicationQuit() { Shutdown(); } private void OnDestroy() { Shutdown(); } public void StartPluginCoroutine(IEnumerator routine) { ((MonoBehaviour)this).StartCoroutine(routine); } private void Shutdown() { if (!shuttingDown) { shuttingDown = true; SceneManager.sceneLoaded -= OnSceneLoaded; Modules?.OnApplicationQuit(); Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } } private void ApplyPatches() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown harmony = new Harmony("joive.bgmod"); PatchManager.Apply(harmony); } } } namespace BGMod.Utils { public static class GameAccess { public static PlayerNetworking LocalPlayer() { try { return ((IEnumerable<PlayerNetworking>)Object.FindObjectsByType<PlayerNetworking>((FindObjectsSortMode)0)).FirstOrDefault((Func<PlayerNetworking, bool>)((PlayerNetworking p) => (Object)(object)p != (Object)null && ((NetworkBehaviour)p).IsLocalPlayer)); } catch (Exception ex) { ModLog.Warning("Local player lookup failed: " + ex.Message); return null; } } public static List<PlayerNetworking> AllPlayers() { try { return (from p in Object.FindObjectsByType<PlayerNetworking>((FindObjectsSortMode)0) where (Object)(object)p != (Object)null select p).ToList(); } catch { return new List<PlayerNetworking>(); } } public static string PlayerName(PlayerNetworking player) { if ((Object)(object)player == (Object)null || (Object)(object)player.SteamPlayer == (Object)null) { return "Player"; } try { string text = "Player"; player.SteamPlayer.TryGetName(ref text); return string.IsNullOrEmpty(text) ? "Player" : text; } catch { return "Player"; } } public static Vector3 Position(Component component) { //IL_0015: 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) if (!((Object)(object)component != (Object)null)) { return Vector3.zero; } return component.transform.position; } public static float DistanceFromLocal(Component component) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) PlayerNetworking val = LocalPlayer(); if ((Object)(object)val == (Object)null || (Object)(object)component == (Object)null) { return float.MaxValue; } return Vector3.Distance(((Component)val).transform.position, component.transform.position); } } public static class GuiStyles { private static bool initialized; private static Texture2D panelTexture; private static Texture2D buttonTexture; private static Texture2D buttonHoverTexture; private static Texture2D activeTexture; private static Texture2D activeHoverTexture; private static Texture2D boxTexture; private static Texture2D toggleOffTexture; private static Texture2D toggleOnTexture; private static Texture2D sliderTexture; private static Texture2D sliderThumbTexture; public static GUIStyle Window; public static GUIStyle Title; public static GUIStyle Tab; public static GUIStyle TabActive; public static GUIStyle Section; public static GUIStyle Label; public static GUIStyle SmallLabel; public static GUIStyle Toggle; public static GUIStyle Button; public static GUIStyle Box; public static GUIStyle TextField; public static GUIStyle Slider; public static GUIStyle SliderThumb; public static void Ensure() { //IL_001c: 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_0062: 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_00a8: 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_00ee: 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_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Expected O, but got Unknown //IL_019c: Expected O, but got Unknown //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: 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_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Expected O, but got Unknown //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Expected O, but got Unknown //IL_0203: Expected O, but got Unknown //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Expected O, but got Unknown //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Expected O, but got Unknown //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Expected O, but got Unknown //IL_028d: 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_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Expected O, but got Unknown //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Expected O, but got Unknown //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Expected O, but got Unknown //IL_03c2: Expected O, but got Unknown //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Expected O, but got Unknown //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_044a: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Expected O, but got Unknown //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Expected O, but got Unknown //IL_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Expected O, but got Unknown //IL_04c3: Expected O, but got Unknown //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_0568: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_058f: Expected O, but got Unknown //IL_058f: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Expected O, but got Unknown //IL_05b4: Unknown result type (might be due to invalid IL or missing references) //IL_0604: Unknown result type (might be due to invalid IL or missing references) //IL_0609: Unknown result type (might be due to invalid IL or missing references) //IL_0610: Unknown result type (might be due to invalid IL or missing references) //IL_061a: Expected O, but got Unknown //IL_061a: Unknown result type (might be due to invalid IL or missing references) //IL_0626: Expected O, but got Unknown //IL_0630: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Unknown result type (might be due to invalid IL or missing references) //IL_0649: Unknown result type (might be due to invalid IL or missing references) //IL_0651: Unknown result type (might be due to invalid IL or missing references) //IL_065c: Unknown result type (might be due to invalid IL or missing references) //IL_0661: Unknown result type (might be due to invalid IL or missing references) //IL_066b: Expected O, but got Unknown //IL_0670: Expected O, but got Unknown //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_068e: Unknown result type (might be due to invalid IL or missing references) //IL_0693: Unknown result type (might be due to invalid IL or missing references) //IL_06a3: Expected O, but got Unknown //IL_06e9: Unknown result type (might be due to invalid IL or missing references) //IL_06ee: Unknown result type (might be due to invalid IL or missing references) //IL_06f9: Unknown result type (might be due to invalid IL or missing references) //IL_0709: Expected O, but got Unknown if (!initialized) { panelTexture = MakeTexture(new Color(0.018f, 0.026f, 0.038f, 0.98f)); buttonTexture = MakeTexture(new Color(0.045f, 0.07f, 0.1f, 1f)); buttonHoverTexture = MakeTexture(new Color(0.07f, 0.12f, 0.17f, 1f)); activeTexture = MakeTexture(new Color(0.06f, 0.32f, 0.46f, 1f)); activeHoverTexture = MakeTexture(new Color(0.08f, 0.43f, 0.62f, 1f)); boxTexture = MakeTexture(new Color(0.012f, 0.018f, 0.027f, 1f)); toggleOffTexture = MakeTexture(new Color(0.055f, 0.082f, 0.115f, 1f)); toggleOnTexture = MakeTexture(new Color(0.08f, 0.42f, 0.34f, 1f)); sliderTexture = MakeTexture(new Color(0.05f, 0.08f, 0.11f, 1f)); sliderThumbTexture = MakeTexture(new Color(0.12f, 0.66f, 0.9f, 1f)); Window = new GUIStyle(GUI.skin.window) { padding = new RectOffset(16, 16, 12, 14), border = new RectOffset(1, 1, 1, 1) }; SetAllStates(Window, panelTexture, Color.white); Title = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)3, fontSize = 18, fontStyle = (FontStyle)1, fixedHeight = 30f, margin = new RectOffset(0, 0, 0, 6), padding = new RectOffset(8, 0, 0, 0) }; SetTextStates(Title, new Color(0.92f, 0.98f, 1f)); Tab = new GUIStyle(GUI.skin.button) { fontSize = 12, fontStyle = (FontStyle)1, fixedHeight = 30f, margin = new RectOffset(2, 2, 2, 2), padding = new RectOffset(8, 8, 6, 6), alignment = (TextAnchor)4 }; SetAllStates(Tab, buttonTexture, new Color(0.68f, 0.77f, 0.86f)); Tab.hover.background = buttonHoverTexture; Tab.hover.textColor = Color.white; Tab.active.background = buttonHoverTexture; Tab.active.textColor = Color.white; Tab.focused.background = buttonTexture; Tab.focused.textColor = Color.white; TabActive = new GUIStyle(Tab); SetAllStates(TabActive, activeTexture, Color.white); TabActive.hover.background = activeHoverTexture; TabActive.active.background = activeHoverTexture; TabActive.focused.background = activeTexture; Section = new GUIStyle(GUI.skin.box) { fontSize = 13, fontStyle = (FontStyle)1, alignment = (TextAnchor)3, fixedHeight = 24f, margin = new RectOffset(0, 0, 8, 5), padding = new RectOffset(9, 6, 4, 4) }; SetAllStates(Section, MakeTexture(new Color(0.028f, 0.052f, 0.075f, 1f)), new Color(0.34f, 0.78f, 1f)); GUIStyle val = new GUIStyle(GUI.skin.label); val.normal.textColor = new Color(0.8f, 0.88f, 0.94f); val.fontSize = 12; val.richText = true; Label = val; GUIStyle val2 = new GUIStyle(Label) { fontSize = 11 }; val2.normal.textColor = new Color(0.55f, 0.66f, 0.76f); SmallLabel = val2; Toggle = new GUIStyle(GUI.skin.button) { fontSize = 12, fixedHeight = 27f, alignment = (TextAnchor)3, margin = new RectOffset(2, 2, 3, 3), padding = new RectOffset(10, 8, 5, 5) }; SetAllStates(Toggle, toggleOffTexture, new Color(0.74f, 0.74f, 0.8f)); Toggle.onNormal.background = toggleOnTexture; Toggle.onNormal.textColor = Color.white; Toggle.onHover.background = toggleOnTexture; Toggle.onHover.textColor = Color.white; Toggle.hover.background = buttonHoverTexture; Toggle.hover.textColor = Color.white; Button = new GUIStyle(GUI.skin.button) { fontSize = 12, fixedHeight = 27f, margin = new RectOffset(2, 2, 3, 3), alignment = (TextAnchor)4 }; SetAllStates(Button, buttonTexture, new Color(0.86f, 0.92f, 0.98f)); Button.hover.background = buttonHoverTexture; Button.active.background = buttonHoverTexture; Button.focused.background = buttonTexture; Box = new GUIStyle(GUI.skin.box) { padding = new RectOffset(10, 10, 8, 8), richText = true }; SetAllStates(Box, boxTexture, Color.white); TextField = new GUIStyle(GUI.skin.textField) { fontSize = 12, fixedHeight = 27f, padding = new RectOffset(7, 7, 5, 5) }; SetAllStates(TextField, boxTexture, Color.white); Slider = new GUIStyle(GUI.skin.horizontalSlider) { fixedHeight = 8f }; Slider.normal.background = sliderTexture; Slider.hover.background = sliderTexture; Slider.active.background = sliderTexture; SliderThumb = new GUIStyle(GUI.skin.horizontalSliderThumb) { fixedWidth = 14f, fixedHeight = 14f }; SliderThumb.normal.background = sliderThumbTexture; SliderThumb.hover.background = activeHoverTexture; SliderThumb.active.background = activeHoverTexture; initialized = true; } } public static Texture2D MakeTexture(Color color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_0017: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1); val.SetPixel(0, 0, color); val.Apply(); return val; } private static void SetAllStates(GUIStyle style, Texture2D background, Color textColor) { //IL_0012: 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_0042: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) style.normal.background = background; style.normal.textColor = textColor; style.hover.background = background; style.hover.textColor = textColor; style.active.background = background; style.active.textColor = textColor; style.focused.background = background; style.focused.textColor = textColor; style.onNormal.background = background; style.onNormal.textColor = textColor; style.onHover.background = background; style.onHover.textColor = textColor; style.onActive.background = background; style.onActive.textColor = textColor; style.onFocused.background = background; style.onFocused.textColor = textColor; } private static void SetTextStates(GUIStyle style, Color textColor) { //IL_0006: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_006a: Unknown result type (might be due to invalid IL or missing references) style.normal.textColor = textColor; style.hover.textColor = Color.white; style.active.textColor = Color.white; style.focused.textColor = textColor; style.onNormal.textColor = textColor; style.onHover.textColor = Color.white; style.onActive.textColor = Color.white; style.onFocused.textColor = textColor; } } public static class ModLog { private static ManualLogSource logger; public static void Initialize(ManualLogSource source) { logger = source; } public static void Msg(string message) { ManualLogSource obj = logger; if (obj != null) { obj.LogInfo((object)message); } } public static void Warning(string message) { ManualLogSource obj = logger; if (obj != null) { obj.LogWarning((object)message); } } public static void Error(string message) { ManualLogSource obj = logger; if (obj != null) { obj.LogError((object)message); } } } public static class ReflectionUtils { public const BindingFlags AnyInstance = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; public const BindingFlags AnyStatic = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; public static object GetMemberValue(object target, string name) { if (target == null || string.IsNullOrEmpty(name)) { return null; } Type type = target.GetType(); PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.GetIndexParameters().Length == 0) { return property.GetValue(target, null); } FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(field != null)) { return null; } return field.GetValue(target); } public static bool TrySetMemberValue(object target, string name, object value) { if (target == null || string.IsNullOrEmpty(name)) { return false; } Type type = target.GetType(); PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanWrite && property.GetIndexParameters().Length == 0) { property.SetValue(target, value, null); return true; } FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { field.SetValue(target, value); return true; } return false; } public static bool GetBool(object target, string name) { object memberValue = GetMemberValue(target, name); if (memberValue is bool) { return (bool)memberValue; } return false; } } public static class VersionInfo { public static string GetGameVersionString() { try { Bootstrap val = Object.FindFirstObjectByType<Bootstrap>(); if ((Object)(object)val != (Object)null && !string.IsNullOrEmpty(val.GameVersionString)) { return val.GameVersionString; } return Application.version; } catch { return "unknown"; } } } } namespace BGMod.UI { public class MenuModule : ModuleBase { private readonly string[] tabs = new string[12] { "Main", "Player", "Online", "ESP", "Items", "Spawn", "World", "Resources", "Game", "Chaos", "Performance", "Debug" }; private Rect windowRect; private Vector2 scroll; private int selectedTab; private int itemMode; private int spawnMode; private string onlineMinutesText = "1"; private string npcMinutesText = "1"; private string roundMinutesText = "20"; private string chaosRadiusText = "12"; private string chaosMinutesText = "0.25"; private KeyCode cachedMenuKey = (KeyCode)277; private bool centered; private bool modalActive; private bool timeScalePaused; private bool oldCursorVisible; private CursorLockMode oldCursorLock; private float oldTimeScale = 1f; private PlayerController modalController; private bool hadModalControllerState; private bool oldControllerUiOpen; private bool confirmReset; private bool showSpawnItems = true; private bool showSpawnObjects = true; private bool showSpawnNpcs = true; private bool showExistingUnits; private Texture2D dimTexture; public override string Id => "menu"; public override string DisplayName => "Menu"; public override bool Enabled { get { return true; } set { } } public bool Visible { get; private set; } private static bool IsRussian => ((ModConfig.MenuLanguage != null) ? ModConfig.MenuLanguage.Value : "English")?.StartsWith("Russian", StringComparison.OrdinalIgnoreCase) ?? false; public MenuModule(ModuleManager modules) { }//IL_00ad: Unknown result type (might be due to invalid IL or missing references) public override void Initialize(ModuleManager modules) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) base.Initialize(modules); cachedMenuKey = ParseKey(ModConfig.MenuKey.Value, (KeyCode)277); } public override void OnUpdate() { //IL_000b: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(cachedMenuKey = ParseKey(ModConfig.MenuKey.Value, cachedMenuKey)) || Input.GetKeyDown((KeyCode)282)) { SetVisible(!Visible); } if (Visible) { KeepModalState(); } } public override void OnGUI() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_0041: Unknown result type (might be due to invalid IL or missing references) if (Visible) { GuiStyles.Ensure(); EnsureWindowRect(); GUI.depth = -10000; if ((Object)(object)dimTexture == (Object)null) { dimTexture = GuiStyles.MakeTexture(new Color(0f, 0f, 0f, 0.55f)); } GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), (Texture)(object)dimTexture); windowRect = GUI.Window(3310, windowRect, new WindowFunction(DrawWindow), "", GuiStyles.Window); windowRect = ClampToScreen(windowRect); } } public override void OnApplicationQuit() { SetVisible(visible: false); } private void SetVisible(bool visible) { if (Visible != visible) { Visible = visible; if (Visible) { centered = false; EnableModalMode(); } else { DisableModalMode(); } } } private void DrawWindow(int id) { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("BGMod", GuiStyles.Title, Array.Empty<GUILayoutOption>()); string headerStatus = GetHeaderStatus(); if (!string.IsNullOrEmpty(headerStatus)) { GUILayout.Space(12f); GUILayout.Label(headerStatus, GuiStyles.SmallLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(260f) }); } GUILayout.FlexibleSpace(); GUILayout.Label("Joive build", GuiStyles.SmallLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }); GUILayout.EndHorizontal(); DrawTabs(); GUILayout.Space(8f); scroll = GUILayout.BeginScrollView(scroll, false, true, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandHeight(true) }); switch (selectedTab) { case 0: DrawMainTab(); break; case 1: DrawPlayerTab(); break; case 2: DrawOnlineTab(); break; case 3: DrawEspTab(); break; case 4: DrawItemsTab(); break; case 5: DrawSpawnTab(); break; case 6: DrawWorldTab(); break; case 7: DrawResourcesTab(); break; case 8: DrawGameTab(); break; case 9: DrawChaosTab(); break; case 10: DrawPerformanceTab(); break; case 11: DrawDebugTab(); break; } GUILayout.EndScrollView(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("BGMod by Joive", GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); GUILayout.FlexibleSpace(); if (GUILayout.Button("Close", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) })) { SetVisible(visible: false); } GUILayout.EndHorizontal(); GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref windowRect)).width, 26f)); GUILayout.EndVertical(); } private string GetHeaderStatus() { List<string> list = new List<string>(); GameModule gameModule = base.Modules.Get<GameModule>(); if (gameModule != null && !string.IsNullOrEmpty(gameModule.RoundStatusText)) { list.Add(gameModule.RoundStatusText); } if (ModConfig.EnableESP.Value) { list.Add("ESP"); } if (ModConfig.EnableGnomeFeatures.Value) { list.Add("Player"); } if (ModConfig.FlyMode.Value) { list.Add("Fly exp"); } if (ModConfig.Noclip.Value) { list.Add("Noclip exp"); } if (list.Count != 0) { return string.Join(" | ", list.ToArray()); } return ""; } private void DrawTabs() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < tabs.Length; i++) { if (i % 6 == 0) { if (i > 0) { GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); } if (GUILayout.Button(L(tabs[i]), (selectedTab == i) ? GuiStyles.TabActive : GuiStyles.Tab, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) })) { selectedTab = i; scroll = Vector2.zero; confirmReset = false; } } GUILayout.EndHorizontal(); } private void DrawMainTab() { GUILayout.Label("BGMod by Joive", GuiStyles.Label, Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(L("Language"), GuiStyles.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }); if (GUILayout.Button("English", IsRussian ? GuiStyles.Tab : GuiStyles.TabActive, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) })) { ModConfig.MenuLanguage.Value = "English"; } if (GUILayout.Button("Русский", IsRussian ? GuiStyles.TabActive : GuiStyles.Tab, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) })) { ModConfig.MenuLanguage.Value = "Russian"; } GUILayout.EndHorizontal(); Toggle(ModConfig.EnableMod, L("Enable BGMod")); Toggle(ModConfig.EnableHUD, L("Enable HUD")); Toggle(ModConfig.EnableESP, L("Enable ESP")); Toggle(ModConfig.EnableGnomeFeatures, L("Enable player features")); Toggle(ModConfig.EnableChaos, L("Enable chaos features")); Toggle(ModConfig.EnablePerformanceMode, L("Enable FPS optimizations")); Toggle(ModConfig.DebugMode, L("Show debug info")); Toggle(ModConfig.UsePauseTimeScale, L("Pause game time while menu is open")); GUILayout.Space(8f); GUILayout.Label(L("Menu key") + ": " + ModConfig.MenuKey.Value + " (F1)", GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); if (GUILayout.Button(L("Save config"), GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) })) { ModConfig.Save(); } GUILayout.Space(4f); if (GUILayout.Button(confirmReset ? L("Confirm reset") : L("Reset config"), GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) })) { if (confirmReset) { ModConfig.ResetToDefaults(); confirmReset = false; } else { confirmReset = true; } } if (confirmReset) { GUILayout.Label(L("Click Confirm reset to restore BGMod defaults."), GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); } } private void DrawPlayerTab() { GnomeModule gnomeModule = base.Modules.Get<GnomeModule>(); Section("Player"); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); Toggle(ModConfig.EnableGnomeFeatures, L("Enable player features")); Toggle(ModConfig.GodMode, L("God mode")); Toggle(ModConfig.InfiniteStamina, L("Infinite stamina")); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button(L("Full heal"), GuiStyles.Button, Array.Empty<GUILayoutOption>())) { gnomeModule?.HealLocal(); } if (GUILayout.Button(L("Kill player"), GuiStyles.Button, Array.Empty<GUILayoutOption>())) { gnomeModule?.KillLocal(); } if (GUILayout.Button(L("Force ragdoll"), GuiStyles.Button, Array.Empty<GUILayoutOption>())) { gnomeModule?.ForceLocalRagdoll(); } if (GUILayout.Button(L("Unragdoll"), GuiStyles.Button, Array.Empty<GUILayoutOption>())) { gnomeModule?.UnragdollLocal(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); Toggle(ModConfig.NoFallDamage, L("No fall damage")); Toggle(ModConfig.AntiKidnap, L("Anti kidnap")); Toggle(ModConfig.LongHands, L("Long hands")); GUILayout.EndHorizontal(); Section("Movement"); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); Toggle(ModConfig.EnableFlyNoclipHotkeys, L("Movement hotkeys")); Toggle(ModConfig.FlyMode, L("Fly (Experimental)")); Toggle(ModConfig.Noclip, L("Noclip (Experimental)")); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); Slider(ModConfig.SpeedMultiplier, L("Speed multiplier"), 0.25f, 6f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("1x", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { ModConfig.SpeedMultiplier.Value = 1f; } if (GUILayout.Button("2x", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { ModConfig.SpeedMultiplier.Value = 2f; } if (GUILayout.Button("3x", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { ModConfig.SpeedMultiplier.Value = 3f; } if (GUILayout.Button("5x", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { ModConfig.SpeedMultiplier.Value = 5f; } GUILayout.EndHorizontal(); GUILayout.EndVertical(); GUILayout.Space(12f); GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); Slider(ModConfig.FlySpeed, L("Fly speed"), 1f, 60f); Slider(ModConfig.InteractionDistance, L("Interaction distance"), 1f, 12f); Slider(ModConfig.PlayerScale, L("Player scale"), 0.2f, 3f); GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.Label(L("Experimental movement note"), GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); GUILayout.Label(L("Hotkeys") + ": Fly " + ModConfig.FlyToggleKey.Value + ", Noclip " + ModConfig.NoclipToggleKey.Value + ", TP G", GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); } private void DrawOnlineTab() { OnlineModule onlineModule = base.Modules.Get<OnlineModule>(); if (onlineModule == null) { GUILayout.Label("Online module not loaded", GuiStyles.Label, Array.Empty<GUILayoutOption>()); return; } if (onlineModule.Players.Count == 0) { onlineModule.RefreshPlayers(); } Section("Online players"); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Refresh players", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) })) { onlineModule.RefreshPlayers(); } GUILayout.Label("Total players: " + onlineModule.Players.Count, GuiStyles.Label, Array.Empty<GUILayoutOption>()); GUILayout.EndHorizontal(); for (int i = 0; i < onlineModule.Players.Count; i++) { if (GUILayout.Button(onlineModule.PlayerLabel(i), (onlineModule.SelectedPlayerIndex == i) ? GuiStyles.TabActive : GuiStyles.Button, Array.Empty<GUILayoutOption>())) { onlineModule.SelectedPlayerIndex = i; } } Section("Actions"); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Heal", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { onlineModule.HealSelected(); } if (GUILayout.Button("Kill", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { onlineModule.KillSelected(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Ragdoll", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { onlineModule.RagdollSelected(ragdoll: true); } if (GUILayout.Button("Unragdoll", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { onlineModule.RagdollSelected(ragdoll: false); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Teleport to me", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { onlineModule.TeleportSelectedToMe(); } if (GUILayout.Button("Teleport me to them", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { onlineModule.TeleportMeToSelected(); } GUILayout.EndHorizontal(); Section("Effects"); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("Minutes (0 = infinity)", GuiStyles.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) }); onlineMinutesText = GUILayout.TextField(onlineMinutesText ?? "1", GuiStyles.TextField, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }); GUILayout.EndHorizontal(); float num = ParsePositiveFloat(onlineMinutesText, 1f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Stun", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { onlineModule.StunSelected(num); } if (GUILayout.Button("Tie", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { onlineModule.TieSelected(num); } if (GUILayout.Button("Fire", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { onlineModule.SetFireSelected(num); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Explode", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { onlineModule.ExplodeSelected(); } if (GUILayout.Button("Clear effects", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { onlineModule.ClearEffectsSelected(); } GUILayout.EndHorizontal(); GUILayout.Label(onlineModule.LastMessage, GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); } private void DrawEspTab() { Toggle(ModConfig.EnableESP, "Enable ESP"); Toggle(ModConfig.EnableItemESP, "Enable Item ESP"); Toggle(ModConfig.EnableLevelItemESP, "Enable Level Item ESP"); Toggle(ModConfig.EnableHumanESP, "Enable Human ESP"); Toggle(ModConfig.EnableRobotESP, "Enable Robot / Machine ESP"); Toggle(ModConfig.EnableInteractableESP, "Enable Interactable ESP"); Toggle(ModConfig.EnableGnomeESP, "Enable Player ESP"); Slider(ModConfig.ESPRefreshRate, "ESP refresh", 0.1f, 3f); Slider(ModConfig.MaxESPDistance, "Max distance", 10f, 250f); IntSlider(ModConfig.MaxESPObjects, "Max objects", 5, 150); Toggle(ModConfig.ShowPlayerInventoryOnESP, "Show player inventory"); Toggle(ModConfig.ShowNpcHeldItemOnESP, "Show NPC held item"); DrawConfigTextField(ModConfig.ESPItemFilter, "Item filter"); DrawConfigTextField(ModConfig.ESPHumanFilter, "Human / unit filter"); DrawConfigTextField(ModConfig.ESPPlayerFilter, "Player filter"); GUILayout.Label("Filters accept comma-separated text. Empty filter shows everything.", GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); GUILayout.Label("Cached targets: " + (base.Modules.Get<ESPModule>()?.Targets.Count ?? 0), GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); } private void DrawItemsTab() { ItemGiverModule itemGiverModule = base.Modules.Get<ItemGiverModule>(); if (itemGiverModule == null) { GUILayout.Label("Item module not loaded", GuiStyles.Label, Array.Empty<GUILayoutOption>()); return; } GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Inventory Items", (itemMode == 0) ? GuiStyles.TabActive : GuiStyles.Tab, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) })) { itemMode = 0; } if (GUILayout.Button("Level / ESP Items", (itemMode == 1) ? GuiStyles.TabActive : GuiStyles.Tab, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(170f) })) { itemMode = 1; if (itemGiverModule.LevelItems.Count == 0) { itemGiverModule.RefreshLevelItems(); } } GUILayout.EndHorizontal(); GUILayout.Space(6f); if (itemMode == 1) { DrawLevelItemsTab(itemGiverModule); } else { DrawInventoryItemsTab(itemGiverModule); } } private void DrawInventoryItemsTab(ItemGiverModule items) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("Search", GuiStyles.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); string text = GUILayout.TextField(items.SearchTerm ?? "", GuiStyles.TextField, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(260f) }); if (text != items.SearchTerm) { items.SearchTerm = text; items.UpdateSearch(); } if (GUILayout.Button("Refresh", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) })) { items.RefreshItems(); } GUILayout.EndHorizontal(); IntSlider(ModConfig.ItemGiveAmount, "Amount", 1, 999); GUILayout.Space(6f); IReadOnlyList<ItemData> matches = items.Matches; int num = Math.Min(matches.Count, 80); for (int i = 0; i < num; i++) { ItemData val = matches[i]; GUILayout.BeginHorizontal(GuiStyles.Box, Array.Empty<GUILayoutOption>()); if (GUILayout.Toggle(items.SelectedIndex == i, ((CraftableItemBase)val).Name, GuiStyles.Toggle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(360f) })) { items.SelectedIndex = i; } if (GUILayout.Button("Give", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) })) { items.SelectedIndex = i; items.GiveSelected(ModConfig.ItemGiveAmount.Value); } GUILayout.EndHorizontal(); } DrawQuickItemButtons(items); GUILayout.Label("Showing " + num + " / " + matches.Count + " matches. Use search for the rest.", GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); GUILayout.Label(items.LastMessage, GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); } private void DrawLevelItemsTab(ItemGiverModule items) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Refresh level items", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) })) { items.RefreshLevelItems(); } if (GUILayout.Button("Find key/remote", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) })) { items.RefreshQuestObjects(); } if (GUILayout.Button("Teleport item to player", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) })) { items.TeleportSelectedItemToPlayer(); } if (GUILayout.Button("Teleport player to item", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) })) { items.TeleportPlayerToSelectedItem(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Collect / Pick up", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) })) { items.CollectSelectedLevelItem(); } if (GUILayout.Button("Spawn copy near player", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(190f) })) { items.SpawnCopyOfSelectedLevelItem(); } GUILayout.EndHorizontal(); GUILayout.Space(6f); IReadOnlyList<ItemGiverModule.LevelItemTarget> levelItems = items.LevelItems; int num = Math.Min(levelItems.Count, 28); for (int i = 0; i < num; i++) { ItemGiverModule.LevelItemTarget levelItemTarget = levelItems[i]; GUILayout.BeginHorizontal(GuiStyles.Box, Array.Empty<GUILayoutOption>()); string text = levelItemTarget.Name + " [" + levelItemTarget.ComponentName + "] " + levelItemTarget.Distance.ToString("F1") + "m"; if (GUILayout.Toggle(items.LevelSelectedIndex == i, text, GuiStyles.Toggle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(480f) })) { items.LevelSelectedIndex = i; } GUILayout.EndHorizontal(); } GUILayout.Label(items.LastMessage, GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); } private void DrawQuickItemButtons(ItemGiverModule items) { GUILayout.Space(8f); GUILayout.Label("Quick", GuiStyles.Label, Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); string[] array = new string[6] { "gnomium", "metal", "fabric", "ceramics", "plastic", "chemicals" }; foreach (string text in array) { if (GUILayout.Button(text, GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(86f) })) { items.Give(text, ModConfig.ItemGiveAmount.Value); } } GUILayout.EndHorizontal(); } private void DrawSpawnTab() { SpawnerModule spawnerModule = base.Modules.Get<SpawnerModule>(); if (spawnerModule == null) { GUILayout.Label("Spawner module not loaded", GuiStyles.Label, Array.Empty<GUILayoutOption>()); return; } if (spawnerModule.ItemMatches.Count == 0 && spawnerModule.PrefabMatches.Count == 0 && string.IsNullOrEmpty(spawnerModule.LastMessage)) { spawnerModule.Refresh(); } GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Refresh lists", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) })) { spawnerModule.Refresh(); } if (GUILayout.Button("Refresh units", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) })) { spawnerModule.RefreshExistingUnits(); } IntFieldLikeSlider(ref spawnerModule.SpawnAmount, "Amount", 1, 50); GUILayout.EndHorizontal(); GUILayout.Space(6f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Items", (spawnMode == 0) ? GuiStyles.TabActive : GuiStyles.Tab, Array.Empty<GUILayoutOption>())) { spawnMode = 0; } if (GUILayout.Button("Objects", (spawnMode == 1) ? GuiStyles.TabActive : GuiStyles.Tab, Array.Empty<GUILayoutOption>())) { spawnMode = 1; } if (GUILayout.Button("NPCs", (spawnMode == 2) ? GuiStyles.TabActive : GuiStyles.Tab, Array.Empty<GUILayoutOption>())) { spawnMode = 2; } GUILayout.EndHorizontal(); if (spawnMode == 0) { DrawSpawnItems(spawnerModule); } else if (spawnMode == 1) { DrawSpawnObjects(spawnerModule); } else { DrawSpawnNpcs(spawnerModule); } GUILayout.Label(spawnerModule.LastMessage, GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); GUILayout.Label("Network spawns need host/server. If a prefab cannot be safely created, BGMod reports unavailable.", GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); } private void DrawSpawnItems(SpawnerModule spawner) { Section("Spawn items"); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("Search", GuiStyles.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); string text = GUILayout.TextField(spawner.ItemSearchTerm ?? "", GuiStyles.TextField, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(260f) }); if (text != spawner.ItemSearchTerm) { spawner.ItemSearchTerm = text; spawner.UpdateItemSearch(); } GUILayout.EndHorizontal(); IReadOnlyList<ItemData> itemMatches = spawner.ItemMatches; string text2 = ((itemMatches.Count > 0 && spawner.SelectedItemIndex >= 0 && spawner.SelectedItemIndex < itemMatches.Count) ? ((CraftableItemBase)itemMatches[spawner.SelectedItemIndex]).Name : "None"); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button((showSpawnItems ? "Hide list" : "Show list") + " (" + itemMatches.Count + ")", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) })) { showSpawnItems = !showSpawnItems; } GUILayout.Label("Selected: " + text2, GuiStyles.Label, Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Spawn selected", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) })) { spawner.SpawnSelectedItem(); } GUILayout.EndHorizontal(); if (!showSpawnItems) { return; } int count = itemMatches.Count; for (int i = 0; i < count; i++) { if (GUILayout.Button(((CraftableItemBase)itemMatches[i]).Name, (spawner.SelectedItemIndex == i) ? GuiStyles.TabActive : GuiStyles.Button, Array.Empty<GUILayoutOption>())) { spawner.SelectedItemIndex = i; } } GUILayout.Label("Showing " + count + " / " + itemMatches.Count + ". Search narrows the list.", GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); } private void DrawSpawnObjects(SpawnerModule spawner) { Section("Spawn objects"); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("Search", GuiStyles.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); string text = GUILayout.TextField(spawner.PrefabSearchTerm ?? "", GuiStyles.TextField, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(260f) }); if (text != spawner.PrefabSearchTerm) { spawner.PrefabSearchTerm = text; spawner.UpdatePrefabSearch(); } GUILayout.EndHorizontal(); IReadOnlyList<SpawnerModule.SpawnPrefabTarget> prefabMatches = spawner.PrefabMatches; string text2 = ((prefabMatches.Count > 0 && spawner.SelectedPrefabIndex >= 0 && spawner.SelectedPrefabIndex < prefabMatches.Count) ? (prefabMatches[spawner.SelectedPrefabIndex].Name + " [" + prefabMatches[spawner.SelectedPrefabIndex].Kind + "]") : "None"); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button((showSpawnObjects ? "Hide list" : "Show list") + " (" + prefabMatches.Count + ")", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) })) { showSpawnObjects = !showSpawnObjects; } GUILayout.Label("Selected: " + text2, GuiStyles.Label, Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Spawn selected", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) })) { spawner.SpawnSelectedPrefab(); } GUILayout.EndHorizontal(); if (!showSpawnObjects) { return; } int count = prefabMatches.Count; for (int i = 0; i < count; i++) { if (GUILayout.Button(prefabMatches[i].Name + " [" + prefabMatches[i].Kind + "]", (spawner.SelectedPrefabIndex == i) ? GuiStyles.TabActive : GuiStyles.Button, Array.Empty<GUILayoutOption>())) { spawner.SelectedPrefabIndex = i; } } GUILayout.Label("Showing " + count + " / " + prefabMatches.Count + ". Search narrows the list.", GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); } private void DrawSpawnNpcs(SpawnerModule spawner) { Section("Spawn NPCs"); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("Search", GuiStyles.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); string text = GUILayout.TextField(spawner.NpcSearchTerm ?? "", GuiStyles.TextField, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(260f) }); if (text != spawner.NpcSearchTerm) { spawner.NpcSearchTerm = text; spawner.UpdateNpcSearch(); } GUILayout.EndHorizontal(); IReadOnlyList<SpawnerModule.NpcSpawnTarget> npcMatches = spawner.NpcMatches; string text2 = ((npcMatches.Count > 0 && spawner.SelectedNpcIndex >= 0 && spawner.SelectedNpcIndex < npcMatches.Count) ? (npcMatches[spawner.SelectedNpcIndex].Name + " [" + npcMatches[spawner.SelectedNpcIndex].Source + "]") : "None"); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button((showSpawnNpcs ? "Hide list" : "Show list") + " (" + npcMatches.Count + ")", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) })) { showSpawnNpcs = !showSpawnNpcs; } GUILayout.Label("Selected: " + text2, GuiStyles.Label, Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Spawn selected", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) })) { spawner.SpawnSelectedNpc(); } GUILayout.EndHorizontal(); if (showSpawnNpcs) { int count = npcMatches.Count; for (int i = 0; i < count; i++) { if (GUILayout.Button(npcMatches[i].Name + " [" + npcMatches[i].Source + "]", (spawner.SelectedNpcIndex == i) ? GuiStyles.TabActive : GuiStyles.Button, Array.Empty<GUILayoutOption>())) { spawner.SelectedNpcIndex = i; } } GUILayout.Label("Showing " + count + " / " + npcMatches.Count + ". Search narrows the list.", GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); } Section("Existing units"); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Teleport unit to me", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { spawner.TeleportSelectedUnitToPlayer(); } if (GUILayout.Button("Teleport me to unit", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { spawner.TeleportPlayerToSelectedUnit(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Kill selected NPC", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { spawner.KillSelectedUnit(); } GUILayout.Label("Minutes (0 = infinity)", GuiStyles.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) }); npcMinutesText = GUILayout.TextField(npcMinutesText ?? "1", GuiStyles.TextField, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }); GUILayout.EndHorizontal(); float minutes = ParsePositiveFloat(npcMinutesText, 1f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Stun NPC", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { spawner.ApplyStatusToSelectedUnit((Type)0, minutes); } if (GUILayout.Button("Tie NPC", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { spawner.ApplyStatusToSelectedUnit((Type)2, minutes); } if (GUILayout.Button("Fire NPC", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { spawner.ApplyStatusToSelectedUnit((Type)1, minutes); } GUILayout.EndHorizontal(); IReadOnlyList<SpawnerModule.ExistingUnitTarget> existingUnits = spawner.ExistingUnits; GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button((showExistingUnits ? "Hide units" : "Show units") + " (" + existingUnits.Count + ")", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) })) { showExistingUnits = !showExistingUnits; } GUILayout.EndHorizontal(); if (!showExistingUnits) { return; } int count2 = existingUnits.Count; for (int j = 0; j < count2; j++) { if (GUILayout.Button(existingUnits[j].Name + " [" + existingUnits[j].TypeName + "] " + existingUnits[j].Distance.ToString("F1") + "m", (spawner.SelectedExistingUnitIndex == j) ? GuiStyles.TabActive : GuiStyles.Button, Array.Empty<GUILayoutOption>())) { spawner.SelectedExistingUnitIndex = j; } } GUILayout.Label("Showing " + count2 + " / " + existingUnits.Count + ".", GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); } private void DrawWorldTab() { WorldModule worldModule = base.Modules.Get<WorldModule>(); if (worldModule == null) { GUILayout.Label("World module not loaded", GuiStyles.Label, Array.Empty<GUILayoutOption>()); return; } if (worldModule.Levels.Count == 0 && string.IsNullOrEmpty(worldModule.LastMessage)) { worldModule.Refresh(); } GUILayout.Label("Current scene: " + worldModule.CurrentScene, GuiStyles.Label, Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Refresh levels", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) })) { worldModule.Refresh(); } if (GUILayout.Button("Start selected", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) })) { worldModule.LoadSelected(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("Search", GuiStyles.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); string text = GUILayout.TextField(worldModule.SearchTerm ?? "", GuiStyles.TextField, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(260f) }); if (text != worldModule.SearchTerm) { worldModule.SearchTerm = text; worldModule.ApplySearch(); } GUILayout.EndHorizontal(); IReadOnlyList<WorldModule.WorldTarget> levels = worldModule.Levels; int num = Math.Min(levels.Count, 60); for (int i = 0; i < num; i++) { WorldModule.WorldTarget worldTarget = levels[i]; GUILayout.BeginHorizontal(GuiStyles.Box, Array.Empty<GUILayoutOption>()); string text2 = worldTarget.DisplayName + " [" + worldTarget.Source + "]"; if (GUILayout.Toggle(worldModule.SelectedIndex == i, text2, GuiStyles.Toggle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(520f) })) { worldModule.SelectedIndex = i; } GUILayout.EndHorizontal(); } GUILayout.Label("Showing " + num + " / " + levels.Count + " levels.", GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); GUILayout.Label(worldModule.MethodInfo, GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); GUILayout.Label(worldModule.LastMessage, GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); } private void DrawResourcesTab() { ResourcesModule resourcesModule = base.Modules.Get<ResourcesModule>(); if (resourcesModule == null) { GUILayout.Label("Resources module not loaded", GuiStyles.Label, Array.Empty<GUILayoutOption>()); return; } GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Refresh resources", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) })) { resourcesModule.Refresh(); } GUILayout.Label(resourcesModule.CurrentValuesText, GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); GUILayout.EndHorizontal(); IntSlider(ModConfig.ResourceGiveAmount, "Amount", 1, 9999); string[] array = new string[6] { "ceramics", "metal", "fabric", "plastic", "chemicals", "gnomium" }; for (int i = 0; i < array.Length; i++) { GUILayout.BeginHorizontal(GuiStyles.Box, Array.Empty<GUILayoutOption>()); GUILayout.Label(array[i] + ": " + resourcesModule.GetCount(i), GuiStyles.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) }); if (GUILayout.Button("Add", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) })) { resourcesModule.AddResource(i, ModConfig.ResourceGiveAmount.Value); } GUILayout.EndHorizontal(); } if (GUILayout.Button("Add all", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) })) { resourcesModule.AddAll(ModConfig.ResourceGiveAmount.Value); } GUILayout.Label("Resources update storage values; some game UI panels refresh after reopening them.", GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); GUILayout.Label(resourcesModule.LastMessage, GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); } private void DrawGameTab() { GameModule gameModule = base.Modules.Get<GameModule>(); if (gameModule == null) { GUILayout.Label("Game module not loaded", GuiStyles.Label, Array.Empty<GUILayoutOption>()); return; } Section("Round"); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Game start", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { gameModule.StartGame(); } if (GUILayout.Button("Game end", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { gameModule.EndGame(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("Round minutes", GuiStyles.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(120f) }); roundMinutesText = GUILayout.TextField(roundMinutesText ?? "20", GuiStyles.TextField, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }); if (GUILayout.Button("Set remaining", GuiStyles.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) })) { gameModule.SetRemainingMinutes(ParsePositiveFloat(roundMinutesText, 20f)); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Infinity round", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { gameModule.FreezeRoundTime(frozen: true); } if (GUILayout.Button("Timer on", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { gameModule.FreezeRoundTime(frozen: false); } GUILayout.EndHorizontal(); Section("Complete tasks"); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); for (int i = 1; i <= 5; i++) { int taskNumber = i; if (GUILayout.Button(taskNumber.ToString(), GuiStyles.Button, Array.Empty<GUILayoutOption>())) { gameModule.CompleteTask(taskNumber); } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Complete 1-3", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { gameModule.CompleteTasksUpTo(3); } if (GUILayout.Button("Complete all 5", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { gameModule.CompleteTasksUpTo(5); } GUILayout.EndHorizontal(); GUILayout.Label(gameModule.LastMessage, GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); } private void DrawChaosTab() { ChaosModule chaosModule = base.Modules.Get<ChaosModule>(); Toggle(ModConfig.EnableChaos, "Enable chaos features"); Toggle(ModConfig.PoltergeistMode, "Poltergeist mode"); GUILayout.Label("Poltergeist extends possession. TP stays on G in the Player tab.", GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); GUILayout.Space(8f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("Radius", GuiStyles.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); chaosRadiusText = GUILayout.TextField(chaosRadiusText ?? "12", GuiStyles.TextField, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }); GUILayout.Label("Minutes", GuiStyles.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); chaosMinutesText = GUILayout.TextField(chaosMinutesText ?? "0.25", GuiStyles.TextField, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(80f) }); GUILayout.EndHorizontal(); float radius = ParsePositiveFloat(chaosRadiusText, 12f); float minutes = ParsePositiveFloat(chaosMinutesText, 0.25f); Section("Local chaos"); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Throw nearby props", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { chaosModule?.ThrowNearbyProps(radius, 22f); } if (GUILayout.Button("Bring units to me", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { chaosModule?.BringNearbyUnits(radius); } if (GUILayout.Button("Kill nearby units", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { chaosModule?.KillNearbyUnits(radius); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Stun nearby", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { chaosModule?.ApplyNearbyStatus((Type)0, radius, minutes); } if (GUILayout.Button("Tie nearby", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { chaosModule?.ApplyNearbyStatus((Type)2, radius, minutes); } if (GUILayout.Button("Fire nearby", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { chaosModule?.ApplyNearbyStatus((Type)1, radius, minutes); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button("Confuse nearby", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { chaosModule?.ApplyNearbyStatus((Type)13, radius, minutes); } if (GUILayout.Button("Sleep nearby", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { chaosModule?.ApplyNearbyStatus((Type)10, radius, minutes); } if (GUILayout.Button("Despawn enemies", GuiStyles.Button, Array.Empty<GUILayoutOption>())) { chaosModule?.DespawnEnemies(); } GUILayout.EndHorizontal(); GUILayout.Label("Some chaos actions need host/server to replicate for everyone.", GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); if (chaosModule != null) { GUILayout.Label(chaosModule.LastMessage, GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); } } private void DrawPerformanceTab() { Toggle(ModConfig.LowFPSMode, "Low FPS mode"); Toggle(ModConfig.DisableExpensiveScans, "Disable expensive scans"); Slider(ModConfig.CacheLifetime, "Cache lifetime", 0.5f, 10f); PerformanceModule performanceModule = base.Modules.Get<PerformanceModule>(); if (performanceModule != null) { GUILayout.Label("Effective ESP refresh: " + performanceModule.EspRefreshRate.ToString("F2"), GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); GUILayout.Label("Effective max objects: " + performanceModule.MaxEspObjects, GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); } } private void DrawDebugTab() { GUILayout.Label("BGMod by Joive", GuiStyles.Label, Array.Empty<GUILayoutOption>()); GUILayout.Label("Local player: " + ((Object)(object)GameAccess.LocalPlayer() != (Object)null), GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); GUILayout.Label("Time scale: " + Time.timeScale.ToString("F2"), GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); GnomeModule gnomeModule = base.Modules.Get<GnomeModule>(); if (gnomeModule != null && !string.IsNullOrEmpty(gnomeModule.LastMovementMessage)) { GUILayout.Label(gnomeModule.LastMovementMessage, GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); } GUILayout.Space(8f); foreach (IModModule allModule in base.Modules.AllModules) { GUILayout.Label(allModule.DisplayName + ": " + (allModule.Enabled ? "on" : "off"), GuiStyles.SmallLabel, Array.Empty<GUILayoutOption>()); } } private void EnableModalMode() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (!modalActive) { modalActive = true; oldCursorVisible = Cursor.visible; oldCursorLock = Cursor.lockState; oldTimeScale = Time.timeScale; Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; timeScalePaused = ModConfig.UsePauseTimeScale.Value; if (timeScalePaused) { Time.timeScale = 0f; } SetGameplayUiOpen(open: true); } } private void DisableModalMode() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (modalActive) { modalActive = false; if (timeScalePaused) { Time.timeScale = ((oldTimeScale <= 0f) ? 1f : oldTimeScale); } timeScalePaused = false; SetGameplayUiOpen(open: false); Cursor.visible = oldCursorVisible; Cursor.lockState = oldCursorLock; } } private void KeepModalState() { Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; SetGameplayUiOpen(open: true); if (ModConfig.UsePauseTimeScale.Value) { if (!timeScalePaused) { oldTimeScale = Time.timeScale; timeScalePaused = true; } if (Time.timeScale != 0f) { Time.timeScale = 0f; } } else if (timeScalePaused) { Time.timeScale = ((oldTimeScale <= 0f) ? 1f : oldTimeScale); timeScalePaused = false; } } private void SetGameplayUiOpen(bool open) { if (!open) { RestoreGameplayUiOpen(); return; } PlayerController val = FindLocalController(); if (!((Object)(object)val == (Object)null)) { if ((Object)(object)modalController != (Object)(object)val) { RestoreGameplayUiOpen(); modalController = val; oldControllerUiOpen = ReflectionUtils.GetBool(val, "isUiOpen"); hadModalControllerState = true; } ReflectionUtils.TrySetMemberValue(val, "isUiOpen", true); val.RefreshMouseState(); } } private void RestoreGameplayUiOpen() { if ((Object)(object)modalController == (Object)null || !hadModalControllerState) { modalController = null; hadModalControllerState = false; return; } ReflectionUtils.TrySetMemberValue(modalController, "isUiOpen", oldControllerUiOpen); modalController.RefreshMouseState(); modalController = null; hadModalControllerState = false; } private static PlayerController FindLocalController() { PlayerNetworking val = GameAccess.LocalPlayer(); if ((Object)(object)val == (Object)null) { return null; } PlayerController val2 = null; try { val2 = val.Controller; } catch { } if (!((Object)(object)val2 != (Object)null)) { return ((Component)val).GetComponentInChildren<PlayerController>(true); } return val2; } private void EnsureWindowRect() { //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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Min(760f, Mathf.Max(460f, (float)Screen.width - 32f)); float num2 = Mathf.Min(520f, Mathf.Max(360f, (float)Screen.height - 32f)); if (!centered || ((Rect)(ref windowRect)).width <= 0f || ((Rect)(ref windowRect)).height <= 0f) { windowRect = new Rect(((float)Screen.width - num) / 2f, ((float)Screen.height - num2) / 2f, num, num2); centered = true; } else { ((Rect)(ref windowRect)).width = num; ((Rect)(ref windowRect)).height = num2; windowRect = ClampToScreen(windowRect); } } private static Rect ClampToScreen(Rect rect) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) ((Rect)(ref rect)).x = Mathf.Clamp(((Rect)(ref rect)).x, 8f, Mathf.Max(8f, (float)Screen.width - ((Rect)(ref rect)).width - 8f)); ((Rect)(ref rect)).y = Mathf.Clamp(((Rect)(ref rect)).y, 8f, Mathf.Max(8f, (float)Screen.height - ((Rect)(ref rect)).height - 8f)); return rect; } private static void Toggle(ConfigEntry<bool> entry, string label) { bool flag = GUILayout.Toggle(entry.Value, label, GuiStyles.Toggle, Array.Empty<GUILayoutOption>()); if (flag != entry.Value) { entry.Value = flag; } } private static void Section(string label) { GUILayout.Label(label, GuiStyles.Section, Array.Empty<GUILayoutOption>()); } private static void Slider(ConfigEntry<float> entry, string label, float min, float max) { GUILayout.Label(label + ": " + entry.Value.ToString("F2"), GuiStyles.Label, Array.Empty<GUILayoutOption>()); entry.Value = GUILayout.HorizontalSlider(entry.Value, min, max, GuiStyles.Slider, GuiStyles.SliderThumb, Array.Empty<GUILayoutOption>()); } private static void IntSlider(ConfigEntry<int> entry, string label, int min, int max) { GUILayout.Label(label + ": " + entry.Value, GuiStyles.Label, Array.Empty<GUILayoutOption>()); entry.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)entry.Value, (float)min, (float)max, GuiStyles.Slider, GuiStyles.SliderThumb, Array.Empty<GUILayoutOption>())); } private static void IntFieldLikeSlider(ref int value, string label, int min, int max) { GUILayout.Label(label + ": " + value, GuiStyles.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }); value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)value, (float)min, (float)max, GuiStyles.Slider, GuiStyles.SliderThumb, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(140f) })); } private static void DrawConfigTextField(ConfigEntry<string> entry, string label) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(label, GuiStyles.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) }); string text = GUILayout.TextField(entry.Value ?? "", GuiStyles.TextField, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }); if (text != entry.Value) { entry.Value = text; } GUILayout.EndHorizontal(); } private static float ParsePositiveFloat(string value, float fallback) { if (float.TryParse((value ?? "").Replace(',', '.'), NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { return Mathf.Max(0f, result); } return fallback; } private static string L(string text) { if (!IsRussian) { return text; } return text switch { "Main" => "Главная", "Player" => "Игрок", "ESP" => "ESP", "Items" => "Предметы", "Spawn" => "Спавн", "World" => "Мир", "Resources" => "Ресурсы", "Chaos" => "Хаос", "Performance" => "FPS", "FPS" => "FPS", "Debug" => "Дебаг", "Language" => "Язык", "Enable BGMod" => "Включить BGMod", "Enable HUD" => "Включить HUD", "Enable ESP" => "Включить ESP", "Enable player features" => "Функции игрока", "Enable chaos features" => "Функции хаоса", "Enable FPS optimizations" => "Оптимизация FPS", "Show debug info" => "Показывать дебаг", "Pause game time while menu is open" => "Пауза времени при открытом меню", "Menu key" => "Клавиша меню", "Save config" => "Сохранить", "Reset config" => "Сбросить", "Confirm reset" => "Подтвердить", "Click Confirm reset to restore BGMod defaults." => "Нажми Подтвердить, чтобы вернуть настройки BGMod.", "Speed" => "Скорость", "Toggles" => "Переключатели", "Hands and scale" => "Руки и размер", "Full heal" => "Полное лечение", "Kill player" => "Убить игрока", "Force ragdoll" => "Ragdoll", "Unragdoll" => "Встать", "God mode" => "Бессмертие", "Infinite stamina" => "Бесконечная выносливость", "Movement hotkeys" => "Горячие клавиши движения", "Fly (Experimental)" => "Fly (Экспериментально)", "Noclip (Experimental)" => "Noclip (Экспериментально)", "No fall damage" => "Без урона от падения", "Anti kidnap" => "Анти-похищение", "Long hands" => "Длинные руки", "Speed multiplier" => "Скорость", "Fly speed" => "Скорость fly", "Interaction distance" => "Дистанция взаимодействия", "Player scale" => "Размер игрока", "Hotkeys" => "Клавиши", "Experimental movement note" => "Fly/Noclip оставлены как Experimental: TP на G стабильнее.", _ => text, }; } private static KeyCode ParseKey(string value, KeyCode fallback) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) try { return (KeyCode)Enum.Parse(typeof(KeyCode), value, ignoreCase: true); } catch { return fallback; } } } } namespace BGMod.Performance { public class PerformanceModule : ModuleBase { public override string Id => "performance"; public override string DisplayName => "Performance"; public override bool Enabled { get { return ModConfig.EnablePerformanceMode.Value; } set { ModConfig.EnablePerformanceMode.Value = value; } } public float EspRefreshRate { get { if (!ModConfig.LowFPSMode.Value) { return Math.Max(ModConfig.ESPRefreshRate.Value, 0.1f); } return Math.Max(ModConfig.ESPRefreshRate.Value, 1.5f); } } public float HudRefreshRate { get { if (!ModConfig.LowFPSMode.Value) { return Math.Max(ModConfig.HUDRefreshRate.Value, 0.05f); } return Math.Max(ModConfig.HUDRefreshRate.Value, 0.5f); } } public int MaxEspObjects { get { if (!ModConfig.LowFPSMode.Value) { return Math.Max(ModConfig.MaxESPObjects.Value, 1); } return Math.Min(ModConfig.MaxESPObjects.Value, 25); } } public float MaxEspDistance { get { if (!ModConfig.LowFPSMode.Value) { return Math.Max(ModConfig.MaxESPDistance.Value, 5f); } return Math.Min(ModConfig.MaxESPDistance.Value, 45f); } } public bool ExpensiveScansAllowed { get { if (!ModConfig.DisableExpensiveScans.Value) { return !ModConfig.LowFPSMode.Value; } return false; } } } } namespace BGMod.Patches { public static class PatchManager { public static void Apply(Harmony harmony) { TryPatch(harmony, "PlayerController", "Update", "PlayerControllerUpdatePrefix", null); } public static bool PlayerControllerUpdatePrefix() { if (!((Object)(object)BGModPlugin.Instance == (Object)null) && BGModPlugin.Instance.Menu != null) { return !BGModPlugin.Instance.Menu.Visible; } return true; } private static void TryPatch(Harmony harmony, string typeName, string methodName, string prefix, string postfix) { //IL_0066: 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) try { Type type = AccessTools.TypeByName(typeName); if (type == null) { ModLog.Warning("Patch skipped, type unavailable: " + typeName); return; } MethodInfo methodInfo = AccessTools.Method(type, methodName, (Type[])null, (Type[])null); if (methodInfo == null) { ModLog.Warning("Patch skipped, method unavailable: " + typeName + "." + methodName); return; } HarmonyMethod val = ((prefix == null) ? ((HarmonyMethod)null) : new HarmonyMethod(typeof(PatchManager).GetMethod(prefix))); HarmonyMethod val2 = ((postfix == null) ? ((HarmonyMethod)null) : new HarmonyMethod(typeof(PatchManager).GetMethod(postfix))); harmony.Patch((MethodBase)methodInfo, val, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); ModLog.Msg("Patch applied: " + typeName + "." + methodName); } catch (Exception ex) { ModLog.Warning("Patch failed for " + typeName + "." + methodName + ": " + ex.Message); } } } } namespace BGMod.HUD { public class HUDModule : ModuleBase { private float deltaTime; private float nextRefresh; private string activeModulesText = ""; private string warningsText = ""; private GUIStyle hudStyle; private GUIStyle fpsStyle; public override string Id => "hud"; public override string DisplayName => "HUD"; public override bool Enabled { get { return ModConfig.EnableHUD.Value; } set { ModConfig.EnableHUD.Value = value; } } public override void OnUpdate() { deltaTime += (Time.unscaledDeltaTime - deltaTime) * 0.1f; float num = base.Modules.Get<PerformanceModule>()?.HudRefreshRate ?? ModConfig.HUDRefreshRate.Value; if (Time.unscaledTime >= nextRefresh) { nextRefresh = Time.unscaledTime + num; activeModulesText = string.Join(", ", base.Modules.EnabledModuleNames.Where((string n) => n != "Menu").Take(8).ToArray()); BuildWarnings(); } } public override void OnGUI() { //IL_00a9: 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_01ab: Unknown result type (might be due to invalid IL or missing references) if (Enabled) { InitStyles(); float num = Mathf.Clamp(ModConfig.HUDScale.Value, 0.6f, 2f); float num2 = Mathf.Clamp(ModConfig.HUDPositionX.Value, 0f, (float)Screen.width - 80f); float num3 = Mathf.Clamp(ModConfig.HUDPositionY.Value, 0f, (float)Screen.height - 40f); int fontSize = Mathf.RoundToInt(12f * num); hudStyle.fontSize = fontSize; fpsStyle.fontSize = Mathf.RoundToInt(13f * num); GUILayout.BeginArea(new Rect(num2, num3, 380f * num, 160f * num), GUIContent.none, GUIStyle.none); if (ModConfig.ShowFPS.Value) { GUILayout.Label("FPS " + ((deltaTime > 0.0001f) ? (1f / deltaTime) : 0f).ToString("F0"), fpsStyle, Array.Empty<GUILayoutOption>()); } if (ModConfig.ShowActiveModules.Value && !string.IsNullOrEmpty(activeModulesText)) { GUILayout.Label("Active: " + activeModulesText, hudStyle, Array.Empty<GUILayoutOption>()); } if (ModConfig.ShowWarnings.Value && !string.IsNullOrEmpty(warningsText)) { GUILayout.Label(warningsText, hudStyle, Array.Empty<GUILayoutOption>()); } if (ModConfig.DebugMode.Value) { PlayerNetworking val = GameAccess.LocalPlayer(); string text = ((Object)(object)val != (Object)null).ToString(); Scene activeScene = SceneManager.GetActiveScene(); GUILayout.Label("Debug: local=" + text + " scene=" + ((Scene)(ref activeScene)).name, hudStyle, Array.Empty<GUILayoutOption>()); } GUILayout.EndArea(); } } private void InitStyles() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown if (hudStyle == null) { GUIStyle val = new GUIStyle(GUI.skin.label); val.normal.textColor = new Color(0.92f, 0.94f, 0.9f, 0.92f); val.richText = true; val.wordWrap = true; hudStyle = val; GUIStyle val2 = new GUIStyle(hudStyle) { fontStyle = (FontStyle)1 }; val2.normal.textColor = new Color(0.45f, 1f, 0.72f, 0.96f); fpsStyle = val2; } } private void BuildWarnings() { List<string> list = new List<string>(); if ((Object)(object)Camera.main == (Object)null) { list.Add("camera unavailable"); } if ((Object)(object)GameAccess.LocalPlayer() == (Object)null) { list.Add("local player not found"); } warningsText = ((list.Count == 0) ? "" : ("Warn: " + string.Join(", ", list.ToArray()))); } } } namespace BGMod.Features { public class ChaosModule : ModuleBase { private object lastPossessTarget; public string LastMessage = ""; public override string Id => "chaos"; public override string DisplayName => "Chaos"; public override bool Enabled { get { return ModConfig.EnableChaos.Value; } set { ModConfig.EnableChaos.Value = value; } } public override void OnUpdate() { if (!Enabled) { return; } PlayerNetworking local = GameAccess.LocalPlayer(); if ((Object)(object)local == (Object)null) { return; } Guard("update", delegate { if (ModConfig.PoltergeistMode.Value) { RunPoltergeist(local); } if (Input.GetMouseButtonDown(2)) { SnatchLookedAtItem(local); } }); } private void RunPoltergeist(PlayerNetworking local) { Component val = ((Component)local).GetComponent("PlayerGhosty") ?? ((Component)local).GetComponentInChildren(TypeByName("PlayerGhosty"), true); if (!((Object)(object)val == (Object)null)) { ReflectionUtils.TrySetMemberValue(val, "possessCooldown", 0f); object memberValue = ReflectionUtils.GetMemberValue(val, "CurrentPossessTarget"); if (memberValue != null && memberValue != lastPossessTarget) { lastPossessTarget = memberValue; BGModPlugin.Instance?.StartPluginCoroutine(ExtendPossession(memberValue)); } } } private IEnumerator ExtendPossession(object target) { for (int i = 0; i < 15; i++) { if (target == null) { break; } ReflectionUtils.TrySetMemberValue(target, "maxPossessTime", 99999f); yield return (object)new WaitForSeconds(0.1f); } } private void SnatchLookedAtItem(PlayerNetworking local) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: 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) RaycastHit val = default(RaycastHit); if ((Object)(object)Camera.main == (Object)null || !Physics.Raycast(Camera.main.ScreenPointToRay(new Vector3((float)Screen.width / 2f, (float)Screen.height / 2f, 0f)), ref val, 120f)) { return; } StealableObject componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<StealableObject>(); if (!((Object)(object)componentInParent == (Object)null)) { ((Component)componentInParent).transform.position = ((Component)local).transform.position + ((Component)local).transform.forward * 1.2f + Vector3.up * 0.4f; Rigidbody component = ((Component)componentInParent).GetComponent<Rigidbody>(); if ((Object)(object)component != (Object)null) { component.linearVelocity = Vector3.zero; component.angularVelocity = Vector3.zero; } } } public void ThrowNearbyProps(float radius, float force) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_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) PlayerNetworking val = GameAccess.LocalPlayer(); if ((Object)(object)val == (Object)null) { LastMessage = "Local player not found"; return; } int num = 0; Vector3 position = ((Component)val).transform.position; Rigidbody[] array = Object.FindObjectsByType<Rigidbody>((FindObjectsSortMode)0); foreach (Rigidbody val2 in array) { if (!((Object)(object)val2 == (Object)null) && !val2.isKinematic && !((Component)val2).transform.IsChildOf(((Component)val).transform) && !(Vector3.Distance(position, val2.position) > radius)) { val2.AddExplosionForce(force, position - Vector3.up, radius, 0.5f, (ForceMode)1); num++; } } LastMessage = "Thrown props: " + num; } public unsafe void ApplyNearbyStatus(Type type, float radius, float minutes) { //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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) PlayerNetworking val = GameAccess.LocalPlayer(); if ((Object)(object)val == (Object)null) { LastMessage = "Local player not found"; return; } float num = ((minutes <= 0f) ? float.PositiveInfinity : (minutes * 60f)); int num2 = 0; Vector3 position = ((Component)val).transform.position; GameEntityBase[] array = Object.FindObjectsByType<GameEntityBase>((FindObjectsSortMode)0); foreach (GameEntityBase val2 in array) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)((Component)val2).gameObject == (Object)(object)((Component)val).gameObject) && !(Vector3.Distance(position, ((Component)val2).transform.position) > radius)) { StatusEffectHandler val3 = ((Component)val2).GetComponent<StatusEffectHandler>() ?? ((Component)val2).GetComponentInChildren<StatusEffectHandler>(true); if (!((Object)(object)val3 == (Object)null)) { val3.AddStatus(type, num); num2++; } } } LastMessage = ((object)(*(Type*)(&type))/*cast due to .constrained prefix*/).ToString() + " applied to nearby units: " + num2; } public void BringNearbyUnits(float radius) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) PlayerNetworking val = GameAccess.LocalPlayer(); if ((Object)(object)val == (Object)null) { LastMessage = "Local player not found"; return; } int num = 0; Vector3 position = ((Component)val).transform.position; Vector3 val2 = position + ((Component)val).transform.forward * 2f; GameEntityBase[] array = Object.FindObjectsByType<GameEntityBase>((FindObjectsSortMode)0); foreach (GameEntityBase val3 in array) { if (!((Object)(object)val3 == (Object)null) && !((Object)(object)((Component)val3).gameObject == (Object)(object)((Component)val).gameObject) && !(Vector3.Distance(position, ((Component)val3).transform.position) > radius)) { ((Component)val3).transform.position = val2 + Random.insideUnitSphere * 1.2f; Rigidbody val4 = ((Component)val3).GetComponent<Rigidbody>() ?? ((Component)val3).GetComponentInChildren<Rigidbody>(true); if ((Object)(object)val4 != (Object)null) { val4.linearVelocity = Vector3.zero; val4.angularVelocity = Vector3.zero; } num++; } } LastMessage = "Moved units to you: " + num; } public void KillNearbyUnits(float radius) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) PlayerNetworking val = GameAccess.LocalPlayer(); if ((Object)(object)val == (Object)null) { LastMessage = "Local player not found"; return; } int num = 0; Vector3 position = ((Component)val).transform.position; GameEntityBase[] array = Object.FindObjectsByType<GameEntityBase>((FindObjectsSortMode)0); foreach (GameEntityBase val2 in array) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)((Component)val2).gameObject == (Object)(object)((Component)val).gameObject) && !(Vector3.Distance(position, ((Component)val2).transform.position) > radius)) { HealthBase val3 = ((Component)val2).GetComponent<HealthBase>() ?? ((Component)val2).GetComponentInChildren<HealthBase>(true); if (!((Object)(object)val3 == (Object)null)) { val3.TakeDamage(9999f); num++; } } } LastMessage = "Killed nearby units: " + num; } public void DespawnEnemies() { AiDirector val = Object.FindFirstObjectByType<AiDirector>(); if ((Object)(object)val == (Object)null) { LastMessage = "AI director not found"; return; } try { val.DespawnEnemies(); LastMessage = "Despawned enemies"; } catch (Exception ex) { LastMessage = "Despawn failed: " + ex.Message; } } private static Type TypeByName(string name) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { Type type = assemblies[i].GetType(name); if (type != null) { return type; } } return null; } } public class GameModule : ModuleBase { public string LastMessage = ""; public override string Id => "game"; public override string DisplayName => "Game"; public override bool Enabled { get { return ModConfig.EnableMod.Value; } set { } } public string RoundStatusText { get { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 GameProgressionManager val = FindProgression(); if ((Object)(object)val == (Object)null) {