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 BepInEx.Logging;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
[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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("GoxOfBears")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GoxOfBears")]
[assembly: AssemblyTitle("GoxOfBears")]
[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 GoxOfBears
{
public static class GoxOfBears
{
internal static class Logger
{
private static readonly ManualLogSource logSource = Logger.CreateLogSource("GoxOfBears");
public static void Info(object data)
{
logSource.LogInfo(data);
}
public static void Error(object data)
{
logSource.LogError(data);
}
public static void Warn(object data)
{
logSource.LogWarning(data);
}
public static void Fatal(object data)
{
logSource.LogFatal(data);
}
public static void Message(object data)
{
logSource.LogMessage(data);
}
public static void Debug(object data)
{
logSource.LogDebug(data);
}
}
public static TypeReference FuckingStupid;
public static AssemblyDefinition WhatTheFuck;
public static IEnumerable<string> TargetDLLs { get; } = new string[1] { "RoR2.dll" };
public static void Patch(AssemblyDefinition def)
{
//IL_0021: 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_0085: Expected O, but got Unknown
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Expected O, but got Unknown
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
try
{
TypeDefinition type = def.MainModule.GetType("RoR2.PickupDropletController");
Logger.Error(((MemberReference)type).Name);
MethodAttributes val = (MethodAttributes)22;
AssemblyDefinition val2 = AssemblyDefinition.ReadAssembly(typeof(void).Assembly.Location);
TypeReference val3 = val2.MainModule.ImportReference(typeof(void));
Logger.Error(((MemberReference)val3).Name);
WhatTheFuck = AssemblyDefinition.ReadAssembly(Path.Combine(Paths.ManagedPath, "UnityEngine.CoreModule.dll"));
MethodDefinition val4 = new MethodDefinition("CreatePickupDroplet", val, val3);
ParameterDefinition val5 = new ParameterDefinition("pickupInfo", (ParameterAttributes)0, (TypeReference)(object)def.MainModule.GetType("RoR2.GenericPickupController/CreatePickupInfo"));
FuckingStupid = ((MemberReference)type).Module.ImportReference((TypeReference)(object)WhatTheFuck.MainModule.GetType("UnityEngine.Vector3"));
ParameterDefinition val6 = new ParameterDefinition("position", (ParameterAttributes)0, FuckingStupid);
ParameterDefinition val7 = new ParameterDefinition("velocity", (ParameterAttributes)0, FuckingStupid);
MethodDefinition val8 = ((IEnumerable<MethodDefinition>)type.Methods).Where((MethodDefinition x) => ((MemberReference)x).Name == "CreatePickupDroplet").Last();
((MethodReference)val4).Parameters.Add(val5);
((MethodReference)val4).Parameters.Add(val6);
((MethodReference)val4).Parameters.Add(val7);
val4.Body.Instructions.Add(Instruction.Create(OpCodes.Ldarg_0));
val4.Body.Instructions.Add(Instruction.Create(OpCodes.Ldarg_2));
val4.Body.Instructions.Add(Instruction.Create(OpCodes.Call, (MethodReference)(object)val8));
val4.Body.Instructions.Add(Instruction.Create(OpCodes.Ret));
type.Methods.Add(val4);
Logger.Error("Patching successful.");
}
catch (Exception data)
{
Logger.Error(data);
}
}
public static void Initialize()
{
}
}
}