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 ImagePings v1.0.0
ImagePings.dll
Decompiled 3 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading.Tasks; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using HG; using HG.Reflection; using ImagePings.Utils; using ImagePings.Utils.Components; using MG.GIF; using Microsoft.CodeAnalysis; using On.RoR2; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using RoR2; using RoR2.Audio; using RoR2.EntitlementManagement; using RoR2.ExpansionManagement; using RoR2.Navigation; using RoR2.Projectile; using RoR2.Skills; using RoR2.SolusWingGrid; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.AI; using UnityEngine.AddressableAssets; using UnityEngine.Audio; using UnityEngine.Networking; using UnityEngine.Rendering.PostProcessing; using UnityEngine.UI; using UnityEngine.UIElements; using UnityEngine.Video; [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("ImagePings")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+32ab7b7a5be3186f405d7a02ac0a714ddf5fd748")] [assembly: AssemblyProduct("ImagePings")] [assembly: AssemblyTitle("ImagePings")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: UnverifiableCode] 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 MG.GIF { public class Image : ICloneable { public int Width; public int Height; public int Delay; public Color32[] RawImage; public Image() { } public Image(Image img) { Width = img.Width; Height = img.Height; Delay = img.Delay; RawImage = ((img.RawImage != null) ? ((Color32[])img.RawImage.Clone()) : null); } public object Clone() { return new Image(this); } public Texture2D CreateTexture() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown Texture2D val = new Texture2D(Width, Height, (TextureFormat)5, false) { filterMode = (FilterMode)0, wrapMode = (TextureWrapMode)1 }; val.SetPixels32(RawImage); val.Apply(); return val; } } public class Decoder : IDisposable { [Flags] private enum ImageFlag { Interlaced = 0x40, ColourTable = 0x80, TableSizeMask = 7, BitDepthMask = 0x70 } private enum Block { Image = 44, Extension = 33, End = 59 } private enum Extension { GraphicControl = 249, Comments = 254, PlainText = 1, ApplicationData = 255 } private enum Disposal { None = 0, DoNotDispose = 4, RestoreBackground = 8, ReturnToPrevious = 12 } [Flags] private enum ControlFlags { HasTransparency = 1, DisposalMask = 0xC } public string Version; public ushort Width; public ushort Height; public Color32 BackgroundColour; private const uint NoCode = 65535u; private const ushort NoTransparency = ushort.MaxValue; private byte[] Input; private int D; private Color32[] GlobalColourTable; private Color32[] LocalColourTable; private Color32[] ActiveColourTable; private ushort TransparentIndex; private Image Image = new Image(); private ushort ImageLeft; private ushort ImageTop; private ushort ImageWidth; private ushort ImageHeight; private Color32[] Output; private Color32[] PreviousImage; private readonly int[] Pow2 = new int[13] { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096 }; private bool Disposed = false; private int CodesLength; private IntPtr CodesHandle; private unsafe ushort* pCodes; private IntPtr CurBlock; private unsafe uint* pCurBlock; private const int MaxCodes = 4096; private IntPtr Indices; private unsafe ushort** pIndicies; public Decoder(byte[] data) : this() { Load(data); } public Decoder Load(byte[] data) { Input = data; D = 0; GlobalColourTable = (Color32[])(object)new Color32[256]; LocalColourTable = (Color32[])(object)new Color32[256]; TransparentIndex = ushort.MaxValue; Output = null; PreviousImage = null; Image.Delay = 0; return this; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private byte ReadByte() { return Input[D++]; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private ushort ReadUInt16() { return (ushort)(Input[D++] | (Input[D++] << 8)); } private void ReadHeader() { //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) if (Input == null || Input.Length <= 12) { throw new Exception("Invalid data"); } Version = Encoding.ASCII.GetString(Input, 0, 6); D = 6; if (Version != "GIF87a" && Version != "GIF89a") { throw new Exception("Unsupported GIF version"); } Width = ReadUInt16(); Height = ReadUInt16(); Image.Width = Width; Image.Height = Height; ImageFlag imageFlag = (ImageFlag)ReadByte(); byte b = ReadByte(); ReadByte(); if (imageFlag.HasFlag(ImageFlag.ColourTable)) { ReadColourTable(GlobalColourTable, imageFlag); } BackgroundColour = GlobalColourTable[b]; } public Image NextImage() { if (D == 0) { ReadHeader(); } while (true) { switch ((Block)ReadByte()) { case Block.Image: { Image image = ReadImageBlock(); if (image != null) { return image; } break; } case Block.Extension: { Extension extension = (Extension)ReadByte(); if (extension == Extension.GraphicControl) { ReadControlBlock(); } else { SkipBlocks(); } break; } case Block.End: return null; default: throw new Exception("Unexpected block type"); } } } private Color32[] ReadColourTable(Color32[] colourTable, ImageFlag flags) { //IL_0062: 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) int num = Pow2[(int)((flags & ImageFlag.TableSizeMask) + 1)]; for (int i = 0; i < num; i++) { colourTable[i] = new Color32(Input[D++], Input[D++], Input[D++], byte.MaxValue); } return colourTable; } private void SkipBlocks() { for (byte b = Input[D++]; b != 0; b = Input[D++]) { D += b; } } private void ReadControlBlock() { ReadByte(); ControlFlags controlFlags = (ControlFlags)ReadByte(); Image.Delay = ReadUInt16() * 10; byte transparentIndex = ReadByte(); ReadByte(); if (controlFlags.HasFlag(ControlFlags.HasTransparency)) { TransparentIndex = transparentIndex; } else { TransparentIndex = ushort.MaxValue; } switch ((Disposal)(controlFlags & ControlFlags.DisposalMask)) { default: PreviousImage = Output; break; case Disposal.RestoreBackground: Output = (Color32[])(object)new Color32[Width * Height]; break; case Disposal.ReturnToPrevious: Output = (Color32[])(object)new Color32[Width * Height]; if (PreviousImage != null) { Array.Copy(PreviousImage, Output, Output.Length); } break; } } private Image ReadImageBlock() { ImageLeft = ReadUInt16(); ImageTop = ReadUInt16(); ImageWidth = ReadUInt16(); ImageHeight = ReadUInt16(); ImageFlag imageFlag = (ImageFlag)ReadByte(); if (ImageWidth == 0 || ImageHeight == 0) { return null; } if (imageFlag.HasFlag(ImageFlag.ColourTable)) { ActiveColourTable = ReadColourTable(LocalColourTable, imageFlag); } else { ActiveColourTable = GlobalColourTable; } if (Output == null) { Output = (Color32[])(object)new Color32[Width * Height]; PreviousImage = Output; } DecompressLZW(); if (imageFlag.HasFlag(ImageFlag.Interlaced)) { Deinterlace(); } Image.RawImage = Output; return Image; } private void Deinterlace() { int num = Output.Length / Width; int num2 = Output.Length - Width; Color32[] output = Output; Output = (Color32[])(object)new Color32[Output.Length]; for (int i = 0; i < num; i++) { int num3; if (i % 8 == 0) { num3 = i / 8; } else if ((i + 4) % 8 == 0) { int num4 = num / 8; num3 = num4 + (i - 4) / 8; } else if ((i + 2) % 4 == 0) { int num5 = num / 4; num3 = num5 + (i - 2) / 4; } else { int num6 = num / 2; num3 = num6 + (i - 1) / 2; } Array.Copy(output, (num - num3 - 1) * Width, Output, num2, Width); num2 -= Width; } } public unsafe Decoder() { CodesLength = 131072; CodesHandle = Marshal.AllocHGlobal(CodesLength * 2); pCodes = (ushort*)CodesHandle.ToPointer(); CurBlock = Marshal.AllocHGlobal(256); pCurBlock = (uint*)CurBlock.ToPointer(); Indices = Marshal.AllocHGlobal(4096 * sizeof(ushort*)); pIndicies = (ushort**)Indices.ToPointer(); } protected virtual void Dispose(bool disposing) { if (!Disposed) { Marshal.FreeHGlobal(CodesHandle); Marshal.FreeHGlobal(CurBlock); Marshal.FreeHGlobal(Indices); Disposed = true; } } ~Decoder() { Dispose(disposing: false); } public void Dispose() { Dispose(disposing: true); GC.SuppressFinalize(this); } private unsafe void DecompressLZW() { //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Unknown result type (might be due to invalid IL or missing references) ushort* ptr = pCodes + CodesLength; fixed (byte* ptr9 = Input) { fixed (Color32* ptr2 = Output) { fixed (Color32* ptr12 = ActiveColourTable) { int num = (Height - ImageTop - 1) * Width; int num2 = ((ImageLeft + ImageWidth > Width) ? (Width - ImageLeft) : ImageWidth); Color32* ptr3 = (Color32*)((byte*)ptr2 + (nint)(num + ImageLeft) * (nint)Unsafe.SizeOf<Color32>()); Color32* ptr4 = ptr3; Color32* ptr5 = (Color32*)((byte*)ptr3 + (nint)(int)ImageWidth * (nint)Unsafe.SizeOf<Color32>()); Color32* ptr6 = (Color32*)((byte*)ptr3 + (nint)num2 * (nint)Unsafe.SizeOf<Color32>()); int num3 = Input[D++]; if (num3 > 11) { num3 = 11; } int num4 = num3 + 1; int num5 = Pow2[num4]; int num6 = Pow2[num3]; int num7 = num6; int num8 = num6 + 1; int num9 = num6 + 2; ushort* ptr7 = pCodes; for (ushort num10 = 0; num10 < num9; num10++) { pIndicies[(int)num10] = ptr7; *(ptr7++) = 1; *(ptr7++) = num10; } uint num11 = 65535u; uint num12 = (uint)(num5 - 1); uint num13 = 0u; int num14 = 0; int num15 = 0; uint* ptr8 = pCurBlock; while (true) { uint num16 = num13 & num12; if (num14 >= num4) { num14 -= num4; num13 >>= num4; } else { if (num15 <= 0) { byte* source = ptr9 + D++; num15 = *(source++); D += num15; if (num15 == 0) { return; } pCurBlock[(num15 - 1) / 4] = 0u; Buffer.MemoryCopy(source, pCurBlock, 256L, num15); ptr8 = pCurBlock; } num13 = *(ptr8++); int num17 = ((num15 >= 4) ? 32 : (num15 * 8)); num15 -= 4; if (num14 > 0) { int num18 = num4 - num14; num16 |= (num13 << num14) & num12; num13 >>= num18; num14 = num17 - num18; } else { num16 = num13 & num12; num13 >>= num4; num14 = num17 - num4; } } if (num16 == num7) { num4 = num3 + 1; num5 = Pow2[num4]; num9 = num6 + 2; ptr7 = pCodes + num9 * 2; num11 = 65535u; num12 = (uint)(num5 - 1); continue; } if (num16 == num8) { break; } bool flag = false; ushort* ptr10 = null; if (num16 < num9) { ptr10 = pIndicies[num16]; } else { if (num11 == 65535) { continue; } ptr10 = pIndicies[num11]; flag = true; } ushort num19 = *(ptr10++); ushort num20 = *ptr10; ushort* ptr11 = ptr10 + (int)num19; do { ushort num21 = *(ptr10++); if (num21 != TransparentIndex && ptr3 < ptr6) { Unsafe.Write(ptr3, ((byte*)ptr12)[(nint)(int)num21 * (nint)Unsafe.SizeOf<Color32>()]); } if ((ptr3 = (Color32*)((byte*)ptr3 + Unsafe.SizeOf<Color32>())) == ptr5) { ptr4 = (Color32*)((byte*)ptr4 - (nint)(int)Width * (nint)Unsafe.SizeOf<Color32>()); ptr3 = ptr4; ptr5 = (Color32*)((byte*)ptr4 + (nint)(int)ImageWidth * (nint)Unsafe.SizeOf<Color32>()); ptr6 = (Color32*)((byte*)ptr4 + (nint)num2 * (nint)Unsafe.SizeOf<Color32>()); if (ptr3 < ptr2) { SkipBlocks(); return; } } } while (ptr10 < ptr11); if (flag) { if (num20 != TransparentIndex && ptr3 < ptr6) { Unsafe.Write(ptr3, ((byte*)ptr12)[(nint)(int)num20 * (nint)Unsafe.SizeOf<Color32>()]); } if ((ptr3 = (Color32*)((byte*)ptr3 + Unsafe.SizeOf<Color32>())) == ptr5) { ptr4 = (Color32*)((byte*)ptr4 - (nint)(int)Width * (nint)Unsafe.SizeOf<Color32>()); ptr3 = ptr4; ptr5 = (Color32*)((byte*)ptr4 + (nint)(int)ImageWidth * (nint)Unsafe.SizeOf<Color32>()); ptr6 = (Color32*)((byte*)ptr4 + (nint)num2 * (nint)Unsafe.SizeOf<Color32>()); if (ptr3 < ptr2) { break; } } } if (num11 != 65535 && num9 != 4096) { ptr10 = pIndicies[num11]; num19 = *(ptr10++); if (ptr7 + (int)num19 + 1 >= ptr) { ushort* ptr13 = pCodes; CodesLength *= 2; CodesHandle = Marshal.ReAllocHGlobal(CodesHandle, (IntPtr)(CodesLength * 2)); pCodes = (ushort*)CodesHandle.ToPointer(); ptr = pCodes + CodesLength; ptr7 = pCodes + (ptr7 - ptr13); for (int i = 0; i < num9; i++) { pIndicies[i] = pCodes + (pIndicies[i] - ptr13); } ptr10 = pIndicies[num11]; ptr10++; } pIndicies[num9++] = ptr7; *(ptr7++) = (ushort)(num19 + 1); Buffer.MemoryCopy(ptr10, ptr7, num19 * 2, num19 * 2); ptr7 += (int)num19; *(ptr7++) = num20; } if (num9 >= num5 && num4 < 12) { num5 = Pow2[++num4]; num12 = (uint)(num5 - 1); } num11 = num16; } SkipBlocks(); } } } } public static string Ident() { string text = "1.1"; string text2 = (BitConverter.IsLittleEndian ? "L" : "B"); string text3 = "M"; string text4 = "U"; string text5 = "2.0"; return text + " " + text2 + text4 + text3 + " " + text5; } } } namespace ImagePings { [BepInPlugin("pseudopulse.ImagePings", "ImagePings", "1.0.0")] public class ImagePings : BaseUnityPlugin { public const string PluginGUID = "pseudopulse.ImagePings"; public const string PluginAuthor = "pseudopulse"; public const string PluginName = "ImagePings"; public const string PluginVersion = "1.0.0"; public static ImagePings instance; public static string videoLocation; public static ManualLogSource ModLogger; public static GameObject GIFRenderer; public static GameObject VideoRenderer; public static GameObject ImageRenderer; public static Dictionary<string, ImageHandler> ImageCache = new Dictionary<string, ImageHandler>(); public void Awake() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown ModLogger = ((BaseUnityPlugin)this).Logger; instance = this; Chat.AddMessage_ChatMessageBase += new hook_AddMessage_ChatMessageBase(OnMessageSent); videoLocation = Assembly.GetExecutingAssembly().Location.Replace("ImagePings.dll", ""); ImageRenderer = PrefabAPI.InstantiateClone(new GameObject(), "IPImageRenderer", false); ImageRenderer.AddComponent<RawImage>(); ImageRenderer.AddComponent<Canvas>((Action<Canvas>)delegate(Canvas x) { x.renderMode = (RenderMode)2; ((Component)x).gameObject.layer = LayerIndex.uiWorldSpace.intVal; }); ImageRenderer.AddComponent<Billboard>(); GIFRenderer = PrefabAPI.InstantiateClone(new GameObject(), "IPGifRenderer", false); GIFRenderer.AddComponent<RawImage>(); GIFRenderer.AddComponent<GIFRenderer>(); GIFRenderer.AddComponent<Canvas>((Action<Canvas>)delegate(Canvas x) { x.renderMode = (RenderMode)2; ((Component)x).gameObject.layer = LayerIndex.uiWorldSpace.intVal; }); GIFRenderer.AddComponent<Billboard>(); VideoRenderer = PrefabAPI.InstantiateClone(new GameObject(), "IPVideoRenderer", false); VideoRenderer.AddComponent<VideoPlayer>(); VideoRenderer.AddComponent<RawImage>(); VideoRenderer.AddComponent<VideoRenderer>(); VideoRenderer.AddComponent<Canvas>((Action<Canvas>)delegate(Canvas x) { x.renderMode = (RenderMode)2; ((Component)x).gameObject.layer = LayerIndex.uiWorldSpace.intVal; }); VideoRenderer.AddComponent<Billboard>(); } private void OnMessageSent(orig_AddMessage_ChatMessageBase orig, ChatMessageBase message) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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) string text = IdentifyURL(message.ConstructChatString()); if (text != null) { try { Uri uRLFromString = GetURLFromString(text); if (uRLFromString != null && message is UserChatMessage) { ImageHandler imageHandler = null; ImageFormat format = CheckImageFormat(text); bool flag = false; NetworkUser component = ((UserChatMessage)((message is UserChatMessage) ? message : null)).sender.GetComponent<NetworkUser>(); Transform val = null; Vector3 zero = Vector3.zero; if (Object.op_Implicit((Object)(object)component.masterController) && Object.op_Implicit((Object)(object)component.masterController.pingerController) && component.masterController.pingerController.currentPing.active) { PingInfo currentPing = component.masterController.pingerController.currentPing; GameObject targetGameObject = ((PingInfo)(ref currentPing)).targetGameObject; val = ((targetGameObject != null) ? targetGameObject.transform : null) ?? null; zero = currentPing.origin; } else { val = component.GetCurrentBody().transform; zero = component.GetCurrentBody().corePosition; } if (ImageCache.ContainsKey(text)) { imageHandler = ImageCache[text]; } else { imageHandler = new ImageHandler(); RunCoro(imageHandler.Initialize(format, uRLFromString, new ImageHandler.SpawnInfo { target = val, offset = zero })); flag = true; ImageCache.Add(text, imageHandler); } if (!flag) { imageHandler.Instantiate(val, zero); } return; } } catch { } } orig.Invoke(message); } public static void RunCoro(IEnumerator coro) { ((MonoBehaviour)instance).StartCoroutine(coro); } public string IdentifyURL(string message) { message = message.Replace("<noparse>", "").Replace("</noparse>", "").Replace("</color>", ""); string[] array = message.Split(" "); string[] array2 = array; foreach (string text in array2) { if (Uri.IsWellFormedUriString(text, UriKind.RelativeOrAbsolute)) { return text; } } return null; } private Uri GetURLFromString(string text) { string[] array = text.Split(' '); foreach (string uriString in array) { if (Uri.IsWellFormedUriString(uriString, UriKind.RelativeOrAbsolute) && CheckImageFormat(text) != 0) { Uri uri = new Uri(uriString); if (uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps) { return uri; } } } return null; } private ImageFormat CheckImageFormat(string text) { if (text.Contains(".png")) { return ImageFormat.PNG; } if (text.Contains(".jpg")) { return ImageFormat.JPG; } if (text.Contains(".mp4")) { return ImageFormat.MP4; } if (text.Contains(".gif")) { return ImageFormat.GIF; } return ImageFormat.Invalid; } } public class ImageHandler { public class SpawnInfo { public Transform target; public Vector3 offset; } [CompilerGenerated] private sealed class <Initialize>d__8 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ImageFormat format; public Uri uri; public SpawnInfo queuedSpawn; public ImageHandler <>4__this; private UnityWebRequest <req>5__1; private byte[] <data>5__2; private ImageFormat <>s__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Initialize>d__8(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <req>5__1 = null; <data>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Invalid comparison between Unknown and I4 //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.format = format; <>4__this.uri = uri; ImagePings.ModLogger.LogError((object)("initializing for: " + uri?.ToString() + " of format " + format)); <>4__this.fileName = Path.GetFileName(uri.AbsolutePath); <req>5__1 = UnityWebRequest.Get(uri); <req>5__1.downloadHandler = (DownloadHandler)new DownloadHandlerBuffer(); <>2__current = <req>5__1.SendWebRequest(); <>1__state = 1; return true; case 1: { <>1__state = -1; if ((int)<req>5__1.result != 1) { ImagePings.ModLogger.LogError((object)("failed to download " + uri)); ManualLogSource modLogger = ImagePings.ModLogger; Result result = <req>5__1.result; modLogger.LogError((object)((object)(Result)(ref result)).ToString()); return false; } ImagePings.ModLogger.LogError((object)("received data of length " + <req>5__1.downloadHandler.data.Length)); <data>5__2 = <req>5__1.downloadHandler.data; ImageFormat imageFormat = format; <>s__3 = imageFormat; switch (<>s__3) { case ImageFormat.PNG: case ImageFormat.JPG: <>4__this.ProcessImage(<data>5__2); break; case ImageFormat.MP4: <>4__this.ProcessVideo(<data>5__2); break; case ImageFormat.GIF: <>4__this.ProcessGIF(<data>5__2); break; } if (queuedSpawn != null) { <>4__this.Instantiate(queuedSpawn.target, queuedSpawn.offset); } 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 ImageFormat format; public Uri uri; public string fileName; public Texture2D tex; public Uri videoURI; public string videoPath; public GifFrame[] frames; [IteratorStateMachine(typeof(<Initialize>d__8))] public IEnumerator Initialize(ImageFormat format, Uri uri, SpawnInfo queuedSpawn = null) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Initialize>d__8(0) { <>4__this = this, format = format, uri = uri, queuedSpawn = queuedSpawn }; } public void ProcessImage(byte[] data) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown tex = new Texture2D(0, 0); ImageConversion.LoadImage(tex, data); } public void ProcessVideo(byte[] data) { videoPath = Path.Combine(ImagePings.videoLocation, fileName); File.WriteAllBytes(videoPath, data); videoURI = new Uri(videoPath); } public void ProcessGIF(byte[] data) { List<GifFrame> list = new List<GifFrame>(); using (MG.GIF.Decoder decoder = new MG.GIF.Decoder(data)) { for (Image image = decoder.NextImage(); image != null; image = decoder.NextImage()) { GifFrame gifFrame = new GifFrame(); gifFrame.tex = image.CreateTexture(); gifFrame.frameTime = (float)image.Delay / 1000f; list.Add(gifFrame); } } frames = list.ToArray(); } public void Cleanup() { if (videoPath != null && File.Exists(videoPath)) { File.Delete(videoPath); } } public void Instantiate(CharacterBody target) { } public void Instantiate(Transform target, Vector3 offset) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_0124: 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) GameObject renderer = null; switch (format) { case ImageFormat.PNG: case ImageFormat.JPG: renderer = Object.Instantiate<GameObject>(ImagePings.ImageRenderer); if (Object.op_Implicit((Object)(object)target)) { renderer.transform.SetParent(target); } renderer.transform.position = offset; renderer.GetComponent<RawImage>().texture = (Texture)(object)tex; break; case ImageFormat.MP4: renderer = Object.Instantiate<GameObject>(ImagePings.VideoRenderer); if (Object.op_Implicit((Object)(object)target)) { renderer.transform.SetParent(target); } renderer.transform.position = offset; renderer.GetComponent<VideoRenderer>().uri = videoURI.ToString(); break; case ImageFormat.GIF: renderer = Object.Instantiate<GameObject>(ImagePings.GIFRenderer); if (Object.op_Implicit((Object)(object)target)) { renderer.transform.SetParent(target); } renderer.transform.position = offset; renderer.GetComponent<GIFRenderer>().frames = frames; break; } if (Object.op_Implicit((Object)(object)renderer)) { renderer.transform.localScale = new Vector3(0.08f, 0.08f, 0.08f); renderer.GetComponent<RectTransform>((Action<RectTransform>)delegate(RectTransform x) { //IL_000d: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_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) Transform transform = renderer.transform; Vector3 localPosition = transform.localPosition; Bounds val = new Bounds(Vector3.zero, Vector2.op_Implicit(x.sizeDelta)); transform.localPosition = localPosition + new Vector3(0f, ((Bounds)(ref val)).extents.y / 2f * 0.25f, 0f); }); renderer.AddComponent<DestroyOnTimer>((Action<DestroyOnTimer>)delegate(DestroyOnTimer x) { x.duration = 5f; }); } } } public class VideoRenderer : MonoBehaviour { public string uri; public RenderTexture texture; public RawImage image; public DestroyOnTimer timer; public VideoPlayer player; public void Start() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown texture = new RenderTexture(256, 256, 16, (RenderTextureFormat)0); texture.Create(); player = ((Component)(object)this).GetComponent<VideoPlayer>((Action<VideoPlayer>)delegate(VideoPlayer x) { x.renderMode = (VideoRenderMode)2; x.targetTexture = texture; x.url = uri; }); image = ((Component)this).GetComponent<RawImage>(); image.texture = (Texture)(object)texture; timer = ((Component)this).GetComponent<DestroyOnTimer>(); } public void FixedUpdate() { if (Object.op_Implicit((Object)(object)player) && player.length != 0.0) { timer.duration = (float)player.length; } } } public class GIFRenderer : MonoBehaviour { public RawImage target; public GifFrame[] frames; public float stopwatch = 0f; public int index = 0; public GifFrame current; public void Start() { target = ((Component)this).GetComponent<RawImage>(); current = frames[0]; target.texture = (Texture)(object)current.tex; stopwatch = current.frameTime; } public void Update() { stopwatch -= Time.deltaTime; if (stopwatch <= 0f) { Advance(); } } public void Advance() { index++; if (index == frames.Length) { index = 0; } current = frames[index]; stopwatch = current.frameTime; target.texture = (Texture)(object)current.tex; } } public class GifFrame { public Texture2D tex; public float frameTime; } public enum ImageFormat { Invalid, PNG, MP4, JPG, GIF } [AttributeUsage(AttributeTargets.Field, AllowMultiple = false)] public class ConfigFieldAttribute : SearchableAttribute { public string name; public string desc; public object defaultValue; public ConfigFieldAttribute(string name, string desc, object defaultValue) { this.name = name; this.desc = desc; this.defaultValue = defaultValue; } } [AttributeUsage(AttributeTargets.Class)] public class ConfigSectionAttribute : Attribute { public string name; public ConfigSectionAttribute(string name) { this.name = name; } } public class ConfigManager { public static void HandleConfigAttributes(Assembly assembly, ConfigFile config) { //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown Type[] types = assembly.GetTypes(); foreach (Type type in types) { TypeInfo typeInfo = type.GetTypeInfo(); ConfigSectionAttribute customAttribute = typeInfo.GetCustomAttribute<ConfigSectionAttribute>(); if (customAttribute == null) { continue; } FieldInfo[] fields = typeInfo.GetFields((BindingFlags)(-1)); foreach (FieldInfo fieldInfo in fields) { if (!fieldInfo.IsStatic) { continue; } Type fieldType = fieldInfo.FieldType; ConfigFieldAttribute customAttribute2 = ((MemberInfo)fieldInfo).GetCustomAttribute<ConfigFieldAttribute>(); if (customAttribute2 != null) { MethodInfo methodInfo = (from x in typeof(ConfigFile).GetMethods() where x.Name == "Bind" select x).First(); methodInfo = methodInfo.MakeGenericMethod(fieldType); ConfigEntryBase val = (ConfigEntryBase)methodInfo.Invoke(config, new object[3] { (object)new ConfigDefinition(customAttribute.name, customAttribute2.name), customAttribute2.defaultValue, (object)new ConfigDescription(customAttribute2.desc, (AcceptableValueBase)null, Array.Empty<object>()) }); fieldInfo.SetValue(null, val.BoxedValue); } } } } } } namespace ImagePings.Utils { public class BasicLaserBeam { public float DamageCoefficient; public CharacterBody Owner; public Transform TargetMuzzle; private LineRenderer lr; public GameObject effectInstance; private bool firing = false; private float stopwatch = 0f; private float growthStopwatch = 0f; private float delay; private BasicLaserInfo info; private Transform origin; private Transform end; private Vector3 targetEndpoint; private float origWidth = 0f; public bool Active => firing; public BasicLaserBeam(CharacterBody owner, Transform muzzle, BasicLaserInfo info) { //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_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) this.info = info; delay = 1f / info.TickRate; TargetMuzzle = muzzle; DamageCoefficient = info.DamageCoefficient * delay; effectInstance = Object.Instantiate<GameObject>(info.EffectPrefab, ((Component)muzzle).transform.position, Quaternion.identity); growthStopwatch = info.ChargeDelay; origin = (info.OriginIsBase ? effectInstance.transform : effectInstance.GetComponent<ChildLocator>().FindChild(info.OriginName)); end = effectInstance.GetComponent<ChildLocator>().FindChild(info.EndpointName); lr = effectInstance.GetComponent<DetachLineRendererAndFade>().line; origWidth = lr.widthMultiplier; Owner = owner; targetEndpoint = GetEndpoint(out var _); ((Component)end).transform.position = targetEndpoint; ((Component)origin).transform.position = ((Component)TargetMuzzle).transform.position; } public void Fire() { if (Object.op_Implicit((Object)(object)info.FiringMaterial)) { ((Renderer)lr).material = info.FiringMaterial; } lr.widthMultiplier = origWidth * info.FiringWidthMultiplier; firing = true; stopwatch = 0f; } public void UpdateVisual(float deltaTime) { //IL_0017: 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_003e: 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) ((Component)origin).transform.position = ((Component)TargetMuzzle).transform.position; ((Component)end).transform.position = Vector3.MoveTowards(((Component)end).transform.position, targetEndpoint, 250f * deltaTime); } public void Update(float deltaTime) { //IL_002c: 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_0088: 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_008e: 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_00a6: Expected O, but got Unknown stopwatch += deltaTime; if (stopwatch >= delay) { targetEndpoint = GetEndpoint(out var unmodified); stopwatch = 0f; if (firing && ((NetworkBehaviour)Owner).hasAuthority) { GetBulletAttack().Fire(); if (Object.op_Implicit((Object)(object)info.ImpactEffect)) { EffectManager.SpawnEffect(info.ImpactEffect, new EffectData { origin = unmodified, scale = 1f }, false); } } } if (!firing) { growthStopwatch -= deltaTime; lr.widthMultiplier = Mathf.Max(0f, growthStopwatch / info.ChargeDelay); } } public Vector3 GetEndpoint(out Vector3 unmodified) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0058: 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) //IL_005e: 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_0072: 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_0074: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_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_00c4: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((info.FiringMode == LaserFiringMode.TrackAim) ? Owner.inputBank.aimDirection : TargetMuzzle.forward); Vector3 val2 = ((info.FiringMode == LaserFiringMode.TrackAim) ? Owner.inputBank.aimOrigin : TargetMuzzle.position); Ray val3 = new Ray(val2, val); Vector3 point = ((Ray)(ref val3)).GetPoint(info.MaxRange); RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val2, val, ref val4, info.MaxRange, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask))) { point = ((RaycastHit)(ref val4)).point; } unmodified = point; return point + val * 5f; } public BulletAttack GetBulletAttack() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_005c: 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_0061: 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_007d: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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) BulletAttack val = new BulletAttack(); val.radius = lr.startWidth * 0.75f; val.damage = Owner.damage * DamageCoefficient; val.origin = ((info.FiringMode == LaserFiringMode.TrackAim) ? Owner.inputBank.aimOrigin : TargetMuzzle.position); Vector3 val2 = ((Component)end).transform.position - TargetMuzzle.position; val.aimVector = ((Vector3)(ref val2)).normalized; val.procCoefficient = 1f; val.owner = ((Component)Owner).gameObject; val.falloffModel = (FalloffModel)0; val.isCrit = Util.CheckRoll(Owner.crit, Owner.master); val.stopperMask = ((LayerIndex)(ref LayerIndex.world)).mask; return val; } public void Stop() { Object.Destroy((Object)(object)effectInstance); } } public class BasicLaserInfo { public GameObject EffectPrefab; public string OriginName = "Origin"; public string EndpointName = "End"; public bool OriginIsBase = true; public float TickRate = 20f; public float DamageCoefficient = 1f; public Material FiringMaterial; public float ChargeDelay = 0.5f; public float FiringWidthMultiplier = 2f; public LaserFiringMode FiringMode = LaserFiringMode.Straight; public float MaxRange = 60f; public GameObject ImpactEffect; } public enum LaserFiringMode { TrackAim, Straight } public class CoolerAntiGravityForce : MonoBehaviour { public float antiGravityCoefficient = -0.2f; public Func<float, float> lerpFunction = EaseInQuart; public float rampTime = 0.5f; private float stopwatch; private Rigidbody rb; public void Start() { rb = ((Component)this).GetComponent<Rigidbody>(); } public void FixedUpdate() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) stopwatch += Time.fixedDeltaTime; float num = lerpFunction(Mathf.Clamp(stopwatch, 0f, rampTime) / rampTime); rb.AddForce(-Physics.gravity * Mathf.Lerp(0f, antiGravityCoefficient, num), (ForceMode)5); } public static float EaseInQuad(float x) { return x * x; } public static float EaseInQuart(float x) { return x * x * x * x; } } public abstract class CoolerBasicMeleeAttack : BasicMeleeAttack { public abstract float BaseDuration { get; } public abstract float DamageCoefficient { get; } public abstract string HitboxName { get; } public abstract GameObject HitEffectPrefab { get; } public abstract float ProcCoefficient { get; } public abstract float HitPauseDuration { get; } public abstract GameObject SwingEffectPrefab { get; } public abstract string MuzzleString { get; } public virtual string MechanimHitboxParameter { get; } public virtual bool ScaleHitPauseDurationWithAttackSpeed { get; } = true; public virtual Func<bool> AlternateActiveParameter { get; } = () => true; public override void OnEnter() { base.baseDuration = BaseDuration; base.damageCoefficient = DamageCoefficient; base.hitBoxGroupName = HitboxName; base.hitEffectPrefab = HitEffectPrefab; base.procCoefficient = ProcCoefficient; base.hitPauseDuration = HitPauseDuration; base.swingEffectPrefab = SwingEffectPrefab; base.swingEffectMuzzleString = MuzzleString; if (MechanimHitboxParameter != null) { base.mecanimHitboxActiveParameter = MechanimHitboxParameter; } base.scaleHitPauseDurationAndVelocityWithAttackSpeed = ScaleHitPauseDurationWithAttackSpeed; ((BasicMeleeAttack)this).OnEnter(); } public override void FixedUpdate() { ((EntityState)this).fixedAge = ((EntityState)this).fixedAge + Time.fixedDeltaTime; if (string.IsNullOrEmpty(MechanimHitboxParameter) && AlternateActiveParameter()) { ((BasicMeleeAttack)this).BeginMeleeAttackEffect(); } else if (base.animator.GetFloat(MechanimHitboxParameter) >= 0.5f) { ((BasicMeleeAttack)this).BeginMeleeAttackEffect(); } if (((EntityState)this).isAuthority) { ((BasicMeleeAttack)this).AuthorityFixedUpdate(); } } } [RequireComponent(typeof(InputBankTest))] [RequireComponent(typeof(CharacterBody))] public abstract class Tracker : MonoBehaviour { public Transform target; public Indicator indicator; public GameObject targetingIndicatorPrefab; private float stopwatch = 0f; public float searchDelay = 0.1f; public float maxSearchAngle = 40f; public float maxSearchDistance = 60f; public bool isActive = true; public InputBankTest inputBank; public CharacterBody body; public Func<bool> isActiveCallback = DefaultIsActiveCallback; public float minDot => Mathf.Cos(Mathf.Clamp(maxSearchAngle, 0f, 180f) * (MathF.PI / 180f)); private static bool DefaultIsActiveCallback() { return true; } public virtual void Start() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown indicator = new Indicator(((Component)this).gameObject, targetingIndicatorPrefab); body = ((Component)this).GetComponent<CharacterBody>(); inputBank = ((Component)this).GetComponent<InputBankTest>(); } public virtual void OnDestroy() { if (indicator != null) { indicator.DestroyVisualizer(); } } public virtual void OnEnable() { if (indicator != null) { indicator.active = DefaultIsActiveCallback(); } } public virtual void OnDisable() { if (indicator != null) { indicator.active = false; } } public virtual void FixedUpdate() { if (indicator != null && !DefaultIsActiveCallback()) { indicator.active = false; return; } if (indicator != null && !Object.op_Implicit((Object)(object)target)) { indicator.active = false; } if (indicator != null && Object.op_Implicit((Object)(object)target)) { indicator.active = true; } stopwatch += Time.fixedDeltaTime; if (stopwatch >= searchDelay) { stopwatch = 0f; target = SearchForTarget(); if (Object.op_Implicit((Object)(object)target) && indicator != null) { indicator.targetTransform = target; } } } public abstract Transform SearchForTarget(); } public class HurtboxTracker : Tracker { public enum TargetType { Enemy, Friendly, All } public TeamIndex userIndex; public TargetType targetType; public CharacterBody targetBody; public override void Start() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) base.Start(); userIndex = body.teamComponent.teamIndex; } public override Transform SearchForTarget() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //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_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_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) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_0087: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) BullseyeSearch val = new BullseyeSearch(); Ray aimRay = inputBank.GetAimRay(); val.searchDirection = ((Ray)(ref aimRay)).direction; val.searchOrigin = ((Component)this).transform.position; val.maxDistanceFilter = maxSearchDistance; val.maxAngleFilter = maxSearchAngle; TeamMask teamMaskFilter = TeamMask.all; switch (targetType) { case TargetType.Enemy: ((TeamMask)(ref teamMaskFilter)).RemoveTeam(userIndex); break; case TargetType.Friendly: teamMaskFilter = TeamMask.none; ((TeamMask)(ref teamMaskFilter)).AddTeam(userIndex); break; case TargetType.All: teamMaskFilter = TeamMask.all; break; } val.teamMaskFilter = teamMaskFilter; val.filterByLoS = true; val.sortMode = (SortMode)2; val.RefreshCandidates(); val.FilterOutGameObject(((Component)this).gameObject); IEnumerable<HurtBox> source = from x in val.GetResults() where Filter(x) select x; HurtBox? obj = source.FirstOrDefault(); Transform val2 = ((obj != null) ? ((Component)obj).transform : null) ?? null; if (Object.op_Implicit((Object)(object)val2)) { targetBody = ((Component)val2).GetComponent<HurtBox>().healthComponent.body; } else { targetBody = null; } return val2; } public virtual bool Filter(HurtBox box) { return true; } } public class ComponentTracker<T> : Tracker where T : Component { public Func<T, bool> validFilter = DefaultFilter; private static bool DefaultFilter(T t) { return true; } public override Transform SearchForTarget() { //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_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_0072: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) T[] array = Object.FindObjectsOfType<T>(); foreach (T val in array) { if (validFilter(val) && !(Vector3.Distance(((Component)this).transform.position, ((Component)val).transform.position) > maxSearchDistance)) { Ray aimRay = inputBank.GetAimRay(); Vector3 direction = ((Ray)(ref aimRay)).direction; Vector3 val2 = ((Component)val).transform.position - ((Component)this).transform.position; float num = Vector3.Dot(direction, ((Vector3)(ref val2)).normalized); if (!(num < base.minDot)) { return ((Component)val).transform; } } } return null; } } public class CallNetworkedMethod : INetMessage, ISerializableObject { private GameObject obj; private string method; private uint id; public CallNetworkedMethod(GameObject obj, string method) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) this.obj = obj; this.method = method; NetworkInstanceId netId = obj.GetComponent<NetworkIdentity>().netId; id = ((NetworkInstanceId)(ref netId)).Value; } public void Serialize(NetworkWriter writer) { writer.Write(id); writer.Write(method); } public void Deserialize(NetworkReader reader) { id = reader.ReadUInt32(); method = reader.ReadString(); } public void OnReceived() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) obj = Util.FindNetworkObject(new NetworkInstanceId(id)); if (Object.op_Implicit((Object)(object)obj)) { obj.SendMessage(method, (SendMessageOptions)1); } } public CallNetworkedMethod() { } } public class LockLocalTransform : MonoBehaviour { public Vector3 Position; public Vector3 Rotation; public Vector3 Scale; public void LateUpdate() { //IL_0008: 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_0031: Unknown result type (might be due to invalid IL or missing references) ((Component)this).transform.localPosition = Position; ((Component)this).transform.localRotation = Quaternion.Euler(Rotation); ((Component)this).transform.localScale = Scale; } } public class ConfigOption<T> { private ConfigEntry<T> Bind; public ConfigOption(ConfigFile config, string categoryName, string configOptionName, T defaultValue, string fullDescription) { Bind = config.Bind<T>(categoryName, configOptionName, defaultValue, fullDescription); } public static implicit operator T(ConfigOption<T> x) { return x.Bind.Value; } public override string ToString() { return Bind.Value.ToString(); } } public static class DamageColourHelper { [CompilerGenerated] private static class <>O { public static hook_FindColor <0>__DamageColor_FindColor; } public static List<DamageColorIndex> registeredColorIndicies = new List<DamageColorIndex>(); internal static void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown object obj = <>O.<0>__DamageColor_FindColor; if (obj == null) { hook_FindColor val = DamageColor_FindColor; <>O.<0>__DamageColor_FindColor = val; obj = (object)val; } DamageColor.FindColor += (hook_FindColor)obj; } private static Color DamageColor_FindColor(orig_FindColor orig, DamageColorIndex colorIndex) { //IL_0006: 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_0025: 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_0016: 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_0028: Unknown result type (might be due to invalid IL or missing references) if (registeredColorIndicies.Contains(colorIndex)) { return DamageColor.colors[colorIndex]; } return orig.Invoke(colorIndex); } public static DamageColorIndex RegisterDamageColor(Color color) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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) //IL_0029: Unknown result type (might be due to invalid IL or missing references) int num = DamageColor.colors.Length; DamageColorIndex val = (DamageColorIndex)(byte)num; ArrayUtils.ArrayAppend<Color>(ref DamageColor.colors, ref color); registeredColorIndicies.Add(val); return val; } } public static class EventRaiser { private static readonly BindingFlags ALL = (BindingFlags)(-1); public static void RaiseEvent(this object instance, string eventName, params object[] e) { Type type = instance.GetType(); FieldInfo field = type.GetField(eventName, ALL); if (field == null) { throw new Exception("Event with name " + eventName + " could not be found."); } if (field.GetValue(instance) is MulticastDelegate multicastDelegate) { Delegate[] invocationList = multicastDelegate.GetInvocationList(); List<object> list = new List<object>(); for (int i = 0; i < e.Length; i++) { list.Add(e[i]); } object[] args = list.ToArray(); Delegate[] array = invocationList; foreach (Delegate @delegate in array) { @delegate.DynamicInvoke(args); } } } } public static class CharacterExtensions { public static bool HasSkillEquipped(this CharacterBody body, SkillDef skill) { GenericSkill[] components = ((Component)body).GetComponents<GenericSkill>(); foreach (GenericSkill val in components) { if ((Object)(object)val.skillDef == (Object)(object)skill) { return true; } } return false; } public static void ClearInventory(this CharacterBody body) { //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_003c: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body.inventory)) { return; } List<ItemDef> list = new List<ItemDef>(); foreach (ItemIndex item in body.inventory.itemAcquisitionOrder) { ItemDef itemDef = ItemCatalog.GetItemDef(item); list.Add(itemDef); } foreach (ItemDef item2 in list) { body.inventory.RemoveItem(item2, body.inventory.GetItemCount(item2)); } } public static void ClearInventory(this CharacterBody body, bool hidden) { //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_003c: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body.inventory)) { return; } List<ItemDef> list = new List<ItemDef>(); foreach (ItemIndex item in body.inventory.itemAcquisitionOrder) { ItemDef itemDef = ItemCatalog.GetItemDef(item); if (hidden) { list.Add(itemDef); } else if (!itemDef.hidden) { list.Add(itemDef); } } foreach (ItemDef item2 in list) { body.inventory.RemoveItem(item2, body.inventory.GetItemCount(item2)); } } public static void StartParticles(this ChildLocator loc, string system, bool withChildren = true) { ((Component)loc.FindChild(system)).GetComponent<ParticleSystem>().Play(withChildren); } public static void StopParticles(this ChildLocator loc, string system, bool withChildren = true) { ((Component)loc.FindChild(system)).GetComponent<ParticleSystem>().Stop(withChildren); } } public static class EnumeratorExtensions { public static T GetRandom<T>(this IEnumerable<T> self) { return self.ElementAt(Random.Range(0, self.Count())); } public static T GetRandom<T>(this IEnumerable<T> self, Xoroshiro128Plus rng) { return self.ElementAt(rng.RangeInt(0, self.Count())); } public static T GetRandom<T>(this IEnumerable<T> self, Func<T, bool> predicate) { try { return self.Where(predicate).ElementAt(Random.Range(0, self.Count())); } catch { return default(T); } } public static T GetRandom<T>(this IEnumerable<T> self, Xoroshiro128Plus rng, Func<T, bool> predicate) { try { return self.Where(predicate).ElementAt(rng.RangeInt(0, self.Count())); } catch { return default(T); } } } public static class StringExtensions { public static string Add(this string str, string text) { LanguageAPI.Add(str, text); return str; } public static void AddOverlay(this string str, string text) { LanguageAPI.AddOverlay(str, text); } public static T Load<T>(this string str) { //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) try { return Addressables.LoadAssetAsync<T>((object)str).WaitForCompletion(); } catch { return default(T); } } public static string RemoveUnsafeCharacters(this string str) { string[] array = new string[17] { "\n", "'", " ", "!", "`", "&", "-", ")", "(", "{", "}", "|", "@", "<", ">", ".", "\\" }; string text = str; string[] array2 = array; foreach (string oldValue in array2) { text = text.Replace(oldValue, ""); } return text; } public static string RemoveUnsafeCharacters(this string str, string[] unsafeChars) { string text = str; foreach (string oldValue in unsafeChars) { text = text.Replace(oldValue, ""); } return text; } public static string AutoFormat(this string str) { return Formatter.FormatString(str); } } internal class Formatter { internal struct Format { public string match; public string expanded; } private static List<Format> formats = new List<Format> { new Format { match = "$su", expanded = "<style=cIsUtility>" }, new Format { match = "$sd", expanded = "<style=cIsDamage>" }, new Format { match = "$ss", expanded = "<style=cStack>" }, new Format { match = "$sr", expanded = "<style=cDeath>" }, new Format { match = "$sh", expanded = "<style=cIsHealing>" }, new Format { match = "$se", expanded = "</style>" }, new Format { match = "$rc", expanded = "<color=#36D7A9>" }, new Format { match = "$ec", expanded = "</color>" }, new Format { match = "$pc", expanded = "<color=#406096>" }, new Format { match = "$sv", expanded = "<style=cIsVoid>" }, new Format { match = "$lc", expanded = "<color=#FF7F7F>" } }; internal static string FormatString(string str) { foreach (Format format in formats) { str = str.Replace(format.match, format.expanded); } return str; } } public static class UnityExtensions { public static void RemoveComponent<T>(this GameObject self) where T : Component { Object.Destroy((Object)(object)self.GetComponent<T>()); } public static void RemoveComponents<T>(this GameObject self) where T : Component { T[] components = self.GetComponents<T>(); for (int i = 0; i < components.Length; i++) { Object.Destroy((Object)(object)components[i]); } } public static void CallNetworkedMethod(this GameObject self, string method, NetworkDestination dest = 1) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) NetMessageExtensions.Send((INetMessage)(object)new CallNetworkedMethod(self, method), dest); } public static T FindComponent<T>(this GameObject self, string name) where T : Component { return self.GetComponentsInChildren<T>().FirstOrDefault((T x) => ((Object)((Component)x).gameObject).name == name); } public static void RemoveComponent<T>(this Component self) where T : Component { Object.Destroy((Object)(object)self.GetComponent<T>()); } public static void RemoveComponents<T>(this Component self) where T : Component { T[] components = self.GetComponents<T>(); for (int i = 0; i < components.Length; i++) { Object.Destroy((Object)(object)components[i]); } } public static T AddComponent<T>(this Component self) where T : Component { return self.gameObject.AddComponent<T>(); } public static T AddComponent<T>(this Component self, Action<T> modification) where T : Component { T val = self.gameObject.AddComponent<T>(); modification(val); return val; } public static T GetComponent<T>(this Component self, Action<T> modification) where T : Component { T component = self.gameObject.GetComponent<T>(); modification(component); return component; } public static T AddComponent<T>(this GameObject self, Action<T> modification) where T : Component { T val = self.AddComponent<T>(); modification(val); return val; } public static T GetComponent<T>(this GameObject self, Action<T> modification) where T : Component { T component = self.GetComponent<T>(); modification(component); return component; } public static void EditComponent<T>(this Component self, Action<T> modification) where T : Component { T component = self.GetComponent<T>(); modification(component); } public static void EditComponent<T>(this GameObject self, Action<T> modification) where T : Component { T component = self.GetComponent<T>(); modification(component); } public static Sprite MakeSprite(this Texture2D self) { //IL_0015: 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) return Sprite.Create(new Rect(0f, 0f, 512f, 512f), new Vector2(256f, 256f), 1f, self); } public static Vector3 Nullify(this Vector3 v, bool x = false, bool y = false, bool z = false) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0036: 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) return new Vector3(x ? 0f : v.x, y ? 0f : v.y, z ? 0f : v.z); } } public static class Keywords { public static string Poison = "KEYWORD_POISON"; public static string Regenerative = "KEYWORD_RAPID_REGEN"; public static string Agile = "KEYWORD_AGILE"; public static string HealthCost = "KEYWORD_PERCENT_HP"; public static string Disperse = "KEYWORD_SONIC_BOOM"; public static string Weak = "KEYWORD_WEAK"; public static string Heavy = "KEYWORD_HEAVY"; public static string Freeze = "KEYWORD_FREEZING"; public static string Stun = "KEYWORD_STUNNING"; public static string Expose = "KEYWORD_EXPOSE"; public static string Shock = "KEYWORD_SHOCKING"; public static string Slayer = "KEYWORD_SLAYER"; public static string Hemorrhage = "KEYWORD_SUPERBLEED"; public static string Ignite = "KEYWORD_IGNITE"; public static string Weakpoint = "KEYWORD_WEAKPOINT"; public static string ActiveReload = "KEYWORD_ACTIVERELOAD"; public static string VoidCorruption = "KEYWORD_VOIDCORRUPTION"; } public static class MathHelpers { public static string FloatToPercentageString(float number, float numberBase = 100f) { return (number * numberBase).ToString("##0") + "%"; } public static Vector3 ClosestPointOnSphereToPoint(Vector3 origin, float radius, Vector3 targetPosition) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_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_0012: 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_0019: 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_0022: Unknown result type (might be due to invalid IL or missing references) Vector3 val = targetPosition - origin; val = Vector3.Normalize(val); val *= radius; return origin + val; } public static List<Vector3> DistributePointsEvenlyAroundSphere(int points, float radius, Vector3 origin) { //IL_0066: 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_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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = new List<Vector3>(); double num = Math.PI * (3.0 - Math.Sqrt(5.0)); for (int i = 0; i < points; i++) { int num2 = 1 - i / (points - 1) * 2; double num3 = Math.Sqrt(1 - num2 * num2); double num4 = num * (double)i; float num5 = (float)(Math.Cos(num4) * num3); float num6 = (float)(Math.Sin(num4) * num3); Vector3 val = origin + new Vector3(num5, (float)num2, num6); list.Add(val * radius); } return list; } public static List<Vector3> DistributePointsEvenlyAroundCircle(int points, float radius, Vector3 origin, float angleOffset = 0f) { //IL_002c: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = new List<Vector3>(); Vector3 item = default(Vector3); for (int i = 0; i < points; i++) { double num = Math.PI * 2.0 / (double)points; double num2 = num * (double)i + (double)angleOffset; ((Vector3)(ref item))..ctor((float)((double)radius * Math.Cos(num2) + (double)origin.x), origin.y, (float)((double)radius * Math.Sin(num2) + (double)origin.z)); list.Add(item); } return list; } public static Vector3 GetPointOnUnitSphereCap(Quaternion targetDirection, float angle) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_0046: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) float num = Random.Range(0f, angle) * (MathF.PI / 180f); Vector2 insideUnitCircle = Random.insideUnitCircle; Vector2 val = ((Vector2)(ref insideUnitCircle)).normalized * Mathf.Sin(num); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(val.x, val.y, Mathf.Cos(num)); return targetDirection * val2; } public static Vector3 GetPointOnUnitSphereCap(Vector3 targetDirection, float angle) { //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_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) //IL_0010: Unknown result type (might be due to invalid IL or missing references) return GetPointOnUnitSphereCap(Quaternion.LookRotation(targetDirection), angle); } public static Vector3 RandomPointOnCircle(Vector3 origin, float radius, Xoroshiro128Plus random) { //IL_0012: 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_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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) float num = random.RangeFloat(0f, MathF.PI * 2f); return origin + new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)) * radius; } public static float InverseHyperbolicScaling(float baseValue, float additionalValue, float maxValue, int itemCount) { return baseValue + (maxValue - baseValue) * (1f - 1f / (1f + additionalValue * (float)(itemCount - 1))); } public static float CustomHyperbolic(float amplificationPercentage, float max = 100f) { return (1f - max / (max + amplificationPercentage)) * max; } } public static class MiscUtils { public static bool HasUnlockable(NetworkUser networkUser, UnlockableDef unlockableDef) { if (!Object.op_Implicit((Object)(object)networkUser)) { return true; } LocalUser localUser = networkUser.localUser; if (localUser != null) { return localUser.userProfile.HasUnlockable(unlockableDef.cachedName); } return networkUser.unlockables.Contains(UnlockableCatalog.GetUnlockableDef(unlockableDef.cachedName)); } public static Vector3? RaycastToDirection(Vector3 position, float maxDistance, Vector3 direction, int layer) { //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_0019: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(new Ray(position, direction), ref val, maxDistance, layer, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val)).point; } return null; } public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> toShuffle, Xoroshiro128Plus random) { List<T> list = new List<T>(); foreach (T item in toShuffle) { list.Insert(random.RangeInt(0, list.Count + 1), item); } return list; } public static Vector3 FindClosestNodeToPosition(Vector3 position, HullClassification hullClassification, bool checkAirNodes = false) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_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_003a: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) NodeGraph val = (checkAirNodes ? SceneInfo.instance.airNodes : SceneInfo.instance.groundNodes); NodeIndex val2 = val.FindClosestNode(position, hullClassification, float.PositiveInfinity); if (val2 != NodeIndex.invalid) { Vector3 result = default(Vector3); val.GetNodePosition(val2, ref result); return result; } return Vector3.zero; } public static bool TeleportBody(CharacterBody characterBody, GameObject target, GameObject teleportEffect, HullClassification hullClassification, Xoroshiro128Plus rng, float minDistance = 20f, float maxDistance = 45f, bool teleportAir = false) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)characterBody)) { return false; } SpawnCard val = ScriptableObject.CreateInstance<SpawnCard>(); val.hullSize = hullClassification; val.nodeGraphType = (GraphType)(teleportAir ? 1 : 0); val.prefab = Resources.Load<GameObject>("SpawnCards/HelperPrefab"); GameObject val2 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(val, new DirectorPlacementRule { placementMode = (PlacementMode)1, position = target.transform.position, minDistance = minDistance, maxDistance = maxDistance }, rng)); if (Object.op_Implicit((Object)(object)val2)) { TeleportHelper.TeleportBody(characterBody, val2.transform.position); if (Object.op_Implicit((Object)(object)teleportEffect)) { EffectManager.SimpleEffect(teleportEffect, val2.transform.position, Quaternion.identity, true); } Object.Destroy((Object)(object)val2); Object.Destroy((Object)(object)val); return true; } Object.Destroy((Object)(object)val); return false; } public static Vector3? AboveTargetVectorFromDamageInfo(DamageInfo damageInfo, float distanceAboveTarget) { //IL_0050: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_006c: 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_007c: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_0121: 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_012b: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) if (damageInfo.rejected || !Object.op_Implicit((Object)(object)damageInfo.attacker)) { return null; } CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component)) { TeamMask enemyTeams = TeamMask.GetEnemyTeams(component.teamComponent.teamIndex); HurtBox val = new SphereSearch { radius = 1f, mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask, origin = damageInfo.position }.RefreshCandidates().FilterCandidatesByHurtBoxTeam(enemyTeams).OrderCandidatesByDistance() .FilterCandidatesByDistinctHurtBoxEntities() .GetHurtBoxes() .FirstOrDefault(); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.healthComponent) && Object.op_Implicit((Object)(object)val.healthComponent.body)) { CharacterBody body = val.healthComponent.body; Vector3 val2 = body.mainHurtBox.collider.ClosestPointOnBounds(body.transform.position + new Vector3(0f, 10000f, 0f)); Vector3? val3 = RaycastToDirection(val2, distanceAboveTarget, Vector3.up, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask)); if (val3.HasValue) { return val3.Value; } return val2 + Vector3.up * distanceAboveTarget; } } return null; } public static Vector3? AboveTargetBody(CharacterBody body, float distanceAbove) { //IL_0030: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body)) { return null; } Vector3 val = body.mainHurtBox.collider.ClosestPointOnBounds(body.transform.position + new Vector3(0f, 10000f, 0f)); Vector3? val2 = RaycastToDirection(val, distanceAbove, Vector3.up, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask)); if (val2.HasValue) { return val2.Value; } return val + Vector3.up * distanceAbove; } public static Dictionary<string, Vector3> GetAimSurfaceAlignmentInfo(Ray ray, int layerMask, float distance) { //IL_0007: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0045: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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) Dictionary<string, Vector3> dictionary = new Dictionary<string, Vector3>(); RaycastHit val = default(RaycastHit); if (!Physics.Raycast(ray, ref val, distance, layerMask, (QueryTriggerInteraction)1)) { return null; } Vector3 point = ((RaycastHit)(ref val)).point; Vector3 val2 = Vector3.Cross(((Ray)(ref ray)).direction, Vector3.up); Vector3 val3 = Vector3.ProjectOnPlane(((RaycastHit)(ref val)).normal, val2); Vector3 value = Vector3.Cross(val2, val3); dictionary.Add("Position", point); dictionary.Add("Right", val2); dictionary.Add("Forward", value); dictionary.Add("Up", val3); return dictionary; } public static FireProjectileInfo GetProjectile(GameObject prefab, float coeff, CharacterBody owner, DamageTypeCombo? damageTypeCombo = null) { //IL_0003: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_005f: 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_0076: 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) FireProjectileInfo val = default(FireProjectileInfo); val.damage = owner.damage * coeff; val.crit = owner.RollCrit(); val.projectilePrefab = prefab; val.owner = ((Component)owner).gameObject; val.position = owner.corePosition; val.rotation = Util.QuaternionSafeLookRotation(owner.inputBank.aimDirection); FireProjectileInfo result = val; if (damageTypeCombo.HasValue) { result.damageTypeOverride = damageTypeCombo; } return result; } public static Vector3? GroundPoint(this Vector3 point) { //IL_0001: 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_0011: Unknown result type (might be due to invalid IL or missing references) return RaycastToDirection(point, float.PositiveInfinity, Vector3.down, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask)); } public static Tuple<Vector3?, Vector3?> GroundPointWithNormal(this Vector3 point) { //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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_003d: 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) RaycastHit val = default(RaycastHit); if (Physics.Raycast(point + Vector3.up * 20f, Vector3.down, ref val, 4000f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask))) { return new Tuple<Vector3?, Vector3?>(((RaycastHit)(ref val)).point, ((RaycastHit)(ref val)).normal); } return new Tuple<Vector3?, Vector3?>(null, null); } public static void DeformPoint(Vector3 pos, float radius = 5f, float depth = 3f) { //IL_0001: 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_0052: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(pos, radius, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask)); MeshFilter val2 = default(MeshFilter); foreach (Collider val in array) { if (val is MeshCollider && ((Component)val).TryGetComponent<MeshFilter>(ref val2) && val2.mesh.isReadable) { DeformCollider(pos, radius, depth, val2, (MeshCollider)(object)((val is MeshCollider) ? val : null)); } } } public static void DeformCollider(Vector3 pos, float radius, float depth, MeshFilter filter, MeshCollider collider) { //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_003a: 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_0050: Unknown result type (might be due to invalid IL or missing references) if (!filter.mesh.isReadable) { return; } Matrix4x4 localToWorld = ((Component)filter).transform.localToWorldMatrix; Matrix4x4 worldToLocal = ((Component)filter).transform.worldToLocalMatrix; Vector3[] verts = (Vector3[])(object)new Vector3[filter.mesh.vertices.Length]; Vector3[] original = filter.mesh.vertices; List<Color> colors = new List<Color>(); filter.mesh.GetColors(colors); Parallel.For(0, verts.Length, delegate(int i, ParallelLoopState state) { //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) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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) Vector3 val = original[i]; Vector3 val2 = ((Matrix4x4)(ref localToWorld)).MultiplyPoint3x4(val); float num = Vector3.Distance(val2, pos); if (num <= radius) { float num2 = 1f - num / radius; val2 += Vector3.down * depth * num2; colors[i] = Color.Lerp(colors[i], Color.red, num2); } verts[i] = ((Matrix4x4)(ref worldToLocal)).MultiplyPoint3x4(val2); }); filter.mesh.SetVertices(verts.ToList()); filter.mesh.SetColors(colors); collider.sharedMesh = filter.mesh; } public static Vector3[] GetSafePositionsWithinDistance(Vector3 center, float distance) { //IL_0097: 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_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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (Object.op_Implicit((Object)(object)SceneInfo.instance) && Object.op_Implicit((Object)(object)SceneInfo.instance.groundNodes)) { NodeGraph groundNodes = SceneInfo.instance.groundNodes; List<Vector3> list = new List<Vector3>(); Node[] nodes = groundNodes.nodes; foreach (Node val in nodes) { if (Vector3.Distance(val.position, center) <= distance) { list.Add(val.position); } } return list.ToArray(); } return (Vector3[])(object)new Vector3[1] { center }; } internal static void GetSafePositionsWithinDistance() { throw new NotImplementedException(); } } public class LazyAddressable<T> where T : Object { private Func<T> func; private T asset = default(T); public T Asset { get { if (!Object.op_Implicit((Object)(object)asset)) { asset = func(); } return asset; } } public LazyAddressable(Func<T> func) { this.func = func; } public static implicit operator T(LazyAddressable<T> addressable) { return addressable.Asset; } } public class LazyIndex { private string target; private BodyIndex _value = (BodyIndex)(-1); public BodyIndex Value => UpdateValue(); public LazyIndex(string target) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) this.target = target; } public BodyIndex UpdateValue() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_002e: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if ((int)_value == -1 || (int)_value == -1) { _value = BodyCatalog.FindBodyIndex(target); } return _value; } public static implicit operator BodyIndex(LazyIndex index) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return index.Value; } } public static class NetworkingHelpers { public static T GetObjectFromNetIdValue<T>(uint netIdValue) { //IL_002c: 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) NetworkInstanceId key = default(NetworkInstanceId); ((NetworkInstanceId)(ref key))..ctor(netIdValue); NetworkIdentity value = null; if (NetworkServer.active) { NetworkServer.objects.TryGetValue(key, out value); } else { ClientScene.objects.TryGetValue(key, out value); } if (Object.op_Implicit((Object)(object)value)) { T component = ((Component)value).GetComponent<T>(); if (component != null) { return component; } } return default(T); } } public static class Events { public static uint Play_item_proc_TransferDebuffOnHit_applyToEnemy = 3512537690u; public static uint Play_item_proc_TransferDebuff