using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using TMPro;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("REPOJP")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("zabuMod")]
[assembly: AssemblyTitle("zabuMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.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;
}
}
}
[BepInPlugin("REPOJP.MapQuickAccess", "MapQuickAccess", "2.0.0")]
public class MapQuickAccessPlugin : BaseUnityPlugin
{
public const string PluginGuid = "REPOJP.MapQuickAccess";
public const string PluginName = "MapQuickAccess";
public const string PluginVersion = "2.0.0";
private Harmony harmony;
internal static ManualLogSource Log;
internal static ConfigFile PluginConfig;
internal static ConfigEntry<bool> EnableMod;
internal static ConfigEntry<bool> AllowWhileSprinting;
internal static ConfigEntry<bool> AllowWhileDisabled;
internal static ConfigEntry<bool> AllowWhileTumbling;
internal static ConfigEntry<bool> AllowWhileAimTargetActive;
internal static ConfigEntry<bool> AllowInMenuLevel;
internal static ConfigEntry<bool> AllowWithTextInputActive;
internal static ConfigEntry<bool> InstantOpenClose;
internal static ConfigEntry<bool> EnableOpenCloseShake;
internal static ConfigEntry<bool> KeepOpenSound;
internal static ConfigEntry<bool> KeepLoopSound;
internal static ConfigEntry<bool> DisableMoveSlowdown;
internal static ConfigEntry<bool> DisableCameraZoomOverride;
internal static ConfigEntry<bool> DisableCameraNoiseOverride;
internal static ConfigEntry<bool> DisableCameraTopFade;
internal static ConfigEntry<bool> DisableCameraBobMultiplier;
internal static ConfigEntry<bool> KeepAimVisible;
internal static ConfigEntry<bool> AlwaysOpenMap;
internal static ConfigEntry<bool> EnableDoubleClickToggleAlwaysOpen;
internal static ConfigEntry<float> DoubleClickThreshold;
internal static ConfigEntry<bool> DisableLoopSoundWhenMapFixed;
internal static ConfigEntry<bool> AutoKeepAimVisibleWhenMapFixed;
internal static ConfigEntry<bool> EnableMapOffsetAdjustment;
internal static ConfigEntry<float> MapOffsetX;
internal static ConfigEntry<float> MapOffsetY;
internal static ConfigEntry<float> MapDistanceOffset;
internal static ConfigEntry<bool> EnableMapOpacityAdjustment;
internal static ConfigEntry<float> MapOpacity;
private void Awake()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
PluginConfig = ((BaseUnityPlugin)this).Config;
InitializeConfig();
harmony = new Harmony("REPOJP.MapQuickAccess");
harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"MapQuickAccess 2.0.0 loaded");
}
private void InitializeConfig()
{
//IL_028f: Unknown result type (might be due to invalid IL or missing references)
//IL_0299: Expected O, but got Unknown
//IL_032c: Unknown result type (might be due to invalid IL or missing references)
//IL_0336: Expected O, but got Unknown
//IL_0369: Unknown result type (might be due to invalid IL or missing references)
//IL_0373: Expected O, but got Unknown
//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
//IL_03b0: Expected O, but got Unknown
//IL_0403: Unknown result type (might be due to invalid IL or missing references)
//IL_040d: Expected O, but got Unknown
EnableMod = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableMod", true, "Enable this mod. このMODを有効化します");
AllowWhileSprinting = ((BaseUnityPlugin)this).Config.Bind<bool>("Open Conditions", "AllowWhileSprinting", true, "Allow opening the map while sprinting. 走り中でもマップを開けるようにします");
AllowWhileDisabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Open Conditions", "AllowWhileDisabled", true, "Allow opening the map while disabled. 死亡無効化中でもマップを開けるようにします");
AllowWhileTumbling = ((BaseUnityPlugin)this).Config.Bind<bool>("Open Conditions", "AllowWhileTumbling", true, "Allow opening the map while tumbling. タンブル中でもマップを開けるようにします");
AllowWhileAimTargetActive = ((BaseUnityPlugin)this).Config.Bind<bool>("Open Conditions", "AllowWhileAimTargetActive", true, "Allow opening the map while aim target mode is active. エイム対象状態でもマップを開けるようにします");
AllowInMenuLevel = ((BaseUnityPlugin)this).Config.Bind<bool>("Open Conditions", "AllowInMenuLevel", true, "Allow opening the map in menu levels. メニュー階層でもマップを開けるようにします");
AllowWithTextInputActive = ((BaseUnityPlugin)this).Config.Bind<bool>("Open Conditions", "AllowWithTextInputActive", true, "Allow opening the map while text input is active. テキスト入力中でもマップを開けるようにします");
InstantOpenClose = ((BaseUnityPlugin)this).Config.Bind<bool>("Opening Behavior", "InstantOpenClose", true, "Open and close the map instantly without the vanilla animation. バニラの開閉アニメーションを使わず即時開閉します");
EnableOpenCloseShake = ((BaseUnityPlugin)this).Config.Bind<bool>("Opening Behavior", "EnableOpenCloseShake", true, "Enable camera shake when opening or closing the map. マップ開閉時のカメラシェイクを有効化します");
KeepOpenSound = ((BaseUnityPlugin)this).Config.Bind<bool>("Opening Behavior", "KeepOpenSound", true, "Keep the map open and close sounds. マップの開閉音を維持します");
KeepLoopSound = ((BaseUnityPlugin)this).Config.Bind<bool>("Opening Behavior", "KeepLoopSound", true, "Keep the map loop sound while the map is active. マップ表示中のループ音を維持します");
DisableMoveSlowdown = ((BaseUnityPlugin)this).Config.Bind<bool>("Movement And Camera", "DisableMoveSlowdown", true, "Disable movement slowdown while the map is open. マップ表示中の移動速度低下を無効化します");
DisableCameraZoomOverride = ((BaseUnityPlugin)this).Config.Bind<bool>("Movement And Camera", "DisableCameraZoomOverride", true, "Disable the map zoom override while the map is open. マップ表示中のCameraZoom変更を無効化します");
DisableCameraNoiseOverride = ((BaseUnityPlugin)this).Config.Bind<bool>("Movement And Camera", "DisableCameraNoiseOverride", true, "Disable the map camera noise override while the map is open. マップ表示中のCameraNoise変更を無効化します");
DisableCameraTopFade = ((BaseUnityPlugin)this).Config.Bind<bool>("Movement And Camera", "DisableCameraTopFade", true, "Disable the top fade effect while the map is open. マップ表示中の上部フェードを無効化します");
DisableCameraBobMultiplier = ((BaseUnityPlugin)this).Config.Bind<bool>("Movement And Camera", "DisableCameraBobMultiplier", true, "Disable the camera bob multiplier change while the map is open. マップ表示中のカメラボブ倍率変更を無効化します");
KeepAimVisible = ((BaseUnityPlugin)this).Config.Bind<bool>("Movement And Camera", "KeepAimVisible", false, "Keep the aim UI visible while the map is open. マップ表示中もエイムUIを隠さないようにします");
AlwaysOpenMap = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixed Map Behavior", "AlwaysOpenMap", false, "Always keep the map open. 常にマップを開いた状態にします");
EnableDoubleClickToggleAlwaysOpen = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixed Map Behavior", "EnableDoubleClickToggleAlwaysOpen", true, "Allow double-clicking the map key to toggle always-open mode. マップキーのダブルクリックで固定表示を切り替え可能にします");
DoubleClickThreshold = ((BaseUnityPlugin)this).Config.Bind<float>("Fixed Map Behavior", "DoubleClickThreshold", 0.3f, new ConfigDescription("Double-click detection time in seconds. ダブルクリック判定秒数です", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 0.6f), Array.Empty<object>()));
DisableLoopSoundWhenMapFixed = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixed Map Behavior", "DisableLoopSoundWhenMapFixed", true, "Disable the map loop sound while the map is fixed open. マップ固定中はループ音を無効化します");
AutoKeepAimVisibleWhenMapFixed = ((BaseUnityPlugin)this).Config.Bind<bool>("Fixed Map Behavior", "AutoKeepAimVisibleWhenMapFixed", true, "Automatically keep the aim UI visible while the map is fixed open. マップ固定中は自動的にエイムUIを表示維持します");
EnableMapOffsetAdjustment = ((BaseUnityPlugin)this).Config.Bind<bool>("Map Placement", "EnableMapOffsetAdjustment", true, "Allow arrow keys and mouse wheel to adjust the opened map object placement. 矢印キーとマウスホイールで開いているマップオブジェクトの配置を調整可能にします");
MapOffsetX = ((BaseUnityPlugin)this).Config.Bind<float>("Map Placement", "MapOffsetX", 0f, new ConfigDescription("Horizontal placement offset of the opened map object. 開いているマップオブジェクトの左右位置補正です", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-3f, 3f), Array.Empty<object>()));
MapOffsetY = ((BaseUnityPlugin)this).Config.Bind<float>("Map Placement", "MapOffsetY", 0f, new ConfigDescription("Vertical placement offset of the opened map object. 開いているマップオブジェクトの上下位置補正です", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-3f, 3f), Array.Empty<object>()));
MapDistanceOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Map Placement", "MapDistanceOffset", 0f, new ConfigDescription("Forward or backward placement offset of the opened map object. 開いているマップオブジェクトの前後位置補正です", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-3f, 3f), Array.Empty<object>()));
EnableMapOpacityAdjustment = ((BaseUnityPlugin)this).Config.Bind<bool>("Map Placement", "EnableMapOpacityAdjustment", true, "Allow PageUp and PageDown to adjust map opacity. PageUpとPageDownでマップの不透明度を調整可能にします");
MapOpacity = ((BaseUnityPlugin)this).Config.Bind<float>("Map Placement", "MapOpacity", 1f, new ConfigDescription("Opacity of the visible map renderers. 表示中のマップ描画の不透明度です", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1f), Array.Empty<object>()));
}
internal static void SaveConfigSafe()
{
try
{
if (PluginConfig != null)
{
PluginConfig.Save();
}
}
catch (Exception ex)
{
if (Log != null)
{
Log.LogError((object)("Failure: SaveConfigSafe\n" + ex));
}
}
}
}
[HarmonyPatch(typeof(MapToolController), "Update")]
public static class MapToolControllerUpdatePatch
{
private sealed class RuntimeState
{
public float LastMapButtonDownTime = -10f;
public bool PendingToggleClick;
public float PendingToggleClickTime;
public bool SuppressMapInputUntilRelease;
public bool BaseTransformCached;
public Vector3 BasePlacementLocalPosition = Vector3.zero;
public Quaternion BasePlacementLocalRotation = Quaternion.identity;
public bool MaterialsCached;
public Renderer[] CachedRenderers = (Renderer[])(object)new Renderer[0];
public Material[][] CachedMaterials = new Material[0][];
public Dictionary<Material, float> CachedMaterialAlpha = new Dictionary<Material, float>();
public float LastAppliedOpacity = -1f;
public float PlayerNameCheckTimer;
}
private const float AdjustmentStep = 0.1f;
private static readonly Dictionary<int, RuntimeState> RuntimeStates = new Dictionary<int, RuntimeState>();
private static readonly FieldInfo FieldActive = AccessTools.Field(typeof(MapToolController), "Active");
private static readonly FieldInfo FieldActivePrev = AccessTools.Field(typeof(MapToolController), "ActivePrev");
private static readonly FieldInfo FieldPhotonView = AccessTools.Field(typeof(MapToolController), "photonView");
private static readonly FieldInfo FieldHideLerp = AccessTools.Field(typeof(MapToolController), "HideLerp");
private static readonly FieldInfo FieldHideScale = AccessTools.Field(typeof(MapToolController), "HideScale");
private static readonly FieldInfo FieldMapToggled = AccessTools.Field(typeof(MapToolController), "mapToggled");
private static readonly FieldInfo FieldDisplayJointAngleDiff = AccessTools.Field(typeof(MapToolController), "DisplayJointAngleDiff");
private static readonly FieldInfo FieldDisplayJointAnglePreviousX = AccessTools.Field(typeof(MapToolController), "DisplayJointAnglePreviousX");
private static readonly FieldInfo FieldPlayerWorldSpaceUIPlayerName = AccessTools.Field(typeof(PlayerAvatar), "worldSpaceUIPlayerName");
private static readonly FieldInfo FieldWorldSpaceUiHideTimer = AccessTools.Field(typeof(WorldSpaceUIParent), "hideTimer");
private static readonly FieldInfo FieldWorldSpaceUiHideAlpha = AccessTools.Field(typeof(WorldSpaceUIParent), "hideAlpha");
private static bool Prefix(MapToolController __instance)
{
if (!MapQuickAccessPlugin.EnableMod.Value)
{
return true;
}
if ((Object)(object)__instance == (Object)null || (Object)(object)InputManager.instance == (Object)null || (Object)(object)PlayerController.instance == (Object)null || (Object)(object)Map.Instance == (Object)null || (Object)(object)CameraAim.Instance == (Object)null)
{
return true;
}
try
{
RunPatchedUpdate(__instance);
return false;
}
catch (Exception ex)
{
if (MapQuickAccessPlugin.Log != null)
{
MapQuickAccessPlugin.Log.LogError((object)("Failure: MapToolController.Update patch\n" + ex));
}
return true;
}
}
private static void RunPatchedUpdate(MapToolController instance)
{
PhotonView photonView = GetPhotonView(instance);
bool flag = !GameManager.Multiplayer() || ((Object)(object)photonView != (Object)null && photonView.IsMine);
RuntimeState runtimeState = GetRuntimeState(instance);
if (flag)
{
ProcessLocalInput(instance, runtimeState);
}
ProcessStateChange(instance, photonView, flag);
ProcessAnimationAndCamera(instance, photonView, flag, runtimeState);
ProcessSoundLoop(instance);
}
private static void ProcessLocalInput(MapToolController instance, RuntimeState runtimeState)
{
bool value = GetBool(instance, FieldActive);
bool mapToggled = GetBool(instance, FieldMapToggled);
float @float = GetFloat(instance, FieldHideLerp);
bool flag = SemiFunc.InputDown((InputKey)8);
bool flag2 = SemiFunc.InputHold((InputKey)8);
bool flag3 = InputManager.instance.InputToggleGet((InputKey)8);
HandleAlwaysOpenDoubleClick(runtimeState, flag, flag2, ref mapToggled, flag3);
bool flag4 = MapQuickAccessPlugin.AllowWhileDisabled.Value || !instance.PlayerAvatar.isDisabled;
bool flag5 = MapQuickAccessPlugin.AllowWhileTumbling.Value || !instance.PlayerAvatar.isTumbling;
bool flag6 = MapQuickAccessPlugin.AllowWhileAimTargetActive.Value || !CameraAim.Instance.AimTargetActive;
bool flag7 = MapQuickAccessPlugin.AllowInMenuLevel.Value || !SemiFunc.MenuLevel();
bool flag8 = MapQuickAccessPlugin.AllowWithTextInputActive.Value || SemiFunc.NoTextInputsActive();
if (flag4 && flag5 && flag6 && flag7 && flag8)
{
if (flag3)
{
if (!MapQuickAccessPlugin.EnableDoubleClickToggleAlwaysOpen.Value)
{
if (flag)
{
mapToggled = !mapToggled;
}
}
else if (runtimeState.PendingToggleClick && Time.unscaledTime - runtimeState.PendingToggleClickTime > MapQuickAccessPlugin.DoubleClickThreshold.Value)
{
mapToggled = !mapToggled;
runtimeState.PendingToggleClick = false;
}
}
else
{
mapToggled = false;
runtimeState.PendingToggleClick = false;
}
bool flag9 = MapQuickAccessPlugin.AllowWhileSprinting.Value || !PlayerController.instance.sprinting;
bool flag10 = flag2 && !runtimeState.SuppressMapInputUntilRelease;
if ((MapQuickAccessPlugin.AlwaysOpenMap.Value || flag10 || mapToggled || Map.Instance.debugActive) && flag9)
{
if (MapQuickAccessPlugin.InstantOpenClose.Value || @float >= 1f)
{
value = true;
}
}
else
{
if (!MapQuickAccessPlugin.AlwaysOpenMap.Value && !flag3)
{
mapToggled = false;
}
if (MapQuickAccessPlugin.InstantOpenClose.Value || @float <= 0f)
{
value = false;
}
}
}
else
{
mapToggled = false;
runtimeState.PendingToggleClick = false;
value = false;
}
SetBool(instance, FieldMapToggled, mapToggled);
SetBool(instance, FieldActive, value);
}
private static void HandleAlwaysOpenDoubleClick(RuntimeState runtimeState, bool mapButtonDown, bool mapButtonHold, ref bool mapToggled, bool toggleMode)
{
if (!mapButtonHold)
{
runtimeState.SuppressMapInputUntilRelease = false;
}
if (!MapQuickAccessPlugin.EnableDoubleClickToggleAlwaysOpen.Value || !mapButtonDown)
{
return;
}
float unscaledTime = Time.unscaledTime;
float value = MapQuickAccessPlugin.DoubleClickThreshold.Value;
if (unscaledTime - runtimeState.LastMapButtonDownTime <= value)
{
MapQuickAccessPlugin.AlwaysOpenMap.Value = !MapQuickAccessPlugin.AlwaysOpenMap.Value;
MapQuickAccessPlugin.SaveConfigSafe();
runtimeState.LastMapButtonDownTime = -10f;
runtimeState.PendingToggleClick = false;
runtimeState.SuppressMapInputUntilRelease = true;
mapToggled = false;
if (MapQuickAccessPlugin.Log != null)
{
MapQuickAccessPlugin.Log.LogInfo((object)("AlwaysOpenMap: " + (MapQuickAccessPlugin.AlwaysOpenMap.Value ? "ON" : "OFF")));
}
}
else
{
runtimeState.LastMapButtonDownTime = unscaledTime;
if (toggleMode)
{
runtimeState.PendingToggleClick = true;
runtimeState.PendingToggleClickTime = unscaledTime;
}
}
}
private static void ProcessStateChange(MapToolController instance, PhotonView photonView, bool isLocalOwner)
{
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
bool @bool = GetBool(instance, FieldActive);
bool bool2 = GetBool(instance, FieldActivePrev);
if (@bool == bool2)
{
return;
}
SetBool(instance, FieldActivePrev, @bool);
if (GameManager.Multiplayer() && isLocalOwner && (Object)(object)photonView != (Object)null)
{
photonView.RPC("SetActiveRPC", (RpcTarget)1, new object[1] { @bool });
}
if (@bool)
{
if (isLocalOwner)
{
if (MapQuickAccessPlugin.EnableOpenCloseShake.Value && (Object)(object)GameDirector.instance != (Object)null && (Object)(object)GameDirector.instance.CameraShake != (Object)null)
{
GameDirector.instance.CameraShake.Shake(2f, 0.1f);
}
if ((Object)(object)Map.Instance != (Object)null)
{
Map.Instance.ActiveSet(true);
}
}
if ((Object)(object)instance.VisualTransform != (Object)null)
{
((Component)instance.VisualTransform).gameObject.SetActive(true);
}
if (MapQuickAccessPlugin.KeepOpenSound.Value && instance.SoundStart != null)
{
instance.SoundStart.Play(((Component)instance).transform.position, 1f, 1f, 1f, 1f);
}
return;
}
if (isLocalOwner)
{
if (MapQuickAccessPlugin.EnableOpenCloseShake.Value && (Object)(object)GameDirector.instance != (Object)null && (Object)(object)GameDirector.instance.CameraShake != (Object)null)
{
GameDirector.instance.CameraShake.Shake(2f, 0.1f);
}
if ((Object)(object)Map.Instance != (Object)null)
{
Map.Instance.ActiveSet(false);
}
}
if (MapQuickAccessPlugin.KeepOpenSound.Value && instance.SoundStop != null)
{
instance.SoundStop.Play(((Component)instance).transform.position, 1f, 1f, 1f, 1f);
}
}
private static void ProcessAnimationAndCamera(MapToolController instance, PhotonView photonView, bool isLocalOwner, RuntimeState runtimeState)
{
//IL_0117: 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_01c1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0422: Unknown result type (might be due to invalid IL or missing references)
//IL_0427: Unknown result type (might be due to invalid IL or missing references)
//IL_0594: Unknown result type (might be due to invalid IL or missing references)
//IL_0599: 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_05ad: Unknown result type (might be due to invalid IL or missing references)
//IL_056b: Unknown result type (might be due to invalid IL or missing references)
//IL_056f: Unknown result type (might be due to invalid IL or missing references)
//IL_047b: Unknown result type (might be due to invalid IL or missing references)
//IL_0497: Unknown result type (might be due to invalid IL or missing references)
//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
//IL_0663: Unknown result type (might be due to invalid IL or missing references)
//IL_066d: Unknown result type (might be due to invalid IL or missing references)
//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
//IL_061c: Unknown result type (might be due to invalid IL or missing references)
//IL_06b4: Unknown result type (might be due to invalid IL or missing references)
//IL_06ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0512: Unknown result type (might be due to invalid IL or missing references)
//IL_051c: Unknown result type (might be due to invalid IL or missing references)
//IL_04f1: Unknown result type (might be due to invalid IL or missing references)
bool @bool = GetBool(instance, FieldActive);
bool flag = @bool && MapQuickAccessPlugin.AlwaysOpenMap.Value;
float num = GetFloat(instance, FieldHideLerp);
float num2 = 90f;
float num3 = 1f;
if (GameManager.Multiplayer() && !isLocalOwner)
{
num2 = 0f;
num3 = 2f;
}
if (MapQuickAccessPlugin.InstantOpenClose.Value)
{
if (@bool)
{
num = 0f;
SetFloat(instance, FieldHideScale, 1f);
if ((Object)(object)instance.HideTransform != (Object)null)
{
instance.HideTransform.localRotation = Quaternion.identity;
}
if ((Object)(object)instance.VisualTransform != (Object)null)
{
((Component)instance.VisualTransform).gameObject.SetActive(true);
}
}
else
{
num = 1f;
SetFloat(instance, FieldHideScale, 0f);
if ((Object)(object)instance.HideTransform != (Object)null)
{
instance.HideTransform.localRotation = Quaternion.Euler(num2, 0f, 0f);
}
if ((Object)(object)instance.VisualTransform != (Object)null)
{
((Component)instance.VisualTransform).gameObject.SetActive(false);
}
}
SetFloat(instance, FieldHideLerp, num);
}
else
{
float value;
if (@bool)
{
if (num > 0f)
{
num -= Time.deltaTime * instance.IntroSpeed * num3;
}
value = Mathf.LerpUnclamped(1f, 0f, instance.IntroCurve.Evaluate(num));
if ((Object)(object)instance.HideTransform != (Object)null)
{
instance.HideTransform.localRotation = Quaternion.Slerp(Quaternion.identity, Quaternion.Euler(num2, 0f, 0f), instance.IntroCurve.Evaluate(num));
}
}
else
{
if (num < 1f)
{
num += Time.deltaTime * instance.OutroSpeed * num3;
if (num > 1f && (Object)(object)instance.VisualTransform != (Object)null)
{
((Component)instance.VisualTransform).gameObject.SetActive(false);
}
}
value = Mathf.LerpUnclamped(1f, 0f, instance.OutroCurve.Evaluate(num));
}
SetFloat(instance, FieldHideLerp, num);
SetFloat(instance, FieldHideScale, value);
}
if (isLocalOwner && @bool)
{
ProcessLocalUi(instance, runtimeState, flag);
if (!flag)
{
SemiFunc.UIHideWorldSpace();
}
else
{
KeepWorldSpaceUiVisible();
UpdatePlayerNamesWhileFixed(runtimeState);
}
if (!MapQuickAccessPlugin.DisableMoveSlowdown.Value)
{
PlayerController.instance.MoveMult(instance.MoveMultiplier, 0.1f);
}
if (!MapQuickAccessPlugin.DisableCameraTopFade.Value && (Object)(object)CameraTopFade.Instance != (Object)null)
{
CameraTopFade.Instance.Set(instance.FadeAmount, 0.1f);
}
if (!MapQuickAccessPlugin.DisableCameraBobMultiplier.Value && (Object)(object)CameraBob.Instance != (Object)null)
{
CameraBob.Instance.SetMultiplier(instance.BobMultiplier, 0.1f);
}
if (!MapQuickAccessPlugin.DisableCameraZoomOverride.Value && (Object)(object)CameraZoom.Instance != (Object)null)
{
CameraZoom.Instance.OverrideZoomSet(50f, 0.05f, 2f, 2f, ((Component)instance).gameObject, 100);
}
if (!MapQuickAccessPlugin.DisableCameraNoiseOverride.Value && (Object)(object)CameraNoise.Instance != (Object)null)
{
CameraNoise.Instance.Override(0.025f, 0.25f);
}
if (!MapQuickAccessPlugin.KeepAimVisible.Value && (!flag || !MapQuickAccessPlugin.AutoKeepAimVisibleWhenMapFixed.Value) && (Object)(object)Aim.instance != (Object)null)
{
Aim.instance.SetState((State)4);
}
ProcessAdjustmentInputs(flag);
}
Vector3 val = Vector3.one;
if (GameManager.Multiplayer() && !isLocalOwner)
{
if ((Object)(object)((Component)instance).transform.parent != (Object)null && (Object)(object)instance.FollowTransformClient != (Object)null)
{
((Component)instance).transform.parent.position = instance.FollowTransformClient.position;
((Component)instance).transform.parent.rotation = instance.FollowTransformClient.rotation;
val = instance.FollowTransformClient.localScale;
}
if ((Object)(object)instance.mainSpringTransform != (Object)null && (Object)(object)instance.mainSpringTransformTarget != (Object)null)
{
if (MapQuickAccessPlugin.InstantOpenClose.Value)
{
instance.mainSpringTransform.rotation = instance.mainSpringTransformTarget.rotation;
}
else
{
instance.mainSpringTransform.rotation = SemiFunc.SpringQuaternionGet(instance.mainSpring, instance.mainSpringTransformTarget.rotation, -1f);
}
}
}
float @float = GetFloat(instance, FieldHideScale);
if ((Object)(object)((Component)instance).transform.parent != (Object)null)
{
if (MapQuickAccessPlugin.InstantOpenClose.Value)
{
((Component)instance).transform.parent.localScale = val * @float;
}
else
{
((Component)instance).transform.parent.localScale = Vector3.Lerp(((Component)instance).transform.parent.localScale, val * @float, Time.deltaTime * 20f);
}
}
if ((Object)(object)instance.displaySpringTransform != (Object)null && (Object)(object)instance.displaySpringTransformTarget != (Object)null)
{
if (MapQuickAccessPlugin.InstantOpenClose.Value)
{
instance.displaySpringTransform.rotation = instance.displaySpringTransformTarget.rotation;
SetDisplayJointAngleDiff(instance, 0f);
SetDisplayJointAnglePreviousX(instance, instance.displaySpringTransform.localRotation.x);
if (instance.SoundLoop != null)
{
instance.SoundLoop.LoopPitch = 1f;
}
}
else
{
instance.displaySpringTransform.rotation = SemiFunc.SpringQuaternionGet(instance.displaySpring, instance.displaySpringTransformTarget.rotation, -1f);
}
}
if (!MapQuickAccessPlugin.InstantOpenClose.Value && @bool && (Object)(object)instance.displaySpringTransform != (Object)null)
{
float displayJointAnglePreviousX = GetDisplayJointAnglePreviousX(instance);
float num4 = (displayJointAnglePreviousX - instance.displaySpringTransform.localRotation.x) * 50f;
num4 = Mathf.Clamp(num4, -0.1f, 0.1f);
SetDisplayJointAngleDiff(instance, num4);
SetDisplayJointAnglePreviousX(instance, instance.displaySpringTransform.localRotation.x);
if (instance.SoundLoop != null)
{
instance.SoundLoop.LoopPitch = Mathf.Lerp(instance.SoundLoop.LoopPitch, 1f - num4, Time.deltaTime * 10f);
}
}
if (isLocalOwner)
{
ApplyPlacementOverrides(instance, runtimeState, @bool);
ApplyOpacityOverrides(instance, runtimeState, @bool);
}
}
private static void ProcessLocalUi(MapToolController instance, RuntimeState runtimeState, bool fixedOpen)
{
if (fixedOpen)
{
if ((Object)(object)StatsUI.instance != (Object)null)
{
((SemiUI)StatsUI.instance).Hide();
}
}
else if ((Object)(object)StatsUI.instance != (Object)null)
{
((SemiUI)StatsUI.instance).Show();
}
if ((Object)(object)ItemInfoUI.instance != (Object)null)
{
((SemiUI)ItemInfoUI.instance).Hide();
}
if ((Object)(object)ItemInfoExtraUI.instance != (Object)null)
{
((SemiUI)ItemInfoExtraUI.instance).Hide();
}
if ((Object)(object)MissionUI.instance != (Object)null && (Object)(object)MissionUI.instance.Text != (Object)null && ((TMP_Text)MissionUI.instance.Text).text != "")
{
((SemiUI)MissionUI.instance).Show();
}
}
private static void KeepWorldSpaceUiVisible()
{
if (!((Object)(object)WorldSpaceUIParent.instance == (Object)null))
{
if (FieldWorldSpaceUiHideTimer != null)
{
FieldWorldSpaceUiHideTimer.SetValue(WorldSpaceUIParent.instance, 0f);
}
if (FieldWorldSpaceUiHideAlpha != null)
{
FieldWorldSpaceUiHideAlpha.SetValue(WorldSpaceUIParent.instance, 1f);
}
CanvasGroup component = ((Component)WorldSpaceUIParent.instance).GetComponent<CanvasGroup>();
if ((Object)(object)component != (Object)null)
{
component.alpha = 1f;
}
}
}
private static void UpdatePlayerNamesWhileFixed(RuntimeState runtimeState)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Invalid comparison between Unknown and I4
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: 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_015f: 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_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)GameDirector.instance == (Object)null || (Object)(object)Camera.main == (Object)null || (Object)(object)DataDirector.instance == (Object)null || (int)GameDirector.instance.currentState != 2 || DataDirector.instance.SettingValueFetch((Setting)30) != 1)
{
return;
}
if (runtimeState.PlayerNameCheckTimer > 0f)
{
runtimeState.PlayerNameCheckTimer -= Time.deltaTime;
return;
}
runtimeState.PlayerNameCheckTimer = 0.25f;
List<PlayerAvatar> list = new List<PlayerAvatar>();
Camera main = Camera.main;
RaycastHit[] array = Physics.SphereCastAll(((Component)main).transform.position, 0.25f, ((Component)main).transform.forward, 15f, LayerMask.GetMask(new string[1] { "PlayerVisuals" }), (QueryTriggerInteraction)2);
RaycastHit val3 = default(RaycastHit);
for (int i = 0; i < array.Length; i++)
{
RaycastHit val = array[i];
PlayerAvatarVisuals componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<PlayerAvatarVisuals>();
if ((Object)(object)componentInParent == (Object)null || (Object)(object)componentInParent.playerAvatar == (Object)null)
{
continue;
}
PlayerAvatar playerAvatar = componentInParent.playerAvatar;
if (playerAvatar.isLocal || list.Contains(playerAvatar))
{
continue;
}
Vector3 val2 = ((Component)main).transform.position - ((RaycastHit)(ref val)).point;
if (!Physics.Raycast(((RaycastHit)(ref val)).point, val2, ref val3, ((Vector3)(ref val2)).magnitude, LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) - LayerMask.GetMask(new string[1] { "Player" }), (QueryTriggerInteraction)2) && FieldPlayerWorldSpaceUIPlayerName != null)
{
object? value = FieldPlayerWorldSpaceUIPlayerName.GetValue(playerAvatar);
WorldSpaceUIPlayerName val4 = (WorldSpaceUIPlayerName)((value is WorldSpaceUIPlayerName) ? value : null);
if ((Object)(object)val4 != (Object)null)
{
val4.Show();
list.Add(playerAvatar);
}
}
}
}
private static void ProcessAdjustmentInputs(bool fixedOpen)
{
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
if (MapQuickAccessPlugin.EnableMapOffsetAdjustment.Value)
{
if (Input.GetKeyDown((KeyCode)276))
{
MapQuickAccessPlugin.MapOffsetX.Value = Mathf.Clamp(MapQuickAccessPlugin.MapOffsetX.Value - 0.1f, -3f, 3f);
flag = true;
}
if (Input.GetKeyDown((KeyCode)275))
{
MapQuickAccessPlugin.MapOffsetX.Value = Mathf.Clamp(MapQuickAccessPlugin.MapOffsetX.Value + 0.1f, -3f, 3f);
flag = true;
}
if (Input.GetKeyDown((KeyCode)273))
{
MapQuickAccessPlugin.MapOffsetY.Value = Mathf.Clamp(MapQuickAccessPlugin.MapOffsetY.Value + 0.1f, -3f, 3f);
flag = true;
}
if (Input.GetKeyDown((KeyCode)274))
{
MapQuickAccessPlugin.MapOffsetY.Value = Mathf.Clamp(MapQuickAccessPlugin.MapOffsetY.Value - 0.1f, -3f, 3f);
flag = true;
}
if (!fixedOpen)
{
float num = Input.mouseScrollDelta.y;
if (Mathf.Abs(num) < 0.01f)
{
num = Input.GetAxis("Mouse ScrollWheel");
}
if (num > 0.01f)
{
MapQuickAccessPlugin.MapDistanceOffset.Value = Mathf.Clamp(MapQuickAccessPlugin.MapDistanceOffset.Value + 0.1f, -3f, 3f);
flag = true;
}
else if (num < -0.01f)
{
MapQuickAccessPlugin.MapDistanceOffset.Value = Mathf.Clamp(MapQuickAccessPlugin.MapDistanceOffset.Value - 0.1f, -3f, 3f);
flag = true;
}
}
}
if (MapQuickAccessPlugin.EnableMapOpacityAdjustment.Value)
{
if (Input.GetKeyDown((KeyCode)280))
{
MapQuickAccessPlugin.MapOpacity.Value = Mathf.Clamp(MapQuickAccessPlugin.MapOpacity.Value + 0.1f, 0.1f, 1f);
flag = true;
}
if (Input.GetKeyDown((KeyCode)281))
{
MapQuickAccessPlugin.MapOpacity.Value = Mathf.Clamp(MapQuickAccessPlugin.MapOpacity.Value - 0.1f, 0.1f, 1f);
flag = true;
}
}
if (flag)
{
MapQuickAccessPlugin.MapOffsetX.Value = RoundTenths(MapQuickAccessPlugin.MapOffsetX.Value);
MapQuickAccessPlugin.MapOffsetY.Value = RoundTenths(MapQuickAccessPlugin.MapOffsetY.Value);
MapQuickAccessPlugin.MapDistanceOffset.Value = RoundTenths(MapQuickAccessPlugin.MapDistanceOffset.Value);
MapQuickAccessPlugin.MapOpacity.Value = RoundTenths(MapQuickAccessPlugin.MapOpacity.Value);
MapQuickAccessPlugin.SaveConfigSafe();
}
}
private static void ApplyPlacementOverrides(MapToolController instance, RuntimeState runtimeState, bool active)
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: 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_00ea: 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_00b5: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)instance == (Object)null || (Object)(object)((Component)instance).transform == (Object)null)
{
return;
}
Transform val = (((Object)(object)((Component)instance).transform.parent != (Object)null) ? ((Component)instance).transform.parent : ((Component)instance).transform);
if (!((Object)(object)val == (Object)null))
{
if (!runtimeState.BaseTransformCached)
{
runtimeState.BasePlacementLocalPosition = val.localPosition;
runtimeState.BasePlacementLocalRotation = val.localRotation;
runtimeState.BaseTransformCached = true;
}
if (active)
{
Vector3 localPosition = runtimeState.BasePlacementLocalPosition + new Vector3(MapQuickAccessPlugin.MapOffsetX.Value, MapQuickAccessPlugin.MapOffsetY.Value, MapQuickAccessPlugin.MapDistanceOffset.Value);
val.localPosition = localPosition;
val.localRotation = runtimeState.BasePlacementLocalRotation;
}
else
{
val.localPosition = runtimeState.BasePlacementLocalPosition;
val.localRotation = runtimeState.BasePlacementLocalRotation;
}
}
}
private static void ApplyOpacityOverrides(MapToolController instance, RuntimeState runtimeState, bool active)
{
float num = (active ? Mathf.Clamp(MapQuickAccessPlugin.MapOpacity.Value, 0.1f, 1f) : 1f);
if (!runtimeState.MaterialsCached)
{
CacheMapMaterials(instance, runtimeState);
}
if (Mathf.Abs(runtimeState.LastAppliedOpacity - num) < 0.0001f)
{
return;
}
for (int i = 0; i < runtimeState.CachedMaterials.Length; i++)
{
Material[] array = runtimeState.CachedMaterials[i];
if (array == null)
{
continue;
}
foreach (Material val in array)
{
if (!((Object)(object)val == (Object)null))
{
if (!runtimeState.CachedMaterialAlpha.TryGetValue(val, out var value))
{
value = GetMaterialBaseAlpha(val);
runtimeState.CachedMaterialAlpha[val] = value;
}
SetMaterialAlpha(val, value * num);
}
}
}
runtimeState.LastAppliedOpacity = num;
}
private static void CacheMapMaterials(MapToolController instance, RuntimeState runtimeState)
{
Transform val = (((Object)(object)instance.VisualTransform != (Object)null) ? instance.VisualTransform : ((Component)instance).transform);
if ((Object)(object)val == (Object)null)
{
return;
}
runtimeState.CachedRenderers = ((Component)val).GetComponentsInChildren<Renderer>(true);
runtimeState.CachedMaterials = new Material[runtimeState.CachedRenderers.Length][];
runtimeState.CachedMaterialAlpha.Clear();
for (int i = 0; i < runtimeState.CachedRenderers.Length; i++)
{
Renderer val2 = runtimeState.CachedRenderers[i];
if ((Object)(object)val2 == (Object)null)
{
runtimeState.CachedMaterials[i] = (Material[])(object)new Material[0];
continue;
}
Material[] materials = val2.materials;
runtimeState.CachedMaterials[i] = materials;
foreach (Material val3 in materials)
{
if ((Object)(object)val3 != (Object)null && !runtimeState.CachedMaterialAlpha.ContainsKey(val3))
{
runtimeState.CachedMaterialAlpha.Add(val3, GetMaterialBaseAlpha(val3));
}
}
}
runtimeState.MaterialsCached = true;
runtimeState.LastAppliedOpacity = -1f;
}
private static float GetMaterialBaseAlpha(Material material)
{
//IL_0026: 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)
if ((Object)(object)material == (Object)null)
{
return 1f;
}
if (material.HasProperty("_Color"))
{
return material.color.a;
}
if (material.HasProperty("_BaseColor"))
{
return material.GetColor("_BaseColor").a;
}
return 1f;
}
private static void SetMaterialAlpha(Material material, float alpha)
{
//IL_0020: 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_002f: 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_0052: 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)
if (!((Object)(object)material == (Object)null))
{
if (material.HasProperty("_Color"))
{
Color color = material.color;
color.a = alpha;
material.color = color;
}
if (material.HasProperty("_BaseColor"))
{
Color color2 = material.GetColor("_BaseColor");
color2.a = alpha;
material.SetColor("_BaseColor", color2);
}
}
}
private static void ProcessSoundLoop(MapToolController instance)
{
if (instance.SoundLoop != null)
{
bool @bool = GetBool(instance, FieldActive);
bool flag = @bool && MapQuickAccessPlugin.AlwaysOpenMap.Value;
bool flag2 = MapQuickAccessPlugin.KeepLoopSound.Value && @bool;
if (flag && MapQuickAccessPlugin.DisableLoopSoundWhenMapFixed.Value)
{
flag2 = false;
}
instance.SoundLoop.PlayLoop(flag2, 5f, 5f, 1f);
}
}
private static RuntimeState GetRuntimeState(MapToolController instance)
{
int instanceID = ((Object)instance).GetInstanceID();
if (!RuntimeStates.TryGetValue(instanceID, out RuntimeState value))
{
value = new RuntimeState();
RuntimeStates.Add(instanceID, value);
}
return value;
}
private static PhotonView GetPhotonView(MapToolController instance)
{
PhotonView val = null;
if (FieldPhotonView != null)
{
object? value = FieldPhotonView.GetValue(instance);
val = (PhotonView)((value is PhotonView) ? value : null);
}
if ((Object)(object)val == (Object)null)
{
val = ((Component)instance).GetComponent<PhotonView>();
if (FieldPhotonView != null && (Object)(object)val != (Object)null)
{
FieldPhotonView.SetValue(instance, val);
}
}
return val;
}
private static bool GetBool(object instance, FieldInfo field)
{
if (field == null)
{
return false;
}
if (!(field.GetValue(instance) is bool result))
{
return false;
}
return result;
}
private static void SetBool(object instance, FieldInfo field, bool value)
{
if (field != null)
{
field.SetValue(instance, value);
}
}
private static float GetFloat(object instance, FieldInfo field)
{
if (field == null)
{
return 0f;
}
if (!(field.GetValue(instance) is float result))
{
return 0f;
}
return result;
}
private static void SetFloat(object instance, FieldInfo field, float value)
{
if (field != null)
{
field.SetValue(instance, value);
}
}
private static float GetDisplayJointAnglePreviousX(MapToolController instance)
{
if (FieldDisplayJointAnglePreviousX == null)
{
return 0f;
}
if (!(FieldDisplayJointAnglePreviousX.GetValue(instance) is float result))
{
return 0f;
}
return result;
}
private static void SetDisplayJointAngleDiff(MapToolController instance, float value)
{
if (FieldDisplayJointAngleDiff != null)
{
FieldDisplayJointAngleDiff.SetValue(instance, value);
}
}
private static void SetDisplayJointAnglePreviousX(MapToolController instance, float value)
{
if (FieldDisplayJointAnglePreviousX != null)
{
FieldDisplayJointAnglePreviousX.SetValue(instance, value);
}
}
private static float RoundTenths(float value)
{
return Mathf.Round(value * 10f) / 10f;
}
}