using System;
using System.Buffers.Binary;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO.Compression;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AtlyssCommandLib.API;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CodeTalker;
using CodeTalker.Networking;
using CodeTalker.Packets;
using HarmonyLib;
using Homebrewery.Code.Component;
using Microsoft.CodeAnalysis;
using Mirror;
using Nessie.ATLYSS.EasySettings;
using UnityEngine;
using UnityEngine.Events;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Homebrewery")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Marioalexsan.Observe")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0+e05ff9ebb2fde25e85d1b3ca8d51aeaf023e6a3a")]
[assembly: AssemblyProduct("Observe")]
[assembly: AssemblyTitle("Marioalexsan.Observe")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.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;
}
}
}
namespace Marioalexsan.Observe
{
public static class CameraChecks
{
private static bool _homebreweryIsFaulty;
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static bool IsUsingFreecam()
{
if (Chainloader.PluginInfos.ContainsKey("Homebrewery") && !_homebreweryIsFaulty)
{
try
{
if (HomebreweryFreecamActive())
{
return true;
}
}
catch (Exception arg)
{
_homebreweryIsFaulty = true;
ObservePlugin.Logger.LogWarning((object)"Failed to get Homebrewery's freecam state! Please report this to Observe's mod author!");
ObservePlugin.Logger.LogWarning((object)$"Exception: {arg}");
}
}
return false;
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
private static bool HomebreweryFreecamActive()
{
return Object.op_Implicit((Object)(object)CameraDX._current) && CameraDX._current._freecam;
}
}
internal static class Commands
{
[CompilerGenerated]
private static class <>O
{
public static CommandCallback <0>__ToggleOwl;
public static CommandCallback <1>__ToggleVanilla;
public static CommandCallback <2>__SetHeadTilt;
public static CommandCallback <3>__ToggleLookSpeed;
public static CommandCallback <4>__ChangeFrontalAngleMode;
}
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static CommandCallback <>9__0_0;
public static CommandCallback <>9__0_1;
public static CommandCallback <>9__0_2;
public static CommandCallback <>9__0_3;
public static CommandCallback <>9__0_4;
public static CommandCallback <>9__0_5;
public static CommandCallback <>9__0_6;
public static CommandCallback <>9__0_7;
public static CommandCallback <>9__0_8;
public static CommandCallback <>9__0_9;
public static CommandCallback <>9__0_10;
internal bool <RegisterCommands>b__0_0(Caller caller, string[] args)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return LookCommand("default", caller, args);
}
internal bool <RegisterCommands>b__0_1(Caller caller, string[] args)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return LookCommand("left", caller, args);
}
internal bool <RegisterCommands>b__0_2(Caller caller, string[] args)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return LookCommand("right", caller, args);
}
internal bool <RegisterCommands>b__0_3(Caller caller, string[] args)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return LookCommand("up", caller, args);
}
internal bool <RegisterCommands>b__0_4(Caller caller, string[] args)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return LookCommand("down", caller, args);
}
internal bool <RegisterCommands>b__0_5(Caller caller, string[] args)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return LookCommand("forward", caller, args);
}
internal bool <RegisterCommands>b__0_6(Caller caller, string[] args)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return LookCommand("backward", caller, args);
}
internal bool <RegisterCommands>b__0_7(Caller caller, string[] args)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return LookCommand("camera", caller, args);
}
internal bool <RegisterCommands>b__0_8(Caller caller, string[] args)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return LookCommand("pose", caller, args);
}
internal bool <RegisterCommands>b__0_9(Caller caller, string[] args)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return LookCommand("freeze", caller, args);
}
internal bool <RegisterCommands>b__0_10(Caller caller, string[] args)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return LookCommand("environment", caller, args);
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
internal static void RegisterCommands()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_003c: 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_0047: Expected O, but got Unknown
//IL_0082: 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)
//IL_008d: Expected O, but got Unknown
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Expected O, but got Unknown
//IL_00f4: 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_00ff: Expected O, but got Unknown
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Expected O, but got Unknown
//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_0171: Expected O, but got Unknown
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Expected O, but got Unknown
//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_01e3: Expected O, but got Unknown
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Expected O, but got Unknown
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Expected O, but got Unknown
//IL_0283: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_028e: Expected O, but got Unknown
//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
//IL_02c3: Expected O, but got Unknown
//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
//IL_02f2: Unknown result type (might be due to invalid IL or missing references)
//IL_02f8: Expected O, but got Unknown
//IL_0322: Unknown result type (might be due to invalid IL or missing references)
//IL_0327: Unknown result type (might be due to invalid IL or missing references)
//IL_032d: Expected O, but got Unknown
//IL_037f: Unknown result type (might be due to invalid IL or missing references)
//IL_0384: Unknown result type (might be due to invalid IL or missing references)
//IL_038a: Expected O, but got Unknown
//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
//IL_03e7: Expected O, but got Unknown
CommandProvider val = new CommandProvider("observe", "Observe commands");
CommandProvider.Root.RegisterProvider(val);
object obj = <>c.<>9__0_0;
if (obj == null)
{
CommandCallback val2 = (Caller caller, string[] args) => LookCommand("default", caller, args);
<>c.<>9__0_0 = val2;
obj = (object)val2;
}
ModCommand val3 = val.RegisterCommand("default", "Look where your camera is looking", (CommandCallback)obj, (CommandOptions?)null);
val.RegisterAlias("reset", val3);
object obj2 = <>c.<>9__0_1;
if (obj2 == null)
{
CommandCallback val4 = (Caller caller, string[] args) => LookCommand("left", caller, args);
<>c.<>9__0_1 = val4;
obj2 = (object)val4;
}
val.RegisterCommand("left", "Look to your left", (CommandCallback)obj2, (CommandOptions?)null);
object obj3 = <>c.<>9__0_2;
if (obj3 == null)
{
CommandCallback val5 = (Caller caller, string[] args) => LookCommand("right", caller, args);
<>c.<>9__0_2 = val5;
obj3 = (object)val5;
}
val.RegisterCommand("right", "Look to your right", (CommandCallback)obj3, (CommandOptions?)null);
object obj4 = <>c.<>9__0_3;
if (obj4 == null)
{
CommandCallback val6 = (Caller caller, string[] args) => LookCommand("up", caller, args);
<>c.<>9__0_3 = val6;
obj4 = (object)val6;
}
val.RegisterCommand("up", "Look up", (CommandCallback)obj4, (CommandOptions?)null);
object obj5 = <>c.<>9__0_4;
if (obj5 == null)
{
CommandCallback val7 = (Caller caller, string[] args) => LookCommand("down", caller, args);
<>c.<>9__0_4 = val7;
obj5 = (object)val7;
}
val.RegisterCommand("down", "Look down", (CommandCallback)obj5, (CommandOptions?)null);
object obj6 = <>c.<>9__0_5;
if (obj6 == null)
{
CommandCallback val8 = (Caller caller, string[] args) => LookCommand("forward", caller, args);
<>c.<>9__0_5 = val8;
obj6 = (object)val8;
}
val.RegisterCommand("forward", "Look forward", (CommandCallback)obj6, (CommandOptions?)null);
object obj7 = <>c.<>9__0_6;
if (obj7 == null)
{
CommandCallback val9 = (Caller caller, string[] args) => LookCommand("backward", caller, args);
<>c.<>9__0_6 = val9;
obj7 = (object)val9;
}
val.RegisterCommand("backward", "Look backward (might require Owl mode)", (CommandCallback)obj7, (CommandOptions?)null);
object obj8 = <>c.<>9__0_7;
if (obj8 == null)
{
CommandCallback val10 = (Caller caller, string[] args) => LookCommand("camera", caller, args);
<>c.<>9__0_7 = val10;
obj8 = (object)val10;
}
val.RegisterCommand("camera", "Look at the camera", (CommandCallback)obj8, (CommandOptions?)null);
object obj9 = <>c.<>9__0_8;
if (obj9 == null)
{
CommandCallback val11 = (Caller caller, string[] args) => LookCommand("pose", caller, args);
<>c.<>9__0_8 = val11;
obj9 = (object)val11;
}
val.RegisterCommand("pose", "Look relative to your current camera direction", (CommandCallback)obj9, (CommandOptions?)null);
object obj10 = <>c.<>9__0_9;
if (obj10 == null)
{
CommandCallback val12 = (Caller caller, string[] args) => LookCommand("freeze", caller, args);
<>c.<>9__0_9 = val12;
obj10 = (object)val12;
}
val.RegisterCommand("freeze", "Freeze your current look direction", (CommandCallback)obj10, (CommandOptions?)null);
object obj11 = <>c.<>9__0_10;
if (obj11 == null)
{
CommandCallback val13 = (Caller caller, string[] args) => LookCommand("environment", caller, args);
<>c.<>9__0_10 = val13;
obj11 = (object)val13;
}
val.RegisterCommand("environment", "Look in the far distance based on your current camera direction", (CommandCallback)obj11, (CommandOptions?)null);
object obj12 = <>O.<0>__ToggleOwl;
if (obj12 == null)
{
CommandCallback val14 = ToggleOwl;
<>O.<0>__ToggleOwl = val14;
obj12 = (object)val14;
}
val.RegisterCommand("owl", "Toggles Owl mode for yourself", (CommandCallback)obj12, (CommandOptions?)null);
object obj13 = <>O.<1>__ToggleVanilla;
if (obj13 == null)
{
CommandCallback val15 = ToggleVanilla;
<>O.<1>__ToggleVanilla = val15;
obj13 = (object)val15;
}
val.RegisterCommand("vanilla", "Toggles Vanilla Mode for yourself", (CommandCallback)obj13, (CommandOptions?)null);
object obj14 = <>O.<2>__SetHeadTilt;
if (obj14 == null)
{
CommandCallback val16 = SetHeadTilt;
<>O.<2>__SetHeadTilt = val16;
obj14 = (object)val16;
}
val.RegisterCommand("tilt", "Tilt your head left or right by the given angle", (CommandCallback)obj14, (CommandOptions?)null);
string text = "Available options are " + string.Join(", ", Enum.GetNames(typeof(LookSpeed))) + ".";
object obj15 = <>O.<3>__ToggleLookSpeed;
if (obj15 == null)
{
CommandCallback val17 = ToggleLookSpeed;
<>O.<3>__ToggleLookSpeed = val17;
obj15 = (object)val17;
}
val.RegisterCommand("speed", "Toggles look speed for yourself", text, (CommandCallback)obj15, (CommandOptions?)null);
string text2 = "Available options are " + string.Join(", ", Enum.GetNames(typeof(BackwardLookMode))) + ".";
object obj16 = <>O.<4>__ChangeFrontalAngleMode;
if (obj16 == null)
{
CommandCallback val18 = ChangeFrontalAngleMode;
<>O.<4>__ChangeFrontalAngleMode = val18;
obj16 = (object)val18;
}
val.RegisterCommand("frontal", "Toggles behaviour of frontal angles for Default mode", text2, (CommandCallback)obj16, (CommandOptions?)null);
}
private static bool ToggleOwl(Caller caller, string[] args)
{
//IL_0028: 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_004f: Unknown result type (might be due to invalid IL or missing references)
if (args.Length != 0)
{
return false;
}
bool flag = !ObservePlugin.OwlModeSetting.Value;
ObservePlugin.OwlModeSetting.Value = flag;
Utils.NotifyCaller(caller, "Owl Mode is now " + (flag ? "on" : "off") + ".", default(Color));
return true;
}
private static bool ToggleVanilla(Caller caller, string[] args)
{
//IL_0028: 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_004f: Unknown result type (might be due to invalid IL or missing references)
if (args.Length != 0)
{
return false;
}
bool flag = !ObservePlugin.VanillaModeSetting.Value;
ObservePlugin.VanillaModeSetting.Value = flag;
Utils.NotifyCaller(caller, "Vanilla Mode is now " + (flag ? "on" : "off") + ".", default(Color));
return true;
}
private static bool ToggleLookSpeed(Caller caller, string[] args)
{
//IL_0034: 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_0059: Unknown result type (might be due to invalid IL or missing references)
if (args.Length != 1)
{
return false;
}
if (!Enum.TryParse<LookSpeed>(args[0], ignoreCase: true, out var result))
{
return false;
}
ObservePlugin.LookSpeedSetting.Value = result;
Utils.NotifyCaller(caller, "Look speed is now " + result.ToString() + ".", default(Color));
return true;
}
private static bool ChangeFrontalAngleMode(Caller caller, string[] args)
{
//IL_0034: 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_0059: Unknown result type (might be due to invalid IL or missing references)
if (args.Length != 1)
{
return false;
}
if (!Enum.TryParse<BackwardLookMode>(args[0], ignoreCase: true, out var result))
{
return false;
}
ObservePlugin.BackwardLookModeSetting.Value = result;
Utils.NotifyCaller(caller, "Frontal angle mode is now " + result.ToString() + ".", default(Color));
return true;
}
private static bool LookCommand(string lookDirection, Caller caller, string[] args)
{
//IL_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_0274: Unknown result type (might be due to invalid IL or missing references)
//IL_0283: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: 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_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: 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_02e0: Unknown result type (might be due to invalid IL or missing references)
//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
//IL_02b4: Unknown result type (might be due to invalid IL or missing references)
//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
//IL_0323: Unknown result type (might be due to invalid IL or missing references)
//IL_0336: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: 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_01f8: Unknown result type (might be due to invalid IL or missing references)
if (args.Length > 1)
{
return false;
}
switch (lookDirection)
{
case "left":
ObservePlugin.SavedOverride = Quaternion.Euler(0f, -90f, 0f);
ObservePlugin.LocalOverrideDirection = LookDirection.Pose;
break;
case "right":
ObservePlugin.SavedOverride = Quaternion.Euler(0f, 90f, 0f);
ObservePlugin.LocalOverrideDirection = LookDirection.Pose;
break;
case "up":
ObservePlugin.SavedOverride = Quaternion.Euler(-80f, 0f, 0f);
ObservePlugin.LocalOverrideDirection = LookDirection.Pose;
break;
case "down":
ObservePlugin.SavedOverride = Quaternion.Euler(80f, 0f, 0f);
ObservePlugin.LocalOverrideDirection = LookDirection.Pose;
break;
case "forward":
ObservePlugin.SavedOverride = Quaternion.identity;
ObservePlugin.LocalOverrideDirection = LookDirection.Pose;
break;
case "backward":
ObservePlugin.SavedOverride = Quaternion.Euler(0f, 180f, 0f);
ObservePlugin.LocalOverrideDirection = LookDirection.Pose;
break;
case "pose":
ObservePlugin.SavedOverride = Quaternion.Inverse(((Component)Player._mainPlayer).transform.rotation) * ((Component)CameraFunction._current).transform.rotation;
ObservePlugin.LocalOverrideDirection = LookDirection.Pose;
break;
case "freeze":
{
Transform headBone = ObservePlugin.GetHeadBone(((Component)Player._mainPlayer).GetComponentInChildren<PlayerRaceModel>());
ObservePlugin.SavedOverride = Quaternion.Inverse(((Component)Player._mainPlayer).transform.rotation) * headBone.rotation;
ObservePlugin.LocalOverrideDirection = LookDirection.Pose;
break;
}
case "environment":
ObservePlugin.SavedOverride = ((Component)CameraFunction._current).transform.rotation;
ObservePlugin.LocalOverrideDirection = LookDirection.Environment;
break;
case "camera":
ObservePlugin.LocalOverrideDirection = LookDirection.Camera;
break;
default:
ObservePlugin.LocalOverrideDirection = LookDirection.Default;
break;
}
if (args.Length == 1)
{
if (!int.TryParse(args[0], out var result))
{
Utils.NotifyCaller(caller, "\"" + args[0] + "\" is not right! It should be a valid duration in seconds!", Color.red);
return false;
}
ObservePlugin.LocalOverrideDirectionTime = TimeSpan.FromSeconds(result);
}
else
{
ObservePlugin.LocalOverrideDirectionTime = TimeSpan.FromDays(300.0);
}
return true;
}
private static bool SetHeadTilt(Caller caller, string[] args)
{
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: 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_00ef: 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_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: 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_0090: 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 (args.Length > 2 || args.Length == 0)
{
return false;
}
int result = 18;
if (args.Length == 2)
{
if (!int.TryParse(args[1], out result))
{
Utils.NotifyCaller(caller, "\"" + args[0] + "\" is not right! It should be a valid angle in degrees!", default(Color));
return false;
}
if (result < 0 || result > 35)
{
Utils.NotifyCaller(caller, $"\"{args[0]}\" needs to be between 0 and {35} degrees!", default(Color));
return false;
}
}
string text = args[0];
string text2 = text;
if (!(text2 == "left"))
{
if (text2 == "right")
{
ObservePlugin.SavedTilt = Quaternion.Euler(0f, 0f, (float)(-result));
}
else
{
ObservePlugin.SavedTilt = Quaternion.identity;
}
}
else
{
ObservePlugin.SavedTilt = Quaternion.Euler(0f, 0f, (float)result);
}
return true;
}
}
public enum LookDirection : byte
{
Default,
Camera,
Pose,
Environment
}
internal class LookPacket : BinaryPacketBase
{
private const string Signature = "Marioalexsan.Observe.LookPacket";
public Quaternion CameraRotation;
public uint TargetNetId;
public bool VanillaMode;
public bool OwlMode;
public LookSpeed LookSpeed;
public LookDirection OverrideDirection;
public bool IsValid = true;
public static readonly LookPacket Instance = new LookPacket();
public override string PacketSignature => "Marioalexsan.Observe.LookPacket";
public override byte[] Serialize()
{
byte[] array = new byte[32];
Span<byte> destination = array.AsSpan();
BinaryPrimitives.TryWriteInt32LittleEndian(destination, BitConverter.SingleToInt32Bits(CameraRotation.x));
ref Span<byte> reference = ref destination;
BinaryPrimitives.TryWriteInt32LittleEndian(reference.Slice(4, reference.Length - 4), BitConverter.SingleToInt32Bits(CameraRotation.y));
reference = ref destination;
BinaryPrimitives.TryWriteInt32LittleEndian(reference.Slice(8, reference.Length - 8), BitConverter.SingleToInt32Bits(CameraRotation.z));
reference = ref destination;
BinaryPrimitives.TryWriteInt32LittleEndian(reference.Slice(12, reference.Length - 12), BitConverter.SingleToInt32Bits(CameraRotation.w));
reference = ref destination;
BinaryPrimitives.TryWriteUInt32LittleEndian(reference.Slice(16, reference.Length - 16), TargetNetId);
reference = ref destination;
BitConverter.TryWriteBytes(reference.Slice(20, reference.Length - 20), VanillaMode);
reference = ref destination;
BitConverter.TryWriteBytes(reference.Slice(21, reference.Length - 21), OwlMode);
destination[22] = (byte)LookSpeed;
destination[23] = (byte)OverrideDirection;
return array;
}
public override void Deserialize(byte[] data)
{
if (data.Length < 32)
{
IsValid = false;
return;
}
Span<byte> span = data.AsSpan();
CameraRotation.x = BitConverter.Int32BitsToSingle(BinaryPrimitives.ReadInt32LittleEndian(span));
ref Quaternion cameraRotation = ref CameraRotation;
ref Span<byte> reference = ref span;
cameraRotation.y = BitConverter.Int32BitsToSingle(BinaryPrimitives.ReadInt32LittleEndian(reference.Slice(4, reference.Length - 4)));
ref Quaternion cameraRotation2 = ref CameraRotation;
reference = ref span;
cameraRotation2.z = BitConverter.Int32BitsToSingle(BinaryPrimitives.ReadInt32LittleEndian(reference.Slice(8, reference.Length - 8)));
ref Quaternion cameraRotation3 = ref CameraRotation;
reference = ref span;
cameraRotation3.w = BitConverter.Int32BitsToSingle(BinaryPrimitives.ReadInt32LittleEndian(reference.Slice(12, reference.Length - 12)));
reference = ref span;
TargetNetId = BinaryPrimitives.ReadUInt32LittleEndian(reference.Slice(16, reference.Length - 16));
reference = ref span;
VanillaMode = BitConverter.ToBoolean(reference.Slice(20, reference.Length - 20));
reference = ref span;
OwlMode = BitConverter.ToBoolean(reference.Slice(21, reference.Length - 21));
LookSpeed = (LookSpeed)span[22];
OverrideDirection = (LookDirection)span[23];
}
}
public enum LookSpeed : byte
{
Sloth = 1,
VerySlow = 2,
Slow = 3,
Normal = 0,
Fast = 4,
VeryFast = 5,
Caffeinated = 6
}
public static class LookSpeedExtensions
{
public static float MapToMultiplier(this LookSpeed speed)
{
if (1 == 0)
{
}
float result = speed switch
{
LookSpeed.Sloth => 0.5f,
LookSpeed.VerySlow => 1.5f,
LookSpeed.Slow => 2.5f,
LookSpeed.Normal => 3.5f,
LookSpeed.Fast => 5.5f,
LookSpeed.VeryFast => 7.5f,
LookSpeed.Caffeinated => 18f,
_ => 3.5f,
};
if (1 == 0)
{
}
return result;
}
}
public enum BackwardLookMode
{
FaceBehindRight,
FaceBehindLeft,
FaceCamera,
FaceFront,
NoEffect
}
[BepInPlugin("Marioalexsan.Observe", "Observe", "1.3.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class ObservePlugin : BaseUnityPlugin
{
private struct PlayerLookInfo
{
public Quaternion DesiredLookDirection;
public PlayerRaceModel RaceModel;
public Transform Head;
public Quaternion LastHeadRotation;
public bool OwlMode;
public LookSpeed LookSpeed;
public LookDirection OverrideDirection;
public bool VanillaMode;
}
private struct SentPlayerInfo
{
public Quaternion DesiredLookDirection;
public bool VanillaMode;
public bool OwlMode;
public LookSpeed LookSpeed;
public DateTime Timestamp;
public LookDirection OverrideDirection;
}
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static UnityAction <>9__32_0;
public static Predicate<Player> <>9__35_0;
internal void <RegisterEasySettings>b__32_0()
{
SettingsTab orAddCustomTab = Settings.GetOrAddCustomTab("Observe");
orAddCustomTab.AddHeader("General");
orAddCustomTab.AddToggle("Enabled", Enabled);
orAddCustomTab.AddToggle("Ignore Camera (self)", VanillaModeSetting);
orAddCustomTab.AddToggle("Enable Networking", EnableNetworking);
orAddCustomTab.AddToggle("Owl Mode (full rotations)", OwlModeSetting);
orAddCustomTab.AddToggle("Allow Owl Mode for others", AllowOwlModeForOthers);
orAddCustomTab.AddDropdown<LookSpeed>("Look speed", LookSpeedSetting);
orAddCustomTab.AddToggle("Hold head direction after strafing", HoldHeadDirectionAfterStrafing);
orAddCustomTab.AddAdvancedSlider("Strafe hold duration", HoldHeadDirectionAfterStrafingDuration, true);
orAddCustomTab.AddDropdown<BackwardLookMode>("Backward look mode", BackwardLookModeSetting);
orAddCustomTab.AddHeader("Fun stuff");
orAddCustomTab.AddToggle("Look at highlighted items", LookAtInteractables);
orAddCustomTab.AddToggle("Look at highlighted NPCs", LookAtNPCDuringDialogue);
}
internal bool <HandlePlayerCleanup>b__35_0(Player player)
{
return !Object.op_Implicit((Object)(object)player);
}
}
private readonly Harmony _harmony = new Harmony("Marioalexsan.Observe");
private readonly Dictionary<Player, PlayerLookInfo> _cachedPlayerData = new Dictionary<Player, PlayerLookInfo>();
private readonly Dictionary<ulong, SentPlayerInfo> MultiplayerData = new Dictionary<ulong, SentPlayerInfo>();
internal static ConfigEntry<bool> Enabled = null;
internal static ConfigEntry<bool> VanillaModeSetting = null;
internal static ConfigEntry<bool> EnableNetworking = null;
internal static ConfigEntry<bool> OwlModeSetting = null;
internal static ConfigEntry<bool> AllowOwlModeForOthers = null;
internal static ConfigEntry<LookSpeed> LookSpeedSetting = null;
internal static ConfigEntry<bool> HoldHeadDirectionAfterStrafing = null;
internal static ConfigEntry<float> HoldHeadDirectionAfterStrafingDuration = null;
internal static ConfigEntry<BackwardLookMode> BackwardLookModeSetting = null;
internal static ConfigEntry<bool> LookAtInteractables = null;
internal static ConfigEntry<bool> LookAtNPCDuringDialogue = null;
private bool _lastSendEnableState = false;
private bool _shouldSendCurrentState = false;
private static TimeSpan RefreshDirectionAccumulator = TimeSpan.Zero;
private static TimeSpan PacketSendCooldown = TimeSpan.Zero;
internal static LookDirection LocalOverrideDirection = LookDirection.Default;
internal static TimeSpan LocalOverrideDirectionTime = TimeSpan.Zero;
internal static Quaternion SavedOverride = Quaternion.identity;
internal static Quaternion SavedTilt = Quaternion.identity;
internal static ManualLogSource Logger = null;
internal static HashSet<Player> Players { get; } = new HashSet<Player>();
public ObservePlugin()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable or disable mod functionality completely.");
VanillaModeSetting = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "VanillaMode", false, "While active, makes your character's head act the same as in vanilla.");
EnableNetworking = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableNetworking", true, "Enable sending/receiving camera directions to/from people with the mod installed.");
OwlModeSetting = ((BaseUnityPlugin)this).Config.Bind<bool>("Display", "OwlMode", false, "Enables full range of rotation for your player's head. This might look pretty weird in some cases!");
AllowOwlModeForOthers = ((BaseUnityPlugin)this).Config.Bind<bool>("Display", "AllowOwlModeForOthers", true, "Allow other players that use OwlMode to display their unconstrained head rotations.");
LookSpeedSetting = ((BaseUnityPlugin)this).Config.Bind<LookSpeed>("Display", "LookSpeed", LookSpeed.Normal, "The speed at which your character reacts to changes in direction.");
HoldHeadDirectionAfterStrafing = ((BaseUnityPlugin)this).Config.Bind<bool>("Controls", "HoldHeadDirectionAfterStrafing", true, "Enable to keep looking at the given direction after strafing as if you used \"/observe environment\".");
HoldHeadDirectionAfterStrafingDuration = ((BaseUnityPlugin)this).Config.Bind<float>("Controls", "HoldHeadDirectionAfterStrafingDuration", 4f, new ConfigDescription("How long to continue looking at the environment when HoldHeadDirectionAfterStrafing is enabled, in seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 120f), Array.Empty<object>()));
BackwardLookModeSetting = ((BaseUnityPlugin)this).Config.Bind<BackwardLookMode>("Display", "BackwardLookMode", BackwardLookMode.FaceBehindRight, "Configure how the character behaves in Default mode when looking at frontal angles.");
LookAtInteractables = ((BaseUnityPlugin)this).Config.Bind<bool>("FunStuff", "LookAtInteractables", true, "Have your character look at interactable objects if not already posing.");
LookAtNPCDuringDialogue = ((BaseUnityPlugin)this).Config.Bind<bool>("FunStuff", "LookAtNPCDuringDialogue", true, "Have your character look at NPCs during dialogue if not already posing.");
}
private void Awake()
{
_harmony.PatchAll();
if (Chainloader.PluginInfos.ContainsKey("EasySettings"))
{
RegisterEasySettings();
}
if (Chainloader.PluginInfos.ContainsKey("CodeTalker"))
{
RegisterCodeYapperListener();
}
if (Chainloader.PluginInfos.ContainsKey("Soggy_Pancake.CommandLib"))
{
RegisterCommandLibCommands();
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
private void RegisterCodeYapperListener()
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
try
{
CodeTalkerNetwork.RegisterBinaryListener<LookPacket>(new BinaryPacketListener(HandleNetworkSyncFromOthers));
}
catch (Exception arg)
{
Logger.LogWarning((object)"Failed to register network listener for CodeYapper! Please report this to the mod author!");
Logger.LogWarning((object)$"Exception: {arg}");
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
private void RegisterCommandLibCommands()
{
try
{
Commands.RegisterCommands();
}
catch (Exception arg)
{
Logger.LogWarning((object)"Failed to register commands for CommandLib! Please report this to the mod author!");
Logger.LogWarning((object)$"Exception: {arg}");
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
private void RegisterEasySettings()
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Expected O, but got Unknown
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Expected O, but got Unknown
try
{
UnityEvent onInitialized = Settings.OnInitialized;
object obj = <>c.<>9__32_0;
if (obj == null)
{
UnityAction val = delegate
{
SettingsTab orAddCustomTab = Settings.GetOrAddCustomTab("Observe");
orAddCustomTab.AddHeader("General");
orAddCustomTab.AddToggle("Enabled", Enabled);
orAddCustomTab.AddToggle("Ignore Camera (self)", VanillaModeSetting);
orAddCustomTab.AddToggle("Enable Networking", EnableNetworking);
orAddCustomTab.AddToggle("Owl Mode (full rotations)", OwlModeSetting);
orAddCustomTab.AddToggle("Allow Owl Mode for others", AllowOwlModeForOthers);
orAddCustomTab.AddDropdown<LookSpeed>("Look speed", LookSpeedSetting);
orAddCustomTab.AddToggle("Hold head direction after strafing", HoldHeadDirectionAfterStrafing);
orAddCustomTab.AddAdvancedSlider("Strafe hold duration", HoldHeadDirectionAfterStrafingDuration, true);
orAddCustomTab.AddDropdown<BackwardLookMode>("Backward look mode", BackwardLookModeSetting);
orAddCustomTab.AddHeader("Fun stuff");
orAddCustomTab.AddToggle("Look at highlighted items", LookAtInteractables);
orAddCustomTab.AddToggle("Look at highlighted NPCs", LookAtNPCDuringDialogue);
};
<>c.<>9__32_0 = val;
obj = (object)val;
}
onInitialized.AddListener((UnityAction)obj);
Settings.OnApplySettings.AddListener((UnityAction)delegate
{
((BaseUnityPlugin)this).Config.Save();
});
}
catch (Exception arg)
{
Logger.LogWarning((object)"Failed to register settings for EasySettings! Please report this to the mod author!");
Logger.LogWarning((object)$"Exception: {arg}");
}
}
private void HandleNetworkSyncFromOthers(PacketHeader header, BinaryPacketBase packet)
{
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
if (!EnableNetworking.Value || !(packet is LookPacket lookPacket) || !lookPacket.IsValid)
{
return;
}
bool flag = false;
foreach (Player player in Players)
{
if (!Object.op_Implicit((Object)(object)player) || ((NetworkBehaviour)player).netId != lookPacket.TargetNetId || !(player._steamID == header.SenderID.ToString()))
{
continue;
}
flag = true;
break;
}
if (flag)
{
MultiplayerData[lookPacket.TargetNetId] = new SentPlayerInfo
{
Timestamp = DateTime.UtcNow,
DesiredLookDirection = lookPacket.CameraRotation,
VanillaMode = lookPacket.VanillaMode,
OwlMode = lookPacket.OwlMode,
OverrideDirection = lookPacket.OverrideDirection,
LookSpeed = lookPacket.LookSpeed
};
}
}
private void LateUpdate()
{
LocalOverrideDirectionTime -= TimeSpan.FromSeconds(Time.deltaTime);
if (LocalOverrideDirectionTime < TimeSpan.Zero)
{
LocalOverrideDirectionTime = TimeSpan.Zero;
LocalOverrideDirection = LookDirection.Default;
}
HandlePlayerCleanup();
HandleLocalPlayerAndNetworkSyncToOthers();
HandleOtherPlayers();
}
private void HandlePlayerCleanup()
{
foreach (Player player in Players)
{
if (!Object.op_Implicit((Object)(object)player))
{
MultiplayerData.Remove(((NetworkBehaviour)player).netId);
_cachedPlayerData.Remove(player);
}
}
Players.RemoveWhere((Player player) => !Object.op_Implicit((Object)(object)player));
}
private void HandleLocalPlayerAndNetworkSyncToOthers()
{
//IL_008b: 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_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: 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_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)Player._mainPlayer) && _cachedPlayerData.TryGetValue(Player._mainPlayer, out var value))
{
if (_lastSendEnableState || EnableNetworking.Value)
{
bool flag = value.VanillaMode != VanillaModeSetting.Value;
if (VanillaModeSetting.Value)
{
RefreshDirectionAccumulator -= TimeSpan.FromSeconds(Time.deltaTime);
}
else
{
float num = Quaternion.Angle(value.DesiredLookDirection, ((Component)CameraFunction._current).transform.rotation);
RefreshDirectionAccumulator -= TimeSpan.FromSeconds((double)Time.deltaTime + (double)num * 3.0 / 30.0);
}
if (flag || RefreshDirectionAccumulator <= TimeSpan.Zero)
{
RefreshDirectionAccumulator = TimeSpan.FromSeconds(3.0);
_shouldSendCurrentState = true;
}
}
else
{
RefreshDirectionAccumulator = TimeSpan.Zero;
}
if (Player._mainPlayer._pMove._strafeToggle && HoldHeadDirectionAfterStrafing.Value)
{
LocalOverrideDirectionTime = TimeSpan.FromSeconds(HoldHeadDirectionAfterStrafingDuration.Value);
LocalOverrideDirection = LookDirection.Environment;
SavedOverride = ((Component)CameraFunction._current).transform.rotation;
}
value.DesiredLookDirection = GetMainPlayerTargetRotation(value.Head);
value.VanillaMode = VanillaModeSetting.Value;
value.OwlMode = OwlModeSetting.Value;
value.LookSpeed = LookSpeedSetting.Value;
value.OverrideDirection = LocalOverrideDirection;
_cachedPlayerData[Player._mainPlayer] = value;
}
_lastSendEnableState = EnableNetworking.Value;
PacketSendCooldown -= TimeSpan.FromSeconds(Time.deltaTime);
if (PacketSendCooldown < TimeSpan.Zero)
{
PacketSendCooldown = TimeSpan.Zero;
}
if (!_shouldSendCurrentState || !(PacketSendCooldown <= TimeSpan.Zero))
{
return;
}
_shouldSendCurrentState = false;
PacketSendCooldown = TimeSpan.FromMilliseconds(250.0);
if (!Object.op_Implicit((Object)(object)Player._mainPlayer) || !_cachedPlayerData.TryGetValue(Player._mainPlayer, out var value2))
{
return;
}
LookPacket.Instance.CameraRotation = (VanillaModeSetting.Value ? Quaternion.identity : GetMainPlayerTargetRotation(value2.Head));
LookPacket.Instance.TargetNetId = ((NetworkBehaviour)Player._mainPlayer).netId;
LookPacket.Instance.VanillaMode = VanillaModeSetting.Value;
LookPacket.Instance.OwlMode = OwlModeSetting.Value;
LookPacket.Instance.LookSpeed = LookSpeedSetting.Value;
LookPacket.Instance.OverrideDirection = LocalOverrideDirection;
foreach (Player player in Players)
{
if ((Object)(object)player != (Object)(object)Player._mainPlayer && ulong.TryParse(player.Network_steamID, out var _))
{
CodeTalkerNetwork.SendNetworkPacket(player, (BinaryPacketBase)(object)LookPacket.Instance, (CompressionType)0, CompressionLevel.Fastest);
}
}
}
private void HandleOtherPlayers()
{
//IL_0096: 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)
foreach (Player player in Players)
{
if (_cachedPlayerData.TryGetValue(player, out var value) && MultiplayerData.TryGetValue(((NetworkBehaviour)player).netId, out var value2))
{
if (value2.Timestamp + TimeSpan.FromSeconds(6.0) < DateTime.UtcNow)
{
value2.VanillaMode = true;
MultiplayerData[((NetworkBehaviour)player).netId] = value2;
}
value.DesiredLookDirection = value2.DesiredLookDirection;
value.VanillaMode = value2.VanillaMode;
value.OwlMode = AllowOwlModeForOthers.Value && value2.OwlMode;
value.LookSpeed = value2.LookSpeed;
value.OverrideDirection = value2.OverrideDirection;
_cachedPlayerData[player] = value;
}
ProcessPlayerHeadRotation(player);
}
}
private void ProcessPlayerHeadRotation(Player player)
{
//IL_0171: 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_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: 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)
//IL_0140: 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_00cc: 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)
//IL_01bb: 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_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: 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_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: 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_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: 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_026c: Unknown result type (might be due to invalid IL or missing references)
//IL_0274: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_027d: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Unknown result type (might be due to invalid IL or missing references)
//IL_028c: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: 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_02c8: Invalid comparison between Unknown and I4
//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
//IL_02e4: Unknown result type (might be due to invalid IL or missing references)
//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0307: Unknown result type (might be due to invalid IL or missing references)
//IL_0309: Unknown result type (might be due to invalid IL or missing references)
//IL_0312: 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_032b: Unknown result type (might be due to invalid IL or missing references)
//IL_032e: Unknown result type (might be due to invalid IL or missing references)
if (!Enabled.Value || !Object.op_Implicit((Object)(object)player) || (!((Object)(object)player == (Object)(object)Player._mainPlayer) && !MultiplayerData.ContainsKey(((NetworkBehaviour)player).netId)))
{
return;
}
if (!_cachedPlayerData.TryGetValue(player, out var value))
{
PlayerRaceModel componentInChildren = ((Component)player).GetComponentInChildren<PlayerRaceModel>();
if ((Object)(object)componentInChildren != (Object)null)
{
Transform headBone = GetHeadBone(componentInChildren);
if ((Object)(object)headBone != (Object)null)
{
value = (_cachedPlayerData[player] = new PlayerLookInfo
{
DesiredLookDirection = ((Component)player).transform.rotation,
RaceModel = componentInChildren,
Head = headBone,
LastHeadRotation = Quaternion.identity,
VanillaMode = false,
OwlMode = false,
OverrideDirection = LookDirection.Default,
LookSpeed = LookSpeed.Normal
});
}
}
}
if ((Object)(object)value.Head == (Object)null)
{
return;
}
if (value.VanillaMode)
{
value.LastHeadRotation = Quaternion.identity;
value.DesiredLookDirection = ((Component)player).transform.rotation;
_cachedPlayerData[player] = value;
return;
}
Transform transform = ((Component)player).transform;
bool isLeftHanded = player._pVisual._playerAppearanceStruct._isLeftHanded;
Quaternion desiredLookDirection = value.DesiredLookDirection;
float num = Quaternion.Angle(transform.rotation, desiredLookDirection);
bool flag = num >= 160f;
Quaternion val = ((value.OverrideDirection == LookDirection.Default && flag && !value.OwlMode) ? GetDefaultModeBackwardLookDirection(value, player) : desiredLookDirection);
Quaternion val2 = (value.OwlMode ? val : Quaternion.RotateTowards(value.Head.parent.rotation, val, 70f));
Quaternion val3 = Quaternion.Slerp(value.LastHeadRotation, val2, Time.deltaTime * value.LookSpeed.MapToMultiplier());
if (!value.OwlMode)
{
val3 = Quaternion.RotateTowards(value.Head.parent.rotation, val3, 70f);
}
value.Head.rotation = val3;
value.LastHeadRotation = value.Head.rotation;
if (isLeftHanded)
{
Quaternion rotation = value.Head.rotation;
Quaternion rotation2 = value.Head.rotation;
((Quaternion)(ref rotation2)).Set(rotation.x, 0f - rotation.y, 0f - rotation.z, rotation.w);
}
if (!value.OwlMode && !flag && (int)value.RaceModel._currentEyeCondition == 0)
{
Vector3 val4 = val * Vector3.forward;
Vector3 val5 = val4 - Vector3.Project(val4, transform.up);
float num2 = Vector3.Angle(val5, transform.forward);
float num3 = Vector3.Angle(val4, val5);
bool flag2 = Vector3.Angle(val4, transform.right) <= 90f;
bool flag3 = Vector3.Angle(val4, transform.up) <= 90f;
bool flag4 = num2 >= num3 * 0.85f;
if (flag4 && num2 >= 105f)
{
value.RaceModel.Set_EyeCondition((EyeCondition)((flag2 == isLeftHanded) ? 4 : 3), 0.15f);
}
else if (!flag4 && num3 >= 55f)
{
value.RaceModel.Set_EyeCondition((EyeCondition)(flag3 ? 1 : 2), 0.15f);
}
}
_cachedPlayerData[player] = value;
}
private static Quaternion GetMainPlayerTargetRotation(Transform headTransform)
{
//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_000c: 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_0014: Unknown result type (might be due to invalid IL or missing references)
return GetMainPlayerTargetDirection(headTransform) * SavedTilt;
}
private static Quaternion GetMainPlayerTargetDirection(Transform headTransform)
{
//IL_008e: 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_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: 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_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: 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_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: 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_01ac: 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_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_01c3: 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_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: 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)
Player mainPlayer = Player._mainPlayer;
bool flag = CameraChecks.IsUsingFreecam() || (Object.op_Implicit((Object)(object)DialogManager._current) && DialogManager._current._isDialogEnabled);
switch (LocalOverrideDirection)
{
case LookDirection.Camera:
if (flag)
{
return headTransform.rotation;
}
return Quaternion.LookRotation(-((Component)CameraFunction._current).transform.forward, ((Component)mainPlayer).transform.up);
case LookDirection.Pose:
return headTransform.parent.rotation * SavedOverride;
case LookDirection.Environment:
return SavedOverride;
default:
{
if (LookAtNPCDuringDialogue.Value && DialogManager._current._isDialogEnabled && Object.op_Implicit((Object)(object)DialogManager._current._cachedNpc))
{
Vector3 position = ((Component)DialogManager._current._cachedNpc).transform.position;
Vector3 position2 = headTransform.position;
Transform headBone = GetHeadBone(DialogManager._current._cachedNpc);
if ((Object)(object)headBone != (Object)null)
{
position = headBone.position;
}
return Quaternion.LookRotation(position - position2, ((Component)mainPlayer).transform.up);
}
PlayerInteract val = default(PlayerInteract);
if (LookAtInteractables.Value && ((Component)mainPlayer).TryGetComponent<PlayerInteract>(ref val) && Object.op_Implicit((Object)(object)val._interactReticleObject) && ((Component)val._interactReticleObject).gameObject.activeSelf)
{
Vector3 position3 = val._interactReticleObject.position;
Vector3 position4 = headTransform.position;
return Quaternion.LookRotation(position3 - position4, ((Component)mainPlayer).transform.up);
}
if (flag)
{
return headTransform.rotation;
}
return ((Component)CameraFunction._current).transform.rotation;
}
}
}
private static Quaternion GetDefaultModeBackwardLookDirection(PlayerLookInfo data, Player player)
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: 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_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_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: 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_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: 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_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)
if (BackwardLookModeSetting.Value == BackwardLookMode.FaceCamera)
{
return Quaternion.LookRotation(-(data.DesiredLookDirection * Vector3.forward), ((Component)player).transform.up);
}
if (BackwardLookModeSetting.Value == BackwardLookMode.NoEffect)
{
return data.DesiredLookDirection;
}
if (BackwardLookModeSetting.Value == BackwardLookMode.FaceBehindRight)
{
return ((Component)player).transform.rotation * Quaternion.Euler(0f, 160f, 0f) * SavedTilt;
}
if (BackwardLookModeSetting.Value == BackwardLookMode.FaceBehindLeft)
{
return ((Component)player).transform.rotation * Quaternion.Euler(0f, -160f, 0f) * SavedTilt;
}
return ((Component)player).transform.rotation * SavedTilt;
}
internal static Transform? GetHeadBone(PlayerRaceModel raceModel)
{
Transform armatureTransform = raceModel._armatureTransform;
return (armatureTransform != null) ? armatureTransform.Find("Armature_character/masterBone/hipCtrl/hip/lowBody/midBody/torso/neck/head") : null;
}
internal static Transform? GetHeadBone(NetNPC npc)
{
SkinnedMeshRenderer componentInChildren = ((Component)npc).GetComponentInChildren<SkinnedMeshRenderer>();
if (!Object.op_Implicit((Object)(object)componentInChildren))
{
return null;
}
return componentInChildren.rootBone.Find("hipCtrl/hip/lowBody/midBody/torso/neck/head");
}
}
internal static class ModInfo
{
public const string GUID = "Marioalexsan.Observe";
public const string NAME = "Observe";
public const string VERSION = "1.3.0";
}
}
namespace Marioalexsan.Observe.HarmonyPatches
{
[HarmonyPatch(typeof(Player), "Update")]
internal static class Trackplayers
{
private static void Postfix(Player __instance)
{
ObservePlugin.Players.Add(__instance);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}