using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UltrakillIfItWasWoke.Utils;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("UltrakillIfItWasWoke")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("UltrakillIfItWasWoke")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 UltrakillIfItWasWoke
{
[BepInPlugin("doomahreal.ultrakill.wokekill", "My first plugin", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(RevolverBeam), "Start")]
private class Patch
{
private static void Postfix(RevolverBeam __instance)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
//IL_0044: 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_0064: 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_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_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: 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_010f: Expected O, but got Unknown
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_024c: Unknown result type (might be due to invalid IL or missing references)
if (CachedTextures.Count == 0)
{
return;
}
LineRenderer component = ((Component)__instance).GetComponent<LineRenderer>();
if ((Object)(object)component == (Object)null)
{
return;
}
Gradient val = new Gradient();
val.colorKeys = (GradientColorKey[])(object)new GradientColorKey[2]
{
new GradientColorKey(Color.white, 0f),
new GradientColorKey(Color.white, 1f)
};
val.alphaKeys = (GradientAlphaKey[])(object)new GradientAlphaKey[2]
{
new GradientAlphaKey(1f, 0f),
new GradientAlphaKey(1f, 1f)
};
component.colorGradient = val;
string[] array = CachedTextures.Keys.Where((string k) => k != "flash").ToArray();
string key = array[Random.Range(0, array.Length)];
Texture2D mainTexture = CachedTextures[key];
Material val2 = new Material(((Renderer)component).material);
val2.mainTexture = (Texture)(object)mainTexture;
((Renderer)component).material = val2;
Texture2D val3 = CachedTextures["flash"];
SpriteRenderer[] componentsInChildren = ((Component)__instance).GetComponentsInChildren<SpriteRenderer>(true);
foreach (SpriteRenderer val4 in componentsInChildren)
{
if (((Object)val4).name.ToLower().Contains("muzzle"))
{
val4.color = AverageColors[key];
val4.sprite = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0.5f, 0.5f), 100f);
}
}
Light component2 = ((Component)__instance).GetComponent<Light>();
if (component2 != null)
{
component2.color = AverageColors[CachedTextures.Keys.Where((string k) => k != "flash").ElementAt(Random.Range(0, CachedTextures.Keys.Count((string k) => k != "flash")))];
}
}
}
public static Dictionary<string, Texture2D> CachedTextures = new Dictionary<string, Texture2D>();
public static Dictionary<string, Color> AverageColors = new Dictionary<string, Color>();
private static Harmony harmony;
private void Awake()
{
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Expected O, but got Unknown
Debug.Log((object)"im twitter's scariest being! A Straight White Male. *evil ass laughter* ");
IMLOADINGITSOHARDDDD.Initialize();
LoadTexture("tran.png");
LoadTexture("pan.png");
LoadTexture("non.png");
LoadTexture("les.png");
LoadTexture("gay.png");
LoadTexture("bi.png");
LoadTexture("ase.png");
LoadTexture("age.png");
LoadTexture("muzzleflashwhite1.png");
harmony = new Harmony("doomahreal.ultrakill.wokekill");
harmony.PatchAll();
}
private void LoadTexture(string file)
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
Texture2D val = IMLOADINGITSOHARDDDD.thegrundle.LoadAsset<Texture2D>("Assets/Custom/improudofyou/" + file);
if (!((Object)(object)val == (Object)null))
{
string text = Path.GetFileNameWithoutExtension(file);
if (text == "muzzleflashwhite1")
{
text = "flash";
}
CachedTextures[text] = val;
AverageColors[text] = CalculateAverageColor(val);
}
}
private Color CalculateAverageColor(Texture2D tex)
{
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
Color[] pixels = tex.GetPixels();
float num = 0f;
float num2 = 0f;
float num3 = 0f;
float num4 = 0f;
for (int i = 0; i < pixels.Length; i++)
{
num += pixels[i].r;
num2 += pixels[i].g;
num3 += pixels[i].b;
num4 += pixels[i].a;
}
float num5 = pixels.Length;
return new Color(num / num5, num2 / num5, num3 / num5, num4 / num5);
}
}
internal static class MyPluginInfo
{
public const string PLUGIN_GUID = "doomahreal.ultrakill.wokekill";
public const string PLUGIN_NAME = "My first plugin";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace UltrakillIfItWasWoke.Utils
{
public static class IMLOADINGITSOHARDDDD
{
private const string skibidifile = "UltrakillIfItWasWoke.ultrakillifitwaswoke!.bundle";
public static AssetBundle? thegrundle;
public static void Initialize()
{
if ((Object)(object)thegrundle != (Object)null)
{
return;
}
Assembly assembly = typeof(IMLOADINGITSOHARDDDD).Assembly;
using Stream stream = assembly.GetManifestResourceStream("UltrakillIfItWasWoke.ultrakillifitwaswoke!.bundle");
if (stream == null)
{
Debug.LogError((object)"dude you LOADED THE WRONG FUCKING THING YOU STUPID IDIOT");
return;
}
using MemoryStream memoryStream = new MemoryStream();
stream.CopyTo(memoryStream);
thegrundle = AssetBundle.LoadFromMemory(memoryStream.ToArray());
if ((Object)(object)thegrundle == (Object)null)
{
Debug.LogError((object)"nice one tons of hussle fun, next time try loading it correctly");
}
else
{
Debug.Log((object)"yayyyyyy grungle woaded");
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
internal IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}