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 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("overridePlayerAimDisableTimer").Invoke(__instance) = 0f; AccessTools.FieldRefAccess("overrideAimStopTimer").Invoke(__instance) = 0f; AccessTools.FieldRefAccess("overrideAimStop").Invoke(__instance) = false; if ((Object)(object)InputManager.instance != (Object)null) { AccessTools.FieldRefAccess("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)(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("aimInvertVertical").Invoke(GameplayManager.instance)) { num4 *= -1f; } ref float reference = ref AccessTools.FieldRefAccess("aimHorizontal").Invoke(__instance); ref float reference2 = ref AccessTools.FieldRefAccess("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)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)__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() == (Object)null) { ((Component)__instance).gameObject.AddComponent(); } } 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("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(); } 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() != (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 Tmp; public CfgI18N I18N; public bool IsSection; } internal sealed class LiveValue { public WeakReference InputField; public CfgI18N I18N; } internal sealed class LiveSliderOptions { public WeakReference Slider; public CfgI18N I18N; public string[] OptionsCN; public string[] OptionsEN; } internal sealed class LiveToggleButtons { public WeakReference LeftTmp; public WeakReference 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 PlayerSteamIDRef = AccessTools.FieldRefAccess("playerSteamID"); internal static readonly FieldRef PlayerAvatarSteamIDRef = AccessTools.FieldRefAccess("steamID"); internal static readonly FieldRef PlayerAvatarIsLocalRef = AccessTools.FieldRefAccess("isLocal"); internal static readonly FieldRef PlayerAvatarPlayerNameRef = AccessTools.FieldRefAccess("playerName"); internal static readonly FieldRef PlayerAvatarDeadSetRef = AccessTools.FieldRefAccess("deadSet"); internal static readonly FieldRef PlayerAvatarTumbleRef = AccessTools.FieldRefAccess("tumble"); internal static readonly FieldRef PlayerAvatarUpgradeTumbleWingsRef = AccessTools.FieldRefAccess("upgradeTumbleWings"); internal static readonly FieldRef PlayerAvatarUpgradeTumbleWingsVisualsActiveRef = AccessTools.FieldRefAccess("upgradeTumbleWingsVisualsActive"); internal static readonly FieldRef Wing1MeshRendererRef = AccessTools.FieldRefAccess("wing1MeshRenderer"); internal static readonly FieldRef Wing2MeshRendererRef = AccessTools.FieldRefAccess("wing2MeshRenderer"); internal static readonly FieldRef WingsPlayerTumbleRef = AccessTools.FieldRefAccess("playerTumble"); internal static readonly FieldRef TumbleWingTimerRef = AccessTools.FieldRefAccess("tumbleWingTimer"); internal static readonly FieldRef PlayerTumblePhysGrabObjectRef = AccessTools.FieldRefAccess("physGrabObject"); internal static readonly FieldRef PlayerTumbleIsTumblingRef = AccessTools.FieldRefAccess("isTumbling"); internal static readonly FieldRef EnemyParentSetupDoneRef = AccessTools.FieldRefAccess("SetupDone"); internal static readonly FieldRef EnemyParentFirstSpawnPointUsedRef = AccessTools.FieldRefAccess("firstSpawnPointUsed"); internal static readonly FieldRef EnemyDirectorSpawnIdlePauseTimerRef = AccessTools.FieldRefAccess("spawnIdlePauseTimer"); internal static readonly FieldRef EnemyParentSpawnedRef = AccessTools.FieldRefAccess("Spawned"); internal static readonly FieldRef EnemyParentPlayerCloseRef = AccessTools.FieldRefAccess("playerClose"); internal static readonly FieldRef EnemyParentEnemyRef = AccessTools.FieldRefAccess("Enemy"); internal static readonly FieldRef EnemyHealthRef = AccessTools.FieldRefAccess("Health"); internal static readonly FieldRef EnemyHealthCurrentRef = AccessTools.FieldRefAccess("healthCurrent"); internal static readonly FieldRef CursorManagerUnlockTimerRef = AccessTools.FieldRefAccess("unlockTimer"); internal static readonly FieldRef EnemyDirectorAmountCurve1ValueRef = AccessTools.FieldRefAccess("amountCurve1Value"); internal static readonly FieldRef EnemyDirectorAmountCurve2ValueRef = AccessTools.FieldRefAccess("amountCurve2Value"); internal static readonly FieldRef EnemyDirectorAmountCurve3ValueRef = AccessTools.FieldRefAccess("amountCurve3Value"); internal static readonly FieldRef EnemyDirectorTotalAmountRef = AccessTools.FieldRefAccess("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 _cfgModEnabled; private static ConfigEntry _cfgLanguage; private ConfigEntry _openKey; private static ConfigEntry _cfgWingsAlwaysShow; private static ConfigEntry _cfgReverseInput; private static ConfigEntry _cfgReverseLegs; private static ConfigEntry _cfgRainbowWings; private static ConfigEntry _cfgJumpMultiplierEnabled; private static ConfigEntry _cfgJumpMultiplier; private static ConfigEntry _cfgTumbleFlyEnabled; private static ConfigEntry _cfgInfiniteWeaponBattery; private static ConfigEntry _cfgSpawnRateMultiplier; internal static ConfigEntry _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 _cfgByEnSection = new Dictionary(StringComparer.Ordinal); internal static readonly Dictionary _cfgByEnKey = new Dictionary(StringComparer.Ordinal); internal static readonly Dictionary> _cfgByKeyOnly = new Dictionary>(StringComparer.Ordinal); private static readonly List _cfgI18Ns = new List(20); private static readonly Dictionary _chineseNames = new Dictionary(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 _spawnablesValuables = new List(); private static List _spawnablesMelee = new List(); private static List _spawnablesRanged = new List(); private static List _spawnablesOtherWeapons = new List(); private static List _spawnablesEnemies = new List(); private static List _spawnablesCarts = new List(); private static List _spawnablesVehicles = new List(); private static List _spawnablesPotions = new List(); 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 _originalWingsLevel = new Dictionary(); private static readonly List _liveLabels = new List(32); private static readonly List _liveValues = new List(4); private static readonly List _liveSliderOptions = new List(4); private static readonly List _liveToggleButtons = new List(8); private static readonly Dictionary _labelTmpFieldCache = new Dictionary(8); private static readonly Dictionary _sliderStringOptionsPropCache = new Dictionary(4); private static readonly Dictionary _toggleLeftTmpCache = new Dictionary(4); private static readonly Dictionary _toggleRightTmpCache = new Dictionary(4); private static readonly Dictionary _pendingKeyMatchIndex = new Dictionary(StringComparer.Ordinal); internal static string _currentRenderingConfigFilePath; internal static bool _createModEntriesPatchInstalled; private static readonly Dictionary _inputStringSystemFieldCache = new Dictionary(4); private static readonly Dictionary _inputStringSystemSetValueCache = new Dictionary(4); private static readonly Dictionary _enumNameCNtoEN = new Dictionary(StringComparer.Ordinal) { ["中文"] = "Chinese" }; private static readonly Dictionary _enumNameENtoCN = new Dictionary(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 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(AvailableKeybinds)); _runtimeConfig = new ConfigFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Config.ConfigFilePath), "zichen.gametoolsruntime.cfg"), false); _cfgWingsAlwaysShow = _runtimeConfig.Bind("Runtime", "WingsAlwaysShow", false, "Wings Always Show"); _cfgReverseInput = _runtimeConfig.Bind("Runtime", "ReverseInput", false, "Reverse Input"); _cfgReverseLegs = _runtimeConfig.Bind("Runtime", "ReverseLegs", false, "Reverse Legs"); _cfgRainbowWings = _runtimeConfig.Bind("Runtime", "RainbowWings", false, "Rainbow Wings"); _cfgJumpMultiplierEnabled = _runtimeConfig.Bind("Runtime", "JumpMultiplierEnabled", false, "Super Jump Enabled"); _cfgJumpMultiplier = _runtimeConfig.Bind("Runtime", "JumpMultiplier", 1.5f, "Jump Force Multiplier"); _cfgTumbleFlyEnabled = _runtimeConfig.Bind("Runtime", "TumbleFlyEnabled", false, "Tumble Fly Enabled"); _cfgInfiniteWeaponBattery = _runtimeConfig.Bind("Runtime", "InfiniteWeaponBattery", false, "Infinite Weapon Battery"); _cfgSpawnRateMultiplier = _runtimeConfig.Bind("Runtime", "SpawnRateMultiplier", 1f, "Spawn Rate Multiplier"); _cfgResetMonsterDataOnLevelLoad = _runtimeConfig.Bind("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 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 BindI18N(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)(object)(cfgI18N.Entry = (ConfigEntryBase)(object)((BaseUnityPlugin)this).Config.Bind(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(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(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(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 enemiesDifficulty = EnemyDirector.instance.enemiesDifficulty1; IEnumerable first = enemiesDifficulty ?? Enumerable.Empty(); enemiesDifficulty = EnemyDirector.instance.enemiesDifficulty2; IEnumerable first2 = first.Concat(enemiesDifficulty ?? Enumerable.Empty()); enemiesDifficulty = EnemyDirector.instance.enemiesDifficulty3; IEnumerable enumerable = first2.Concat(enemiesDifficulty ?? Enumerable.Empty()); HashSet hashSet = new HashSet(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)(object)spawnObject).Prefab != (Object)null) { EnemyHealth componentInChildren = ((PrefabRef)(object)spawnObject).Prefab.GetComponentInChildren(); 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 hashSet2 = new HashSet(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 tiny = valuablePreset.tiny; IEnumerable first3 = tiny ?? Enumerable.Empty(); tiny = valuablePreset.small; IEnumerable first4 = first3.Concat(tiny ?? Enumerable.Empty()); tiny = valuablePreset.medium; IEnumerable first5 = first4.Concat(tiny ?? Enumerable.Empty()); tiny = valuablePreset.big; IEnumerable first6 = first5.Concat(tiny ?? Enumerable.Empty()); tiny = valuablePreset.wide; IEnumerable first7 = first6.Concat(tiny ?? Enumerable.Empty()); tiny = valuablePreset.tall; IEnumerable first8 = first7.Concat(tiny ?? Enumerable.Empty()); tiny = valuablePreset.veryTall; foreach (PrefabRef item2 in first8.Concat(tiny ?? Enumerable.Empty())) { if (item2 == null || !((PrefabRef)(object)item2).IsValid() || string.IsNullOrEmpty(((PrefabRef)(object)item2).PrefabName) || hashSet2.Contains(((PrefabRef)(object)item2).PrefabName)) { continue; } hashSet2.Add(((PrefabRef)(object)item2).PrefabName); int num7 = -1; int num8 = -1; if ((Object)(object)((PrefabRef)(object)item2).Prefab != (Object)null) { ValuableObject component = ((PrefabRef)(object)item2).Prefab.GetComponent(); 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)(object)item2).PrefabName.Replace("Valuable ", "").Replace("valuable ", ""); if (((PrefabRef)(object)item2).PrefabName.IndexOf("Upgrade", StringComparison.OrdinalIgnoreCase) >= 0) { _spawnablesPotions.Add(new SpawnableInfo { Name = name2, InternalName = ((PrefabRef)(object)item2).PrefabName, Type = SpawnType.Valuable, Source = item2, ExtraInfo = extraInfo4 }); } else { _spawnablesValuables.Add(new SpawnableInfo { Name = name2, InternalName = ((PrefabRef)(object)item2).PrefabName, Type = SpawnType.Valuable, Source = item2, ExtraInfo = extraInfo4 }); } } } } } List list = new List(); 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)(object)spawnObject).IsValid()) { continue; } GameObject val3 = (isMultiplayer ? PhotonNetwork.InstantiateRoomObject(((PrefabRef)(object)spawnObject).ResourcePath, val, Quaternion.identity, (byte)0, (object[])null) : Object.Instantiate(((PrefabRef)(object)spawnObject).Prefab, val, Quaternion.identity)); if (!((Object)(object)val3 != (Object)null)) { continue; } val3.AddComponent(); EnemyParent component = val3.GetComponent(); if ((Object)(object)component != (Object)null) { EnemyParentSetupDoneRef.Invoke(component) = true; Enemy componentInChildren = val3.GetComponentInChildren(); 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)(object)val4.prefab).ResourcePath, val, rotation, (byte)0, (object[])null); } else { Object.Instantiate(((PrefabRef)(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)(object)val5).IsValid()) { GameObject val6 = (isMultiplayer ? PhotonNetwork.InstantiateRoomObject(((PrefabRef)(object)val5).ResourcePath, val, rotation, (byte)0, (object[])null) : Object.Instantiate(((PrefabRef)(object)val5).Prefab, val, rotation)); if ((Object)(object)val6 != (Object)null) { ValuableObject component2 = val6.GetComponent(); 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 "/f4"; } if (name.Length == 1 && name[0] >= '0' && name[0] <= '9') { return "/" + name; } if (name.Length == 1 && char.IsLetter(name[0])) { return "/" + name.ToLowerInvariant(); } if (name.Length > 1 && name[0] == 'F' && int.TryParse(name.Substring(1), out var _)) { return "/" + name; } return name switch { "Space" => "/space", "Enter" => "/enter", "Tab" => "/tab", "LeftShift" => "/leftShift", "RightShift" => "/rightShift", "LeftControl" => "/leftCtrl", "RightControl" => "/rightCtrl", _ => "/" + 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 value = Traverse.Create((object)InputManager.instance).Field>("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 be due to invalid IL or missing references) //IL_173e: Unknown result type (might be due to invalid IL or missing references) //IL_17f7: Unknown result type (might be due to invalid IL or missing references) //IL_1842: Unknown result type (might be due to invalid IL or missing references) //IL_18e0: Unknown result type (might be due to invalid IL or missing references) //IL_2345: Unknown result type (might be due to invalid IL or missing references) //IL_2781: Unknown result type (might be due to invalid IL or missing references) //IL_2794: Unknown result type (might be due to invalid IL or missing references) //IL_112e: Unknown result type (might be due to invalid IL or missing references) //IL_116a: Unknown result type (might be due to invalid IL or missing references) //IL_1660: Unknown result type (might be due to invalid IL or missing references) //IL_2255: Unknown result type (might be due to invalid IL or missing references) //IL_225a: Unknown result type (might be due to invalid IL or missing references) //IL_2264: Unknown result type (might be due to invalid IL or missing references) //IL_2269: Unknown result type (might be due to invalid IL or missing references) //IL_226e: Unknown result type (might be due to invalid IL or missing references) //IL_196d: Unknown result type (might be due to invalid IL or missing references) //IL_11a7: Unknown result type (might be due to invalid IL or missing references) //IL_1776: Unknown result type (might be due to invalid IL or missing references) //IL_1785: Unknown result type (might be due to invalid IL or missing references) //IL_178f: Unknown result type (might be due to invalid IL or missing references) //IL_1794: Unknown result type (might be due to invalid IL or missing references) //IL_1799: Unknown result type (might be due to invalid IL or missing references) //IL_17a3: Unknown result type (might be due to invalid IL or missing references) //IL_17a8: Unknown result type (might be due to invalid IL or missing references) //IL_17ad: Unknown result type (might be due to invalid IL or missing references) //IL_27e3: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_1267: Unknown result type (might be due to invalid IL or missing references) //IL_12a3: Unknown result type (might be due to invalid IL or missing references) //IL_22f1: Unknown result type (might be due to invalid IL or missing references) //IL_1b3e: Unknown result type (might be due to invalid IL or missing references) //IL_1b51: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0245: 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_0578: Unknown result type (might be due to invalid IL or missing references) //IL_12e0: Unknown result type (might be due to invalid IL or missing references) //IL_1a0c: Unknown result type (might be due to invalid IL or missing references) //IL_22db: Unknown result type (might be due to invalid IL or missing references) //IL_22dd: Unknown result type (might be due to invalid IL or missing references) //IL_05c5: Unknown result type (might be due to invalid IL or missing references) //IL_05d8: Unknown result type (might be due to invalid IL or missing references) //IL_05fa: Unknown result type (might be due to invalid IL or missing references) //IL_138a: Unknown result type (might be due to invalid IL or missing references) //IL_13c6: Unknown result type (might be due to invalid IL or missing references) //IL_1a61: Unknown result type (might be due to invalid IL or missing references) //IL_1a74: Unknown result type (might be due to invalid IL or missing references) //IL_1a92: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_240f: Unknown result type (might be due to invalid IL or missing references) //IL_2448: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_1403: Unknown result type (might be due to invalid IL or missing references) //IL_14c3: Unknown result type (might be due to invalid IL or missing references) //IL_24a1: Unknown result type (might be due to invalid IL or missing references) //IL_07a5: Unknown result type (might be due to invalid IL or missing references) //IL_24cc: Unknown result type (might be due to invalid IL or missing references) //IL_24b4: Unknown result type (might be due to invalid IL or missing references) //IL_07db: Unknown result type (might be due to invalid IL or missing references) //IL_07ee: Unknown result type (might be due to invalid IL or missing references) //IL_0811: Unknown result type (might be due to invalid IL or missing references) //IL_24fa: Unknown result type (might be due to invalid IL or missing references) //IL_0ca9: Unknown result type (might be due to invalid IL or missing references) //IL_0cbc: Unknown result type (might be due to invalid IL or missing references) //IL_0cde: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_0678: Unknown result type (might be due to invalid IL or missing references) //IL_1531: Unknown result type (might be due to invalid IL or missing references) //IL_2537: Unknown result type (might be due to invalid IL or missing references) //IL_2594: Unknown result type (might be due to invalid IL or missing references) //IL_25ce: Unknown result type (might be due to invalid IL or missing references) //IL_1c5a: Unknown result type (might be due to invalid IL or missing references) //IL_1c93: Unknown result type (might be due to invalid IL or missing references) //IL_0d3e: Unknown result type (might be due to invalid IL or missing references) //IL_0d51: Unknown result type (might be due to invalid IL or missing references) //IL_0d73: Unknown result type (might be due to invalid IL or missing references) //IL_087d: Unknown result type (might be due to invalid IL or missing references) //IL_260b: Unknown result type (might be due to invalid IL or missing references) //IL_1ccf: Unknown result type (might be due to invalid IL or missing references) //IL_0dac: Unknown result type (might be due to invalid IL or missing references) //IL_2686: Unknown result type (might be due to invalid IL or missing references) //IL_26cc: Unknown result type (might be due to invalid IL or missing references) //IL_08db: 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_1d28: Unknown result type (might be due to invalid IL or missing references) //IL_1d53: Unknown result type (might be due to invalid IL or missing references) //IL_1d3b: Unknown result type (might be due to invalid IL or missing references) //IL_2710: Unknown result type (might be due to invalid IL or missing references) //IL_0938: Unknown result type (might be due to invalid IL or missing references) //IL_0e4a: Unknown result type (might be due to invalid IL or missing references) //IL_0e83: Unknown result type (might be due to invalid IL or missing references) //IL_097c: Unknown result type (might be due to invalid IL or missing references) //IL_098f: Unknown result type (might be due to invalid IL or missing references) //IL_09b2: Unknown result type (might be due to invalid IL or missing references) //IL_1dbe: Unknown result type (might be due to invalid IL or missing references) //IL_1df0: Unknown result type (might be due to invalid IL or missing references) //IL_0f57: Unknown result type (might be due to invalid IL or missing references) //IL_0f6a: Unknown result type (might be due to invalid IL or missing references) //IL_0f8c: Unknown result type (might be due to invalid IL or missing references) //IL_0a10: Unknown result type (might be due to invalid IL or missing references) //IL_1e2d: Unknown result type (might be due to invalid IL or missing references) //IL_1e8a: Unknown result type (might be due to invalid IL or missing references) //IL_1ec4: Unknown result type (might be due to invalid IL or missing references) //IL_0a6e: Unknown result type (might be due to invalid IL or missing references) //IL_1f01: Unknown result type (might be due to invalid IL or missing references) //IL_1f7c: Unknown result type (might be due to invalid IL or missing references) //IL_1fb6: Unknown result type (might be due to invalid IL or missing references) //IL_0acb: Unknown result type (might be due to invalid IL or missing references) //IL_1ff3: Unknown result type (might be due to invalid IL or missing references) //IL_2050: Unknown result type (might be due to invalid IL or missing references) //IL_208a: Unknown result type (might be due to invalid IL or missing references) //IL_0b0a: Unknown result type (might be due to invalid IL or missing references) //IL_0b1d: Unknown result type (might be due to invalid IL or missing references) //IL_0b40: Unknown result type (might be due to invalid IL or missing references) //IL_20c7: Unknown result type (might be due to invalid IL or missing references) //IL_2124: Unknown result type (might be due to invalid IL or missing references) //IL_216a: Unknown result type (might be due to invalid IL or missing references) //IL_0bac: Unknown result type (might be due to invalid IL or missing references) //IL_21b0: Unknown result type (might be due to invalid IL or missing references) //IL_21bf: Unknown result type (might be due to invalid IL or missing references) //IL_21c9: Unknown result type (might be due to invalid IL or missing references) //IL_21ce: Unknown result type (might be due to invalid IL or missing references) //IL_21d3: Unknown result type (might be due to invalid IL or missing references) //IL_21dd: Unknown result type (might be due to invalid IL or missing references) //IL_21e2: Unknown result type (might be due to invalid IL or missing references) //IL_21e7: Unknown result type (might be due to invalid IL or missing references) //IL_21eb: Unknown result type (might be due to invalid IL or missing references) //IL_0c23: Unknown result type (might be due to invalid IL or missing references) GUI.enabled = true; float num = ((Rect)(ref _windowRect)).width - 32f; float num2 = 36f; DrawCloseButton(); string text = (UseChinese() ? "游戏工具控制中心" : "✦ Game Control Center"); GUI.Label(new Rect(16f, num2, num - 300f, 30f), text, _sTitle); string text2 = (UseChinese() ? "Switch to English" : "切换中文"); if (GUI.Button(new Rect(((Rect)(ref _windowRect)).width - 220f, num2 - 4f, 170f, 36f), text2, _sBtnNormal)) { DisplayLanguage value = (UseChinese() ? DisplayLanguage.English : DisplayLanguage.中文); _cfgLanguage.Value = value; } num2 += 44f; string[] array = ((!UseChinese()) ? new string[5] { "⚙\ufe0f Global", "\ud83d\udc65 Players", "\ud83c\udfae Game Visuals", "\ud83d\udce6 Spawner", "\ud83d\udc7e Spawns" } : new string[5] { "⚙\ufe0f 全局设置", "\ud83d\udc65 玩家控制", "\ud83c\udfae 局内表现", "\ud83d\udce6 刷取助手", "\ud83d\udc7e 刷怪监控" }); float num3 = num / 5f; for (int i = 0; i < 5; i++) { bool flag = _currentTab == i; if (GUI.Button(new Rect(16f + (float)i * num3, num2, num3 - 4f, 36f), array[i], flag ? _sBtnGreen : _sBtnNormal)) { _currentTab = i; } } num2 += 44f; float num4 = ((Rect)(ref _windowRect)).height - num2 - 16f - 10f; Rect val = default(Rect); ((Rect)(ref val))..ctor(16f, num2, num, num4); if (_currentTab == 3) { bool enabled = GUI.enabled; bool flag2 = true; try { flag2 = !PhotonNetwork.InRoom || PhotonNetwork.IsMasterClient; } catch { } if (!_cfgModEnabled.Value || !flag2) { GUI.enabled = false; } DrawTabSpawner(val); GUI.enabled = enabled; } else { Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(0f, 0f, num - 16f, _lastVirtualHeight); _scrollPos = GUI.BeginScrollView(val, _scrollPos, val2); float curY = 0f; float num5 = num - 18f; float num6 = 0f; float num7 = num6 + 12f; float num8 = num5 - 24f; if (_currentTab == 0) { string text3 = (UseChinese() ? "\ud83d\udd04 重置全部全局选项" : "\ud83d\udd04 Reset All Global Settings"); if (GUI.Button(new Rect(num6, curY, num5, 36f), text3, _sBtnRed)) { ResetGlobalSettings(); } curY += 48f; Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(num6, curY, num5, 110f); GUI.Box(val3, "", _sSection); DrawBorderRect(val3, _texBorder); float num9 = curY + 12f; bool flag3 = DrawStyledToggle(new Rect(num7, num9, num8, 30f), _cfgModEnabled.Value, UseChinese() ? "启用整个模组功能" : "Enable GameTools Mod"); if (flag3 != _cfgModEnabled.Value) { _cfgModEnabled.Value = flag3; } curY += 60f; bool enabled2 = GUI.enabled; if (!IsStaticModEnabled()) { GUI.enabled = false; } Rect val4 = default(Rect); ((Rect)(ref val4))..ctor(num6, curY, num5, 150f); GUI.Box(val4, "", _sSection); DrawBorderRect(val4, _texBorder); num9 = curY + 12f; GUI.Label(new Rect(num7, num9, num8, 24f), UseChinese() ? "模组运行状态信息:" : "Mod Runtime Information:", _sTitle); num9 += 30f; string text4 = ((!SemiFunc.RunIsLobbyMenu()) ? (UseChinese() ? "已进入游戏关卡内" : "In Level / Game Session") : (UseChinese() ? "当前在大厅菜单中" : "In Lobby Menu")); GUI.Label(new Rect(num7, num9, num8, 24f), (UseChinese() ? "环境状态: " : "Environment: ") + text4, _sLabel); num9 += 26f; string text5; try { text5 = ((!PhotonNetwork.InRoom) ? (UseChinese() ? "单机模式 (可用)" : "Singleplayer (Available)") : ((!PhotonNetwork.IsMasterClient) ? (UseChinese() ? "联机客机 (功能可用,控制他人需房主)" : "Client (Available, control requires Host)") : (UseChinese() ? "联机房主 / 主机 (可用)" : "Host / MasterClient (Available)"))); } catch { text5 = (UseChinese() ? "单机模式 (可用)" : "Singleplayer (Available)"); } GUI.Label(new Rect(num7, num9, num8, 24f), (UseChinese() ? "权限状态: " : "Authority: ") + text5, _sStatus); num9 += 26f; string text6 = (((Object)(object)PlayerController.instance != (Object)null) ? PlayerSteamIDRef.Invoke(PlayerController.instance) : null); string text7 = (string.IsNullOrEmpty(text6) ? (UseChinese() ? "等待玩家初始化..." : "Waiting for Player avatar...") : (UseChinese() ? ("本地玩家ID已就绪 (SteamID: " + text6 + ")") : ("Player Ready (SteamID: " + text6 + ")"))); GUI.Label(new Rect(num7, num9, num8, 24f), (UseChinese() ? "玩家状态: " : "Player State: ") + text7, _sStatus); GUI.enabled = enabled2; curY += 170f; Rect val5 = default(Rect); ((Rect)(ref val5))..ctor(num6, curY, num5, 95f); GUI.Box(val5, "", _sSection); DrawBorderRect(val5, _texBorder); float num10 = curY + 12f; GUI.Label(new Rect(num7, num10, num8, 24f), UseChinese() ? "\ud83c\udfae 关卡与回合控制" : "\ud83c\udfae Level & Round Control", _sTitle); num10 += 30f; bool enabled3 = GUI.enabled; if (!IsStaticModEnabled() || (Object)(object)RunManager.instance == (Object)null) { GUI.enabled = false; } float num11 = (num8 - 12f) / 2f; string text8 = (UseChinese() ? "⚡ 切换下一关" : "⚡ Next Level"); if (GUI.Button(new Rect(num7, num10, num11, 36f), text8, _sBtnGreen)) { try { RunManager.instance.ChangeLevel(true, false, (ChangeLevelType)0); } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[ChangeLevel Error]: {arg}"); } } } string text9 = (UseChinese() ? "\ud83d\udd04 重载当前关卡" : "\ud83d\udd04 Reload Level"); if (GUI.Button(new Rect(num7 + num11 + 12f, num10, num11, 36f), text9, _sBtnRed)) { try { RunManager.instance.RestartScene(); } catch (Exception arg2) { Plugin instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogWarning((object)$"[RestartScene Error]: {arg2}"); } } } GUI.enabled = enabled3; curY += 115f; } else if (_currentTab == 1) { DrawTabPlayerControl(num6, ref curY, num5, num7, num8); } else if (_currentTab == 2) { bool enabled4 = GUI.enabled; if (!_cfgModEnabled.Value) { GUI.enabled = false; } string text10 = (UseChinese() ? "\ud83d\udd04 重置全部局内选项" : "\ud83d\udd04 Reset All Visual Settings"); if (GUI.Button(new Rect(num6, curY, num5, 36f), text10, _sBtnRed)) { ResetVisualSettings(); } curY += 48f; Rect val6 = default(Rect); ((Rect)(ref val6))..ctor(num6, curY, num5, 180f); GUI.Box(val6, "", _sSection); DrawBorderRect(val6, _texBorder); float num12 = curY + 12f; bool flag4 = DrawStyledToggle(new Rect(num7, num12, num8, 30f), _cfgWingsAlwaysShow.Value, UseChinese() ? "激活翅膀常显 (不论是否摔倒、落地,炫酷发光翅膀永久展开)" : "Wings Always Active (Glowing wings stay active indefinitely)"); if (flag4 != _cfgWingsAlwaysShow.Value) { _cfgWingsAlwaysShow.Value = flag4; SaveRuntimeConfig(); } num12 += 36f; bool enabled5 = GUI.enabled; GUI.enabled = enabled5 && flag4; bool flag5 = DrawStyledToggle(new Rect(num7, num12, num8, 30f), _cfgRainbowWings.Value, UseChinese() ? "彩虹渐变效果 (背部翅膀颜色呈七彩霓虹灯平滑滚动)" : "Rainbow Color Shift (Wings shift colors like rgb neon lights)"); if (flag5 != _cfgRainbowWings.Value) { _cfgRainbowWings.Value = flag5; SaveRuntimeConfig(); } num12 += 36f; bool flag6 = DrawStyledToggle(new Rect(num7, num12, num8, 30f), _cfgTumbleFlyEnabled.Value, UseChinese() ? "Q键飞行方向控制 (空中摔倒状态下按 WASD + 空格/Ctrl 自由飞翔)" : "Tumble Fly Control (WASD + Space/Ctrl to fly freely in ragdoll state)"); if (flag6 != _cfgTumbleFlyEnabled.Value) { _cfgTumbleFlyEnabled.Value = flag6; SaveRuntimeConfig(); } num12 += 36f; GUI.Label(new Rect(num7, num12, num8, 24f), UseChinese() ? "※ 开启后,在空中摔倒时能自由控制飞行方向。飞行状态下会自动展开背部翅膀。" : "* Allows controlling ragdoll flight in mid-air. Wings will render automatically.", _sStatus); GUI.enabled = enabled5; curY += 200f; Rect val7 = default(Rect); ((Rect)(ref val7))..ctor(num6, curY, num5, 196f); GUI.Box(val7, "", _sSection); DrawBorderRect(val7, _texBorder); num12 = curY + 12f; bool flag7 = DrawStyledToggle(new Rect(num7, num12, num8, 30f), _cfgReverseInput.Value, UseChinese() ? "反向控制 (键盘操作前后左右的方向颠倒)" : "Reverse Movement (WASD inputs are inverted)"); if (flag7 != _cfgReverseInput.Value) { _cfgReverseInput.Value = flag7; SaveRuntimeConfig(); } num12 += 36f; bool flag8 = DrawStyledToggle(new Rect(num7, num12, num8, 30f), _cfgReverseLegs.Value, UseChinese() ? "反向太空步 (跑步移动时,大腿会朝向运动相反方向搞笑滑行)" : "Moonwalk / Reverse Legs (Leg animation rotates 180° opposite to motion)"); if (flag8 != _cfgReverseLegs.Value) { _cfgReverseLegs.Value = flag8; SaveRuntimeConfig(); } num12 += 36f; bool flag9 = DrawStyledToggle(new Rect(num7, num12, num8, 30f), _cfgInfiniteWeaponBattery.Value, UseChinese() ? "⚡ 无限武器电量 (近战和远程武器使用时不消耗任何电池电量)" : "Infinite Weapon Battery (Melee and ranged weapons do not drain battery)"); if (flag9 != _cfgInfiniteWeaponBattery.Value) { _cfgInfiniteWeaponBattery.Value = flag9; SaveRuntimeConfig(); } num12 += 36f; GUI.Label(new Rect(num7, num12, num8, 24f), UseChinese() ? "※ 特效均实时生效。无限武器电量仅对近战和远程装备生效。" : "* Effects apply immediately. Infinite battery only applies to melee and ranged weapons.", _sStatus); curY += 216f; Rect val8 = default(Rect); ((Rect)(ref val8))..ctor(num6, curY, num5, 140f); GUI.Box(val8, "", _sSection); DrawBorderRect(val8, _texBorder); num12 = curY + 12f; bool flag10 = DrawStyledToggle(new Rect(num7, num12, num8, 30f), _cfgJumpMultiplierEnabled.Value, UseChinese() ? "开启超级大跳 (修改本地玩家起跳力倍数)" : "Enable Super Jump (Modify local player jump force multiplier)"); if (flag10 != _cfgJumpMultiplierEnabled.Value) { _cfgJumpMultiplierEnabled.Value = flag10; SaveRuntimeConfig(); } num12 += 36f; bool enabled6 = GUI.enabled; GUI.enabled = enabled6 && flag10; float num13 = DrawStyledSliderFloat(new Rect(num7, num12, num8, 36f), _cfgJumpMultiplier.Value, 1f, 3f, UseChinese() ? "大跳物理力度倍数:" : "Jump Force Multiplier:"); if (Mathf.Abs(num13 - _cfgJumpMultiplier.Value) > 0.01f) { _cfgJumpMultiplier.Value = num13; SaveRuntimeConfig(); } GUI.enabled = enabled6; num12 += 36f; GUI.Label(new Rect(num7, num12, num8, 24f), UseChinese() ? "※ 超级大跳在本地物理模拟中计算,可助力越过常规手段无法跨越的高墙或深坑。" : "* Super Jump runs on local physics to help clear high walls or deep gaps.", _sStatus); curY += 160f; GUI.enabled = enabled4; } else if (_currentTab == 4) { bool enabled7 = GUI.enabled; if (!IsStaticModEnabled()) { GUI.enabled = false; } if (!((Object)(object)PlayerController.instance != (Object)null) || !((Object)(object)EnemyDirector.instance != (Object)null)) { Rect val9 = default(Rect); ((Rect)(ref val9))..ctor(num6, curY, num5, 200f); GUI.Box(val9, "", _sSection); DrawBorderRect(val9, _texBorder); float num14 = curY + 50f; GUI.Label(new Rect(num7, num14, num8, 30f), UseChinese() ? "⚠\ufe0f 请在进入游戏局内后再查看刷怪状态监控!" : "⚠\ufe0f Please enter a level session first!", _sTitle); curY += 220f; } else { List enemiesSpawned = EnemyDirector.instance.enemiesSpawned; int num15 = enemiesSpawned?.Count ?? 0; Rect val10 = default(Rect); ((Rect)(ref val10))..ctor(num6, curY, num5, 145f); GUI.Box(val10, "", _sSection); DrawBorderRect(val10, _texBorder); float num16 = curY + 12f; GUI.Label(new Rect(num7, num16, num8, 24f), UseChinese() ? "\ud83d\udc7e 刷怪倍率与难度增强" : "\ud83d\udc7e Spawn Rate & Difficulty Enhancements", _sTitle); num16 += 28f; int num17 = DrawStyledSliderInt(new Rect(num7, num16, num8, 36f), Mathf.RoundToInt(_cfgSpawnRateMultiplier.Value), 1, 50, UseChinese() ? "关卡刷怪数量倍率:" : "Level Spawn Multiplier:"); if (Mathf.Abs((float)num17 - _cfgSpawnRateMultiplier.Value) > 0.01f) { _cfgSpawnRateMultiplier.Value = num17; SaveRuntimeConfig(); } num16 += 36f; Rect rect = default(Rect); ((Rect)(ref rect))..ctor(num7, num16, 360f, 24f); string text11 = (UseChinese() ? "每次关卡刷新怪物数据重置" : "Reset Monster Data on Level Load"); bool value2 = _cfgResetMonsterDataOnLevelLoad.Value; bool flag11 = DrawStyledToggle(rect, value2, text11); if (flag11 != value2) { _cfgResetMonsterDataOnLevelLoad.Value = flag11; SaveRuntimeConfig(); } num16 += 28f; GUI.Label(new Rect(num7, num16, num8, 24f), UseChinese() ? "※ 控制关卡初始生成的怪物槽总数量(切关时生效)以及已生成槽位的倒计时刷新速度(实时生效)。" : "* Multiplies the initial spawn slot count (takes effect next level) and reduces spawn cooldowns (real-time).", _sStatus); curY += 160f; if (!_globalOverrideInited && enemiesSpawned != null && enemiesSpawned.Count > 0) { EnemyParent val11 = enemiesSpawned[0]; if ((Object)(object)val11 != (Object)null) { _globalDespawnMin = val11.DespawnedTimeMin; _globalDespawnMax = val11.DespawnedTimeMax; _globalSpawnMin = val11.SpawnedTimeMin; _globalSpawnMax = val11.SpawnedTimeMax; _originalDespawnMin = val11.DespawnedTimeMin; _originalDespawnMax = val11.DespawnedTimeMax; _originalSpawnMin = val11.SpawnedTimeMin; _originalSpawnMax = val11.SpawnedTimeMax; _globalOverrideInited = true; } } Rect val12 = default(Rect); ((Rect)(ref val12))..ctor(num6, curY, num5, 305f); GUI.Box(val12, "", _sSection); DrawBorderRect(val12, _texBorder); float num18 = curY + 12f; GUI.Label(new Rect(num7, num18, num8, 24f), UseChinese() ? "\ud83d\udc7e 怪物导演 (EnemyDirector) 全局状态" : "\ud83d\udc7e Global Enemy Director Status", _sTitle); num18 += 26f; float num19 = 0f; try { num19 = EnemyDirectorSpawnIdlePauseTimerRef.Invoke(EnemyDirector.instance); } catch { } string text12 = (UseChinese() ? $"全局生成暂停计时: {num19:F1} 秒 | 怪物槽总数: {num15}" : $"Spawn Idle Pause: {num19:F1}s | Total Slots: {num15}"); GUI.Label(new Rect(num7, num18, num8, 24f), text12, _sLabel); float num20 = curY + 65f; GUI.Label(new Rect(num7, num20, 120f, 24f), UseChinese() ? "全局最小刷新:" : "Global Min Spawn:", _sLabel); float num21 = GUI.HorizontalSlider(new Rect(num7 + 130f, num20 + 8f, 240f, 20f), _globalDespawnMin, 1f, 300f, _sSlider, _sThumb); if (Mathf.Abs(num21 - _globalDespawnMin) > 0.01f) { _globalDespawnMin = Mathf.Round(num21 * 10f) / 10f; foreach (EnemyParent item in enemiesSpawned) { if ((Object)(object)item != (Object)null) { item.DespawnedTimeMin = _globalDespawnMin; } } } GUI.Label(new Rect(num7 + 380f, num20, 60f, 24f), $"{_globalDespawnMin:F1}s", _sToggleOn); num20 += 38f; GUI.Label(new Rect(num7, num20, 120f, 24f), UseChinese() ? "全局最大刷新:" : "Global Max Spawn:", _sLabel); float num22 = GUI.HorizontalSlider(new Rect(num7 + 130f, num20 + 8f, 240f, 20f), _globalDespawnMax, 1f, 300f, _sSlider, _sThumb); if (Mathf.Abs(num22 - _globalDespawnMax) > 0.01f) { _globalDespawnMax = Mathf.Round(num22 * 10f) / 10f; if (_globalDespawnMax < _globalDespawnMin) { _globalDespawnMax = _globalDespawnMin; } foreach (EnemyParent item2 in enemiesSpawned) { if ((Object)(object)item2 != (Object)null) { item2.DespawnedTimeMax = _globalDespawnMax; } } } GUI.Label(new Rect(num7 + 380f, num20, 60f, 24f), $"{_globalDespawnMax:F1}s", _sToggleOn); num20 += 38f; GUI.Label(new Rect(num7, num20, 120f, 24f), UseChinese() ? "全局最小寿命:" : "Global Min Life:", _sLabel); float num23 = GUI.HorizontalSlider(new Rect(num7 + 130f, num20 + 8f, 240f, 20f), _globalSpawnMin, 1f, 600f, _sSlider, _sThumb); if (Mathf.Abs(num23 - _globalSpawnMin) > 0.01f) { _globalSpawnMin = Mathf.Round(num23 * 10f) / 10f; foreach (EnemyParent item3 in enemiesSpawned) { if ((Object)(object)item3 != (Object)null) { item3.SpawnedTimeMin = _globalSpawnMin; } } } GUI.Label(new Rect(num7 + 380f, num20, 60f, 24f), $"{_globalSpawnMin:F1}s", _sToggleOn); num20 += 38f; GUI.Label(new Rect(num7, num20, 120f, 24f), UseChinese() ? "全局最大寿命:" : "Global Max Life:", _sLabel); float num24 = GUI.HorizontalSlider(new Rect(num7 + 130f, num20 + 8f, 240f, 20f), _globalSpawnMax, 1f, 600f, _sSlider, _sThumb); if (Mathf.Abs(num24 - _globalSpawnMax) > 0.01f) { _globalSpawnMax = Mathf.Round(num24 * 10f) / 10f; if (_globalSpawnMax < _globalSpawnMin) { _globalSpawnMax = _globalSpawnMin; } foreach (EnemyParent item4 in enemiesSpawned) { if ((Object)(object)item4 != (Object)null) { item4.SpawnedTimeMax = _globalSpawnMax; } } } GUI.Label(new Rect(num7 + 380f, num20, 60f, 24f), $"{_globalSpawnMax:F1}s", _sToggleOn); float num25 = num7 + 460f; float num26 = num8 - 460f; if (num26 < 200f) { num26 = 280f; } string text13 = (UseChinese() ? "⚡ 强制全体出生" : "⚡ Force All Spawns"); if (GUI.Button(new Rect(num25, curY + 55f, num26, 32f), text13, _sBtnGreen)) { try { EnemyDirectorSpawnIdlePauseTimerRef.Invoke(EnemyDirector.instance) = 0f; } catch { } if (enemiesSpawned != null) { foreach (EnemyParent item5 in enemiesSpawned) { if ((Object)(object)item5 != (Object)null && !EnemyParentSpawnedRef.Invoke(item5)) { item5.DespawnedTimerSet(0f, false); } } } } string text14 = (UseChinese() ? "\ud83d\udc80 全局一键击杀" : "\ud83d\udc80 Kill All Enemies"); if (GUI.Button(new Rect(num25, curY + 95f, num26, 32f), text14, _sBtnRed) && enemiesSpawned != null) { foreach (EnemyParent item6 in enemiesSpawned) { if (!((Object)(object)item6 != (Object)null) || !EnemyParentSpawnedRef.Invoke(item6)) { continue; } Enemy val13 = EnemyParentEnemyRef.Invoke(item6); if (!((Object)(object)val13 != (Object)null)) { continue; } EnemyHealth val14 = EnemyHealthRef.Invoke(val13); if ((Object)(object)val14 != (Object)null) { try { val14.Hurt(9999, Vector3.zero); } catch { } } } } string text15 = (UseChinese() ? "\ud83d\udca5 强制全体消失" : "\ud83d\udca5 Force All Despawns"); if (GUI.Button(new Rect(num25, curY + 135f, num26, 32f), text15, _sBtnRed) && enemiesSpawned != null) { foreach (EnemyParent item7 in enemiesSpawned) { if ((Object)(object)item7 != (Object)null && EnemyParentSpawnedRef.Invoke(item7)) { try { item7.Despawn(); } catch { } } } } string text16 = (UseChinese() ? "\ud83d\udccd 全体拉到面前" : "\ud83d\udccd Pull All Enemies"); if (GUI.Button(new Rect(num25, curY + 175f, num26, 32f), text16, _sBtnNormal) && enemiesSpawned != null && (Object)(object)PlayerController.instance != (Object)null) { Vector3 val15 = ((Component)PlayerController.instance).transform.position + ((Component)PlayerController.instance).transform.forward * 3f + Vector3.up * 0.5f; foreach (EnemyParent item8 in enemiesSpawned) { if (!((Object)(object)item8 != (Object)null) || !EnemyParentSpawnedRef.Invoke(item8)) { continue; } Enemy val16 = EnemyParentEnemyRef.Invoke(item8); if ((Object)(object)val16 != (Object)null) { try { val16.EnemyTeleported(val15); } catch { } } } } string text17 = (UseChinese() ? "❌ 一键移除所有刷新" : "❌ Clear All Spawns"); if (GUI.Button(new Rect(num25, curY + 215f, num26, 32f), text17, _sBtnRed) && enemiesSpawned != null) { foreach (EnemyParent item9 in new List(enemiesSpawned)) { if ((Object)(object)item9 != (Object)null) { try { item9.Despawn(); } catch { } try { EnemyDirector.instance.enemiesSpawned.Remove(item9); } catch { } } } } string text18 = (UseChinese() ? "\ud83d\udd04 一键重置数据" : "\ud83d\udd04 Reset Monster Data"); if (GUI.Button(new Rect(num25, curY + 255f, num26, 32f), text18, _sBtnRed)) { ResetMonsterData(); } curY += 320f; int num27 = 0; int num28 = 0; if (enemiesSpawned != null) { foreach (EnemyParent item10 in enemiesSpawned) { if ((Object)(object)item10 != (Object)null) { if (EnemyParentSpawnedRef.Invoke(item10)) { num27++; } else { num28++; } } } } new Rect(num6, curY, num5, 36f); string[] array2 = ((!UseChinese()) ? new string[2] { $"\ud83d\udfe2 Alive Enemies ({num27})", $"\ud83d\udd34 Despawned Slots ({num28})" } : new string[2] { $"\ud83d\udfe2 存活怪物列表 (共 {num27} 只)", $"\ud83d\udd34 待刷槽位列表 (共 {num28} 个)" }); float num29 = num5 / 2f; for (int j = 0; j < 2; j++) { bool flag12 = _monsterSubTab == j; if (GUI.Button(new Rect(num6 + (float)j * num29, curY, num29 - 4f, 32f), array2[j], flag12 ? _sBtnGreen : _sBtnNormal)) { _monsterSubTab = j; } } curY += 44f; if (num15 == 0) { Rect val17 = default(Rect); ((Rect)(ref val17))..ctor(num6, curY, num5, 100f); GUI.Box(val17, "", _sSection); DrawBorderRect(val17, _texBorder); GUI.Label(new Rect(num7, curY + 36f, num8, 24f), UseChinese() ? "当前地图尚未加载任何怪物槽..." : "No enemy slots loaded in the current level...", _sLabel); curY += 120f; } else { int num30 = 0; Rect val19 = default(Rect); for (int k = 0; k < num15; k++) { EnemyParent val18 = enemiesSpawned[k]; if ((Object)(object)val18 == (Object)null) { continue; } bool flag13 = EnemyParentSpawnedRef.Invoke(val18); if ((_monsterSubTab == 0 && !flag13) || (_monsterSubTab == 1 && flag13)) { continue; } num30++; float num31 = ((_monsterSubTab == 0) ? 205f : 115f); ((Rect)(ref val19))..ctor(num6, curY, num5, num31); GUI.Box(val19, "", _sSection); DrawBorderRect(val19, _texBorder); string text19 = val18.enemyName.Replace("Enemy - ", "").Replace("Enemy ", ""); string arg3 = (UseChinese() ? EnemyNameLocalizer.Translate(text19) : text19); Enemy val20 = EnemyParentEnemyRef.Invoke(val18); EnemyHealth val21 = null; if ((Object)(object)val20 != (Object)null) { val21 = EnemyHealthRef.Invoke(val20); } float num32 = num7; float num33 = num7 + 250f; float num34 = num7 + num8 - 150f; if (_monsterSubTab == 0) { int num35 = (((Object)(object)val21 != (Object)null) ? EnemyHealthCurrentRef.Invoke(val21) : 0); int num36 = (((Object)(object)val21 != (Object)null) ? val21.health : 0); string text20 = (((Object)(object)val21 != (Object)null) ? $"❤\ufe0f HP: {num35}/{num36}" : "❤\ufe0f HP: --/--"); GUI.Label(new Rect(num32, curY + 12f, 240f, 24f), $"[{k + 1}] {arg3}", _sTitle); GUI.Label(new Rect(num32, curY + 42f, 240f, 24f), text20, ((float)num35 < (float)num36 * 0.3f) ? _sBtnRed : _sStatus); GUI.Label(new Rect(num32, curY + 70f, 240f, 24f), UseChinese() ? $"⏱\ufe0f 已活: {val18.SpawnedTimer:F1}秒" : $"⏱\ufe0f Life: {val18.SpawnedTimer:F1}s", _sLabel); GUI.Label(new Rect(num32, curY + 98f, 240f, 24f), UseChinese() ? $"⚙\ufe0f 难度: {val18.difficulty}" : $"⚙\ufe0f Diff: {val18.difficulty}", _sLabel); bool flag14 = EnemyParentPlayerCloseRef.Invoke(val18); string text21 = ((!flag14) ? (UseChinese() ? "\ud83c\udf43 四下无人" : "\ud83c\udf43 Empty Area") : (UseChinese() ? "\ud83d\udc65 玩家在旁" : "\ud83d\udc65 Player Near")); GUI.Label(new Rect(num32, curY + 126f, 240f, 24f), text21, flag14 ? _sStatus : _sLabel); GUI.Label(new Rect(num33, curY + 12f, 100f, 24f), UseChinese() ? "最小寿命:" : "Min Life:", _sLabel); float num37 = GUI.HorizontalSlider(new Rect(num33 + 105f, curY + 20f, 180f, 20f), val18.SpawnedTimeMin, 1f, 600f, _sSlider, _sThumb); val18.SpawnedTimeMin = Mathf.Round(num37 * 10f) / 10f; GUI.Label(new Rect(num33 + 295f, curY + 12f, 60f, 24f), $"{val18.SpawnedTimeMin:F0}s", _sToggleOn); GUI.Label(new Rect(num33, curY + 47f, 100f, 24f), UseChinese() ? "最大寿命:" : "Max Life:", _sLabel); float num38 = GUI.HorizontalSlider(new Rect(num33 + 105f, curY + 55f, 180f, 20f), val18.SpawnedTimeMax, 1f, 600f, _sSlider, _sThumb); val18.SpawnedTimeMax = Mathf.Round(num38 * 10f) / 10f; if (val18.SpawnedTimeMax < val18.SpawnedTimeMin) { val18.SpawnedTimeMax = val18.SpawnedTimeMin; } GUI.Label(new Rect(num33 + 295f, curY + 47f, 60f, 24f), $"{val18.SpawnedTimeMax:F0}s", _sToggleOn); GUI.Label(new Rect(num33, curY + 82f, 100f, 24f), UseChinese() ? "动作速度:" : "Action Spd:", _sLabel); float num39 = GUI.HorizontalSlider(new Rect(num33 + 105f, curY + 90f, 180f, 20f), val18.actionMultiplier, 0.1f, 5f, _sSlider, _sThumb); val18.actionMultiplier = Mathf.Round(num39 * 10f) / 10f; GUI.Label(new Rect(num33 + 295f, curY + 82f, 60f, 24f), $"{val18.actionMultiplier:F1}x", _sToggleOn); GUI.Label(new Rect(num33, curY + 117f, 100f, 24f), UseChinese() ? "过载倍率:" : "Overcharge:", _sLabel); float num40 = GUI.HorizontalSlider(new Rect(num33 + 105f, curY + 125f, 180f, 20f), val18.overchargeMultiplier, 0.1f, 5f, _sSlider, _sThumb); val18.overchargeMultiplier = Mathf.Round(num40 * 10f) / 10f; GUI.Label(new Rect(num33 + 295f, curY + 117f, 60f, 24f), $"{val18.overchargeMultiplier:F1}x", _sToggleOn); float num41 = 140f; float num42 = 28f; float num43 = curY + 12f; if (GUI.Button(new Rect(num34, num43, num41, num42), UseChinese() ? "\ud83d\udccd 拉到面前" : "\ud83d\udccd Pull", _sBtnNormal) && (Object)(object)val20 != (Object)null && (Object)(object)PlayerController.instance != (Object)null) { try { Vector3 val22 = ((Component)PlayerController.instance).transform.position + ((Component)PlayerController.instance).transform.forward * 3f + Vector3.up * 0.5f; val20.EnemyTeleported(val22); } catch { } } num43 += 36f; if (GUI.Button(new Rect(num34, num43, num41, num42), UseChinese() ? "✈\ufe0f 飞过去" : "✈\ufe0f Goto", _sBtnNormal) && (Object)(object)val20 != (Object)null && (Object)(object)PlayerController.instance != (Object)null) { try { Vector3 val23 = ((Component)val20).transform.position + Vector3.up * 0.5f; PlayerAvatar val24 = (((Object)(object)PlayerController.instance.playerAvatarScript != (Object)null) ? ((Component)PlayerController.instance.playerAvatarScript).GetComponent() : null); if ((Object)(object)val24 != (Object)null) { PlayerTumble val25 = PlayerAvatarTumbleRef.Invoke(val24); if ((Object)(object)val25 != (Object)null && (Object)(object)PlayerTumblePhysGrabObjectRef.Invoke(val25) != (Object)null) { PlayerTumblePhysGrabObjectRef.Invoke(val25).Teleport(val23, Quaternion.identity); } } ((Component)PlayerController.instance).transform.position = val23; } catch { } } num43 += 36f; if (GUI.Button(new Rect(num34, num43, num41, num42), UseChinese() ? "⚡ 一键击杀" : "⚡ Kill Enemy", _sBtnRed) && (Object)(object)val21 != (Object)null) { try { val21.Hurt(9999, Vector3.zero); } catch { } } num43 += 36f; if (GUI.Button(new Rect(num34, num43, num41, num42), UseChinese() ? "\ud83d\udca5 强制消失" : "\ud83d\udca5 Despawn", _sBtnRed)) { try { val18.Despawn(); } catch { } } num43 += 36f; if (GUI.Button(new Rect(num34, num43, num41, num42), UseChinese() ? "❌ 移除刷新" : "❌ Remove", _sBtnRed)) { try { val18.Despawn(); } catch { } try { EnemyDirector.instance.enemiesSpawned.Remove(val18); } catch { } } } else { GUI.Label(new Rect(num32, curY + 12f, 240f, 24f), $"[{k + 1}] {arg3}", _sTitle); GUI.Label(new Rect(num32, curY + 42f, 240f, 24f), UseChinese() ? $"\ud83d\udc80 炸裂刷新: {val18.DespawnedTimer:F1}s" : $"\ud83d\udc80 Spawn In: {val18.DespawnedTimer:F1}s", _sBtnRed); GUI.Label(new Rect(num32, curY + 70f, 240f, 24f), UseChinese() ? $"⚙\ufe0f 难度: {val18.difficulty}" : $"⚙\ufe0f Diff: {val18.difficulty}", _sLabel); GUI.Label(new Rect(num33, curY + 22f, 100f, 24f), UseChinese() ? "最小刷新:" : "Min Spawn:", _sLabel); float num44 = GUI.HorizontalSlider(new Rect(num33 + 105f, curY + 30f, 180f, 20f), val18.DespawnedTimeMin, 1f, 300f, _sSlider, _sThumb); val18.DespawnedTimeMin = Mathf.Round(num44 * 10f) / 10f; GUI.Label(new Rect(num33 + 295f, curY + 22f, 60f, 24f), $"{val18.DespawnedTimeMin:F0}s", _sToggleOn); GUI.Label(new Rect(num33, curY + 60f, 100f, 24f), UseChinese() ? "最大刷新:" : "Max Spawn:", _sLabel); float num45 = GUI.HorizontalSlider(new Rect(num33 + 105f, curY + 68f, 180f, 20f), val18.DespawnedTimeMax, 1f, 300f, _sSlider, _sThumb); val18.DespawnedTimeMax = Mathf.Round(num45 * 10f) / 10f; if (val18.DespawnedTimeMax < val18.DespawnedTimeMin) { val18.DespawnedTimeMax = val18.DespawnedTimeMin; } GUI.Label(new Rect(num33 + 295f, curY + 60f, 60f, 24f), $"{val18.DespawnedTimeMax:F0}s", _sToggleOn); float num46 = 140f; float num47 = 28f; float num48 = curY + 22f; if (GUI.Button(new Rect(num34, num48, num46, num47), UseChinese() ? "⚡ 立即出生" : "⚡ Spawn Now", _sBtnGreen)) { val18.DespawnedTimerSet(0f, false); } num48 += 36f; if (GUI.Button(new Rect(num34, num48, num46, num47), UseChinese() ? "❌ 移除刷新" : "❌ Remove", _sBtnRed)) { try { EnemyDirector.instance.enemiesSpawned.Remove(val18); } catch { } } } curY += num31 + 16f; } if (num30 == 0) { Rect val26 = default(Rect); ((Rect)(ref val26))..ctor(num6, curY, num5, 100f); GUI.Box(val26, "", _sSection); DrawBorderRect(val26, _texBorder); string text22 = ((_monsterSubTab != 0) ? (UseChinese() ? "当前地图没有待刷新的怪物槽。" : "No despawned enemy slots.") : (UseChinese() ? "当前地图没有任何存活的怪物。" : "No alive enemies in the level.")); GUI.Label(new Rect(num7, curY + 36f, num8, 24f), text22, _sLabel); curY += 120f; } } } _lastVirtualHeight = curY + 20f; GUI.enabled = enabled7; } _lastVirtualHeight = curY + 20f; GUI.EndScrollView(); } GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _windowRect)).width - 50f, 30f)); } private void DrawTabSpawner(Rect viewRect) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: 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_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Unknown result type (might be due to invalid IL or missing references) //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Unknown result type (might be due to invalid IL or missing references) LoadAllSpawnables(force: false); float x = ((Rect)(ref viewRect)).x; float y = ((Rect)(ref viewRect)).y; float width = ((Rect)(ref viewRect)).width; float height = ((Rect)(ref viewRect)).height; Rect val = default(Rect); ((Rect)(ref val))..ctor(x, y, 180f, height); GUI.Box(val, "", _sSection); DrawBorderRect(val, _texBorder); string[] array = ((!UseChinese()) ? new string[8] { "\ud83d\udc7e Enemies", "\ud83d\udc8e Valuables", "\ud83e\uddea Potions", "⚔\ufe0f Melee", "\ud83d\udd2b Ranged", "\ud83d\udca3 Others", "\ud83d\uded2 Carts", "\ud83c\udfce\ufe0f Vehicles" } : new string[8] { "\ud83d\udc7e 危险怪物", "\ud83d\udc8e 贵重物品", "\ud83e\uddea 升级药水", "⚔\ufe0f 近战武器", "\ud83d\udd2b 远程武器", "\ud83d\udca3 其他装备", "\ud83d\uded2 运载推车", "\ud83c\udfce\ufe0f 赛车交通" }); float num = y + 12f; for (int i = 0; i < 8; i++) { bool flag = _currentSubTab == i; if (GUI.Button(new Rect(x + 10f, num, 160f, 44f), array[i], flag ? _sBtnGreen : _sBtnNormal)) { _currentSubTab = i; } num += 54f; } if (GUI.Button(new Rect(x + 10f, y + height - 56f, 160f, 44f), UseChinese() ? "\ud83d\udd04 刷新数据" : "\ud83d\udd04 Refresh", _sBtnNormal)) { LoadAllSpawnables(force: true); } float num2 = x + 195f; float num3 = width - 195f; Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(num2, y, num3, height); GUI.Box(val2, "", _sSection); DrawBorderRect(val2, _texBorder); if (!((Object)(object)PlayerController.instance != (Object)null)) { string text = (UseChinese() ? "⚠\ufe0f 请在进入游戏局内后再使用刷取助手!" : "⚠\ufe0f Please enter a game level/lobby first!"); GUI.Label(new Rect(num2 + 20f, y + height * 0.4f, num3 - 40f, 40f), text, _sTitle); return; } float num4 = y + 12f; GUI.Label(new Rect(num2 + 16f, num4 + 4f, 80f, 30f), UseChinese() ? "生成数量:" : "Spawn Qty:", _sLabel); if (int.TryParse(GUI.TextField(new Rect(num2 + 100f, num4, 80f, 30f), _spawnCount.ToString(), _sTextInput), out var result)) { _spawnCount = Mathf.Clamp(result, 1, 100); } if (GUI.Button(new Rect(num2 + 190f, num4, 34f, 30f), "-", _sBtnNormal)) { _spawnCount = Mathf.Max(1, _spawnCount - 1); } if (GUI.Button(new Rect(num2 + 230f, num4, 34f, 30f), "+", _sBtnNormal)) { _spawnCount = Mathf.Min(100, _spawnCount + 1); } if (_currentSubTab == 0) { Rect rect = default(Rect); ((Rect)(ref rect))..ctor(num2 + 280f, num4, 260f, 30f); string text2 = (UseChinese() ? "跟随游戏自动重生" : "Auto Respawn"); _cfgSpawnedAutoRespawn = DrawStyledToggle(rect, _cfgSpawnedAutoRespawn, text2); } List list = ((_currentSubTab == 0) ? _spawnablesEnemies : ((_currentSubTab == 1) ? _spawnablesValuables : ((_currentSubTab == 2) ? _spawnablesPotions : ((_currentSubTab == 3) ? _spawnablesMelee : ((_currentSubTab == 4) ? _spawnablesRanged : ((_currentSubTab == 5) ? _spawnablesOtherWeapons : ((_currentSubTab == 6) ? _spawnablesCarts : _spawnablesVehicles))))))); if (list == null || list.Count == 0) { string text3 = (UseChinese() ? "没有拉取到该类型的资产。请尝试点击左侧的【刷新数据】。" : "No assets found for this category. Try clicking [Refresh]."); GUI.Label(new Rect(num2 + 20f, y + height * 0.4f, num3 - 40f, 40f), text3, _sLabel); return; } int num5 = 2; float num6 = (num3 - 36f) / (float)num5; float num7 = 46f; float num8 = 12f; float num9 = 10f; float num10 = (float)Mathf.CeilToInt((float)list.Count / (float)num5) * (num7 + num9) + 24f; float num11 = y + 52f; float num12 = height - 62f; Rect val3 = new Rect(num2 + 10f, num11, num3 - 20f, num12); Rect val4 = default(Rect); ((Rect)(ref val4))..ctor(0f, 0f, num3 - 36f, num10); _subScrollPos = GUI.BeginScrollView(val3, _subScrollPos, val4); for (int j = 0; j < list.Count; j++) { int num13 = j / num5; float num14 = (float)(j % num5) * (num6 + num8); float num15 = (float)num13 * (num7 + num9); SpawnableInfo spawnableInfo = list[j]; string displayName = spawnableInfo.GetDisplayName(); if (GUI.Button(new Rect(num14, num15, num6, num7), displayName, _sBtnNormal)) { SpawnObject(spawnableInfo); } } GUI.EndScrollView(); } private static string GetPlayerDisplayName(PlayerAvatar player) { if ((Object)(object)player == (Object)null) { if (!UseChinese()) { return "Unknown Player"; } return "未知玩家"; } try { string text = PlayerAvatarPlayerNameRef.Invoke(player); if (!string.IsNullOrWhiteSpace(text)) { return text.Trim(); } } catch { } try { PhotonView photonView = player.photonView; object obj2; if (photonView == null) { obj2 = null; } else { Player owner = photonView.Owner; obj2 = ((owner != null) ? owner.NickName : null); } string text2 = (string)obj2; if (!string.IsNullOrWhiteSpace(text2)) { return text2.Trim(); } } catch { } try { string text3 = SemiFunc.PlayerGetName(player); if (!string.IsNullOrWhiteSpace(text3)) { return text3.Trim(); } } catch { } if (!string.IsNullOrWhiteSpace(((Object)player).name)) { return ((Object)player).name.Replace("(Clone)", string.Empty).Trim(); } if (!UseChinese()) { return "Unknown Player"; } return "未知玩家"; } private void DrawTabPlayerControl(float curX, ref float curY, float curW, float innerX, float innerW) { //IL_0529: 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_0048: 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) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_068a: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_032b: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: Unknown result type (might be due to invalid IL or missing references) //IL_05d5: Unknown result type (might be due to invalid IL or missing references) //IL_05df: Unknown result type (might be due to invalid IL or missing references) //IL_05e4: Unknown result type (might be due to invalid IL or missing references) //IL_05e9: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_06b9: Unknown result type (might be due to invalid IL or missing references) //IL_06be: Unknown result type (might be due to invalid IL or missing references) //IL_06c8: Unknown result type (might be due to invalid IL or missing references) //IL_06cd: Unknown result type (might be due to invalid IL or missing references) //IL_06d2: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_063a: Unknown result type (might be due to invalid IL or missing references) //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_0747: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Unknown result type (might be due to invalid IL or missing references) //IL_0733: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar[] array = Object.FindObjectsOfType(); int num = ((array != null) ? array.Length : 0); bool enabled = GUI.enabled; if (!IsStaticModEnabled()) { GUI.enabled = false; } float num2 = 108f; Rect val = default(Rect); ((Rect)(ref val))..ctor(curX, curY, curW, num2); GUI.Box(val, "", _sSection); DrawBorderRect(val, _texBorder); float num3 = curY + 12f; GUI.Label(new Rect(innerX, num3, innerW, 24f), UseChinese() ? "⚡ 一键全体操作" : "⚡ Batch Operations", _sTitle); num3 += 32f; float num4 = (innerW - 20f) / 3f; if (GUI.Button(new Rect(innerX, num3, num4, 36f), UseChinese() ? "\ud83d\udc9a 复活全部" : "\ud83d\udc9a Revive All", _sBtnGreen) && array != null) { PlayerAvatar[] array2 = array; foreach (PlayerAvatar val2 in array2) { try { if ((Object)(object)val2 != (Object)null && PlayerAvatarDeadSetRef.Invoke(val2)) { val2.Revive(false); } } catch { } } } if (GUI.Button(new Rect(innerX + num4 + 10f, num3, num4, 36f), UseChinese() ? "\ud83d\udc80 杀死全部" : "\ud83d\udc80 Kill All", _sBtnRed) && array != null) { PlayerAvatar[] array2 = array; foreach (PlayerAvatar val3 in array2) { try { if ((Object)(object)val3 != (Object)null && !PlayerAvatarDeadSetRef.Invoke(val3)) { val3.PlayerDeath(-1); } } catch { } } } bool num5 = (Object)(object)PlayerController.instance != (Object)null; bool enabled2 = GUI.enabled; if (!num5) { GUI.enabled = false; } if (GUI.Button(new Rect(innerX + (num4 + 10f) * 2f, num3, num4, 36f), UseChinese() ? "\ud83e\uddf2 拉过来全部" : "\ud83e\uddf2 Pull All", _sBtnNormal) && array != null && (Object)(object)PlayerController.instance != (Object)null) { PlayerAvatar[] array2 = array; foreach (PlayerAvatar val4 in array2) { try { if (!((Object)(object)val4 == (Object)null) && !PlayerAvatarIsLocalRef.Invoke(val4)) { Vector3 val5 = ((Component)PlayerController.instance).transform.position + ((Component)PlayerController.instance).transform.forward * 2f + Vector3.up * 0.5f; PlayerTumble val6 = PlayerAvatarTumbleRef.Invoke(val4); if ((Object)(object)val6 != (Object)null && (Object)(object)PlayerTumblePhysGrabObjectRef.Invoke(val6) != (Object)null) { PlayerTumblePhysGrabObjectRef.Invoke(val6).Teleport(val5, Quaternion.identity); } } } catch { } } } GUI.enabled = enabled2; curY += num2 + 16f; float num6 = 54f + ((num == 0) ? 30f : ((float)num * 34f)); Rect val7 = default(Rect); ((Rect)(ref val7))..ctor(curX, curY, curW, num6); GUI.Box(val7, "", _sSection); DrawBorderRect(val7, _texBorder); float num7 = curY + 12f; GUI.Label(new Rect(innerX, num7, innerW, 24f), UseChinese() ? "\ud83d\udc65 联机房间玩家控制" : "\ud83d\udc65 Player Management", _sTitle); num7 += 30f; if (num == 0) { GUI.Label(new Rect(innerX, num7, innerW, 24f), UseChinese() ? "等待联机玩家加载..." : "Waiting for players to load...", _sLabel); } else { Array.Sort(array, delegate(PlayerAvatar a, PlayerAvatar b) { if ((Object)(object)a == (Object)null || (Object)(object)b == (Object)null) { return 0; } bool flag3 = PlayerAvatarIsLocalRef.Invoke(a); bool flag4 = PlayerAvatarIsLocalRef.Invoke(b); if (flag3 && !flag4) { return -1; } return (!flag3 && flag4) ? 1 : string.Compare(GetPlayerDisplayName(a), GetPlayerDisplayName(b), StringComparison.OrdinalIgnoreCase); }); PlayerAvatar[] array2 = array; foreach (PlayerAvatar val8 in array2) { if ((Object)(object)val8 == (Object)null) { continue; } bool flag = PlayerAvatarIsLocalRef.Invoke(val8); string playerDisplayName = GetPlayerDisplayName(val8); bool flag2 = PlayerAvatarDeadSetRef.Invoke(val8); string text = playerDisplayName; if (flag) { text += (UseChinese() ? " (我)" : " (Me)"); } text += ((!flag2) ? (UseChinese() ? " [❤\ufe0f存活]" : " [❤\ufe0fAlive]") : (UseChinese() ? " [\ud83d\udc80死亡]" : " [\ud83d\udc80Dead]")); GUI.Label(new Rect(innerX, num7, 200f, 30f), text, _sLabel); float num8 = innerX + 210f; float num9 = 65f; float num10 = 28f; float num11 = 6f; bool enabled3 = GUI.enabled; GUI.enabled = enabled3 && !flag2; if (GUI.Button(new Rect(num8, num7 - 2f, num9, num10), UseChinese() ? "杀死" : "Kill", _sBtnRed)) { try { val8.PlayerDeath(-1); } catch { } } num8 += num9 + num11; GUI.enabled = enabled3 && flag2; if (GUI.Button(new Rect(num8, num7 - 2f, num9, num10), UseChinese() ? "复活" : "Revive", _sBtnGreen)) { try { val8.Revive(false); } catch { } } num8 += num9 + num11; GUI.enabled = enabled3 && !flag && (Object)(object)PlayerController.instance != (Object)null; if (GUI.Button(new Rect(num8, num7 - 2f, num9 + 10f, num10), UseChinese() ? "拉过来" : "Pull", _sBtnNormal)) { try { Vector3 val9 = ((Component)PlayerController.instance).transform.position + ((Component)PlayerController.instance).transform.forward * 2f + Vector3.up * 0.5f; PlayerTumble val10 = PlayerAvatarTumbleRef.Invoke(val8); if ((Object)(object)val10 != (Object)null && (Object)(object)PlayerTumblePhysGrabObjectRef.Invoke(val10) != (Object)null) { PlayerTumblePhysGrabObjectRef.Invoke(val10).Teleport(val9, Quaternion.identity); } } catch { } } num8 += num9 + 10f + num11; GUI.enabled = enabled3 && !flag && (Object)(object)PlayerController.instance != (Object)null; if (GUI.Button(new Rect(num8, num7 - 2f, num9 + 10f, num10), UseChinese() ? "飞过去" : "Goto", _sBtnNormal)) { try { Vector3 val11 = ((Component)val8).transform.position + Vector3.up * 0.5f; PlayerAvatar playerAvatarScript = PlayerController.instance.playerAvatarScript; PlayerAvatar val12 = ((playerAvatarScript != null) ? ((Component)playerAvatarScript).GetComponent() : null); if ((Object)(object)val12 != (Object)null) { PlayerTumble val13 = PlayerAvatarTumbleRef.Invoke(val12); if ((Object)(object)val13 != (Object)null && (Object)(object)PlayerTumblePhysGrabObjectRef.Invoke(val13) != (Object)null) { PlayerTumblePhysGrabObjectRef.Invoke(val13).Teleport(val11, Quaternion.identity); } } ((Component)PlayerController.instance).transform.position = val11; } catch { } } GUI.enabled = enabled3; num7 += 34f; } } GUI.enabled = enabled; curY += num6 + 20f; } private static bool IsWeapon(ItemBattery battery) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0037: Invalid comparison between Unknown and I4 //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Invalid comparison between Unknown and I4 //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 if ((Object)(object)battery == (Object)null) { return false; } ItemAttributes component = ((Component)battery).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.item != (Object)null) { itemType itemType = component.item.itemType; if ((int)itemType != 7 && (int)itemType != 9) { return (int)itemType == 15; } return true; } return false; } internal static void TryHookREPOConfig(Harmony h) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Expected O, but got Unknown //IL_018a: Expected O, but got Unknown try { Type type = AccessTools.TypeByName("MenuLib.MenuAPI"); if (type == null) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)"MenuLib not detected, skip REPOConfig bilingual hook."); } return; } HarmonyMethod val = new HarmonyMethod(AccessTools.Method(typeof(REPOConfigCreateHook), "Postfix", (Type[])null, (Type[])null)); HashSet hashSet = new HashSet(StringComparer.Ordinal) { "CreateREPOLabel", "CreateREPOToggle", "CreateREPOSlider", "CreateREPOInputField", "CreateREPOButton" }; int num = 0; foreach (MethodInfo declaredMethod in AccessTools.GetDeclaredMethods(type)) { if (!hashSet.Contains(declaredMethod.Name)) { continue; } ParameterInfo[] parameters = declaredMethod.GetParameters(); if (parameters.Length != 0 && !(parameters[0].ParameterType != typeof(string))) { try { h.Patch((MethodBase)declaredMethod, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); num++; } catch { } } } try { Type type2 = AccessTools.TypeByName("REPOConfig.ConfigMenu"); if (type2 != null) { MethodInfo methodInfo = AccessTools.Method(type2, "CreateModEntries", (Type[])null, (Type[])null); if (methodInfo != null) { h.Patch((MethodBase)methodInfo, new HarmonyMethod(AccessTools.Method(typeof(REPOConfigCreateHook), "CreateModEntriesPrefix", (Type[])null, (Type[])null)), new HarmonyMethod(AccessTools.Method(typeof(REPOConfigCreateHook), "CreateModEntriesPostfix", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _createModEntriesPatchInstalled = true; } } } catch { } if (num > 0) { Plugin instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)$"REPOConfig bilingual hook attached ({num} UI creation methods)."); } } else { Plugin instance3 = Instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogInfo((object)"REPOConfig: no patchable UI creation methods found."); } } } catch (Exception ex) { Plugin instance4 = Instance; if (instance4 != null) { ((BaseUnityPlugin)instance4).Logger.LogInfo((object)("REPOConfig hook failed: " + ex.Message)); } } } internal static void RegisterLiveLabelIfMatched(string label, object uiElement) { if (string.IsNullOrEmpty(label) || uiElement == null) { return; } string text = label.Trim().Replace("▼", "").Replace("▶", "") .Replace(" ", ""); CfgI18N cfgI18N = null; for (int i = 0; i < _cfgI18Ns.Count; i++) { CfgI18N cfgI18N2 = _cfgI18Ns[i]; string value = cfgI18N2.SectionEN?.Replace(" ", ""); string value2 = cfgI18N2.SectionCN?.Replace(" ", ""); if ((!string.IsNullOrEmpty(value) && text.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0) || (!string.IsNullOrEmpty(value2) && text.IndexOf(value2, StringComparison.OrdinalIgnoreCase) >= 0)) { cfgI18N = cfgI18N2; break; } } if (cfgI18N != null) { RegisterOneLiveLabel(uiElement, cfgI18N, isSection: true); return; } string key = label.Trim(); if (!_cfgByKeyOnly.TryGetValue(key, out var value3) || value3 == null || value3.Count == 0) { return; } if (value3.Count == 1) { RegisterOneLiveLabel(uiElement, value3[0], isSection: false); return; } if (!_pendingKeyMatchIndex.TryGetValue(key, out var value4)) { value4 = 0; } if (value4 >= value3.Count) { value4 = 0; } RegisterOneLiveLabel(uiElement, value3[value4], isSection: false); _pendingKeyMatchIndex[key] = value4 + 1; } private static void RegisterOneLiveLabel(object uiElement, CfgI18N i18n, bool isSection) { if (!IsOwnEntry(i18n) || !IsRenderingOurMod()) { return; } TextMeshProUGUI labelTmp = GetLabelTmp(uiElement); if ((Object)(object)labelTmp == (Object)null) { return; } bool flag = UseChinese(); string text = ((!isSection) ? (flag ? i18n.KeyCN : (i18n.DisplayEN ?? i18n.KeyEN)) : (flag ? i18n.SectionCN : i18n.SectionEN)); if (!string.IsNullOrEmpty(text)) { try { ((TMP_Text)labelTmp).text = text; } catch { } } _liveLabels.Add(new LiveLabel { Tmp = new WeakReference(labelTmp), I18N = i18n, IsSection = isSection }); if (!isSection && i18n.ReadOnlyEntry != null) { Object val = (Object)((uiElement is Object) ? uiElement : null); if (val != null && AccessTools.Field(uiElement.GetType(), "inputStringSystem") != null) { _liveValues.Add(new LiveValue { InputField = new WeakReference(val), I18N = i18n }); TrySetInputFieldValue(val, flag ? i18n.ValueCN : i18n.ValueEN); } } if (!isSection) { Type type = uiElement.GetType(); if (!_toggleLeftTmpCache.TryGetValue(type, out var value)) { value = AccessTools.Field(type, "leftButtonTMP"); _toggleLeftTmpCache[type] = value; } if (!_toggleRightTmpCache.TryGetValue(type, out var value2)) { value2 = AccessTools.Field(type, "rightButtonTMP"); _toggleRightTmpCache[type] = value2; } if (value != null && value2 != null) { object? value3 = value.GetValue(uiElement); TextMeshProUGUI val2 = (TextMeshProUGUI)((value3 is TextMeshProUGUI) ? value3 : null); object? value4 = value2.GetValue(uiElement); TextMeshProUGUI val3 = (TextMeshProUGUI)((value4 is TextMeshProUGUI) ? value4 : null); if ((Object)(object)val2 != (Object)null && (Object)(object)val3 != (Object)null) { _liveToggleButtons.Add(new LiveToggleButtons { LeftTmp = new WeakReference(val2), RightTmp = new WeakReference(val3) }); ApplyToggleButtonText(val2, val3, flag); } } } if (isSection || i18n.Entry == null || !i18n.Entry.SettingType.IsSubclassOf(typeof(Enum))) { return; } Object val4 = (Object)((uiElement is Object) ? uiElement : null); if (val4 != null) { Type type2 = uiElement.GetType(); if (!_sliderStringOptionsPropCache.TryGetValue(type2, out var value5)) { value5 = AccessTools.Property(type2, "stringOptions"); _sliderStringOptionsPropCache[type2] = value5; } if (value5 != null) { string[] names = Enum.GetNames(i18n.Entry.SettingType); string[] array = BuildEnumOptionsCN(names); string[] array2 = BuildEnumOptionsEN(names); LiveSliderOptions item = new LiveSliderOptions { Slider = new WeakReference(val4), I18N = i18n, OptionsCN = array, OptionsEN = array2 }; _liveSliderOptions.Add(item); TrySetSliderOptions(val4, value5, flag ? array : array2); } } } private static bool IsOwnEntry(CfgI18N i18n) { if (i18n?.Entry == null) { return false; } Plugin instance = Instance; if ((Object)(object)instance == (Object)null) { return false; } return i18n.Entry.ConfigFile == ((BaseUnityPlugin)instance).Config; } private static bool IsRenderingOurMod() { if (!_createModEntriesPatchInstalled) { return true; } if (_currentRenderingConfigFilePath == null) { return false; } Plugin instance = Instance; if ((Object)(object)instance == (Object)null) { return false; } return string.Equals(_currentRenderingConfigFilePath, ((BaseUnityPlugin)instance).Config.ConfigFilePath, StringComparison.OrdinalIgnoreCase); } private static TextMeshProUGUI GetLabelTmp(object uiElement) { try { Type type = uiElement.GetType(); if (!_labelTmpFieldCache.TryGetValue(type, out var value)) { value = AccessTools.Field(type, "labelTMP"); _labelTmpFieldCache[type] = value; } return (TextMeshProUGUI)((value == null) ? null : /*isinst with value type is only supported in some contexts*/); } catch { return null; } } internal static void RefreshLiveLabels() { bool flag = UseChinese(); for (int num = _liveLabels.Count - 1; num >= 0; num--) { LiveLabel liveLabel = _liveLabels[num]; if (!liveLabel.Tmp.TryGetTarget(out var target) || (Object)(object)target == (Object)null || (Object)(object)((Component)target).gameObject == (Object)null) { _liveLabels.RemoveAt(num); } else { string text = ((!liveLabel.IsSection) ? (flag ? liveLabel.I18N.KeyCN : (liveLabel.I18N.DisplayEN ?? liveLabel.I18N.KeyEN)) : (flag ? liveLabel.I18N.SectionCN : liveLabel.I18N.SectionEN)); try { ((TMP_Text)target).text = text; } catch { _liveLabels.RemoveAt(num); } } } for (int num2 = _liveValues.Count - 1; num2 >= 0; num2--) { LiveValue liveValue = _liveValues[num2]; if (!liveValue.InputField.TryGetTarget(out var target2) || target2 == (Object)null) { _liveValues.RemoveAt(num2); } else { string newVal = (flag ? liveValue.I18N.ValueCN : liveValue.I18N.ValueEN); if (!TrySetInputFieldValue(target2, newVal)) { _liveValues.RemoveAt(num2); } } } for (int num3 = _liveSliderOptions.Count - 1; num3 >= 0; num3--) { LiveSliderOptions liveSliderOptions = _liveSliderOptions[num3]; if (!liveSliderOptions.Slider.TryGetTarget(out var target3) || target3 == (Object)null) { _liveSliderOptions.RemoveAt(num3); } else { Type type = ((object)target3).GetType(); if (!_sliderStringOptionsPropCache.TryGetValue(type, out var value) || value == null) { _liveSliderOptions.RemoveAt(num3); } else { TrySetSliderOptions(target3, value, flag ? liveSliderOptions.OptionsCN : liveSliderOptions.OptionsEN); } } } for (int num4 = _liveToggleButtons.Count - 1; num4 >= 0; num4--) { LiveToggleButtons liveToggleButtons = _liveToggleButtons[num4]; if (!liveToggleButtons.LeftTmp.TryGetTarget(out var target4) || (Object)(object)target4 == (Object)null || !liveToggleButtons.RightTmp.TryGetTarget(out var target5) || (Object)(object)target5 == (Object)null) { _liveToggleButtons.RemoveAt(num4); } else { ApplyToggleButtonText(target4, target5, flag); } } _pendingKeyMatchIndex.Clear(); } private static string[] BuildEnumOptionsCN(string[] enumNames) { string[] array = new string[enumNames.Length]; for (int i = 0; i < enumNames.Length; i++) { array[i] = (_enumNameENtoCN.TryGetValue(enumNames[i], out var value) ? value : enumNames[i]); } return array; } private static string[] BuildEnumOptionsEN(string[] enumNames) { string[] array = new string[enumNames.Length]; for (int i = 0; i < enumNames.Length; i++) { array[i] = (_enumNameCNtoEN.TryGetValue(enumNames[i], out var value) ? value : enumNames[i]); } return array; } private static void TrySetSliderOptions(Object sliderObj, PropertyInfo prop, string[] options) { try { prop.SetValue(sliderObj, options); } catch { } } private static void ApplyToggleButtonText(TextMeshProUGUI leftTmp, TextMeshProUGUI rightTmp, bool cn) { try { ((TMP_Text)leftTmp).text = (cn ? "开" : "ON"); ((TMP_Text)rightTmp).text = (cn ? "关" : "OFF"); } catch { } } private static bool TrySetInputFieldValue(Object ifObj, string newVal) { try { Type type = ((object)ifObj).GetType(); if (!_inputStringSystemFieldCache.TryGetValue(type, out var value)) { value = AccessTools.Field(type, "inputStringSystem"); _inputStringSystemFieldCache[type] = value; } if (value == null) { return false; } object value2 = value.GetValue(ifObj); if (value2 == null) { return false; } Type type2 = value2.GetType(); if (!_inputStringSystemSetValueCache.TryGetValue(type2, out var value3)) { value3 = AccessTools.Method(type2, "SetValue", new Type[2] { typeof(string), typeof(bool) }, (Type[])null); _inputStringSystemSetValueCache[type2] = value3; } if (value3 == null) { return false; } value3.Invoke(value2, new object[2] { newVal ?? string.Empty, false }); return true; } catch { return false; } } } public class SpawnedByGameToolsHelper : MonoBehaviour { } internal sealed class ConfigurationManagerAttributes { public int? Order; public bool? ReadOnly; public bool? Browsable; public bool? HideDefaultButton; public string Category; public string DispName; public string Description; } internal static class REPOConfigCreateHook { public static void Postfix(object[] __args, object __result) { try { if (__args != null && __args.Length != 0 && __result != null && __args[0] is string label) { Plugin.RegisterLiveLabelIfMatched(label, __result); } } catch { } } public static void CreateModEntriesPrefix(object[] __args) { try { Plugin._currentRenderingConfigFilePath = null; if (__args != null && __args.Length >= 2 && __args[1] is ConfigEntryBase[] array && array.Length != 0) { ConfigEntryBase val = array[0]; if (((val != null) ? val.ConfigFile : null) != null) { Plugin._currentRenderingConfigFilePath = val.ConfigFile.ConfigFilePath; } } } catch { } } public static void CreateModEntriesPostfix() { Plugin._currentRenderingConfigFilePath = null; } } internal static class ItemNameLocalizer { private static readonly Regex WhitespaceRegex = new Regex("\\s+", RegexOptions.Compiled); private static readonly Regex PrefixValueRegex = new Regex("^(Arctic|Manor|Museum|Wizard)\\s+(.+)$", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex LeadingTypePrefixRegex = new Regex("^(enemy\\s+valuable|valuable\\s*object|valuable|item)\\s+", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex TrailingTypePrefixRegex = new Regex("\\s+(valuable\\s*object|valuable|item)$", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex SeparatorRegex = new Regex("[_\\-]+", RegexOptions.Compiled); private static readonly Regex LeadingValuablePrefixRegex = new Regex("^Valuable(?=[A-Z0-9_\\-\\s])", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex LowerUpperBoundaryRegex = new Regex("([a-z])([A-Z])", RegexOptions.Compiled); private static readonly Regex LetterDigitBoundaryRegex = new Regex("([A-Za-z])(\\d)", RegexOptions.Compiled); private static readonly Regex DigitLetterBoundaryRegex = new Regex("(\\d)([A-Za-z])", RegexOptions.Compiled); private static readonly Dictionary ExactNameMap = new Dictionary(StringComparer.OrdinalIgnoreCase) { { "C.A.R.T. Cannon", "C.A.R.T. 加农炮" }, { "C.A.R.T. Laser", "C.A.R.T. 激光炮" }, { "C.A.R.T.", "C.A.R.T.运输车" }, { "POCKET C.A.R.T.", "C.A.R.T.小车" }, { "Recharge Drone", "充能无人机" }, { "Feather Drone", "羽毛无人机" }, { "Indestructible Drone", "无敌无人机" }, { "Roll Drone", "滚动无人机" }, { "Zero Gravity Drone", "零重力无人机" }, { "Duck Bucket", "鸭子桶" }, { "Extraction Tracker", "提取追踪器" }, { "Duct Taped Grenades", "胶带捆绑手榴弹" }, { "Grenade", "手榴弹" }, { "Human Grenade", "人类手榴弹" }, { "Shockwave Grenade", "冲击波手榴弹" }, { "Stun Grenade", "眩晕手榴弹" }, { "AK-47", "AK-47" }, { "Gun", "枪" }, { "Photon Blaster", "光子冲击炮" }, { "Pulse Pistol", "脉冲手枪" }, { "Shotgun", "霰弹枪" }, { "Boltzap", "电击枪" }, { "Tranq Gun", "麻醉枪" }, { "Large Health Pack (100)", "大医疗包 (100)" }, { "Medium Health Pack (50)", "中医疗包 (50)" }, { "Small Health Pack (25)", "小医疗包 (25)" }, { "Leaf Blower", "吹风机" }, { "Baseball Bat", "棒球棍" }, { "Frying Pan", "铁锅" }, { "Inflatable Hammer", "充气锤" }, { "Sledge Hammer", "大锤" }, { "Prodzap", "电击棒" }, { "Sword", "剑" }, { "Explosive Mine", "爆炸地雷" }, { "Shockwave Mine", "冲击波地雷" }, { "Trapzap", "陷阱" }, { "Zero Gravity Orb", "零重力球" }, { "Phase Bridge", "相位桥" }, { "Energy Crystal", "能量水晶" }, { "Defibro", "除颤仪" }, { "Rubber Duck", "橡胶鸭" }, { "Roll Staff", "滚动法杖" }, { "Void Staff", "虚空法杖" }, { "Zero Gravity Staff", "零重力法杖" }, { "Death Head Battery Upgrade", "死亡头部电池升级" }, { "Map Player Count Upgrade", "地图玩家剩余数量升级" }, { "Crouch Rest Upgrade", "下蹲回体升级" }, { "Stamina Upgrade", "体力升级" }, { "Extra Jump Upgrade", "额外跳跃升级" }, { "Range Upgrade", "抓取范围升级" }, { "Strength Upgrade", "力量升级" }, { "Health Upgrade", "生命升级" }, { "Sprint Speed Upgrade", "冲刺速度升级" }, { "Tumble Climb Upgrade", "翻滚抓墙升级" }, { "Tumble Launch Upgrade", "翻滚速度升级" }, { "Tumble Wings Upgrade", "翻滚滑翔升级" }, { "Valuable Tracker", "贵重物品追踪器" }, { "Hauler", "载货车" }, { "Scout", "斥候" }, { "Semibot Walkies", "半机械对讲机套件" }, { "Cart", "推车" }, { "Small Cart", "小推车" }, { "Decor Box", "装饰箱" }, { "Enemy Valuable Small", "滚动珠(小)" }, { "Enemy Valuable Medium", "滚动珠(中)" }, { "Enemy Valuable Large", "滚动珠(大)" }, { "Medium", "滚动珠(中)" }, { "Small", "滚动珠(小)" }, { "Big", "滚动珠(大)" }, { "Large", "滚动珠(大)" }, { "C.A.R.T. Cargo Vehicle", "C.A.R.T.载货车" }, { "Cargo Vehicle", "载货车" }, { "CargoVehicle", "载货车" }, { "ItemVehicle", "载货车" }, { "Item Vehicle", "载货车" }, { "Vehicle", "载货车" }, { "Racing Vehicle", "赛车" }, { "RacingVehicle", "赛车" }, { "Kart", "赛车" }, { "Large Health Pack", "大医疗包" }, { "Medium Health Pack", "中医疗包" }, { "Small Health Pack", "小医疗包" }, { "Stun Mine", "眩晕地雷" }, { "Map Player Count Upgrades", "地图玩家数量升级" }, { "Grenades", "手雷" }, { "Health Upgrades", "生命值升级" }, { "Extra Jump Upgrades", "额外跳跃升级" }, { "Explosive Mines", "爆炸地雷" }, { "Axe", "斧" }, { "Tumble Launch Upgrades", "翻滚发射升级" }, { "Stun Mines", "眩晕地雷" }, { "Stun Grenades", "眩晕手雷" }, { "Strength Upgrades", "力量升级" }, { "Stamina Upgrades", "耐力升级" }, { "Sprint Speed Upgrades", "冲刺速度升级" }, { "Shockwave Mines", "震荡波地雷" }, { "Shockwave Grenades", "震荡波手雷" }, { "Bomb", "炸弹" }, { "Mode: STRONG", "模式:强" }, { "Mode: WEAK", "模式:弱" }, { "Bread", "面包" }, { "Apple", "苹果" }, { "Golden Apple", "金苹果" }, { "Cooked Beef", "烤牛排" }, { "Iron Sword", "铁剑" }, { "Diamond Sword", "钻石剑" }, { "Iron Pickaxe", "铁镐" }, { "Firework", "烟花" }, { "Golden Deagle", "黄金沙鹰" }, { "Keyblade", "钥匙剑" }, { "Exploding Pumpkin", "爆炸南瓜" }, { "Water Balloon", "水气球" }, { "Roblox Bomb", "Roblox 炸弹" }, { "Roblox Rocket Launcher", "Roblox 火箭发射器" }, { "Subspace Tripmine", "量子诡雷" }, { "Rainbow Pistol", "彩虹手枪" }, { "True Knife", "临界匕首" }, { "Moon Stick", "月亮法杖" }, { "Illumina", "伊露米娜" }, { "Ultraviolet Blaster", "紫外脉冲枪" }, { "Blerdly's Halberd", "布勒德利之斧" }, { "Golden AK47", "黄金 AK47" }, { "Devilsknife", "恶魔之刃" }, { "Roblox Paintball Gun", "Roblox 彩弹枪" }, { "Nuclear Bomb", "裂变炸弹" }, { "Freeze Gun (Stun enemies for 5s)", "冻结枪 (暂停怪物 5 秒)" }, { "Freeze Gun", "冻结枪" }, { "Venomous Sniper (Press Z to scope)", "剧毒狙击枪 (按 Z 开镜)" }, { "Venomous Sniper", "剧毒狙击枪" }, { "Rainbow Lucky Block (I wonder what's inside this...)", "彩虹幸运方块 (我也不知道里面有什么...)" }, { "Rainbow Lucky Block", "彩虹幸运方块" }, { "Monster Energy (15)", "魔爪饮料 (15)" }, { "Monster Energy", "魔爪饮料" }, { "M&M Peanut Chocolate Bag (50)", "M&M 巧克力 (50)" }, { "M&M Peanut Chocolate Bag", "M&M 巧克力" }, { "Fortune Healing Potion (65)", "幸运恢复药水 (65)" }, { "Fortune Healing Potion", "幸运恢复药水" }, { "Health Bloxy Cola (15)", "健康 Bloxy 可乐 (15)" }, { "Health Bloxy Cola", "健康 Bloxy 可乐" }, { "Muffet Cereal Box (20)", "Muffet 麦片盒 (20)" }, { "Muffet Cereal Box", "Muffet 麦片盒" }, { "Healing Gun (Shoot to heal teammates)", "恢复枪 (为队友恢复健康)" }, { "Healing Gun", "恢复枪" }, { "Medkit (150)", "绷带 (150)" }, { "Medkit", "绷带" }, { "Beast Minigun", "加特林机枪" }, { "The Moonlight Greatsword", "月光巨剑" }, { "Crimson Periastron", "绯红近星剑" }, { "Summit Shaper", "斫峰之刃" }, { "Candy Cane Basher", "拐杖糖" }, { "Shedletsky Gubby", "Shedletsky Gubby 人偶" }, { "Meowmere", "喵喵神剑" }, { "Guts shotgun", "勇气霰弹枪" }, { "Healing Staff", "治疗法杖" }, { "Haunted Cheezburger [E] (10 seconds GODMODE)", "闹鬼芝士堡 (10秒上帝模式)" }, { "Haunted Cheezburger", "闹鬼芝士堡" }, { "Candy Bucket (100)", "糖果桶 (100)" }, { "Candy Bucket", "糖果桶" }, { "Comic Large Pencil", "漫画巨笔" }, { "Explosive Snowball", "爆炸雪球" }, { "Stop Sign", "停止标志" }, { "Bloxiade (10 seconds speed boost)", "果立方 (10秒速度提升)" }, { "Bloxiade", "果立方" }, { "Teddy Bloxpin (50/50 chance to full heal or kill)", "泰迪·布洛克钉 (50%概率治愈或死亡)" }, { "Teddy Bloxpin", "泰迪·布洛克钉" }, { "Turkey Leg (40)", "火鸡腿 (40)" }, { "Turkey Leg", "火鸡腿" }, { "Pet Rock (This pet kills monsters easily, but they have short lifetime)", "岩宠 (这个宠物很容易杀死怪物,但生命短暂)" }, { "Pet Rock", "岩宠" }, { "Riff Ripper", "猩红撕裂者" }, { "Spray Can", "喷罐" }, { "Halloween Hammer", "万圣之锤" }, { "Baguette", "法棍" }, { "Pizza (40)", "披萨 (40)" }, { "Pizza", "披萨" }, { "Chips for Noobs (20)", "新手薯片 (20)" }, { "Chips for Noobs", "新手薯片" }, { "Xeno Zapper", "电击棒" }, { "Xeno Basher", "电击剑" }, { "Rebar Gun", "射钉枪" }, { "Nobelisk", "锘石炸弹" }, { "Pulse Nobelisk", "脉冲锘石炸弹" }, { "Nobelisk Detonator", "锘石起爆器" }, { "Rifle", "步枪" }, { "Potion (20)", "伤药 (20)" }, { "Potion", "伤药" }, { "Super Potion (60)", "强效药水 (60)" }, { "Super Potion", "强效药水" }, { "Hyper Potion (120)", "厉害伤药 (120)" }, { "Hyper Potion", "厉害伤药" }, { "Max Potion (250)", "全满药 (250)" }, { "Max Potion", "全满药" }, { "Full Restore (500)", "全复药 (500)" }, { "Full Restore", "全复药" }, { "Moomoo Milk (100)", "哞哞牛奶 (100)" }, { "Moomoo Milk", "哞哞牛奶" }, { "Lemonade (70)", "柠檬汁 (70)" }, { "Lemonade", "柠檬汁" }, { "Soda Pop (50)", "劲爽汽水 (50)" }, { "Soda Pop", "劲爽汽水" }, { "Fresh Water (30)", "美味之水 (30)" }, { "Fresh Water", "美味之水" }, { "Energy Powder (60)", "元气粉 (60)" }, { "Energy Powder", "元气粉" }, { "Scatter Bang", "声弹" }, { "Energy Root (120)", "元气根 (120)" }, { "Energy Root", "元气根" }, { "Remedy (60)", "中药 (60)" }, { "Remedy", "中药" }, { "Fine Remedy (100)", "好中药 (100)" }, { "Fine Remedy", "好中药" }, { "Superb Remedy (150)", "厉害中药 (150)" }, { "Superb Remedy", "厉害中药" }, { "Sweet Heart (20)", "心形甜点 (20)" }, { "Sweet Heart", "心形甜点" }, { "Bunk C.A.R.T", "双层推车" }, { "Big C.A.R.T.", "大型推车" }, { "Big Bunk C.A.R.T", "大型双层推车" }, { "Hidey Box", "隐藏箱" }, { "Walkie Talkie", "对讲机" }, { "Walkie-Talkie", "对讲机" }, { "WalkieTalkie", "对讲机" }, { "Walkies", "对讲机" }, { "Walkie Box", "对讲机礼盒" }, { "WalkieBox", "对讲机礼盒" }, { "WalkieTalkieBox", "对讲机礼盒" }, { "Semibot Walkie", "半机械对讲机" }, { "Walkie", "对讲机" } }; private static readonly Dictionary BodyMap = new Dictionary(StringComparer.OrdinalIgnoreCase) { { "3D Printer", "3D打印机" }, { "3 D Printer", "3D打印机" }, { "Alchemy Station", "炼金台" }, { "Animal Crate", "动物箱" }, { "Baby Head", "婴儿头" }, { "Banana Bow", "香蕉蝴蝶结" }, { "Barrel", "桶" }, { "Big Sample", "大型样本" }, { "Bird Skull", "鸟头骨" }, { "Blender", "搅拌机" }, { "Bonsai", "盆景" }, { "Boombox", "音响" }, { "Bottle", "瓶子" }, { "Broom", "扫帚" }, { "Bug", "虫子" }, { "Calculator", "计算器" }, { "Camera", "相机" }, { "Car", "汽车" }, { "Cauldron Box", "坩埚箱" }, { "Centrifuge", "离心机" }, { "Chomp Book", "咬咬书" }, { "Clown", "小丑" }, { "Cocktail", "鸡尾酒" }, { "Coffee Cup", "咖啡杯" }, { "Coffin", "棺材" }, { "Computer", "电脑" }, { "Cool brain", "酷脑" }, { "Creature Leg", "生物腿" }, { "Crown", "王冠" }, { "Cryo Pod", "冷冻舱" }, { "Crystal", "水晶" }, { "Crystal Ball", "水晶球" }, { "Cube ball", "方块球" }, { "Cube of Knowledge", "知识方块" }, { "Cubic Sculpture", "立方雕塑" }, { "Cubic Tower", "立方塔" }, { "Diamond", "钻石" }, { "Diamond Display", "钻石展示架" }, { "Dinosaur", "恐龙" }, { "Doll", "玩偶" }, { "Dragon Skull", "龙头骨" }, { "duck man", "鸭人" }, { "Dumgolfs Staff", "杜姆高夫法杖" }, { "Egg", "蛋" }, { "Emerald Bracelet", "翡翠手镯" }, { "Eraser", "橡皮" }, { "Eye Ball", "眼球" }, { "Eye of Orpigox", "奥匹戈克斯之眼" }, { "Fan", "风扇" }, { "Fire Extinguisher", "灭火器" }, { "Fish", "鱼" }, { "Flamethrower", "火焰喷射器" }, { "Flashlight", "手电筒" }, { "Flesh Blob", "肉团" }, { "Forever Candle", "永燃蜡烛" }, { "Fortune Card", "命运卡" }, { "Frog", "青蛙" }, { "Gem Box", "宝石箱" }, { "Gem Burger", "宝石汉堡" }, { "Globe", "地球仪" }, { "Glowing Jar", "发光罐" }, { "Goblet", "高脚杯" }, { "Goblin Arm", "哥布林手臂" }, { "Goblin Head", "哥布林头" }, { "Golden Statue", "黄金雕像" }, { "Golden Swirl", "金色旋纹" }, { "GoldFish", "金鱼" }, { "Gold Fish", "金鱼" }, { "GoldTooth", "金牙" }, { "Gold Tooth", "金牙" }, { "Gramophone", "留声机" }, { "Grandfather Clock", "落地钟" }, { "Griffin Statue", "狮鹫雕像" }, { "Guitar", "吉他" }, { "Gumball", "口香糖球" }, { "Handface", "手脸" }, { "Hand Face", "手脸" }, { "Harp", "竖琴" }, { "HDD", "硬盘" }, { "Heavy Water", "重水" }, { "Horse", "马" }, { "Ice Block", "冰块" }, { "Ice Saw", "冰锯" }, { "Icepick", "冰镐" }, { "Instrument", "乐器" }, { "Jackhammer", "风镐" }, { "Kettle", "水壶" }, { "Keycard", "钥匙卡" }, { "ladybug", "瓢虫" }, { "Laptop", "笔记本电脑" }, { "Levitation Potion", "漂浮药水" }, { "Love Potion", "爱情药水" }, { "Magnifying Glass", "放大镜" }, { "Map", "地图" }, { "Master Potion", "大师药水" }, { "Milk", "牛奶" }, { "Money", "钱" }, { "MonkeyBox", "猴子盒" }, { "Monkey Box", "猴子盒" }, { "Music Box", "音乐盒" }, { "Ocarina", "陶笛" }, { "Old Camera", "老式相机" }, { "Pacifier", "奶嘴" }, { "Painting", "画作" }, { "Pendant", "吊坠" }, { "Phone", "电话" }, { "Piano", "钢琴" }, { "Pills", "药丸" }, { "PimpleGuy", "痘痘人" }, { "Pimple Guy", "痘痘人" }, { "Plane", "飞机" }, { "Pocket Watch", "怀表" }, { "Poison Chalice", "毒酒杯" }, { "Power Crystal", "能量水晶" }, { "Propane Tank", "丙烷罐" }, { "Radio", "收音机" }, { "Red Mushroom", "红蘑菇" }, { "RubenDoll", "鲁本玩偶" }, { "Ruben Doll", "鲁本玩偶" }, { "Sample", "样本" }, { "Sample Cooler", "样本冷藏箱" }, { "Sample Cooler Wide", "宽样本冷藏箱" }, { "Sample Six Pack", "六联样本" }, { "Scale", "天平" }, { "Science Station", "科研站" }, { "Scream Doll", "尖叫玩偶" }, { "Server Rack", "服务器机柜" }, { "Ship in a bottle", "瓶中船" }, { "SilverFish", "银鱼" }, { "Silver Fish", "银鱼" }, { "Small Gem", "小宝石" }, { "Small Potion", "小药水" }, { "Smartwatch", "智能手表" }, { "Snow Bike", "雪地摩托" }, { "Spider Potion", "蜘蛛药水" }, { "Stapler", "订书机" }, { "Star Wand", "星星魔杖" }, { "Sword", "剑" }, { "Tall Guy", "高个子" }, { "Teeth Bot", "牙齿机器人" }, { "Telescope", "望远镜" }, { "Television", "电视" }, { "Tentacle", "触手" }, { "Time Glass", "时之沙漏" }, { "Toast", "吐司" }, { "Tooth", "牙齿" }, { "Toy Monkey", "玩具猴" }, { "Traffic Light", "红绿灯" }, { "Tray", "托盘" }, { "Troll Finger", "巨魔手指" }, { "Trophy", "奖杯" }, { "Unicorn Horn", "独角兽角" }, { "Uranium Mug", "铀杯" }, { "Uranium Mug Deluxe", "豪华铀杯" }, { "Uranium Petri Dish", "铀培养皿" }, { "Uranium Plate", "铀盘" }, { "Usb stick", "U盘" }, { "Vase", "花瓶" }, { "Vase Big", "大花瓶" }, { "Vase Chunky", "厚花瓶" }, { "Vase Small", "小花瓶" }, { "VHS", "录像带" }, { "Vinyl", "黑胶唱片" }, { "Wire Figure", "铁丝人偶" }, { "Worm", "蠕虫" } }; public static string Translate(string rawName) { string text = CleanName(rawName); if (string.Equals(text, "CART", StringComparison.Ordinal)) { return "C.A.R.T.运输车"; } if (string.Equals(text, "Pocket CART", StringComparison.OrdinalIgnoreCase)) { return "C.A.R.T.小车"; } if (ExactNameMap.TryGetValue(text, out var value)) { return value; } string key = SplitWords(text); if (ExactNameMap.TryGetValue(key, out value)) { return value; } string text2 = CleanDisplayName(rawName); if (string.IsNullOrWhiteSpace(text2)) { return text; } if (ExactNameMap.TryGetValue(text2, out value)) { return value; } string text3 = SplitWords(text2); if (ExactNameMap.TryGetValue(text3, out value)) { return value; } if (TryTranslatePrefixedValuable(text2, out value) || TryTranslatePrefixedValuable(text3, out value)) { return value; } if (TryGetBodyTranslation(text2, out value) || TryGetBodyTranslation(text3, out value)) { return value; } return text3; } public static string CleanDisplayName(string rawName) { string text = NormalizeLeadingValuablePrefix(CleanName(rawName)); string text2 = StripTypePrefix(text); if (!string.IsNullOrWhiteSpace(text2)) { return text2; } return text; } private static bool TryTranslatePrefixedValuable(string value, out string translated) { translated = null; if (string.IsNullOrWhiteSpace(value)) { return false; } if (!TrySplitPrefixAndBody(value, out var _, out var body)) { return false; } if (TryGetBodyTranslation(body, out var translated2)) { translated = translated2; return true; } string text = SplitWords(body); translated = text; return true; } private static bool TryGetBodyTranslation(string value, out string translated) { translated = null; if (string.IsNullOrWhiteSpace(value)) { return false; } if (BodyMap.TryGetValue(value, out translated)) { return true; } string text = SplitWords(value); if (!string.Equals(text, value, StringComparison.OrdinalIgnoreCase) && BodyMap.TryGetValue(text, out translated)) { return true; } string text2 = WhitespaceRegex.Replace(value, string.Empty); if (!string.Equals(text2, value, StringComparison.OrdinalIgnoreCase) && BodyMap.TryGetValue(text2, out translated)) { return true; } return false; } private static bool TrySplitPrefixAndBody(string value, out string prefix, out string body) { prefix = null; body = null; Match match = PrefixValueRegex.Match(value); if (!match.Success) { return false; } prefix = match.Groups[1].Value.Trim(); body = match.Groups[2].Value.Trim(); return !string.IsNullOrWhiteSpace(body); } private static string StripTypePrefix(string name) { if (string.IsNullOrWhiteSpace(name)) { return string.Empty; } string input = SplitWords(name); input = LeadingTypePrefixRegex.Replace(input, string.Empty); input = TrailingTypePrefixRegex.Replace(input, string.Empty); input = WhitespaceRegex.Replace(input, " "); return input.Trim(); } private static string CleanName(string rawName) { if (string.IsNullOrWhiteSpace(rawName)) { return string.Empty; } string input = rawName.Replace("(Clone)", string.Empty).Trim(); input = SeparatorRegex.Replace(input, " "); input = WhitespaceRegex.Replace(input, " "); return input.Trim(); } private static string NormalizeLeadingValuablePrefix(string value) { if (string.IsNullOrWhiteSpace(value)) { return string.Empty; } return LeadingValuablePrefixRegex.Replace(value, string.Empty).Trim(); } private static string SplitWords(string value) { string input = LowerUpperBoundaryRegex.Replace(value, "$1 $2"); input = LetterDigitBoundaryRegex.Replace(input, "$1 $2"); input = DigitLetterBoundaryRegex.Replace(input, "$1 $2"); input = SeparatorRegex.Replace(input, " "); input = WhitespaceRegex.Replace(input, " "); return input.Trim(); } } internal static class EnemyNameLocalizer { private static readonly Regex GroupCountRegex = new Regex("^(?\\d+)\\s+(?.+)$", RegexOptions.Compiled); private static readonly Regex CamelCaseBoundaryRegex = new Regex("(?<=[a-z])(?=[A-Z])", RegexOptions.Compiled); private static readonly Regex LeadingEnemyRegex = new Regex("^Enemy\\s+", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex WhitespaceRegex = new Regex("\\s+", RegexOptions.Compiled); private static readonly Regex ComponentSuffixRegex = new Regex("\\b(Anim|Animation System|Always Active|Attaching|Bot Tilt|Bomb|Camera Visuals|Catch Cutscene|Chase Offset|Controller|Cute Face|Director|Explosion|Eye|Eye Idle|Eye Target|Eye Tilt|Eye Tremble|Float|Fuse|Gas Checker|Gas Guider|Hair|Hair Lean|Hair Target|Hair Tilt|Heal Aura|Hive Attack|Lean|Local Camera|Loop|Old|Particle|Particle Puke Collision|Player Avatar Attached|Pupil|Screen Vein Effect|Sphere Effect|Stun Fly|Tentacle|Tilt|Up|Visual|Visuals)\\b.*$", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Dictionary NameMap = new Dictionary(StringComparer.OrdinalIgnoreCase) { ["Animal"] = "蟑螂", ["Enemy Animal"] = "蟑螂", ["Apex Predator"] = "邪恶鸭子", ["Bang"] = "炸弹骷髅", ["Banger"] = "炸弹骷髅", ["Enemy Bang"] = "炸弹骷髅", ["Baby"] = "扔东西小孩", ["Beamer"] = "激光小丑", ["Enemy Beamer"] = "激光小丑", ["Bella"] = "三轮车", ["Birthday Boy"] = "生日男孩", ["Enemy Birthday Boy"] = "生日男孩", ["Bomb Thrower"] = "疯狂厨师青蛙", ["Enemy Bomb Thrower"] = "疯狂厨师青蛙", ["Bowtie"] = "尖叫大白", ["Enemy Bowtie"] = "尖叫大白", ["Ceiling Eye"] = "邪恶大眼", ["Enemy Ceiling Eye"] = "邪恶大眼", ["Chef"] = "疯狂厨师青蛙", ["Cleanup Crew"] = "清洁工", ["Clown"] = "激光小丑", ["Dog"] = "小狗", ["Elsa"] = "小狗", ["Enemy Elsa"] = "小狗", ["Duck"] = "邪恶鸭子", ["Enemy Duck"] = "邪恶鸭子", ["Floater"] = "外星人", ["Enemy Floater"] = "外星人", ["Frog"] = "疯狂厨师青蛙", ["Gambit"] = "赌盘怪", ["Gnome"] = "红帽子侏儒", ["Gnomes"] = "红帽子侏儒", ["Enemy Gnome"] = "红帽子侏儒", ["Head"] = "咬人骷髅头", ["Enemy Head"] = "咬人骷髅头", ["Head Grabber"] = "抢头怪", ["Enemy Head Grabber"] = "抢头怪", ["Headgrab"] = "抢头怪", ["Headman"] = "咬人骷髅头", ["Heart Hugger"] = "爱心花", ["Enemy Heart Hugger"] = "爱心花", ["Hidden"] = "隐身怪", ["Enemy Hidden"] = "隐身怪", ["Hunter"] = "猎人", ["Huntsman"] = "猎人", ["Enemy Hunter"] = "猎人", ["Loom"] = "拍手女", ["Mentalist"] = "外星人", ["Oogly"] = "绿灯怪", ["Enemy Oogly"] = "绿灯怪", ["Peeper"] = "邪恶大眼", ["Peeper Ceiling Eye"] = "邪恶大眼", ["Reaper"] = "电锯小丑", ["Robe"] = "长袍无脸男", ["Enemy Robe"] = "长袍无脸男", ["Rugrat"] = "熊孩子", ["Runner"] = "电锯小丑", ["Enemy Runner"] = "电锯小丑", ["Shadow"] = "拍手女", ["Enemy Shadow"] = "拍手女", ["Shadow Child"] = "娃娃脸小孩", ["Slow Mouth"] = "呕吐怪", ["Enemy Slow Mouth"] = "呕吐怪", ["Slow Walker"] = "大锤版钟馗", ["Enemy Slow Walker"] = "大锤版钟馗", ["Spewer"] = "呕吐怪", ["Spinny"] = "赌盘怪", ["Enemy Spinny"] = "赌盘怪", ["Thin Man"] = "娃娃脸小孩", ["Enemy Thin Man"] = "娃娃脸小孩", ["Tick"] = "吸血虫", ["Enemy Tick"] = "吸血虫", ["Tricycle"] = "三轮车", ["Enemy Tricycle"] = "三轮车", ["Trudge"] = "大锤版钟馗", ["Tumbler"] = "疯狂厨师青蛙", ["Enemy Tumbler"] = "疯狂厨师青蛙", ["Upscream"] = "尖叫", ["Enemy Upscream"] = "尖叫", ["Valuable Thrower"] = "熊孩子", ["Enemy Valuable Thrower"] = "熊孩子", ["Reaper Runner"] = "追击收割者", ["Soldier"] = "士兵", ["Soldier Ghost"] = "幽灵士兵", ["Gusher"] = "喷酸虫", ["Roaster"] = "喷火虫", ["Voodoo"] = "巫毒娃娃", ["Lost droid"] = "迷失的机器人", ["Droid"] = "机器人", ["Destroyer"] = "毁灭者", ["Rolling Giant"] = "滚动巨人", ["Lost Destroyer"] = "迷失的毁灭者", ["Carnivore"] = "肉食者", ["Rugrats"] = "淘气小兵" }; public static string Translate(string rawName) { if (string.IsNullOrWhiteSpace(rawName)) { return string.Empty; } string text = rawName.Trim(); if (NameMap.TryGetValue(text, out var value)) { return value; } string text2 = NormalizeKey(text); if (NameMap.TryGetValue(text2, out value)) { return value; } string text3 = SimplifyEnemyComponentName(text2); if (!string.Equals(text3, text2, StringComparison.OrdinalIgnoreCase) && NameMap.TryGetValue(text3, out value)) { return value; } Match match = GroupCountRegex.Match(text2); if (match.Success) { string value2 = match.Groups["count"].Value; string text4 = match.Groups["name"].Value.Trim(); string text5 = (text4.EndsWith("s", StringComparison.OrdinalIgnoreCase) ? text4.Substring(0, text4.Length - 1) : text4); if (NameMap.TryGetValue(text4, out value)) { return value + " x" + value2; } if (NameMap.TryGetValue(text5, out value)) { return value + " x" + value2; } string key = SimplifyEnemyComponentName(text4); if (NameMap.TryGetValue(key, out value)) { return value + " x" + value2; } string key2 = SimplifyEnemyComponentName(text5); if (NameMap.TryGetValue(key2, out value)) { return value + " x" + value2; } return text4 + " x" + value2; } return text; } private static string NormalizeKey(string rawName) { string input = rawName.Replace("(Clone)", string.Empty).Replace("Enemy Group - ", string.Empty).Replace("Enemy - ", string.Empty) .Replace("Group - ", string.Empty) .Replace("_", " ") .Replace("-", " ") .Trim(); input = CamelCaseBoundaryRegex.Replace(input, " "); input = LeadingEnemyRegex.Replace(input, string.Empty); return WhitespaceRegex.Replace(input, " ").Trim(); } private static string SimplifyEnemyComponentName(string cleaned) { if (string.IsNullOrWhiteSpace(cleaned)) { return string.Empty; } string text = ComponentSuffixRegex.Replace(cleaned, string.Empty).Trim(); if (!string.IsNullOrWhiteSpace(text)) { return text; } return cleaned; } } }