Decompiled source of Tripod v0.6.1

BepInEx/plugins/Tripod/CWMod.dll

Decompiled 9 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using Steamworks;
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: AssemblyCompany("CWMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CWMod")]
[assembly: AssemblyTitle("CWMod")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
[BepInPlugin("com.example.cwmod", "CWMod", "0.6.1")]
public class Plugin : BaseUnityPlugin, IOnEventCallback
{
	internal static ManualLogSource Log;

	private static ConfigEntry<KeyCode> spawnKey;

	private static ConfigEntry<KeyCode> mountKey;

	private static ConfigEntry<KeyCode> deleteKey;

	private static ConfigEntry<KeyCode> recordKey;

	private static ConfigEntry<KeyCode> heightUpKey;

	private static ConfigEntry<KeyCode> heightDownKey;

	private static ConfigEntry<KeyCode> tiltUpKey;

	private static ConfigEntry<KeyCode> tiltDownKey;

	private static ConfigEntry<KeyCode> settingsKey;

	private static ConfigEntry<KeyCode>[] keyEntries;

	private static CWText[] keyLabels;

	private static ConfigEntry<float> mountHeight;

	private static ConfigEntry<float> mountYawOffset;

	private static ConfigEntry<float> heightStep;

	private static ConfigEntry<float> tiltStep;

	private static ConfigEntry<string> languageCfg;

	private static readonly Dictionary<string, CWStand> stands = new Dictionary<string, CWStand>();

	private static readonly Dictionary<string, Material> mats = new Dictionary<string, Material>();

	private static readonly List<PendingMount> pending = new List<PendingMount>();

	private const byte SpawnCode = 190;

	private const byte DeleteCode = 191;

	private const byte MountCode = 192;

	private const byte AdjustCode = 193;

	private const byte RequestCode = 194;

	private const byte SyncCode = 195;

	private const float DefaultHeight = 1.25f;

	private const float MinHeight = 0.5f;

	private const float MaxHeight = 2f;

	private const float MaxTilt = 60f;

	private const float UseRange = 3f;

	private const float OnStandRange = 1f;

	private const float MountSearchRange = 2f;

	private static string message = "";

	private static float messageUntil;

	private static float nextRepeat;

	private static float nextPendingCheck;

	private static bool syncRequested;

	private static bool menuOpen;

	private static int menuIndex;

	private static bool rebinding;

	private static Texture2D whiteTex;

	private static Texture2D dotTex;

	private static Font monoFont;

	private static bool monoTried;

	internal static bool MenuOpen => menuOpen;

	internal static string LanguageSetting => (languageCfg != null) ? languageCfg.Value : "auto";

	private void Awake()
	{
		//IL_0268: Unknown result type (might be due to invalid IL or missing references)
		//IL_026e: Expected O, but got Unknown
		//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02dd: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		spawnKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "SpawnStandKey", (KeyCode)122, "Baktigin yere tripod koyar");
		mountKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "MountCameraKey", (KeyCode)120, "Yakindaki kamerayi tripoda oturtur / yonunu ayarlar");
		deleteKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "DeleteStandKey", (KeyCode)127, "Yakindaki tripodu siler");
		recordKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "ToggleRecordKey", (KeyCode)114, "Tripoddaki kamerayi baslatir/durdurur");
		heightUpKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "HeightUpKey", (KeyCode)280, "Tripod boyunu arttirir");
		heightDownKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "HeightDownKey", (KeyCode)281, "Tripod boyunu azaltir");
		tiltUpKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "TiltUpKey", (KeyCode)278, "Kamerayi yukari egar");
		tiltDownKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "TiltDownKey", (KeyCode)279, "Kamerayi asagi egar");
		settingsKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Keys", "SettingsMenuKey", (KeyCode)277, "Tus ayar menusunu acar");
		mountHeight = ((BaseUnityPlugin)this).Config.Bind<float>("Mount", "MountHeightOffset", 0.12f, "Kameranin tripod basindan yuksekligi");
		mountYawOffset = ((BaseUnityPlugin)this).Config.Bind<float>("Mount", "MountYawOffset", 0f, "Kamera arkaya bakiyorsa 180 yap");
		heightStep = ((BaseUnityPlugin)this).Config.Bind<float>("Adjust", "HeightStep", 0.05f, "Boy ayar adimi (metre)");
		tiltStep = ((BaseUnityPlugin)this).Config.Bind<float>("Adjust", "TiltStep", 5f, "Egim ayar adimi (derece)");
		languageCfg = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Language", "auto", "auto, en, tr, fr, it, de, es, ja, ko, pt, ru, zh");
		keyEntries = new ConfigEntry<KeyCode>[9] { spawnKey, mountKey, deleteKey, recordKey, heightUpKey, heightDownKey, tiltUpKey, tiltDownKey, settingsKey };
		keyLabels = new CWText[9]
		{
			CWText.ActSpawn,
			CWText.ActMount,
			CWText.ActDelete,
			CWText.ActRecord,
			CWText.ActHeightUp,
			CWText.ActHeightDown,
			CWText.ActTiltUp,
			CWText.ActTiltDown,
			CWText.ActMenu
		};
		Harmony val = new Harmony("com.example.cwmod");
		try
		{
			val.PatchAll();
		}
		catch (Exception ex)
		{
			Log.LogWarning((object)("[Patch] PatchAll hatasi: " + ex.Message));
		}
		try
		{
			MethodInfo methodInfo = AccessTools.Method(typeof(GlobalInputHandler), "CanTakeInput", (Type[])null, (Type[])null);
			if (methodInfo != null)
			{
				val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(Plugin), "BlockInputPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}
		catch (Exception ex2)
		{
			Log.LogWarning((object)("[Patch] Girdi engelleme uygulanamadi: " + ex2.Message));
		}
		PhotonNetwork.AddCallbackTarget((object)this);
		Log.LogInfo((object)"CWMod 0.6.1 yuklendi.");
	}

	internal static void BlockInputPostfix(ref bool __result)
	{
		if (menuOpen)
		{
			__result = false;
		}
	}

	private void OnDestroy()
	{
		PhotonNetwork.RemoveCallbackTarget((object)this);
	}

	private void Update()
	{
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: 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_00dd: 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_0113: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0168: Unknown result type (might be due to invalid IL or missing references)
		//IL_0192: Unknown result type (might be due to invalid IL or missing references)
		if (!PhotonNetwork.InRoom)
		{
			syncRequested = false;
			menuOpen = false;
		}
		else
		{
			if ((Object)(object)Player.localPlayer == (Object)null || (Object)(object)MainCamera.instance == (Object)null)
			{
				return;
			}
			RequestSyncIfNeeded();
			ProcessPending();
			if (menuOpen)
			{
				UpdateMenu();
			}
			else
			{
				if (!GlobalInputHandler.CanTakeInput())
				{
					return;
				}
				if (Input.GetKeyDown(settingsKey.Value))
				{
					menuOpen = true;
					menuIndex = 0;
					rebinding = false;
					return;
				}
				if (Input.GetKeyDown(spawnKey.Value))
				{
					TrySpawnStand();
				}
				if (Input.GetKeyDown(mountKey.Value))
				{
					TryMountCamera();
				}
				if (Input.GetKeyDown(deleteKey.Value))
				{
					TryDeleteStand();
				}
				if (Input.GetKeyDown(recordKey.Value))
				{
					ToggleRecording();
				}
				if (Repeat(heightUpKey.Value))
				{
					Adjust(heightStep.Value, 0f);
				}
				if (Repeat(heightDownKey.Value))
				{
					Adjust(0f - heightStep.Value, 0f);
				}
				if (Repeat(tiltUpKey.Value))
				{
					Adjust(0f, tiltStep.Value);
				}
				if (Repeat(tiltDownKey.Value))
				{
					Adjust(0f, 0f - tiltStep.Value);
				}
			}
		}
	}

	private static bool Repeat(KeyCode k)
	{
		//IL_0001: 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)
		if (Input.GetKeyDown(k))
		{
			nextRepeat = Time.unscaledTime + 0.35f;
			return true;
		}
		if (Input.GetKey(k) && Time.unscaledTime >= nextRepeat)
		{
			nextRepeat = Time.unscaledTime + 0.08f;
			return true;
		}
		return false;
	}

	private static void UpdateMenu()
	{
		//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: 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_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Invalid comparison between Unknown and I4
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0053: Invalid comparison between Unknown and I4
		//IL_0189: Unknown result type (might be due to invalid IL or missing references)
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Invalid comparison between Unknown and I4
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Invalid comparison between Unknown and I4
		//IL_0070: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Invalid comparison between Unknown and I4
		//IL_0086: 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)
		if (rebinding)
		{
			if (!Input.GetKeyDown((KeyCode)8))
			{
				foreach (KeyCode value in Enum.GetValues(typeof(KeyCode)))
				{
					if ((int)value != 0 && (int)value != 27 && (int)value != 8 && (int)value != 323 && (int)value != 324 && (int)value < 330 && Input.GetKeyDown(value))
					{
						TryAssign(menuIndex, value);
						rebinding = false;
						break;
					}
				}
				return;
			}
			rebinding = false;
		}
		else if (Input.GetKeyDown(settingsKey.Value))
		{
			menuOpen = false;
		}
		else
		{
			if (Input.GetKeyDown((KeyCode)273))
			{
				menuIndex = (menuIndex + keyEntries.Length - 1) % keyEntries.Length;
			}
			if (Input.GetKeyDown((KeyCode)274))
			{
				menuIndex = (menuIndex + 1) % keyEntries.Length;
			}
			if (Input.GetKeyDown((KeyCode)13) || Input.GetKeyDown((KeyCode)271))
			{
				rebinding = true;
			}
			if (Input.GetKeyDown((KeyCode)8))
			{
				keyEntries[menuIndex].Value = (KeyCode)((ConfigEntryBase)keyEntries[menuIndex]).DefaultValue;
			}
		}
	}

	private static void TryAssign(int index, KeyCode k)
	{
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		for (int i = 0; i < keyEntries.Length; i++)
		{
			if (i != index && keyEntries[i].Value == k)
			{
				Say(string.Format(CWLang.Get(CWText.KeyInUse), CWLang.Get(keyLabels[i])));
				return;
			}
		}
		keyEntries[index].Value = k;
	}

	private void OnGUI()
	{
		DrawMessage();
		if (menuOpen)
		{
			DrawMenu();
		}
	}

	private static void EnsureResources()
	{
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Expected O, but got Unknown
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_006d: Expected O, but got Unknown
		//IL_0087: 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)
		//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)whiteTex == (Object)null)
		{
			whiteTex = new Texture2D(1, 1, (TextureFormat)4, false);
			whiteTex.SetPixel(0, 0, Color.white);
			whiteTex.Apply();
			((Object)whiteTex).hideFlags = (HideFlags)61;
		}
		if ((Object)(object)dotTex == (Object)null)
		{
			dotTex = new Texture2D(32, 32, (TextureFormat)4, false);
			for (int i = 0; i < 32; i++)
			{
				for (int j = 0; j < 32; j++)
				{
					float num = Vector2.Distance(new Vector2((float)j + 0.5f, (float)i + 0.5f), new Vector2(16f, 16f));
					dotTex.SetPixel(j, i, new Color(1f, 1f, 1f, Mathf.Clamp01(16f - num)));
				}
			}
			dotTex.Apply();
			((Object)dotTex).hideFlags = (HideFlags)61;
		}
		if (!monoTried)
		{
			monoTried = true;
			try
			{
				monoFont = Font.CreateDynamicFontFromOSFont(new string[3] { "Consolas", "Courier New", "Lucida Console" }, 20);
			}
			catch
			{
				monoFont = null;
			}
		}
	}

	private static void Fill(Rect r, Color c)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		Color color = GUI.color;
		GUI.color = c;
		GUI.DrawTexture(r, (Texture)(object)whiteTex);
		GUI.color = color;
	}

	private static void Dot(Rect r, Color c)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		Color color = GUI.color;
		GUI.color = c;
		GUI.DrawTexture(r, (Texture)(object)dotTex);
		GUI.color = color;
	}

	private static void Corners(Rect r, float len, float th, Color c)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_004b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: 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)
		Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, len, th), c);
		Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, th, len), c);
		Fill(new Rect(((Rect)(ref r)).xMax - len, ((Rect)(ref r)).y, len, th), c);
		Fill(new Rect(((Rect)(ref r)).xMax - th, ((Rect)(ref r)).y, th, len), c);
		Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - th, len, th), c);
		Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - len, th, len), c);
		Fill(new Rect(((Rect)(ref r)).xMax - len, ((Rect)(ref r)).yMax - th, len, th), c);
		Fill(new Rect(((Rect)(ref r)).xMax - th, ((Rect)(ref r)).yMax - len, th, len), c);
	}

	private static GUIStyle TextStyle(int size, FontStyle fs, TextAnchor anchor, Color col, Font font)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: 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_0019: 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_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Expected O, but got Unknown
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		GUIStyle val = new GUIStyle(GUI.skin.label)
		{
			fontSize = size,
			fontStyle = fs,
			alignment = anchor,
			wordWrap = false
		};
		val.normal.textColor = col;
		if ((Object)(object)font != (Object)null)
		{
			val.font = font;
		}
		return val;
	}

	private static void DrawMessage()
	{
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Expected O, but got Unknown
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		if (!string.IsNullOrEmpty(message) && !(Time.unscaledTime > messageUntil))
		{
			EnsureResources();
			GUIStyle val = TextStyle(22, (FontStyle)1, (TextAnchor)3, Color.white, null);
			val.wordWrap = true;
			GUIContent val2 = new GUIContent(message);
			float num = Mathf.Min((float)Screen.width - 80f, 900f);
			float num2 = Mathf.Min(val.CalcSize(val2).x + 4f, num - 56f);
			float num3 = val.CalcHeight(val2, num2);
			Rect r = default(Rect);
			((Rect)(ref r))..ctor(((float)Screen.width - (num2 + 56f)) * 0.5f, (float)Screen.height * 0.16f, num2 + 56f, num3 + 20f);
			Fill(r, new Color(0.04f, 0.04f, 0.06f, 0.88f));
			Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, 5f, ((Rect)(ref r)).height), new Color(0.9f, 0.1f, 0.12f, 1f));
			GUI.Label(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + 10f, num2, num3), message, val);
		}
	}

	private static void DrawMenu()
	{
		//IL_008f: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_0152: 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_0191: Unknown result type (might be due to invalid IL or missing references)
		//IL_019d: Unknown result type (might be due to invalid IL or missing references)
		//IL_020c: Unknown result type (might be due to invalid IL or missing references)
		//IL_021a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0246: 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_02ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0300: Unknown result type (might be due to invalid IL or missing references)
		//IL_0319: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: 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_05a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
		//IL_037a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0390: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_05fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_05fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_040e: Unknown result type (might be due to invalid IL or missing references)
		//IL_040b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0638: Unknown result type (might be due to invalid IL or missing references)
		//IL_066b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0679: Unknown result type (might be due to invalid IL or missing references)
		//IL_0435: Unknown result type (might be due to invalid IL or missing references)
		//IL_043a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0472: Unknown result type (might be due to invalid IL or missing references)
		//IL_046f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0488: Unknown result type (might be due to invalid IL or missing references)
		//IL_0492: Expected O, but got Unknown
		//IL_048d: Unknown result type (might be due to invalid IL or missing references)
		//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0522: Unknown result type (might be due to invalid IL or missing references)
		//IL_053b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0546: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e1: Unknown result type (might be due to invalid IL or missing references)
		EnsureResources();
		float unscaledTime = Time.unscaledTime;
		Color val = default(Color);
		((Color)(ref val))..ctor(0.9f, 0.1f, 0.12f, 1f);
		Color val2 = default(Color);
		((Color)(ref val2))..ctor(0.95f, 0.95f, 0.95f, 1f);
		Color val3 = default(Color);
		((Color)(ref val3))..ctor(0.62f, 0.64f, 0.68f, 1f);
		Color val4 = default(Color);
		((Color)(ref val4))..ctor(1f, 0.85f, 0.3f, 1f);
		Fill(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), new Color(0f, 0f, 0f, 0.55f));
		float num = 720f;
		float num2 = 38f;
		float num3 = 64f;
		float num4 = 74f;
		float num5 = num3 + (float)keyEntries.Length * num2 + num4 + 12f;
		Rect r = default(Rect);
		((Rect)(ref r))..ctor(((float)Screen.width - num) * 0.5f, ((float)Screen.height - num5) * 0.5f, num, num5);
		Fill(r, new Color(0.04f, 0.04f, 0.06f, 0.95f));
		for (float num6 = ((Rect)(ref r)).y; num6 < ((Rect)(ref r)).yMax; num6 += 4f)
		{
			Fill(new Rect(((Rect)(ref r)).x, num6, ((Rect)(ref r)).width, 1f), new Color(0f, 0f, 0f, 0.2f));
		}
		Corners(r, 30f, 3f, val2);
		if (unscaledTime % 1.2f < 0.7f)
		{
			Dot(new Rect(((Rect)(ref r)).x + 26f, ((Rect)(ref r)).y + 24f, 16f, 16f), val);
		}
		GUI.Label(new Rect(((Rect)(ref r)).x + 50f, ((Rect)(ref r)).y + 16f, 90f, 32f), "REC", TextStyle(22, (FontStyle)1, (TextAnchor)3, val, monoFont));
		GUI.Label(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 14f, num, 36f), CWLang.Get(CWText.MenuTitle), TextStyle(26, (FontStyle)1, (TextAnchor)4, val2, null));
		int num7 = (int)unscaledTime;
		string text = $"{num7 / 3600:00}:{num7 / 60 % 60:00}:{num7 % 60:00}";
		GUI.Label(new Rect(((Rect)(ref r)).xMax - 200f, ((Rect)(ref r)).y + 16f, 176f, 32f), text, TextStyle(18, (FontStyle)0, (TextAnchor)5, val3, monoFont));
		Fill(new Rect(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).y + num3 - 6f, num - 48f, 2f), new Color(1f, 1f, 1f, 0.25f));
		Rect r2 = default(Rect);
		Rect val6 = default(Rect);
		for (int i = 0; i < keyEntries.Length; i++)
		{
			float num8 = ((Rect)(ref r)).y + num3 + (float)i * num2;
			bool flag = i == menuIndex;
			((Rect)(ref r2))..ctor(((Rect)(ref r)).x + 24f, num8, num - 48f, num2 - 4f);
			if (flag)
			{
				Fill(r2, new Color(0.9f, 0.1f, 0.12f, 0.26f));
				Fill(new Rect(((Rect)(ref r2)).x, ((Rect)(ref r2)).y, 5f, ((Rect)(ref r2)).height), val);
			}
			GUI.Label(new Rect(((Rect)(ref r2)).x + 16f, ((Rect)(ref r2)).y, ((Rect)(ref r2)).width - 200f, ((Rect)(ref r2)).height), CWLang.Get(keyLabels[i]), TextStyle(20, (FontStyle)(flag ? 1 : 0), (TextAnchor)3, flag ? val2 : val3, null));
			bool flag2 = flag && rebinding;
			string text2 = (flag2 ? ((unscaledTime % 0.8f < 0.5f) ? "..." : "") : ((object)keyEntries[i].Value/*cast due to .constrained prefix*/).ToString());
			GUIStyle val5 = TextStyle(18, (FontStyle)1, (TextAnchor)4, flag2 ? val : val2, monoFont);
			float num9 = Mathf.Max(120f, val5.CalcSize(new GUIContent(text2)).x + 40f);
			((Rect)(ref val6))..ctor(((Rect)(ref r2)).xMax - num9 - 8f, ((Rect)(ref r2)).y + 3f, num9, ((Rect)(ref r2)).height - 6f);
			Fill(val6, flag2 ? val : (flag ? val2 : val3));
			Fill(new Rect(((Rect)(ref val6)).x + 2f, ((Rect)(ref val6)).y + 2f, ((Rect)(ref val6)).width - 4f, ((Rect)(ref val6)).height - 4f), new Color(0.1f, 0.1f, 0.12f, 1f));
			GUI.Label(val6, text2, val5);
		}
		Rect r3 = default(Rect);
		((Rect)(ref r3))..ctor(((Rect)(ref r)).x + 24f, ((Rect)(ref r)).yMax - num4 - 4f, num - 48f, num4 - 22f);
		Fill(r3, new Color(0f, 0f, 0f, 0.4f));
		string text3 = (rebinding ? CWLang.Get(CWText.PressKey) : string.Format(CWLang.Get(CWText.MenuHint), settingsKey.Value));
		GUIStyle val7 = TextStyle(16, (FontStyle)0, (TextAnchor)4, rebinding ? val4 : val3, null);
		val7.wordWrap = true;
		GUI.Label(new Rect(((Rect)(ref r3)).x + 10f, ((Rect)(ref r3)).y, ((Rect)(ref r3)).width - 20f, ((Rect)(ref r3)).height), text3, val7);
		GUI.Label(new Rect(((Rect)(ref r)).xMax - 220f, ((Rect)(ref r)).yMax - 24f, 200f, 18f), "TRIPOD v0.6.1", TextStyle(12, (FontStyle)0, (TextAnchor)5, val3, monoFont));
	}

	private static void Say(string m)
	{
		message = m;
		messageUntil = Time.unscaledTime + 3f;
	}

	private static void Raise(byte code, object content)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Expected O, but got Unknown
		PhotonNetwork.RaiseEvent(code, content, new RaiseEventOptions
		{
			Receivers = (ReceiverGroup)1
		}, SendOptions.SendReliable);
	}

	public unsafe void OnEvent(EventData e)
	{
		//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_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)
		//IL_0287: 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_02f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
		if (e.Code == 190)
		{
			object[] array = (object[])e.CustomData;
			CWStand cWStand = new CWStand();
			cWStand.id = (string)array[0];
			cWStand.pos = new Vector3((float)array[1], (float)array[2], (float)array[3]);
			cWStand.yaw = (float)array[4];
			cWStand.height = 1.25f;
			BuildGeometry(cWStand);
			stands[cWStand.id] = cWStand;
			ManualLogSource log = Log;
			Vector3 pos = cWStand.pos;
			log.LogInfo((object)("[Stand] Tripod olusturuldu: " + ((object)(*(Vector3*)(&pos))/*cast due to .constrained prefix*/).ToString()));
		}
		else if (e.Code == 191)
		{
			RemoveStand((string)e.CustomData);
		}
		else if (e.Code == 192)
		{
			object[] array2 = (object[])e.CustomData;
			string standId = (string)array2[0];
			string text = (string)array2[1];
			float yaw = (float)array2[2];
			if (!TryMountNow(standId, text, yaw))
			{
				PendingMount pendingMount = new PendingMount();
				pendingMount.standId = standId;
				pendingMount.guid = text;
				pendingMount.yaw = yaw;
				pendingMount.until = Time.unscaledTime + 10f;
				pending.Add(pendingMount);
			}
		}
		else if (e.Code == 193)
		{
			object[] array3 = (object[])e.CustomData;
			ApplyAdjust((string)array3[0], (float)array3[1], (float)array3[2]);
		}
		else if (e.Code == 194)
		{
			if (PhotonNetwork.IsMasterClient)
			{
				SendStandsTo(e.Sender);
			}
		}
		else if (e.Code == 195)
		{
			object[] array4 = (object[])e.CustomData;
			string text2 = (string)array4[0];
			if (!stands.TryGetValue(text2, out var value) || !((Object)(object)value.root != (Object)null))
			{
				CWStand cWStand2 = new CWStand();
				cWStand2.id = text2;
				cWStand2.pos = new Vector3((float)array4[1], (float)array4[2], (float)array4[3]);
				cWStand2.yaw = (float)array4[4];
				cWStand2.height = (float)array4[5];
				cWStand2.tilt = (float)array4[6];
				cWStand2.mountYaw = (float)array4[7];
				BuildGeometry(cWStand2);
				stands[text2] = cWStand2;
				ManualLogSource log2 = Log;
				Vector3 pos = cWStand2.pos;
				log2.LogInfo((object)("[Sync] Tripod alindi: " + ((object)(*(Vector3*)(&pos))/*cast due to .constrained prefix*/).ToString()));
			}
		}
	}

	private static void RequestSyncIfNeeded()
	{
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Expected O, but got Unknown
		if (!syncRequested && !PhotonNetwork.IsMasterClient)
		{
			syncRequested = true;
			PhotonNetwork.RaiseEvent((byte)194, (object)null, new RaiseEventOptions
			{
				Receivers = (ReceiverGroup)2
			}, SendOptions.SendReliable);
			Log.LogInfo((object)"[Sync] Host'tan tripodlar istendi.");
		}
	}

	private static void SendStandsTo(int actor)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Expected O, but got Unknown
		//IL_00e2: 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_0174: Unknown result type (might be due to invalid IL or missing references)
		RaiseEventOptions val = new RaiseEventOptions();
		val.TargetActors = new int[1] { actor };
		RaiseEventOptions val2 = val;
		foreach (KeyValuePair<string, CWStand> stand in stands)
		{
			CWStand value = stand.Value;
			if ((Object)(object)value.root == (Object)null)
			{
				continue;
			}
			PhotonNetwork.RaiseEvent((byte)195, (object)new object[8]
			{
				value.id,
				value.pos.x,
				value.pos.y,
				value.pos.z,
				value.yaw,
				value.height,
				value.tilt,
				value.mountYaw
			}, val2, SendOptions.SendReliable);
			VideoCamera val3 = FindMountedCameraNear(Head(value));
			if ((Object)(object)val3 != (Object)null)
			{
				ItemInstanceData val4 = DataOf(val3);
				if (val4 != null)
				{
					float num = (float.IsNaN(value.mountYaw) ? value.yaw : value.mountYaw);
					PhotonNetwork.RaiseEvent((byte)192, (object)new object[3]
					{
						value.id,
						val4.m_guid.ToString(),
						num
					}, val2, SendOptions.SendReliable);
				}
			}
		}
		Log.LogInfo((object)("[Sync] Tripodlar oyuncuya gonderildi: " + actor));
	}

	private static VideoCamera FindMountedCameraNear(Vector3 point)
	{
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		VideoCamera[] array = Object.FindObjectsByType<VideoCamera>((FindObjectsSortMode)0);
		foreach (VideoCamera val in array)
		{
			if (!((ItemInstanceBehaviour)val).isHeld && !((Object)(object)((Component)val).GetComponent<MountedCamera>() == (Object)null) && Vector3.Distance(((Component)val).transform.position, point) < 1f)
			{
				return val;
			}
		}
		return null;
	}

	private static void ProcessPending()
	{
		if (pending.Count == 0 || Time.unscaledTime < nextPendingCheck)
		{
			return;
		}
		nextPendingCheck = Time.unscaledTime + 0.5f;
		for (int num = pending.Count - 1; num >= 0; num--)
		{
			PendingMount pendingMount = pending[num];
			if (TryMountNow(pendingMount.standId, pendingMount.guid, pendingMount.yaw) || Time.unscaledTime > pendingMount.until)
			{
				pending.RemoveAt(num);
			}
		}
	}

	private static void TrySpawnStand()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_005f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: 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_009a: Unknown result type (might be due to invalid IL or missing references)
		Transform transform = ((Component)MainCamera.instance).transform;
		RaycastHit val = default(RaycastHit);
		if (!Physics.Raycast(transform.position, transform.forward, ref val, 4f))
		{
			Say(CWLang.Get(CWText.LookSurface));
			return;
		}
		string text = Guid.NewGuid().ToString();
		object[] content = new object[5]
		{
			text,
			((RaycastHit)(ref val)).point.x,
			((RaycastHit)(ref val)).point.y,
			((RaycastHit)(ref val)).point.z,
			transform.eulerAngles.y
		};
		Raise(190, content);
	}

	private static Material GetMat(Color c, float metallic, float smooth)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b2: Expected O, but got Unknown
		//IL_00b3: 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)
		string key = ColorUtility.ToHtmlStringRGB(c) + "_" + metallic.ToString("0.00", CultureInfo.InvariantCulture) + "_" + smooth.ToString("0.00", CultureInfo.InvariantCulture);
		if (mats.TryGetValue(key, out var value) && (Object)(object)value != (Object)null)
		{
			return value;
		}
		Shader val = Shader.Find("Universal Render Pipeline/Lit");
		if ((Object)(object)val == (Object)null)
		{
			val = Shader.Find("Standard");
		}
		if ((Object)(object)val == (Object)null)
		{
			return null;
		}
		value = new Material(val);
		value.color = c;
		if (value.HasProperty("_BaseColor"))
		{
			value.SetColor("_BaseColor", c);
		}
		if (value.HasProperty("_Metallic"))
		{
			value.SetFloat("_Metallic", metallic);
		}
		if (value.HasProperty("_Smoothness"))
		{
			value.SetFloat("_Smoothness", smooth);
		}
		if (value.HasProperty("_Glossiness"))
		{
			value.SetFloat("_Glossiness", smooth);
		}
		mats[key] = value;
		return value;
	}

	private static GameObject Shape(PrimitiveType type, Transform parent, Vector3 localPos, Vector3 localScale, Color color, float metallic, float smooth, bool keepCollider)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: 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)
		GameObject val = GameObject.CreatePrimitive(type);
		val.transform.SetParent(parent, false);
		val.transform.localPosition = localPos;
		val.transform.localScale = localScale;
		if (!keepCollider)
		{
			Collider component = val.GetComponent<Collider>();
			if ((Object)(object)component != (Object)null)
			{
				Object.Destroy((Object)(object)component);
			}
		}
		Material mat = GetMat(color, metallic, smooth);
		if ((Object)(object)mat != (Object)null)
		{
			val.GetComponent<Renderer>().sharedMaterial = mat;
		}
		return val;
	}

	private static void Segment(Transform parent, Vector3 from, Vector3 to, float thickness, Color color, float metallic, float smooth)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: 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_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = to - from;
		float magnitude = ((Vector3)(ref val)).magnitude;
		GameObject val2 = Shape((PrimitiveType)2, parent, (from + to) * 0.5f, new Vector3(thickness, magnitude * 0.5f, thickness), color, metallic, smooth, keepCollider: false);
		val2.transform.localRotation = Quaternion.FromToRotation(Vector3.up, val);
	}

	private static void Collar(Transform parent, Vector3 pos, Vector3 axis, float diameter, Color color)
	{
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: 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)
		GameObject val = Shape((PrimitiveType)2, parent, pos, new Vector3(diameter, 0.02f, diameter), color, 0f, 0.15f, keepCollider: false);
		val.transform.localRotation = Quaternion.FromToRotation(Vector3.up, axis);
	}

	private static void BuildGeometry(CWStand s)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//IL_0013: Unknown result type (might be due to invalid IL or missing references)
		//IL_0028: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0142: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_014e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0153: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_0159: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_017f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018a: Unknown result type (might be due to invalid IL or missing references)
		//IL_018f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0191: Unknown result type (might be due to invalid IL or missing references)
		//IL_0193: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: 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_01b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b8: 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_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01df: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: 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_01fa: Unknown result type (might be due to invalid IL or missing references)
		//IL_020c: Unknown result type (might be due to invalid IL or missing references)
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_021e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: Unknown result type (might be due to invalid IL or missing references)
		//IL_0227: 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_0242: Unknown result type (might be due to invalid IL or missing references)
		//IL_0247: Unknown result type (might be due to invalid IL or missing references)
		//IL_0262: 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_0269: Unknown result type (might be due to invalid IL or missing references)
		//IL_0276: Unknown result type (might be due to invalid IL or missing references)
		//IL_027a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0284: Unknown result type (might be due to invalid IL or missing references)
		//IL_0289: Unknown result type (might be due to invalid IL or missing references)
		//IL_029d: 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_02b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0300: Unknown result type (might be due to invalid IL or missing references)
		//IL_0335: Unknown result type (might be due to invalid IL or missing references)
		//IL_033e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0348: Unknown result type (might be due to invalid IL or missing references)
		//IL_034d: Unknown result type (might be due to invalid IL or missing references)
		//IL_036d: Unknown result type (might be due to invalid IL or missing references)
		//IL_037a: 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_03b4: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
		//IL_0403: Unknown result type (might be due to invalid IL or missing references)
		//IL_040d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0432: Unknown result type (might be due to invalid IL or missing references)
		//IL_0446: Unknown result type (might be due to invalid IL or missing references)
		//IL_044b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0475: Unknown result type (might be due to invalid IL or missing references)
		//IL_0494: 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_04d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_0504: Unknown result type (might be due to invalid IL or missing references)
		//IL_050b: Expected O, but got Unknown
		//IL_052d: Unknown result type (might be due to invalid IL or missing references)
		//IL_055b: 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_0574: Unknown result type (might be due to invalid IL or missing references)
		//IL_0598: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ac: Unknown result type (might be due to invalid IL or missing references)
		//IL_05b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_05d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_05e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_0613: Unknown result type (might be due to invalid IL or missing references)
		//IL_0627: Unknown result type (might be due to invalid IL or missing references)
		//IL_062c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0651: Unknown result type (might be due to invalid IL or missing references)
		//IL_0665: Unknown result type (might be due to invalid IL or missing references)
		//IL_066a: Unknown result type (might be due to invalid IL or missing references)
		//IL_068f: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_06a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_06cd: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0710: Unknown result type (might be due to invalid IL or missing references)
		//IL_072d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0741: Unknown result type (might be due to invalid IL or missing references)
		//IL_0746: Unknown result type (might be due to invalid IL or missing references)
		//IL_076b: Unknown result type (might be due to invalid IL or missing references)
		//IL_077f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0784: Unknown result type (might be due to invalid IL or missing references)
		//IL_07ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_07e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_07e9: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0803: Unknown result type (might be due to invalid IL or missing references)
		//IL_0805: Unknown result type (might be due to invalid IL or missing references)
		//IL_080c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0811: Unknown result type (might be due to invalid IL or missing references)
		//IL_0818: Unknown result type (might be due to invalid IL or missing references)
		//IL_082d: Unknown result type (might be due to invalid IL or missing references)
		//IL_083e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0843: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("CWMod_Tripod");
		val.transform.SetPositionAndRotation(s.pos, Quaternion.Euler(0f, s.yaw, 0f));
		Transform val2 = (s.root = val.transform);
		Color color = default(Color);
		((Color)(ref color))..ctor(0.62f, 0.64f, 0.67f);
		Color color2 = default(Color);
		((Color)(ref color2))..ctor(0.09f, 0.09f, 0.1f);
		Color color3 = default(Color);
		((Color)(ref color3))..ctor(0.04f, 0.04f, 0.04f);
		Color color4 = default(Color);
		((Color)(ref color4))..ctor(0.95f, 0.45f, 0.1f);
		Color color5 = default(Color);
		((Color)(ref color5))..ctor(0.55f, 0.9f, 0.6f);
		float height = s.height;
		float num = Mathf.InverseLerp(0.5f, 2f, height);
		float num2 = Mathf.Lerp(0.42f, 0.7f, num);
		float num3 = height - 0.2f;
		Vector3[] array = (Vector3[])(object)new Vector3[3];
		Vector3[] array2 = (Vector3[])(object)new Vector3[3];
		Vector3 val3 = default(Vector3);
		for (int i = 0; i < 3; i++)
		{
			float num4 = (90f + (float)i * 120f) * (MathF.PI / 180f);
			((Vector3)(ref val3))..ctor(Mathf.Cos(num4), 0f, Mathf.Sin(num4));
			Vector3 val4 = new Vector3(0f, num3, 0f) + val3 * 0.07f;
			Vector3 val5 = val3 * num2 + new Vector3(0f, 0.03f, 0f);
			array[i] = val4;
			array2[i] = val5;
			Vector3 val6 = val5 - val4;
			Vector3 val7 = Vector3.Lerp(val4, val5, 0.36f);
			Vector3 val8 = Vector3.Lerp(val4, val5, 0.68f);
			Segment(val2, val4, val7, 0.046f, color2, 0.3f, 0.4f);
			Segment(val2, val7, val8, 0.036f, color, 0.85f, 0.65f);
			Segment(val2, val8, val5, 0.027f, color, 0.85f, 0.65f);
			Collar(val2, val7, val6, 0.058f, color3);
			Collar(val2, val8, val6, 0.046f, color3);
			GameObject val9 = Shape((PrimitiveType)2, val2, val5, new Vector3(0.05f, 0.025f, 0.05f), color3, 0f, 0.15f, keepCollider: false);
			val9.transform.localRotation = Quaternion.FromToRotation(Vector3.up, val6);
			Shape((PrimitiveType)0, val2, val5 - ((Vector3)(ref val6)).normalized * 0.02f, new Vector3(0.05f, 0.05f, 0.05f), color3, 0f, 0.15f, keepCollider: false);
			GameObject val10 = Shape((PrimitiveType)3, val2, val4, new Vector3(0.07f, 0.07f, 0.07f), color, 0.8f, 0.6f, keepCollider: false);
			val10.transform.localRotation = Quaternion.Euler(0f, 90f - (float)i * 120f, 0f);
		}
		Vector3[] array3 = (Vector3[])(object)new Vector3[3];
		for (int j = 0; j < 3; j++)
		{
			array3[j] = Vector3.Lerp(array[j], array2[j], 0.5f);
		}
		for (int k = 0; k < 3; k++)
		{
			Segment(val2, array3[k], array3[(k + 1) % 3], 0.016f, color2, 0.3f, 0.4f);
		}
		Shape((PrimitiveType)2, val2, new Vector3(0f, num3, 0f), new Vector3(0.2f, 0.03f, 0.2f), color2, 0.3f, 0.4f, keepCollider: false);
		Segment(val2, new Vector3(0f, num3, 0f), new Vector3(0f, height - 0.11f, 0f), 0.055f, color, 0.85f, 0.65f);
		GameObject val11 = Shape((PrimitiveType)2, val2, new Vector3(0.13f, num3 + 0.01f, 0.02f), new Vector3(0.022f, 0.04f, 0.022f), color4, 0.2f, 0.5f, keepCollider: false);
		val11.transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
		Shape((PrimitiveType)0, val2, new Vector3(0.18f, num3 + 0.01f, 0.02f), new Vector3(0.05f, 0.05f, 0.05f), color4, 0.2f, 0.5f, keepCollider: false);
		Shape((PrimitiveType)2, val2, new Vector3(0f, height - 0.125f, 0f), new Vector3(0.15f, 0.025f, 0.15f), color2, 0.3f, 0.4f, keepCollider: false);
		GameObject val12 = new GameObject("Head");
		val12.transform.SetParent(val2, false);
		val12.transform.localPosition = new Vector3(0f, height, 0f);
		Transform parent = (s.head = val12.transform);
		Shape((PrimitiveType)2, parent, new Vector3(0f, -0.06f, 0f), new Vector3(0.12f, 0.04f, 0.12f), color2, 0.3f, 0.4f, keepCollider: false);
		Shape((PrimitiveType)3, parent, new Vector3(0f, -0.01f, 0f), new Vector3(0.3f, 0.02f, 0.3f), color2, 0.3f, 0.4f, keepCollider: true);
		Shape((PrimitiveType)3, parent, new Vector3(0.145f, 0.004f, 0f), new Vector3(0.012f, 0.02f, 0.3f), color4, 0.2f, 0.5f, keepCollider: false);
		Shape((PrimitiveType)3, parent, new Vector3(-0.145f, 0.004f, 0f), new Vector3(0.012f, 0.02f, 0.3f), color4, 0.2f, 0.5f, keepCollider: false);
		Shape((PrimitiveType)3, parent, new Vector3(0f, 0.004f, 0.145f), new Vector3(0.3f, 0.02f, 0.012f), color4, 0.2f, 0.5f, keepCollider: false);
		Shape((PrimitiveType)3, parent, new Vector3(0f, 0.004f, -0.145f), new Vector3(0.3f, 0.02f, 0.012f), color4, 0.2f, 0.5f, keepCollider: false);
		GameObject val13 = Shape((PrimitiveType)2, parent, new Vector3(0.08f, -0.06f, 0f), new Vector3(0.02f, 0.03f, 0.02f), color4, 0.2f, 0.5f, keepCollider: false);
		val13.transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
		Shape((PrimitiveType)0, parent, new Vector3(0.115f, -0.06f, 0f), new Vector3(0.045f, 0.045f, 0.045f), color4, 0.2f, 0.5f, keepCollider: false);
		GameObject val14 = Shape((PrimitiveType)2, parent, new Vector3(0f, -0.055f, 0.062f), new Vector3(0.03f, 0.006f, 0.03f), color5, 0f, 0.8f, keepCollider: false);
		val14.transform.localRotation = Quaternion.Euler(90f, 0f, 0f);
		Vector3 val15 = default(Vector3);
		((Vector3)(ref val15))..ctor(0.03f, -0.06f, -0.05f);
		Vector3 val16 = default(Vector3);
		((Vector3)(ref val16))..ctor(0.03f, -0.15f, -0.4f);
		Segment(parent, val15, val16, 0.018f, color2, 0.3f, 0.4f);
		Segment(parent, Vector3.Lerp(val15, val16, 0.45f), val16, 0.032f, color3, 0f, 0.15f);
		Shape((PrimitiveType)0, parent, val16, new Vector3(0.04f, 0.04f, 0.04f), color3, 0f, 0.15f, keepCollider: false);
		UpdateHead(s);
	}

	private static void UpdateHead(CWStand s)
	{
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)s.head == (Object)null))
		{
			float num = (float.IsNaN(s.mountYaw) ? s.yaw : s.mountYaw);
			s.head.rotation = Quaternion.Euler(0f - s.tilt, num, 0f);
		}
	}

	private static void RemoveStand(string id)
	{
		if (stands.TryGetValue(id, out var value))
		{
			if ((Object)(object)value.root != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)value.root).gameObject);
			}
			stands.Remove(id);
			Log.LogInfo((object)"[Stand] Tripod silindi.");
		}
	}

	private static Vector3 Head(CWStand s)
	{
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		return s.root.TransformPoint(0f, s.height, 0f);
	}

	private static void CameraPose(CWStand s, out Vector3 pos, out Quaternion rot)
	{
		//IL_001f: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0061: Unknown result type (might be due to invalid IL or missing references)
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		float num = (float.IsNaN(s.mountYaw) ? s.yaw : s.mountYaw);
		pos = Head(s) + s.head.up * mountHeight.Value;
		rot = Quaternion.Euler(0f - s.tilt, num + mountYawOffset.Value, 0f);
	}

	internal static bool IsNearStand(Vector3 p, float range)
	{
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		foreach (KeyValuePair<string, CWStand> stand in stands)
		{
			if ((Object)(object)stand.Value.root == (Object)null || !(Vector3.Distance(p, Head(stand.Value)) < range))
			{
				continue;
			}
			return true;
		}
		return false;
	}

	private static CWStand NearestStand(Vector3 p, float range, out string id)
	{
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		id = null;
		CWStand result = null;
		float num = range;
		foreach (KeyValuePair<string, CWStand> stand in stands)
		{
			CWStand value = stand.Value;
			if (!((Object)(object)value.root == (Object)null))
			{
				float num2 = Vector3.Distance(p, value.root.position);
				if (num2 < num)
				{
					num = num2;
					result = value;
					id = stand.Key;
				}
			}
		}
		return result;
	}

	private static VideoCamera FindCameraNear(Vector3 point, float range)
	{
		//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)
		VideoCamera result = null;
		float num = range;
		VideoCamera[] array = Object.FindObjectsByType<VideoCamera>((FindObjectsSortMode)0);
		foreach (VideoCamera val in array)
		{
			if (!((ItemInstanceBehaviour)val).isHeld)
			{
				float num2 = Vector3.Distance(((Component)val).transform.position, point);
				if (num2 < num)
				{
					num = num2;
					result = val;
				}
			}
		}
		return result;
	}

	private static ItemInstanceData DataOf(VideoCamera c)
	{
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Expected O, but got Unknown
		return (ItemInstanceData)AccessTools.Field(typeof(VideoCamera), "m_instanceData").GetValue(c);
	}

	private static void Adjust(float dh, float dt)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		string id;
		CWStand cWStand = NearestStand(((Component)MainCamera.instance).transform.position, 3f, out id);
		if (cWStand != null)
		{
			float num = Mathf.Clamp(cWStand.height + dh, 0.5f, 2f);
			float num2 = Mathf.Clamp(cWStand.tilt + dt, -60f, 60f);
			if (!Mathf.Approximately(num, cWStand.height) || !Mathf.Approximately(num2, cWStand.tilt))
			{
				Raise(193, new object[3] { id, num, num2 });
				Say(CWLang.Get(CWText.Height) + ": " + num.ToString("0.00", CultureInfo.InvariantCulture) + " m    " + CWLang.Get(CWText.Tilt) + ": " + num2.ToString("0", CultureInfo.InvariantCulture) + "°");
			}
		}
	}

	private static void ApplyAdjust(string id, float h, float t)
	{
		//IL_002b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_0117: Unknown result type (might be due to invalid IL or missing references)
		if (!stands.TryGetValue(id, out var value) || (Object)(object)value.root == (Object)null)
		{
			return;
		}
		Vector3 val = Head(value);
		bool flag = !Mathf.Approximately(h, value.height);
		value.height = h;
		value.tilt = t;
		List<MountedCamera> list = new List<MountedCamera>();
		VideoCamera[] array = Object.FindObjectsByType<VideoCamera>((FindObjectsSortMode)0);
		foreach (VideoCamera val2 in array)
		{
			if (!((ItemInstanceBehaviour)val2).isHeld)
			{
				MountedCamera component = ((Component)val2).GetComponent<MountedCamera>();
				if ((Object)(object)component != (Object)null && Vector3.Distance(((Component)val2).transform.position, val) < 1f)
				{
					list.Add(component);
				}
			}
		}
		if (flag)
		{
			Object.Destroy((Object)(object)((Component)value.root).gameObject);
			BuildGeometry(value);
		}
		else
		{
			UpdateHead(value);
		}
		foreach (MountedCamera item in list)
		{
			CameraPose(value, out var pos, out var rot);
			item.Set(pos, rot);
		}
	}

	private static void TryMountCamera()
	{
		//IL_000d: 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_00a6: Unknown result type (might be due to invalid IL or missing references)
		Transform transform = ((Component)MainCamera.instance).transform;
		string id;
		CWStand cWStand = NearestStand(transform.position, 3f, out id);
		if (cWStand == null)
		{
			Say(CWLang.Get(CWText.NoStand));
			return;
		}
		VideoCamera val = FindCameraNear(Head(cWStand), 2f);
		if ((Object)(object)val == (Object)null)
		{
			Say(CWLang.Get(CWText.NoCameraNear));
			return;
		}
		ItemInstanceData val2 = DataOf(val);
		string text = ((val2 == null) ? "" : val2.m_guid.ToString());
		Raise(192, new object[3]
		{
			id,
			text,
			transform.eulerAngles.y
		});
	}

	private static bool TryMountNow(string standId, string camGuid, float yaw)
	{
		//IL_00a5: 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_0106: Unknown result type (might be due to invalid IL or missing references)
		if (!stands.TryGetValue(standId, out var value) || (Object)(object)value.root == (Object)null)
		{
			return true;
		}
		VideoCamera val = null;
		VideoCamera[] array = Object.FindObjectsByType<VideoCamera>((FindObjectsSortMode)0);
		foreach (VideoCamera val2 in array)
		{
			if (!((ItemInstanceBehaviour)val2).isHeld)
			{
				ItemInstanceData val3 = DataOf(val2);
				if (val3 != null && val3.m_guid.ToString() == camGuid)
				{
					val = val2;
					break;
				}
			}
		}
		if ((Object)(object)val == (Object)null)
		{
			val = FindCameraNear(Head(value), 2f);
		}
		if ((Object)(object)val == (Object)null)
		{
			return false;
		}
		value.mountYaw = yaw;
		UpdateHead(value);
		CameraPose(value, out var pos, out var rot);
		MountedCamera mountedCamera = ((Component)val).GetComponent<MountedCamera>();
		if ((Object)(object)mountedCamera == (Object)null)
		{
			mountedCamera = ((Component)val).gameObject.AddComponent<MountedCamera>();
		}
		mountedCamera.Set(pos, rot);
		Log.LogInfo((object)"[Stand] Kamera oturtuldu.");
		return true;
	}

	private static void TryDeleteStand()
	{
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		Transform transform = ((Component)MainCamera.instance).transform;
		string id;
		CWStand cWStand = NearestStand(transform.position, 3f, out id);
		if (cWStand != null)
		{
			if ((Object)(object)FindCameraNear(Head(cWStand), 1f) != (Object)null)
			{
				Say(CWLang.Get(CWText.CameraOnStand));
			}
			else
			{
				Raise(191, id);
			}
		}
	}

	private static void ToggleRecording()
	{
		//IL_000b: 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)
		string id;
		CWStand cWStand = NearestStand(((Component)MainCamera.instance).transform.position, 3f, out id);
		if (cWStand == null)
		{
			return;
		}
		VideoCamera val = FindCameraNear(Head(cWStand), 1f);
		if ((Object)(object)val == (Object)null)
		{
			Say(CWLang.Get(CWText.NoCameraOn));
			return;
		}
		ItemInstanceData val2 = DataOf(val);
		RecordingsHandler instance = RetrievableSingleton<RecordingsHandler>.Instance;
		if (val.recording)
		{
			Log.LogInfo((object)"[Stand] Kayit durduruluyor.");
			instance.StopRecording(val2);
		}
		else if (val.HasFilmLeft)
		{
			Log.LogInfo((object)"[Stand] Kayit baslatiliyor.");
			instance.StartRecording(val2, Player.localPlayer.refs.view);
		}
		else
		{
			Say(CWLang.Get(CWText.NoFilm));
		}
	}
}
public class PendingMount
{
	public string standId;

