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 BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using P1.GameSystem.Effect;
using P1.System.Collision;
using P2.GameSystem.Effect;
using P2.System.Collision;
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(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Auto_Collect_Items")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Auto Collect Items")]
[assembly: AssemblyTitle("Auto_Collect_Items")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace Auto_Collect_Items
{
[BepInPlugin("com.melonthug.autocollectitems", "Auto Collect Items", "2.0.2")]
public class Plugin : BasePlugin
{
public static ManualLogSource Logger;
public override void Load()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
Logger = ((BasePlugin)this).Log;
Harmony val = new Harmony("com.melonthug.autocollectitems");
val.PatchAll();
Logger.LogInfo((object)"[Auto Collect Items] loaded");
}
}
[HarmonyPatch(typeof(Manager), "generateItemEffect")]
internal class generateItemEffectP2Hook
{
private static void Postfix(ref int itemId, ref uint effectId, ref Vector2 position, ref Vector2 velocity, ref float time, Manager __instance, Effect __result)
{
//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_0055: 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_005b: 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_0067: 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_006d: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: 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_008f: 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_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_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: 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_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
if (__result == null)
{
Plugin.Logger.LogError((object)"P2: Failed to collect item. __result is null.");
return;
}
if (__result.collisionBody_ == null)
{
Plugin.Logger.LogError((object)"P2: Failed to collect item. __result.collisionBody is null.");
return;
}
ShapeBox tmpBuffer_ = __result.collisionBody_.tmpBuffer_;
Vector2 val = tmpBuffer_.center - tmpBuffer_.extent;
Vector2 val2 = tmpBuffer_.center + tmpBuffer_.extent;
val -= new Vector2(5000f, 5000f);
val2 += new Vector2(5000f, 5000f);
Vector2 val3 = (val + val2) * 0.5f;
Vector2 val4 = (val2 - val) * 0.5f;
__result.collisionBody_.setShapeBox(ref val3, ref val4);
}
}
[HarmonyPatch(typeof(Manager), "generateEffect")]
internal class generateEffectP1Hook
{
private static void Postfix(int id, ref Vector2 position, ref Vector2 velocity, int troopType, float time, int userId, Manager __instance, Effect __result)
{
//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_009b: 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_00a2: 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_00a9: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: 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_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: 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_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
if (__result == null)
{
Plugin.Logger.LogError((object)"P1: Failed to collect item. __result is null.");
return;
}
if (__result.staticEffect_ == null)
{
Plugin.Logger.LogError((object)"P1: Failed to collect item. __result.staticEffect is null.");
return;
}
int categoryId = __result.staticEffect_.getCategoryId();
if (categoryId >= 3 && categoryId <= 5)
{
if (__result.collisionBody_ == null)
{
Plugin.Logger.LogError((object)"P1: Failed to collect item. __result.collisionBody is null.");
return;
}
ShapeBox tmpBuffer_ = __result.collisionBody_.tmpBuffer_;
Vector2 val = tmpBuffer_.center - tmpBuffer_.extent;
Vector2 val2 = tmpBuffer_.center + tmpBuffer_.extent;
val -= new Vector2(5000f, 5000f);
val2 += new Vector2(5000f, 5000f);
Vector2 val3 = (val + val2) * 0.5f;
Vector2 val4 = (val2 - val) * 0.5f;
__result.collisionBody_.setShapeBox(ref val3, ref val4);
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Auto_Collect_Items";
public const string PLUGIN_NAME = "Auto Collect Items";
public const string PLUGIN_VERSION = "1.0.0";
}
}