using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Mimics;
using Mimics.API;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Mimics")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("me.loaforc.fairermimics")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("1.0.3")]
[assembly: AssemblyProduct("FairerMimics")]
[assembly: AssemblyTitle("me.loaforc.fairermimics")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace FairerMimics
{
[BepInPlugin("me.loaforc.fairermimics", "FairerMimics", "1.0.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class FairerMimics : BaseUnityPlugin
{
internal int Damage;
public static FairerMimics Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
internal static Harmony Harmony { get; set; }
private void Awake()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Expected O, but got Unknown
Logger = Logger.CreateLogSource("me.loaforc.fairermimics");
Instance = this;
Harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "me.loaforc.fairermimics");
Damage = ((BaseUnityPlugin)this).Config.Bind<int>("Attacking", "Damage", 60, new ConfigDescription("How much damage should mimics deal, instead of just instantly killing", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>())).Value;
Logger.LogInfo((object)"me.loaforc.fairermimics:1.0.3 by loaforc has loaded :3");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "me.loaforc.fairermimics";
public const string PLUGIN_NAME = "FairerMimics";
public const string PLUGIN_VERSION = "1.0.3";
}
}
namespace FairerMimics.Patches
{
[HarmonyPatch(typeof(GameNetworkManager))]
internal static class GameNetworkManagerPatch
{
[HarmonyPatch("Start")]
[HarmonyPrefix]
private static void EnsureAllClientsHaveMod()
{
//IL_0005: 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_0013: Expected O, but got Unknown
GameObject val = new GameObject("me.loaforc.fairermimics")
{
hideFlags = (HideFlags)61
};
NetworkObject val2 = val.AddComponent<NetworkObject>();
val2.GlobalObjectIdHash = BitConverter.ToUInt32(Encoding.UTF8.GetBytes(((Object)val).name), 0);
NetworkManager.Singleton.AddNetworkPrefab(val);
}
}
[HarmonyPatch(typeof(MimicDoor))]
internal static class MimicDoorPatch
{
[HarmonyPatch("Attack")]
[HarmonyPostfix]
private static void ReplaceKillPlayerWithDamage(MimicDoor __instance, int playerId, ref IEnumerator __result)
{
try
{
__result = ReplacementAttack(playerId, __instance);
}
catch (Exception ex)
{
FairerMimics.Logger.LogError((object)"Failed to replace .Attack() !!");
FairerMimics.Logger.LogError((object)ex);
}
}
private static IEnumerator ReplacementAttack(int playerId, MimicDoor door)
{
FairerMimics.Logger.LogDebug((object)"replacement attack");
PlayerControllerB player = StartOfRound.Instance.allPlayerScripts[playerId];
MimicsAPI.MainAPI.OnMimicAttackStart(door, player);
door.attacking = true;
door.interactTrigger.interactable = false;
door.mimicAnimator.SetTrigger("Attack");
door.playerTarget.transform.position = ((Component)player).transform.position;
yield return (object)new WaitForSeconds(0.1f);
door.playerTarget.transform.position = ((Component)player).transform.position;
yield return (object)new WaitForSeconds(0.1f);
door.playerTarget.transform.position = ((Component)player).transform.position;
yield return (object)new WaitForSeconds(0.1f);
door.playerTarget.transform.position = ((Component)player).transform.position;
yield return (object)new WaitForSeconds(0.1f);
float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)door.frameBox).transform.position);
if (num < 8f)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
}
else if (num < 14f)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
}
yield return (object)new WaitForSeconds(0.2f);
if (((NetworkBehaviour)player).IsOwner && Vector3.Distance(((Component)player).transform.position, ((Component)door).transform.position) < 8.45f)
{
GameNetworkManager.Instance.localPlayerController.DamagePlayer(FairerMimics.Instance.Damage, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
}
float startTime = Time.timeSinceLevelLoad;
yield return (object)new WaitUntil((Func<bool>)(() => (Object)(object)player.deadBody != (Object)null || Time.timeSinceLevelLoad - startTime > 4f));
if ((Object)(object)player.deadBody != (Object)null)
{
player.deadBody.attachedTo = door.grabPoint.transform;
player.deadBody.attachedLimb = player.deadBody.bodyParts[5];
player.deadBody.matchPositionExactly = true;
for (int i = 0; i < player.deadBody.bodyParts.Length; i++)
{
((Component)player.deadBody.bodyParts[i]).GetComponent<Collider>().excludeLayers = LayerMask.op_Implicit(-1);
}
}
yield return (object)new WaitForSeconds(2f);
if ((Object)(object)player.deadBody != (Object)null)
{
player.deadBody.attachedTo = null;
player.deadBody.attachedLimb = null;
player.deadBody.matchPositionExactly = false;
((Component)((Component)player.deadBody).transform.GetChild(0)).gameObject.SetActive(false);
player.deadBody = null;
}
yield return (object)new WaitForSeconds(4.5f);
door.attacking = false;
door.interactTrigger.interactable = true;
MimicsAPI.MainAPI.OnMimicAttackEnd(door);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}