	public string guid;

	public float yaw;

	public float until;
}
public class CWStand
{
	public string id;

	public Transform root;

	public Transform head;

	public Vector3 pos;

	public float yaw;

	public float height = 1.25f;

	public float tilt = 0f;

	public float mountYaw = float.NaN;
}
public enum CWText
{
	LookSurface,
	NoStand,
	NoCameraNear,
	CameraOnStand,
	NoCameraOn,
	NoFilm,
	Height,
	Tilt,
	MenuTitle,
	MenuHint,
	PressKey,
	KeyInUse,
	ActSpawn,
	ActMount,
	ActDelete,
	ActRecord,
	ActHeightUp,
	ActHeightDown,
	ActTiltUp,
	ActTiltDown,
	ActMenu
}
public static class CWLang
{
	private static string lang;

	private static readonly Dictionary<string, string[]> T = new Dictionary<string, string[]>
	{
		{
			"en",
			new string[21]
			{
				"Look at a surface and try again.", "No tripod nearby.", "No camera next to the tripod. Drop it next to the tripod first.", "Camera on it! Tripod can't be deleted.", "No camera on the tripod.", "No film left.", "Height", "Tilt", "Tripod controls", "Up/Down: select   Enter: change   Backspace: default   {0}: close",
				"Press a new key... (Backspace: cancel)", "Already used by: {0}", "Place tripod", "Mount camera / aim", "Remove tripod", "Start / stop recording", "Raise tripod", "Lower tripod", "Tilt up", "Tilt down",
				"Open this menu"
			}
		},
		{
			"tr",
			new string[21]
			{
				"Bir yüzeye bakıp tekrar dene.", "Yakında stand yok.", "Standın yanında kamera yok. Önce kamerayı standın yanına bırak.", "Kamera var! Stand silinemez.", "Standın üstünde kamera yok.", "Filmde süre kalmadı.", "Yükseklik", "Eğim", "Stand kontrolleri", "Yukarı/Aşağı: seç   Enter: değiştir   Backspace: varsayılan   {0}: kapat",
				"Yeni bir tuşa bas... (Backspace: iptal)", "Zaten kullanılıyor: {0}", "Stand koy", "Kamerayı oturt / yönlendir", "Standı sil", "Kaydı başlat / durdur", "Standı yükselt", "Standı alçalt", "Yukarı eğ", "Aşağı eğ",
				"Bu menüyü aç"
			}
		},
		{
			"fr",
			new string[21]
			{
				"Vise une surface et réessaie.", "Aucun trépied à proximité.", "Pas de caméra près du trépied. Pose-la d'abord à côté.", "Caméra dessus ! Impossible de supprimer le trépied.", "Pas de caméra sur le trépied.", "Plus de pellicule.", "Hauteur", "Inclinaison", "Commandes du trépied", "Haut/Bas : choisir   Entrée : modifier   Retour arrière : défaut   {0} : fermer",
				"Appuie sur une touche... (Retour arrière : annuler)", "Déjà utilisée par : {0}", "Poser le trépied", "Fixer la caméra / orienter", "Retirer le trépied", "Démarrer / arrêter l'enregistrement", "Monter le trépied", "Baisser le trépied", "Incliner vers le haut", "Incliner vers le bas",
				"Ouvrir ce menu"
			}
		},
		{
			"it",
			new string[21]
			{
				"Guarda una superficie e riprova.", "Nessun treppiede nelle vicinanze.", "Nessuna videocamera vicino al treppiede. Posala prima accanto ad esso.", "Videocamera sopra! Impossibile eliminare il treppiede.", "Nessuna videocamera sul treppiede.", "Pellicola esaurita.", "Altezza", "Inclinazione", "Controlli del treppiede", "Su/Giù: seleziona   Invio: cambia   Backspace: predefinito   {0}: chiudi",
				"Premi un nuovo tasto... (Backspace: annulla)", "Già usato da: {0}", "Posiziona treppiede", "Monta videocamera / orienta", "Rimuovi treppiede", "Avvia / ferma registrazione", "Alza il treppiede", "Abbassa il treppiede", "Inclina in alto", "Inclina in basso",
				"Apri questo menu"
			}
		},
		{
			"de",
			new string[21]
			{
				"Schau auf eine Fläche und versuche es erneut.", "Kein Stativ in der Nähe.", "Keine Kamera neben dem Stativ. Leg sie zuerst daneben ab.", "Kamera darauf! Stativ kann nicht gelöscht werden.", "Keine Kamera auf dem Stativ.", "Kein Film mehr übrig.", "Höhe", "Neigung", "Stativ-Steuerung", "Hoch/Runter: wählen   Enter: ändern   Rücktaste: Standard   {0}: schließen",
				"Drücke eine neue Taste... (Rücktaste: abbrechen)", "Bereits belegt durch: {0}", "Stativ aufstellen", "Kamera montieren / ausrichten", "Stativ entfernen", "Aufnahme starten / stoppen", "Stativ erhöhen", "Stativ senken", "Nach oben neigen", "Nach unten neigen",
				"Dieses Menü öffnen"
			}
		},
		{
			"es",
			new string[21]
			{
				"Mira una superficie e inténtalo de nuevo.", "No hay ningún trípode cerca.", "No hay cámara junto al trípode. Déjala primero a su lado.", "¡Hay una cámara! No se puede eliminar el trípode.", "No hay cámara en el trípode.", "No queda película.", "Altura", "Inclinación", "Controles del trípode", "Arriba/Abajo: elegir   Intro: cambiar   Retroceso: predeterminado   {0}: cerrar",
				"Pulsa una tecla nueva... (Retroceso: cancelar)", "Ya está en uso por: {0}", "Colocar trípode", "Montar cámara / orientar", "Quitar trípode", "Iniciar / detener grabación", "Subir trípode", "Bajar trípode", "Inclinar hacia arriba", "Inclinar hacia abajo",
				"Abrir este menú"
			}
		},
		{
			"ja",
			new string[21]
			{
				"表面を見てもう一度お試しください。", "近くに三脚がありません。", "三脚の近くにカメラがありません。先に三脚の横に置いてください。", "カメラが乗っています!三脚は削除できません。", "三脚にカメラがありません。", "フィルムの残りがありません。", "高さ", "傾き", "三脚の操作", "上/下:選択   Enter:変更   Backspace:初期値   {0}:閉じる",
				"新しいキーを押してください…(Backspace:キャンセル)", "すでに使用中:{0}", "三脚を置く", "カメラを取り付け/向きを調整", "三脚を撤去", "録画の開始/停止", "三脚を高くする", "三脚を低くする", "上に傾ける", "下に傾ける",
				"このメニューを開く"
			}
		},
		{
			"ko",
			new string[21]
			{
				"표면을 바라보고 다시 시도하세요.", "근처에 삼각대가 없습니다.", "삼각대 옆에 카메라가 없습니다. 먼저 삼각대 옆에 내려놓으세요.", "카메라가 있습니다! 삼각대를 삭제할 수 없습니다.", "삼각대에 카메라가 없습니다.", "남은 필름이 없습니다.", "높이", "기울기", "삼각대 조작", "위/아래: 선택   Enter: 변경   Backspace: 기본값   {0}: 닫기",
				"새 키를 누르세요... (Backspace: 취소)", "이미 사용 중: {0}", "삼각대 설치", "카메라 장착 / 방향 조정", "삼각대 제거", "녹화 시작 / 중지", "삼각대 높이기", "삼각대 낮추기", "위로 기울이기", "아래로 기울이기",
				"이 메뉴 열기"
			}
		},
		{
			"pt",
			new string[21]
			{
				"Olhe para uma superfície e tente de novo.", "Nenhum tripé por perto.", "Nenhuma câmera ao lado do tripé. Solte-a primeiro ao lado dele.", "Há uma câmera! Não é possível excluir o tripé.", "Nenhuma câmera no tripé.", "Acabou o filme.", "Altura", "Inclinação", "Controles do tripé", "Cima/Baixo: selecionar   Enter: alterar   Backspace: padrão   {0}: fechar",
				"Pressione uma nova tecla... (Backspace: cancelar)", "Já usada por: {0}", "Colocar tripé", "Montar câmera / direcionar", "Remover tripé", "Iniciar / parar gravação", "Aumentar altura do tripé", "Diminuir altura do tripé", "Inclinar para cima", "Inclinar para baixo",
				"Abrir este menu"
			}
		},
		{
			"ru",
			new string[21]
			{
				"Посмотри на поверхность и попробуй снова.", "Рядом нет штатива.", "Рядом со штативом нет камеры. Сначала положи её рядом.", "На штативе камера! Удалить штатив нельзя.", "На штативе нет камеры.", "Плёнка закончилась.", "Высота", "Наклон", "Управление штативом", "Вверх/Вниз: выбор   Enter: изменить   Backspace: по умолчанию   {0}: закрыть",
				"Нажми новую клавишу... (Backspace: отмена)", "Уже используется: {0}", "Поставить штатив", "Установить камеру / навести", "Убрать штатив", "Начать / остановить запись", "Поднять штатив", "Опустить штатив", "Наклонить вверх", "Наклонить вниз",
				"Открыть это меню"
			}
		},
		{
			"zh",
			new string[21]
			{
				"请看向一个表面后重试。", "附近没有三脚架。", "三脚架旁边没有摄像机。请先把摄像机放在旁边。", "上面有摄像机!无法删除三脚架。", "三脚架上没有摄像机。", "胶片已用完。", "高度", "倾斜", "三脚架控制", "上/下:选择   Enter:更改   Backspace:恢复默认   {0}:关闭",
				"请按下新的按键…(Backspace:取消)", "已被占用:{0}", "放置三脚架", "安装摄像机 / 调整朝向", "移除三脚架", "开始 / 停止录制", "升高三脚架", "降低三脚架", "向上倾斜", "向下倾斜",
				"打开此菜单"
			}
		}
	};

