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.AI; 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.2")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+88f40fada1dcf82c6929456d75027e36eaea82ff")] [assembly: AssemblyProduct("Zichen-GameTools-1.0.2")] [assembly: AssemblyTitle("Zichen-GameTools-1.0.2")] [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.2")] 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, Other } 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) && IsWingsShouldActive() && !_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 = IsWingsShouldActive(); } } 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_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0aaf: Unknown result type (might be due to invalid IL or missing references) //IL_0ab6: Expected O, but got Unknown //IL_0e60: Unknown result type (might be due to invalid IL or missing references) //IL_0e67: Expected O, but got Unknown //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Expected O, but got Unknown //IL_0d08: Unknown result type (might be due to invalid IL or missing references) //IL_0d0d: Unknown result type (might be due to invalid IL or missing references) //IL_0d0f: Unknown result type (might be due to invalid IL or missing references) //IL_0d14: Unknown result type (might be due to invalid IL or missing references) //IL_0d37: Unknown result type (might be due to invalid IL or missing references) //IL_0d39: Unknown result type (might be due to invalid IL or missing references) //IL_0ce0: Unknown result type (might be due to invalid IL or missing references) //IL_0ef2: Unknown result type (might be due to invalid IL or missing references) //IL_0ef7: Unknown result type (might be due to invalid IL or missing references) //IL_0ded: Unknown result type (might be due to invalid IL or missing references) //IL_0dca: Unknown result type (might be due to invalid IL or missing references) //IL_0dcc: Unknown result type (might be due to invalid IL or missing references) //IL_0d89: Unknown result type (might be due to invalid IL or missing references) //IL_0d8b: Unknown result type (might be due to invalid IL or missing references) //IL_0e09: Unknown result type (might be due to invalid IL or missing references) 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; } bool flag2 = IsWingsShouldActive(); if (PlayerAvatarUpgradeTumbleWingsVisualsActiveRef.Invoke(__instance) != flag2) { __instance.UpgradeTumbleWingsVisualsActive(flag2, false); PlayerAvatarUpgradeTumbleWingsVisualsActiveRef.Invoke(__instance) = flag2; } 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) { Hashtable val = new Hashtable(); bool flag3 = false; bool flag4 = false; if (((Dictionary)(object)PhotonNetwork.LocalPlayer.CustomProperties).TryGetValue((object)"GT_WingsAlwaysShow", out object value4) && value4 is bool) { flag4 = (bool)value4; } if (flag4 != flag) { val[(object)"GT_WingsAlwaysShow"] = flag; flag3 = true; } int num = 0; if (((Dictionary)(object)PhotonNetwork.LocalPlayer.CustomProperties).TryGetValue((object)"GT_WingsColorIndex", out object value5)) { num = SafeConvertToInt(value5); } int wingsColorIndex = GetWingsColorIndex(); if (num != wingsColorIndex) { val[(object)"GT_WingsColorIndex"] = wingsColorIndex; flag3 = true; } if (flag3) { PhotonNetwork.LocalPlayer.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } } } else { if ((Object)(object)__instance.playerAvatarVisuals != (Object)null && ((Component)__instance.playerAvatarVisuals).transform.localScale != Vector3.one) { ((Component)__instance.playerAvatarVisuals).transform.localScale = Vector3.one; } bool flag5 = false; int num2 = 0; if (PhotonNetwork.InRoom && (Object)(object)__instance.photonView != (Object)null && __instance.photonView.Owner != null) { Player owner = __instance.photonView.Owner; if (((Dictionary)(object)owner.CustomProperties).TryGetValue((object)"GT_WingsAlwaysShow", out object value6) && value6 is bool) { flag5 = (bool)value6; } if (((Dictionary)(object)owner.CustomProperties).TryGetValue((object)"GT_WingsColorIndex", out object value7)) { num2 = SafeConvertToInt(value7); } } else { flag5 = IsWingsAlwaysShowEnabled(); num2 = GetWingsColorIndex(); } if (flag5 && IsTab2Enabled()) { float num3 = ((num2 == 1) ? 2f : 3f); int num4 = ((num2 == 1) ? 2 : 3); if (PlayerAvatarUpgradeTumbleWingsRef.Invoke(__instance) != num3) { PlayerAvatarUpgradeTumbleWingsRef.Invoke(__instance) = num3; } if (!PlayerAvatarUpgradeTumbleWingsVisualsActiveRef.Invoke(__instance)) { PlayerAvatarUpgradeTumbleWingsVisualsActiveRef.Invoke(__instance) = true; } if (PhotonNetwork.IsMasterClient && (Object)(object)StatsManager.instance != (Object)null && !string.IsNullOrEmpty(text)) { int value8 = 0; StatsManager.instance.playerUpgradeTumbleWings.TryGetValue(text, out value8); if (value8 != num4) { if (!_originalWingsLevel.ContainsKey(text)) { _originalWingsLevel[text] = value8; } StatsManager.instance.playerUpgradeTumbleWings[text] = num4; SemiFunc.StatSyncAll(); } } } else { 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 value9)) { StatsManager.instance.playerUpgradeTumbleWings[text] = value9; _originalWingsLevel.Remove(text); SemiFunc.StatSyncAll(); } } } if (!PhotonNetwork.InRoom) { return; } string text2 = PlayerAvatarSteamIDRef.Invoke(__instance); bool flag6 = PlayerAvatarDeadSetRef.Invoke(__instance); if (PlayerAvatarIsLocalRef.Invoke(__instance) && !string.IsNullOrEmpty(text2)) { if (flag6) { string key = "GT_ReqRevive_" + text2; bool flag7 = false; Player[] playerList = PhotonNetwork.PlayerList; foreach (Player val2 in playerList) { if (val2 != null && ((Dictionary)(object)val2.CustomProperties).TryGetValue((object)key, out object value10) && value10 is bool && (bool)value10) { flag7 = true; break; } } if (flag7) { try { __instance.Revive(false); Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)("[GameTools] Self-revived by remote request: " + text2)); } } catch (Exception arg) { Plugin instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogWarning((object)$"[Self Revive Error]: {arg}"); } } } } else { string key2 = "GT_ReqKill_" + text2; bool flag8 = false; Player[] playerList = PhotonNetwork.PlayerList; foreach (Player val3 in playerList) { if (val3 != null && ((Dictionary)(object)val3.CustomProperties).TryGetValue((object)key2, out object value11) && value11 is bool && (bool)value11) { flag8 = true; break; } } if (flag8) { try { __instance.PlayerDeath(-1); Plugin instance3 = Instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogInfo((object)("[GameTools] Self-killed by remote request: " + text2)); } } catch (Exception arg2) { Plugin instance4 = Instance; if (instance4 != null) { ((BaseUnityPlugin)instance4).Logger.LogWarning((object)$"[Self Kill Error]: {arg2}"); } } } } if (!flag6 && (Object)(object)__instance.playerHealth != (Object)null) { string key3 = "GT_ReqHeal_" + text2; bool flag9 = false; Player[] playerList = PhotonNetwork.PlayerList; foreach (Player val4 in playerList) { if (val4 != null && ((Dictionary)(object)val4.CustomProperties).TryGetValue((object)key3, out object value12) && value12 is bool && (bool)value12) { flag9 = true; break; } } if (flag9) { try { int num5 = PlayerHealthMaxRef.Invoke(__instance.playerHealth); __instance.playerHealth.Heal(num5, true); Plugin instance5 = Instance; if (instance5 != null) { ((BaseUnityPlugin)instance5).Logger.LogInfo((object)("[GameTools] Self-healed by remote request: " + text2)); } } catch (Exception arg3) { Plugin instance6 = Instance; if (instance6 != null) { ((BaseUnityPlugin)instance6).Logger.LogWarning((object)$"[Self Heal Error]: {arg3}"); } } } } } if (IsTab1Enabled() && PhotonNetwork.IsMasterClient && !string.IsNullOrEmpty(text2)) { bool flag10 = false; if ((Object)(object)__instance.photonView != (Object)null && __instance.photonView.Owner != null && ((Dictionary)(object)__instance.photonView.Owner.CustomProperties).TryGetValue((object)"GT_Active", out object value13) && value13 is bool && (bool)value13) { flag10 = true; } if (!flag10) { if (flag6) { string key4 = "GT_ReqRevive_" + text2; bool flag11 = false; Player[] playerList = PhotonNetwork.PlayerList; foreach (Player val5 in playerList) { if (val5 != null && ((Dictionary)(object)val5.CustomProperties).TryGetValue((object)key4, out object value14) && value14 is bool && (bool)value14) { flag11 = true; break; } } if (flag11 && (Object)(object)__instance.photonView != (Object)null) { try { __instance.photonView.RPC("ReviveRPC", (RpcTarget)0, new object[1] { false }); Plugin instance7 = Instance; if (instance7 != null) { ((BaseUnityPlugin)instance7).Logger.LogInfo((object)("[GameTools] Host proxy-revived vanilla player: " + text2)); } } catch (Exception arg4) { Plugin instance8 = Instance; if (instance8 != null) { ((BaseUnityPlugin)instance8).Logger.LogWarning((object)$"[Host Proxy Revive Error]: {arg4}"); } } } } else { string key5 = "GT_ReqKill_" + text2; bool flag12 = false; Player[] playerList = PhotonNetwork.PlayerList; foreach (Player val6 in playerList) { if (val6 != null && ((Dictionary)(object)val6.CustomProperties).TryGetValue((object)key5, out object value15) && value15 is bool && (bool)value15) { flag12 = true; break; } } if (flag12 && (Object)(object)__instance.photonView != (Object)null) { try { __instance.photonView.RPC("PlayerDeathRPC", (RpcTarget)0, new object[1] { -1 }); Plugin instance9 = Instance; if (instance9 != null) { ((BaseUnityPlugin)instance9).Logger.LogInfo((object)("[GameTools] Host proxy-killed vanilla player: " + text2)); } } catch (Exception arg5) { Plugin instance10 = Instance; if (instance10 != null) { ((BaseUnityPlugin)instance10).Logger.LogWarning((object)$"[Host Proxy Kill Error]: {arg5}"); } } } } if (!flag6 && (Object)(object)__instance.playerHealth != (Object)null) { string key6 = "GT_ReqHeal_" + text2; bool flag13 = false; Player[] playerList = PhotonNetwork.PlayerList; foreach (Player val7 in playerList) { if (val7 != null && ((Dictionary)(object)val7.CustomProperties).TryGetValue((object)key6, out object value16) && value16 is bool && (bool)value16) { flag13 = true; break; } } if (flag13 && (Object)(object)__instance.photonView != (Object)null) { try { int num6 = PlayerHealthMaxRef.Invoke(__instance.playerHealth); __instance.photonView.RPC("UpdateHealthRPC", (RpcTarget)0, new object[4] { num6, num6, true, false }); Plugin instance11 = Instance; if (instance11 != null) { ((BaseUnityPlugin)instance11).Logger.LogInfo((object)("[GameTools] Host proxy-healed vanilla player: " + text2)); } } catch (Exception arg6) { Plugin instance12 = Instance; if (instance12 != null) { ((BaseUnityPlugin)instance12).Logger.LogWarning((object)$"[Host Proxy Heal Error]: {arg6}"); } } } } } } if (PlayerAvatarIsLocalRef.Invoke(__instance)) { List list = SemiFunc.PlayerGetList(); if (list != null) { Hashtable val8 = new Hashtable(); bool flag14 = false; foreach (PlayerAvatar item in list) { if ((Object)(object)item == (Object)null) { continue; } string text3 = PlayerAvatarSteamIDRef.Invoke(item); if (string.IsNullOrEmpty(text3)) { continue; } bool num7 = PlayerAvatarDeadSetRef.Invoke(item); if (!num7) { string text4 = "GT_ReqRevive_" + text3; if (((Dictionary)(object)PhotonNetwork.LocalPlayer.CustomProperties).TryGetValue((object)text4, out object value17) && value17 is bool && (bool)value17) { val8[(object)text4] = null; flag14 = true; } } else { string text5 = "GT_ReqKill_" + text3; if (((Dictionary)(object)PhotonNetwork.LocalPlayer.CustomProperties).TryGetValue((object)text5, out object value18) && value18 is bool && (bool)value18) { val8[(object)text5] = null; flag14 = true; } } if (num7 || !((Object)(object)item.playerHealth != (Object)null)) { continue; } int num8 = PlayerHealthCurrentRef.Invoke(item.playerHealth); int num9 = PlayerHealthMaxRef.Invoke(item.playerHealth); if (num8 >= num9) { string text6 = "GT_ReqHeal_" + text3; if (((Dictionary)(object)PhotonNetwork.LocalPlayer.CustomProperties).TryGetValue((object)text6, out object value19) && value19 is bool && (bool)value19) { val8[(object)text6] = null; flag14 = true; } } } if (flag14) { PhotonNetwork.LocalPlayer.SetCustomProperties(val8, (Hashtable)null, (WebFlags)null); Plugin instance13 = Instance; if (instance13 != null) { ((BaseUnityPlugin)instance13).Logger.LogInfo((object)"[GameTools] Cleared resolved player control requests."); } } } } if (PlayerAvatarIsLocalRef.Invoke(__instance)) { string text7 = PlayerAvatarSteamIDRef.Invoke(__instance); if (!string.IsNullOrEmpty(text7)) { string key7 = "GT_ReqTeleport_" + text7; Vector3? val9 = null; Player[] playerList = PhotonNetwork.PlayerList; foreach (Player val10 in playerList) { if (val10 != null && ((Dictionary)(object)val10.CustomProperties).TryGetValue((object)key7, out object value20) && value20 is float[] array && array.Length == 3) { val9 = new Vector3(array[0], array[1], array[2]); break; } } if (val9.HasValue) { Vector3 value21 = val9.Value; if (Vector3.Distance(_lastRemoteTpPos, value21) > 0.5f || Time.time - _lastRemoteTpTime > 1f) { _lastRemoteTpPos = value21; _lastRemoteTpTime = Time.time; try { if (PlayerAvatarDeadSetRef.Invoke(__instance)) { PlayerDeathHead val11 = PlayerAvatarPlayerDeathHeadRef.Invoke(__instance); if ((Object)(object)val11 != (Object)null) { PhysGrabObject val12 = PlayerDeathHeadPhysGrabObjectRef.Invoke(val11); if ((Object)(object)val12 != (Object)null) { val12.Teleport(value21, Quaternion.identity); } } } else { PlayerTumble val13 = PlayerAvatarTumbleRef.Invoke(__instance); if ((Object)(object)val13 != (Object)null) { PhysGrabObject val14 = PlayerTumblePhysGrabObjectRef.Invoke(val13); if ((Object)(object)val14 != (Object)null) { val14.Teleport(value21, Quaternion.identity); } } } if ((Object)(object)PlayerController.instance != (Object)null) { ((Component)PlayerController.instance).transform.position = value21; } Plugin instance14 = Instance; if (instance14 != null) { ((BaseUnityPlugin)instance14).Logger.LogInfo((object)$"[GameTools] Teleported self locally by remote request to {value21}"); } } catch (Exception arg7) { Plugin instance15 = Instance; if (instance15 != null) { ((BaseUnityPlugin)instance15).Logger.LogWarning((object)$"[Self Teleport By Remote Error]: {arg7}"); } } } } } } if (!PlayerAvatarIsLocalRef.Invoke(__instance)) { return; } List list2 = SemiFunc.PlayerGetList(); if (list2 == null) { return; } Hashtable val15 = new Hashtable(); bool flag15 = false; Vector3 val16 = default(Vector3); foreach (PlayerAvatar item2 in list2) { if ((Object)(object)item2 == (Object)null) { continue; } string text8 = PlayerAvatarSteamIDRef.Invoke(item2); if (string.IsNullOrEmpty(text8)) { continue; } string text9 = "GT_ReqTeleport_" + text8; if (((Dictionary)(object)PhotonNetwork.LocalPlayer.CustomProperties).TryGetValue((object)text9, out object value22) && value22 is float[] array2 && array2.Length == 3) { ((Vector3)(ref val16))..ctor(array2[0], array2[1], array2[2]); if (Vector3.Distance(GetPlayerPosition(item2), val16) < 3f) { val15[(object)text9] = null; flag15 = true; } } } if (flag15) { PhotonNetwork.LocalPlayer.SetCustomProperties(val15, (Hashtable)null, (WebFlags)null); Plugin instance16 = Instance; if (instance16 != null) { ((BaseUnityPlugin)instance16).Logger.LogInfo((object)"[GameTools] Cleared resolved teleport requests."); } } } catch (Exception arg8) { Plugin instance17 = Instance; if (instance17 != null) { ((BaseUnityPlugin)instance17).Logger.LogWarning((object)$"[PlayerAvatar.Update.Postfix Error]: {arg8}"); } } } } [HarmonyPatch(typeof(PlayerController), "Update")] private class PlayerController_Update_Patch { private static float _originalJumpForce = -1f; private static bool _prevGodModeFlightEnabled = false; [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; } UpdateGodModeFlight(__instance); UpdateAllTeammatesGodMode(); } } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[PlayerController.Update.JumpForce Patch Error]: {arg}"); } } } private static void UpdateGodModeFlight(PlayerController player) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: 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_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: 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_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) if (IsStaticModEnabled() && IsGodModeFlightEnabled()) { if (!_prevGodModeFlightEnabled) { _prevGodModeFlightEnabled = true; if ((Object)(object)PlayerAvatar.instance != (Object)null) { string text = PlayerAvatarSteamIDRef.Invoke(PlayerAvatar.instance); if (!string.IsNullOrEmpty(text)) { SetPlayerGodMode(text, enable: true); } } } if ((Object)(object)player.playerAvatarScript != (Object)null) { bool num = AccessTools.FieldRefAccess("isTumbling").Invoke(player.playerAvatarScript); PlayerTumble val = AccessTools.FieldRefAccess("tumble").Invoke(player.playerAvatarScript); if (num && (Object)(object)val != (Object)null) { val.TumbleRequest(false, false); } } if ((Object)(object)player.rb != (Object)null) { player.rb.isKinematic = true; player.rb.useGravity = false; player.rb.velocity = Vector3.zero; } if ((Object)(object)player.col != (Object)null && player.col.enabled) { player.col.enabled = false; } float num2 = 12f; if (SemiFunc.InputHold((InputKey)15) || player.sprinting) { num2 = 28f; } float num3 = SemiFunc.InputMovementX(); float num4 = SemiFunc.InputMovementY(); Vector3 val2 = Vector3.zero; Camera main = Camera.main; if ((Object)(object)main != (Object)null) { Vector3 forward = ((Component)main).transform.forward; Vector3 right = ((Component)main).transform.right; val2 += forward * num4; val2 += right * num3; } else { val2 += ((Component)player).transform.forward * num4; val2 += ((Component)player).transform.right * num3; } if (SemiFunc.InputHold((InputKey)1)) { val2 += Vector3.up; } if (SemiFunc.InputHold((InputKey)12)) { val2 -= Vector3.up; } if (((Vector3)(ref val2)).sqrMagnitude > 0.001f) { Transform transform = ((Component)player).transform; transform.position += ((Vector3)(ref val2)).normalized * num2 * Time.deltaTime; } } else { if (!_prevGodModeFlightEnabled) { return; } _prevGodModeFlightEnabled = false; if ((Object)(object)PlayerAvatar.instance != (Object)null) { string text2 = PlayerAvatarSteamIDRef.Invoke(PlayerAvatar.instance); if (!string.IsNullOrEmpty(text2)) { SetPlayerGodMode(text2, enable: false); } } if ((Object)(object)player.rb != (Object)null) { player.rb.isKinematic = false; player.rb.useGravity = true; } if ((Object)(object)player.col != (Object)null) { player.col.enabled = true; } } } } [HarmonyPatch(typeof(ItemUpgradePlayerTumbleWingsLogic), "LoopSound")] private class ItemUpgradePlayerTumbleWingsLogic_LoopSound_Patch { [HarmonyPrefix] private static bool Prefix(ItemUpgradePlayerTumbleWingsLogic __instance) { if (!IsWingsSoundEnabled()) { try { if (__instance.soundWingsLoop != null) { __instance.soundWingsLoop.PlayLoop(false, 2f, 2f, 1f, 1f); } } catch { } return false; } return true; } } [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 (!IsTab3Enabled() || (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 Postfix Error]: {arg}"); } } } } [HarmonyPatch(typeof(EnemyDirector), "AmountSetup")] private class EnemyDirector_AmountSetup_Patch { [HarmonyPostfix] private static void Postfix(EnemyDirector __instance) { if (!IsTab4Enabled() || (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; } } [HarmonyPatch(typeof(PlayerHealth), "Hurt")] private class PlayerHealth_Hurt_Patch { [HarmonyPrefix] private static bool Prefix(PlayerHealth __instance) { if (!IsStaticModEnabled()) { return true; } try { PlayerAvatar val = PlayerHealthAvatarRef.Invoke(__instance); if ((Object)(object)val != (Object)null && PlayerAvatarIsLocalRef.Invoke(val) && IsPlayerGodMode(PlayerAvatarSteamIDRef.Invoke(val))) { PlayerHealthCurrentRef.Invoke(__instance) = PlayerHealthMaxRef.Invoke(__instance); return false; } } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[PlayerHealth.Hurt Patch Error]: {arg}"); } } return true; } } [HarmonyPatch(typeof(PlayerHealth), "Update")] private class PlayerHealth_Update_Patch { [HarmonyPrefix] private static void Prefix(PlayerHealth __instance) { if (!IsStaticModEnabled()) { return; } try { PlayerAvatar val = PlayerHealthAvatarRef.Invoke(__instance); if ((Object)(object)val != (Object)null && PlayerAvatarIsLocalRef.Invoke(val) && IsPlayerGodMode(PlayerAvatarSteamIDRef.Invoke(val))) { int num = PlayerHealthMaxRef.Invoke(__instance); if (PlayerHealthCurrentRef.Invoke(__instance) < num) { PlayerHealthCurrentRef.Invoke(__instance) = num; } } } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[PlayerHealth.Update Patch Error]: {arg}"); } } } } [HarmonyPatch(typeof(CameraPosition), "Awake")] private class CameraPosition_Awake_Patch { [HarmonyPostfix] private static void Postfix() { CameraPosition_Update_Patch.ResetState(); } } [HarmonyPatch(typeof(CameraPosition), "Update")] private class CameraPosition_Update_Patch { private static bool _prevThirdPersonEnabled = false; private static Vector3 _lastMainCamLocalPos = Vector3.zero; public static void ResetState() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) _prevThirdPersonEnabled = false; _lastMainCamLocalPos = Vector3.zero; } [HarmonyPrefix] private static void Prefix(CameraPosition __instance) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) if (!IsStaticModEnabled()) { return; } try { bool flag = IsThirdPersonEnabled(); bool flag2 = CameraPositionOverridePositionActiveRef.Invoke(__instance) || CameraPositionOverridePositionTimerRef.Invoke(__instance) > 0f; if ((Object)(object)PlayerAvatar.instance != (Object)null && PlayerAvatarIsLocalRef.Invoke(PlayerAvatar.instance) && flag && _prevThirdPersonEnabled && !flag2) { Camera main = Camera.main; if ((Object)(object)main != (Object)null) { ((Component)main).transform.localPosition = _lastMainCamLocalPos; } } } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[CameraPosition.Update Prefix Patch Error]: {arg}"); } } } [HarmonyPostfix] private static void Postfix(CameraPosition __instance) { //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0267: 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_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) if (!IsStaticModEnabled()) { return; } try { bool flag = IsThirdPersonEnabled(); bool flag2 = CameraPositionOverridePositionActiveRef.Invoke(__instance) || CameraPositionOverridePositionTimerRef.Invoke(__instance) > 0f; if (!((Object)(object)PlayerAvatar.instance != (Object)null) || !PlayerAvatarIsLocalRef.Invoke(PlayerAvatar.instance)) { return; } if (flag && !flag2) { Camera main = Camera.main; if (!((Object)(object)main != (Object)null)) { return; } if (!_prevThirdPersonEnabled) { _prevThirdPersonEnabled = true; _lastMainCamLocalPos = ((Component)main).transform.localPosition; } if ((Object)(object)PlayerAvatar.instance.playerAvatarVisuals != (Object)null) { PlayerAvatar.instance.playerAvatarVisuals.ShowSelfOverride(0.5f); float thirdPersonModelScale = GetThirdPersonModelScale(); ((Component)PlayerAvatar.instance.playerAvatarVisuals).transform.localScale = new Vector3(thirdPersonModelScale, thirdPersonModelScale, thirdPersonModelScale); } PhysGrabber physGrabber = PlayerAvatar.instance.physGrabber; if (physGrabber != null) { physGrabber.SetThirdPerson(true); } FlashlightController flashlightController = PlayerAvatar.instance.flashlightController; if (flashlightController != null) { flashlightController.SetThirdPerson(true); } if ((Object)(object)PlayerAvatar.instance.playerAvatarVisuals != (Object)null) { PlayerAvatarRightArm val = PlayerAvatarVisualsRightArmRef.Invoke(PlayerAvatar.instance.playerAvatarVisuals); if ((Object)(object)val != (Object)null && (Object)(object)val.grabberOrb != (Object)null) { ((Component)val.grabberOrb).gameObject.SetActive(false); } } _lastMainCamLocalPos = ((Component)main).transform.localPosition; Vector3 position = ((Component)main).transform.position; Quaternion rotation = ((Component)main).transform.rotation; float thirdPersonDistance = GetThirdPersonDistance(); float thirdPersonHeight = GetThirdPersonHeight(); float thirdPersonHorizontal = GetThirdPersonHorizontal(); Vector3 val2 = rotation * Vector3.forward; Vector3 val3 = rotation * Vector3.right; Vector3 val4 = -val2 * thirdPersonDistance + Vector3.up * thirdPersonHeight + val3 * thirdPersonHorizontal; float magnitude = ((Vector3)(ref val4)).magnitude; Vector3 normalized = ((Vector3)(ref val4)).normalized; Vector3 position2 = position + val4; int mask = LayerMask.GetMask(new string[3] { "Default", "World", "Terrain" }); RaycastHit val5 = default(RaycastHit); if (Physics.SphereCast(position, 0.2f, normalized, ref val5, magnitude, mask, (QueryTriggerInteraction)1)) { position2 = position + normalized * Mathf.Max(0.1f, ((RaycastHit)(ref val5)).distance - 0.05f); } ((Component)main).transform.position = position2; } else { if (!_prevThirdPersonEnabled) { return; } _prevThirdPersonEnabled = false; Camera main2 = Camera.main; if ((Object)(object)main2 != (Object)null) { ((Component)main2).transform.localPosition = _lastMainCamLocalPos; } if ((Object)(object)PlayerAvatar.instance.playerAvatarVisuals != (Object)null) { PlayerAvatar.instance.playerAvatarVisuals.ShowSelfOverride(0f); ((Component)PlayerAvatar.instance.playerAvatarVisuals).transform.localScale = Vector3.one; } if (!flag) { PhysGrabber physGrabber2 = PlayerAvatar.instance.physGrabber; if (physGrabber2 != null) { physGrabber2.SetThirdPerson(false); } FlashlightController flashlightController2 = PlayerAvatar.instance.flashlightController; if (flashlightController2 != null) { flashlightController2.SetThirdPerson(false); } } } } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[CameraPosition.Update Postfix Patch Error]: {arg}"); } } } } [HarmonyPatch(typeof(FlashlightController), "Update")] private class FlashlightController_Update_Patch { [HarmonyPostfix] private static void Postfix(FlashlightController __instance) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) if (!IsStaticModEnabled()) { return; } try { if ((Object)(object)__instance.PlayerAvatar != (Object)null && PlayerAvatarIsLocalRef.Invoke(__instance.PlayerAvatar) && IsThirdPersonEnabled() && (Object)(object)__instance.FollowTransformClient != (Object)null) { float num = AccessTools.FieldRefAccess("hiddenScale").Invoke(__instance); ((Component)__instance).transform.position = __instance.FollowTransformClient.position; ((Component)__instance).transform.rotation = __instance.FollowTransformClient.rotation; ((Component)__instance).transform.localScale = __instance.FollowTransformClient.localScale * num * GetThirdPersonModelScale(); if ((Object)(object)__instance.meshShadows != (Object)null) { ((Component)__instance.meshShadows).transform.position = __instance.FollowTransformClient.position; ((Component)__instance.meshShadows).transform.rotation = __instance.FollowTransformClient.rotation; ((Component)__instance.meshShadows).transform.localScale = ((Component)__instance.mesh).transform.localScale * GetThirdPersonModelScale(); } } } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[FlashlightController.Update Postfix Patch Error]: {arg}"); } } } } [HarmonyPatch(typeof(InputManager))] private class InputManager_Block_Patch { [HarmonyPrefix] [HarmonyPatch("KeyDown")] private static bool PrefixKeyDown(ref bool __result) { if (IsStaticModEnabled() && IsWindowOpen()) { __result = false; return false; } return true; } [HarmonyPrefix] [HarmonyPatch("KeyUp")] private static bool PrefixKeyUp(ref bool __result) { if (IsStaticModEnabled() && IsWindowOpen()) { __result = false; return false; } return true; } [HarmonyPrefix] [HarmonyPatch("KeyHold")] private static bool PrefixKeyHold(ref bool __result) { if (IsStaticModEnabled() && IsWindowOpen()) { __result = false; return false; } return true; } [HarmonyPrefix] [HarmonyPatch("GetMovementX")] private static bool PrefixGetMovementX(ref float __result) { if (IsStaticModEnabled() && IsWindowOpen()) { __result = 0f; return false; } return true; } [HarmonyPrefix] [HarmonyPatch("GetMovementY")] private static bool PrefixGetMovementY(ref float __result) { if (IsStaticModEnabled() && IsWindowOpen()) { __result = 0f; return false; } return true; } [HarmonyPrefix] [HarmonyPatch("GetScrollY")] private static bool PrefixGetScrollY(ref float __result) { if (IsStaticModEnabled() && IsWindowOpen()) { __result = 0f; return false; } return true; } [HarmonyPrefix] [HarmonyPatch("KeyPullAndPush")] private static bool PrefixKeyPullAndPush(ref float __result) { if (IsStaticModEnabled() && IsWindowOpen()) { __result = 0f; 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.2"; internal static Plugin Instance; internal static Vector3 _lastRemoteTpPos = Vector3.zero; internal static float _lastRemoteTpTime = 0f; 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 PlayerAvatarPlayerDeathHeadRef = AccessTools.FieldRefAccess("playerDeathHead"); internal static readonly FieldRef PlayerDeathHeadPhysGrabObjectRef = AccessTools.FieldRefAccess("physGrabObject"); 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 PlayerHealthCurrentRef = AccessTools.FieldRefAccess("health"); internal static readonly FieldRef PlayerHealthMaxRef = AccessTools.FieldRefAccess("maxHealth"); internal static readonly FieldRef PlayerHealthAvatarRef = AccessTools.FieldRefAccess("playerAvatar"); internal static readonly FieldRef CursorManagerUnlockTimerRef = AccessTools.FieldRefAccess("unlockTimer"); internal static readonly FieldRef RunManagerLevelIsShopRef = AccessTools.FieldRefAccess("levelIsShop"); internal static readonly FieldRef EnemyNavMeshAgentAgentRef = AccessTools.FieldRefAccess("Agent"); internal static readonly FieldRef EnemyHasRigidbodyRef = AccessTools.FieldRefAccess("HasRigidbody"); internal static readonly FieldRef EnemyRigidbodyRef = AccessTools.FieldRefAccess("Rigidbody"); internal static readonly FieldRef EnemyRigidbodyRbRef = AccessTools.FieldRefAccess("rb"); internal static readonly FieldRef EnemyRigidbodyFollowTargetRef = AccessTools.FieldRefAccess("followTarget"); internal static readonly FieldRef EnemyRigidbodyPhysGrabObjectRef = AccessTools.FieldRefAccess("physGrabObject"); 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"); internal static readonly FieldRef PlayerAvatarVisualsRightArmRef = AccessTools.FieldRefAccess("playerAvatarRightArm"); internal static readonly FieldRef CameraPositionOverridePositionActiveRef = AccessTools.FieldRefAccess("overridePositionActive"); internal static readonly FieldRef CameraPositionOverridePositionTimerRef = AccessTools.FieldRefAccess("overridePositionTimer"); 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 _cfgProhibitOthers; private static ConfigEntry _cfgLanguage; private ConfigEntry _openKey; private static ConfigEntry _cfgWingsAlwaysShow; private static ConfigEntry _cfgEnableWingsSound; private static ConfigEntry _cfgJumpMultiplierEnabled; private static ConfigEntry _cfgJumpMultiplier; private static ConfigEntry _cfgTumbleFlyEnabled; private static ConfigEntry _cfgInfiniteWeaponBattery; private static ConfigEntry _cfgSpawnRateMultiplier; private static ConfigEntry _cfgRemovePillarLimit; private static ConfigEntry _cfgAutoReviveTeammates; private static ConfigEntry _cfgLimitActionAndOvercharge; internal static ConfigEntry _cfgResetMonsterDataOnLevelLoad; private static ConfigEntry _cfgWingsColorIndex; private static ConfigEntry _cfgWingsShowFrequency; private static ConfigEntry _cfgThirdPersonEnabled; private static ConfigEntry _cfgThirdPersonDistance; private static ConfigEntry _cfgThirdPersonHeight; private static ConfigEntry _cfgThirdPersonModelScale; internal static ConfigEntry _cfgThirdPersonHorizontal; private static ConfigEntry _cfgGodModeFlightEnabled; private static ConfigEntry _cfgAllTeammatesGodMode; private static readonly HashSet _processedGodModeTeammates = new HashSet(); private static readonly Dictionary _teammateDeathTimers = new Dictionary(); private static readonly HashSet _localGodModePlayers = new HashSet(); private static ConfigEntry _cfgTab0Enabled; private static ConfigEntry _cfgTab1Enabled; private static ConfigEntry _cfgTab2Enabled; private static ConfigEntry _cfgTab3Enabled; private static ConfigEntry _cfgTab4Enabled; internal static readonly Dictionary _enemyScaleDict = new Dictionary(); internal static EnemyScaleSync _enemyScaleSync; public static readonly Color[] WingsColors = (Color[])(object)new Color[9] { new Color(1f, 1f, 1f), new Color(1f, 0.15f, 0.15f), new Color(0.15f, 1f, 0.15f), new Color(0.15f, 0.3f, 1f), new Color(1f, 0.9f, 0.15f), new Color(0.7f, 0.15f, 1f), new Color(0.15f, 1f, 1f), new Color(1f, 0.4f, 0.7f), new Color(1f, 0.5f, 0f) }; private float _masterCheckTimer; 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); internal static GameObject _tempLevelGenGo; internal static GameObject _tempEnemyDirGo; 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 Vector2 _playerScrollPos = Vector2.zero; private static int _spawnCount = 1; internal static bool _cfgSpawnedAutoRespawn = false; internal static bool _cfgSpawnedDelayPull = true; 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 List _spawnablesOthers = new List(); private static List _spawnablesDrones = new List(); private static List _spawnablesCustomItems = new List(); private static List _spawnablesCustomEnemies = new List(); private static List _spawnablesCosmeticBoxes = new List(); private static bool _spawnablesLoaded = false; private static List _cachedCosmeticObjectSetups = new List(); 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, 1150f, 800f); private bool _windowCentered; private Vector2 _scrollPos = Vector2.zero; private bool _showConfirmSpawn; private SpawnableInfo _pendingSpawnInfo; private float _lastVirtualHeight = 400f; private string _spawnCountStr; 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 Texture2D _texMask; 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 IsWindowOpen() { if ((Object)(object)Instance != (Object)null) { return Instance._windowOpen; } return false; } public static bool IsProhibitedByHost() { try { if (PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null && !PhotonNetwork.IsMasterClient && PhotonNetwork.MasterClient != null && ((Dictionary)(object)PhotonNetwork.MasterClient.CustomProperties).TryGetValue((object)"GT_Active", out object value) && value is bool && (bool)value && ((Dictionary)(object)((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties).TryGetValue((object)"GT_ProhibitOthers", out object value2) && value2 is bool && (bool)value2) { return true; } } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[IsProhibitedByHost Error]: {arg}"); } } return false; } public static int SafeConvertToInt(object obj, int defaultValue = 0) { if (obj == null) { return defaultValue; } try { return Convert.ToInt32(obj); } catch { return defaultValue; } } public static bool IsStaticModEnabled() { if (_cfgModEnabled == null || !_cfgModEnabled.Value) { return false; } if (IsProhibitedByHost()) { return false; } return true; } public static bool IsTab0Enabled() { if (IsStaticModEnabled()) { if (_cfgTab0Enabled != null) { return _cfgTab0Enabled.Value; } return true; } return false; } public static bool IsTab1Enabled() { if (IsStaticModEnabled()) { if (_cfgTab1Enabled != null) { return _cfgTab1Enabled.Value; } return true; } return false; } public static bool IsTab2Enabled() { if (IsStaticModEnabled()) { if (_cfgTab2Enabled != null) { return _cfgTab2Enabled.Value; } return true; } return false; } public static bool IsTab3Enabled() { if (IsStaticModEnabled()) { if (_cfgTab3Enabled != null) { return _cfgTab3Enabled.Value; } return true; } return false; } public static bool IsTab4Enabled() { if (IsStaticModEnabled()) { if (_cfgTab4Enabled != null) { return _cfgTab4Enabled.Value; } return true; } return false; } public static bool UseChinese() { if (_cfgLanguage != null) { return _cfgLanguage.Value == DisplayLanguage.中文; } return false; } public static float GetSpawnRateMultiplier() { if (_cfgSpawnRateMultiplier == null || !IsTab4Enabled()) { return 1f; } return _cfgSpawnRateMultiplier.Value; } public static bool IsWingsAlwaysShowEnabled() { if (IsTab2Enabled() && _cfgWingsAlwaysShow != null) { return _cfgWingsAlwaysShow.Value; } return false; } public static bool IsWingsSoundEnabled() { if (IsTab2Enabled() && _cfgEnableWingsSound != null) { return _cfgEnableWingsSound.Value; } return true; } public static bool IsJumpMultiplierEnabled() { if (IsTab2Enabled() && _cfgJumpMultiplierEnabled != null) { return _cfgJumpMultiplierEnabled.Value; } return false; } public static float GetJumpMultiplier() { if (_cfgJumpMultiplier == null) { return 1f; } return _cfgJumpMultiplier.Value; } public static bool IsTumbleFlyEnabled() { if (IsTab2Enabled() && _cfgTumbleFlyEnabled != null) { return _cfgTumbleFlyEnabled.Value; } return false; } public static bool IsInfiniteWeaponBatteryEnabled() { if (IsTab2Enabled() && _cfgInfiniteWeaponBattery != null) { return _cfgInfiniteWeaponBattery.Value; } return false; } public static bool IsRemovePillarLimitEnabled() { if (IsTab2Enabled() && _cfgRemovePillarLimit != null) { return _cfgRemovePillarLimit.Value; } return false; } public static bool IsAutoReviveTeammatesEnabled() { if (IsTab1Enabled() && _cfgAutoReviveTeammates != null) { return _cfgAutoReviveTeammates.Value; } return false; } public static bool IsLimitActionAndOverchargeEnabled() { if (IsTab4Enabled() && _cfgLimitActionAndOvercharge != null) { return _cfgLimitActionAndOvercharge.Value; } return false; } public static int GetWingsColorIndex() { if (!IsTab2Enabled() || _cfgWingsColorIndex == null) { return 0; } return _cfgWingsColorIndex.Value; } public static float GetWingsShowFrequency() { if (!IsTab2Enabled() || _cfgWingsShowFrequency == null) { return 0f; } return _cfgWingsShowFrequency.Value; } public static bool IsTabMapPressed() { try { if (Keyboard.current != null && ((ButtonControl)Keyboard.current.tabKey).isPressed) { return true; } } catch { } return false; } public static bool IsThirdPersonEnabled() { if (!IsTab2Enabled() || _cfgThirdPersonEnabled == null || !_cfgThirdPersonEnabled.Value) { return false; } return true; } public static float GetThirdPersonDistance() { if (!IsTab2Enabled() || _cfgThirdPersonDistance == null) { return 2.2f; } return _cfgThirdPersonDistance.Value; } public static float GetThirdPersonHeight() { if (!IsTab2Enabled() || _cfgThirdPersonHeight == null) { return 0.5f; } return _cfgThirdPersonHeight.Value; } public static float GetThirdPersonModelScale() { if (!IsTab2Enabled() || _cfgThirdPersonModelScale == null) { return 0.6f; } return _cfgThirdPersonModelScale.Value; } public static float GetThirdPersonHorizontal() { if (!IsTab2Enabled() || _cfgThirdPersonHorizontal == null) { return 0f; } return _cfgThirdPersonHorizontal.Value; } public static bool IsGodModeFlightEnabled() { if (IsTab2Enabled() && _cfgGodModeFlightEnabled != null) { return _cfgGodModeFlightEnabled.Value; } return false; } public static bool IsAllTeammatesGodModeEnabled() { if (IsTab1Enabled() && _cfgAllTeammatesGodMode != null) { return _cfgAllTeammatesGodMode.Value; } return false; } public static bool IsPlayerGodMode(string steamID) { if (!IsTab1Enabled()) { return false; } if (string.IsNullOrEmpty(steamID)) { return false; } if (!SemiFunc.IsMultiplayer()) { return _localGodModePlayers.Contains(steamID); } if (PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null && ((Dictionary)(object)((RoomInfo)PhotonNetwork.CurrentRoom).CustomProperties).TryGetValue((object)("GT_GodMode_" + steamID), out object value) && value is bool) { return (bool)value; } return false; } public static void SetPlayerGodMode(string steamID, bool enable) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown if (!IsStaticModEnabled() || string.IsNullOrEmpty(steamID)) { return; } if (!SemiFunc.IsMultiplayer()) { if (enable) { _localGodModePlayers.Add(steamID); } else { _localGodModePlayers.Remove(steamID); } } else if (PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null) { Hashtable val = new Hashtable(); val[(object)("GT_GodMode_" + steamID)] = enable; PhotonNetwork.CurrentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } } public static void OnAllTeammatesGodModeChanged(bool enable) { _processedGodModeTeammates.Clear(); List list = SemiFunc.PlayerGetList(); if (list == null) { return; } foreach (PlayerAvatar item in list) { if ((Object)(object)item == (Object)null || PlayerAvatarIsLocalRef.Invoke(item)) { continue; } string text = PlayerAvatarSteamIDRef.Invoke(item); if (!string.IsNullOrEmpty(text)) { if (enable) { SetPlayerGodMode(text, enable: true); _processedGodModeTeammates.Add(text); } else { SetPlayerGodMode(text, enable: false); } } } } public static void UpdateAllTeammatesGodMode() { if (!IsAllTeammatesGodModeEnabled()) { return; } List list = SemiFunc.PlayerGetList(); if (list == null) { return; } foreach (PlayerAvatar item in list) { if (!((Object)(object)item == (Object)null) && !PlayerAvatarIsLocalRef.Invoke(item)) { string text = PlayerAvatarSteamIDRef.Invoke(item); if (!string.IsNullOrEmpty(text) && !_processedGodModeTeammates.Contains(text)) { _processedGodModeTeammates.Add(text); SetPlayerGodMode(text, enable: true); } } } } public static Color GetWingsColor(int index) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (index < 0 || index >= WingsColors.Length) { return Color.white; } return WingsColors[index]; } public static string GetColorName(int index) { switch (index) { case 0: if (!UseChinese()) { return "Default White"; } return "默认白"; case 1: if (!UseChinese()) { return "Flame Red"; } return "火焰红"; case 2: if (!UseChinese()) { return "Neon Green"; } return "荧光绿"; case 3: if (!UseChinese()) { return "Deep Blue"; } return "深海蓝"; case 4: if (!UseChinese()) { return "Aurora Yellow"; } return "极光黄"; case 5: if (!UseChinese()) { return "Cosmic Purple"; } return "星空紫"; case 6: if (!UseChinese()) { return "Ice Cyan"; } return "冰晶青"; case 7: if (!UseChinese()) { return "Cherry Pink"; } return "樱花粉"; case 8: if (!UseChinese()) { return "Sunset Orange"; } return "落日橙"; default: return ""; } } public static bool IsWingsShouldActive() { if (!IsWingsAlwaysShowEnabled()) { return false; } float wingsShowFrequency = GetWingsShowFrequency(); if (wingsShowFrequency <= 0.01f) { return true; } return (int)(Time.time / wingsShowFrequency) % 2 == 0; } 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; } internal static void EnsureEnemyScaleSync() { if (!((Object)(object)_enemyScaleSync != (Object)null) && !((Object)(object)PunManager.instance == (Object)null)) { _enemyScaleSync = ((Component)PunManager.instance).GetComponent(); if ((Object)(object)_enemyScaleSync == (Object)null) { _enemyScaleSync = ((Component)PunManager.instance).gameObject.AddComponent(); } } } public static void SetEnemyScale(EnemyParent ep, float scale) { if ((Object)(object)ep == (Object)null) { return; } scale = Mathf.Clamp(scale, 0.1f, 5f); int viewID = ((MonoBehaviourPun)ep).photonView.ViewID; _enemyScaleDict[viewID] = scale; ApplyEnemyScale(ep, scale); if (PhotonNetwork.InRoom) { EnsureEnemyScaleSync(); if ((Object)(object)_enemyScaleSync != (Object)null) { _enemyScaleSync.BroadcastScale(viewID, scale); } } } internal static void ApplyEnemyScale(EnemyParent ep, float scale) { //IL_0010: 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) if (!((Object)(object)ep == (Object)null)) { ((Component)ep).transform.localScale = Vector3.one * scale; } } 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.2 已加载。"); 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(); } _masterCheckTimer += Time.deltaTime; if (_masterCheckTimer >= 3f) { _masterCheckTimer = 0f; PerformActiveFeaturesCheck(); } 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 (IsAutoReviveTeammatesEnabled() && PhotonNetwork.InRoom) { List list = SemiFunc.PlayerGetList(); if (list != null) { List list2 = new List(); foreach (PlayerAvatar item in list) { if ((Object)(object)item == (Object)null) { continue; } string text = PlayerAvatarSteamIDRef.Invoke(item); if (string.IsNullOrEmpty(text)) { continue; } if (PlayerAvatarDeadSetRef.Invoke(item)) { if (!_teammateDeathTimers.ContainsKey(text)) { _teammateDeathTimers[text] = 0f; } else if (_teammateDeathTimers[text] >= 0f) { _teammateDeathTimers[text] += Time.deltaTime; if (_teammateDeathTimers[text] >= 5f) { _teammateDeathTimers[text] = -9999f; RevivePlayer(item); } } } else { list2.Add(text); } } foreach (string item2 in list2) { if (_teammateDeathTimers.ContainsKey(item2)) { _teammateDeathTimers.Remove(item2); } } } } else { _teammateDeathTimers.Clear(); } if (!((Object)(object)EnemyDirector.instance != (Object)null) || EnemyDirector.instance.enemiesSpawned == null) { return; } float spawnRateMultiplier = GetSpawnRateMultiplier(); if (spawnRateMultiplier > 1f) { foreach (EnemyParent item3 in EnemyDirector.instance.enemiesSpawned) { if ((Object)(object)item3 != (Object)null && !EnemyParentSpawnedRef.Invoke(item3)) { float despawnedTimer = item3.DespawnedTimer; if (despawnedTimer > 0f) { float num = Time.deltaTime * (spawnRateMultiplier - 1f); item3.DespawnedTimerSet(Mathf.Max(0f, despawnedTimer - num), false); } } } } if (!IsLimitActionAndOverchargeEnabled()) { return; } foreach (EnemyParent item4 in EnemyDirector.instance.enemiesSpawned) { if (!((Object)(object)item4 == (Object)null)) { if (item4.actionMultiplier > 0.1f) { item4.actionMultiplier = 0.1f; } if (item4.overchargeMultiplier > 0.1f) { item4.overchargeMultiplier = 0.1f; } } } } private void PerformActiveFeaturesCheck() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown try { if (PhotonNetwork.InRoom && PhotonNetwork.LocalPlayer != null && (!((Dictionary)(object)PhotonNetwork.LocalPlayer.CustomProperties).TryGetValue((object)"GT_Active", out object value) || !(value is bool) || !(bool)value)) { Hashtable val = new Hashtable(); val[(object)"GT_Active"] = true; PhotonNetwork.LocalPlayer.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } if (PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient) { SyncProhibitOthersToRoom(); } if (!IsStaticModEnabled() || !IsTab0Enabled()) { DisableAndRestoreTab1(); DisableAndRestoreTab2(); DisableAndRestoreTab3(); DisableAndRestoreTab4(); return; } if (!IsTab1Enabled()) { DisableAndRestoreTab1(); } if (!IsTab2Enabled()) { DisableAndRestoreTab2(); } if (!IsTab3Enabled()) { DisableAndRestoreTab3(); } if (!IsTab4Enabled()) { DisableAndRestoreTab4(); } } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogWarning((object)$"[PerformActiveFeaturesCheck Error]: {arg}"); } } private void DisableAndRestoreTab1() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown bool flag = false; if (_cfgAutoReviveTeammates != null && _cfgAutoReviveTeammates.Value) { flag = true; } if (_cfgAllTeammatesGodMode != null && _cfgAllTeammatesGodMode.Value) { flag = true; } if (_localGodModePlayers.Count > 0) { flag = true; } if (!flag) { return; } ((BaseUnityPlugin)this).Logger.LogInfo((object)"[GameTools] Tab 1 is disabled. Restoring original player settings and disabling effects."); ResetPlayerSettings(); _localGodModePlayers.Clear(); OnAllTeammatesGodModeChanged(enable: false); if (!PhotonNetwork.InRoom || PhotonNetwork.CurrentRoom == null) { return; } Hashtable val = new Hashtable(); List list = SemiFunc.PlayerGetList(); if (list != null) { foreach (PlayerAvatar item in list) { if (!((Object)(object)item == (Object)null)) { string text = PlayerAvatarSteamIDRef.Invoke(item); if (!string.IsNullOrEmpty(text)) { val[(object)("GT_GodMode_" + text)] = null; } } } } PhotonNetwork.CurrentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } private void DisableAndRestoreTab2() { //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown bool flag = false; if (_cfgWingsAlwaysShow != null && _cfgWingsAlwaysShow.Value) { flag = true; } if (_cfgTumbleFlyEnabled != null && _cfgTumbleFlyEnabled.Value) { flag = true; } if (_cfgJumpMultiplierEnabled != null && _cfgJumpMultiplierEnabled.Value) { flag = true; } if (_cfgInfiniteWeaponBattery != null && _cfgInfiniteWeaponBattery.Value) { flag = true; } if (_cfgThirdPersonEnabled != null && _cfgThirdPersonEnabled.Value) { flag = true; } if (_cfgGodModeFlightEnabled != null && _cfgGodModeFlightEnabled.Value) { flag = true; } if (_cfgWingsColorIndex != null && _cfgWingsColorIndex.Value > 0) { flag = true; } if (_cfgWingsShowFrequency != null && _cfgWingsShowFrequency.Value > 0) { flag = true; } if (flag) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"[GameTools] Tab 2 is disabled. Restoring original visual settings and disabling effects."); ResetVisualSettings(); if (PhotonNetwork.InRoom && PhotonNetwork.LocalPlayer != null) { Hashtable val = new Hashtable(); val[(object)"GT_WingsAlwaysShow"] = false; val[(object)"GT_WingsColorIndex"] = 0; PhotonNetwork.LocalPlayer.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } } } private void DisableAndRestoreTab3() { if (_cfgSpawnedAutoRespawn || _cfgSpawnedDelayPull) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"[GameTools] Tab 3 is disabled. Disabling spawner options."); _cfgSpawnedAutoRespawn = false; _cfgSpawnedDelayPull = false; } } private void DisableAndRestoreTab4() { bool flag = false; if (_cfgSpawnRateMultiplier != null && _cfgSpawnRateMultiplier.Value != 1f) { flag = true; } if (_cfgLimitActionAndOvercharge != null && _cfgLimitActionAndOvercharge.Value) { flag = true; } if (_enemyScaleDict.Count > 0) { flag = true; } if (!flag) { return; } ((BaseUnityPlugin)this).Logger.LogInfo((object)"[GameTools] Tab 4 is disabled. Restoring original monster settings."); ResetMonsterData(); List list = (((Object)(object)EnemyDirector.instance != (Object)null) ? EnemyDirector.instance.enemiesSpawned : null); if (list != null) { foreach (EnemyParent item in list) { if ((Object)(object)item != (Object)null) { SetEnemyScale(item, 1f); } } } _enemyScaleDict.Clear(); } public static void SetProhibitOthers(bool enable) { if (_cfgProhibitOthers != null) { _cfgProhibitOthers.Value = enable; } SyncProhibitOthersToRoom(); } public static void SyncProhibitOthersToRoom() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown if (PhotonNetwork.InRoom && PhotonNetwork.IsMasterClient) { Hashtable val = new Hashtable(); val[(object)"GT_ProhibitOthers"] = IsProhibitOthersEnabled(); PhotonNetwork.CurrentRoom.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)$"[GameTools] Sync ProhibitOthers={IsProhibitOthersEnabled()} to room."); } } } public static bool IsProhibitOthersEnabled() { if (_cfgProhibitOthers != null) { return _cfgProhibitOthers.Value; } return 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_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0217: 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.2", "1.0.2", 990, "Mod Version"); _cfgModEnabled = BindI18N("B.Global Settings", "B.全局设置", "Mod Enable", "模组启用", "Disable to turn off the whole mod.", "关闭整个模组,使其彻底失效。", defaultVal: true); _cfgProhibitOthers = BindI18N("B.Global Settings", "B.全局设置", "Prohibit Others", "禁止其他玩家使用此模组", "If enabled as host, prohibits other players in the room from using this mod.", "作为房主时,如果开启此项,将禁止房间内其他玩家使用该模组功能。", defaultVal: false); _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"); _cfgEnableWingsSound = _runtimeConfig.Bind("Runtime", "EnableWingsSound", false, "Enable Wings Sound"); _cfgWingsColorIndex = _runtimeConfig.Bind("Runtime", "WingsColorIndex", 0, "Wings Color Index"); _cfgWingsShowFrequency = _runtimeConfig.Bind("Runtime", "WingsShowFrequency", 0, "Wings Show Frequency"); _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"); _cfgRemovePillarLimit = _runtimeConfig.Bind("Runtime", "RemovePillarLimit", true, "Remove Pillar Limit"); _cfgAutoReviveTeammates = _runtimeConfig.Bind("Runtime", "AutoReviveTeammates", false, "Auto Revive Teammates"); _cfgLimitActionAndOvercharge = _runtimeConfig.Bind("Runtime", "LimitActionAndOvercharge", false, "Limit Action And Overcharge Multiplier"); _cfgResetMonsterDataOnLevelLoad = _runtimeConfig.Bind("Runtime", "ResetMonsterDataOnLevelLoad", true, "Reset Monster Data On Level Load"); _cfgThirdPersonEnabled = _runtimeConfig.Bind("Runtime", "ThirdPersonEnabled", false, "Third Person Enabled"); _cfgThirdPersonDistance = _runtimeConfig.Bind("Runtime", "ThirdPersonDistance", 2.2f, "Third Person Distance"); _cfgThirdPersonHeight = _runtimeConfig.Bind("Runtime", "ThirdPersonHeight", 0.5f, "Third Person Height"); _cfgThirdPersonModelScale = _runtimeConfig.Bind("Runtime", "ThirdPersonModelScale", 0.6f, "Third Person Model Scale"); _cfgThirdPersonHorizontal = _runtimeConfig.Bind("Runtime", "ThirdPersonHorizontal", 0f, "Third Person Horizontal Offset"); _cfgGodModeFlightEnabled = _runtimeConfig.Bind("Runtime", "GodModeFlightEnabled", false, "God Mode Flight Enabled"); _cfgAllTeammatesGodMode = _runtimeConfig.Bind("Runtime", "AllTeammatesGodMode", false, "All Teammates God Mode"); _cfgTab0Enabled = _runtimeConfig.Bind("Runtime", "Tab0Enabled", true, "Tab 0 Global Settings Master Switch"); _cfgTab1Enabled = _runtimeConfig.Bind("Runtime", "Tab1Enabled", true, "Tab 1 Player Settings Master Switch"); _cfgTab2Enabled = _runtimeConfig.Bind("Runtime", "Tab2Enabled", true, "Tab 2 Visual Settings Master Switch"); _cfgTab3Enabled = _runtimeConfig.Bind("Runtime", "Tab3Enabled", true, "Tab 3 Spawner Settings Master Switch"); _cfgTab4Enabled = _runtimeConfig.Bind("Runtime", "Tab4Enabled", true, "Tab 4 Monster Settings Master Switch"); 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.2")) { ((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.2, 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 { } } public static void EnsureSafeDirectorsForShop() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown if ((Object)(object)LevelGenerator.Instance == (Object)null) { _tempLevelGenGo = new GameObject("GameTools_TempLevelGenerator"); LevelGenerator obj = _tempLevelGenGo.AddComponent(); obj.EnemyParent = new GameObject("GameTools_TempEnemyParent"); obj.EnemyParent.transform.SetParent(_tempLevelGenGo.transform); LevelGenerator.Instance = obj; } if ((Object)(object)EnemyDirector.instance == (Object)null) { _tempEnemyDirGo = new GameObject("GameTools_TempEnemyDirector"); EnemyDirector obj2 = _tempEnemyDirGo.AddComponent(); obj2.enemiesSpawned = new List(); EnemyDirector.instance = obj2; } } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if ((Object)(object)LevelGenerator.Instance != (Object)null && (Object)(object)_tempLevelGenGo != (Object)null && (Object)(object)((Component)LevelGenerator.Instance).gameObject == (Object)(object)_tempLevelGenGo) { LevelGenerator.Instance = null; } if ((Object)(object)EnemyDirector.instance != (Object)null && (Object)(object)_tempEnemyDirGo != (Object)null && (Object)(object)((Component)EnemyDirector.instance).gameObject == (Object)(object)_tempEnemyDirGo) { EnemyDirector.instance = null; } _tempLevelGenGo = null; _tempEnemyDirGo = null; if ((Object)(object)RunManager.instance != (Object)null && RunManagerLevelIsShopRef.Invoke(RunManager.instance)) { EnsureSafeDirectorsForShop(); } if (_cfgResetMonsterDataOnLevelLoad != null && _cfgResetMonsterDataOnLevelLoad.Value) { ResetGlobalMonsterData(); } } public static void ResetGlobalMonsterData() { _globalOverrideInited = false; SaveRuntimeConfig(); } public static void LoadAllSpawnables(bool force) { //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Invalid comparison between Unknown and I4 //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Invalid comparison between Unknown and I4 //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Invalid comparison between Unknown and I4 //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0416: Invalid comparison between Unknown and I4 //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Invalid comparison between Unknown and I4 //IL_0c27: Unknown result type (might be due to invalid IL or missing references) //IL_0c2c: Unknown result type (might be due to invalid IL or missing references) //IL_0c2e: Unknown result type (might be due to invalid IL or missing references) //IL_0c45: Expected I4, but got Unknown //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Invalid comparison between Unknown and I4 //IL_0434: Unknown result type (might be due to invalid IL or missing references) //IL_043b: Invalid comparison between Unknown and I4 //IL_0444: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Invalid comparison between Unknown and I4 //IL_0451: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Invalid comparison between Unknown and I4 if (_spawnablesLoaded && !force) { return; } _spawnablesEnemies.Clear(); _spawnablesCustomItems.Clear(); _spawnablesCustomEnemies.Clear(); _spawnablesCosmeticBoxes.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 }); } _spawnablesEnemies = (from e in _spawnablesEnemies orderby IsMultipleEnemy(e) ? 1 : 0, e.Name select e).ToList(); } _spawnablesMelee.Clear(); _spawnablesRanged.Clear(); _spawnablesOtherWeapons.Clear(); _spawnablesCarts.Clear(); _spawnablesVehicles.Clear(); _spawnablesPotions.Clear(); _spawnablesOthers.Clear(); _spawnablesDrones.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; bool flag5 = (int)value.itemType == 0; 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 }); } else if (flag5) { _spawnablesDrones.Add(new SpawnableInfo { Name = value.itemName, InternalName = value.itemName, Type = SpawnType.Other, Source = value, ExtraInfo = extraInfo3 }); } else { _spawnablesOthers.Add(new SpawnableInfo { Name = value.itemName, InternalName = value.itemName, Type = SpawnType.Other, 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 ((Object)(object)ValuableDirector.instance != (Object)null && ValuableDirector.instance.cosmeticWorldObjectSetups != null) { _cachedCosmeticObjectSetups.Clear(); foreach (CosmeticWorldObjectSetup cosmeticWorldObjectSetup in ValuableDirector.instance.cosmeticWorldObjectSetups) { if (cosmeticWorldObjectSetup != null) { _cachedCosmeticObjectSetups.Add(cosmeticWorldObjectSetup); } } } List list2 = new List(); if (_cachedCosmeticObjectSetups.Count > 0) { foreach (CosmeticWorldObjectSetup cachedCosmeticObjectSetup in _cachedCosmeticObjectSetups) { if (cachedCosmeticObjectSetup != null && cachedCosmeticObjectSetup.prefab != null && ((PrefabRef)(object)cachedCosmeticObjectSetup.prefab).IsValid()) { string text = ""; Rarity rarity = cachedCosmeticObjectSetup.rarity; switch ((int)rarity) { case 0: text = (UseChinese() ? "普通" : "Common"); break; case 1: text = (UseChinese() ? "罕见" : "Uncommon"); break; case 2: text = (UseChinese() ? "稀有" : "Rare"); break; case 3: text = (UseChinese() ? "极度稀有" : "Ultra Rare"); break; } string name3 = (UseChinese() ? ("代币箱子 (" + text + ")") : ("Cosmetic Box (" + text + ")")); list2.Add(new SpawnableInfo { Name = name3, InternalName = ((PrefabRef)(object)cachedCosmeticObjectSetup.prefab).PrefabName, Type = SpawnType.Valuable, Source = cachedCosmeticObjectSetup.prefab, ExtraInfo = "" }); } } } _spawnablesCosmeticBoxes.AddRange(list2); try { EnemySetup[] array = Resources.FindObjectsOfTypeAll(); HashSet hashSet3 = new HashSet(StringComparer.OrdinalIgnoreCase); HashSet hashSet4 = new HashSet(StringComparer.OrdinalIgnoreCase); foreach (SpawnableInfo spawnablesEnemy in _spawnablesEnemies) { if (spawnablesEnemy != null && !string.IsNullOrEmpty(spawnablesEnemy.InternalName)) { hashSet4.Add(spawnablesEnemy.InternalName); } } EnemySetup[] array2 = array; foreach (EnemySetup val in array2) { if ((Object)(object)val == (Object)null || string.IsNullOrEmpty(((Object)val).name) || hashSet3.Contains(((Object)val).name)) { continue; } hashSet3.Add(((Object)val).name); if (hashSet4.Contains(((Object)val).name)) { continue; } int num11 = -1; if (val.spawnObjects != null) { foreach (PrefabRef spawnObject2 in val.spawnObjects) { if (spawnObject2 != null && (Object)(object)((PrefabRef)(object)spawnObject2).Prefab != (Object)null) { EnemyHealth componentInChildren2 = ((PrefabRef)(object)spawnObject2).Prefab.GetComponentInChildren(); if ((Object)(object)componentInChildren2 != (Object)null) { num11 = componentInChildren2.health; break; } } } } string extraInfo5 = ((num11 > 0) ? $"(HP: {num11})" : ""); string text2 = ((Object)val).name.Replace("Enemy - ", "").Replace("Enemy ", ""); _spawnablesCustomEnemies.Add(new SpawnableInfo { Name = "[Mod] " + text2, InternalName = ((Object)val).name, Type = SpawnType.Enemy, Source = val, ExtraInfo = extraInfo5 }); } } catch (Exception arg) { Debug.LogError((object)$"[LoadAllSpawnables CustomEnemies Error]: {arg}"); } try { Item[] array3 = Resources.FindObjectsOfTypeAll(); HashSet hashSet5 = new HashSet(StringComparer.OrdinalIgnoreCase); HashSet hashSet6 = new HashSet(StringComparer.OrdinalIgnoreCase); foreach (List item3 in new List> { _spawnablesMelee, _spawnablesRanged, _spawnablesOtherWeapons, _spawnablesCarts, _spawnablesVehicles, _spawnablesPotions, _spawnablesOthers, _spawnablesValuables }) { foreach (SpawnableInfo item4 in item3) { if (item4 != null && !string.IsNullOrEmpty(item4.InternalName)) { hashSet6.Add(item4.InternalName); } } } Item[] array4 = array3; foreach (Item val2 in array4) { if ((Object)(object)val2 == (Object)null || val2.prefab == null || string.IsNullOrEmpty(val2.itemName) || hashSet5.Contains(val2.itemName)) { continue; } hashSet5.Add(val2.itemName); if (!hashSet6.Contains(val2.itemName)) { int num12 = -1; int num13 = -1; if ((Object)(object)val2.value != (Object)null) { num12 = Mathf.RoundToInt(val2.value.valueMin); num13 = Mathf.RoundToInt(val2.value.valueMax); } string extraInfo6 = ""; if (num12 > 0) { extraInfo6 = ((num12 == num13) ? $"(${num12})" : $"(${num12}-{num13})"); } _spawnablesCustomItems.Add(new SpawnableInfo { Name = "[Mod] " + val2.itemName, InternalName = val2.itemName, Type = SpawnType.Other, Source = val2, ExtraInfo = extraInfo6 }); } } } catch (Exception arg2) { Debug.LogError((object)$"[LoadAllSpawnables CustomItems Error]: {arg2}"); } 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 || _spawnablesOthers.Count > 0 || _spawnablesCustomItems.Count > 0 || _spawnablesCustomEnemies.Count > 0 || _spawnablesDrones.Count > 0 || _spawnablesCosmeticBoxes.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; } private static bool IsMultipleEnemy(SpawnableInfo info) { if (info == null) { return false; } string text = EnemyNameLocalizer.Translate(info.Name); if (!string.IsNullOrEmpty(text)) { Match match = Regex.Match(text, "\\s[xX](?\\d+)$"); if (match.Success && int.TryParse(match.Groups["num"].Value, out var result) && result >= 2) { return true; } } string input = info.Name ?? ""; if (Regex.IsMatch(input, "\\b[xX](?\\d+)\\b")) { Match match2 = Regex.Match(input, "\\b[xX](?\\d+)\\b"); if (match2.Success && int.TryParse(match2.Groups["num"].Value, out var result2) && result2 >= 2) { return true; } } Match match3 = Regex.Match(input, "^(Group - )?(?\\d+)\\s"); if (match3.Success && int.TryParse(match3.Groups["num"].Value, out var result3) && result3 >= 2) { return true; } Match match4 = Regex.Match(info.InternalName ?? "", "^(Enemy Group - |Group - |Enemy - |Enemy )?(?\\d+)\\s", RegexOptions.IgnoreCase); if (match4.Success && int.TryParse(match4.Groups["num"].Value, out var result4) && result4 >= 2) { return true; } return false; } public void ResetGlobalSettings() { if (_cfgModEnabled != null) { _cfgModEnabled.Value = true; } if (_cfgProhibitOthers != null) { _cfgProhibitOthers.Value = false; } if (_openKey != null) { _openKey.Value = "F4"; } ((BaseUnityPlugin)this).Config.Save(); RebindOpenKey(); SyncProhibitOthersToRoom(); } public void ResetPlayerSettings() { if (_cfgAutoReviveTeammates != null) { _cfgAutoReviveTeammates.Value = false; } if (_cfgAllTeammatesGodMode != null) { _cfgAllTeammatesGodMode.Value = false; } OnAllTeammatesGodModeChanged(enable: false); SaveRuntimeConfig(); } public void ResetVisualSettings() { if (_cfgWingsAlwaysShow != null) { _cfgWingsAlwaysShow.Value = false; } if (_cfgEnableWingsSound != null) { _cfgEnableWingsSound.Value = false; } if (_cfgTumbleFlyEnabled != null) { _cfgTumbleFlyEnabled.Value = false; } if (_cfgJumpMultiplierEnabled != null) { _cfgJumpMultiplierEnabled.Value = false; } if (_cfgJumpMultiplier != null) { _cfgJumpMultiplier.Value = 1.5f; } if (_cfgInfiniteWeaponBattery != null) { _cfgInfiniteWeaponBattery.Value = false; } if (_cfgRemovePillarLimit != null) { _cfgRemovePillarLimit.Value = true; } if (_cfgWingsColorIndex != null) { _cfgWingsColorIndex.Value = 0; } if (_cfgWingsShowFrequency != null) { _cfgWingsShowFrequency.Value = 0; } if (_cfgThirdPersonEnabled != null) { _cfgThirdPersonEnabled.Value = false; } if (_cfgThirdPersonDistance != null) { _cfgThirdPersonDistance.Value = 2.2f; } if (_cfgThirdPersonHeight != null) { _cfgThirdPersonHeight.Value = 0.5f; } if (_cfgThirdPersonModelScale != null) { _cfgThirdPersonModelScale.Value = 0.6f; } if (_cfgThirdPersonHorizontal != null) { _cfgThirdPersonHorizontal.Value = 0f; } if (_cfgGodModeFlightEnabled != null) { _cfgGodModeFlightEnabled.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 (_cfgLimitActionAndOvercharge != null) { _cfgLimitActionAndOvercharge.Value = false; } 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(); } public static Vector3 CheckWallObstacle(Vector3 startPos, Vector3 targetPos, float radius = 0.4f) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) Vector3 val = targetPos - startPos; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.1f) { return targetPos; } ((Vector3)(ref val)).Normalize(); int num = ~LayerMask.GetMask(new string[2] { "Player", "Ignore Raycast" }); RaycastHit val2 = default(RaycastHit); if (Physics.SphereCast(startPos, radius, val, ref val2, magnitude, num, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val2)).point + ((RaycastHit)(ref val2)).normal * (radius + 0.05f); } return targetPos; } public static Vector3 FixPositionIfWall(Vector3 targetPos, float radius = 0.4f) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0074: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_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_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0120: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) int num = ~LayerMask.GetMask(new string[4] { "Player", "Ignore Raycast", "Trigger", "UI" }); if (Physics.OverlapSphere(targetPos, radius, num, (QueryTriggerInteraction)1).Length == 0) { return targetPos; } Vector3[] obj = new Vector3[10] { Vector3.up, Vector3.forward, Vector3.back, Vector3.left, Vector3.right, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3) }; Vector3 val = Vector3.forward + Vector3.left; obj[5] = ((Vector3)(ref val)).normalized; val = Vector3.forward + Vector3.right; obj[6] = ((Vector3)(ref val)).normalized; val = Vector3.back + Vector3.left; obj[7] = ((Vector3)(ref val)).normalized; val = Vector3.back + Vector3.right; obj[8] = ((Vector3)(ref val)).normalized; obj[9] = Vector3.down; Vector3[] array = (Vector3[])(object)obj; for (float num2 = 0.3f; num2 <= 1.5f; num2 += 0.3f) { Vector3[] array2 = array; foreach (Vector3 val2 in array2) { Vector3 val3 = targetPos + val2 * num2; if (Physics.OverlapSphere(val3, radius, num, (QueryTriggerInteraction)1).Length == 0) { return val3; } } } return targetPos; } public static Vector3 GetSpawnPosition(float distance = 2f, float upOffset = 0.5f) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_00f4: 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) //IL_0104: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)PlayerController.instance == (Object)null) { return Vector3.zero; } bool flag = false; try { PlayerAvatar val = (((Object)(object)PlayerController.instance.playerAvatarScript != (Object)null) ? ((Component)PlayerController.instance.playerAvatarScript).GetComponent() : null); if ((Object)(object)val != (Object)null) { flag = PlayerAvatarDeadSetRef.Invoke(val); } } catch { } Vector3 val2; Vector3 targetPos; if (flag && (Object)(object)Camera.main != (Object)null) { val2 = ((Component)Camera.main).transform.position; targetPos = val2 + ((Component)Camera.main).transform.forward * (distance + 1f); } else { val2 = ((Component)PlayerController.instance).transform.position + Vector3.up * upOffset; targetPos = ((Component)PlayerController.instance).transform.position + ((Component)PlayerController.instance).transform.forward * distance + Vector3.up * upOffset; } return FixPositionIfWall(CheckWallObstacle(val2, targetPos)); } public static Quaternion GetSpawnRotation() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)PlayerController.instance == (Object)null) { return Quaternion.identity; } bool flag = false; try { PlayerAvatar val = (((Object)(object)PlayerController.instance.playerAvatarScript != (Object)null) ? ((Component)PlayerController.instance.playerAvatarScript).GetComponent() : null); if ((Object)(object)val != (Object)null) { flag = PlayerAvatarDeadSetRef.Invoke(val); } } catch { } if (flag && (Object)(object)Camera.main != (Object)null) { return ((Component)Camera.main).transform.rotation; } return ((Component)PlayerController.instance).transform.rotation; } private IEnumerator SpawnCoroutine(SpawnableInfo info, int totalCount) { if (info == null) { yield break; } if ((Object)(object)RunManager.instance != (Object)null && RunManagerLevelIsShopRef.Invoke(RunManager.instance)) { EnsureSafeDirectorsForShop(); } bool isMultiplayer = SemiFunc.IsMultiplayer(); for (int count = 0; count < totalCount; count++) { if ((Object)(object)PlayerController.instance == (Object)null) { break; } Vector3 spawnPosition = GetSpawnPosition(5f); Quaternion spawnRotation = GetSpawnRotation(); try { if (info.Type == SpawnType.Enemy) { object source = info.Source; EnemySetup val = (EnemySetup)((source is EnemySetup) ? source : null); if ((Object)(object)val != (Object)null && val.spawnObjects != null) { foreach (PrefabRef spawnObject in val.spawnObjects) { if (spawnObject == null || !((PrefabRef)(object)spawnObject).IsValid()) { continue; } GameObject val2 = null; try { if (isMultiplayer) { val2 = (PhotonNetwork.IsMasterClient ? PhotonNetwork.InstantiateRoomObject(((PrefabRef)(object)spawnObject).ResourcePath, spawnPosition, Quaternion.identity, (byte)0, (object[])null) : PhotonNetwork.Instantiate(((PrefabRef)(object)spawnObject).ResourcePath, spawnPosition, Quaternion.identity, (byte)0, (object[])null)); } } catch (Exception ex) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)("[SpawnObject Enemy Network Fail, Fallback to local]: " + ex.Message)); } } if ((Object)(object)val2 == (Object)null && (Object)(object)((PrefabRef)(object)spawnObject).Prefab != (Object)null) { val2 = Object.Instantiate(((PrefabRef)(object)spawnObject).Prefab, spawnPosition, Quaternion.identity); } if (!((Object)(object)val2 != (Object)null)) { continue; } val2.AddComponent(); EnemyParent component = val2.GetComponent(); if ((Object)(object)component != (Object)null) { EnemyParentSetupDoneRef.Invoke(component) = true; Enemy componentInChildren = val2.GetComponentInChildren(); if (componentInChildren != null) { componentInChildren.EnemyTeleported(spawnPosition); } EnemyParentFirstSpawnPointUsedRef.Invoke(component) = true; if (_cfgSpawnedDelayPull) { ((MonoBehaviour)Instance).StartCoroutine(Instance.DelayTeleportToPlayerCoroutine(component)); } } } } } else if (info.Type == SpawnType.Weapon || info.Type == SpawnType.Cart || info.Type == SpawnType.Vehicle || info.Type == SpawnType.Other) { object source2 = info.Source; Item val3 = (Item)((source2 is Item) ? source2 : null); if ((Object)(object)val3 != (Object)null && val3.prefab != null) { GameObject val4 = null; try { if (isMultiplayer) { val4 = (PhotonNetwork.IsMasterClient ? PhotonNetwork.InstantiateRoomObject(((PrefabRef)(object)val3.prefab).ResourcePath, spawnPosition, spawnRotation, (byte)0, (object[])null) : PhotonNetwork.Instantiate(((PrefabRef)(object)val3.prefab).ResourcePath, spawnPosition, spawnRotation, (byte)0, (object[])null)); } } catch (Exception ex2) { Plugin instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogWarning((object)("[SpawnObject Item Network Fail, Fallback to local]: " + ex2.Message)); } } if ((Object)(object)val4 == (Object)null && (Object)(object)((PrefabRef)(object)val3.prefab).Prefab != (Object)null) { Object.Instantiate(((PrefabRef)(object)val3.prefab).Prefab, spawnPosition, spawnRotation); } } } else if (info.Type == SpawnType.Valuable) { object source3 = info.Source; PrefabRef val5 = (PrefabRef)((source3 is PrefabRef) ? source3 : null); object source4 = info.Source; Item val6 = (Item)((source4 is Item) ? source4 : null); if (val5 == null && (Object)(object)val6 != (Object)null) { val5 = val6.prefab; } if (val5 != null && ((PrefabRef)(object)val5).IsValid()) { GameObject val7 = null; try { if (isMultiplayer) { val7 = (PhotonNetwork.IsMasterClient ? PhotonNetwork.InstantiateRoomObject(((PrefabRef)(object)val5).ResourcePath, spawnPosition, spawnRotation, (byte)0, (object[])null) : PhotonNetwork.Instantiate(((PrefabRef)(object)val5).ResourcePath, spawnPosition, spawnRotation, (byte)0, (object[])null)); } } catch (Exception ex3) { Plugin instance3 = Instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogWarning((object)("[SpawnObject Valuable Network Fail, Fallback to local]: " + ex3.Message)); } } if ((Object)(object)val7 == (Object)null && (Object)(object)((PrefabRef)(object)val5).Prefab != (Object)null) { val7 = Object.Instantiate(((PrefabRef)(object)val5).Prefab, spawnPosition, spawnRotation); } if ((Object)(object)val7 != (Object)null) { ValuableObject component2 = val7.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}"); } } } private IEnumerator DelayTeleportToPlayerCoroutine(EnemyParent enemyParent) { if ((Object)(object)enemyParent == (Object)null) { yield break; } float timeout = 5f; while ((Object)(object)enemyParent != (Object)null && EnemyParentSpawnedRef.Invoke(enemyParent) && timeout > 0f) { timeout -= Time.deltaTime; yield return null; } timeout = 30f; while ((Object)(object)enemyParent != (Object)null && !EnemyParentSpawnedRef.Invoke(enemyParent) && timeout > 0f) { timeout -= Time.deltaTime; yield return null; } if (!((Object)(object)enemyParent != (Object)null) || !EnemyParentSpawnedRef.Invoke(enemyParent) || !((Object)(object)PlayerController.instance != (Object)null)) { yield break; } yield return (object)new WaitForSeconds(0.2f); if (!((Object)(object)enemyParent != (Object)null) || !EnemyParentSpawnedRef.Invoke(enemyParent) || !((Object)(object)PlayerController.instance != (Object)null)) { yield break; } Vector3 spawnPosition = GetSpawnPosition(6f); Enemy componentInChildren = ((Component)enemyParent).GetComponentInChildren(); if (!((Object)(object)componentInChildren != (Object)null)) { yield break; } try { componentInChildren.EnemyTeleported(spawnPosition); } catch { } } 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_0117: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Expected O, but got Unknown //IL_0198: Expected O, but got Unknown //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Expected O, but got Unknown //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Expected O, but got Unknown //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: 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_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Expected O, but got Unknown //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Expected O, but got Unknown //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Expected O, but got Unknown //IL_0326: 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_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0342: 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_0355: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Expected O, but got Unknown //IL_0364: Expected O, but got Unknown //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Expected O, but got Unknown //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Expected O, but got Unknown //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Expected O, but got Unknown //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0424: 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_043a: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Expected O, but got Unknown //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_0484: 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_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: 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_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: 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)); _texMask = MakeTex(new Color(0f, 0f, 0f, 0.65f)); 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 = 21; _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 = 15 }; 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_2fb3: Unknown result type (might be due to invalid IL or missing references) //IL_3061: Unknown result type (might be due to invalid IL or missing references) //IL_30b8: Unknown result type (might be due to invalid IL or missing references) //IL_30fb: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0075: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_073d: Unknown result type (might be due to invalid IL or missing references) //IL_1a1a: Unknown result type (might be due to invalid IL or missing references) //IL_1a4b: Unknown result type (might be due to invalid IL or missing references) //IL_23c9: 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_01be: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_1fe0: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_095a: Unknown result type (might be due to invalid IL or missing references) //IL_1a88: Unknown result type (might be due to invalid IL or missing references) //IL_20b2: Unknown result type (might be due to invalid IL or missing references) //IL_2142: Unknown result type (might be due to invalid IL or missing references) //IL_21fb: Unknown result type (might be due to invalid IL or missing references) //IL_2246: Unknown result type (might be due to invalid IL or missing references) //IL_22d1: Unknown result type (might be due to invalid IL or missing references) //IL_22d6: Unknown result type (might be due to invalid IL or missing references) //IL_22e0: Unknown result type (might be due to invalid IL or missing references) //IL_22e5: Unknown result type (might be due to invalid IL or missing references) //IL_22ea: Unknown result type (might be due to invalid IL or missing references) //IL_2339: Unknown result type (might be due to invalid IL or missing references) //IL_3097: Unknown result type (might be due to invalid IL or missing references) //IL_3507: Unknown result type (might be due to invalid IL or missing references) //IL_351a: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_35e3: Unknown result type (might be due to invalid IL or missing references) //IL_1b32: Unknown result type (might be due to invalid IL or missing references) //IL_1b6e: Unknown result type (might be due to invalid IL or missing references) //IL_2064: Unknown result type (might be due to invalid IL or missing references) //IL_22ee: Unknown result type (might be due to invalid IL or missing references) //IL_2ff6: Unknown result type (might be due to invalid IL or missing references) //IL_2ffb: Unknown result type (might be due to invalid IL or missing references) //IL_3005: Unknown result type (might be due to invalid IL or missing references) //IL_300a: Unknown result type (might be due to invalid IL or missing references) //IL_300f: Unknown result type (might be due to invalid IL or missing references) //IL_248a: Unknown result type (might be due to invalid IL or missing references) //IL_1bab: Unknown result type (might be due to invalid IL or missing references) //IL_217a: Unknown result type (might be due to invalid IL or missing references) //IL_2189: Unknown result type (might be due to invalid IL or missing references) //IL_2193: Unknown result type (might be due to invalid IL or missing references) //IL_2198: Unknown result type (might be due to invalid IL or missing references) //IL_219d: Unknown result type (might be due to invalid IL or missing references) //IL_21a7: Unknown result type (might be due to invalid IL or missing references) //IL_21ac: Unknown result type (might be due to invalid IL or missing references) //IL_21b1: 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_3569: Unknown result type (might be due to invalid IL or missing references) //IL_1c6b: Unknown result type (might be due to invalid IL or missing references) //IL_1ca7: Unknown result type (might be due to invalid IL or missing references) //IL_3043: Unknown result type (might be due to invalid IL or missing references) //IL_07e9: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_1ce4: Unknown result type (might be due to invalid IL or missing references) //IL_25a2: Unknown result type (might be due to invalid IL or missing references) //IL_2437: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0836: Unknown result type (might be due to invalid IL or missing references) //IL_0849: Unknown result type (might be due to invalid IL or missing references) //IL_086b: Unknown result type (might be due to invalid IL or missing references) //IL_1d8e: Unknown result type (might be due to invalid IL or missing references) //IL_1dca: Unknown result type (might be due to invalid IL or missing references) //IL_2932: Unknown result type (might be due to invalid IL or missing references) //IL_2945: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_1e07: Unknown result type (might be due to invalid IL or missing references) //IL_262a: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_1ec7: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04d4: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_2743: Unknown result type (might be due to invalid IL or missing references) //IL_3161: Unknown result type (might be due to invalid IL or missing references) //IL_319a: Unknown result type (might be due to invalid IL or missing references) //IL_0a18: Unknown result type (might be due to invalid IL or missing references) //IL_08e9: Unknown result type (might be due to invalid IL or missing references) //IL_1f35: Unknown result type (might be due to invalid IL or missing references) //IL_31f3: Unknown result type (might be due to invalid IL or missing references) //IL_158f: Unknown result type (might be due to invalid IL or missing references) //IL_321e: Unknown result type (might be due to invalid IL or missing references) //IL_3206: Unknown result type (might be due to invalid IL or missing references) //IL_27e2: Unknown result type (might be due to invalid IL or missing references) //IL_3270: Unknown result type (might be due to invalid IL or missing references) //IL_2837: Unknown result type (might be due to invalid IL or missing references) //IL_284a: Unknown result type (might be due to invalid IL or missing references) //IL_2868: Unknown result type (might be due to invalid IL or missing references) //IL_32a4: Unknown result type (might be due to invalid IL or missing references) //IL_32fb: Unknown result type (might be due to invalid IL or missing references) //IL_3335: Unknown result type (might be due to invalid IL or missing references) //IL_2a4e: Unknown result type (might be due to invalid IL or missing references) //IL_2a87: Unknown result type (might be due to invalid IL or missing references) //IL_15e2: Unknown result type (might be due to invalid IL or missing references) //IL_15f5: Unknown result type (might be due to invalid IL or missing references) //IL_1617: Unknown result type (might be due to invalid IL or missing references) //IL_0a73: Unknown result type (might be due to invalid IL or missing references) //IL_0a86: Unknown result type (might be due to invalid IL or missing references) //IL_0aa9: Unknown result type (might be due to invalid IL or missing references) //IL_3369: Unknown result type (might be due to invalid IL or missing references) //IL_2ac3: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_33de: Unknown result type (might be due to invalid IL or missing references) //IL_3424: Unknown result type (might be due to invalid IL or missing references) //IL_0b07: Unknown result type (might be due to invalid IL or missing references) //IL_2b1c: Unknown result type (might be due to invalid IL or missing references) //IL_05f5: Unknown result type (might be due to invalid IL or missing references) //IL_0608: Unknown result type (might be due to invalid IL or missing references) //IL_062a: Unknown result type (might be due to invalid IL or missing references) //IL_2b47: Unknown result type (might be due to invalid IL or missing references) //IL_2b2f: Unknown result type (might be due to invalid IL or missing references) //IL_16cf: Unknown result type (might be due to invalid IL or missing references) //IL_16e2: Unknown result type (might be due to invalid IL or missing references) //IL_1704: Unknown result type (might be due to invalid IL or missing references) //IL_3468: Unknown result type (might be due to invalid IL or missing references) //IL_0b65: Unknown result type (might be due to invalid IL or missing references) //IL_1742: Unknown result type (might be due to invalid IL or missing references) //IL_2bb2: Unknown result type (might be due to invalid IL or missing references) //IL_0693: Unknown result type (might be due to invalid IL or missing references) //IL_0bcc: Unknown result type (might be due to invalid IL or missing references) //IL_2c08: Unknown result type (might be due to invalid IL or missing references) //IL_17e0: Unknown result type (might be due to invalid IL or missing references) //IL_0fb9: Unknown result type (might be due to invalid IL or missing references) //IL_0c46: Unknown result type (might be due to invalid IL or missing references) //IL_2c3c: Unknown result type (might be due to invalid IL or missing references) //IL_2c93: Unknown result type (might be due to invalid IL or missing references) //IL_2ccd: Unknown result type (might be due to invalid IL or missing references) //IL_0cb4: Unknown result type (might be due to invalid IL or missing references) //IL_2d01: 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_1047: Unknown result type (might be due to invalid IL or missing references) //IL_0d2e: Unknown result type (might be due to invalid IL or missing references) //IL_2d76: Unknown result type (might be due to invalid IL or missing references) //IL_2db0: Unknown result type (might be due to invalid IL or missing references) //IL_1880: Unknown result type (might be due to invalid IL or missing references) //IL_0d9c: Unknown result type (might be due to invalid IL or missing references) //IL_1089: Unknown result type (might be due to invalid IL or missing references) //IL_109c: Unknown result type (might be due to invalid IL or missing references) //IL_10bf: Unknown result type (might be due to invalid IL or missing references) //IL_2de4: Unknown result type (might be due to invalid IL or missing references) //IL_2e3b: Unknown result type (might be due to invalid IL or missing references) //IL_2e75: Unknown result type (might be due to invalid IL or missing references) //IL_0e20: Unknown result type (might be due to invalid IL or missing references) //IL_1954: Unknown result type (might be due to invalid IL or missing references) //IL_1967: Unknown result type (might be due to invalid IL or missing references) //IL_1989: Unknown result type (might be due to invalid IL or missing references) //IL_0e8e: Unknown result type (might be due to invalid IL or missing references) //IL_2ea9: Unknown result type (might be due to invalid IL or missing references) //IL_2f00: Unknown result type (might be due to invalid IL or missing references) //IL_2f46: 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_0f42: Unknown result type (might be due to invalid IL or missing references) //IL_2f8c: Unknown result type (might be due to invalid IL or missing references) //IL_2f91: Unknown result type (might be due to invalid IL or missing references) //IL_2f95: Unknown result type (might be due to invalid IL or missing references) //IL_11f2: Unknown result type (might be due to invalid IL or missing references) //IL_12a7: Unknown result type (might be due to invalid IL or missing references) //IL_12fc: Unknown result type (might be due to invalid IL or missing references) //IL_135a: Unknown result type (might be due to invalid IL or missing references) //IL_13b7: Unknown result type (might be due to invalid IL or missing references) //IL_13fd: Unknown result type (might be due to invalid IL or missing references) //IL_1410: Unknown result type (might be due to invalid IL or missing references) //IL_1433: Unknown result type (might be due to invalid IL or missing references) //IL_149f: Unknown result type (might be due to invalid IL or missing references) //IL_1516: Unknown result type (might be due to invalid IL or missing references) if (IsProhibitedByHost()) { string text = (UseChinese() ? "⚠\ufe0f 模组已被房主禁用\n\n当前房间的房主禁用了其他玩家使用此模组的功能。\n所有修改已被强制清除并恢复为原版游戏效果。\n只有加入其他房间或切换到单机模式时才不受此限制。" : "⚠\ufe0f Mod Disabled by Host\n\nThe host of the current room has prohibited other players from using this mod.\nAll active effects have been cleared and reverted to original game features.\nThis restriction only applies inside this room."); float num = 40f; Rect val = new Rect(num, 120f, ((Rect)(ref _windowRect)).width - num * 2f, ((Rect)(ref _windowRect)).height - 240f); GUI.Box(val, "", _sSection); GUIStyle val2 = new GUIStyle(_sLabel); val2.alignment = (TextAnchor)4; val2.richText = true; GUI.Label(val, text, val2); float num2 = 200f; float num3 = 40f; float num4 = (((Rect)(ref _windowRect)).width - num2) * 0.5f; float num5 = ((Rect)(ref _windowRect)).height - 100f; if (GUI.Button(new Rect(num4, num5, num2, num3), UseChinese() ? "关闭菜单" : "Close Menu", _sBtnRed)) { SetWindowOpen(open: false); } GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _windowRect)).width, 40f)); return; } if (_showConfirmSpawn && _pendingSpawnInfo != null) { if ((Object)(object)_texMask != (Object)null) { GUI.DrawTexture(new Rect(0f, 0f, ((Rect)(ref _windowRect)).width, ((Rect)(ref _windowRect)).height), (Texture)(object)_texMask); } float num6 = 460f; float num7 = 220f; float num8 = (((Rect)(ref _windowRect)).width - num6) * 0.5f; float num9 = (((Rect)(ref _windowRect)).height - num7) * 0.5f; Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(num8, num9, num6, num7); if (!((Rect)(ref val3)).Contains(Event.current.mousePosition)) { GUI.Button(new Rect(0f, 0f, ((Rect)(ref _windowRect)).width, ((Rect)(ref _windowRect)).height), "", GUIStyle.none); } } GUI.enabled = !_showConfirmSpawn; float num10 = ((Rect)(ref _windowRect)).width - 32f; float num11 = 36f; DrawCloseButton(); string text2 = (UseChinese() ? "游戏工具控制中心" : "✦ Game Control Center"); GUI.Label(new Rect(16f, num11, num10 - 300f, 30f), text2, _sTitle); string text3 = (UseChinese() ? "Switch to English" : "切换中文"); if (GUI.Button(new Rect(((Rect)(ref _windowRect)).width - 220f, num11 - 4f, 170f, 36f), text3, _sBtnNormal)) { DisplayLanguage value = (UseChinese() ? DisplayLanguage.English : DisplayLanguage.中文); _cfgLanguage.Value = value; } num11 += 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 num12 = num10 / 5f; for (int i = 0; i < 5; i++) { bool flag = _currentTab == i; if (GUI.Button(new Rect(16f + (float)i * num12, num11, num12 - 4f, 40f), array[i], flag ? _sBtnGreen : _sBtnNormal)) { _currentTab = i; } } num11 += 48f; float num13 = ((Rect)(ref _windowRect)).height - num11 - 16f - 10f; Rect val4 = default(Rect); ((Rect)(ref val4))..ctor(16f, num11, num10, num13); if (_currentTab == 3) { bool enabled = GUI.enabled; if (!_cfgModEnabled.Value) { GUI.enabled = false; } DrawTabSpawner(val4); GUI.enabled = enabled; } else { Rect val5 = default(Rect); ((Rect)(ref val5))..ctor(0f, 0f, num10 - 16f, _lastVirtualHeight); _scrollPos = GUI.BeginScrollView(val4, _scrollPos, val5); float curY = 0f; float num14 = num10 - 18f; float num15 = 0f; float num16 = num15 + 12f; float num17 = num14 - 24f; if (_currentTab == 0) { string text4 = (UseChinese() ? "\ud83d\udd04 重置全部全局选项" : "\ud83d\udd04 Reset All Global Settings"); if (GUI.Button(new Rect(num15, curY, num14, 40f), text4, _sBtnRed)) { ResetGlobalSettings(); } curY += 52f; Rect val6 = default(Rect); ((Rect)(ref val6))..ctor(num15, curY, num14, 120f); GUI.Box(val6, "", _sSection); DrawBorderRect(val6, _texBorder); float num18 = curY + 12f; bool flag2 = DrawStyledToggle(new Rect(num16, num18, num17, 34f), _cfgModEnabled.Value, UseChinese() ? "启用整个模组功能" : "Enable GameTools Mod"); if (flag2 != _cfgModEnabled.Value) { _cfgModEnabled.Value = flag2; } float num19 = num18 + 40f; bool enabled2 = GUI.enabled; if (PhotonNetwork.InRoom && !PhotonNetwork.IsMasterClient) { GUI.enabled = false; } string text5 = (UseChinese() ? "禁止其他玩家使用此模组 (仅房主可用)" : "Prohibit other players from using mod (Host Only)"); if (!PhotonNetwork.InRoom) { text5 = (UseChinese() ? "禁止其他玩家使用此模组" : "Prohibit other players from using mod"); } bool flag3 = DrawStyledToggle(new Rect(num16, num19, num17, 34f), IsProhibitOthersEnabled(), text5); if (flag3 != IsProhibitOthersEnabled()) { SetProhibitOthers(flag3); } GUI.enabled = enabled2; curY += 135f; bool enabled3 = GUI.enabled; if (!IsStaticModEnabled()) { GUI.enabled = false; } Rect val7 = default(Rect); ((Rect)(ref val7))..ctor(num15, curY, num14, 170f); GUI.Box(val7, "", _sSection); DrawBorderRect(val7, _texBorder); num18 = curY + 12f; GUI.Label(new Rect(num16, num18, num17, 24f), UseChinese() ? "模组运行状态信息:" : "Mod Runtime Information:", _sTitle); num18 += 30f; string text6 = ((!SemiFunc.RunIsLobbyMenu()) ? (UseChinese() ? "已进入游戏关卡内" : "In Level / Game Session") : (UseChinese() ? "当前在大厅菜单中" : "In Lobby Menu")); GUI.Label(new Rect(num16, num18, num17, 24f), (UseChinese() ? "环境状态: " : "Environment: ") + text6, _sLabel); num18 += 26f; string text7; try { text7 = ((!PhotonNetwork.InRoom) ? (UseChinese() ? "单机模式 (可用)" : "Singleplayer (Available)") : ((!PhotonNetwork.IsMasterClient) ? (UseChinese() ? "联机客机 (功能可用,控制他人需房主)" : "Client (Available, control requires Host)") : (UseChinese() ? "联机房主 / 主机 (可用)" : "Host / MasterClient (Available)"))); } catch { text7 = (UseChinese() ? "单机模式 (可用)" : "Singleplayer (Available)"); } GUI.Label(new Rect(num16, num18, num17, 24f), (UseChinese() ? "权限状态: " : "Authority: ") + text7, _sStatus); num18 += 26f; string text8 = (((Object)(object)PlayerController.instance != (Object)null) ? PlayerSteamIDRef.Invoke(PlayerController.instance) : null); string text9 = (string.IsNullOrEmpty(text8) ? (UseChinese() ? "等待玩家初始化..." : "Waiting for Player avatar...") : (UseChinese() ? ("本地玩家ID已就绪 (SteamID: " + text8 + ")") : ("Player Ready (SteamID: " + text8 + ")"))); GUI.Label(new Rect(num16, num18, num17, 24f), (UseChinese() ? "玩家状态: " : "Player State: ") + text9, _sStatus); GUI.enabled = enabled3; curY += 185f; Rect val8 = default(Rect); ((Rect)(ref val8))..ctor(num15, curY, num14, 105f); GUI.Box(val8, "", _sSection); DrawBorderRect(val8, _texBorder); float num20 = curY + 12f; GUI.Label(new Rect(num16, num20, num17, 24f), UseChinese() ? "\ud83c\udfae 关卡与回合控制" : "\ud83c\udfae Level & Round Control", _sTitle); num20 += 30f; bool enabled4 = GUI.enabled; if (!IsStaticModEnabled() || (Object)(object)RunManager.instance == (Object)null) { GUI.enabled = false; } float num21 = (num17 - 12f) / 2f; string text10 = (UseChinese() ? "⚡ 切换下一关" : "⚡ Next Level"); if (GUI.Button(new Rect(num16, num20, num21, 40f), text10, _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 text11 = (UseChinese() ? "\ud83d\udd04 重载当前关卡" : "\ud83d\udd04 Reload Level"); if (GUI.Button(new Rect(num16 + num21 + 12f, num20, num21, 40f), text11, _sBtnRed)) { try { RunManager.instance.RestartScene(); } catch (Exception arg2) { Plugin instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogWarning((object)$"[RestartScene Error]: {arg2}"); } } } GUI.enabled = enabled4; curY += 120f; } else if (_currentTab == 1) { DrawTabPlayerControl(num15, ref curY, num14, num16, num17); } else if (_currentTab == 2) { bool enabled5 = GUI.enabled; if (!_cfgModEnabled.Value) { GUI.enabled = false; } string text12 = (UseChinese() ? "\ud83d\udd04 重置全部局内选项" : "\ud83d\udd04 Reset All Visual Settings"); if (GUI.Button(new Rect(num15, curY, num14, 40f), text12, _sBtnRed)) { ResetVisualSettings(); } curY += 52f; bool flag4 = _cfgThirdPersonEnabled != null && _cfgThirdPersonEnabled.Value; float num22 = (flag4 ? 345f : 225f); Rect val9 = default(Rect); ((Rect)(ref val9))..ctor(num15, curY, num14, num22); GUI.Box(val9, "", _sSection); DrawBorderRect(val9, _texBorder); float num23 = curY + 12f; bool flag5 = DrawStyledToggle(new Rect(num16, num23, num17, 34f), _cfgInfiniteWeaponBattery.Value, UseChinese() ? "⚡ 无限武器电量 (近战和远程武器使用时不消耗任何电池电量)" : "Infinite Weapon Battery (Melee and ranged weapons do not drain battery)"); if (flag5 != _cfgInfiniteWeaponBattery.Value) { _cfgInfiniteWeaponBattery.Value = flag5; SaveRuntimeConfig(); } num23 += 40f; bool flag6 = DrawStyledToggle(new Rect(num16, num23, num17, 34f), _cfgRemovePillarLimit.Value, UseChinese() ? "❌ 取消柱子掉落上限 (怪物死亡掉落的提取柱不再受关卡次数上限及距离限制并无限掉落)" : "Remove Shard Limit (Monsters drop valuable shards upon death without count or distance limits)"); if (flag6 != _cfgRemovePillarLimit.Value) { _cfgRemovePillarLimit.Value = flag6; SaveRuntimeConfig(); } num23 += 40f; bool flag7 = DrawStyledToggle(new Rect(num16, num23, num17, 34f), _cfgThirdPersonEnabled.Value, UseChinese() ? "\ud83c\udfa5 开启第三人称视角 (将相机稍微往斜后上方拉伸,以俯瞰视角显示本地玩家)" : "3rd Person View (Pull camera up and back to overlook local player)"); if (flag7 != _cfgThirdPersonEnabled.Value) { _cfgThirdPersonEnabled.Value = flag7; SaveRuntimeConfig(); } if (flag4) { num23 += 40f; GUI.Label(new Rect(num16, num23, 150f, 24f), UseChinese() ? ("机位距离: " + _cfgThirdPersonDistance.Value.ToString("F1")) : ("Camera Distance: " + _cfgThirdPersonDistance.Value.ToString("F1")), _sLabel); float num24 = GUI.HorizontalSlider(new Rect(num16 + 160f, num23 + 6f, num17 - 160f, 20f), _cfgThirdPersonDistance.Value, 1f, 5f, _sSlider, _sThumb); if (Mathf.Abs(num24 - _cfgThirdPersonDistance.Value) > 0.01f) { _cfgThirdPersonDistance.Value = num24; SaveRuntimeConfig(); } num23 += 30f; GUI.Label(new Rect(num16, num23, 150f, 24f), UseChinese() ? ("机位高度: " + _cfgThirdPersonHeight.Value.ToString("F1")) : ("Camera Height: " + _cfgThirdPersonHeight.Value.ToString("F1")), _sLabel); float num25 = GUI.HorizontalSlider(new Rect(num16 + 160f, num23 + 6f, num17 - 160f, 20f), _cfgThirdPersonHeight.Value, 0f, 2f, _sSlider, _sThumb); if (Mathf.Abs(num25 - _cfgThirdPersonHeight.Value) > 0.01f) { _cfgThirdPersonHeight.Value = num25; SaveRuntimeConfig(); } num23 += 30f; GUI.Label(new Rect(num16, num23, 150f, 24f), UseChinese() ? ("人物缩放: " + _cfgThirdPersonModelScale.Value.ToString("F2") + "x") : ("Model Scale: " + _cfgThirdPersonModelScale.Value.ToString("F2") + "x"), _sLabel); float num26 = GUI.HorizontalSlider(new Rect(num16 + 160f, num23 + 6f, num17 - 160f, 20f), _cfgThirdPersonModelScale.Value, 0.2f, 1f, _sSlider, _sThumb); if (Mathf.Abs(num26 - _cfgThirdPersonModelScale.Value) > 0.01f) { _cfgThirdPersonModelScale.Value = num26; SaveRuntimeConfig(); } num23 += 30f; GUI.Label(new Rect(num16, num23, 150f, 24f), UseChinese() ? ("相机左右偏置: " + ((_cfgThirdPersonHorizontal.Value > 0.01f) ? "+" : "") + _cfgThirdPersonHorizontal.Value.ToString("F1")) : ("Camera Horizontal: " + ((_cfgThirdPersonHorizontal.Value > 0.01f) ? "+" : "") + _cfgThirdPersonHorizontal.Value.ToString("F1")), _sLabel); float num27 = GUI.HorizontalSlider(new Rect(num16 + 160f, num23 + 6f, num17 - 160f, 20f), _cfgThirdPersonHorizontal.Value, -1.5f, 1.5f, _sSlider, _sThumb); if (Mathf.Abs(num27 - _cfgThirdPersonHorizontal.Value) > 0.01f) { _cfgThirdPersonHorizontal.Value = num27; SaveRuntimeConfig(); } } num23 += (flag4 ? 30f : 40f); bool flag8 = DrawStyledToggle(new Rect(num16, num23, num17, 34f), _cfgGodModeFlightEnabled.Value, UseChinese() ? "\ud83d\udd4a\ufe0f 上帝飞行模式 (开启后可通过 WASD+空格/Ctrl 穿墙上下左右飞行,开启时自动开启无敌)" : "God Flight Mode (Fly freely through walls with WASD+Space/Ctrl, auto-enables God Mode)"); if (flag8 != _cfgGodModeFlightEnabled.Value) { _cfgGodModeFlightEnabled.Value = flag8; SaveRuntimeConfig(); if ((Object)(object)PlayerAvatar.instance != (Object)null) { string text13 = PlayerAvatarSteamIDRef.Invoke(PlayerAvatar.instance); if (!string.IsNullOrEmpty(text13)) { SetPlayerGodMode(text13, flag8); } } } num23 += 40f; GUI.Label(new Rect(num16, num23, num17, 24f), UseChinese() ? "※ 特效均实时生效。无限武器电量仅对本地玩家自己生效。" : "* Effects apply immediately. Infinite Battery only applies to local player.", _sStatus); curY += num22 + 20f; Rect val10 = default(Rect); ((Rect)(ref val10))..ctor(num15, curY, num14, 336f); GUI.Box(val10, "", _sSection); DrawBorderRect(val10, _texBorder); num23 = curY + 12f; bool flag9 = DrawStyledToggle(new Rect(num16, num23, num17, 34f), _cfgWingsAlwaysShow.Value, UseChinese() ? "激活翅膀常显 (不论是否情绪跌落、是否落地,炫酷发光翅膀永久展开)" : "Wings Always Active (Glowing wings stay active indefinitely)"); if (flag9 != _cfgWingsAlwaysShow.Value) { _cfgWingsAlwaysShow.Value = flag9; SaveRuntimeConfig(); } num23 += 40f; bool enabled6 = GUI.enabled; GUI.enabled = enabled6 && flag9; int num28 = DrawStyledSliderInt(new Rect(num16, num23, num17, 36f), _cfgWingsShowFrequency.Value, 0, 5, UseChinese() ? ("显示频率: " + ((_cfgWingsShowFrequency.Value == 0) ? "常亮 (0秒)" : $"每隔 {_cfgWingsShowFrequency.Value} 秒显示一次")) : ("Flicker Interval: " + ((_cfgWingsShowFrequency.Value == 0) ? "Always ON" : $"{_cfgWingsShowFrequency.Value}s"))); if (num28 != _cfgWingsShowFrequency.Value) { _cfgWingsShowFrequency.Value = num28; SaveRuntimeConfig(); } num23 += 42f; GUI.Label(new Rect(num16, num23, 240f, 24f), UseChinese() ? "翅膀指定颜色 (所有联机玩家可见):" : "Wings Color (Visible to All):", _sLabel); num23 += 30f; string[] array2 = ((!UseChinese()) ? new string[3] { "Default/None", "Pink (Level 2)", "Blue (Level 3)" } : new string[3] { "默认/无", "原版粉色 (2级)", "原版蓝色 (3级)" }); float num29 = (num17 - 20f) / 3f; float num30 = 36f; for (int j = 0; j < 3; j++) { bool flag10 = _cfgWingsColorIndex.Value == j; if (GUI.Button(new Rect(num16 + (float)j * (num29 + 10f), num23, num29, num30), array2[j], flag10 ? _sBtnGreen : _sBtnNormal)) { _cfgWingsColorIndex.Value = j; SaveRuntimeConfig(); } } num23 += 42f; bool flag11 = DrawStyledToggle(new Rect(num16, num23, num17, 34f), _cfgEnableWingsSound.Value, UseChinese() ? "播放翅膀背景音乐 (常显状态下开启/关闭滑翔声效,默认关闭)" : "Play Wings Background Music (Toggle glide sound in active state, OFF by default)"); if (flag11 != _cfgEnableWingsSound.Value) { _cfgEnableWingsSound.Value = flag11; SaveRuntimeConfig(); } num23 += 40f; bool flag12 = DrawStyledToggle(new Rect(num16, num23, num17, 34f), _cfgTumbleFlyEnabled.Value, UseChinese() ? "Q键飞行方向控制 (空中摔倒状态下按 WASD + 空格/Ctrl 自由飞翔)" : "Tumble Fly Control (WASD + Space/Ctrl to fly freely in ragdoll state)"); if (flag12 != _cfgTumbleFlyEnabled.Value) { _cfgTumbleFlyEnabled.Value = flag12; SaveRuntimeConfig(); } num23 += 40f; GUI.Label(new Rect(num16, num23, num17, 24f), UseChinese() ? "※ 开启后,在空中摔倒时能自由控制飞行方向。飞行状态下会自动展开背部翅膀。" : "* Allows controlling ragdoll flight in mid-air. Wings will render automatically.", _sStatus); GUI.enabled = enabled6; curY += 356f; Rect val11 = default(Rect); ((Rect)(ref val11))..ctor(num15, curY, num14, 160f); GUI.Box(val11, "", _sSection); DrawBorderRect(val11, _texBorder); num23 = curY + 12f; bool flag13 = DrawStyledToggle(new Rect(num16, num23, num17, 34f), _cfgJumpMultiplierEnabled.Value, UseChinese() ? "开启超级大跳 (修改本地玩家起跳力倍数)" : "Enable Super Jump (Modify local player jump force multiplier)"); if (flag13 != _cfgJumpMultiplierEnabled.Value) { _cfgJumpMultiplierEnabled.Value = flag13; SaveRuntimeConfig(); } num23 += 40f; bool enabled7 = GUI.enabled; GUI.enabled = enabled7 && flag13; float num31 = DrawStyledSliderFloat(new Rect(num16, num23, num17, 36f), _cfgJumpMultiplier.Value, 1f, 3f, UseChinese() ? "大跳物理力度倍数:" : "Jump Force Multiplier:"); if (Mathf.Abs(num31 - _cfgJumpMultiplier.Value) > 0.01f) { _cfgJumpMultiplier.Value = num31; SaveRuntimeConfig(); } GUI.enabled = enabled7; num23 += 40f; GUI.Label(new Rect(num16, num23, num17, 24f), UseChinese() ? "※ 超级大跳在本地物理模拟中计算,可助力越过常规手段无法跨越的高墙或深坑。" : "* Super Jump runs on local physics to help clear high walls or deep gaps.", _sStatus); curY += 160f; GUI.enabled = enabled5; } else if (_currentTab == 4) { bool enabled8 = GUI.enabled; if (!IsStaticModEnabled()) { GUI.enabled = false; } string text14 = (UseChinese() ? "\ud83d\udd04 重置全部刷怪选项" : "\ud83d\udd04 Reset All Monster Settings"); if (GUI.Button(new Rect(num15, curY, num14, 40f), text14, _sBtnRed)) { ResetMonsterData(); } curY += 52f; if (!((Object)(object)PlayerController.instance != (Object)null) || !((Object)(object)EnemyDirector.instance != (Object)null)) { Rect val12 = default(Rect); ((Rect)(ref val12))..ctor(num15, curY, num14, 200f); GUI.Box(val12, "", _sSection); DrawBorderRect(val12, _texBorder); float num32 = curY + 50f; GUI.Label(new Rect(num16, num32, num17, 30f), UseChinese() ? "⚠\ufe0f 请在进入游戏局内后再查看刷怪状态监控!" : "⚠\ufe0f Please enter a level session first!", _sTitle); curY += 220f; } else { if ((Object)(object)EnemyDirector.instance != (Object)null && EnemyDirector.instance.enemiesSpawned != null) { EnemyDirector.instance.enemiesSpawned.RemoveAll((EnemyParent ep) => (Object)(object)ep == (Object)null || !Object.op_Implicit((Object)(object)ep) || (Object)(object)((Component)ep).gameObject == (Object)null); } List list = (((Object)(object)EnemyDirector.instance != (Object)null) ? EnemyDirector.instance.enemiesSpawned : null); int num33 = list?.Count ?? 0; Rect val13 = default(Rect); ((Rect)(ref val13))..ctor(num15, curY, num14, 183f); GUI.Box(val13, "", _sSection); DrawBorderRect(val13, _texBorder); float num34 = curY + 12f; GUI.Label(new Rect(num16, num34, num17, 24f), UseChinese() ? "\ud83d\udc7e 刷怪倍率与难度增强" : "\ud83d\udc7e Spawn Rate & Difficulty Enhancements", _sTitle); num34 += 28f; bool enabled9 = GUI.enabled; int num35 = DrawStyledSliderInt(new Rect(num16, num34, num17, 36f), Mathf.RoundToInt(_cfgSpawnRateMultiplier.Value), 1, 50, UseChinese() ? "关卡刷怪数量倍率:" : "Level Spawn Multiplier:"); if (Mathf.Abs((float)num35 - _cfgSpawnRateMultiplier.Value) > 0.01f) { _cfgSpawnRateMultiplier.Value = num35; SaveRuntimeConfig(); } num34 += 36f; Rect rect = default(Rect); ((Rect)(ref rect))..ctor(num16, num34, 360f, 24f); string text15 = (UseChinese() ? "每次关卡刷新怪物数据重置" : "Reset Monster Data on Level Load"); bool value2 = _cfgResetMonsterDataOnLevelLoad.Value; bool flag14 = DrawStyledToggle(rect, value2, text15); if (flag14 != value2) { _cfgResetMonsterDataOnLevelLoad.Value = flag14; SaveRuntimeConfig(); } num34 += 30f; Rect rect2 = default(Rect); ((Rect)(ref rect2))..ctor(num16, num34, num17, 24f); string text16 = (UseChinese() ? "⚡ 全局动作/过载下限 (开启后所有怪物的动作速度和过载倍率不低于 0.1x,防止怪物完全冻结)" : "⚡ Global Action/Overcharge Floor (Clamp all monsters' action & overcharge multipliers >= 0.1x)"); bool value3 = _cfgLimitActionAndOvercharge.Value; bool flag15 = DrawStyledToggle(rect2, value3, text16); if (flag15 != value3) { _cfgLimitActionAndOvercharge.Value = flag15; SaveRuntimeConfig(); } GUI.enabled = enabled9; num34 += 28f; GUI.Label(new Rect(num16, num34, num17, 24f), UseChinese() ? "※ 控制关卡初始生成的怪物槽总数量(切关时生效)以及已生成槽位的倒计时刷新速度(实时生效)。" : "* Multiplies the initial spawn slot count (takes effect next level) and reduces spawn cooldowns (real-time).", _sStatus); curY += 200f; if (!_globalOverrideInited && list != null && list.Count > 0) { EnemyParent val14 = list[0]; if ((Object)(object)val14 != (Object)null) { _globalDespawnMin = val14.DespawnedTimeMin; _globalDespawnMax = val14.DespawnedTimeMax; _globalSpawnMin = val14.SpawnedTimeMin; _globalSpawnMax = val14.SpawnedTimeMax; _originalDespawnMin = val14.DespawnedTimeMin; _originalDespawnMax = val14.DespawnedTimeMax; _originalSpawnMin = val14.SpawnedTimeMin; _originalSpawnMax = val14.SpawnedTimeMax; _globalOverrideInited = true; } } Rect val15 = default(Rect); ((Rect)(ref val15))..ctor(num15, curY, num14, 430f); GUI.Box(val15, "", _sSection); DrawBorderRect(val15, _texBorder); float num36 = curY + 12f; GUI.Label(new Rect(num16, num36, num17, 24f), UseChinese() ? "\ud83d\udc7e 怪物导演 (EnemyDirector) 全局状态" : "\ud83d\udc7e Global Enemy Director Status", _sTitle); num36 += 26f; float num37 = 0f; try { num37 = EnemyDirectorSpawnIdlePauseTimerRef.Invoke(EnemyDirector.instance); } catch { } string text17 = (UseChinese() ? $"全局生成暂停计时: {num37:F1} 秒 | 怪物槽总数: {num33}" : $"Spawn Idle Pause: {num37:F1}s | Total Slots: {num33}"); GUI.Label(new Rect(num16, num36, num17, 24f), text17, _sLabel); float num38 = curY + 65f; bool enabled10 = GUI.enabled; GUI.Label(new Rect(num16, num38, 120f, 24f), UseChinese() ? "全局最小刷新:" : "Global Min Spawn:", _sLabel); float num39 = GUI.HorizontalSlider(new Rect(num16 + 130f, num38 + 8f, 240f, 20f), _globalDespawnMin, 1f, 300f, _sSlider, _sThumb); if (Mathf.Abs(num39 - _globalDespawnMin) > 0.01f) { _globalDespawnMin = Mathf.Round(num39 * 10f) / 10f; foreach (EnemyParent item in list) { if ((Object)(object)item != (Object)null) { item.DespawnedTimeMin = _globalDespawnMin; } } } GUI.Label(new Rect(num16 + 380f, num38, 60f, 24f), $"{_globalDespawnMin:F1}s", _sToggleOn); num38 += 38f; GUI.Label(new Rect(num16, num38, 120f, 24f), UseChinese() ? "全局最大刷新:" : "Global Max Spawn:", _sLabel); float num40 = GUI.HorizontalSlider(new Rect(num16 + 130f, num38 + 8f, 240f, 20f), _globalDespawnMax, 1f, 300f, _sSlider, _sThumb); if (Mathf.Abs(num40 - _globalDespawnMax) > 0.01f) { _globalDespawnMax = Mathf.Round(num40 * 10f) / 10f; if (_globalDespawnMax < _globalDespawnMin) { _globalDespawnMax = _globalDespawnMin; } foreach (EnemyParent item2 in list) { if ((Object)(object)item2 != (Object)null) { item2.DespawnedTimeMax = _globalDespawnMax; } } } GUI.Label(new Rect(num16 + 380f, num38, 60f, 24f), $"{_globalDespawnMax:F1}s", _sToggleOn); num38 += 38f; GUI.Label(new Rect(num16, num38, 120f, 24f), UseChinese() ? "全局最小寿命:" : "Global Min Life:", _sLabel); float num41 = GUI.HorizontalSlider(new Rect(num16 + 130f, num38 + 8f, 240f, 20f), _globalSpawnMin, 1f, 600f, _sSlider, _sThumb); if (Mathf.Abs(num41 - _globalSpawnMin) > 0.01f) { _globalSpawnMin = Mathf.Round(num41 * 10f) / 10f; foreach (EnemyParent item3 in list) { if ((Object)(object)item3 != (Object)null) { item3.SpawnedTimeMin = _globalSpawnMin; } } } GUI.Label(new Rect(num16 + 380f, num38, 60f, 24f), $"{_globalSpawnMin:F1}s", _sToggleOn); num38 += 38f; GUI.Label(new Rect(num16, num38, 120f, 24f), UseChinese() ? "全局最大寿命:" : "Global Max Life:", _sLabel); float num42 = GUI.HorizontalSlider(new Rect(num16 + 130f, num38 + 8f, 240f, 20f), _globalSpawnMax, 1f, 600f, _sSlider, _sThumb); if (Mathf.Abs(num42 - _globalSpawnMax) > 0.01f) { _globalSpawnMax = Mathf.Round(num42 * 10f) / 10f; if (_globalSpawnMax < _globalSpawnMin) { _globalSpawnMax = _globalSpawnMin; } foreach (EnemyParent item4 in list) { if ((Object)(object)item4 != (Object)null) { item4.SpawnedTimeMax = _globalSpawnMax; } } } GUI.Label(new Rect(num16 + 380f, num38, 60f, 24f), $"{_globalSpawnMax:F1}s", _sToggleOn); float num43 = num16 + 460f; float num44 = num17 - 460f; if (num44 < 200f) { num44 = 280f; } string text18 = (UseChinese() ? "⚡ 强制全体出生" : "⚡ Force All Spawns"); if (GUI.Button(new Rect(num43, curY + 55f, num44, 32f), text18, _sBtnGreen)) { try { EnemyDirectorSpawnIdlePauseTimerRef.Invoke(EnemyDirector.instance) = 0f; } catch { } if (list != null) { foreach (EnemyParent item5 in list) { if ((Object)(object)item5 != (Object)null && !EnemyParentSpawnedRef.Invoke(item5)) { item5.DespawnedTimerSet(0f, false); } } } } string text19 = (UseChinese() ? "\ud83d\udc80 全局一键击杀" : "\ud83d\udc80 Kill All Enemies"); if (GUI.Button(new Rect(num43, curY + 95f, num44, 32f), text19, _sBtnRed) && list != null) { foreach (EnemyParent item6 in list) { if (!((Object)(object)item6 != (Object)null) || !EnemyParentSpawnedRef.Invoke(item6)) { continue; } Enemy val16 = EnemyParentEnemyRef.Invoke(item6); if (!((Object)(object)val16 != (Object)null)) { continue; } EnemyHealth val17 = EnemyHealthRef.Invoke(val16); if ((Object)(object)val17 != (Object)null) { try { val17.Hurt(9999, Vector3.zero); } catch { } } } } string text20 = (UseChinese() ? "\ud83d\udca5 强制全体消失" : "\ud83d\udca5 Force All Despawns"); if (GUI.Button(new Rect(num43, curY + 135f, num44, 32f), text20, _sBtnRed) && list != null) { foreach (EnemyParent item7 in list) { if ((Object)(object)item7 != (Object)null && EnemyParentSpawnedRef.Invoke(item7)) { try { item7.Despawn(); } catch { } } } } string text21 = (UseChinese() ? "\ud83d\udccd 全体拉到面前" : "\ud83d\udccd Pull All Enemies"); if (GUI.Button(new Rect(num43, curY + 175f, num44, 32f), text21, _sBtnNormal) && list != null && (Object)(object)PlayerController.instance != (Object)null) { Vector3 val18 = ((Component)PlayerController.instance).transform.position + ((Component)PlayerController.instance).transform.forward * 3f + Vector3.up * 0.5f; foreach (EnemyParent item8 in list) { if (!((Object)(object)item8 != (Object)null) || !EnemyParentSpawnedRef.Invoke(item8)) { continue; } Enemy val19 = EnemyParentEnemyRef.Invoke(item8); if ((Object)(object)val19 != (Object)null) { try { val19.EnemyTeleported(val18); } catch { } } } } string text22 = (UseChinese() ? "\ud83c\udfb2 全体随机分布" : "\ud83c\udfb2 Random Scatter Enemies"); if (GUI.Button(new Rect(num43, curY + 215f, num44, 32f), text22, _sBtnNormal) && list != null) { List scatterPoints = GetScatterPoints(); if (scatterPoints.Count > 0) { foreach (EnemyParent item9 in list) { if (!((Object)(object)item9 != (Object)null) || !EnemyParentSpawnedRef.Invoke(item9)) { continue; } Enemy val20 = EnemyParentEnemyRef.Invoke(item9); if ((Object)(object)val20 != (Object)null) { int index = Random.Range(0, scatterPoints.Count); Vector3 val21 = scatterPoints[index] + Vector3.up * 0.5f; try { val20.EnemyTeleported(val21); } catch { } } } } } string text23 = (UseChinese() ? "❌ 一键移除所有刷新" : "❌ Clear All Spawns"); if (GUI.Button(new Rect(num43, curY + 255f, num44, 32f), text23, _sBtnRed) && list != null) { foreach (EnemyParent item10 in new List(list)) { if ((Object)(object)item10 != (Object)null) { try { item10.Despawn(); } catch { } try { EnemyDirector.instance.enemiesSpawned.Remove(item10); } catch { } } } } num38 += 38f; GUI.Label(new Rect(num16, num38, 120f, 24f), UseChinese() ? "全局体积:" : "Global Scale:", _sLabel); float num45 = 1f; int num46 = 0; float num47 = 0f; if (list != null) { foreach (EnemyParent item11 in list) { if ((Object)(object)item11 != (Object)null && EnemyParentSpawnedRef.Invoke(item11)) { num47 += ((Component)item11).transform.localScale.x; num46++; } } } if (num46 > 0) { num45 = num47 / (float)num46; } float num48 = Mathf.Round(GUI.HorizontalSlider(new Rect(num16 + 130f, num38 + 8f, 240f, 20f), num45, 0.1f, 5f, _sSlider, _sThumb) * 10f) / 10f; if (Mathf.Abs(num48 - num45) > 0.05f && list != null) { foreach (EnemyParent item12 in list) { if ((Object)(object)item12 != (Object)null && EnemyParentSpawnedRef.Invoke(item12)) { SetEnemyScale(item12, num48); } } } GUI.Label(new Rect(num16 + 380f, num38, 60f, 24f), $"{num48:F1}x", _sToggleOn); num43 = num16 + 460f; num44 = num17 - 460f; if (num44 < 200f) { num44 = 280f; } string text24 = (UseChinese() ? "\ud83d\udcd0 重置全部体积" : "\ud83d\udcd0 Reset All Scale"); if (GUI.Button(new Rect(num43, curY + 335f, num44, 32f), text24, _sBtnNormal) && list != null) { foreach (EnemyParent item13 in list) { if ((Object)(object)item13 != (Object)null) { SetEnemyScale(item13, 1f); } } } GUI.enabled = enabled10; string text25 = (UseChinese() ? "\ud83d\udd04 刷新/重读数据" : "\ud83d\udd04 Refresh Data"); if (GUI.Button(new Rect(num43, curY + 295f, num44, 32f), text25, _sBtnNormal)) { _globalOverrideInited = false; if ((Object)(object)EnemyDirector.instance != (Object)null) { EnemyParent[] array3 = Object.FindObjectsOfType(true); List list2 = new List(); EnemyParent[] array4 = array3; foreach (EnemyParent val22 in array4) { if ((Object)(object)val22 != (Object)null && (Object)(object)((Component)val22).gameObject != (Object)null && !list2.Contains(val22)) { list2.Add(val22); } } EnemyDirector.instance.enemiesSpawned = list2; } Plugin instance3 = Instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogInfo((object)"[GameTools] Reloaded/refreshed enemy settings from live game."); } } curY += 450f; int num50 = 0; int num51 = 0; if (list != null) { foreach (EnemyParent item14 in list) { if ((Object)(object)item14 != (Object)null) { if (EnemyParentSpawnedRef.Invoke(item14)) { num50++; } else { num51++; } } } } new Rect(num15, curY, num14, 36f); string[] array5 = ((!UseChinese()) ? new string[2] { $"\ud83d\udfe2 Alive Enemies ({num50})", $"\ud83d\udd34 Despawned Slots ({num51})" } : new string[2] { $"\ud83d\udfe2 存活怪物列表 (共 {num50} 只)", $"\ud83d\udd34 待刷槽位列表 (共 {num51} 个)" }); float num52 = num14 / 2f; for (int num53 = 0; num53 < 2; num53++) { bool flag16 = _monsterSubTab == num53; if (GUI.Button(new Rect(num15 + (float)num53 * num52, curY, num52 - 4f, 32f), array5[num53], flag16 ? _sBtnGreen : _sBtnNormal)) { _monsterSubTab = num53; } } curY += 44f; if (num33 == 0) { Rect val23 = default(Rect); ((Rect)(ref val23))..ctor(num15, curY, num14, 100f); GUI.Box(val23, "", _sSection); DrawBorderRect(val23, _texBorder); GUI.Label(new Rect(num16, curY + 36f, num17, 24f), UseChinese() ? "当前地图尚未加载任何怪物槽..." : "No enemy slots loaded in the current level...", _sLabel); curY += 120f; } else { int num54 = 0; Rect val25 = default(Rect); for (int num55 = 0; num55 < num33; num55++) { EnemyParent val24 = list[num55]; if ((Object)(object)val24 == (Object)null || !Object.op_Implicit((Object)(object)val24) || (Object)(object)((Component)val24).gameObject == (Object)null) { continue; } try { bool flag17 = EnemyParentSpawnedRef.Invoke(val24); if ((_monsterSubTab == 0 && !flag17) || (_monsterSubTab == 1 && flag17)) { continue; } num54++; float num56 = ((_monsterSubTab == 0) ? 220f : 130f); ((Rect)(ref val25))..ctor(num15, curY, num14, num56); GUI.Box(val25, "", _sSection); DrawBorderRect(val25, _texBorder); string text26 = val24.enemyName.Replace("Enemy - ", "").Replace("Enemy ", ""); string arg3 = (UseChinese() ? EnemyNameLocalizer.Translate(text26) : text26); Enemy val26 = EnemyParentEnemyRef.Invoke(val24); EnemyHealth val27 = null; if ((Object)(object)val26 != (Object)null) { val27 = EnemyHealthRef.Invoke(val26); } float num57 = num16; float num58 = num16 + 250f; float num59 = num16 + num17 - 150f; if (_monsterSubTab == 0) { int num60 = (((Object)(object)val27 != (Object)null) ? EnemyHealthCurrentRef.Invoke(val27) : 0); int num61 = (((Object)(object)val27 != (Object)null) ? val27.health : 0); string text27 = (((Object)(object)val27 != (Object)null) ? $"❤\ufe0f HP: {num60}/{num61}" : "❤\ufe0f HP: --/--"); GUI.Label(new Rect(num57, curY + 12f, 240f, 24f), $"[{num55 + 1}] {arg3}", _sTitle); GUI.Label(new Rect(num57, curY + 42f, 240f, 24f), text27, ((float)num60 < (float)num61 * 0.3f) ? _sBtnRed : _sStatus); GUI.Label(new Rect(num57, curY + 70f, 240f, 24f), UseChinese() ? $"⏱\ufe0f 已活: {val24.SpawnedTimer:F1}秒" : $"⏱\ufe0f Life: {val24.SpawnedTimer:F1}s", _sLabel); GUI.Label(new Rect(num57, curY + 98f, 240f, 24f), UseChinese() ? $"⚙\ufe0f 难度: {val24.difficulty}" : $"⚙\ufe0f Diff: {val24.difficulty}", _sLabel); bool flag18 = EnemyParentPlayerCloseRef.Invoke(val24); string text28 = ((!flag18) ? (UseChinese() ? "\ud83c\udf43 四下无人" : "\ud83c\udf43 Empty Area") : (UseChinese() ? "\ud83d\udc65 玩家在旁" : "\ud83d\udc65 Player Near")); GUI.Label(new Rect(num57, curY + 126f, 240f, 24f), text28, flag18 ? _sStatus : _sLabel); float num62 = num58 + 130f; float num63 = num16 + num17 - 210f; float num64 = num63 - num62 - 10f; GUI.Label(new Rect(num58, curY + 12f, 120f, 24f), UseChinese() ? "最小寿命:" : "Min Life:", _sLabel); float num65 = GUI.HorizontalSlider(new Rect(num62, curY + 18f, num64, 20f), val24.SpawnedTimeMin, 1f, 600f, _sSlider, _sThumb); val24.SpawnedTimeMin = Mathf.Round(num65 * 10f) / 10f; GUI.Label(new Rect(num63, curY + 12f, 50f, 24f), $"{val24.SpawnedTimeMin:F0}s", _sToggleOn); GUI.Label(new Rect(num58, curY + 54f, 120f, 24f), UseChinese() ? "最大寿命:" : "Max Life:", _sLabel); float num66 = GUI.HorizontalSlider(new Rect(num62, curY + 60f, num64, 20f), val24.SpawnedTimeMax, 1f, 600f, _sSlider, _sThumb); val24.SpawnedTimeMax = Mathf.Round(num66 * 10f) / 10f; if (val24.SpawnedTimeMax < val24.SpawnedTimeMin) { val24.SpawnedTimeMax = val24.SpawnedTimeMin; } GUI.Label(new Rect(num63, curY + 54f, 50f, 24f), $"{val24.SpawnedTimeMax:F0}s", _sToggleOn); GUI.Label(new Rect(num58, curY + 96f, 120f, 24f), UseChinese() ? "动作速度:" : "Action Spd:", _sLabel); float num67 = GUI.HorizontalSlider(new Rect(num62, curY + 102f, num64, 20f), val24.actionMultiplier, 0.1f, 5f, _sSlider, _sThumb); val24.actionMultiplier = Mathf.Round(num67 * 10f) / 10f; GUI.Label(new Rect(num63, curY + 96f, 50f, 24f), $"{val24.actionMultiplier:F1}x", _sToggleOn); GUI.Label(new Rect(num58, curY + 138f, 120f, 24f), UseChinese() ? "过载倍率:" : "Overcharge:", _sLabel); float num68 = GUI.HorizontalSlider(new Rect(num62, curY + 144f, num64, 20f), val24.overchargeMultiplier, 0.1f, 5f, _sSlider, _sThumb); val24.overchargeMultiplier = Mathf.Round(num68 * 10f) / 10f; GUI.Label(new Rect(num63, curY + 138f, 50f, 24f), $"{val24.overchargeMultiplier:F1}x", _sToggleOn); float num69 = 140f; float num70 = 32f; float num71 = curY + 12f; if (GUI.Button(new Rect(num59, num71, num69, num70), UseChinese() ? "\ud83d\udccd 拉到面前" : "\ud83d\udccd Pull", _sBtnNormal) && (Object)(object)val26 != (Object)null && (Object)(object)PlayerController.instance != (Object)null) { try { Vector3 spawnPosition = GetSpawnPosition(3f); val26.EnemyTeleported(spawnPosition); } catch { } } num71 += 38f; if (GUI.Button(new Rect(num59, num71, num69, num70), UseChinese() ? "✈\ufe0f 飞过去" : "✈\ufe0f Goto", _sBtnNormal) && (Object)(object)val26 != (Object)null && (Object)(object)PlayerController.instance != (Object)null) { try { Vector3 position = ((Component)val26).transform.position + Vector3.up * 0.5f; PlayerAvatar val28 = (((Object)(object)PlayerController.instance.playerAvatarScript != (Object)null) ? ((Component)PlayerController.instance.playerAvatarScript).GetComponent() : null); if ((Object)(object)val28 != (Object)null) { TeleportPlayer(val28, position); } } catch { } } num71 += 38f; if (GUI.Button(new Rect(num59, num71, num69, num70), UseChinese() ? "⚡ 一键击杀" : "⚡ Kill Enemy", _sBtnRed) && (Object)(object)val27 != (Object)null) { try { val27.Hurt(9999, Vector3.zero); } catch { } } num71 += 38f; if (GUI.Button(new Rect(num59, num71, num69, num70), UseChinese() ? "\ud83d\udca5 强制消失" : "\ud83d\udca5 Despawn", _sBtnRed)) { try { val24.Despawn(); } catch { } } num71 += 38f; if (GUI.Button(new Rect(num59, num71, num69, num70), UseChinese() ? "❌ 移除刷新" : "❌ Remove", _sBtnRed)) { try { val24.Despawn(); } catch { } try { EnemyDirector.instance.enemiesSpawned.Remove(val24); } catch { } } } else { GUI.Label(new Rect(num57, curY + 12f, 240f, 24f), $"[{num55 + 1}] {arg3}", _sTitle); GUI.Label(new Rect(num57, curY + 42f, 240f, 24f), UseChinese() ? $"\ud83d\udc80 炸裂刷新: {val24.DespawnedTimer:F1}s" : $"\ud83d\udc80 Spawn In: {val24.DespawnedTimer:F1}s", _sBtnRed); GUI.Label(new Rect(num57, curY + 70f, 240f, 24f), UseChinese() ? $"⚙\ufe0f 难度: {val24.difficulty}" : $"⚙\ufe0f Diff: {val24.difficulty}", _sLabel); float num72 = num58 + 130f; float num73 = num16 + num17 - 210f; float num74 = num73 - num72 - 10f; GUI.Label(new Rect(num58, curY + 22f, 120f, 24f), UseChinese() ? "最小刷新:" : "Min Spawn:", _sLabel); float num75 = GUI.HorizontalSlider(new Rect(num72, curY + 28f, num74, 20f), val24.DespawnedTimeMin, 1f, 300f, _sSlider, _sThumb); val24.DespawnedTimeMin = Mathf.Round(num75 * 10f) / 10f; GUI.Label(new Rect(num73, curY + 22f, 50f, 24f), $"{val24.DespawnedTimeMin:F0}s", _sToggleOn); GUI.Label(new Rect(num58, curY + 70f, 120f, 24f), UseChinese() ? "最大刷新:" : "Max Spawn:", _sLabel); float num76 = GUI.HorizontalSlider(new Rect(num72, curY + 76f, num74, 20f), val24.DespawnedTimeMax, 1f, 300f, _sSlider, _sThumb); val24.DespawnedTimeMax = Mathf.Round(num76 * 10f) / 10f; if (val24.DespawnedTimeMax < val24.DespawnedTimeMin) { val24.DespawnedTimeMax = val24.DespawnedTimeMin; } GUI.Label(new Rect(num73, curY + 70f, 50f, 24f), $"{val24.DespawnedTimeMax:F0}s", _sToggleOn); float num77 = 140f; float num78 = 32f; float num79 = curY + 22f; if (GUI.Button(new Rect(num59, num79, num77, num78), UseChinese() ? "⚡ 立即出生" : "⚡ Spawn Now", _sBtnGreen)) { val24.DespawnedTimerSet(0f, false); } num79 += 42f; if (GUI.Button(new Rect(num59, num79, num77, num78), UseChinese() ? "❌ 移除刷新" : "❌ Remove", _sBtnRed)) { try { EnemyDirector.instance.enemiesSpawned.Remove(val24); } catch { } } } curY += num56 + 16f; } catch (Exception arg4) { Plugin instance4 = Instance; if (instance4 != null) { ((BaseUnityPlugin)instance4).Logger.LogWarning((object)$"[DrawMonsterCard Error] Index {num55}: {arg4}"); } } } if (num54 == 0) { Rect val29 = default(Rect); ((Rect)(ref val29))..ctor(num15, curY, num14, 100f); GUI.Box(val29, "", _sSection); DrawBorderRect(val29, _texBorder); string text29 = ((_monsterSubTab != 0) ? (UseChinese() ? "当前地图没有待刷新的怪物槽。" : "No despawned enemy slots.") : (UseChinese() ? "当前地图没有任何存活的怪物。" : "No alive enemies in the level.")); GUI.Label(new Rect(num16, curY + 36f, num17, 24f), text29, _sLabel); curY += 120f; } } } _lastVirtualHeight = curY + 20f; GUI.enabled = enabled8; } _lastVirtualHeight = curY + 20f; GUI.EndScrollView(); } if (_showConfirmSpawn && _pendingSpawnInfo != null) { DrawConfirmSpawnDialog(); } GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _windowRect)).width - 50f, 30f)); } private void DrawTabSpawner(Rect viewRect) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_0235: 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_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Expected O, but got Unknown //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Expected O, but got Unknown //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_053f: Unknown result type (might be due to invalid IL or missing references) //IL_0589: Unknown result type (might be due to invalid IL or missing references) //IL_06a5: Unknown result type (might be due to invalid IL or missing references) //IL_074a: Unknown result type (might be due to invalid IL or missing references) //IL_076a: Unknown result type (might be due to invalid IL or missing references) //IL_076f: Unknown result type (might be due to invalid IL or missing references) //IL_0771: Unknown result type (might be due to invalid IL or missing references) //IL_0776: Unknown result type (might be due to invalid IL or missing references) //IL_07bb: 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; string text = (UseChinese() ? "\ud83d\udd04 重置全部刷取选项" : "\ud83d\udd04 Reset All Spawner Settings"); if (GUI.Button(new Rect(x, y, width, 40f), text, _sBtnRed)) { _spawnCount = 1; _spawnCountStr = "1"; _cfgSpawnedAutoRespawn = false; _cfgSpawnedDelayPull = false; } y += 52f; height -= 52f; Rect val = default(Rect); ((Rect)(ref val))..ctor(x, y, 200f, height); GUI.Box(val, "", _sSection); DrawBorderRect(val, _texBorder); string[] array = ((!UseChinese()) ? new string[13] { "\ud83d\udc7e Enemies", "\ud83c\udfa8 Custom Enemies", "\ud83d\udc8e Valuables", "\ud83c\udf81 Cosmetic Boxes", "\ud83e\uddea Potions", "⚔\ufe0f Melee", "\ud83d\udd2b Ranged", "\ud83d\udca3 Others", "\ud83d\uded2 Carts", "\ud83c\udfce\ufe0f Vehicles", "\ud83d\udef8 Drones", "\ud83d\udce6 Other Items", "\ud83c\udfa8 Custom Items" } : new string[13] { "\ud83d\udc7e 危险怪物", "\ud83c\udfa8 自定怪物", "\ud83d\udc8e 贵重物品", "\ud83c\udf81 代币箱子", "\ud83e\uddea 升级药水", "⚔\ufe0f 近战武器", "\ud83d\udd2b 远程武器", "\ud83d\udca3 其他装备", "\ud83d\uded2 运载推车", "\ud83c\udfce\ufe0f 赛车交通", "\ud83d\udef8 无人机装备", "\ud83d\udce6 其它道具", "\ud83c\udfa8 自定物品" }); float num = y + 12f; float num2 = 36f; float num3 = 6f; for (int i = 0; i < 13; i++) { bool flag = _currentSubTab == i; if (GUI.Button(new Rect(x + 10f, num, 180f, num2), array[i], flag ? _sBtnGreen : _sBtnNormal)) { _currentSubTab = i; } num += num2 + num3; } if (GUI.Button(new Rect(x + 10f, y + height - 56f, 180f, 44f), UseChinese() ? "\ud83d\udd04 刷新数据" : "\ud83d\udd04 Refresh", _sBtnNormal)) { LoadAllSpawnables(force: true); } float num4 = x + 215f; float num5 = width - 215f; Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(num4, y, num5, height); GUI.Box(val2, "", _sSection); DrawBorderRect(val2, _texBorder); if (!((Object)(object)PlayerController.instance != (Object)null)) { string text2 = (UseChinese() ? "⚠\ufe0f 请在进入游戏局内后再使用刷取助手!" : "⚠\ufe0f Please enter a game level/lobby first!"); GUI.Label(new Rect(num4 + 20f, y + height * 0.4f, num5 - 40f, 40f), text2, _sTitle); return; } float num6 = y + 12f; GUI.Label(new Rect(num4 + 16f, num6 + 4f, 80f, 30f), UseChinese() ? "生成数量:" : "Spawn Qty:", _sLabel); if (_spawnCountStr == null) { _spawnCountStr = _spawnCount.ToString(); } _spawnCountStr = GUI.TextField(new Rect(num4 + 100f, num6, 80f, 30f), _spawnCountStr, _sTextInput); if (GUI.Button(new Rect(num4 + 190f, num6, 34f, 30f), "-", _sBtnNormal)) { if (int.TryParse(_spawnCountStr, out var result)) { _spawnCount = Mathf.Clamp(result, 1, 100); } _spawnCount = Mathf.Max(1, _spawnCount - 1); _spawnCountStr = _spawnCount.ToString(); } if (GUI.Button(new Rect(num4 + 230f, num6, 34f, 30f), "+", _sBtnNormal)) { if (int.TryParse(_spawnCountStr, out var result2)) { _spawnCount = Mathf.Clamp(result2, 1, 100); } _spawnCount = Mathf.Min(100, _spawnCount + 1); _spawnCountStr = _spawnCount.ToString(); } GUIStyle val3 = new GUIStyle(_sBtnNormal) { fontSize = 15, padding = new RectOffset(0, 0, 0, 0), alignment = (TextAnchor)4 }; int[] array2 = new int[6] { 1, 10, 20, 30, 40, 50 }; for (int j = 0; j < array2.Length; j++) { int spawnCount = array2[j]; if (GUI.Button(new Rect(num4 + 274f + (float)j * 37f, num6, 32f, 30f), spawnCount.ToString(), val3)) { _spawnCount = spawnCount; _spawnCountStr = spawnCount.ToString(); } } if (_currentSubTab == 0 || _currentSubTab == 1) { Rect rect = default(Rect); ((Rect)(ref rect))..ctor(num4 + 16f, num6 + 36f, 250f, 30f); string text3 = (UseChinese() ? "跟随游戏自动重生" : "Auto Respawn"); _cfgSpawnedAutoRespawn = DrawStyledToggle(rect, _cfgSpawnedAutoRespawn, text3); Rect rect2 = default(Rect); ((Rect)(ref rect2))..ctor(num4 + 280f, num6 + 36f, 250f, 30f); string text4 = (UseChinese() ? "延迟传送到面前" : "Delay Pull to Front"); _cfgSpawnedDelayPull = DrawStyledToggle(rect2, _cfgSpawnedDelayPull, text4); } List list = ((_currentSubTab == 0) ? _spawnablesEnemies : ((_currentSubTab == 1) ? _spawnablesCustomEnemies : ((_currentSubTab == 2) ? _spawnablesValuables : ((_currentSubTab == 3) ? _spawnablesCosmeticBoxes : ((_currentSubTab == 4) ? _spawnablesPotions : ((_currentSubTab == 5) ? _spawnablesMelee : ((_currentSubTab == 6) ? _spawnablesRanged : ((_currentSubTab == 7) ? _spawnablesOtherWeapons : ((_currentSubTab == 8) ? _spawnablesCarts : ((_currentSubTab == 9) ? _spawnablesVehicles : ((_currentSubTab == 10) ? _spawnablesDrones : ((_currentSubTab == 11) ? _spawnablesOthers : _spawnablesCustomItems)))))))))))); if (list == null || list.Count == 0) { string text5 = (UseChinese() ? "没有拉取到该类型的资产。请尝试点击左侧的【刷新数据】。" : "No assets found for this category. Try clicking [Refresh]."); GUI.Label(new Rect(num4 + 20f, y + height * 0.4f, num5 - 40f, 40f), text5, _sLabel); return; } int num7 = 3; float num8 = 12f; float num9 = 10f; float num10 = (num5 - (float)(num7 - 1) * num8 - 24f) / (float)num7; float num11 = 46f; float num12 = (float)Mathf.CeilToInt((float)list.Count / (float)num7) * (num11 + num9) + 24f; float num13 = ((_currentSubTab == 0 || _currentSubTab == 1) ? 90f : 52f); float num14 = y + num13; float num15 = height - (num13 + 10f); Rect val4 = new Rect(num4 + 10f, num14, num5 - 20f, num15); Rect val5 = default(Rect); ((Rect)(ref val5))..ctor(0f, 0f, num5 - 36f, num12); _subScrollPos = GUI.BeginScrollView(val4, _subScrollPos, val5); for (int k = 0; k < list.Count; k++) { int num16 = k / num7; float num17 = (float)(k % num7) * (num10 + num8); float num18 = (float)num16 * (num11 + num9); SpawnableInfo spawnableInfo = list[k]; string displayName = spawnableInfo.GetDisplayName(); if (GUI.Button(new Rect(num17, num18, num10, num11), displayName, _sBtnNormal)) { if (int.TryParse(_spawnCountStr, out var result3)) { _spawnCount = Mathf.Clamp(result3, 1, 100); } else { _spawnCount = 1; } _spawnCountStr = _spawnCount.ToString(); if (_spawnCount > 1) { _showConfirmSpawn = true; _pendingSpawnInfo = spawnableInfo; } else { 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 static Vector3 GetPlayerPosition(PlayerAvatar player) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)player == (Object)null) { return Vector3.zero; } try { if (PlayerAvatarDeadSetRef.Invoke(player)) { PlayerDeathHead val = PlayerAvatarPlayerDeathHeadRef.Invoke(player); if ((Object)(object)val != (Object)null) { PhysGrabObject val2 = PlayerDeathHeadPhysGrabObjectRef.Invoke(val); if ((Object)(object)val2 != (Object)null) { return val2.centerPoint; } } } } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[GetPlayerPosition Error] {((Object)player).name}: {arg}"); } } return ((Component)player).transform.position; } private static List GetScatterPoints() { //IL_00e1: 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) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) List list = new List(); try { RoomVolume[] array = Object.FindObjectsOfType(); if (array != null && array.Length != 0) { RoomVolume[] array2 = array; foreach (RoomVolume val in array2) { if ((Object)(object)val != (Object)null) { list.Add(((Component)val).transform.position); } } } } catch { } if (list.Count < 3) { try { if ((Object)(object)EnemyDirector.instance != (Object)null && EnemyDirector.instance.enemiesSpawned != null) { foreach (EnemyParent item in EnemyDirector.instance.enemiesSpawned) { if ((Object)(object)item != (Object)null) { list.Add(((Component)item).transform.position); } } } } catch { } } if (list.Count < 3 && (Object)(object)PlayerController.instance != (Object)null) { Vector3 position = ((Component)PlayerController.instance).transform.position; for (int j = 0; j < 15; j++) { float num = Random.Range(-25f, 25f); float num2 = Random.Range(-25f, 25f); list.Add(new Vector3(position.x + num, position.y + 0.5f, position.z + num2)); } } return list; } private static void TeleportPlayer(PlayerAvatar avatar, Vector3 position) { //IL_006c: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)avatar == (Object)null) { return; } if (!PhotonNetwork.InRoom) { if (PlayerAvatarDeadSetRef.Invoke(avatar)) { PlayerDeathHead val = PlayerAvatarPlayerDeathHeadRef.Invoke(avatar); if ((Object)(object)val != (Object)null) { PhysGrabObject val2 = PlayerDeathHeadPhysGrabObjectRef.Invoke(val); if ((Object)(object)val2 != (Object)null) { val2.Teleport(position, Quaternion.identity); } } } else { ((Component)avatar).transform.position = position; } } else { if (!((Object)(object)avatar.photonView != (Object)null)) { return; } if (PlayerAvatarDeadSetRef.Invoke(avatar)) { PlayerDeathHead val3 = PlayerAvatarPlayerDeathHeadRef.Invoke(avatar); if ((Object)(object)val3 != (Object)null) { PhysGrabObject val4 = PlayerDeathHeadPhysGrabObjectRef.Invoke(val3); if ((Object)(object)val4 != (Object)null) { val4.Teleport(position, Quaternion.identity); } } } avatar.photonView.RPC("SpawnRPC", (RpcTarget)0, new object[2] { position, ((Component)avatar).transform.rotation }); Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)$"[GameTools] Sent SpawnRPC to teleport player {((Object)avatar).name} to {position}"); } } } catch (Exception arg) { Plugin instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogWarning((object)$"[TeleportPlayer Error] {((Object)avatar).name}: {arg}"); } } } private void RevivePlayer(PlayerAvatar avatar) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown try { if ((Object)(object)avatar == (Object)null) { return; } if (!PhotonNetwork.InRoom) { avatar.Revive(false); return; } string text = PlayerAvatarSteamIDRef.Invoke(avatar); if (string.IsNullOrEmpty(text)) { return; } bool flag = false; if ((Object)(object)avatar.photonView != (Object)null && avatar.photonView.Owner != null && ((Dictionary)(object)avatar.photonView.Owner.CustomProperties).TryGetValue((object)"GT_Active", out object value) && value is bool && (bool)value) { flag = true; } if (flag) { Hashtable val = new Hashtable(); val[(object)("GT_ReqRevive_" + text)] = true; PhotonNetwork.LocalPlayer.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)("[GameTools] Request revive (via properties) for modded player: " + ((Object)avatar).name)); } } else if (PhotonNetwork.IsMasterClient && (Object)(object)avatar.photonView != (Object)null) { avatar.photonView.RPC("ReviveRPC", (RpcTarget)0, new object[1] { false }); Plugin instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)("[GameTools] Host directly sent ReviveRPC for vanilla player: " + ((Object)avatar).name)); } } } catch (Exception arg) { Plugin instance3 = Instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogWarning((object)$"[RevivePlayer Error] {((Object)avatar).name}: {arg}"); } } } private void KillPlayer(PlayerAvatar avatar) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown try { if ((Object)(object)avatar == (Object)null) { return; } if (!PhotonNetwork.InRoom) { avatar.PlayerDeath(-1); return; } string text = PlayerAvatarSteamIDRef.Invoke(avatar); if (string.IsNullOrEmpty(text)) { return; } bool flag = false; if ((Object)(object)avatar.photonView != (Object)null && avatar.photonView.Owner != null && ((Dictionary)(object)avatar.photonView.Owner.CustomProperties).TryGetValue((object)"GT_Active", out object value) && value is bool && (bool)value) { flag = true; } if (flag) { Hashtable val = new Hashtable(); val[(object)("GT_ReqKill_" + text)] = true; PhotonNetwork.LocalPlayer.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)("[GameTools] Request kill (via properties) for modded player: " + ((Object)avatar).name)); } } else if (PhotonNetwork.IsMasterClient && (Object)(object)avatar.photonView != (Object)null) { avatar.photonView.RPC("PlayerDeathRPC", (RpcTarget)0, new object[1] { -1 }); Plugin instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)("[GameTools] Host directly sent PlayerDeathRPC for vanilla player: " + ((Object)avatar).name)); } } } catch (Exception arg) { Plugin instance3 = Instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogWarning((object)$"[KillPlayer Error] {((Object)avatar).name}: {arg}"); } } } private void HealPlayer(PlayerAvatar avatar) { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown try { if ((Object)(object)avatar == (Object)null) { return; } if (!PhotonNetwork.InRoom) { if ((Object)(object)avatar.playerHealth != (Object)null) { int num = PlayerHealthMaxRef.Invoke(avatar.playerHealth); avatar.playerHealth.Heal(num, true); } return; } string text = PlayerAvatarSteamIDRef.Invoke(avatar); if (string.IsNullOrEmpty(text)) { return; } bool flag = false; if ((Object)(object)avatar.photonView != (Object)null && avatar.photonView.Owner != null && ((Dictionary)(object)avatar.photonView.Owner.CustomProperties).TryGetValue((object)"GT_Active", out object value) && value is bool && (bool)value) { flag = true; } if (flag) { Hashtable val = new Hashtable(); val[(object)("GT_ReqHeal_" + text)] = true; PhotonNetwork.LocalPlayer.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)("[GameTools] Request heal (via properties) for modded player: " + ((Object)avatar).name)); } } else if (PhotonNetwork.IsMasterClient && (Object)(object)avatar.photonView != (Object)null && (Object)(object)avatar.playerHealth != (Object)null) { int num2 = PlayerHealthMaxRef.Invoke(avatar.playerHealth); avatar.photonView.RPC("UpdateHealthRPC", (RpcTarget)0, new object[4] { num2, num2, true, false }); Plugin instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogInfo((object)("[GameTools] Host directly sent UpdateHealthRPC for vanilla player: " + ((Object)avatar).name)); } } } catch (Exception arg) { Plugin instance3 = Instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogWarning((object)$"[HealPlayer Error] {((Object)avatar).name}: {arg}"); } } } private void DrawTabPlayerControl(float curX, ref float curY, float curW, float innerX, float innerW) { //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_0220: 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_0365: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_0a8b: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_0ae7: Unknown result type (might be due to invalid IL or missing references) //IL_0afa: Unknown result type (might be due to invalid IL or missing references) //IL_0ac6: Unknown result type (might be due to invalid IL or missing references) //IL_0ad3: Unknown result type (might be due to invalid IL or missing references) //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_0b28: Unknown result type (might be due to invalid IL or missing references) //IL_0742: Unknown result type (might be due to invalid IL or missing references) //IL_0b60: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_0639: Unknown result type (might be due to invalid IL or missing references) //IL_063e: Unknown result type (might be due to invalid IL or missing references) //IL_064a: Unknown result type (might be due to invalid IL or missing references) //IL_064f: Unknown result type (might be due to invalid IL or missing references) //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_0595: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_07a0: Unknown result type (might be due to invalid IL or missing references) //IL_0bb0: Unknown result type (might be due to invalid IL or missing references) //IL_0473: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_070d: Unknown result type (might be due to invalid IL or missing references) //IL_083c: Unknown result type (might be due to invalid IL or missing references) //IL_084f: Unknown result type (might be due to invalid IL or missing references) //IL_0871: Unknown result type (might be due to invalid IL or missing references) //IL_0c07: Unknown result type (might be due to invalid IL or missing references) //IL_08a9: Unknown result type (might be due to invalid IL or missing references) //IL_0702: Unknown result type (might be due to invalid IL or missing references) //IL_06ef: Unknown result type (might be due to invalid IL or missing references) //IL_06f1: Unknown result type (might be due to invalid IL or missing references) //IL_08e4: Unknown result type (might be due to invalid IL or missing references) //IL_0c68: Unknown result type (might be due to invalid IL or missing references) //IL_0943: Unknown result type (might be due to invalid IL or missing references) //IL_0963: Unknown result type (might be due to invalid IL or missing references) //IL_0968: Unknown result type (might be due to invalid IL or missing references) //IL_096a: Unknown result type (might be due to invalid IL or missing references) //IL_096f: Unknown result type (might be due to invalid IL or missing references) //IL_0ca4: 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_0cad: Unknown result type (might be due to invalid IL or missing references) //IL_0ce7: Unknown result type (might be due to invalid IL or missing references) //IL_0d0e: Unknown result type (might be due to invalid IL or missing references) //IL_0d13: Unknown result type (might be due to invalid IL or missing references) //IL_0d1d: Unknown result type (might be due to invalid IL or missing references) //IL_0d22: Unknown result type (might be due to invalid IL or missing references) //IL_0d27: Unknown result type (might be due to invalid IL or missing references) //IL_0d4d: Unknown result type (might be due to invalid IL or missing references) List list = SemiFunc.PlayerGetList(); PlayerAvatar[] array = (PlayerAvatar[])((list != null) ? ((Array)list.ToArray()) : ((Array)new PlayerAvatar[0])); int num = array.Length; bool enabled = GUI.enabled; if (!IsStaticModEnabled()) { GUI.enabled = false; } string text = (UseChinese() ? "\ud83d\udd04 重置全部玩家选项" : "\ud83d\udd04 Reset All Player Settings"); if (GUI.Button(new Rect(curX, curY, curW, 40f), text, _sBtnRed)) { ResetPlayerSettings(); } curY += 52f; float num2 = 250f; 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 - 30f) / 4f; if (GUI.Button(new Rect(innerX, num3, num4, 40f), 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)) { RevivePlayer(val2); } } catch { } } } if (GUI.Button(new Rect(innerX + num4 + 10f, num3, num4, 40f), 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, 40f), 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 spawnPosition = GetSpawnPosition(); TeleportPlayer(val4, spawnPosition); } } catch { } } } GUI.enabled = enabled2; if (GUI.Button(new Rect(innerX + (num4 + 10f) * 3f, num3, num4, 40f), UseChinese() ? "❤\ufe0f 全体满血" : "❤\ufe0f Heal All", _sBtnNormal) && array != null) { PlayerAvatar[] array2 = array; foreach (PlayerAvatar val5 in array2) { try { if ((Object)(object)val5 != (Object)null) { HealPlayer(val5); } } catch { } } } num3 += 50f; float num6 = (innerW - 20f) / 3f; GUI.enabled = enabled2 && array != null && array.Length != 0; if (GUI.Button(new Rect(innerX, num3, num6, 40f), UseChinese() ? "\ud83c\udfb2 全体随机分布" : "\ud83c\udfb2 Scatter All", _sBtnNormal) && array != null) { List scatterPoints = GetScatterPoints(); if (scatterPoints.Count > 0) { PlayerAvatar[] array2 = array; foreach (PlayerAvatar val6 in array2) { if ((Object)(object)val6 == (Object)null) { continue; } int index = Random.Range(0, scatterPoints.Count); Vector3 val7 = scatterPoints[index] + Vector3.up * 0.5f; if (PlayerAvatarIsLocalRef.Invoke(val6)) { if (!((Object)(object)PlayerController.instance != (Object)null)) { continue; } PlayerAvatar playerAvatarScript = PlayerController.instance.playerAvatarScript; PlayerAvatar val8 = ((playerAvatarScript != null) ? ((Component)playerAvatarScript).GetComponent() : null); if ((Object)(object)val8 != (Object)null) { PlayerTumble val9 = PlayerAvatarTumbleRef.Invoke(val8); if ((Object)(object)val9 != (Object)null && (Object)(object)PlayerTumblePhysGrabObjectRef.Invoke(val9) != (Object)null) { PlayerTumblePhysGrabObjectRef.Invoke(val9).Teleport(val7, Quaternion.identity); } } ((Component)PlayerController.instance).transform.position = val7; } else { TeleportPlayer(val6, val7); } } } } bool flag = (Object)(object)TruckSafetySpawnPoint.instance != (Object)null; GUI.enabled = enabled2 && flag; if (GUI.Button(new Rect(innerX + num6 + 10f, num3, num6, 40f), UseChinese() ? "\ud83c\udfe0 传回卡车(自己)" : "\ud83c\udfe0 To Truck (Self)", _sBtnNormal) && (Object)(object)PlayerController.instance != (Object)null) { PlayerAvatar playerAvatarScript2 = PlayerController.instance.playerAvatarScript; PlayerAvatar val10 = ((playerAvatarScript2 != null) ? ((Component)playerAvatarScript2).GetComponent() : null); if ((Object)(object)val10 != (Object)null && (Object)(object)TruckSafetySpawnPoint.instance != (Object)null) { PlayerTumble val11 = PlayerAvatarTumbleRef.Invoke(val10); if ((Object)(object)val11 != (Object)null && (Object)(object)PlayerTumblePhysGrabObjectRef.Invoke(val11) != (Object)null) { PlayerTumblePhysGrabObjectRef.Invoke(val11).Teleport(((Component)TruckSafetySpawnPoint.instance).transform.position, ((Component)TruckSafetySpawnPoint.instance).transform.rotation); } ((Component)PlayerController.instance).transform.position = ((Component)TruckSafetySpawnPoint.instance).transform.position; } } GUI.enabled = enabled2 && flag && array != null && array.Length != 0; if (GUI.Button(new Rect(innerX + (num6 + 10f) * 2f, num3, num6, 40f), UseChinese() ? "\ud83d\ude9a 全体传回卡车" : "\ud83d\ude9a To Truck (All)", _sBtnNormal) && array != null && (Object)(object)TruckSafetySpawnPoint.instance != (Object)null) { Vector3 position = ((Component)TruckSafetySpawnPoint.instance).transform.position; Quaternion rotation = ((Component)TruckSafetySpawnPoint.instance).transform.rotation; PlayerAvatar[] array2 = array; foreach (PlayerAvatar val12 in array2) { if ((Object)(object)val12 == (Object)null) { continue; } if (PlayerAvatarIsLocalRef.Invoke(val12)) { if (!((Object)(object)PlayerController.instance != (Object)null)) { continue; } PlayerAvatar playerAvatarScript3 = PlayerController.instance.playerAvatarScript; PlayerAvatar val13 = ((playerAvatarScript3 != null) ? ((Component)playerAvatarScript3).GetComponent() : null); if ((Object)(object)val13 != (Object)null) { PlayerTumble val14 = PlayerAvatarTumbleRef.Invoke(val13); if ((Object)(object)val14 != (Object)null && (Object)(object)PlayerTumblePhysGrabObjectRef.Invoke(val14) != (Object)null) { PlayerTumblePhysGrabObjectRef.Invoke(val14).Teleport(position, rotation); } } ((Component)PlayerController.instance).transform.position = position; } else { TeleportPlayer(val12, position); } } } num3 += 50f; GUI.enabled = enabled2; bool flag2 = DrawStyledToggle(new Rect(innerX, num3, innerW, 30f), _cfgAutoReviveTeammates.Value, UseChinese() ? "队友死亡后 5 秒自动原地复活" : "Auto Revive Teammates after 5 seconds"); if (flag2 != _cfgAutoReviveTeammates.Value) { _cfgAutoReviveTeammates.Value = flag2; SaveRuntimeConfig(); } num3 += 36f; bool flag3 = DrawStyledToggle(new Rect(innerX, num3, innerW, 30f), _cfgAllTeammatesGodMode.Value, UseChinese() ? "\ud83d\udee1\ufe0f 全体队友开启无敌" : "\ud83d\udee1\ufe0f Enable God Mode for All Teammates"); if (flag3 != _cfgAllTeammatesGodMode.Value) { _cfgAllTeammatesGodMode.Value = flag3; OnAllTeammatesGodModeChanged(flag3); SaveRuntimeConfig(); } GUI.enabled = enabled2; curY += num2 + 16f; float num7 = ((num == 0) ? 30f : ((float)num * 38f)); float num8 = 266f; float num9 = 90f + Mathf.Min(num7, num8); Rect val15 = default(Rect); ((Rect)(ref val15))..ctor(curX, curY, curW, num9); GUI.Box(val15, "", _sSection); DrawBorderRect(val15, _texBorder); float num10 = curY + 12f; GUI.Label(new Rect(innerX, num10, innerW, 24f), UseChinese() ? "\ud83d\udc65 联机房间玩家控制" : "\ud83d\udc65 Player Management", _sTitle); num10 += 30f; GUI.Label(new Rect(innerX, num10, innerW, 24f), UseChinese() ? "\ud83d\udca1 最左侧勾选框控制玩家无敌状态" : "\ud83d\udca1 Checkbox on the left controls player God Mode", _sStatus); num10 += 26f; if (num == 0) { GUI.Label(new Rect(innerX, num10, 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 flag10 = PlayerAvatarIsLocalRef.Invoke(a); bool flag11 = PlayerAvatarIsLocalRef.Invoke(b); if (flag10 && !flag11) { return -1; } return (!flag10 && flag11) ? 1 : string.Compare(GetPlayerDisplayName(a), GetPlayerDisplayName(b), StringComparison.OrdinalIgnoreCase); }); float num11 = num9 - 76f; Rect val16 = new Rect(innerX, num10, innerW, num11); Rect val17 = default(Rect); ((Rect)(ref val17))..ctor(0f, 0f, innerW - 16f, num7); _playerScrollPos = GUI.BeginScrollView(val16, _playerScrollPos, val17); bool enabled3 = GUI.enabled; float num12 = 0f; PlayerAvatar[] array2 = array; Rect val19 = default(Rect); foreach (PlayerAvatar val18 in array2) { if ((Object)(object)val18 == (Object)null) { continue; } bool flag4 = PlayerAvatarIsLocalRef.Invoke(val18); string playerDisplayName = GetPlayerDisplayName(val18); bool flag5 = PlayerAvatarDeadSetRef.Invoke(val18); string text2 = playerDisplayName; if (flag4) { text2 += (UseChinese() ? " (我)" : " (Me)"); } text2 += ((!flag5) ? (UseChinese() ? " [❤\ufe0f存活]" : " [❤\ufe0fAlive]") : (UseChinese() ? " [\ud83d\udc80死亡]" : " [\ud83d\udc80Dead]")); float num13 = 32f; float num14 = 8f; bool flag6 = (GUI.enabled = enabled3); float num15 = 26f; float num16 = num12 + (38f - num15) * 0.5f; ((Rect)(ref val19))..ctor(0f, num16, num15, num15); string steamID = PlayerAvatarSteamIDRef.Invoke(val18); bool flag8 = IsPlayerGodMode(steamID); GUI.enabled = flag6 && !flag5; if (GUI.Button(val19, GUIContent.none, GUIStyle.none)) { bool flag9 = !flag8; SetPlayerGodMode(steamID, flag9); if (!flag9) { _cfgAllTeammatesGodMode.Value = false; SaveRuntimeConfig(); } } if (flag8) { GUI.DrawTexture(val19, (Texture)(object)_texGreen); GUI.Label(val19, "✓", _sCheckmarkStyleWhite); } else { GUI.Box(val19, "", _sSection); DrawBorderRect(val19, _texBorder); } GUI.enabled = flag6; GUI.Label(new Rect(num15 + 8f, num12 + 4f, 240f, 30f), text2, _sLabel); GUI.enabled = flag6 && !flag5; if (GUI.Button(new Rect(280f, num12 + 1f, 65f, num13), UseChinese() ? "杀死" : "Kill", _sBtnRed)) { KillPlayer(val18); } float num17 = 280f + (65f + num14); GUI.enabled = flag6 && flag5; if (GUI.Button(new Rect(num17, num12 + 1f, 65f, num13), UseChinese() ? "复活" : "Revive", _sBtnGreen)) { RevivePlayer(val18); } float num18 = num17 + (65f + num14); GUI.enabled = flag6 && !flag5; if (GUI.Button(new Rect(num18, num12 + 1f, 65f, num13), UseChinese() ? "满血" : "Heal", _sBtnNormal)) { HealPlayer(val18); } float num19 = num18 + (65f + num14); GUI.enabled = flag6 && !flag4 && (Object)(object)PlayerController.instance != (Object)null; if (GUI.Button(new Rect(num19, num12 + 1f, 95f, num13), UseChinese() ? "拉过来" : "Pull", _sBtnNormal) && (Object)(object)PlayerController.instance != (Object)null) { Vector3 spawnPosition2 = GetSpawnPosition(); TeleportPlayer(val18, spawnPosition2); } float num20 = num19 + (95f + num14); GUI.enabled = flag6 && !flag4 && (Object)(object)PlayerController.instance != (Object)null; if (GUI.Button(new Rect(num20, num12 + 1f, 95f, num13), UseChinese() ? "飞过去" : "Goto", _sBtnNormal)) { try { Vector3 position2 = GetPlayerPosition(val18) + Vector3.up * 0.5f; PlayerAvatar playerAvatarScript4 = PlayerController.instance.playerAvatarScript; PlayerAvatar val20 = ((playerAvatarScript4 != null) ? ((Component)playerAvatarScript4).GetComponent() : null); if ((Object)(object)val20 != (Object)null) { TeleportPlayer(val20, position2); } } catch { } } num12 += 38f; } GUI.EndScrollView(); } curY += num9 + 16f; GUI.enabled = enabled; } private void DrawConfirmSpawnDialog() { //IL_0045: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0188: 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) GUI.enabled = true; float num = 460f; float num2 = 220f; float num3 = (((Rect)(ref _windowRect)).width - num) * 0.5f; float num4 = (((Rect)(ref _windowRect)).height - num2) * 0.5f; Rect val = default(Rect); ((Rect)(ref val))..ctor(num3, num4, num, num2); GUI.Box(val, "", _sSection); DrawBorderRect(val, _texBorder); float num5 = num4 + 20f; string text = (UseChinese() ? "⚠\ufe0f 批量刷取确认" : "⚠\ufe0f Batch Spawn Confirm"); GUI.Label(new Rect(num3 + 20f, num5, num - 40f, 30f), text, _sTitle); num5 += 40f; string displayName = _pendingSpawnInfo.GetDisplayName(); string text2 = (UseChinese() ? $"确定要刷取数量为 {_spawnCount} 的物品吗?\n物品: {displayName}" : $"Are you sure to spawn {_spawnCount} items?\nItem: {displayName}"); GUIStyle val2 = new GUIStyle(_sLabel); val2.richText = true; val2.alignment = (TextAnchor)1; GUI.Label(new Rect(num3 + 20f, num5, num - 40f, 60f), text2, val2); num5 += 70f; float num6 = 120f; float num7 = 36f; float num8 = 40f; float num9 = num3 + (num - (num6 * 2f + num8)) * 0.5f; string text3 = (UseChinese() ? "确认" : "Confirm"); if (GUI.Button(new Rect(num9, num5, num6, num7), text3, _sBtnGreen)) { SpawnObject(_pendingSpawnInfo); _showConfirmSpawn = false; _pendingSpawnInfo = null; } string text4 = (UseChinese() ? "取消" : "Cancel"); if (GUI.Button(new Rect(num9 + num6 + num8, num5, num6, num7), text4, _sBtnRed)) { _showConfirmSpawn = false; _pendingSpawnInfo = null; } } private static bool IsWeapon(ItemBattery battery) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Invalid comparison between Unknown and I4 //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Invalid comparison between Unknown and I4 //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Invalid comparison between Unknown and I4 if ((Object)(object)battery == (Object)null) { return false; } ItemAttributes val = ((Component)battery).GetComponent(); if ((Object)(object)val == (Object)null) { val = ((Component)battery).GetComponentInParent(); } if ((Object)(object)val == (Object)null) { val = ((Component)battery).GetComponentInChildren(); } if ((Object)(object)val != (Object)null && (Object)(object)val.item != (Object)null) { itemType itemType = val.item.itemType; if ((int)itemType == 7 || (int)itemType == 9 || (int)itemType == 15) { return true; } } try { Transform val2 = ((Component)battery).transform; while ((Object)(object)val2 != (Object)null) { string text = ((Object)val2).name.ToLower(); if (text.Contains("melee") || text.Contains("gun") || text.Contains("weapon") || text.Contains("launcher") || text.Contains("shovel") || text.Contains("hammer") || text.Contains("pistol") || text.Contains("rifle") || text.Contains("shotgun") || text.Contains("taser") || text.Contains("cannon")) { return true; } Component[] components = ((Component)val2).GetComponents(); foreach (Component val3 in components) { if ((Object)(object)val3 == (Object)null) { continue; } Type type = ((object)val3).GetType(); PropertyInfo propertyInfo = type.GetProperty("item") ?? type.GetProperty("Item"); FieldInfo fieldInfo = type.GetField("item") ?? type.GetField("Item"); object obj = null; if (propertyInfo != null) { obj = propertyInfo.GetValue(val3, null); } else if (fieldInfo != null) { obj = fieldInfo.GetValue(val3); } if (obj == null) { continue; } FieldInfo fieldInfo2 = obj.GetType().GetField("itemType") ?? obj.GetType().GetField("ItemType"); PropertyInfo propertyInfo2 = obj.GetType().GetProperty("itemType") ?? obj.GetType().GetProperty("ItemType"); object obj2 = null; if (fieldInfo2 != null) { obj2 = fieldInfo2.GetValue(obj); } else if (propertyInfo2 != null) { obj2 = propertyInfo2.GetValue(obj, null); } if (obj2 != null) { string text2 = obj2.ToString(); if (text2.Equals("melee", StringComparison.OrdinalIgnoreCase) || text2.Equals("gun", StringComparison.OrdinalIgnoreCase) || text2.Equals("launcher", StringComparison.OrdinalIgnoreCase)) { return true; } } } val2 = val2.parent; } } catch (Exception arg) { Plugin instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)$"[IsWeapon Fallback Error]: {arg}"); } } 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; } } public class EnemyScaleSync : MonoBehaviourPun { internal void BroadcastScale(int enemyPhotonViewID, float scale) { if (!((Object)(object)((MonoBehaviourPun)this).photonView == (Object)null)) { ((MonoBehaviourPun)this).photonView.RPC("ReceiveEnemyScaleRPC", (RpcTarget)0, new object[2] { enemyPhotonViewID, scale }); } } [PunRPC] private void ReceiveEnemyScaleRPC(int enemyPhotonViewID, float scale, PhotonMessageInfo info) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.MasterOnlyRPC(info)) { return; } Plugin._enemyScaleDict[enemyPhotonViewID] = scale; PhotonView val = PhotonView.Find(enemyPhotonViewID); if (!((Object)(object)val == (Object)null)) { EnemyParent component = ((Component)val).GetComponent(); if (!((Object)(object)component == (Object)null)) { Plugin.ApplyEnemyScale(component, scale); } } } } }