Decompiled source of Keep Loot on Failure v1.0.1

Keep_Loot_on_Failure.dll

Decompiled a month ago
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 Il2CppInterop.Runtime.InteropTypes.Arrays;
using Microsoft.CodeAnalysis;
using P2;
using P2.Bases;
using P2.Game;
using P2.GameSystem.Item;

[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("Keep_Loot_on_Failure")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Keep Loot on Failure")]
[assembly: AssemblyTitle("Keep_Loot_on_Failure")]
[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 Keep_Loot_on_Failure
{
	[BepInPlugin("com.melonthug.keeplootonfailure", "Keep Loot on Failure", "1.0.0")]
	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.keeplootonfailure");
			val.PatchAll();
			Logger.LogInfo((object)"[Keep Loot on Failure] loaded");
		}
	}
	[HarmonyPatch(typeof(Game), "setGameEnd")]
	internal class setGameEndHook
	{
		private static void Prefix(GameEndType gameEndType, Game __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Invalid comparison between Unknown and I4
			Operator val = new Operator();
			if ((int)gameEndType != 2)
			{
				return;
			}
			LaboCommon instance = LaboCommon.getInstance();
			if (instance == null)
			{
				return;
			}
			LaboGlobalData laboGlobalDataPtr_ = instance.laboGlobalDataPtr_;
			if (laboGlobalDataPtr_ == null)
			{
				return;
			}
			GlobalData basesData = laboGlobalDataPtr_.basesData;
			if (basesData == null)
			{
				return;
			}
			basesData.energy += __instance.settingParam_.pGameSettingData.temporaryEnergy;
			if (basesData.energy > 99999)
			{
				basesData.energy = 99999u;
			}
			foreach (TemporaryItem item in (Il2CppArrayBase<TemporaryItem>)(object)__instance.settingParam_.pGameSettingData.temporaryItem)
			{
				val.addItem((int)item.itemId, (int)item.num);
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Keep_Loot_on_Failure";

		public const string PLUGIN_NAME = "Keep Loot on Failure";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}