Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Overtime v1.0.0
plugins/Overtime.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using ExitGames.Client.Photon; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Overtime")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Overtime")] [assembly: AssemblyTitle("Overtime")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Overtime { internal static class Game { internal const BindingFlags All = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private static readonly Dictionary<string, Type> _types = new Dictionary<string, Type>(); private static readonly Dictionary<string, MethodInfo> _semi = new Dictionary<string, MethodInfo>(); private static FieldInfo _currentPage; private static float _avatarScanAt = -9f; private static readonly Dictionary<int, Transform> _avatars = new Dictionary<int, Transform>(); private static TMP_FontAsset _font; internal static Type FindType(string name) { if (_types.TryGetValue(name, out var value)) { return value; } Type type = null; Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { try { type = assembly.GetType(name, throwOnError: false); } catch { } if (type != null) { break; } } _types[name] = type; return type; } internal static bool Alive(object o) { if (o != null) { Object val = (Object)((o is Object) ? o : null); if (val != null) { return !(val == (Object)null); } return true; } return false; } internal static object StaticInstance(Type t) { if (t == null) { return null; } object obj = null; FieldInfo fieldInfo = t.GetField("instance", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) ?? t.GetField("Instance", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (fieldInfo != null) { obj = fieldInfo.GetValue(null); } else { PropertyInfo propertyInfo = t.GetProperty("instance", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) ?? t.GetProperty("Instance", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (propertyInfo != null) { obj = propertyInfo.GetValue(null); } } if (!Alive(obj)) { return null; } return obj; } internal static object Get(object inst, string member) { if (inst == null) { return null; } Type type = inst.GetType(); FieldInfo field = type.GetField(member, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field.GetValue(inst); } return type.GetProperty(member, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(inst); } internal static bool? Semi(string method) { if (!_semi.TryGetValue(method, out var value)) { value = FindType("SemiFunc")?.GetMethod(method, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); _semi[method] = value; } if (value == null) { return null; } try { return (bool)value.Invoke(null, null); } catch { return null; } } internal static bool RunIsLevel() { return Semi("RunIsLevel") == true; } internal static bool RunIsLobbyOrShop() { if (Semi("RunIsLobby") != true) { return Semi("RunIsShop") == true; } return true; } internal static bool MenuOpen() { try { Type type = FindType("MenuManager"); object obj = StaticInstance(type); if (obj == null) { return false; } if (_currentPage == null) { _currentPage = type.GetField("currentMenuPage", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); } object? obj2 = _currentPage?.GetValue(obj); Object val = (Object)((obj2 is Object) ? obj2 : null); return val != null && val != (Object)null; } catch { return false; } } internal static Transform AvatarOf(int actor) { if (Time.unscaledTime - _avatarScanAt > 2f) { _avatarScanAt = Time.unscaledTime; _avatars.Clear(); Type type = FindType("PlayerAvatar"); if (type != null) { Object[] array = Object.FindObjectsByType(type, (FindObjectsSortMode)0); foreach (Object obj in array) { Component val = (Component)(object)((obj is Component) ? obj : null); if (val != null && !((Object)(object)val == (Object)null)) { PhotonView val2 = (PhotonView)(((object)val.GetComponent<PhotonView>()) ?? ((object)/*isinst with value type is only supported in some contexts*/)); if (((val2 != null) ? val2.Owner : null) != null) { _avatars[val2.Owner.ActorNumber] = val.transform; } } } } } if (!_avatars.TryGetValue(actor, out var value) || !((Object)(object)value != (Object)null)) { return null; } return value; } internal static TMP_FontAsset Font() { if ((Object)(object)_font != (Object)null) { return _font; } try { object obj = Get(StaticInstance(FindType("BigMessageUI")), "Text"); TMP_Text val = (TMP_Text)((obj is TMP_Text) ? obj : null); if (val != null && (Object)(object)val.font != (Object)null) { return _font = val.font; } } catch { } TextMeshProUGUI val2 = ((IEnumerable<TextMeshProUGUI>)Object.FindObjectsByType<TextMeshProUGUI>((FindObjectsSortMode)0)).FirstOrDefault((Func<TextMeshProUGUI, bool>)((TextMeshProUGUI x) => (Object)(object)((TMP_Text)x).font != (Object)null)); if ((Object)(object)val2 != (Object)null) { return _font = ((TMP_Text)val2).font; } return _font = Resources.FindObjectsOfTypeAll<TMP_FontAsset>().FirstOrDefault(); } internal static float Spring(float t, float amount = 0.35f, float freq = 28f, float damp = 11f) { return 1f + amount * Mathf.Exp((0f - damp) * t) * Mathf.Cos(freq * t); } } [BepInPlugin("overtime.repo", "Overtime", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string Guid = "overtime.repo"; public const string ModName = "Overtime"; public const string Version = "1.0.0"; public const string Build = "2026-12-01 12:20"; internal static ManualLogSource Log; private void Awake() { //IL_0010: 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_001b: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; GameObject val = new GameObject("Overtime"); Object.DontDestroyOnLoad((Object)val); ((Object)val).hideFlags = (HideFlags)61; val.AddComponent<SkinTradeSigns>(); Log.LogInfo((object)"Overtime 1.0.0 (build 2026-12-01 12:20) loaded."); } } internal static class Reach { private struct Arm { public Vector3 Shoulder; public Vector3 Hand; } private const float MaxDistance = 2f; private const float HandTolerance = 0.32f; private const float ArmTolerance = 0.24f; private static Type _avatarType; private static Type _leftArmType; private static Type _inputKeyType; private static MethodInfo _poseOverride; private static MethodInfo _keyHold; private static bool _failed; private static Type AvatarType => _avatarType ?? (_avatarType = Game.FindType("PlayerAvatar")); internal static bool Disabled => _failed; internal static void Fail(Exception e) { if (!_failed) { _failed = true; Plugin.Log.LogWarning((object)("Handshake visuals switched off: " + e.Message)); } } private static Component AvatarComponent(int actor) { Transform val = Game.AvatarOf(actor); if (!((Object)(object)val == (Object)null) && !(AvatarType == null)) { return ((Component)val).GetComponent(AvatarType); } return null; } internal static bool IsOut(Component avatar) { if (!((Object)(object)avatar == (Object)null)) { object obj = Game.Get(avatar, "isDisabled"); bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) == 0) { obj = Game.Get(avatar, "deadSet"); bool flag2 = default(bool); int num2; if (obj is bool) { flag2 = (bool)obj; num2 = 1; } else { num2 = 0; } return (byte)((uint)num2 & (flag2 ? 1u : 0u)) != 0; } } return true; } internal static void Pose(int actor) { if (_failed) { return; } try { Component val = AvatarComponent(actor); if ((Object)(object)val == (Object)null || IsOut(val)) { return; } object obj = Game.Get(Game.Get(val, "playerAvatarVisuals"), "playerAvatarRightArm"); if (obj != null) { if (_poseOverride == null) { _poseOverride = obj.GetType().GetMethod("GrabberPoseOverride", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(float) }, null); } _poseOverride?.Invoke(obj, new object[1] { 0.2f }); } } catch (Exception e) { Fail(e); } } internal static bool GrabHeld() { try { Type type = Game.FindType("InputManager"); object obj = Game.StaticInstance(type); if (obj == null) { return false; } if (_keyHold == null) { _inputKeyType = Game.FindType("InputKey"); MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { ParameterInfo[] parameters = methodInfo.GetParameters(); if (methodInfo.Name == "KeyHold" && parameters.Length >= 1 && parameters[0].ParameterType == _inputKeyType && methodInfo.ReturnType == typeof(bool)) { _keyHold = methodInfo; break; } } } if (_keyHold == null) { return false; } ParameterInfo[] parameters2 = _keyHold.GetParameters(); object[] array = new object[parameters2.Length]; array[0] = Enum.Parse(_inputKeyType, "Grab"); for (int j = 1; j < parameters2.Length; j++) { array[j] = (parameters2[j].HasDefaultValue ? parameters2[j].DefaultValue : (parameters2[j].ParameterType.IsValueType ? Activator.CreateInstance(parameters2[j].ParameterType) : null)); } return (bool)_keyHold.Invoke(obj, array); } catch { return false; } } internal static bool LocalBusy() { try { object obj = Game.StaticInstance(Game.FindType("PhysGrabber")); bool flag = default(bool); int num; if (obj != null) { object obj2 = Game.Get(obj, "grabbed"); if (obj2 is bool) { flag = (bool)obj2; num = 1; } else { num = 0; } } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0) { return true; } Player localPlayer = PhotonNetwork.LocalPlayer; Component val = ((localPlayer == null) ? null : AvatarComponent(localPlayer.ActorNumber)); int result; if (!((Object)(object)val == (Object)null) && !IsOut(val)) { object obj2 = Game.Get(val, "isTumbling"); bool flag2 = default(bool); int num2; if (obj2 is bool) { flag2 = (bool)obj2; num2 = 1; } else { num2 = 0; } result = num2 & (flag2 ? 1 : 0); } else { result = 1; } return (byte)result != 0; } catch { return true; } } internal static int RightHandTarget() { //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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) if (_failed) { return 0; } try { Player localPlayer = PhotonNetwork.LocalPlayer; if (localPlayer == null) { return 0; } Component val = AvatarComponent(localPlayer.ActorNumber); if ((Object)(object)val == (Object)null || IsOut(val)) { return 0; } object obj = Game.Get(val, "localCamera"); Camera val2 = (Camera)((obj is Camera) ? obj : null); if ((Object)(object)val2 == (Object)null) { val2 = Camera.main; } if ((Object)(object)val2 == (Object)null) { return 0; } Vector3 position = ((Component)val2).transform.position; Vector3 forward = ((Component)val2).transform.forward; float num = 3.1999998f; int result = 0; float num2 = float.MaxValue; Player[] playerListOthers = PhotonNetwork.PlayerListOthers; foreach (Player val3 in playerListOthers) { Component val4 = AvatarComponent(val3.ActorNumber); if ((Object)(object)val4 == (Object)null || IsOut(val4)) { continue; } Vector3 a = val4.transform.position + Vector3.up * 0.25f; Vector3 b = val4.transform.position + Vector3.up * 1.7f; ClosestRaySegment(position, forward, a, b, out var along, out var gap); if (along <= 0.05f || along > num || gap > 0.6f || !Arms(val4, out var right, out var left)) { continue; } float num3 = ArmScore(position, forward, right, num); float num4 = ArmScore(position, forward, left, num); if (!(num3 > 1f) && !(num3 > num4)) { float num5 = num3 * 0.15f + along * 0.05f; if (num5 < num2) { num2 = num5; result = val3.ActorNumber; } } } return result; } catch (Exception e) { Fail(e); return 0; } } private static bool Arms(Component avatar, out Arm right, out Arm left) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_009f: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_0195: 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_01e1: 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) right = default(Arm); left = default(Arm); object obj = Game.Get(avatar, "playerAvatarVisuals"); Component val = (Component)((obj is Component) ? obj : null); object inst = Game.Get(val, "playerAvatarRightArm"); object obj2 = Game.Get(inst, "grabberTransform"); Transform val2 = (Transform)((obj2 is Transform) ? obj2 : null); object obj3 = Game.Get(inst, "rightArmTransform"); Transform val3 = (Transform)((obj3 is Transform) ? obj3 : null); if ((Object)(object)val2 == (Object)null && (Object)(object)val3 == (Object)null) { return false; } Vector3 up = avatar.transform.up; right.Hand = (val2 ?? val3).position; right.Shoulder = (((Object)(object)val3 != (Object)null && Vector3.Distance(val3.position, right.Hand) > 0.15f) ? val3.position : (right.Hand + up * 0.45f)); if (_leftArmType == null) { _leftArmType = Game.FindType("PlayerAvatarLeftArm"); } Component inst2 = (((Object)(object)val != (Object)null && _leftArmType != null) ? val.GetComponentInChildren(_leftArmType) : null); object obj4 = Game.Get(inst2, "flashlightController"); Component val4 = (Component)((obj4 is Component) ? obj4 : null); object obj5 = Game.Get(inst2, "leftArmTransform"); Transform val5 = (Transform)((obj5 is Transform) ? obj5 : null); Vector3 position = avatar.transform.position; Vector3 right2 = avatar.transform.right; left.Hand = (((Object)(object)val4 != (Object)null) ? val4.transform.position : (right.Hand - right2 * (2f * Vector3.Dot(right.Hand - position, right2)))); left.Shoulder = (((Object)(object)val5 != (Object)null && Vector3.Distance(val5.position, left.Hand) > 0.15f) ? val5.position : (right.Shoulder - right2 * (2f * Vector3.Dot(right.Shoulder - position, right2)))); return true; } private static float ArmScore(Vector3 o, Vector3 d, Arm a, float reach) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_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_0031: 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_0034: Unknown result type (might be due to invalid IL or missing references) ClosestRaySegment(o, d, a.Shoulder, a.Hand, out var along, out var gap); float num = ((along <= 0.05f || along > reach) ? float.MaxValue : (gap / 0.24f)); float num2 = RayPointGap(o, d, a.Hand, reach) / 0.32f; return Mathf.Min(num, num2); } private static float RayPointGap(Vector3 o, Vector3 d, Vector3 p, float reach) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) float num = Vector3.Dot(p - o, d); if (num <= 0.05f || num > reach) { return float.MaxValue; } return Vector3.Distance(o + d * num, p); } private static void ClosestRaySegment(Vector3 o, Vector3 d, Vector3 a, Vector3 b, out float along, out float gap) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_000f: 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_0011: 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_0018: 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_0020: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_0094: 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) Vector3 val = b - a; Vector3 val2 = o - a; float num = Vector3.Dot(val, val); float num2 = Vector3.Dot(val, d); float num3 = Vector3.Dot(val, val2); float num4 = Vector3.Dot(d, val2); float num5 = num - num2 * num2; float num6 = ((num5 > 1E-05f) ? Mathf.Clamp01((num3 - num2 * num4) / num5) : 0f); Vector3 val3 = a + val * num6; along = Vector3.Dot(val3 - o, d); Vector3 val4 = o + d * Mathf.Max(0f, along); gap = Vector3.Distance(val4, val3); } } internal sealed class SkinTradeSigns : MonoBehaviour, IOnEventCallback { private sealed class Sign { public GameObject Root; public TextMeshPro Text; } private sealed class Bit { public Transform T; public TextMeshPro Text; public Vector3 Pos; public Vector3 Vel; public float Spin; public float Angle; public float Flutter; public float Phase; public Color Color; } private sealed class Cheer { public int Actor; public float At; public GameObject Root; public TextMeshPro Text; public readonly List<Bit> Bits = new List<Bit>(); } private const string SkinTradeGuid = "skintrade.repo"; private const byte SkinTradeEvent = 147; private const string SkinTradeMagic = "SKT2"; private const int CelebrateMsg = 12; private const string PropWith = "skintrade.with"; private const string PropOff = "skintrade.off"; private const string PropSkinTrade = "skintrade.ver"; private const string PropOvertime = "overtime.ver"; private const string PropGrab = "skintrade.grab"; private const string OffHint = "SKINTRADE IS OFF - TURN IT ON IN YOUR MOD MANAGER TO TRADE SKINS"; private const string MissingHint = "GET SKINTRADE IN YOUR MOD MANAGER TO TRADE SKINS WITH YOUR CREW"; private const float SignHeight = 2.1f; private const float CheerTime = 4.2f; private const float ToastCps = 42f; private const float ToastTime = 10f; private static readonly Color SignColor = new Color(1f, 0.78f, 0.15f); private static readonly Color CheerColor = new Color(1f, 0.84f, 0.2f); private static readonly Color SoftYellow = new Color(1f, 0.86f, 0.45f); private static readonly Color FrameColor = new Color(1f, 0.88f, 0.34f); private static readonly Color PanelColor = new Color(0.06f, 0.05f, 0.03f, 0.96f); private static readonly Color[] ConfettiColors = (Color[])(object)new Color[6] { new Color(1f, 0.8f, 0.15f), new Color(0.35f, 0.95f, 0.35f), new Color(0.3f, 0.65f, 1f), new Color(1f, 0.4f, 0.85f), new Color(1f, 0.35f, 0.25f), new Color(0.96f, 0.94f, 0.86f) }; private readonly Dictionary<int, Sign> _signs = new Dictionary<int, Sign>(); private readonly List<int> _remove = new List<int>(); private readonly List<Cheer> _cheers = new List<Cheer>(); private readonly Random _rng = new Random(); private float _nextScan; private bool _skinTradeLoaded; private bool _turnedOff; private object _publishedRoom; private bool _hintShown; private float _hintReadySince = -1f; private Canvas _toastCanvas; private TextMeshProUGUI _toast; private RectTransform _toastPanel; private CanvasGroup _toastPanelGroup; private float _toastAt; private float _toastUntil; private int _errors; private object _versionRoom; private float _versionSince = -1f; private int _wantedBy; private int _attemptOn; private float _wantedSince = -1f; private float _attemptSince = -1f; private float _attemptHintUntil; private void Awake() { _skinTradeLoaded = Chainloader.PluginInfos.ContainsKey("skintrade.repo"); _turnedOff = !_skinTradeLoaded && DisabledSkinTradeInstalled(); if (_turnedOff) { Plugin.Log.LogInfo((object)"SkinTrade is installed but turned off - trading signs are shown by Overtime."); } } private static bool DisabledSkinTradeInstalled() { try { string[] files = Directory.GetFiles(Paths.PluginPath, "SkinTrade.dll.old", SearchOption.AllDirectories); for (int i = 0; i < files.Length; i++) { if (files[i] != null) { return true; } } } catch { } return false; } private void OnEnable() { PhotonNetwork.AddCallbackTarget((object)this); } private void OnDisable() { PhotonNetwork.RemoveCallbackTarget((object)this); } public void OnEvent(EventData ev) { if (_skinTradeLoaded || ev.Code != 147 || !(ev.CustomData is object[] array) || array.Length < 5 || !(array[0] is string text) || text != "SKT2") { return; } try { if ((int)array[1] != 12) { return; } Player localPlayer = PhotonNetwork.LocalPlayer; int num = ((localPlayer != null) ? localPlayer.ActorNumber : (-1)); int[] array2 = new int[2] { (int)array[3], (int)array[4] }; foreach (int actor in array2) { if (actor == num) { continue; } _cheers.RemoveAll(delegate(Cheer c) { if (c.Actor != actor) { return false; } if ((Object)(object)c.Root != (Object)null) { Object.Destroy((Object)(object)c.Root); } return true; }); _cheers.Add(CreateCheer(actor)); } } catch { } } private static string TradingText() { int num = (int)(Time.unscaledTime / 0.45f) % 4; return "TRADING " + new string('.', num) + "<alpha=#00>" + new string('.', 3 - num); } private void LateUpdate() { try { LateUpdateInner(); } catch (Exception ex) { _errors++; if (_errors <= 3) { Plugin.Log.LogError((object)("Overtime trading signs error: " + ex)); } if (_errors >= 3) { Plugin.Log.LogError((object)"Overtime trading signs switched off after repeated errors - most likely a game update. The rest of the game keeps working."); try { Clear(); } catch { } ((Behaviour)this).enabled = false; } } } private void LateUpdateInner() { //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_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: 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_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.InRoom) { Clear(); _publishedRoom = null; _hintReadySince = -1f; UpdateToast(); return; } Publish(); UpdateVersionHint(); if (_skinTradeLoaded) { UpdateToast(); return; } UpdateReach(); UpdateHint(); UpdateToast(); if (Time.unscaledTime >= _nextScan) { _nextScan = Time.unscaledTime + 0.25f; HashSet<int> hashSet = new HashSet<int>(); Player[] playerListOthers = PhotonNetwork.PlayerListOthers; foreach (Player val in playerListOthers) { if (TradingWith(val) != 0) { hashSet.Add(val.ActorNumber); } } _remove.Clear(); foreach (KeyValuePair<int, Sign> sign in _signs) { if (!hashSet.Contains(sign.Key)) { _remove.Add(sign.Key); } } foreach (int item in _remove) { if ((Object)(object)_signs[item].Root != (Object)null) { Object.Destroy((Object)(object)_signs[item].Root); } _signs.Remove(item); } foreach (int item2 in hashSet) { if (!_signs.ContainsKey(item2)) { _signs[item2] = CreateSign(); } } } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } float num = Mathf.Sin(Time.unscaledTime * 2.2f) * 0.05f; string text = TradingText(); UpdateCheers(main); foreach (KeyValuePair<int, Sign> sign2 in _signs) { Transform val2 = Game.AvatarOf(sign2.Key); Sign value = sign2.Value; if ((Object)(object)value.Root == (Object)null) { continue; } value.Root.SetActive((Object)(object)val2 != (Object)null); if (!((Object)(object)val2 == (Object)null)) { value.Root.transform.position = val2.position + Vector3.up * (2.1f + num); value.Root.transform.rotation = Quaternion.LookRotation(value.Root.transform.position - ((Component)main).transform.position); ((TMP_Text)value.Text).alpha = 0.8f + 0.2f * Mathf.PerlinNoise(Time.unscaledTime * 6f, (float)sign2.Key); if (((TMP_Text)value.Text).text != text) { ((TMP_Text)value.Text).text = text; } } } } private static int TradingWith(Player p) { object obj = ((p != null) ? p.CustomProperties[(object)"skintrade.with"] : null); if (obj is int) { return (int)obj; } return 0; } private void Publish() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown if (_publishedRoom == PhotonNetwork.CurrentRoom) { return; } Player localPlayer = PhotonNetwork.LocalPlayer; if (localPlayer != null) { _publishedRoom = PhotonNetwork.CurrentRoom; _hintShown = false; _hintReadySince = -1f; Hashtable val = new Hashtable { [(object)"overtime.ver"] = "1.0.0" }; if (_turnedOff) { val[(object)"skintrade.off"] = true; } localPlayer.SetCustomProperties(val, (Hashtable)null, (WebFlags)null); } } private static Version ParseVersion(object v) { try { return (v is string version) ? new Version(version) : null; } catch { return null; } } private void UpdateVersionHint() { if (_versionRoom == PhotonNetwork.CurrentRoom) { return; } Version version = ParseVersion("1.0.0"); bool flag = false; Player[] playerListOthers = PhotonNetwork.PlayerListOthers; foreach (Player obj in playerListOthers) { Version version2 = ParseVersion((obj != null) ? obj.CustomProperties[(object)"overtime.ver"] : null); if (version != null && version2 != null && version2 > version) { flag = true; break; } } if (!flag || Game.RunIsLevel() || Game.MenuOpen() || PhotonNetwork.LocalPlayer == null || !((Object)(object)Game.AvatarOf(PhotonNetwork.LocalPlayer.ActorNumber) != (Object)null)) { _versionSince = -1f; return; } if (_versionSince < 0f) { _versionSince = Time.unscaledTime; } if (!(Time.unscaledTime - _versionSince < 4f)) { _versionRoom = PhotonNetwork.CurrentRoom; ShowToast("OVERTIME UPDATE AVAILABLE - UPDATE IT IN YOUR MOD MANAGER", 6f); Plugin.Log.LogInfo((object)"Someone in this lobby has a newer Overtime version - update hint shown."); } } private static int GrabOf(Player p) { object obj = ((p != null) ? p.CustomProperties[(object)"skintrade.grab"] : null); if (obj is int) { return (int)obj; } return 0; } private static bool HasSkinTrade(Player p) { if (p != null) { return ((Dictionary<object, object>)(object)p.CustomProperties).ContainsKey((object)"skintrade.ver"); } return false; } private void UpdateReach() { if (Reach.Disabled) { return; } Player localPlayer = PhotonNetwork.LocalPlayer; int num = ((localPlayer != null) ? localPlayer.ActorNumber : 0); int num2 = 0; Player[] playerListOthers = PhotonNetwork.PlayerListOthers; foreach (Player val in playerListOthers) { if (!HasSkinTrade(val)) { continue; } int num3 = GrabOf(val); if (num3 != 0) { Reach.Pose(val.ActorNumber); if (num3 == num && num2 == 0) { num2 = val.ActorNumber; } } } int num4; int num5; if (!Game.RunIsLevel() && Game.RunIsLobbyOrShop()) { num4 = ((!Game.MenuOpen()) ? 1 : 0); if (num4 != 0 && Reach.GrabHeld() && !Reach.LocalBusy()) { num5 = Reach.RightHandTarget(); goto IL_00a1; } } else { num4 = 0; } num5 = 0; goto IL_00a1; IL_00a1: int num6 = num5; object p; if (num6 == 0) { p = null; } else { Room currentRoom = PhotonNetwork.CurrentRoom; p = ((currentRoom != null) ? currentRoom.GetPlayer(num6, false) : null); } if (!HasSkinTrade((Player)p)) { num6 = 0; } if (num6 != 0) { Reach.Pose(num); } float unscaledTime = Time.unscaledTime; if (num4 == 0) { num2 = 0; } if (num2 != _wantedBy) { _wantedBy = num2; _wantedSince = unscaledTime; } if (num6 != _attemptOn) { _attemptOn = num6; _attemptSince = unscaledTime; } if (unscaledTime < _attemptHintUntil) { return; } string text = (_turnedOff ? "TURN ON" : "GET"); if (_wantedBy != 0 && unscaledTime - _wantedSince >= 0.6f) { Room currentRoom2 = PhotonNetwork.CurrentRoom; object obj; if (currentRoom2 == null) { obj = null; } else { Player player = currentRoom2.GetPlayer(_wantedBy, false); obj = ((player != null) ? player.NickName : null); } if (obj == null) { obj = "SOMEONE"; } string text2 = (string)obj; ShowToast(text2.ToUpperInvariant() + " WANTS TO TRADE - " + text + " SKINTRADE IN YOUR MOD MANAGER", 6f); _attemptHintUntil = unscaledTime + 20f; } else if (_attemptOn != 0 && unscaledTime - _attemptSince >= 0.6f) { ShowToast(_turnedOff ? "SKINTRADE IS OFF - TURN IT ON IN YOUR MOD MANAGER TO TRADE SKINS" : "GET SKINTRADE IN YOUR MOD MANAGER TO TRADE SKINS WITH YOUR CREW", 6f); _attemptHintUntil = unscaledTime + 20f; } } private static bool SkinTradeInRoom() { Player[] playerListOthers = PhotonNetwork.PlayerListOthers; foreach (Player val in playerListOthers) { if (val != null && ((Dictionary<object, object>)(object)val.CustomProperties).ContainsKey((object)"skintrade.ver")) { return true; } } return false; } private void UpdateHint() { if (_hintShown) { return; } if (PhotonNetwork.OfflineMode || PhotonNetwork.PlayerListOthers.Length == 0 || Game.RunIsLevel() || !Game.RunIsLobbyOrShop() || Game.MenuOpen() || PhotonNetwork.LocalPlayer == null || !((Object)(object)Game.AvatarOf(PhotonNetwork.LocalPlayer.ActorNumber) != (Object)null) || !SkinTradeInRoom()) { _hintReadySince = -1f; return; } if (_hintReadySince < 0f) { _hintReadySince = Time.unscaledTime; } if (!(Time.unscaledTime - _hintReadySince < 4f)) { _hintShown = true; ShowToast(_turnedOff ? "SKINTRADE IS OFF - TURN IT ON IN YOUR MOD MANAGER TO TRADE SKINS" : "GET SKINTRADE IN YOUR MOD MANAGER TO TRADE SKINS WITH YOUR CREW"); } } private void ShowToast(string text, float time = 10f) { //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0382: 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_001c: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_00d4: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0197: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: 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_01bf: 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_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: 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_01d1: 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_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Expected O, but got Unknown //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_026c: 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_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0295: 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) if ((Object)(object)_toastCanvas == (Object)null) { GameObject val = new GameObject("OvertimeSkinTradeHint"); Object.DontDestroyOnLoad((Object)(object)val); _toastCanvas = val.AddComponent<Canvas>(); _toastCanvas.renderMode = (RenderMode)0; _toastCanvas.sortingOrder = 31001; CanvasScaler obj = val.AddComponent<CanvasScaler>(); obj.uiScaleMode = (ScaleMode)1; obj.referenceResolution = new Vector2(1920f, 1080f); obj.matchWidthOrHeight = 1f; GameObject val2 = new GameObject("ToastPanel", new Type[1] { typeof(RectTransform) }); _toastPanel = (RectTransform)val2.transform; ((Transform)_toastPanel).SetParent(val.transform, false); RectTransform toastPanel = _toastPanel; RectTransform toastPanel2 = _toastPanel; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 1f); toastPanel2.anchorMax = val3; toastPanel.anchorMin = val3; _toastPanel.pivot = new Vector2(0.5f, 0.5f); _toastPanel.anchoredPosition = new Vector2(0f, -308f); _toastPanel.sizeDelta = new Vector2(600f, 84f); _toastPanelGroup = val2.AddComponent<CanvasGroup>(); _toastPanelGroup.blocksRaycasts = false; _toastPanelGroup.interactable = false; Image obj2 = val2.AddComponent<Image>(); obj2.sprite = UiSprites.RoundedFill(14); obj2.type = (Type)1; ((Graphic)obj2).color = PanelColor; ((Graphic)obj2).raycastTarget = false; GameObject val4 = new GameObject("Frame", new Type[1] { typeof(RectTransform) }); RectTransform val5 = (RectTransform)val4.transform; ((Transform)val5).SetParent((Transform)(object)_toastPanel, false); val5.anchorMin = Vector2.zero; val5.anchorMax = Vector2.one; val3 = (val5.offsetMin = (val5.offsetMax = Vector2.zero)); Image obj3 = val4.AddComponent<Image>(); obj3.sprite = UiSprites.RoundedBorder(14, 3); obj3.type = (Type)1; ((Graphic)obj3).color = FrameColor; ((Graphic)obj3).raycastTarget = false; GameObject val7 = new GameObject("Toast", new Type[1] { typeof(RectTransform) }); RectTransform val8 = (RectTransform)val7.transform; ((Transform)val8).SetParent(val.transform, false); ((Vector2)(ref val3))..ctor(0.5f, 1f); val8.anchorMax = val3; val8.anchorMin = val3; val8.pivot = new Vector2(0.5f, 0.5f); val8.anchoredPosition = new Vector2(0f, -308f); val8.sizeDelta = new Vector2(1600f, 70f); _toast = val7.AddComponent<TextMeshProUGUI>(); TMP_FontAsset val9 = Game.Font() ?? TMP_Settings.defaultFontAsset; if ((Object)(object)val9 != (Object)null) { ((TMP_Text)_toast).font = val9; } ((TMP_Text)_toast).fontSize = 38f; ((Graphic)_toast).color = SoftYellow; ((TMP_Text)_toast).alignment = (TextAlignmentOptions)514; ((TMP_Text)_toast).fontStyle = (FontStyles)1; ((TMP_Text)_toast).textWrappingMode = (TextWrappingModes)0; ((TMP_Text)_toast).overflowMode = (TextOverflowModes)0; ((Graphic)_toast).raycastTarget = false; ((TMP_Text)_toast).characterSpacing = 2f; SoftShadow((TMP_Text)(object)_toast); } ((TMP_Text)_toast).text = text; _toastPanel.sizeDelta = new Vector2(Mathf.Min(1560f, ((TMP_Text)_toast).GetPreferredValues(text).x + 80f), 84f); ((TMP_Text)_toast).maxVisibleCharacters = 0; _toastAt = Time.unscaledTime; _toastUntil = _toastAt + (float)text.Length / 42f + time; } private void UpdateToast() { //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_toast == (Object)null)) { float unscaledTime = Time.unscaledTime; float num = _toastUntil - unscaledTime; float num2 = unscaledTime - _toastAt; bool flag = num > 0f && !Game.MenuOpen() && PhotonNetwork.InRoom; ((Component)_toast).gameObject.SetActive(flag); ((Component)_toastPanel).gameObject.SetActive(flag); if (flag) { ((TMP_Text)_toast).maxVisibleCharacters = Mathf.Clamp(Mathf.FloorToInt(num2 * 42f), 0, ((TMP_Text)_toast).text.Length); ((TMP_Text)_toast).alpha = Mathf.SmoothStep(0f, 1f, num2 / 0.15f) * Mathf.SmoothStep(0f, 1f, Mathf.Min(num, 10f) / 0.6f); float num3 = Game.Spring(num2, 0.3f); _toastPanelGroup.alpha = ((TMP_Text)_toast).alpha; ((Transform)_toastPanel).localScale = Vector3.one * num3; ((TMP_Text)_toast).transform.localScale = Vector3.one * num3; } } } private static void SoftShadow(TMP_Text t) { //IL_0016: 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) try { t.outlineWidth = 0.08f; t.outlineColor = new Color32((byte)28, (byte)12, (byte)0, (byte)200); Material fontMaterial = t.fontMaterial; fontMaterial.EnableKeyword(ShaderUtilities.Keyword_Underlay); fontMaterial.SetColor(ShaderUtilities.ID_UnderlayColor, new Color(0.05f, 0.02f, 0f, 0.85f)); fontMaterial.SetFloat(ShaderUtilities.ID_UnderlaySoftness, 0.85f); fontMaterial.SetFloat(ShaderUtilities.ID_UnderlayDilate, 0.45f); fontMaterial.SetFloat("_UnderlayOffsetX", 0f); fontMaterial.SetFloat("_UnderlayOffsetY", -0.25f); t.extraPadding = true; } catch { } } private Sign CreateSign() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_005e: 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) GameObject val = new GameObject("SkinTradeSign"); Object.DontDestroyOnLoad((Object)(object)val); TextMeshPro val2 = val.AddComponent<TextMeshPro>(); TMP_FontAsset val3 = Game.Font(); if ((Object)(object)val3 != (Object)null) { ((TMP_Text)val2).font = val3; } ((TMP_Text)val2).text = TradingText(); ((TMP_Text)val2).richText = true; ((TMP_Text)val2).fontSize = 2.4f; ((TMP_Text)val2).fontStyle = (FontStyles)1; ((TMP_Text)val2).alignment = (TextAlignmentOptions)514; ((Graphic)val2).color = SignColor; ((TMP_Text)val2).characterSpacing = 6f; ((TMP_Text)val2).textWrappingMode = (TextWrappingModes)0; try { ((TMP_Text)val2).outlineWidth = 0.25f; ((TMP_Text)val2).outlineColor = new Color32((byte)28, (byte)12, (byte)0, byte.MaxValue); } catch { } return new Sign { Root = val, Text = val2 }; } private Cheer CreateCheer(int actor) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0041: 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_0133: 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_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("SkinTradeCheer"); Object.DontDestroyOnLoad((Object)(object)val); Cheer cheer = new Cheer { Actor = actor, At = Time.unscaledTime, Root = val }; cheer.Text = MakeText(val.transform, "DEAL!", 3.6f, CheerColor); ((TMP_Text)cheer.Text).characterSpacing = 4f; for (int i = 0; i < 26; i++) { Color color = ConfettiColors[_rng.Next(ConfettiColors.Length)]; TextMeshPro val2 = MakeText(val.transform, (_rng.Next(3) == 0) ? "-" : "I", 1.1f + (float)_rng.NextDouble() * 0.6f, color); try { ((TMP_Text)val2).outlineWidth = 0f; } catch { } float num = (float)(_rng.NextDouble() * 3.1415927410125732 * 2.0); float num2 = 1.4f + (float)_rng.NextDouble() * 1.6f; cheer.Bits.Add(new Bit { T = val2.transform, Text = val2, Color = color, Pos = new Vector3(0f, 0.1f, 0f), Vel = new Vector3(Mathf.Cos(num) * num2 * 0.8f, 1.6f + Mathf.Abs(Mathf.Sin(num)) * num2, ((float)_rng.NextDouble() - 0.5f) * 0.6f), Spin = ((float)_rng.NextDouble() - 0.5f) * 900f, Angle = (float)_rng.NextDouble() * 360f, Flutter = 8f + (float)_rng.NextDouble() * 10f, Phase = (float)_rng.NextDouble() * 6f }); } return cheer; } private static TextMeshPro MakeText(Transform parent, string text, float size, Color color) { //IL_0005: 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_0054: 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) GameObject val = new GameObject("Text"); val.transform.SetParent(parent, false); TextMeshPro val2 = val.AddComponent<TextMeshPro>(); TMP_FontAsset val3 = Game.Font(); if ((Object)(object)val3 != (Object)null) { ((TMP_Text)val2).font = val3; } ((TMP_Text)val2).text = text; ((TMP_Text)val2).fontSize = size; ((TMP_Text)val2).fontStyle = (FontStyles)1; ((TMP_Text)val2).alignment = (TextAlignmentOptions)514; ((Graphic)val2).color = color; ((TMP_Text)val2).textWrappingMode = (TextWrappingModes)0; try { ((TMP_Text)val2).outlineWidth = 0.25f; ((TMP_Text)val2).outlineColor = new Color32((byte)28, (byte)12, (byte)0, byte.MaxValue); } catch { } return val2; } private void UpdateCheers(Camera cam) { //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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_017b: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: 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_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: 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_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_0210: 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_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: 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_024c: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_029f: 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) float unscaledTime = Time.unscaledTime; float num = Mathf.Min(Time.unscaledDeltaTime, 0.05f); for (int num2 = _cheers.Count - 1; num2 >= 0; num2--) { Cheer cheer = _cheers[num2]; float num3 = unscaledTime - cheer.At; Transform val = Game.AvatarOf(cheer.Actor); if (num3 > 4.2f || (Object)(object)cheer.Root == (Object)null) { if ((Object)(object)cheer.Root != (Object)null) { Object.Destroy((Object)(object)cheer.Root); } _cheers.RemoveAt(num2); } else { cheer.Root.SetActive((Object)(object)val != (Object)null); if (!((Object)(object)val == (Object)null)) { cheer.Root.transform.position = val.position + Vector3.up * 2.1f; cheer.Root.transform.rotation = Quaternion.LookRotation(cheer.Root.transform.position - ((Component)cam).transform.position); float alpha = Mathf.Clamp01((4.2f - num3) / 0.6f); cheer.Text.transform.localScale = Vector3.one * Game.Spring(num3); cheer.Text.transform.localPosition = new Vector3(0f, 0.15f * Mathf.Clamp01(num3 / 4.2f), 0f); ((TMP_Text)cheer.Text).alpha = alpha; float num4 = Mathf.Clamp01((4.2f - num3) / 1.2f); foreach (Bit bit in cheer.Bits) { bit.Vel += new Vector3(0f, -3.2f, 0f) * num; bit.Vel *= Mathf.Exp((0f - num) * 1.8f); bit.Pos += bit.Vel * num; bit.Angle += bit.Spin * num; bit.T.localPosition = bit.Pos; bit.T.localRotation = Quaternion.Euler(0f, 0f, bit.Angle); bit.T.localScale = new Vector3(Mathf.Cos(unscaledTime * bit.Flutter + bit.Phase), 1f, 1f); ((Graphic)bit.Text).color = new Color(bit.Color.r, bit.Color.g, bit.Color.b, num4); } } } } } private void Clear() { foreach (Cheer cheer in _cheers) { if ((Object)(object)cheer.Root != (Object)null) { Object.Destroy((Object)(object)cheer.Root); } } _cheers.Clear(); foreach (Sign value in _signs.Values) { if ((Object)(object)value.Root != (Object)null) { Object.Destroy((Object)(object)value.Root); } } _signs.Clear(); } } internal static class UiSprites { private static readonly Dictionary<string, Sprite> _sprites = new Dictionary<string, Sprite>(); private static float RoundedRectSdf(float x, float y, float w, float h, float radius) { //IL_004a: 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) float num = Mathf.Abs(x - w / 2f) - (w / 2f - radius); float num2 = Mathf.Abs(y - h / 2f) - (h / 2f - radius); Vector2 val = new Vector2(Mathf.Max(num, 0f), Mathf.Max(num2, 0f)); float magnitude = ((Vector2)(ref val)).magnitude; float num3 = Mathf.Min(Mathf.Max(num, num2), 0f); return magnitude + num3 - radius; } private static Sprite Build(string key, int radius, int thickness) { //IL_0024: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) if (_sprites.TryGetValue(key, out var value) && (Object)(object)value != (Object)null) { return value; } int num = radius * 2 + 8; Texture2D val = new Texture2D(num, num, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; Color32[] array = (Color32[])(object)new Color32[num * num]; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num2 = RoundedRectSdf((float)j + 0.5f, (float)i + 0.5f, num, num, radius); float num3 = Mathf.Clamp01(0.5f - num2); if (thickness > 0) { num3 *= Mathf.Clamp01(num2 + (float)thickness + 0.5f); } array[i * num + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num3 * 255f)); } } val.SetPixels32(array); val.Apply(); float num4 = radius + 2; return _sprites[key] = Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4(num4, num4, num4, num4)); } internal static Sprite RoundedFill(int radius) { return Build("fill" + radius, radius, 0); } internal static Sprite RoundedBorder(int radius, int thickness) { return Build($"border{radius}_{thickness}", radius, thickness); } } }