using System;
using System.Diagnostics;
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 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: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("EmpressBlood")]
[assembly: AssemblyTitle("EmpressBlood")]
[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;
}
}
}
[BepInPlugin("com.empress.blood", "EmpressBlood", "1.0.0")]
public class EmpressBlood : BaseUnityPlugin
{
public static class BloodPatches
{
[HarmonyPatch(typeof(EnemyHealth), "HurtRPC")]
[HarmonyPostfix]
public static void EnemyHurtRPC(EnemyHealth __instance, int _damage, Vector3 _hurtDirection)
{
//IL_0007: 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)
Splatter(((Component)__instance).transform.position, _hurtDirection);
}
[HarmonyPatch(typeof(PlayerHealth), "Hurt")]
[HarmonyPostfix]
public static void PlayerHurt(PlayerHealth __instance, int damage)
{
//IL_0007: 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)
Splatter(((Component)__instance).transform.position, Vector3.down);
}
[HarmonyPatch(typeof(PlayerHealth), "UpdateHealthRPC")]
[HarmonyPrefix]
public static void PlayerUpdateHealthRPC(PlayerHealth __instance, int healthNew, int ___health)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
if (healthNew < ___health)
{
Splatter(((Component)__instance).transform.position, Vector3.down);
}
}
}
private static Texture2D bloodTexture;
private static Material bloodMaterial;
private void Awake()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Expected O, but got Unknown
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Expected O, but got Unknown
//IL_00fb: 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_0032: 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_007f: Unknown result type (might be due to invalid IL or missing references)
bloodTexture = new Texture2D(64, 64);
for (int i = 0; i < 64; i++)
{
for (int j = 0; j < 64; j++)
{
float num = Vector2.Distance(new Vector2((float)i, (float)j), new Vector2(32f, 32f));
if (num < 24f + Random.Range(-8f, 8f))
{
bloodTexture.SetPixel(i, j, new Color(0.6f, 0f, 0f, Random.Range(0.8f, 1f)));
}
else
{
bloodTexture.SetPixel(i, j, Color.clear);
}
}
}
bloodTexture.Apply();
bloodMaterial = new Material(Shader.Find("Sprites/Default"));
bloodMaterial.mainTexture = (Texture)(object)bloodTexture;
bloodMaterial.color = Color.white;
Harmony.CreateAndPatchAll(typeof(BloodPatches), (string)null);
}
public static void Splatter(Vector3 position, Vector3 direction)
{
//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_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_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_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_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
if (direction == Vector3.zero)
{
direction = Vector3.down;
}
RaycastHit hit = default(RaycastHit);
for (int i = 0; i < Random.Range(1, 4); i++)
{
Vector3 val = direction + Random.insideUnitSphere;
Vector3 normalized = ((Vector3)(ref val)).normalized;
if (Physics.Raycast(position, normalized, ref hit, 5f, -1, (QueryTriggerInteraction)1))
{
CreateDecal(hit);
}
}
}
private static void CreateDecal(RaycastHit hit)
{
//IL_001c: 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_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_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_004f: 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_0096: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.CreatePrimitive((PrimitiveType)5);
Object.Destroy((Object)(object)val.GetComponent<Collider>());
val.transform.position = ((RaycastHit)(ref hit)).point + ((RaycastHit)(ref hit)).normal * 0.02f;
val.transform.rotation = Quaternion.LookRotation(-((RaycastHit)(ref hit)).normal);
val.transform.Rotate(0f, 0f, (float)Random.Range(0, 360));
val.transform.localScale = Vector3.one * Random.Range(0.3f, 1.2f);
MeshRenderer component = val.GetComponent<MeshRenderer>();
((Renderer)component).material = bloodMaterial;
}
}