using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using System.Threading;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.IL2CPP;
using BepInEx.IL2CPP.Utils.Collections;
using CrabDevKit.Intermediary;
using CrabDevKit.Utilities;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using SteamworksNative;
using UnhollowerBaseLib;
using UnhollowerRuntimeLib;
using UnityEngine;
using UnityEngine.UI;
[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("SereinLiteVisualsMenu")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Create a server on Awake")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("SereinLiteVisualsMenu")]
[assembly: AssemblyTitle("SereinLiteVisualsMenu")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace SereinLiteVisualsMenu
{
public static class PluginInfo
{
public const string PLUGIN_GUID = "SereinLiteVisualsMenu";
public const string PLUGIN_NAME = "SereinLiteVisualsMenu";
public const string PLUGIN_VERSION = "1.1.0";
}
}
namespace SereinLiteMod
{
[BepInPlugin("Serein.Lite", "Serein Lite (Visuals)", "1.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class SereinLitePlugin : BasePlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static MessageHandler <>9__14_0;
internal void <RegisterNetworkHandlers>b__14_0(ulong senderId, ObjectPublicIDisposableLi1ByInByBoUnique packet)
{
bool active = PacketExtensions.ReadBool(packet, true);
int type = 1;
try
{
if (PacketExtensions.UnreadLength(packet) >= 4)
{
type = PacketExtensions.ReadInt(packet, true);
}
}
catch
{
}
MarkerManager.SetMarker(senderId, active, type);
}
}
public static SereinLitePlugin Instance;
public static GameObject __MenuObject;
public static bool HasCrabNet;
public static ConfigEntry<KeyCode> ConfigMenuKey;
public static ConfigEntry<bool> ConfigEnableTrail;
public static ConfigEntry<string> ConfigTrailColor;
public static ConfigEntry<bool> ConfigEnableJumpRing;
public static ConfigEntry<string> ConfigJumpRingColor;
public static ConfigEntry<bool> ConfigEnableAura;
public static ConfigEntry<string> ConfigAuraColor;
public static ConfigEntry<bool> ConfigAuraDrag;
public static ConfigEntry<bool> ConfigShareVisuals;
public static ConfigEntry<bool> ConfigShowMarker;
public override void Load()
{
//IL_018e: 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_01bc: 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_01e8: 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_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
HasCrabNet = ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.ContainsKey("lammas123.CrabDevKit");
Utility.Log(HasCrabNet ? "CrabDevKit detected." : "CrabDevKit NOT detected.");
ConfigMenuKey = ((BasePlugin)this).Config.Bind<KeyCode>("General", "MenuKey", (KeyCode)277, "Key to toggle the menu.");
ConfigEnableTrail = ((BasePlugin)this).Config.Bind<bool>("Visuals", "EnableTrail", false, "Enable player movement trail");
ConfigTrailColor = ((BasePlugin)this).Config.Bind<string>("Visuals", "TrailColor", "#00FFFF", "Trail color in Hex");
ConfigEnableJumpRing = ((BasePlugin)this).Config.Bind<bool>("Visuals", "EnableJumpRing", true, "Enable jump ripple effect");
ConfigJumpRingColor = ((BasePlugin)this).Config.Bind<string>("Visuals", "JumpRingColor", "#000000", "Jump ring color in Hex");
ConfigEnableAura = ((BasePlugin)this).Config.Bind<bool>("Visuals", "EnableAura", false, "Enable particle aura");
ConfigAuraColor = ((BasePlugin)this).Config.Bind<string>("Visuals", "AuraColor", "#00FFFF", "Aura color in Hex");
ConfigAuraDrag = ((BasePlugin)this).Config.Bind<bool>("Visuals", "AuraDrag", true, "Particles trail behind movement");
ConfigShareVisuals = ((BasePlugin)this).Config.Bind<bool>("Visuals", "ShareVisuals", true, "Share your Trail/Aura/Rings with other mod users.");
ConfigShowMarker = ((BasePlugin)this).Config.Bind<bool>("Visuals", "ShowMarker", true, "Show marker on other mod users.");
Variables.menuKey = ConfigMenuKey.Value;
VisualsManager.enableTrail = ConfigEnableTrail.Value;
Color trailColor = default(Color);
if (ColorUtility.TryParseHtmlString(ConfigTrailColor.Value, ref trailColor))
{
VisualsManager.TrailColor = trailColor;
}
VisualsManager.enableJumpRing = ConfigEnableJumpRing.Value;
Color jumpRingColor = default(Color);
if (ColorUtility.TryParseHtmlString(ConfigJumpRingColor.Value, ref jumpRingColor))
{
VisualsManager.JumpRingColor = jumpRingColor;
}
AuraManager.enabled = ConfigEnableAura.Value;
AuraManager.enableDrag = ConfigAuraDrag.Value;
Color auraColor = default(Color);
if (ColorUtility.TryParseHtmlString(ConfigAuraColor.Value, ref auraColor))
{
AuraManager.AuraColor = auraColor;
}
NetworkVisualsManager.ShareVisuals = ConfigShareVisuals.Value;
if (HasCrabNet)
{
RegisterNetworkHandlers();
NetworkVisualsManager.Init();
}
ClassInjector.RegisterTypeInIl2Cpp<SereinNotification>();
ClassInjector.RegisterTypeInIl2Cpp<MenuManager>();
ClassInjector.RegisterTypeInIl2Cpp<Draggable>();
ClassInjector.RegisterTypeInIl2Cpp<RemoteVisualsBehavior>();
Harmony.CreateAndPatchAll(typeof(SereinLitePlugin), (string)null);
Harmony.CreateAndPatchAll(typeof(JumpVisualPatch), (string)null);
Utility.CreateFolder(Variables.mainFolderPath);
Utility.CreateFile(Variables.logFilePath);
Utility.Log("Serein Lite Loaded.");
}
private void RegisterNetworkHandlers()
{
//IL_001a: 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_0025: Expected O, but got Unknown
object obj = <>c.<>9__14_0;
if (obj == null)
{
MessageHandler val = delegate(ulong senderId, ObjectPublicIDisposableLi1ByInByBoUnique packet)
{
bool active = PacketExtensions.ReadBool(packet, true);
int type = 1;
try
{
if (PacketExtensions.UnreadLength(packet) >= 4)
{
type = PacketExtensions.ReadInt(packet, true);
}
}
catch
{
}
MarkerManager.SetMarker(senderId, active, type);
};
<>c.<>9__14_0 = val;
obj = (object)val;
}
CrabNet.RegisterMessageHandler("Serein:Marker", (MessageHandler)obj);
}
[HarmonyPatch(typeof(MonoBehaviourPublicGaroloGaObInCacachGaUnique), "Awake")]
[HarmonyPostfix]
public static void UIAwakePatch(MonoBehaviourPublicGaroloGaObInCacachGaUnique __instance)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Expected O, but got Unknown
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: 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_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Expected O, but got Unknown
if (!((Object)(object)__MenuObject != (Object)null))
{
GameObject val = new GameObject("SereinLite_UI");
val.transform.SetParent(((Component)__instance).transform, false);
RectTransform val2 = val.AddComponent<RectTransform>();
val2.anchorMin = new Vector2(0.5f, 0.5f);
val2.anchorMax = new Vector2(0.5f, 0.5f);
val2.pivot = new Vector2(0.5f, 0.5f);
val2.anchoredPosition = Vector2.zero;
val2.sizeDelta = new Vector2(500f, 600f);
Image val3 = val.AddComponent<Image>();
((Graphic)val3).color = new Color(0.05f, 0.05f, 0.05f, 0.95f);
val.AddComponent<Draggable>();
GameObject val4 = new GameObject("MainText");
val4.transform.SetParent(val.transform, false);
Text val5 = val4.AddComponent<Text>();
val5.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
val5.fontSize = 18;
val5.fontStyle = (FontStyle)1;
val5.supportRichText = true;
((Graphic)val5).raycastTarget = false;
val5.alignment = (TextAnchor)0;
val5.horizontalOverflow = (HorizontalWrapMode)1;
val5.verticalOverflow = (VerticalWrapMode)1;
val5.lineSpacing = 1.1f;
((Graphic)val5).color = Color.white;
RectTransform component = val4.GetComponent<RectTransform>();
component.anchorMin = Vector2.zero;
component.anchorMax = Vector2.one;
component.sizeDelta = new Vector2(-40f, -40f);
Outline val6 = val4.AddComponent<Outline>();
((Shadow)val6).effectDistance = new Vector2(1f, -1f);
((Shadow)val6).effectColor = Color.black;
MenuManager menuManager = val.AddComponent<MenuManager>();
menuManager.menuText = val5;
__MenuObject = val;
GlobalStatsManager.Init();
GameObject val7 = new GameObject("Serein_Notification");
val7.transform.SetParent(((Component)__instance).transform, false);
val7.AddComponent<SereinNotification>();
}
}
}
public static class GlobalStatsManager
{
private const string SERVER_URL = "https://muddy-dew-f2cc.gaaasssdddfff11122.workers.dev";
public static int OnlineUsers = 1;
private static bool _isRunning = false;
public static void Init()
{
if (!_isRunning)
{
_isRunning = true;
Thread thread = new Thread(HeartbeatLoop);
thread.IsBackground = true;
thread.Start();
}
}
private static void HeartbeatLoop()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
while (_isRunning)
{
try
{
ulong num = 0uL;
if ((Object)(object)MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance != (Object)null)
{
num = MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance.field_Private_CSteamID_0.m_SteamID;
}
if (num != 0)
{
string requestUriString = string.Format("{0}?id={1}", "https://muddy-dew-f2cc.gaaasssdddfff11122.workers.dev", num);
HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(requestUriString);
httpWebRequest.Method = "GET";
httpWebRequest.UserAgent = "SereinMod/1.0";
httpWebRequest.Timeout = 5000;
using HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using StreamReader streamReader = new StreamReader(httpWebResponse.GetResponseStream());
string s = streamReader.ReadToEnd();
if (int.TryParse(s, out var result))
{
OnlineUsers = result;
}
}
}
catch
{
}
Thread.Sleep(60000);
}
}
}
public class MenuManager : MonoBehaviour
{
public Text menuText;
public static int selectedIndex;
private List<MenuButton> _page1;
private float _syncTimer = 0f;
public MenuManager(IntPtr ptr)
: base(ptr)
{
}
private void Start()
{
_page1 = MenuUtility.BuildPage1();
RefreshDisplay();
if (!Variables.menuTrigger)
{
((Behaviour)((Component)this).GetComponent<Image>()).enabled = false;
((Behaviour)menuText).enabled = false;
}
}
private void Update()
{
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
VisualsManager.Update();
NetworkVisualsManager.Update();
AuraManager.Update();
if (SereinLitePlugin.HasCrabNet)
{
MarkerManager.Update();
_syncTimer += Time.deltaTime;
if (_syncTimer >= 5f)
{
_syncTimer = 0f;
ObjectPublicIDisposableLi1ByInByBoUnique val = new ObjectPublicIDisposableLi1ByInByBoUnique();
PacketExtensions.Write(val, true);
PacketExtensions.Write(val, 2);
CrabNet.SendMessage("Serein:Marker", val, Utility.GetAllLobbyMembers());
}
}
if (Input.GetKeyDown(Variables.menuKey))
{
Variables.menuTrigger = !Variables.menuTrigger;
ToggleCursor(Variables.menuTrigger);
((Behaviour)((Component)this).GetComponent<Image>()).enabled = Variables.menuTrigger;
((Behaviour)menuText).enabled = Variables.menuTrigger;
}
if (Variables.menuTrigger)
{
HandleNavigation();
HandleInteraction();
RenderMenu();
}
}
public void RefreshDisplay()
{
if (Variables.menuTrigger)
{
RenderMenu();
}
}
private void HandleNavigation()
{
float axis = Input.GetAxis("Mouse ScrollWheel");
if (axis > 0f)
{
selectedIndex = (selectedIndex - 1 + _page1.Count) % _page1.Count;
}
else if (axis < 0f)
{
selectedIndex = (selectedIndex + 1) % _page1.Count;
}
}
private void HandleInteraction()
{
MenuButton menuButton = _page1[selectedIndex];
if (Input.GetMouseButtonDown(0))
{
menuButton.Action?.Invoke();
}
}
private void RenderMenu()
{
IEnumerable<string> values = _page1.Select((MenuButton btn, int index) => btn.GetFormattedLabel(index == selectedIndex));
menuText.text = MenuConstants.HEADER + "\n" + string.Join("\n", values);
}
private void ToggleCursor(bool enable)
{
Cursor.lockState = (CursorLockMode)((!enable) ? 1 : 0);
Cursor.visible = enable;
}
}
public class MenuUtility
{
private static MenuButton CreateBtn(string label, Action action, Func<string> status)
{
return new MenuButton(label, action, status);
}
public static List<MenuButton> BuildPage1()
{
List<MenuButton> list = new List<MenuButton>();
list.Add(new MenuButton("=== Serein Lite (Visuals Only) ==="));
list.Add(new MenuButton("----------------"));
list.Add(CreateBtn("移动拖尾 (Trail)", delegate
{
VisualsManager.enableTrail = !VisualsManager.enableTrail;
SereinLitePlugin.ConfigEnableTrail.Value = VisualsManager.enableTrail;
((BasePlugin)SereinLitePlugin.Instance).Config.Save();
NetworkVisualsManager.SendState();
Utility.ForceMessage(VisualsManager.enableTrail ? "Trail ON" : "Trail OFF");
}, () => VisualsManager.enableTrail ? "<color=green>[ ON ]</color>" : "<color=red>[ OFF ]</color>"));
list.Add(CreateBtn(" -> 切换拖尾颜色", delegate
{
//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_000b: 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)
VisualsManager.TrailColor = CycleColor(VisualsManager.TrailColor);
SereinLitePlugin.ConfigTrailColor.Value = "#" + ColorUtility.ToHtmlStringRGB(VisualsManager.TrailColor);
((BasePlugin)SereinLitePlugin.Instance).Config.Save();
}, () => "[ <color=#" + ColorUtility.ToHtmlStringRGB(VisualsManager.TrailColor) + ">COLOR</color> ]"));
list.Add(CreateBtn("跳跃波纹 (Jump Ring)", delegate
{
VisualsManager.enableJumpRing = !VisualsManager.enableJumpRing;
SereinLitePlugin.ConfigEnableJumpRing.Value = VisualsManager.enableJumpRing;
((BasePlugin)SereinLitePlugin.Instance).Config.Save();
}, () => VisualsManager.enableJumpRing ? "<color=green>[ ON ]</color>" : "<color=red>[ OFF ]</color>"));
list.Add(CreateBtn(" -> 切换波纹颜色", delegate
{
//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_000b: 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)
VisualsManager.JumpRingColor = CycleColor(VisualsManager.JumpRingColor);
SereinLitePlugin.ConfigJumpRingColor.Value = "#" + ColorUtility.ToHtmlStringRGB(VisualsManager.JumpRingColor);
((BasePlugin)SereinLitePlugin.Instance).Config.Save();
}, () => "[ <color=#" + ColorUtility.ToHtmlStringRGB(VisualsManager.JumpRingColor) + ">COLOR</color> ]"));
list.Add(CreateBtn("光环 (Aura)", delegate
{
AuraManager.enabled = !AuraManager.enabled;
SereinLitePlugin.ConfigEnableAura.Value = AuraManager.enabled;
((BasePlugin)SereinLitePlugin.Instance).Config.Save();
NetworkVisualsManager.SendState();
}, () => AuraManager.enabled ? "<color=green>[ ON ]</color>" : "<color=red>[ OFF ]</color>"));
list.Add(CreateBtn(" -> 动态跟随 (Inertia)", delegate
{
AuraManager.enableDrag = !AuraManager.enableDrag;
}, () => AuraManager.enableDrag ? "<color=green>[ ON ]</color>" : "<color=red>[ OFF ]</color>"));
list.Add(CreateBtn(" -> 切换光环颜色", delegate
{
//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_000b: 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)
AuraManager.AuraColor = CycleColor(AuraManager.AuraColor);
SereinLitePlugin.ConfigAuraColor.Value = "#" + ColorUtility.ToHtmlStringRGB(AuraManager.AuraColor);
((BasePlugin)SereinLitePlugin.Instance).Config.Save();
}, () => "[ <color=#" + ColorUtility.ToHtmlStringRGB(AuraManager.AuraColor) + ">COLOR</color> ]"));
list.Add(CreateBtn("共享视觉效果 (Share Visuals)", delegate
{
NetworkVisualsManager.ShareVisuals = !NetworkVisualsManager.ShareVisuals;
SereinLitePlugin.ConfigShareVisuals.Value = NetworkVisualsManager.ShareVisuals;
((BasePlugin)SereinLitePlugin.Instance).Config.Save();
NetworkVisualsManager.SendState(NetworkVisualsManager.ShareVisuals);
}, () => NetworkVisualsManager.ShareVisuals ? "<color=green>[ ON ]</color>" : "<color=red>[ OFF ]</color>"));
list.Add(new MenuButton("----------------"));
list.Add(CreateBtn("显示头顶标记 (Net Marker)", delegate
{
Utility.ForceMessage("Net Marker is Always ON (Lite Version)");
}, () => SereinLitePlugin.HasCrabNet ? "<color=green>[ ALWAYS ON ]</color>" : "<color=red>[ No API ]</color>"));
return list;
}
private static Color CycleColor(Color c)
{
//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_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: 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_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: 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_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
if (c == Color.cyan)
{
return Color.red;
}
if (c == Color.red)
{
return Color.green;
}
if (c == Color.green)
{
return Color.yellow;
}
if (c == Color.yellow)
{
return new Color(1f, 0f, 1f);
}
if (c == new Color(1f, 0f, 1f))
{
return Color.white;
}
return Color.cyan;
}
}
public static class MarkerManager
{
public static HashSet<ulong> MarkedPlayers = new HashSet<ulong>();
private static Dictionary<ulong, int> _playerTypes = new Dictionary<ulong, int>();
private static Dictionary<ulong, GameObject> _markers = new Dictionary<ulong, GameObject>();
public static void SetMarker(ulong steamId, bool active, int type = 1)
{
if (active)
{
if (!MarkedPlayers.Contains(steamId))
{
MarkedPlayers.Add(steamId);
}
if (_playerTypes.ContainsKey(steamId))
{
_playerTypes[steamId] = type;
}
else
{
_playerTypes.Add(steamId, type);
}
if (_markers.ContainsKey(steamId) && (Object)(object)_markers[steamId] != (Object)null)
{
RemoveMarkerObj(steamId, fullRemove: false);
}
}
else
{
if (MarkedPlayers.Contains(steamId))
{
MarkedPlayers.Remove(steamId);
}
RemoveMarkerObj(steamId, fullRemove: true);
}
}
public static void Update()
{
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)MonoBehaviourPublicDi2UIObacspDi2UIObUnique.Instance == (Object)null || MonoBehaviourPublicDi2UIObacspDi2UIObUnique.Instance.activePlayers == null)
{
return;
}
foreach (ulong markedPlayer in MarkedPlayers)
{
if (!MonoBehaviourPublicDi2UIObacspDi2UIObUnique.Instance.activePlayers.ContainsKey(markedPlayer))
{
continue;
}
MonoBehaviourPublicCSstReshTrheObplBojuUnique val = MonoBehaviourPublicDi2UIObacspDi2UIObUnique.Instance.activePlayers[markedPlayer];
if ((Object)(object)val == (Object)null || val.dead)
{
RemoveMarkerObj(markedPlayer, fullRemove: false);
continue;
}
if (!_markers.ContainsKey(markedPlayer) || (Object)(object)_markers[markedPlayer] == (Object)null)
{
int type = ((!_playerTypes.ContainsKey(markedPlayer)) ? 1 : _playerTypes[markedPlayer]);
CreateMarkerObj(markedPlayer, type);
}
if (_markers.TryGetValue(markedPlayer, out var value) && !((Object)(object)((Component)val).transform == (Object)null))
{
value.transform.position = ((Component)val).transform.position + Vector3.up * 3.5f;
if (Object.op_Implicit((Object)(object)Camera.main))
{
value.transform.LookAt(((Component)Camera.main).transform);
}
value.transform.Rotate(0f, 180f, 0f);
}
}
}
private static void CreateMarkerObj(ulong id, int type)
{
//IL_0046: 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_0078: Expected O, but got Unknown
//IL_008a: 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)
GameObject val = GameObject.CreatePrimitive((PrimitiveType)0);
((Object)val).name = $"Marker_{id}_T{type}";
Object.Destroy((Object)(object)val.GetComponent<Collider>());
val.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
Renderer component = val.GetComponent<Renderer>();
if (Object.op_Implicit((Object)(object)component))
{
component.material = new Material(Shader.Find("Sprites/Default"));
component.material.color = ((type == 2) ? Color.red : Color.cyan);
}
_markers[id] = val;
}
private static void RemoveMarkerObj(ulong id, bool fullRemove)
{
if (_markers.ContainsKey(id))
{
if ((Object)(object)_markers[id] != (Object)null)
{
Object.Destroy((Object)(object)_markers[id]);
}
_markers.Remove(id);
}
if (fullRemove && _playerTypes.ContainsKey(id))
{
_playerTypes.Remove(id);
}
}
}
public static class VisualsManager
{
[CompilerGenerated]
private sealed class <AnimateRing>d__11 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public GameObject ring;
public Material mat;
private float <timer>5__1;
private float <duration>5__2;
private Vector3 <startScale>5__3;
private Vector3 <endScale>5__4;
private float <t>5__5;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <AnimateRing>d__11(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//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_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_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<timer>5__1 = 0f;
<duration>5__2 = 2f;
<startScale>5__3 = ring.transform.localScale;
<endScale>5__4 = new Vector3(12f, 12f, 1f);
break;
case 1:
<>1__state = -1;
break;
}
if (<timer>5__1 < <duration>5__2)
{
if ((Object)(object)ring == (Object)null)
{
return false;
}
<t>5__5 = <timer>5__1 / <duration>5__2;
ring.transform.localScale = Vector3.Lerp(<startScale>5__3, <endScale>5__4, <t>5__5);
mat.color = new Color(1f, 1f, 1f, Mathf.Lerp(1f, 0f, Mathf.Sqrt(<t>5__5)));
<timer>5__1 += Time.deltaTime;
<>2__current = null;
<>1__state = 1;
return true;
}
if ((Object)(object)ring != (Object)null)
{
Object.Destroy((Object)(object)ring);
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public static bool enableTrail = false;
public static bool enableJumpRing = false;
public static Color TrailColor = Color.cyan;
public static Color JumpRingColor = Color.black;
private static TrailRenderer _currentTrail;
private static MonoBehaviourPublicGaplfoGaTrorplTrRiBoUnique _localPlayer;
private static Texture2D _jumpRingTexture;
private static Color _lastJumpRingColor;
public static void Update()
{
if ((Object)(object)_localPlayer == (Object)null)
{
_localPlayer = Object.FindObjectOfType<MonoBehaviourPublicGaplfoGaTrorplTrRiBoUnique>();
}
else
{
HandleTrail();
}
}
public static void SpawnJumpEffect(Vector3 position)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Expected O, but got Unknown
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
if (enableJumpRing && !((Object)(object)_localPlayer == (Object)null))
{
GameObject val = GameObject.CreatePrimitive((PrimitiveType)5);
((Object)val).name = "JumpRing";
val.transform.position = position + new Vector3(0f, 0.05f, 0f);
val.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
val.transform.localScale = new Vector3(1.3f, 1.3f, 1.3f);
Object.Destroy((Object)(object)val.GetComponent<Collider>());
Renderer component = val.GetComponent<Renderer>();
component.material = new Material(Shader.Find("Sprites/Default"));
component.material.mainTexture = (Texture)(object)GetJumpRingTexture();
component.material.color = Color.white;
((MonoBehaviour)_localPlayer).StartCoroutine(CollectionExtensions.WrapToIl2Cpp(AnimateRing(val, component.material)));
}
}
public static void SpawnRemoteJumpEffect(Vector3 position, Color color)
{
//IL_001a: 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_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
//IL_00ae: 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)
GameObject val = GameObject.CreatePrimitive((PrimitiveType)5);
((Object)val).name = "RemoteJumpRing";
val.transform.position = position + new Vector3(0f, 0.05f, 0f);
val.transform.rotation = Quaternion.Euler(90f, 0f, 0f);
val.transform.localScale = new Vector3(1.3f, 1.3f, 1.3f);
Object.Destroy((Object)(object)val.GetComponent<Collider>());
Renderer component = val.GetComponent<Renderer>();
component.material = new Material(Shader.Find("Sprites/Default"));
component.material.mainTexture = (Texture)(object)CreateSoftRingTexture(256, color, 0.2f);
component.material.color = Color.white;
if ((Object)(object)_localPlayer != (Object)null)
{
((MonoBehaviour)_localPlayer).StartCoroutine(CollectionExtensions.WrapToIl2Cpp(AnimateRing(val, component.material)));
}
else
{
Object.Destroy((Object)(object)val);
}
}
[IteratorStateMachine(typeof(<AnimateRing>d__11))]
private static IEnumerator AnimateRing(GameObject ring, Material mat)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <AnimateRing>d__11(0)
{
ring = ring,
mat = mat
};
}
private static Texture2D GetJumpRingTexture()
{
//IL_000e: 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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)_jumpRingTexture == (Object)null || _lastJumpRingColor != JumpRingColor)
{
if ((Object)(object)_jumpRingTexture != (Object)null)
{
Object.Destroy((Object)(object)_jumpRingTexture);
}
_jumpRingTexture = CreateSoftRingTexture(512, JumpRingColor, 0.2f);
_lastJumpRingColor = JumpRingColor;
}
return _jumpRingTexture;
}
private static Texture2D CreateSoftRingTexture(int size, Color color, float thickness)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Expected O, but got Unknown
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = new Texture2D(size, size);
((Texture)val).wrapMode = (TextureWrapMode)1;
((Texture)val).filterMode = (FilterMode)2;
Color[] array = (Color[])(object)new Color[size * size];
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor((float)size / 2f, (float)size / 2f);
float num = (float)size / 2f;
float num2 = num * (1f - thickness / 2f);
float num3 = num * thickness / 2f;
for (int i = 0; i < size; i++)
{
for (int j = 0; j < size; j++)
{
float num4 = Vector2.Distance(new Vector2((float)j, (float)i), val2);
float num5 = Mathf.Abs(num4 - num2);
float num6 = 0f;
if (num5 < num3)
{
num6 = 1f - num5 / num3;
num6 = Mathf.SmoothStep(0f, 1f, num6);
num6 *= num6;
}
array[i * size + j] = new Color(color.r, color.g, color.b, num6);
}
}
val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
val.Apply();
return val;
}
private static void HandleTrail()
{
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Expected O, but got Unknown
//IL_0155: 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)
if ((Object)(object)_localPlayer == (Object)null)
{
return;
}
if ((Object)(object)_currentTrail == (Object)null)
{
_currentTrail = ((Component)_localPlayer).GetComponent<TrailRenderer>();
if ((Object)(object)_currentTrail == (Object)null && enableTrail)
{
_currentTrail = ((Component)_localPlayer).gameObject.AddComponent<TrailRenderer>();
Material material = new Material(Shader.Find("Sprites/Default"));
((Renderer)_currentTrail).material = material;
_currentTrail.time = 0.5f;
_currentTrail.startWidth = 0.4f;
_currentTrail.endWidth = 0f;
_currentTrail.autodestruct = false;
_currentTrail.minVertexDistance = 0.1f;
_currentTrail.alignment = (LineAlignment)0;
}
}
if ((Object)(object)_currentTrail != (Object)null)
{
if (enableTrail && !((Renderer)_currentTrail).enabled)
{
((Renderer)_currentTrail).enabled = true;
}
else if (!enableTrail && ((Renderer)_currentTrail).enabled)
{
((Renderer)_currentTrail).enabled = false;
}
if (enableTrail)
{
_currentTrail.startColor = TrailColor;
_currentTrail.endColor = new Color(TrailColor.r, TrailColor.g, TrailColor.b, 0f);
}
}
}
}
public static class AuraManager
{
public static bool enabled = false;
public static bool enableDrag = true;
public static Color AuraColor = Color.cyan;
private static int particleCount = 70;
private static float swarmRadius = 2.2f;
private static Vector3 _currentCenter;
private static bool _isFirstFrame = true;
private static List<GameObject> _particles = new List<GameObject>();
private static List<Vector4> _particleProperties = new List<Vector4>();
private static MonoBehaviourPublicGaplfoGaTrorplTrRiBoUnique _localPlayer;
public static void Update()
{
//IL_0034: 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)
if ((Object)(object)_localPlayer == (Object)null)
{
_localPlayer = Object.FindObjectOfType<MonoBehaviourPublicGaplfoGaTrorplTrRiBoUnique>();
if ((Object)(object)_localPlayer != (Object)null)
{
_currentCenter = ((Component)_localPlayer).transform.position;
}
}
if (!enabled)
{
ClearParticles();
return;
}
if (_particles.Count > 0 && (Object)(object)_particles[0] == (Object)null)
{
_particles.Clear();
_particleProperties.Clear();
_isFirstFrame = true;
}
if (_particles.Count != particleCount && (Object)(object)_localPlayer != (Object)null)
{
SpawnParticles();
}
if ((Object)(object)_localPlayer != (Object)null)
{
AnimateParticles();
}
}
private static void SpawnParticles()
{
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
ClearParticles();
_isFirstFrame = true;
for (int i = 0; i < particleCount; i++)
{
GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
Object.Destroy((Object)(object)val.GetComponent<Collider>());
float num = Random.Range(0.01f, 0.03f);
val.transform.localScale = new Vector3(num * Random.Range(0.5f, 1.5f), num * Random.Range(0.5f, 1.5f), 0.0002f);
Renderer component = val.GetComponent<Renderer>();
component.material = new Material(Shader.Find("Sprites/Default"));
component.material.color = AuraColor;
_particles.Add(val);
_particleProperties.Add(new Vector4(Random.Range(0f, 10f), Random.Range(0f, 10f), Random.Range(0f, 10f), Random.Range(150f, 400f)));
}
}
private static void AnimateParticles()
{
//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_001a: 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_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: 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_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: 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_0165: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((Component)_localPlayer).transform.position + Vector3.up * 1f;
if (_isFirstFrame)
{
_currentCenter = val;
_isFirstFrame = false;
}
if (enableDrag)
{
_currentCenter = Vector3.Lerp(_currentCenter, val, Time.deltaTime * 5f);
}
else
{
_currentCenter = val;
}
float time = Time.time;
for (int i = 0; i < _particles.Count; i++)
{
GameObject val2 = _particles[i];
if (!((Object)(object)val2 == (Object)null))
{
val2.GetComponent<Renderer>().material.color = AuraColor;
Vector4 val3 = _particleProperties[i];
float num = Mathf.Sin(time * 0.3f + val3.x) * swarmRadius;
float num2 = Mathf.Sin(time * 0.2f + val3.y) * (swarmRadius * 0.6f);
float num3 = Mathf.Cos(time * 0.25f + val3.z) * swarmRadius;
val2.transform.position = _currentCenter + new Vector3(num, num2, num3);
val2.transform.Rotate(new Vector3(val3.w * Time.deltaTime, val3.w * 0.8f * Time.deltaTime, 0f));
}
}
}
private static void ClearParticles()
{
if (_particles.Count <= 0)
{
return;
}
foreach (GameObject particle in _particles)
{
if ((Object)(object)particle != (Object)null)
{
Object.Destroy((Object)(object)particle);
}
}
_particles.Clear();
_particleProperties.Clear();
}
}
public static class NetworkVisualsManager
{
[CompilerGenerated]
private static class <>O
{
public static MessageHandler <0>__HandleTrailPacket;
public static MessageHandler <1>__HandleAuraPacket;
public static MessageHandler <2>__HandleJumpPacket;
}
public static bool ShareVisuals;
private static float syncTimer;
public const string MSG_TRAIL = "Serein:Trail";
public const string MSG_AURA = "Serein:Aura";
public const string MSG_JUMP = "Serein:Jump";
public static void Init()
{
//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_002f: Expected O, but got Unknown
//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)
//IL_0055: Expected O, but got Unknown
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
if (SereinLitePlugin.HasCrabNet)
{
object obj = <>O.<0>__HandleTrailPacket;
if (obj == null)
{
MessageHandler val = HandleTrailPacket;
<>O.<0>__HandleTrailPacket = val;
obj = (object)val;
}
CrabNet.RegisterMessageHandler("Serein:Trail", (MessageHandler)obj);
object obj2 = <>O.<1>__HandleAuraPacket;
if (obj2 == null)
{
MessageHandler val2 = HandleAuraPacket;
<>O.<1>__HandleAuraPacket = val2;
obj2 = (object)val2;
}
CrabNet.RegisterMessageHandler("Serein:Aura", (MessageHandler)obj2);
object obj3 = <>O.<2>__HandleJumpPacket;
if (obj3 == null)
{
MessageHandler val3 = HandleJumpPacket;
<>O.<2>__HandleJumpPacket = val3;
obj3 = (object)val3;
}
CrabNet.RegisterMessageHandler("Serein:Jump", (MessageHandler)obj3);
}
}
public static void Update()
{
if (SereinLitePlugin.HasCrabNet && ShareVisuals)
{
syncTimer += Time.deltaTime;
if (syncTimer > 3f)
{
syncTimer = 0f;
SendState();
}
}
}
public static void SendState(bool active = true)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Expected O, but got Unknown
//IL_0049: 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_0070: Expected O, but got Unknown
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
if (SereinLitePlugin.HasCrabNet)
{
bool flag = active && VisualsManager.enableTrail && ShareVisuals;
bool flag2 = active && AuraManager.enabled && ShareVisuals;
ObjectPublicIDisposableLi1ByInByBoUnique val = new ObjectPublicIDisposableLi1ByInByBoUnique();
PacketExtensions.Write(val, flag);
PacketExtensions.Write(val, ColorUtility.ToHtmlStringRGB(VisualsManager.TrailColor));
CrabNet.SendMessage("Serein:Trail", val, Utility.GetAllLobbyMembers());
ObjectPublicIDisposableLi1ByInByBoUnique val2 = new ObjectPublicIDisposableLi1ByInByBoUnique();
PacketExtensions.Write(val2, flag2);
PacketExtensions.Write(val2, ColorUtility.ToHtmlStringRGB(AuraManager.AuraColor));
CrabNet.SendMessage("Serein:Aura", val2, Utility.GetAllLobbyMembers());
}
}
public static void SendJump(Vector3 pos)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Expected O, but got Unknown
//IL_0027: 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)
if (SereinLitePlugin.HasCrabNet && ShareVisuals && VisualsManager.enableJumpRing)
{
ObjectPublicIDisposableLi1ByInByBoUnique val = new ObjectPublicIDisposableLi1ByInByBoUnique();
PacketExtensions.Write(val, pos);
PacketExtensions.Write(val, ColorUtility.ToHtmlStringRGB(VisualsManager.JumpRingColor));
CrabNet.SendMessage("Serein:Jump", val, Utility.GetAllLobbyMembers());
}
}
private static RemoteVisualsBehavior GetRemoteBehavior(ulong senderId)
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)MonoBehaviourPublicDi2UIObacspDi2UIObUnique.Instance == (Object)null || MonoBehaviourPublicDi2UIObacspDi2UIObUnique.Instance.activePlayers == null)
{
return null;
}
ulong num = (((Object)(object)MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance != (Object)null) ? MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance.field_Private_CSteamID_0.m_SteamID : 0);
if (senderId == num)
{
return null;
}
if (!MonoBehaviourPublicDi2UIObacspDi2UIObUnique.Instance.activePlayers.ContainsKey(senderId))
{
return null;
}
MonoBehaviourPublicCSstReshTrheObplBojuUnique val = MonoBehaviourPublicDi2UIObacspDi2UIObUnique.Instance.activePlayers[senderId];
if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).transform == (Object)null)
{
return null;
}
RemoteVisualsBehavior remoteVisualsBehavior = ((Component)val).gameObject.GetComponent<RemoteVisualsBehavior>();
if ((Object)(object)remoteVisualsBehavior == (Object)null)
{
remoteVisualsBehavior = ((Component)val).gameObject.AddComponent<RemoteVisualsBehavior>();
}
return remoteVisualsBehavior;
}
private static void HandleTrailPacket(ulong senderId, ObjectPublicIDisposableLi1ByInByBoUnique p)
{
//IL_003f: 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)
RemoteVisualsBehavior remoteBehavior = GetRemoteBehavior(senderId);
if (!((Object)(object)remoteBehavior == (Object)null))
{
remoteBehavior.trailActive = PacketExtensions.ReadBool(p, true);
Color trailColor = default(Color);
if (ColorUtility.TryParseHtmlString("#" + PacketExtensions.ReadString(p, true), ref trailColor))
{
remoteBehavior.trailColor = trailColor;
}
}
}
private static void HandleAuraPacket(ulong senderId, ObjectPublicIDisposableLi1ByInByBoUnique p)
{
//IL_003f: 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)
RemoteVisualsBehavior remoteBehavior = GetRemoteBehavior(senderId);
if (!((Object)(object)remoteBehavior == (Object)null))
{
remoteBehavior.auraActive = PacketExtensions.ReadBool(p, true);
Color auraColor = default(Color);
if (ColorUtility.TryParseHtmlString("#" + PacketExtensions.ReadString(p, true), ref auraColor))
{
remoteBehavior.auraColor = auraColor;
}
}
}
private static void HandleJumpPacket(ulong senderId, ObjectPublicIDisposableLi1ByInByBoUnique p)
{
//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_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = PacketExtensions.ReadVector3(p, true);
Color color = default(Color);
if (ColorUtility.TryParseHtmlString("#" + PacketExtensions.ReadString(p, true), ref color))
{
VisualsManager.SpawnRemoteJumpEffect(position, color);
}
}
}
public class RemoteVisualsBehavior : MonoBehaviour
{
public TrailRenderer trail;
public GameObject auraContainer;
private List<GameObject> auraParticles = new List<GameObject>();
private List<Vector4> auraProps = new List<Vector4>();
public bool trailActive = false;
public bool auraActive = false;
public Color trailColor = Color.cyan;
public Color auraColor = Color.cyan;
private Vector3 lastPos;
public RemoteVisualsBehavior(IntPtr ptr)
: base(ptr)
{
}//IL_0025: 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_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
private void Start()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
lastPos = ((Component)this).transform.position;
}
private void Update()
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)((Component)this).gameObject == (Object)null || !((Component)this).gameObject.activeInHierarchy)
{
Cleanup();
return;
}
UpdateTrail();
UpdateAura();
lastPos = ((Component)this).transform.position;
}
private void OnDisable()
{
Cleanup();
}
private void OnDestroy()
{
Cleanup();
}
private void Cleanup()
{
if ((Object)(object)trail != (Object)null)
{
Object.Destroy((Object)(object)trail);
trail = null;
}
if ((Object)(object)auraContainer != (Object)null)
{
Object.Destroy((Object)(object)auraContainer);
auraContainer = null;
auraParticles.Clear();
auraProps.Clear();
}
}
private void UpdateTrail()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
//IL_010b: 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_0153: 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)
if (trailActive && (Object)(object)trail == (Object)null)
{
trail = ((Component)this).gameObject.AddComponent<TrailRenderer>();
((Renderer)trail).material = new Material(Shader.Find("Sprites/Default"));
trail.time = 0.5f;
trail.startWidth = 0.4f;
trail.endWidth = 0f;
trail.autodestruct = false;
trail.minVertexDistance = 0.1f;
trail.Clear();
}
if (!trailActive && (Object)(object)trail != (Object)null)
{
((Renderer)trail).enabled = false;
}
else if ((Object)(object)trail != (Object)null && trailActive)
{
((Renderer)trail).enabled = true;
trail.startColor = trailColor;
trail.endColor = new Color(trailColor.r, trailColor.g, trailColor.b, 0f);
if (Vector3.Distance(((Component)this).transform.position, lastPos) > 10f)
{
trail.Clear();
}
}
}
private void UpdateAura()
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0074: 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_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Expected O, but got Unknown
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: 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_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_027b: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_0292: Unknown result type (might be due to invalid IL or missing references)
if (!auraActive)
{
if ((Object)(object)auraContainer != (Object)null)
{
Cleanup();
}
return;
}
if ((Object)(object)auraContainer == (Object)null)
{
auraContainer = new GameObject("RemoteAura");
auraContainer.transform.SetParent(((Component)this).transform, false);
auraContainer.transform.localPosition = Vector3.zero;
for (int i = 0; i < 35; i++)
{
GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
Object.Destroy((Object)(object)val.GetComponent<Collider>());
val.transform.SetParent(auraContainer.transform, false);
float num = Random.Range(0.02f, 0.05f);
val.transform.localScale = new Vector3(num, num, num);
val.GetComponent<Renderer>().material = new Material(Shader.Find("Sprites/Default"));
auraParticles.Add(val);
auraProps.Add(new Vector4(Random.Range(0f, 10f), Random.Range(0f, 10f), Random.Range(0f, 10f), Random.Range(1f, 3f)));
}
}
if ((Object)(object)auraContainer.transform.parent != (Object)(object)((Component)this).transform)
{
auraContainer.transform.SetParent(((Component)this).transform, false);
auraContainer.transform.localPosition = Vector3.zero;
}
float time = Time.time;
float num2 = 2f;
for (int j = 0; j < auraParticles.Count; j++)
{
GameObject val2 = auraParticles[j];
if (!((Object)(object)val2 == (Object)null))
{
val2.GetComponent<Renderer>().material.color = auraColor;
Vector4 val3 = auraProps[j];
float num3 = Mathf.Sin(time * 0.5f + val3.x) * num2;
float num4 = Mathf.Sin(time * 1.5f + val3.z) * 0.8f + 1.2f;
float num5 = Mathf.Cos(time * 0.4f + val3.y) * num2;
val2.transform.localPosition = new Vector3(num3, num4, num5);
val2.transform.Rotate(Vector3.up, val3.w * 100f * Time.deltaTime);
}
}
}
}
[HarmonyPatch(typeof(MonoBehaviourPublicGaplfoGaTrorplTrRiBoUnique), "Jump")]
public static class JumpVisualPatch
{
[HarmonyPostfix]
public static void PostJump(MonoBehaviourPublicGaplfoGaTrorplTrRiBoUnique __instance)
{
//IL_0007: 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)
VisualsManager.SpawnJumpEffect(((Component)__instance).transform.position);
NetworkVisualsManager.SendJump(((Component)__instance).transform.position);
}
}
public class SereinNotification : MonoBehaviour
{
public static SereinNotification Instance;
private Text _textComponent;
private RectTransform _rectTransform;
private CanvasGroup _canvasGroup;
private float _timer = 0f;
private const float TOTAL_DURATION = 3f;
private const float ANIM_IN_DURATION = 0.5f;
private const float FADE_OUT_START = 1f;
private float startY = 100f;
private float targetY = -80f;
public SereinNotification(IntPtr ptr)
: base(ptr)
{
}
private void Awake()
{
//IL_0028: 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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
_rectTransform = ((Component)this).gameObject.AddComponent<RectTransform>();
_rectTransform.anchorMin = new Vector2(0.5f, 1f);
_rectTransform.anchorMax = new Vector2(0.5f, 1f);
_rectTransform.pivot = new Vector2(0.5f, 1f);
_rectTransform.sizeDelta = new Vector2(800f, 100f);
_rectTransform.anchoredPosition = new Vector2(0f, startY);
_textComponent = ((Component)this).gameObject.AddComponent<Text>();
_textComponent.font = Resources.GetBuiltinResource<Font>("Arial.ttf");
_textComponent.fontSize = 28;
_textComponent.fontStyle = (FontStyle)1;
_textComponent.alignment = (TextAnchor)4;
((Graphic)_textComponent).color = Color.cyan;
_textComponent.supportRichText = true;
Outline val = ((Component)this).gameObject.AddComponent<Outline>();
((Shadow)val).effectColor = Color.black;
((Shadow)val).effectDistance = new Vector2(2f, -2f);
_canvasGroup = ((Component)this).gameObject.AddComponent<CanvasGroup>();
_canvasGroup.alpha = 0f;
_canvasGroup.blocksRaycasts = false;
}
public void Show(string msg)
{
//IL_00c0: 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)
if (!((Object)(object)_textComponent == (Object)null))
{
if (msg.Contains("OFF") && _canvasGroup.alpha > 0.01f)
{
_textComponent.text = msg;
_timer = 2f;
_rectTransform.anchoredPosition = new Vector2(0f, targetY);
_canvasGroup.alpha = 1f;
}
else
{
_textComponent.text = msg;
_timer = 0f;
_canvasGroup.alpha = 0f;
_rectTransform.anchoredPosition = new Vector2(0f, startY);
}
}
}
private void Update()
{
//IL_007a: 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_00bd: Unknown result type (might be due to invalid IL or missing references)
if (!(_timer > 3f))
{
_timer += Time.deltaTime;
if (_timer < 0.5f)
{
float num = _timer / 0.5f;
float num2 = Mathf.SmoothStep(0f, 1f, num);
float num3 = Mathf.Lerp(startY, targetY, num2);
_rectTransform.anchoredPosition = new Vector2(0f, num3);
_canvasGroup.alpha = num2;
}
else if (_timer < 2f)
{
_rectTransform.anchoredPosition = new Vector2(0f, targetY);
_canvasGroup.alpha = 1f;
}
else
{
float num4 = 3f - _timer;
float num5 = Mathf.Clamp01(num4 / 1f);
float num6 = Mathf.SmoothStep(0f, 1f, num5);
float num7 = Mathf.Lerp(startY, targetY, num6);
_rectTransform.anchoredPosition = new Vector2(0f, num7);
_canvasGroup.alpha = num6;
}
}
}
}
public class Draggable : MonoBehaviour
{
private RectTransform rectTransform;
private bool isDragging = false;
private Vector2 offset;
public Draggable(IntPtr ptr)
: base(ptr)
{
}
private void Start()
{
rectTransform = ((Component)this).GetComponent<RectTransform>();
}
private void Update()
{
//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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00a4: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
if (Variables.menuTrigger)
{
if (Input.GetMouseButtonDown(0) && RectTransformUtility.RectangleContainsScreenPoint(rectTransform, Vector2.op_Implicit(Input.mousePosition)))
{
isDragging = true;
RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, Vector2.op_Implicit(Input.mousePosition), (Camera)null, ref offset);
}
if (Input.GetMouseButtonUp(0))
{
isDragging = false;
}
if (isDragging)
{
Vector2 val = default(Vector2);
RectTransformUtility.ScreenPointToLocalPointInRectangle(((Component)((Transform)rectTransform).parent).GetComponent<RectTransform>(), Vector2.op_Implicit(Input.mousePosition), (Camera)null, ref val);
rectTransform.anchoredPosition = val - offset;
}
}
}
}
public static class KeybindManager
{
public static Dictionary<string, KeyCode> SavedBinds = new Dictionary<string, KeyCode>();
public static void LoadBinds()
{
}
public static string GetButtonID(string l)
{
return l;
}
}
public class MenuConstants
{
public const string SEPARATOR = "----------------";
public const string SELECTED_PREFIX = "> ";
public const string SELECTED_SUFFIX = " <";
public const string UNSELECTED_PREFIX = " ";
public const string UNSELECTED_SUFFIX = "";
public static string HEADER => $"<color=#A020F0><b>[ Serein Lite ]</b></color>\n<size=12><color=#00FF00>● Online Users(在线人数): {GlobalStatsManager.OnlineUsers}</color></size>\n";
}
public class MenuButton
{
public string Label;
public Action Action;
public Func<string> Status;
public MenuButton(string l, Action a = null, Func<string> s = null)
{
Label = l;
Action = a;
Status = s;
}
public string GetFormattedLabel(bool s)
{
return (s ? "> " : " ") + Label + " " + ((Status != null) ? Status() : "");
}
}
public static class Variables
{
public static string mainFolderPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\SereinLite\\";
public static string logFilePath = mainFolderPath + "log.txt";
public static KeyCode menuKey = (KeyCode)277;
public static bool menuTrigger;
}
public static class Utility
{
[CompilerGenerated]
private sealed class <GetAllLobbyMembers>d__5 : IEnumerable<CSteamID>, IEnumerable, IEnumerator<CSteamID>, IEnumerator, IDisposable
{
private int <>1__state;
private CSteamID <>2__current;
private int <>l__initialThreadId;
private int <count>5__1;
private int <i>5__2;
CSteamID IEnumerator<CSteamID>.Current
{
[DebuggerHidden]
get
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
return <>2__current;
}
}
[DebuggerHidden]
public <GetAllLobbyMembers>d__5(int <>1__state)
{
this.<>1__state = <>1__state;
<>l__initialThreadId = Environment.CurrentManagedThreadId;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0037: 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_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)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if ((Object)(object)MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance == (Object)null)
{
return false;
}
<count>5__1 = SteamMatchmaking.GetNumLobbyMembers(MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance.currentLobby);
<i>5__2 = 0;
break;
case 1:
<>1__state = -1;
<i>5__2++;
break;
}
if (<i>5__2 < <count>5__1)
{
<>2__current = SteamMatchmaking.GetLobbyMemberByIndex(MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance.currentLobby, <i>5__2);
<>1__state = 1;
return true;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
[DebuggerHidden]
IEnumerator<CSteamID> IEnumerable<CSteamID>.GetEnumerator()
{
if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
{
<>1__state = 0;
return this;
}
return new <GetAllLobbyMembers>d__5(0);
}
[DebuggerHidden]
IEnumerator IEnumerable.GetEnumerator()
{
return ((IEnumerable<CSteamID>)this).GetEnumerator();
}
}
public static void CreateFolder(string p)
{
if (!Directory.Exists(p))
{
Directory.CreateDirectory(p);
}
}
public static void CreateFile(string p)
{
if (!File.Exists(p))
{
using (File.CreateText(p))
{
}
}
}
public static void Log(string l)
{
Console.WriteLine("[Serein Lite] " + l);
}
public static void ForceMessage(string msg)
{
if ((Object)(object)SereinNotification.Instance != (Object)null)
{
SereinNotification.Instance.Show(msg);
}
else
{
Log(StripColorTags(msg));
}
}
public static string StripColorTags(string input)
{
return Regex.Replace(input, "<.*?>", string.Empty);
}
[IteratorStateMachine(typeof(<GetAllLobbyMembers>d__5))]
public static IEnumerable<CSteamID> GetAllLobbyMembers()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <GetAllLobbyMembers>d__5(-2);
}
}
}