	public static string Get(CWText k)
	{
		if (lang == null)
		{
			lang = Detect();
		}
		string key = lang ?? "en";
		if (!T.TryGetValue(key, out var value) || (int)k >= value.Length)
		{
			value = T["en"];
		}
		return value[(int)k];
	}

	private static string Detect()
	{
		string text = (Plugin.LanguageSetting ?? "auto").Trim().ToLowerInvariant();
		if (text.Length > 0 && text != "auto")
		{
			Plugin.Log.LogInfo((object)("[Dil] ayardan: " + text));
			return text;
		}
		string currentGameLanguage;
		try
		{
			currentGameLanguage = SteamApps.GetCurrentGameLanguage();
		}
		catch
		{
			return null;
		}
		if (string.IsNullOrEmpty(currentGameLanguage))
		{
			return null;
		}
		string text2;
		switch (currentGameLanguage.ToLowerInvariant())
		{
		case "turkish":
			text2 = "tr";
			break;
		case "french":
			text2 = "fr";
			break;
		case "italian":
			text2 = "it";
			break;
		case "german":
			text2 = "de";
			break;
		case "spanish":
		case "latam":
			text2 = "es";
			break;
		case "japanese":
			text2 = "ja";
			break;
		case "koreana":
			text2 = "ko";
			break;
		case "brazilian":
		case "portuguese":
			text2 = "pt";
			break;
		case "russian":
			text2 = "ru";
			break;
		case "schinese":
		case "tchinese":
			text2 = "zh";
			break;
		default:
			text2 = "en";
			break;
		}
		Plugin.Log.LogInfo((object)("[Dil] Steam dili: " + currentGameLanguage + " -> " + text2));
		return text2;
	}
}
public class MountedCamera : MonoBehaviour
{
	private Vector3 pos;

