Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of GameTools v1.0.0
Zichen-GameTools-1.0.0.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.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("Zichen-GameTools-1.0.0")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+0912781a8d417f59f0b27bf4c57e37143756b297")] [assembly: AssemblyProduct("Zichen-GameTools-1.0.0")] [assembly: AssemblyTitle("Zichen-GameTools-1.0.0")] [assembly: AssemblyVersion("1.0.0.0")] [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 Zichen_GameTools { public enum DisplayLanguage { 中文, English } [BepInPlugin("zichen.gametools", "GameTools", "1.0.0")] public class Plugin : BaseUnityPlugin { internal sealed class CfgI18N { public string SectionCN; public string SectionEN; public string KeyCN; public string KeyEN; public string DisplayEN; public string DescCN; public string DescEN; public ConfigurationManagerAttributes Attrs; public string ValueEN; public string ValueCN; public ConfigEntry<string> ReadOnlyEntry; public ConfigEntryBase Entry; } public enum SpawnType { Valuable, Weapon, Enemy, Cart, Vehicle } public class SpawnableInfo { public string Name; public string InternalName; public SpawnType Type; public object Source; public string ExtraInfo; public string GetDisplayName() { string text = Name; if (UseChinese()) { text = ((Type != SpawnType.Enemy) ? ItemNameLocalizer.Translate(Name) : EnemyNameLocalizer.Translate(Name)); } if (!string.IsNullOrEmpty(ExtraInfo)) { return text + " " + ExtraInfo; } return text; } } [HarmonyPatch(typeof(InputManager), "InitializeInputs")] private class InputManager_InitializeInputs_Patch { [HarmonyPostfix] private static void Postfix() { try { InputManagerInitializeInputsPostfix(); } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[InitializeInputs Patch Error]: {arg}"); } } } } [HarmonyPatch(typeof(PlayerController), "Start")] private class PlayerController_Start_Patch { [HarmonyPostfix] private static void Postfix() { try { PlayerControllerStartPostfix(); } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[PlayerController.Start Patch Error]: {arg}"); } } } } [HarmonyPatch(typeof(CameraAim), "Update")] private class CameraAim_Update_Patch { [HarmonyPrefix] private static void Prefix(CameraAim __instance) { //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) if (!IsStaticModEnabled() || !IsTumbleFlyEnabled()) { return; } try { PlayerController instance = PlayerController.instance; PlayerTumble val = (((Object)(object)instance != (Object)null && (Object)(object)instance.playerAvatarScript != (Object)null) ? PlayerAvatarTumbleRef.Invoke(instance.playerAvatarScript) : null); if (!((Object)(object)val != (Object)null) || !PlayerTumbleIsTumblingRef.Invoke(val)) { return; } Keyboard current = Keyboard.current; if (current == null || !((ButtonControl)current.qKey).isPressed) { return; } AccessTools.FieldRefAccess<CameraAim, float>("overridePlayerAimDisableTimer").Invoke(__instance) = 0f; AccessTools.FieldRefAccess<CameraAim, float>("overrideAimStopTimer").Invoke(__instance) = 0f; AccessTools.FieldRefAccess<CameraAim, bool>("overrideAimStop").Invoke(__instance) = false; if ((Object)(object)InputManager.instance != (Object)null) { AccessTools.FieldRefAccess<InputManager, float>("disableAimingTimer").Invoke(InputManager.instance) = 0f; } float num = SemiFunc.InputMouseX(); float num2 = SemiFunc.InputMouseY(); if (!(Mathf.Abs(num) < 0.0001f) || !(Mathf.Abs(num2) < 0.0001f)) { return; } Mouse current2 = Mouse.current; if (current2 == null) { return; } Vector2 val2 = ((InputControl<Vector2>)(object)((Pointer)current2).delta).ReadValue(); if (((Vector2)(ref val2)).sqrMagnitude > 0.0001f) { float aimSpeedMouse = __instance.AimSpeedMouse; float num3 = val2.x * 0.05f * aimSpeedMouse; float num4 = val2.y * 0.05f * aimSpeedMouse; if ((Object)(object)GameplayManager.instance != (Object)null && AccessTools.FieldRefAccess<GameplayManager, bool>("aimInvertVertical").Invoke(GameplayManager.instance)) { num4 *= -1f; } ref float reference = ref AccessTools.FieldRefAccess<CameraAim, float>("aimHorizontal").Invoke(__instance); ref float reference2 = ref AccessTools.FieldRefAccess<CameraAim, float>("aimVertical").Invoke(__instance); reference += num3; if (reference > 360f) { reference -= 360f; } if (reference < -360f) { reference += 360f; } reference2 -= num4; reference2 = Mathf.Clamp(reference2, -70f, 80f); } } catch (Exception arg) { Plugin instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogWarning((object)$"[CameraAim.Update Prefix Error]: {arg}"); } } } } [HarmonyPatch(typeof(PlayerAvatar), "UpgradeTumbleWingsVisualsActive")] private class PlayerAvatar_UpgradeTumbleWingsVisualsActive_Patch { [HarmonyPrefix] private static bool Prefix(PlayerAvatar __instance, ref bool _visualsActive) { if (!IsStaticModEnabled()) { return true; } try { if (IsWingsAlwaysShowEnabled() && PlayerAvatarIsLocalRef.Invoke(__instance) && !_visualsActive) { return false; } } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[UpgradeTumbleWingsVisualsActive.Prefix Error]: {arg}"); } } return true; } } [HarmonyPatch(typeof(PlayerAvatar), "UpgradeTumbleWingsVisualsActiveRPC")] private class PlayerAvatar_UpgradeTumbleWingsVisualsActiveRPC_Patch { [HarmonyPrefix] private static void Prefix(PlayerAvatar __instance, ref bool _visualsActive) { if (!IsStaticModEnabled()) { return; } try { if (IsWingsAlwaysShowEnabled() && PlayerAvatarIsLocalRef.Invoke(__instance)) { _visualsActive = true; } } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[UpgradeTumbleWingsVisualsActiveRPC.Prefix Error]: {arg}"); } } } } [HarmonyPatch(typeof(PlayerAvatar), "Update")] private class PlayerAvatar_Update_Patch { [HarmonyPostfix] private static void Postfix(PlayerAvatar __instance) { //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Expected O, but got Unknown if (!IsStaticModEnabled()) { return; } try { string text = PlayerAvatarSteamIDRef.Invoke(__instance); int value = 0; if ((Object)(object)StatsManager.instance != (Object)null && !string.IsNullOrEmpty(text)) { StatsManager.instance.playerUpgradeTumbleWings.TryGetValue(text, out value); } if (PlayerAvatarIsLocalRef.Invoke(__instance)) { bool flag = IsWingsAlwaysShowEnabled(); if (flag) { if (PlayerAvatarUpgradeTumbleWingsRef.Invoke(__instance) < 3f) { PlayerAvatarUpgradeTumbleWingsRef.Invoke(__instance) = 3f; } if (!PlayerAvatarUpgradeTumbleWingsVisualsActiveRef.Invoke(__instance)) { __instance.UpgradeTumbleWingsVisualsActive(true, false); PlayerAvatarUpgradeTumbleWingsVisualsActiveRef.Invoke(__instance) = true; } if (PhotonNetwork.IsMasterClient && (Object)(object)StatsManager.instance != (Object)null && !string.IsNullOrEmpty(text)) { int value2 = 0; StatsManager.instance.playerUpgradeTumbleWings.TryGetValue(text, out value2); if (value2 < 3) { if (!_originalWingsLevel.ContainsKey(text)) { _originalWingsLevel[text] = value2; } StatsManager.instance.playerUpgradeTumbleWings[text] = 3; SemiFunc.StatSyncAll(); } } } else { if (PlayerAvatarUpgradeTumbleWingsRef.Invoke(__instance) > (float)value) { PlayerAvatarUpgradeTumbleWingsRef.Invoke(__instance) = value; if (value <= 0) { __instance.UpgradeTumbleWingsVisualsActive(false, false); PlayerAvatarUpgradeTumbleWingsVisualsActiveRef.Invoke(__instance) = false; } } if (PhotonNetwork.IsMasterClient && (Object)(object)StatsManager.instance != (Object)null && !string.IsNullOrEmpty(text) && _originalWingsLevel.TryGetValue(text, out var value3)) { StatsManager.instance.playerUpgradeTumbleWings[text] = value3; _originalWingsLevel.Remove(text); SemiFunc.StatSyncAll(); } } if (PhotonNetwork.InRoom && PhotonNetwork.LocalPlayer != null) { bool flag2 = false; if (((Dictionary<object, object>)(object)PhotonNetwork.LocalPlayer.CustomProperties).TryGetValue((object)"GT_WingsAlwaysShow", out object value4) && value4 is bool) { flag2 = (bool)value4; } if (flag2 != flag) { Hashtable val = new Hashtable(); val[(object)"GT_WingsAlwaysShow"] = flag; PhotonNetwork.LocalPlayer.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } } return; } bool flag3 = false; if (PhotonNetwork.InRoom && (Object)(object)__instance.photonView != (Object)null && __instance.photonView.Owner != null && ((Dictionary<object, object>)(object)__instance.photonView.Owner.CustomProperties).TryGetValue((object)"GT_WingsAlwaysShow", out object value5) && value5 is bool) { flag3 = (bool)value5; } if (flag3) { if (PlayerAvatarUpgradeTumbleWingsRef.Invoke(__instance) < 3f) { PlayerAvatarUpgradeTumbleWingsRef.Invoke(__instance) = 3f; } if (!PlayerAvatarUpgradeTumbleWingsVisualsActiveRef.Invoke(__instance)) { PlayerAvatarUpgradeTumbleWingsVisualsActiveRef.Invoke(__instance) = true; } if (!PhotonNetwork.IsMasterClient || !((Object)(object)StatsManager.instance != (Object)null) || string.IsNullOrEmpty(text)) { return; } int value6 = 0; StatsManager.instance.playerUpgradeTumbleWings.TryGetValue(text, out value6); if (value6 < 3) { if (!_originalWingsLevel.ContainsKey(text)) { _originalWingsLevel[text] = value6; } StatsManager.instance.playerUpgradeTumbleWings[text] = 3; SemiFunc.StatSyncAll(); } return; } if (PlayerAvatarUpgradeTumbleWingsRef.Invoke(__instance) > (float)value) { PlayerAvatarUpgradeTumbleWingsRef.Invoke(__instance) = value; if (value <= 0) { PlayerAvatarUpgradeTumbleWingsVisualsActiveRef.Invoke(__instance) = false; } } if (PhotonNetwork.IsMasterClient && (Object)(object)StatsManager.instance != (Object)null && !string.IsNullOrEmpty(text) && _originalWingsLevel.TryGetValue(text, out var value7)) { StatsManager.instance.playerUpgradeTumbleWings[text] = value7; _originalWingsLevel.Remove(text); SemiFunc.StatSyncAll(); } } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[PlayerAvatar.Update.Postfix Error]: {arg}"); } } } } [HarmonyPatch(typeof(PlayerController), "FixedUpdate")] private class PlayerController_FixedUpdate_Patch { [HarmonyPostfix] private static void Postfix(PlayerController __instance) { //IL_0012: 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_001c: Unknown result type (might be due to invalid IL or missing references) //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_002d: Unknown result type (might be due to invalid IL or missing references) if (!IsStaticModEnabled()) { return; } try { if (IsReverseInputEnabled()) { __instance.InputDirection = -__instance.InputDirection; __instance.InputDirectionRaw = -__instance.InputDirectionRaw; } } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[PlayerController.FixedUpdate.Postfix Error]: {arg}"); } } } } [HarmonyPatch(typeof(PlayerAvatarVisuals), "Start")] private class PlayerAvatarVisuals_Start_Patch { [HarmonyPostfix] private static void Postfix(PlayerAvatarVisuals __instance) { if (!IsStaticModEnabled()) { return; } try { if ((Object)(object)((Component)__instance).GetComponent<GameToolsLateUpdateHelper>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<GameToolsLateUpdateHelper>(); } } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[PlayerAvatarVisuals.Start.AddComponent Error]: {arg}"); } } } } [HarmonyPatch(typeof(PlayerController), "Update")] private class PlayerController_Update_Patch { private static float _originalJumpForce = -1f; [HarmonyPostfix] private static void Postfix(PlayerController __instance) { bool flag = IsStaticModEnabled() && IsJumpMultiplierEnabled(); try { if ((Object)(object)__instance == (Object)(object)PlayerController.instance) { if (_originalJumpForce < 0f) { _originalJumpForce = __instance.JumpForce; } if (flag) { __instance.JumpForce = _originalJumpForce * GetJumpMultiplier(); } else if (__instance.JumpForce != _originalJumpForce && _originalJumpForce >= 0f) { __instance.JumpForce = _originalJumpForce; } } } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[PlayerController.Update.JumpForce Patch Error]: {arg}"); } } } } [HarmonyPatch(typeof(ItemUpgradePlayerTumbleWingsLogic), "Update")] private class ItemUpgradePlayerTumbleWingsLogic_Update_Patch { private static bool _lastRainbowActive; [HarmonyPostfix] private static void Postfix(ItemUpgradePlayerTumbleWingsLogic __instance) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) bool flag = IsStaticModEnabled() && IsRainbowWingsEnabled(); try { if (!((Object)(object)__instance.playerAvatar != (Object)null) || !PlayerAvatarIsLocalRef.Invoke(__instance.playerAvatar)) { return; } if (flag) { float num = Time.time * 0.5f % 1f; Color val = Color.HSVToRGB(num, 1f, 1f); Color val2 = Color.HSVToRGB(num, 0.8f, 1f); MeshRenderer val3 = Wing1MeshRendererRef.Invoke(__instance); MeshRenderer val4 = Wing2MeshRendererRef.Invoke(__instance); if ((Object)(object)val3 != (Object)null && (Object)(object)((Renderer)val3).material != (Object)null) { ((Renderer)val3).material.SetColor("_BaseColor", val); ((Renderer)val3).material.SetColor("_FresnelColor", val2); } if ((Object)(object)val4 != (Object)null && (Object)(object)((Renderer)val4).material != (Object)null) { ((Renderer)val4).material.SetColor("_BaseColor", val); ((Renderer)val4).material.SetColor("_FresnelColor", val2); } if ((Object)(object)__instance.lightWings != (Object)null) { __instance.lightWings.color = val; } _lastRainbowActive = true; } else if (_lastRainbowActive) { if (AccessTools.FieldRefAccess<ItemUpgradePlayerTumbleWingsLogic, bool>("isPink").Invoke(__instance)) { __instance.WingsSetPinkColors(); } else { __instance.WingsSetOriginalColors(); } _lastRainbowActive = false; } } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[ItemUpgradePlayerTumbleWingsLogic.Update Patch Error]: {arg}"); } } } } public class GameToolsLateUpdateHelper : MonoBehaviour { private PlayerAvatarVisuals _visuals; private void Start() { _visuals = ((Component)this).GetComponent<PlayerAvatarVisuals>(); } private void LateUpdate() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) if (!IsStaticModEnabled()) { return; } try { if (IsReverseLegsEnabled() && (Object)(object)_visuals != (Object)null && (Object)(object)_visuals.legTwistTransform != (Object)null && !_visuals.isMenuAvatar && (Object)(object)_visuals.playerAvatar != (Object)null && PlayerAvatarIsLocalRef.Invoke(_visuals.playerAvatar)) { Transform legTwistTransform = _visuals.legTwistTransform; legTwistTransform.localRotation *= Quaternion.Euler(0f, 180f, 0f); } } catch { } } } [HarmonyPatch(typeof(ItemUpgradePlayerTumbleWingsLogic), "FixedUpdate")] private class ItemUpgradePlayerTumbleWingsLogic_FixedUpdate_Patch { [HarmonyPostfix] private static void Postfix(ItemUpgradePlayerTumbleWingsLogic __instance) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) if (!IsStaticModEnabled() || !IsTumbleFlyEnabled()) { return; } try { if (!((Object)(object)__instance.playerAvatar != (Object)null) || !PlayerAvatarIsLocalRef.Invoke(__instance.playerAvatar)) { return; } PlayerTumble val = WingsPlayerTumbleRef.Invoke(__instance); PhysGrabObject val2 = (((Object)(object)val != (Object)null) ? PlayerTumblePhysGrabObjectRef.Invoke(val) : null); Keyboard current = Keyboard.current; if (current == null || !((ButtonControl)current.qKey).isPressed || !((Object)(object)val != (Object)null) || !PlayerTumbleIsTumblingRef.Invoke(val) || !((Object)(object)val2 != (Object)null) || !((Object)(object)val2.rb != (Object)null)) { return; } Transform overrideTransform = __instance.playerAvatar.localCamera.GetOverrideTransform(); if ((Object)(object)overrideTransform != (Object)null) { Vector3 forward = overrideTransform.forward; float num = 16f; val2.rb.velocity = forward * num; val.OverrideLookAtCamera(0.1f, 10f, 5f); if (!PlayerAvatarUpgradeTumbleWingsVisualsActiveRef.Invoke(__instance.playerAvatar)) { __instance.playerAvatar.UpgradeTumbleWingsVisualsActive(true, false); PlayerAvatarUpgradeTumbleWingsVisualsActiveRef.Invoke(__instance.playerAvatar) = true; } TumbleWingTimerRef.Invoke(__instance) = 1f; } } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[ItemUpgradePlayerTumbleWingsLogic.FixedUpdate Patch Error]: {arg}"); } } } } [HarmonyPatch(typeof(EnemyParent), "Despawn")] private class EnemyParent_Despawn_Patch { [HarmonyPostfix] private static void Postfix(EnemyParent __instance) { if (!IsStaticModEnabled() || (PhotonNetwork.InRoom && !PhotonNetwork.IsMasterClient)) { return; } try { if (!((Object)(object)((Component)__instance).GetComponent<SpawnedByGameToolsHelper>() != (Object)null) || _cfgSpawnedAutoRespawn) { return; } Enemy val = EnemyParentEnemyRef.Invoke(__instance); if (!((Object)(object)val != (Object)null)) { return; } EnemyHealth val2 = EnemyHealthRef.Invoke(val); if (!((Object)(object)val2 != (Object)null) || EnemyHealthCurrentRef.Invoke(val2) > 0) { return; } if ((Object)(object)EnemyDirector.instance != (Object)null && EnemyDirector.instance.enemiesSpawned != null) { EnemyDirector.instance.enemiesSpawned.Remove(__instance); } if (PhotonNetwork.InRoom) { if (PhotonNetwork.IsMasterClient) { PhotonNetwork.Destroy(((Component)__instance).gameObject); } } else { Object.Destroy((Object)(object)((Component)__instance).gameObject); } } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[EnemyParent.Despawn Patch Error]: {arg}"); } } } } [HarmonyPatch(typeof(EnemyDirector), "AmountSetup")] private class EnemyDirector_AmountSetup_Patch { [HarmonyPostfix] private static void Postfix(EnemyDirector __instance) { if (!IsStaticModEnabled() || (PhotonNetwork.InRoom && !PhotonNetwork.IsMasterClient)) { return; } try { float spawnRateMultiplier = GetSpawnRateMultiplier(); if (!(spawnRateMultiplier > 1f)) { return; } int num = EnemyDirectorAmountCurve1ValueRef.Invoke(__instance); int num2 = EnemyDirectorAmountCurve2ValueRef.Invoke(__instance); int num3 = EnemyDirectorAmountCurve3ValueRef.Invoke(__instance); int num4 = Mathf.RoundToInt((float)num * (spawnRateMultiplier - 1f)); int num5 = Mathf.RoundToInt((float)num2 * (spawnRateMultiplier - 1f)); int num6 = Mathf.RoundToInt((float)num3 * (spawnRateMultiplier - 1f)); MethodInfo method = typeof(EnemyDirector).GetMethod("PickEnemies", BindingFlags.Instance | BindingFlags.NonPublic); if (method != null) { for (int i = 0; i < num6; i++) { method.Invoke(__instance, new object[1] { __instance.enemiesDifficulty3 }); } for (int j = 0; j < num5; j++) { method.Invoke(__instance, new object[1] { __instance.enemiesDifficulty2 }); } for (int k = 0; k < num4; k++) { method.Invoke(__instance, new object[1] { __instance.enemiesDifficulty1 }); } } EnemyDirectorAmountCurve1ValueRef.Invoke(__instance) = num + num4; EnemyDirectorAmountCurve2ValueRef.Invoke(__instance) = num2 + num5; EnemyDirectorAmountCurve3ValueRef.Invoke(__instance) = num3 + num6; EnemyDirectorTotalAmountRef.Invoke(__instance) = EnemyDirectorTotalAmountRef.Invoke(__instance) + num4 + num5 + num6; Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)$"[GameTools] Spawn Multiplier {spawnRateMultiplier}x applied! Added slots: Difficulty1={num4}, Difficulty2={num5}, Difficulty3={num6}. Total slots: {EnemyDirectorTotalAmountRef.Invoke(__instance)}"); } } catch (Exception arg) { Plugin instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogWarning((object)$"[EnemyDirector.AmountSetup Postfix Error]: {arg}"); } } } } [HarmonyPatch(typeof(ItemBattery), "Update")] private class ItemBattery_Update_Patch { [HarmonyPrefix] private static void Prefix(ItemBattery __instance, ref float __state) { __state = -1f; if (IsStaticModEnabled() && IsInfiniteWeaponBatteryEnabled() && IsWeapon(__instance)) { __state = __instance.batteryLife; } } [HarmonyPostfix] private static void Postfix(ItemBattery __instance, float __state) { if (__state >= 0f) { __instance.batteryLife = __state; } } } [HarmonyPatch(typeof(ItemBattery), "Drain")] private class ItemBattery_Drain_Patch { [HarmonyPrefix] private static bool Prefix(ItemBattery __instance) { if (IsStaticModEnabled() && IsInfiniteWeaponBatteryEnabled() && IsWeapon(__instance)) { return false; } return true; } } [HarmonyPatch(typeof(ItemBattery), "RemoveFullBar")] private class ItemBattery_RemoveFullBar_Patch { [HarmonyPrefix] private static bool Prefix(ItemBattery __instance) { if (IsStaticModEnabled() && IsInfiniteWeaponBatteryEnabled() && IsWeapon(__instance)) { return false; } return true; } } internal sealed class LiveLabel { public WeakReference<TextMeshProUGUI> Tmp; public CfgI18N I18N; public bool IsSection; } internal sealed class LiveValue { public WeakReference<Object> InputField; public CfgI18N I18N; } internal sealed class LiveSliderOptions { public WeakReference<Object> Slider; public CfgI18N I18N; public string[] OptionsCN; public string[] OptionsEN; } internal sealed class LiveToggleButtons { public WeakReference<TextMeshProUGUI> LeftTmp; public WeakReference<TextMeshProUGUI> RightTmp; } public const string PluginGuid = "zichen.gametools"; public const string PluginName = "GameTools"; public const string PluginVersion = "1.0.0"; internal static Plugin Instance; private Harmony _harmony; internal static readonly FieldRef<PlayerController, string> PlayerSteamIDRef = AccessTools.FieldRefAccess<PlayerController, string>("playerSteamID"); internal static readonly FieldRef<PlayerAvatar, string> PlayerAvatarSteamIDRef = AccessTools.FieldRefAccess<PlayerAvatar, string>("steamID"); internal static readonly FieldRef<PlayerAvatar, bool> PlayerAvatarIsLocalRef = AccessTools.FieldRefAccess<PlayerAvatar, bool>("isLocal"); internal static readonly FieldRef<PlayerAvatar, string> PlayerAvatarPlayerNameRef = AccessTools.FieldRefAccess<PlayerAvatar, string>("playerName"); internal static readonly FieldRef<PlayerAvatar, bool> PlayerAvatarDeadSetRef = AccessTools.FieldRefAccess<PlayerAvatar, bool>("deadSet"); internal static readonly FieldRef<PlayerAvatar, PlayerTumble> PlayerAvatarTumbleRef = AccessTools.FieldRefAccess<PlayerAvatar, PlayerTumble>("tumble"); internal static readonly FieldRef<PlayerAvatar, float> PlayerAvatarUpgradeTumbleWingsRef = AccessTools.FieldRefAccess<PlayerAvatar, float>("upgradeTumbleWings"); internal static readonly FieldRef<PlayerAvatar, bool> PlayerAvatarUpgradeTumbleWingsVisualsActiveRef = AccessTools.FieldRefAccess<PlayerAvatar, bool>("upgradeTumbleWingsVisualsActive"); internal static readonly FieldRef<ItemUpgradePlayerTumbleWingsLogic, MeshRenderer> Wing1MeshRendererRef = AccessTools.FieldRefAccess<ItemUpgradePlayerTumbleWingsLogic, MeshRenderer>("wing1MeshRenderer"); internal static readonly FieldRef<ItemUpgradePlayerTumbleWingsLogic, MeshRenderer> Wing2MeshRendererRef = AccessTools.FieldRefAccess<ItemUpgradePlayerTumbleWingsLogic, MeshRenderer>("wing2MeshRenderer"); internal static readonly FieldRef<ItemUpgradePlayerTumbleWingsLogic, PlayerTumble> WingsPlayerTumbleRef = AccessTools.FieldRefAccess<ItemUpgradePlayerTumbleWingsLogic, PlayerTumble>("playerTumble"); internal static readonly FieldRef<ItemUpgradePlayerTumbleWingsLogic, float> TumbleWingTimerRef = AccessTools.FieldRefAccess<ItemUpgradePlayerTumbleWingsLogic, float>("tumbleWingTimer"); internal static readonly FieldRef<PlayerTumble, PhysGrabObject> PlayerTumblePhysGrabObjectRef = AccessTools.FieldRefAccess<PlayerTumble, PhysGrabObject>("physGrabObject"); internal static readonly FieldRef<PlayerTumble, bool> PlayerTumbleIsTumblingRef = AccessTools.FieldRefAccess<PlayerTumble, bool>("isTumbling"); internal static readonly FieldRef<EnemyParent, bool> EnemyParentSetupDoneRef = AccessTools.FieldRefAccess<EnemyParent, bool>("SetupDone"); internal static readonly FieldRef<EnemyParent, bool> EnemyParentFirstSpawnPointUsedRef = AccessTools.FieldRefAccess<EnemyParent, bool>("firstSpawnPointUsed"); internal static readonly FieldRef<EnemyDirector, float> EnemyDirectorSpawnIdlePauseTimerRef = AccessTools.FieldRefAccess<EnemyDirector, float>("spawnIdlePauseTimer"); internal static readonly FieldRef<EnemyParent, bool> EnemyParentSpawnedRef = AccessTools.FieldRefAccess<EnemyParent, bool>("Spawned"); internal static readonly FieldRef<EnemyParent, bool> EnemyParentPlayerCloseRef = AccessTools.FieldRefAccess<EnemyParent, bool>("playerClose"); internal static readonly FieldRef<EnemyParent, Enemy> EnemyParentEnemyRef = AccessTools.FieldRefAccess<EnemyParent, Enemy>("Enemy"); internal static readonly FieldRef<Enemy, EnemyHealth> EnemyHealthRef = AccessTools.FieldRefAccess<Enemy, EnemyHealth>("Health"); internal static readonly FieldRef<EnemyHealth, int> EnemyHealthCurrentRef = AccessTools.FieldRefAccess<EnemyHealth, int>("healthCurrent"); internal static readonly FieldRef<CursorManager, float> CursorManagerUnlockTimerRef = AccessTools.FieldRefAccess<CursorManager, float>("unlockTimer"); internal static readonly FieldRef<EnemyDirector, int> EnemyDirectorAmountCurve1ValueRef = AccessTools.FieldRefAccess<EnemyDirector, int>("amountCurve1Value"); internal static readonly FieldRef<EnemyDirector, int> EnemyDirectorAmountCurve2ValueRef = AccessTools.FieldRefAccess<EnemyDirector, int>("amountCurve2Value"); internal static readonly FieldRef<EnemyDirector, int> EnemyDirectorAmountCurve3ValueRef = AccessTools.FieldRefAccess<EnemyDirector, int>("amountCurve3Value"); internal static readonly FieldRef<EnemyDirector, int> EnemyDirectorTotalAmountRef = AccessTools.FieldRefAccess<EnemyDirector, int>("totalAmount"); private bool _windowOpen; private int _currentTab; private CursorLockMode _prevLockMode; private bool _prevVisible; internal static int _realUpgradeHealth = -1; internal static int _realUpgradeStamina = -1; internal static int _realUpgradeSpeed = -1; private static ConfigFile _runtimeConfig; private static ConfigEntry<bool> _cfgModEnabled; private static ConfigEntry<DisplayLanguage> _cfgLanguage; private ConfigEntry<string> _openKey; private static ConfigEntry<bool> _cfgWingsAlwaysShow; private static ConfigEntry<bool> _cfgReverseInput; private static ConfigEntry<bool> _cfgReverseLegs; private static ConfigEntry<bool> _cfgRainbowWings; private static ConfigEntry<bool> _cfgJumpMultiplierEnabled; private static ConfigEntry<float> _cfgJumpMultiplier; private static ConfigEntry<bool> _cfgTumbleFlyEnabled; private static ConfigEntry<bool> _cfgInfiniteWeaponBattery; private static ConfigEntry<float> _cfgSpawnRateMultiplier; internal static ConfigEntry<bool> _cfgResetMonsterDataOnLevelLoad; private static readonly string[] _chineseModKeywords = new string[6] { "chinese", "简体", "繁體", "繁体", "汉化", "中文" }; private static readonly string[] _chineseEnvironmentPluginGuids = new string[1] { "gravydevsupreme.xunity.autotranslator" }; internal static readonly Dictionary<string, CfgI18N> _cfgByEnSection = new Dictionary<string, CfgI18N>(StringComparer.Ordinal); internal static readonly Dictionary<string, CfgI18N> _cfgByEnKey = new Dictionary<string, CfgI18N>(StringComparer.Ordinal); internal static readonly Dictionary<string, List<CfgI18N>> _cfgByKeyOnly = new Dictionary<string, List<CfgI18N>>(StringComparer.Ordinal); private static readonly List<CfgI18N> _cfgI18Ns = new List<CfgI18N>(20); private static readonly Dictionary<string, string> _chineseNames = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) { { "Oogly", "哭泣鬼 (Oogly)" }, { "Tick", "蜱虫 (Tick)" }, { "ThinMan", "瘦子触手怪 (Thin Man)" }, { "HeartHugger", "抱心怪 (Heart Hugger)" }, { "Floater", "漂浮者 (Floater)" }, { "Runner", "奔跑者 (Runner)" }, { "Slow Walker", "慢行者 (Slow Walker)" }, { "Gnome", "地精 (Gnome)" }, { "Beamer", "激光怪 (Beamer)" }, { "Bomb Thrower", "投弹者 (Bomb Thrower)" }, { "Valuable Thrower", "丢垃圾者 (Valuable Thrower)" }, { "Slow Mouth", "大嘴怪 (Slow Mouth)" }, { "Upscream", "尖叫怪 (Upscream)" }, { "Tricycle", "三轮车 (Tricycle)" }, { "Bang", "炸弹人 (Bang)" }, { "Head Grabber", "抱头怪 (Head Grabber)" }, { "Gun Tranq", "麻醉枪" }, { "Gun Laser", "激光枪" }, { "Mine Explosive", "爆炸地雷" }, { "Mine Stun", "电击地雷" }, { "Grenade Stun", "闪光眩晕弹" }, { "Grenade Explosive", "爆炸手雷" }, { "Grenade Shockwave", "冲击波弹" }, { "Grenade Human", "诱饵弹" }, { "Grenade Duct Taped", "胶带手雷" }, { "Melee Inflatable Hammer", "充气气锤" }, { "Stun Baton", "电击棒" }, { "Staff Void", "虚空法杖" }, { "Staff Torque", "扭矩法杖" }, { "Staff Zero Gravity", "无重力法杖" }, { "Gumball", "扭蛋机" }, { "Surplus Small", "剩余物资(小)" }, { "Surplus Medium", "剩余物资(中)" }, { "Surplus Big", "剩余物资(大)" }, { "MoneyBag", "钱袋" }, { "Milk", "牛奶瓶" }, { "Barrel", "木桶" }, { "Jackhammer", "冲击钻" }, { "FireExtinguisher", "灭火器" }, { "Flamethrower", "火焰喷射器" }, { "IceSaw", "电锯/冰锯" }, { "Blender", "榨汁机" }, { "CrystalBall", "水晶球" }, { "BabyHead", "婴儿头" }, { "Vehicle Semiscooter Small", "小型滑板车 (Scooter)" }, { "Vehicle Cart Small", "小型手推车 (Cart S)" }, { "Vehicle Cart Medium", "中型手推车 (Cart M)" }, { "Vehicle Cart Big", "大型手推车 (Cart L)" }, { "Vehicle Cart Pallet", "液压托盘车 (Pallet)" }, { "Pocket Cart", "折叠随身车" } }; private static int _currentSubTab = 0; private static int _monsterSubTab = 0; internal static float _globalDespawnMin = 30f; internal static float _globalDespawnMax = 120f; internal static float _globalSpawnMin = 60f; internal static float _globalSpawnMax = 300f; internal static float _originalDespawnMin = 30f; internal static float _originalDespawnMax = 120f; internal static float _originalSpawnMin = 60f; internal static float _originalSpawnMax = 300f; internal static bool _globalOverrideInited = false; private static Vector2 _subScrollPos = Vector2.zero; private static int _spawnCount = 1; internal static bool _cfgSpawnedAutoRespawn = false; private static List<SpawnableInfo> _spawnablesValuables = new List<SpawnableInfo>(); private static List<SpawnableInfo> _spawnablesMelee = new List<SpawnableInfo>(); private static List<SpawnableInfo> _spawnablesRanged = new List<SpawnableInfo>(); private static List<SpawnableInfo> _spawnablesOtherWeapons = new List<SpawnableInfo>(); private static List<SpawnableInfo> _spawnablesEnemies = new List<SpawnableInfo>(); private static List<SpawnableInfo> _spawnablesCarts = new List<SpawnableInfo>(); private static List<SpawnableInfo> _spawnablesVehicles = new List<SpawnableInfo>(); private static List<SpawnableInfo> _spawnablesPotions = new List<SpawnableInfo>(); private static bool _spawnablesLoaded = false; internal static readonly string[] AvailableKeybinds = new string[55] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "F11", "F12", "Space", "Enter", "Tab", "LeftShift", "RightShift", "LeftControl", "RightControl" }; private const int OpenInputKeyValue = 336; private static readonly InputKey OpenInputKey = (InputKey)336; private static string _lastAppliedOpenKey; private const int GuiWindowId = 33002; private const float Pad = 16f; private Rect _windowRect = new Rect(0f, 0f, 860f, 700f); private bool _windowCentered; private Vector2 _scrollPos = Vector2.zero; private float _lastVirtualHeight = 400f; private bool _stylesInit; private Texture2D _texDark; private Texture2D _texMid; private Texture2D _texLight; private Texture2D _texGreen; private Texture2D _texRed; private Texture2D _texSection; private Texture2D _texBorder; private GUIStyle _sWindow; private GUIStyle _sTitle; private GUIStyle _sLabel; private GUIStyle _sStatus; private GUIStyle _sBtnGreen; private GUIStyle _sBtnRed; private GUIStyle _sBtnNormal; private GUIStyle _sBtnClose; private GUIStyle _sSection; private GUIStyle _sToggleOn; private GUIStyle _sCheckmarkStyleWhite; private GUIStyle _sSlider; private GUIStyle _sThumb; private GUIStyle _sTextInput; private static Dictionary<string, int> _originalWingsLevel = new Dictionary<string, int>(); private static readonly List<LiveLabel> _liveLabels = new List<LiveLabel>(32); private static readonly List<LiveValue> _liveValues = new List<LiveValue>(4); private static readonly List<LiveSliderOptions> _liveSliderOptions = new List<LiveSliderOptions>(4); private static readonly List<LiveToggleButtons> _liveToggleButtons = new List<LiveToggleButtons>(8); private static readonly Dictionary<Type, FieldInfo> _labelTmpFieldCache = new Dictionary<Type, FieldInfo>(8); private static readonly Dictionary<Type, PropertyInfo> _sliderStringOptionsPropCache = new Dictionary<Type, PropertyInfo>(4); private static readonly Dictionary<Type, FieldInfo> _toggleLeftTmpCache = new Dictionary<Type, FieldInfo>(4); private static readonly Dictionary<Type, FieldInfo> _toggleRightTmpCache = new Dictionary<Type, FieldInfo>(4); private static readonly Dictionary<string, int> _pendingKeyMatchIndex = new Dictionary<string, int>(StringComparer.Ordinal); internal static string _currentRenderingConfigFilePath; internal static bool _createModEntriesPatchInstalled; private static readonly Dictionary<Type, FieldInfo> _inputStringSystemFieldCache = new Dictionary<Type, FieldInfo>(4); private static readonly Dictionary<Type, MethodInfo> _inputStringSystemSetValueCache = new Dictionary<Type, MethodInfo>(4); private static readonly Dictionary<string, string> _enumNameCNtoEN = new Dictionary<string, string>(StringComparer.Ordinal) { ["中文"] = "Chinese" }; private static readonly Dictionary<string, string> _enumNameENtoCN = new Dictionary<string, string>(StringComparer.Ordinal) { ["English"] = "英语", ["Chinese"] = "中文" }; public static bool IsStaticModEnabled() { if (_cfgModEnabled != null) { return _cfgModEnabled.Value; } return false; } public static bool UseChinese() { if (_cfgLanguage != null) { return _cfgLanguage.Value == DisplayLanguage.中文; } return false; } public static float GetSpawnRateMultiplier() { if (_cfgSpawnRateMultiplier == null || !IsStaticModEnabled()) { return 1f; } return _cfgSpawnRateMultiplier.Value; } public static bool IsWingsAlwaysShowEnabled() { if (IsStaticModEnabled() && _cfgWingsAlwaysShow != null) { return _cfgWingsAlwaysShow.Value; } return false; } public static bool IsReverseInputEnabled() { if (IsStaticModEnabled() && _cfgReverseInput != null) { return _cfgReverseInput.Value; } return false; } public static bool IsReverseLegsEnabled() { if (IsStaticModEnabled() && _cfgReverseLegs != null) { return _cfgReverseLegs.Value; } return false; } public static bool IsRainbowWingsEnabled() { if (IsStaticModEnabled() && _cfgRainbowWings != null) { return _cfgRainbowWings.Value; } return false; } public static bool IsJumpMultiplierEnabled() { if (IsStaticModEnabled() && _cfgJumpMultiplierEnabled != null) { return _cfgJumpMultiplierEnabled.Value; } return false; } public static float GetJumpMultiplier() { if (_cfgJumpMultiplier == null) { return 1f; } return _cfgJumpMultiplier.Value; } public static bool IsTumbleFlyEnabled() { if (IsStaticModEnabled() && _cfgTumbleFlyEnabled != null) { return _cfgTumbleFlyEnabled.Value; } return false; } public static bool IsInfiniteWeaponBatteryEnabled() { if (IsStaticModEnabled() && _cfgInfiniteWeaponBattery != null) { return _cfgInfiniteWeaponBattery.Value; } return false; } public static int GetDictValue(Dictionary<string, int> dict, string key, int defaultVal = 0) { if (dict == null || string.IsNullOrEmpty(key)) { return defaultVal; } if (!dict.TryGetValue(key, out var value)) { return defaultVal; } return value; } private void Awake() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.DestroyImmediate((Object)(object)((Component)this).gameObject); return; } Instance = this; DetachFromManager(); ResetConfigIfVersionChanged(); BindConfig(); try { _harmony = new Harmony("zichen.gametools"); _harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"GameTools Harmony patches applied successfully."); } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Failed to patch Harmony: {arg}"); } TryHookREPOConfig(_harmony); ((BaseUnityPlugin)this).Logger.LogInfo((object)"GameTools v1.0.0 已加载。"); try { SceneManager.sceneLoaded += OnSceneLoaded; } catch (Exception arg2) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Failed to bind sceneLoaded: {arg2}"); } } private void Update() { if (IsOpenKeyPressed()) { SetWindowOpen(!_windowOpen); } if (_windowOpen) { KeepCursorFree(); } if (!IsStaticModEnabled()) { RestoreRealUpgrades(); return; } if (!string.IsNullOrEmpty(((Object)(object)PlayerController.instance != (Object)null) ? PlayerSteamIDRef.Invoke(PlayerController.instance) : null) && (Object)(object)StatsManager.instance != (Object)null) { if (_realUpgradeHealth != -1 || _realUpgradeStamina != -1 || _realUpgradeSpeed != -1) { RestoreRealUpgrades(); } } else { _realUpgradeHealth = -1; _realUpgradeStamina = -1; _realUpgradeSpeed = -1; _globalOverrideInited = false; } if (!((Object)(object)EnemyDirector.instance != (Object)null) || EnemyDirector.instance.enemiesSpawned == null) { return; } float spawnRateMultiplier = GetSpawnRateMultiplier(); if (!(spawnRateMultiplier > 1f)) { return; } foreach (EnemyParent item in EnemyDirector.instance.enemiesSpawned) { if ((Object)(object)item != (Object)null && !EnemyParentSpawnedRef.Invoke(item)) { float despawnedTimer = item.DespawnedTimer; if (despawnedTimer > 0f) { float num = Time.deltaTime * (spawnRateMultiplier - 1f); item.DespawnedTimerSet(Mathf.Max(0f, despawnedTimer - num), false); } } } } private void LateUpdate() { if (_windowOpen && IsStaticModEnabled()) { KeepCursorFree(); } } public static void RestoreRealUpgrades() { if ((Object)(object)StatsManager.instance == (Object)null) { return; } string text = (((Object)(object)PlayerController.instance != (Object)null) ? PlayerSteamIDRef.Invoke(PlayerController.instance) : null); if (string.IsNullOrEmpty(text)) { return; } bool flag = false; if (_realUpgradeHealth != -1) { StatsManager.instance.playerUpgradeHealth[text] = _realUpgradeHealth; _realUpgradeHealth = -1; flag = true; } if (_realUpgradeStamina != -1) { StatsManager.instance.playerUpgradeStamina[text] = _realUpgradeStamina; _realUpgradeStamina = -1; flag = true; } if (_realUpgradeSpeed != -1) { StatsManager.instance.playerUpgradeSpeed[text] = _realUpgradeSpeed; _realUpgradeSpeed = -1; flag = true; } if (flag) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)"[GameTools] Restored player upgrades to original values."); } if ((Object)(object)StatsUI.instance != (Object)null) { StatsUI.instance.Fetch(); } } } private void TakeCursor() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) _prevLockMode = Cursor.lockState; _prevVisible = Cursor.visible; try { if ((Object)(object)CursorManager.instance != (Object)null) { CursorManager.instance.Unlock(9999f); } } catch { } Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } private static void KeepCursorFree() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if ((int)Cursor.lockState != 0) { Cursor.lockState = (CursorLockMode)0; } if (!Cursor.visible) { Cursor.visible = true; } } private void ReleaseCursor() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Cursor.lockState = _prevLockMode; Cursor.visible = _prevVisible; try { if ((Object)(object)CursorManager.instance != (Object)null) { CursorManagerUnlockTimerRef.Invoke(CursorManager.instance) = 0f; } } catch { } } private void SetWindowOpen(bool open) { if (_windowOpen != open) { _windowOpen = open; if (open) { _windowCentered = false; TakeCursor(); } else { ReleaseCursor(); } } } private void BindConfig() { //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Expected O, but got Unknown DisplayLanguage defaultVal = DetectDefaultLanguage(); try { string configFilePath = ((BaseUnityPlugin)this).Config.ConfigFilePath; if (File.Exists(configFilePath)) { Match match = Regex.Match(File.ReadAllText(configFilePath), "(?m)^GameTools Language\\s*=\\s*(.+?)\\s*$"); if (match.Success) { string text = match.Groups[1].Value.Trim(); if (text == "中文" || text == DisplayLanguage.中文.ToString()) { defaultVal = DisplayLanguage.中文; } else if (text == "English" || text == DisplayLanguage.English.ToString()) { defaultVal = DisplayLanguage.English; } } } } catch { } _cfgLanguage = BindI18N("A.Mod Info", "A.模组信息", "GameToolsLanguage", "语言", "Switch display language. Live updates UI.", "切换显示语言。实时刷新面板。", defaultVal, null, 980, "Language"); BindReadOnlyI18N("A.Mod Info", "A.模组信息", "GameToolsModName", "模组名称", "GameTools", "游戏工具箱", 1000, "Mod Name"); BindReadOnlyI18N("A.Mod Info", "A.模组信息", "GameToolsModVersion", "模组版本号", "1.0.0", "1.0.0", 990, "Mod Version"); _cfgModEnabled = BindI18N("B.Global Settings", "B.全局设置", "Mod Enable", "模组启用", "Disable to turn off the whole mod.", "关闭整个模组,使其彻底失效。", defaultVal: true); _openKey = BindI18N("B.Global Settings", "B.全局设置", "Open Keybind", "打开快捷键", "The key used to open/close the GUI menu.", "呼出或关闭本界面的快捷键。", "F4", (AcceptableValueBase)(object)new AcceptableValueList<string>(AvailableKeybinds)); _runtimeConfig = new ConfigFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Config.ConfigFilePath), "zichen.gametoolsruntime.cfg"), false); _cfgWingsAlwaysShow = _runtimeConfig.Bind<bool>("Runtime", "WingsAlwaysShow", false, "Wings Always Show"); _cfgReverseInput = _runtimeConfig.Bind<bool>("Runtime", "ReverseInput", false, "Reverse Input"); _cfgReverseLegs = _runtimeConfig.Bind<bool>("Runtime", "ReverseLegs", false, "Reverse Legs"); _cfgRainbowWings = _runtimeConfig.Bind<bool>("Runtime", "RainbowWings", false, "Rainbow Wings"); _cfgJumpMultiplierEnabled = _runtimeConfig.Bind<bool>("Runtime", "JumpMultiplierEnabled", false, "Super Jump Enabled"); _cfgJumpMultiplier = _runtimeConfig.Bind<float>("Runtime", "JumpMultiplier", 1.5f, "Jump Force Multiplier"); _cfgTumbleFlyEnabled = _runtimeConfig.Bind<bool>("Runtime", "TumbleFlyEnabled", false, "Tumble Fly Enabled"); _cfgInfiniteWeaponBattery = _runtimeConfig.Bind<bool>("Runtime", "InfiniteWeaponBattery", false, "Infinite Weapon Battery"); _cfgSpawnRateMultiplier = _runtimeConfig.Bind<float>("Runtime", "SpawnRateMultiplier", 1f, "Spawn Rate Multiplier"); _cfgResetMonsterDataOnLevelLoad = _runtimeConfig.Bind<bool>("Runtime", "ResetMonsterDataOnLevelLoad", true, "Reset Monster Data On Level Load"); if (_cfgLanguage != null) { _cfgLanguage.SettingChanged += delegate { RefreshAllI18N(); }; } } public static void SaveRuntimeConfig() { try { ConfigFile runtimeConfig = _runtimeConfig; if (runtimeConfig != null) { runtimeConfig.Save(); } } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[SaveRuntimeConfig Error]: {arg}"); } } } private static DisplayLanguage DetectDefaultLanguage() { try { foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { string text = pluginInfo.Key ?? string.Empty; PluginInfo value = pluginInfo.Value; object obj; if (value == null) { obj = null; } else { BepInPlugin metadata = value.Metadata; obj = ((metadata != null) ? metadata.Name : null); } if (obj == null) { obj = string.Empty; } string text2 = (string)obj; string[] chineseModKeywords = _chineseModKeywords; foreach (string value2 in chineseModKeywords) { if (text.IndexOf(value2, StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf(value2, StringComparison.OrdinalIgnoreCase) >= 0) { return DisplayLanguage.中文; } } chineseModKeywords = _chineseEnvironmentPluginGuids; foreach (string b in chineseModKeywords) { if (string.Equals(text, b, StringComparison.OrdinalIgnoreCase)) { return DisplayLanguage.中文; } } } } catch { } return DisplayLanguage.English; } private ConfigEntry<T> BindI18N<T>(string sectEN, string sectCN, string keyEN, string keyCN, string descEN, string descCN, T defaultVal, AcceptableValueBase acceptableValues = null, int? order = null, string displayEN = null) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown CfgI18N cfgI18N = NewI18N(sectEN, sectCN, keyEN, keyCN, descEN, descCN, readOnly: false, order); cfgI18N.DisplayEN = displayEN; ApplyI18N(cfgI18N); return (ConfigEntry<T>)(object)(cfgI18N.Entry = (ConfigEntryBase)(object)((BaseUnityPlugin)this).Config.Bind<T>(sectEN, keyEN, defaultVal, new ConfigDescription(descEN, acceptableValues, new object[1] { cfgI18N.Attrs }))); } private void BindReadOnlyI18N(string sectEN, string sectCN, string keyEN, string keyCN, string valueEN, string valueCN, int? order = null, string displayEN = null) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown CfgI18N cfgI18N = NewI18N(sectEN, sectCN, keyEN, keyCN, "", "", readOnly: true, order); cfgI18N.ValueEN = valueEN; cfgI18N.ValueCN = valueCN; cfgI18N.DisplayEN = displayEN; ApplyI18N(cfgI18N); cfgI18N.ReadOnlyEntry = ((BaseUnityPlugin)this).Config.Bind<string>(sectEN, keyEN, valueEN, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { cfgI18N.Attrs })); cfgI18N.Entry = (ConfigEntryBase)(object)cfgI18N.ReadOnlyEntry; if (cfgI18N.ReadOnlyEntry.Value != valueEN) { cfgI18N.ReadOnlyEntry.Value = valueEN; } } private static CfgI18N NewI18N(string sectEN, string sectCN, string keyEN, string keyCN, string descEN, string descCN, bool readOnly, int? order = null) { ConfigurationManagerAttributes configurationManagerAttributes = (readOnly ? new ConfigurationManagerAttributes { ReadOnly = true, HideDefaultButton = true } : new ConfigurationManagerAttributes()); if (order.HasValue) { configurationManagerAttributes.Order = order.Value; } CfgI18N cfgI18N = new CfgI18N { SectionEN = sectEN, SectionCN = sectCN, KeyEN = keyEN, KeyCN = keyCN, DescEN = descEN, DescCN = descCN, Attrs = configurationManagerAttributes }; _cfgI18Ns.Add(cfgI18N); _cfgByEnSection[sectEN] = cfgI18N; _cfgByEnKey[sectEN + "\0" + keyEN] = cfgI18N; if (!_cfgByKeyOnly.TryGetValue(keyEN, out var value)) { value = new List<CfgI18N>(2); _cfgByKeyOnly[keyEN] = value; } value.Add(cfgI18N); string text = FixNamingForLookup(keyEN); if (!string.Equals(text, keyEN, StringComparison.Ordinal)) { if (!_cfgByKeyOnly.TryGetValue(text, out var value2)) { value2 = new List<CfgI18N>(2); _cfgByKeyOnly[text] = value2; } if (!value2.Contains(cfgI18N)) { value2.Add(cfgI18N); } } return cfgI18N; } private static void ApplyI18N(CfgI18N i18n) { if (i18n == null || i18n.Attrs == null) { return; } i18n.Attrs.Category = i18n.SectionEN; bool flag = UseChinese(); i18n.Attrs.DispName = (flag ? i18n.KeyCN : (i18n.DisplayEN ?? i18n.KeyEN)); i18n.Attrs.Description = (flag ? i18n.DescCN : i18n.DescEN); if (i18n.ReadOnlyEntry != null) { string text = (flag ? i18n.ValueCN : i18n.ValueEN); if (i18n.ReadOnlyEntry.Value != text) { i18n.ReadOnlyEntry.Value = text; } } } private static void RefreshAllI18N() { for (int i = 0; i < _cfgI18Ns.Count; i++) { ApplyI18N(_cfgI18Ns[i]); } RefreshLiveLabels(); } private static string FixNamingForLookup(string input) { if (string.IsNullOrEmpty(input)) { return input; } input = Regex.Replace(input, "([a-z])([A-Z])", "$1 $2"); input = Regex.Replace(input, "([A-Z])([A-Z][a-z])", "$1 $2"); input = Regex.Replace(input, "\\s+", " "); input = Regex.Replace(input, "([A-Z]\\.)\\s([A-Z]\\.)", "$1$2"); return input.Trim(); } private void ResetConfigIfVersionChanged() { try { string configFilePath = ((BaseUnityPlugin)this).Config.ConfigFilePath; if (File.Exists(configFilePath)) { string text = ReadConfigPluginVersion(configFilePath); if (!(text == "1.0.0")) { ((BaseUnityPlugin)this).Config.Clear(); File.Delete(configFilePath); ((BaseUnityPlugin)this).Config.Reload(); ((BaseUnityPlugin)this).Logger.LogWarning((object)(string.IsNullOrWhiteSpace(text) ? "Old config without Mod Version, reset to defaults." : ("Config version " + text + " -> 1.0.0, reset to defaults."))); } } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Reset config failed: " + ex.Message)); } } private static string ReadConfigPluginVersion(string configPath) { if (!File.Exists(configPath)) { return null; } string input = File.ReadAllText(configPath); Match match = Regex.Match(input, "(?m)^GameToolsModVersion\\s*=\\s*(.+?)\\s*$"); if (!match.Success) { match = Regex.Match(input, "(?m)^Mod Version\\s*=\\s*(.+?)\\s*$"); } if (!match.Success) { match = Regex.Match(input, "(?m)^模组版本号\\s*=\\s*(.+?)\\s*$"); } if (!match.Success) { return null; } return match.Groups[1].Value.Trim(); } private void DetachFromManager() { ((Component)this).gameObject.transform.parent = null; ((Object)((Component)this).gameObject).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); } private void OnDestroy() { SetWindowOpen(open: false); RestoreRealUpgrades(); try { SceneManager.sceneLoaded -= OnSceneLoaded; } catch { } try { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } catch { } } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (_cfgResetMonsterDataOnLevelLoad != null && _cfgResetMonsterDataOnLevelLoad.Value) { ResetGlobalMonsterData(); } } public static void ResetGlobalMonsterData() { _globalOverrideInited = false; SaveRuntimeConfig(); } public static void LoadAllSpawnables(bool force) { //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Invalid comparison between Unknown and I4 //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Invalid comparison between Unknown and I4 //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Invalid comparison between Unknown and I4 //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Invalid comparison between Unknown and I4 //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Invalid comparison between Unknown and I4 //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Invalid comparison between Unknown and I4 //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Invalid comparison between Unknown and I4 //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Invalid comparison between Unknown and I4 if (_spawnablesLoaded && !force) { return; } _spawnablesEnemies.Clear(); if ((Object)(object)EnemyDirector.instance != (Object)null) { IEnumerable<EnemySetup> enemiesDifficulty = EnemyDirector.instance.enemiesDifficulty1; IEnumerable<EnemySetup> first = enemiesDifficulty ?? Enumerable.Empty<EnemySetup>(); enemiesDifficulty = EnemyDirector.instance.enemiesDifficulty2; IEnumerable<EnemySetup> first2 = first.Concat(enemiesDifficulty ?? Enumerable.Empty<EnemySetup>()); enemiesDifficulty = EnemyDirector.instance.enemiesDifficulty3; IEnumerable<EnemySetup> enumerable = first2.Concat(enemiesDifficulty ?? Enumerable.Empty<EnemySetup>()); HashSet<string> hashSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase); foreach (EnemySetup item in enumerable) { if ((Object)(object)item == (Object)null || string.IsNullOrEmpty(((Object)item).name) || hashSet.Contains(((Object)item).name)) { continue; } hashSet.Add(((Object)item).name); int num = -1; if (item.spawnObjects != null) { foreach (PrefabRef spawnObject in item.spawnObjects) { if (spawnObject != null && (Object)(object)((PrefabRef<GameObject>)(object)spawnObject).Prefab != (Object)null) { EnemyHealth componentInChildren = ((PrefabRef<GameObject>)(object)spawnObject).Prefab.GetComponentInChildren<EnemyHealth>(); if ((Object)(object)componentInChildren != (Object)null) { num = componentInChildren.health; break; } } } } string extraInfo = ((num > 0) ? $"(HP: {num})" : ""); string name = ((Object)item).name.Replace("Enemy - ", "").Replace("Enemy ", ""); _spawnablesEnemies.Add(new SpawnableInfo { Name = name, InternalName = ((Object)item).name, Type = SpawnType.Enemy, Source = item, ExtraInfo = extraInfo }); } } _spawnablesMelee.Clear(); _spawnablesRanged.Clear(); _spawnablesOtherWeapons.Clear(); _spawnablesCarts.Clear(); _spawnablesVehicles.Clear(); _spawnablesPotions.Clear(); if ((Object)(object)StatsManager.instance != (Object)null && StatsManager.instance.itemDictionary != null) { foreach (Item value in StatsManager.instance.itemDictionary.Values) { if ((Object)(object)value == (Object)null || value.prefab == null || string.IsNullOrEmpty(value.itemName)) { continue; } if (value.itemName.IndexOf("Upgrade", StringComparison.OrdinalIgnoreCase) >= 0) { int num2 = -1; int num3 = -1; if ((Object)(object)value.value != (Object)null) { num2 = Mathf.RoundToInt(value.value.valueMin); num3 = Mathf.RoundToInt(value.value.valueMax); } string extraInfo2 = ""; if (num2 > 0) { extraInfo2 = ((num2 == num3) ? $"(${num2})" : $"(${num2}-{num3})"); } _spawnablesPotions.Add(new SpawnableInfo { Name = value.itemName, InternalName = value.itemName, Type = SpawnType.Valuable, Source = value, ExtraInfo = extraInfo2 }); continue; } bool num4 = (int)value.itemType == 7; bool flag = (int)value.itemType == 9 || (int)value.itemType == 15; bool flag2 = (int)value.itemType == 6 || (int)value.itemType == 11; bool flag3 = (int)value.itemType == 2 || (int)value.itemType == 12; bool flag4 = (int)value.itemType == 14; int num5 = -1; int num6 = -1; if ((Object)(object)value.value != (Object)null) { num5 = Mathf.RoundToInt(value.value.valueMin); num6 = Mathf.RoundToInt(value.value.valueMax); } string extraInfo3 = ""; if (num5 > 0) { extraInfo3 = ((num5 == num6) ? $"(${num5})" : $"(${num5}-{num6})"); } if (num4) { _spawnablesMelee.Add(new SpawnableInfo { Name = value.itemName, InternalName = value.itemName, Type = SpawnType.Weapon, Source = value, ExtraInfo = extraInfo3 }); } else if (flag) { _spawnablesRanged.Add(new SpawnableInfo { Name = value.itemName, InternalName = value.itemName, Type = SpawnType.Weapon, Source = value, ExtraInfo = extraInfo3 }); } else if (flag2) { _spawnablesOtherWeapons.Add(new SpawnableInfo { Name = value.itemName, InternalName = value.itemName, Type = SpawnType.Weapon, Source = value, ExtraInfo = extraInfo3 }); } else if (flag3) { _spawnablesCarts.Add(new SpawnableInfo { Name = value.itemName, InternalName = value.itemName, Type = SpawnType.Cart, Source = value, ExtraInfo = extraInfo3 }); } else if (flag4) { _spawnablesVehicles.Add(new SpawnableInfo { Name = value.itemName, InternalName = value.itemName, Type = SpawnType.Vehicle, Source = value, ExtraInfo = extraInfo3 }); } } } _spawnablesValuables.Clear(); if ((Object)(object)RunManager.instance != (Object)null && RunManager.instance.levels != null) { HashSet<string> hashSet2 = new HashSet<string>(StringComparer.OrdinalIgnoreCase); foreach (Level level in RunManager.instance.levels) { if ((Object)(object)level == (Object)null || level.ValuablePresets == null) { continue; } foreach (LevelValuables valuablePreset in level.ValuablePresets) { if ((Object)(object)valuablePreset == (Object)null) { continue; } IEnumerable<PrefabRef> tiny = valuablePreset.tiny; IEnumerable<PrefabRef> first3 = tiny ?? Enumerable.Empty<PrefabRef>(); tiny = valuablePreset.small; IEnumerable<PrefabRef> first4 = first3.Concat(tiny ?? Enumerable.Empty<PrefabRef>()); tiny = valuablePreset.medium; IEnumerable<PrefabRef> first5 = first4.Concat(tiny ?? Enumerable.Empty<PrefabRef>()); tiny = valuablePreset.big; IEnumerable<PrefabRef> first6 = first5.Concat(tiny ?? Enumerable.Empty<PrefabRef>()); tiny = valuablePreset.wide; IEnumerable<PrefabRef> first7 = first6.Concat(tiny ?? Enumerable.Empty<PrefabRef>()); tiny = valuablePreset.tall; IEnumerable<PrefabRef> first8 = first7.Concat(tiny ?? Enumerable.Empty<PrefabRef>()); tiny = valuablePreset.veryTall; foreach (PrefabRef item2 in first8.Concat(tiny ?? Enumerable.Empty<PrefabRef>())) { if (item2 == null || !((PrefabRef<GameObject>)(object)item2).IsValid() || string.IsNullOrEmpty(((PrefabRef<GameObject>)(object)item2).PrefabName) || hashSet2.Contains(((PrefabRef<GameObject>)(object)item2).PrefabName)) { continue; } hashSet2.Add(((PrefabRef<GameObject>)(object)item2).PrefabName); int num7 = -1; int num8 = -1; if ((Object)(object)((PrefabRef<GameObject>)(object)item2).Prefab != (Object)null) { ValuableObject component = ((PrefabRef<GameObject>)(object)item2).Prefab.GetComponent<ValuableObject>(); if ((Object)(object)component != (Object)null && (Object)(object)component.valuePreset != (Object)null) { num7 = Mathf.RoundToInt(component.valuePreset.valueMin); num8 = Mathf.RoundToInt(component.valuePreset.valueMax); } } string extraInfo4 = ""; if (num7 > 0) { extraInfo4 = ((num7 == num8) ? $"(${num7})" : $"(${num7}-{num8})"); } string name2 = ((PrefabRef<GameObject>)(object)item2).PrefabName.Replace("Valuable ", "").Replace("valuable ", ""); if (((PrefabRef<GameObject>)(object)item2).PrefabName.IndexOf("Upgrade", StringComparison.OrdinalIgnoreCase) >= 0) { _spawnablesPotions.Add(new SpawnableInfo { Name = name2, InternalName = ((PrefabRef<GameObject>)(object)item2).PrefabName, Type = SpawnType.Valuable, Source = item2, ExtraInfo = extraInfo4 }); } else { _spawnablesValuables.Add(new SpawnableInfo { Name = name2, InternalName = ((PrefabRef<GameObject>)(object)item2).PrefabName, Type = SpawnType.Valuable, Source = item2, ExtraInfo = extraInfo4 }); } } } } } List<SpawnableInfo> list = new List<SpawnableInfo>(); for (int num9 = _spawnablesValuables.Count - 1; num9 >= 0; num9--) { SpawnableInfo spawnableInfo = _spawnablesValuables[num9]; if (spawnableInfo.Name.IndexOf("Valuable Small", StringComparison.OrdinalIgnoreCase) >= 0 || spawnableInfo.Name.IndexOf("Valuable Medium", StringComparison.OrdinalIgnoreCase) >= 0 || spawnableInfo.Name.IndexOf("Valuable Large", StringComparison.OrdinalIgnoreCase) >= 0 || spawnableInfo.Name.IndexOf("Valuable Big", StringComparison.OrdinalIgnoreCase) >= 0 || spawnableInfo.Name.IndexOf("Enemy Valuable", StringComparison.OrdinalIgnoreCase) >= 0 || string.Equals(spawnableInfo.Name, "Small", StringComparison.OrdinalIgnoreCase) || string.Equals(spawnableInfo.Name, "Medium", StringComparison.OrdinalIgnoreCase) || string.Equals(spawnableInfo.Name, "Big", StringComparison.OrdinalIgnoreCase) || string.Equals(spawnableInfo.Name, "Large", StringComparison.OrdinalIgnoreCase)) { list.Add(spawnableInfo); _spawnablesValuables.RemoveAt(num9); } } list.Sort(delegate(SpawnableInfo x, SpawnableInfo y) { int rollingBallScore = GetRollingBallScore(x.Name); int rollingBallScore2 = GetRollingBallScore(y.Name); return rollingBallScore.CompareTo(rollingBallScore2); }); _spawnablesValuables.InsertRange(0, list); if (_spawnablesEnemies.Count > 0 || _spawnablesMelee.Count > 0 || _spawnablesRanged.Count > 0 || _spawnablesOtherWeapons.Count > 0 || _spawnablesValuables.Count > 0 || _spawnablesCarts.Count > 0 || _spawnablesVehicles.Count > 0 || _spawnablesPotions.Count > 0) { _spawnablesLoaded = true; } } private static int GetRollingBallScore(string name) { if (name.IndexOf("Small", StringComparison.OrdinalIgnoreCase) >= 0) { return 1; } if (name.IndexOf("Medium", StringComparison.OrdinalIgnoreCase) >= 0) { return 2; } if (name.IndexOf("Large", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("Big", StringComparison.OrdinalIgnoreCase) >= 0) { return 3; } return 4; } public void ResetGlobalSettings() { if (_cfgModEnabled != null) { _cfgModEnabled.Value = true; } if (_openKey != null) { _openKey.Value = "F4"; } ((BaseUnityPlugin)this).Config.Save(); RebindOpenKey(); } public void ResetVisualSettings() { if (_cfgWingsAlwaysShow != null) { _cfgWingsAlwaysShow.Value = false; } if (_cfgRainbowWings != null) { _cfgRainbowWings.Value = false; } if (_cfgTumbleFlyEnabled != null) { _cfgTumbleFlyEnabled.Value = false; } if (_cfgReverseInput != null) { _cfgReverseInput.Value = false; } if (_cfgReverseLegs != null) { _cfgReverseLegs.Value = false; } if (_cfgJumpMultiplierEnabled != null) { _cfgJumpMultiplierEnabled.Value = false; } if (_cfgJumpMultiplier != null) { _cfgJumpMultiplier.Value = 1.5f; } if (_cfgSpawnRateMultiplier != null) { _cfgSpawnRateMultiplier.Value = 1f; } if (_cfgInfiniteWeaponBattery != null) { _cfgInfiniteWeaponBattery.Value = false; } SaveRuntimeConfig(); } public void ResetMonsterData() { _globalDespawnMin = _originalDespawnMin; _globalDespawnMax = _originalDespawnMax; _globalSpawnMin = _originalSpawnMin; _globalSpawnMax = _originalSpawnMax; _globalOverrideInited = true; if (_cfgSpawnRateMultiplier != null) { _cfgSpawnRateMultiplier.Value = 1f; } if (_cfgResetMonsterDataOnLevelLoad != null) { _cfgResetMonsterDataOnLevelLoad.Value = true; } if ((Object)(object)EnemyDirector.instance != (Object)null && EnemyDirector.instance.enemiesSpawned != null) { foreach (EnemyParent item in EnemyDirector.instance.enemiesSpawned) { if ((Object)(object)item != (Object)null) { item.DespawnedTimeMin = _globalDespawnMin; item.DespawnedTimeMax = _globalDespawnMax; item.SpawnedTimeMin = _globalSpawnMin; item.SpawnedTimeMax = _globalSpawnMax; } } } SaveRuntimeConfig(); } private IEnumerator SpawnCoroutine(SpawnableInfo info, int totalCount) { if (info == null) { yield break; } bool isMultiplayer = SemiFunc.IsMultiplayer(); for (int count = 0; count < totalCount; count++) { if ((Object)(object)PlayerController.instance == (Object)null) { break; } Vector3 val = ((Component)PlayerController.instance).transform.position + ((Component)PlayerController.instance).transform.forward * 2f + Vector3.up * 0.5f; Quaternion rotation = ((Component)PlayerController.instance).transform.rotation; try { if (info.Type == SpawnType.Enemy) { object source = info.Source; EnemySetup val2 = (EnemySetup)((source is EnemySetup) ? source : null); if ((Object)(object)val2 != (Object)null && val2.spawnObjects != null) { foreach (PrefabRef spawnObject in val2.spawnObjects) { if (spawnObject == null || !((PrefabRef<GameObject>)(object)spawnObject).IsValid()) { continue; } GameObject val3 = (isMultiplayer ? PhotonNetwork.InstantiateRoomObject(((PrefabRef<GameObject>)(object)spawnObject).ResourcePath, val, Quaternion.identity, (byte)0, (object[])null) : Object.Instantiate<GameObject>(((PrefabRef<GameObject>)(object)spawnObject).Prefab, val, Quaternion.identity)); if (!((Object)(object)val3 != (Object)null)) { continue; } val3.AddComponent<SpawnedByGameToolsHelper>(); EnemyParent component = val3.GetComponent<EnemyParent>(); if ((Object)(object)component != (Object)null) { EnemyParentSetupDoneRef.Invoke(component) = true; Enemy componentInChildren = val3.GetComponentInChildren<Enemy>(); if (componentInChildren != null) { componentInChildren.EnemyTeleported(val); } EnemyParentFirstSpawnPointUsedRef.Invoke(component) = true; } } } } else if (info.Type == SpawnType.Weapon || info.Type == SpawnType.Cart || info.Type == SpawnType.Vehicle) { object source2 = info.Source; Item val4 = (Item)((source2 is Item) ? source2 : null); if ((Object)(object)val4 != (Object)null && val4.prefab != null) { if (isMultiplayer) { PhotonNetwork.InstantiateRoomObject(((PrefabRef<GameObject>)(object)val4.prefab).ResourcePath, val, rotation, (byte)0, (object[])null); } else { Object.Instantiate<GameObject>(((PrefabRef<GameObject>)(object)val4.prefab).Prefab, val, rotation); } } } else if (info.Type == SpawnType.Valuable) { object source3 = info.Source; PrefabRef val5 = (PrefabRef)((source3 is PrefabRef) ? source3 : null); if (val5 != null && ((PrefabRef<GameObject>)(object)val5).IsValid()) { GameObject val6 = (isMultiplayer ? PhotonNetwork.InstantiateRoomObject(((PrefabRef<GameObject>)(object)val5).ResourcePath, val, rotation, (byte)0, (object[])null) : Object.Instantiate<GameObject>(((PrefabRef<GameObject>)(object)val5).Prefab, val, rotation)); if ((Object)(object)val6 != (Object)null) { ValuableObject component2 = val6.GetComponent<ValuableObject>(); if ((Object)(object)component2 != (Object)null) { component2.DollarValueSetLogic(); } } } } } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"[SpawnObject Coroutine Error]: Failed to spawn {info.Name} at index {count}. Exception: {arg}"); } if (count < totalCount - 1) { yield return (object)new WaitForSecondsRealtime(0.1f); } } } public static void SpawnObject(SpawnableInfo info) { if (info == null || (Object)(object)PlayerController.instance == (Object)null || (Object)(object)Instance == (Object)null) { return; } try { ((MonoBehaviour)Instance).StartCoroutine(Instance.SpawnCoroutine(info, _spawnCount)); } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogError((object)$"[SpawnObject StartCoroutine Error]: Failed to start spawn coroutine for {info.Name}. Exception: {arg}"); } } } internal static string KeybindNameToBindingPath(string name) { if (string.IsNullOrEmpty(name)) { return "<keyboard>/f4"; } if (name.Length == 1 && name[0] >= '0' && name[0] <= '9') { return "<keyboard>/" + name; } if (name.Length == 1 && char.IsLetter(name[0])) { return "<keyboard>/" + name.ToLowerInvariant(); } if (name.Length > 1 && name[0] == 'F' && int.TryParse(name.Substring(1), out var _)) { return "<keyboard>/" + name; } return name switch { "Space" => "<keyboard>/space", "Enter" => "<keyboard>/enter", "Tab" => "<keyboard>/tab", "LeftShift" => "<keyboard>/leftShift", "RightShift" => "<keyboard>/rightShift", "LeftControl" => "<keyboard>/leftCtrl", "RightControl" => "<keyboard>/rightCtrl", _ => "<keyboard>/" + char.ToLower(name[0]) + name.Substring(1), }; } internal static void RebindOpenKey() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Instance == (Object)null) && Instance._openKey != null && !((Object)(object)InputManager.instance == (Object)null)) { string value = Instance._openKey.Value; if (!(_lastAppliedOpenKey == value)) { _lastAppliedOpenKey = value; InputManager.instance.Rebind(OpenInputKey, KeybindNameToBindingPath(value)); } } } internal static void InputManagerInitializeInputsPostfix() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) Dictionary<InputKey, InputAction> value = Traverse.Create((object)InputManager.instance).Field<Dictionary<InputKey, InputAction>>("inputActions").Value; if (value != null && !value.ContainsKey(OpenInputKey)) { InputAction val = new InputAction("OpenGameTools", (InputActionType)0, KeybindNameToBindingPath(Instance?._openKey.Value ?? "F4"), (string)null, (string)null, (string)null); value.Add(OpenInputKey, val); val.Enable(); _lastAppliedOpenKey = Instance?._openKey.Value ?? "F4"; } } internal static void PlayerControllerStartPostfix() { RebindOpenKey(); } private bool IsOpenKeyPressed() { //IL_0251: 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_01c0: Expected O, but got Unknown //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Expected O, but got Unknown try { string text = _openKey?.Value ?? "F4"; Keyboard current = Keyboard.current; if (current != null) { KeyControl val = null; if (string.Equals(text, "F1", StringComparison.OrdinalIgnoreCase)) { val = current.f1Key; } else if (string.Equals(text, "F2", StringComparison.OrdinalIgnoreCase)) { val = current.f2Key; } else if (string.Equals(text, "F3", StringComparison.OrdinalIgnoreCase)) { val = current.f3Key; } else if (string.Equals(text, "F4", StringComparison.OrdinalIgnoreCase)) { val = current.f4Key; } else if (string.Equals(text, "F5", StringComparison.OrdinalIgnoreCase)) { val = current.f5Key; } else if (string.Equals(text, "F6", StringComparison.OrdinalIgnoreCase)) { val = current.f6Key; } else if (string.Equals(text, "F7", StringComparison.OrdinalIgnoreCase)) { val = current.f7Key; } else if (string.Equals(text, "F8", StringComparison.OrdinalIgnoreCase)) { val = current.f8Key; } else if (string.Equals(text, "F9", StringComparison.OrdinalIgnoreCase)) { val = current.f9Key; } else if (string.Equals(text, "F10", StringComparison.OrdinalIgnoreCase)) { val = current.f10Key; } else if (string.Equals(text, "F11", StringComparison.OrdinalIgnoreCase)) { val = current.f11Key; } else if (string.Equals(text, "F12", StringComparison.OrdinalIgnoreCase)) { val = current.f12Key; } else { string text2 = text; if (text2.Length == 1) { char c = char.ToLowerInvariant(text2[0]); if (c >= 'a' && c <= 'z') { PropertyInfo property = ((object)current).GetType().GetProperty(c + "Key"); if (property != null) { val = (KeyControl)property.GetValue(current); } } else if (c >= '0' && c <= '9') { PropertyInfo propertyInfo = ((object)current).GetType().GetProperty("numpad" + c + "Key") ?? ((object)current).GetType().GetProperty("digit" + c + "Key"); if (propertyInfo != null) { val = (KeyControl)propertyInfo.GetValue(current); } } } } if (val != null && ((ButtonControl)val).wasPressedThisFrame) { return true; } } } catch { } try { if ((Object)(object)InputManager.instance != (Object)null && SemiFunc.InputDown(OpenInputKey)) { return true; } } catch { } return false; } private void InitStyles() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Expected O, but got Unknown //IL_0174: Expected O, but got Unknown //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Expected O, but got Unknown //IL_01bc: 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) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Expected O, but got Unknown //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Expected O, but got Unknown //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Expected O, but got Unknown //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Expected O, but got Unknown //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Expected O, but got Unknown //IL_0340: Expected O, but got Unknown //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Expected O, but got Unknown //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Expected O, but got Unknown //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Expected O, but got Unknown //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Expected O, but got Unknown //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0487: 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_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04b9: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Expected O, but got Unknown if (!_stylesInit) { _stylesInit = true; _texDark = MakeTex(new Color(0.12f, 0.12f, 0.14f, 0.97f)); _texMid = MakeTex(new Color(0.18f, 0.18f, 0.22f, 0.95f)); _texLight = MakeTex(new Color(0.25f, 0.25f, 0.3f, 0.9f)); _texGreen = MakeTex(new Color(0.2f, 0.55f, 0.2f)); _texRed = MakeTex(new Color(0.6f, 0.2f, 0.2f)); _texSection = MakeTex(new Color(0.15f, 0.15f, 0.18f, 0.95f)); _texBorder = MakeTex(new Color(0.3f, 0.3f, 0.35f, 0.8f)); GUIStyle val = new GUIStyle(GUI.skin.window); val.normal.background = _texDark; val.normal.textColor = Color.white; val.onNormal.background = _texDark; val.onNormal.textColor = Color.white; val.fontSize = 22; val.padding = new RectOffset(16, 16, 36, 16); _sWindow = val; _sTitle = new GUIStyle(GUI.skin.label); _sTitle.fontSize = 20; _sTitle.fontStyle = (FontStyle)1; _sTitle.normal.textColor = new Color(0.95f, 0.85f, 0.6f); GUIStyle val2 = new GUIStyle(GUI.skin.label) { fontSize = 18 }; val2.normal.textColor = new Color(0.92f, 0.92f, 0.95f); _sLabel = val2; GUIStyle val3 = new GUIStyle(GUI.skin.label) { fontSize = 16 }; val3.normal.textColor = new Color(0.7f, 0.9f, 0.7f); _sStatus = val3; _sBtnGreen = MakeBtn(_texGreen, new Color(0.25f, 0.65f, 0.25f)); _sBtnRed = MakeBtn(_texRed, new Color(0.7f, 0.25f, 0.25f)); _sBtnNormal = MakeBtn(_texLight, new Color(0.32f, 0.32f, 0.4f)); _sBtnClose = new GUIStyle(_sBtnRed); _sBtnClose.fontSize = 20; _sBtnClose.fontStyle = (FontStyle)1; _sBtnClose.alignment = (TextAnchor)4; _sBtnClose.padding = new RectOffset(0, 0, 0, 0); GUIStyle val4 = new GUIStyle(GUI.skin.box); val4.normal.background = _texSection; val4.normal.textColor = Color.white; val4.padding = new RectOffset(10, 10, 10, 10); _sSection = val4; GUIStyle val5 = new GUIStyle(_sLabel); val5.normal.textColor = new Color(0.4f, 0.85f, 0.4f); _sToggleOn = val5; _sCheckmarkStyleWhite = new GUIStyle(GUI.skin.label); _sCheckmarkStyleWhite.fontSize = 18; _sCheckmarkStyleWhite.fontStyle = (FontStyle)1; _sCheckmarkStyleWhite.alignment = (TextAnchor)4; _sCheckmarkStyleWhite.normal.textColor = Color.white; GUIStyle val6 = new GUIStyle(GUI.skin.horizontalSlider) { fixedHeight = 8f }; val6.normal.background = _texSection; _sSlider = val6; GUIStyle val7 = new GUIStyle(GUI.skin.horizontalSliderThumb) { fixedWidth = 18f, fixedHeight = 18f }; val7.normal.background = _texGreen; _sThumb = val7; _sThumb.hover.background = MakeTex(new Color(0.25f, 0.65f, 0.25f)); _sThumb.active.background = MakeTex(Color.yellow); GUIStyle val8 = new GUIStyle(GUI.skin.textField) { fontSize = 18 }; val8.normal.background = _texSection; val8.normal.textColor = Color.white; val8.focused.background = _texLight; val8.focused.textColor = Color.white; _sTextInput = val8; } } private static GUIStyle MakeBtn(Texture2D bg, Color hover) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_008b: Expected O, but got Unknown Texture2D background = MakeTex(hover); GUIStyle val = new GUIStyle(GUI.skin.button) { fontSize = 18, fontStyle = (FontStyle)1 }; val.normal.background = bg; val.normal.textColor = Color.white; val.hover.background = background; val.hover.textColor = Color.white; val.active.background = background; val.active.textColor = Color.yellow; val.padding = new RectOffset(12, 12, 6, 6); return val; } private static Texture2D MakeTex(Color c) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); val.SetPixels((Color[])(object)new Color[4] { c, c, c, c }); val.Apply(); ((Object)val).hideFlags = (HideFlags)61; return val; } private void DrawCloseButton() { //IL_0034: 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_004f: Expected O, but got Unknown string text = (UseChinese() ? "关闭" : "Close"); if (GUI.Button(new Rect(((Rect)(ref _windowRect)).width - 46f, 4f, 42f, 34f), new GUIContent("✕", text), _sBtnClose)) { SetWindowOpen(open: false); } } private void DrawBorderRect(Rect rect, Texture2D tex) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_00a5: Unknown result type (might be due to invalid IL or missing references) GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, 1f), (Texture)(object)tex); GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y + ((Rect)(ref rect)).height - 1f, ((Rect)(ref rect)).width, 1f), (Texture)(object)tex); GUI.DrawTexture(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 1f, ((Rect)(ref rect)).height), (Texture)(object)tex); GUI.DrawTexture(new Rect(((Rect)(ref rect)).x + ((Rect)(ref rect)).width - 1f, ((Rect)(ref rect)).y, 1f, ((Rect)(ref rect)).height), (Texture)(object)tex); } private bool DrawStyledToggle(Rect rect, bool value, string text) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) float num = 22f; float num2 = ((Rect)(ref rect)).y + (((Rect)(ref rect)).height - num) * 0.5f; Rect val = default(Rect); ((Rect)(ref val))..ctor(((Rect)(ref rect)).x, num2, num, num); Rect val2 = new Rect(((Rect)(ref rect)).x + num + 8f, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width - num - 8f, ((Rect)(ref rect)).height); if (GUI.Button(rect, GUIContent.none, GUIStyle.none)) { value = !value; } if (value) { GUI.DrawTexture(val, (Texture)(object)_texGreen); GUI.Label(val, "✓", _sCheckmarkStyleWhite); } else { GUI.Box(val, "", _sSection); DrawBorderRect(val, _texBorder); } GUI.Label(val2, text, value ? _sToggleOn : _sLabel); return value; } private int DrawStyledSlider(Rect rect, int value, int min, int max, string label) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 180f, ((Rect)(ref rect)).height), label, _sLabel); int num = Mathf.RoundToInt(GUI.HorizontalSlider(new Rect(((Rect)(ref rect)).x + 190f, ((Rect)(ref rect)).y + 10f, ((Rect)(ref rect)).width - 290f, 20f), (float)value, (float)min, (float)max, _sSlider, _sThumb)); string text = (UseChinese() ? $"Class {num + 1}" : $"Class {num + 1}"); GUI.Label(new Rect(((Rect)(ref rect)).x + ((Rect)(ref rect)).width - 90f, ((Rect)(ref rect)).y, 80f, ((Rect)(ref rect)).height), text, _sToggleOn); return num; } private float DrawStyledSliderFloat(Rect rect, float value, float min, float max, string label) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 180f, ((Rect)(ref rect)).height), label, _sLabel); float num = GUI.HorizontalSlider(new Rect(((Rect)(ref rect)).x + 190f, ((Rect)(ref rect)).y + 10f, ((Rect)(ref rect)).width - 290f, 20f), value, min, max, _sSlider, _sThumb); num = Mathf.Round(num * 10f) / 10f; string text = $"{num:F1}x"; GUI.Label(new Rect(((Rect)(ref rect)).x + ((Rect)(ref rect)).width - 90f, ((Rect)(ref rect)).y, 80f, ((Rect)(ref rect)).height), text, _sToggleOn); return num; } private int DrawStyledSliderInt(Rect rect, int value, int min, int max, string label) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) GUI.Label(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 180f, ((Rect)(ref rect)).height), label, _sLabel); int num = Mathf.RoundToInt(GUI.HorizontalSlider(new Rect(((Rect)(ref rect)).x + 190f, ((Rect)(ref rect)).y + 10f, ((Rect)(ref rect)).width - 290f, 20f), (float)value, (float)min, (float)max, _sSlider, _sThumb)); string text = $"{num}x"; GUI.Label(new Rect(((Rect)(ref rect)).x + ((Rect)(ref rect)).width - 90f, ((Rect)(ref rect)).y, 80f, ((Rect)(ref rect)).height), text, _sToggleOn); return num; } private void OnGUI() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_009d: 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) if (_windowOpen) { GUI.enabled = true; InitStyles(); if (!_windowCentered) { ((Rect)(ref _windowRect)).x = ((float)Screen.width - ((Rect)(ref _windowRect)).width) * 0.5f; ((Rect)(ref _windowRect)).y = ((float)Screen.height - ((Rect)(ref _windowRect)).height) * 0.5f; _windowCentered = true; } string text = (UseChinese() ? "游戏工具箱" : "✦ GameTools"); _windowRect = GUI.Window(33002, _windowRect, new WindowFunction(DrawWindow), text, _sWindow); } } private void DrawWindow(int id) { //IL_2209: Unknown result type (might be due to invalid IL or missing references) //IL_230f: Unknown result type (might be due to invalid IL or missing references) //IL_2366: Unknown result type (might be due to invalid IL or missing references) //IL_23a9: 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_0209: Unknown result type (might be due to invalid IL or missing references) //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_101d: Unknown result type (might be due to invalid IL or missing references) //IL_1047: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_2847: Unknown result type (might be due to invalid IL or missing references) //IL_15dc: Unknown result type (might be due to invalid IL or missing references) //IL_06e9: Unknown result type (might be due to invalid IL or missing references) //IL_1084: Unknown result type (might be due to invalid IL or missing references) //IL_16ae: Unknown result type (might