using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.IL2CPP;
using BepInEx.Logging;
using CrabDevKit.Intermediary;
using CrabDevKit.Utilities;
using Il2CppSystem;
using Microsoft.CodeAnalysis;
using SteamworksNative;
using UnhollowerBaseLib;
using UnhollowerRuntimeLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("Antro.Marks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Antro.Marks")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.0")]
[assembly: AssemblyProduct("Antro.Marks")]
[assembly: AssemblyTitle("Antro.Marks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace Antro.Marks
{
[BepInPlugin("Antro.Marks", "Antro Marks", "1.6.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class MarksPlugin : BasePlugin
{
[CompilerGenerated]
private static class <>O
{
public static MessageHandler <0>__HandleMarkMessage;
}
public static MarksPlugin Instance;
public const string MSG_MARK = "Antro:Mark_Data_V2";
public const float MARK_LIFETIME = 5f;
public const float MAX_DIST = 5000f;
public const int MAX_MARKS_PER_PLAYER = 5;
public const float SPHERE_HEIGHT = 0.9f;
public const float SPHERE_SIZE = 0.7f;
public const float RING_SIZE = 2f;
public static bool _hasCrabNet = false;
public static Texture2D _ringTexture;
public static ConfigEntry<string> _cfgColor;
public static Color _myColor = Color.red;
public override void Load()
{
//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_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Expected O, but got Unknown
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Expected O, but got Unknown
Instance = this;
try
{
ClassInjector.RegisterTypeInIl2Cpp<MarksController>();
}
catch
{
}
_cfgColor = ((BasePlugin)this).Config.Bind<string>("General", "MarkColor", "Red", "Color of your mark. Options: Red, Green, Blue, Yellow, Cyan, Magenta, White, Black, Orange, Purple, Pink, Lime");
_myColor = ParseColor(_cfgColor.Value);
ManualLogSource log = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(42, 0, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Antro.Marks] Loaded. Global limit active.");
}
log.LogInfo(val);
_ringTexture = GenerateRingTexture();
if (((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.ContainsKey("lammas123.CrabDevKit"))
{
_hasCrabNet = true;
RegisterNetwork();
}
GameObject val2 = new GameObject("AntroMarks_Controller");
Object.DontDestroyOnLoad((Object)(object)val2);
((Object)val2).hideFlags = (HideFlags)61;
val2.AddComponent<MarksController>();
}
private Color ParseColor(string colorName)
{
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: 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_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_026b: Unknown result type (might be due to invalid IL or missing references)
//IL_0263: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_021b: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
return (Color)(colorName.ToLower().Trim() switch
{
"green" => Color.green,
"blue" => Color.blue,
"yellow" => Color.yellow,
"cyan" => Color.cyan,
"magenta" => Color.magenta,
"white" => Color.white,
"black" => Color.black,
"orange" => new Color(1f, 0.5f, 0f),
"purple" => new Color(0.5f, 0f, 0.5f),
"pink" => new Color(1f, 0.4f, 0.7f),
"lime" => new Color(0.5f, 1f, 0f),
_ => Color.red,
});
}
private void RegisterNetwork()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
try
{
object obj = <>O.<0>__HandleMarkMessage;
if (obj == null)
{
MessageHandler val = HandleMarkMessage;
<>O.<0>__HandleMarkMessage = val;
obj = (object)val;
}
CrabNet.RegisterMessageHandler("Antro:Mark_Data_V2", (MessageHandler)obj);
}
catch
{
}
}
public static void CreateLocalMark(Vector3 pos, Vector3 normal)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
GameObject markObj = SpawnMarkVisuals(pos, normal, _myColor);
ulong steamId = 0uL;
if ((Object)(object)MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance != (Object)null)
{
steamId = MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance.field_Private_CSteamID_0.m_SteamID;
}
MarksController.Instance.RegisterMarkForPlayer(steamId, markObj);
if (_hasCrabNet)
{
ObjectPublicIDisposableLi1ByInByBoUnique val = new ObjectPublicIDisposableLi1ByInByBoUnique();
PacketExtensions.Write(val, pos);
PacketExtensions.Write(val, normal);
PacketExtensions.Write(val, _myColor.r);
PacketExtensions.Write(val, _myColor.g);
PacketExtensions.Write(val, _myColor.b);
SendToLobby("Antro:Mark_Data_V2", val);
}
}
private static void SendToLobby(string msgId, ObjectPublicIDisposableLi1ByInByBoUnique p)
{
//IL_001d: 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_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance == (Object)null)
{
return;
}
List<CSteamID> list = new List<CSteamID>();
int numLobbyMembers = SteamMatchmaking.GetNumLobbyMembers(MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance.currentLobby);
for (int i = 0; i < numLobbyMembers; i++)
{
CSteamID lobbyMemberByIndex = SteamMatchmaking.GetLobbyMemberByIndex(MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance.currentLobby, i);
if (lobbyMemberByIndex.m_SteamID != MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance.field_Private_CSteamID_0.m_SteamID)
{
list.Add(lobbyMemberByIndex);
}
}
if (list.Count > 0)
{
CrabNet.SendMessage(msgId, p, (IEnumerable<CSteamID>)list);
}
}
private static void HandleMarkMessage(ulong senderId, ObjectPublicIDisposableLi1ByInByBoUnique p)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: 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)
//IL_0067: 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)
if ((Object)(object)MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance != (Object)null && senderId == MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance.field_Private_CSteamID_0.m_SteamID)
{
return;
}
try
{
Vector3 pos = PacketExtensions.ReadVector3(p, true);
Vector3 normal = PacketExtensions.ReadVector3(p, true);
float num = PacketExtensions.ReadFloat(p, true);
float num2 = PacketExtensions.ReadFloat(p, true);
float num3 = PacketExtensions.ReadFloat(p, true);
Color color = default(Color);
((Color)(ref color))..ctor(num, num2, num3, 1f);
GameObject markObj = SpawnMarkVisuals(pos, normal, color);
MarksController.Instance.RegisterMarkForPlayer(senderId, markObj);
}
catch
{
}
}
public static GameObject SpawnMarkVisuals(Vector3 pos, Vector3 normal, Color color)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: 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_010a: Expected O, but got Unknown
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Expected O, but got Unknown
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
GameObject val = null;
try
{
if ((Object)(object)_ringTexture == (Object)null)
{
_ringTexture = GenerateRingTexture();
}
val = new GameObject("Antro_Mark_Root");
val.transform.position = pos;
val.transform.rotation = Quaternion.LookRotation(normal) * Quaternion.Euler(90f, 0f, 0f);
GameObject val2 = GameObject.CreatePrimitive((PrimitiveType)5);
if (Object.op_Implicit((Object)(object)val2.GetComponent<Collider>()))
{
Object.Destroy((Object)(object)val2.GetComponent<Collider>());
}
val2.transform.SetParent(val.transform);
val2.transform.localPosition = new Vector3(0f, 0.03f, 0f);
val2.transform.localRotation = Quaternion.Euler(90f, 0f, 0f);
val2.transform.localScale = Vector3.one * 2f;
Renderer component = val2.GetComponent<Renderer>();
Material val3 = new Material(Shader.Find("Sprites/Default"));
val3.mainTexture = (Texture)(object)_ringTexture;
val3.color = color;
component.material = val3;
GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)0);
if (Object.op_Implicit((Object)(object)val4.GetComponent<Collider>()))
{
Object.Destroy((Object)(object)val4.GetComponent<Collider>());
}
val4.transform.SetParent(val.transform);
val4.transform.localPosition = new Vector3(0f, 0.9f, 0f);
val4.transform.localScale = Vector3.one * 0.7f;
Renderer component2 = val4.GetComponent<Renderer>();
Material val5 = new Material(Shader.Find("Standard"));
val5.color = color;
val5.EnableKeyword("_EMISSION");
val5.SetColor("_EmissionColor", color * 2f);
component2.material = val5;
if ((Object)(object)MarksController.Instance != (Object)null)
{
MarksController.Instance.RegisterActiveMark(val, val4, val2, 5f);
}
else
{
Object.Destroy((Object)(object)val);
}
}
catch (Exception ex)
{
Debug.LogError(Object.op_Implicit("[Antro.Marks] Spawn failed: " + ex.Message));
if ((Object)(object)val != (Object)null)
{
Object.Destroy((Object)(object)val);
}
}
return val;
}
private static Texture2D GenerateRingTexture()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0063: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
int num = 128;
Texture2D val = new Texture2D(num, num, (TextureFormat)4, false);
((Object)val).hideFlags = (HideFlags)61;
Object.DontDestroyOnLoad((Object)(object)val);
Color[] array = (Color[])(object)new Color[num * num];
Vector2 val2 = default(Vector2);
((Vector2)(ref val2))..ctor((float)num / 2f, (float)num / 2f);
float num2 = (float)num / 2f;
for (int i = 0; i < num; i++)
{
for (int j = 0; j < num; j++)
{
float num3 = Vector2.Distance(new Vector2((float)j, (float)i), val2);
float num4 = num3 / num2;
float num5 = 0f;
if (num4 > 0.8f && num4 < 0.95f)
{
num5 = 1f;
}
if (num4 > 0.4f && num4 < 0.5f)
{
num5 = 1f;
}
if (num4 < 0.15f)
{
num5 = 1f;
}
array[i * num + j] = new Color(1f, 1f, 1f, num5);
}
}
val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array));
val.Apply();
return val;
}
}
public class MarksController : MonoBehaviour
{
private class MarkEntry
{
public GameObject root;
public GameObject sphere;
public GameObject ring;
public float timer;
public float maxTime;
public Vector3 baseSpherePos;
}
public static MarksController Instance;
private List<MarkEntry> activeMarks = new List<MarkEntry>();
private Dictionary<ulong, List<GameObject>> playerMarksMap = new Dictionary<ulong, List<GameObject>>();
public MarksController(IntPtr ptr)
: base(ptr)
{
}
private void Awake()
{
Instance = this;
}
public void RegisterActiveMark(GameObject root, GameObject sphere, GameObject ring, float lifetime)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
activeMarks.Add(new MarkEntry
{
root = root,
sphere = sphere,
ring = ring,
timer = lifetime,
maxTime = lifetime,
baseSpherePos = sphere.transform.localPosition
});
}
public void RegisterMarkForPlayer(ulong steamId, GameObject markObj)
{
if ((Object)(object)markObj == (Object)null)
{
return;
}
if (!playerMarksMap.ContainsKey(steamId))
{
playerMarksMap[steamId] = new List<GameObject>();
}
List<GameObject> list = playerMarksMap[steamId];
list.RemoveAll((GameObject x) => (Object)(object)x == (Object)null);
list.Add(markObj);
while (list.Count > 5)
{
GameObject val = list[0];
if ((Object)(object)val != (Object)null)
{
Object.Destroy((Object)(object)val);
}
list.RemoveAt(0);
}
}
private void Update()
{
//IL_0013: 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_0065: 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_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance == (Object)null || MonoBehaviourPublicObInUIgaStCSBoStcuCSUnique.Instance.currentLobby.m_SteamID == 0)
{
return;
}
RaycastHit val = default(RaycastHit);
if (Input.GetKeyDown((KeyCode)325) && (Object)(object)Camera.main != (Object)null && Physics.Raycast(((Component)Camera.main).transform.position, ((Component)Camera.main).transform.forward, ref val, 5000f))
{
MarksPlugin.CreateLocalMark(((RaycastHit)(ref val)).point, ((RaycastHit)(ref val)).normal);
}
for (int num = activeMarks.Count - 1; num >= 0; num--)
{
MarkEntry markEntry = activeMarks[num];
if ((Object)(object)markEntry.root == (Object)null)
{
activeMarks.RemoveAt(num);
}
else
{
markEntry.timer -= Time.deltaTime;
if (markEntry.timer <= 0f)
{
Object.Destroy((Object)(object)markEntry.root);
activeMarks.RemoveAt(num);
}
else
{
if ((Object)(object)markEntry.sphere != (Object)null)
{
float num2 = Mathf.Sin(Time.time * 3f) * 0.1f;
markEntry.sphere.transform.localPosition = markEntry.baseSpherePos + new Vector3(0f, num2, 0f);
}
if ((Object)(object)markEntry.ring != (Object)null)
{
float num3 = 2f + Mathf.Sin(Time.time * 5f) * 0.1f;
markEntry.ring.transform.localScale = new Vector3(num3, num3, 1f);
}
if (markEntry.timer < 1f)
{
float num4 = markEntry.timer / 1f;
markEntry.root.transform.localScale = new Vector3(num4, num4, num4);
}
}
}
}
}
}
}