	private Quaternion rot;

	private Rigidbody rb;

	public void Set(Vector3 p, Quaternion r)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0003: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: 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_0045: 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)
		pos = p;
		rot = r;
		rb = ((Component)this).GetComponent<Rigidbody>();
		if ((Object)(object)rb != (Object)null && !rb.isKinematic)
		{
			rb.linearVelocity = Vector3.zero;
			rb.angularVelocity = Vector3.zero;
			rb.isKinematic = true;
		}
		((Component)this).transform.SetPositionAndRotation(pos, rot);
	}

	private void FixedUpdate()
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)rb == (Object)null))
		{
			if (!rb.isKinematic)
			{
				rb.isKinematic = true;
			}
			rb.position = pos;
			rb.rotation = rot;
		}
	}

	private void LateUpdate()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		((Component)this).transform.SetPositionAndRotation(pos, rot);
	}
}
[HarmonyPatch(typeof(VideoCamera), "RestartRecordingDelayed")]
internal static class StandSkipAutoRecordPatch
{
	private static bool Prefix(VideoCamera __instance, ref IEnumerator __result)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Expected O, but got Unknown
		Transform transform = ((Component)__instance).transform;
		Vector3 p = (((Object)(object)transform.parent != (Object)null) ? transform.parent.position : transform.position);
		if (!Plugin.IsNearStand(p, 1.2f))
		{
			return true;
		}
		Plugin.Log.LogInfo((object)"[Stand] Tripoda yakin kamera: otomatik 4 saniyelik kayit iptal edildi.");
		VideoInfoEntry val = (VideoInfoEntry)AccessTools.Field(typeof(VideoCamera), "m_recorderInfoEntry").GetValue(__instance);
		if (val != null && val.isRecording)
		{
			val.isRecording = false;
			((ItemDataEntry)val).SetDirty();
		}
		__result = Nothing();
		return false;
	}

	private static IEnumerator Nothing()
	{
		yield break;
	}
}
[HarmonyPatch(typeof(RecordingsHandler), "StartRecording")]
internal static class StartRecordingLogPatch
{
	private static void Prefix(ItemInstanceData data, PhotonView playerView)
	{
		ManualLogSource log = Plugin.Log;
		Guid guid = data.m_guid;
		log.LogInfo((object)("[StartRecording] kamera=" + guid.ToString() + " playerView=" + (((Object)(object)playerView == (Object)null) ? "null" : playerView.OwnerActorNr.ToString())));
	}
}
[HarmonyPatch(typeof(RecordingsHandler), "StopRecording")]
internal static class StopRecordingLogPatch
{
	private static void Prefix(ItemInstanceData data)
	{
		ManualLogSource log = Plugin.Log;
		Guid guid = data.m_guid;
		log.LogInfo((object)("[StopRecording] kamera=" + guid));
	}
}