Decompiled source of NoMoreRobbery v1.0.0

NoRobberyMod.dll

Decompiled 6 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AddWatermark;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using LBoL.Base;
using LBoL.ConfigData;
using LBoL.Core;
using LBoL.Core.Battle;
using LBoL.Core.Battle.BattleActions;
using LBoL.Core.Cards;
using LBoL.Core.StatusEffects;
using LBoL.Core.Units;
using LBoL.EntityLib.Cards.Enemy;
using LBoL.EntityLib.EnemyUnits.Character;
using LBoLEntitySideloader;
using LBoLEntitySideloader.Attributes;
using LBoLEntitySideloader.CustomHandlers;
using LBoLEntitySideloader.Entities;
using LBoLEntitySideloader.Resource;
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: IgnoresAccessChecksTo("LBoL.Base")]
[assembly: IgnoresAccessChecksTo("LBoL.ConfigData")]
[assembly: IgnoresAccessChecksTo("LBoL.Core")]
[assembly: IgnoresAccessChecksTo("LBoL.EntityLib")]
[assembly: IgnoresAccessChecksTo("LBoL.Presentation")]
[assembly: IgnoresAccessChecksTo("Untitled.ConfigDataBuilder.Base")]
[assembly: AssemblyCompany("NoRobberyMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+65797270fcc890e46bd281616ee2feac873d78bc")]
[assembly: AssemblyProduct("NoRobberyMod")]
[assembly: AssemblyTitle("NoRobberyMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace NoRobberyMod
{
	[BepInPlugin("gluee.lbol.norobbery", "No Robbery Mod", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInProcess("LBoL.exe")]
	public class BepinexPlugin : BaseUnityPlugin
	{
		private static readonly Harmony harmony = PInfo.harmony;

		internal static ManualLogSource log;

		internal static TemplateSequenceTable sequenceTable = new TemplateSequenceTable(0);

		internal static IResourceSource embeddedSource = (IResourceSource)new EmbeddedSource(Assembly.GetExecutingAssembly());

		internal static DirectorySource directorySource = new DirectorySource("gluee.lbol.norobbery", "");

		private void Awake()
		{
			log = ((BaseUnityPlugin)this).Logger;
			Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			EntityManager.RegisterSelf();
			harmony.PatchAll();
			if (Chainloader.PluginInfos.ContainsKey("neo.lbol.tools.watermark"))
			{
				WatermarkWrapper.ActivateWatermark();
			}
			Handlers.RegisterHandlers();
		}

		private void OnDestroy()
		{
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
	public sealed class BribeEffect : StatusEffectTemplate
	{
		public override IdContainer GetId()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			return IdContainer.op_Implicit("BribeStatus");
		}

		public override LocalizationOption LoadLocalization()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			GlobalLocalization val = new GlobalLocalization(BepinexPlugin.embeddedSource);
			val.LocalizationFiles.AddLocaleFile((Locale)0, "StatusEffectsEn.yaml");
			return (LocalizationOption)(object)val;
		}

		public override Sprite LoadSprite()
		{
			return ResourceLoader.LoadSprite("BribeSE.png", BepinexPlugin.embeddedSource, (Rect?)null, 1, (Vector2?)null);
		}

		public override StatusEffectConfig MakeConfig()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			return new StatusEffectConfig(0, "", 10, (StatusEffectType)2, false, true, (int?)null, true, (StackType?)(StackType)0, false, (StackType?)(StackType)0, (DurationDecreaseTiming)0, false, (StackType?)(StackType)3, (StackType?)(StackType)3, false, (Keyword)0, (IReadOnlyList<string>)new List<string>(), "Default", "Default", "Default");
		}
	}
	[EntityLogic(typeof(BribeEffect))]
	public sealed class BribeStatus : StatusEffect
	{
		public int Bribe => ((Card)Library.CreateCard<Bribery>()).MoneyCost;

		protected override void OnAdded(Unit unit)
		{
			EnemyUnit val = (EnemyUnit)(object)((unit is EnemyUnit) ? unit : null);
			((StatusEffect)this).HandleOwnerEvent<DieEventArgs>(val.EnemyPointGenerating, (GameEventHandler<DieEventArgs>)OnDie);
		}

		private void OnDie(DieEventArgs args)
		{
			args.Money += ((StatusEffect)this).Level;
		}
	}
	internal static class Handlers
	{
		public static void RegisterHandlers()
		{
			CHandlerManager.RegisterBattleEventHandler<CardUsingEventArgs>((EventProvider<CardUsingEventArgs, BattleController>)((BattleController battle) => battle.CardUsed), (GameEventHandler<CardUsingEventArgs>)OnCardUsed, (Predicate<BattleController>)null, (GameEventPriority)10);
		}

		private static void OnCardUsed(CardUsingEventArgs args)
		{
			Debug.Log((object)"hi1");
			Card card = args.Card;
			Bribery val = (Bribery)(object)((card is Bribery) ? card : null);
			if (val != null)
			{
				BattleController battle = ((Card)val).Battle;
				List<EnemyUnit> list = ((IEnumerable<EnemyUnit>)battle.EnemyGroup).Where((EnemyUnit u) => u is Long && ((Unit)u).IsAlive).ToList();
				if (list.Count > 1)
				{
					Debug.LogWarning((object)"Multiple Long exists");
					return;
				}
				if (list.Count == 0)
				{
					Debug.LogWarning((object)"Bribery is used while no Long");
					return;
				}
				Debug.Log((object)"hi2");
				EnemyUnit val2 = list.First();
				battle.React(Reactor.op_Implicit((BattleAction)(object)new ApplyStatusEffectAction<BribeStatus>((Unit)(object)val2, (int?)((Card)val).MoneyCost, (int?)null, (int?)null, (int?)null, 0f, true)), (GameEntity)(object)val2, (ActionCause)2);
			}
		}
	}
	public static class PInfo
	{
		public const string GUID = "gluee.lbol.norobbery";

		public const string Name = "No Robbery Mod";

		public const string version = "1.0.0";

		public static readonly Harmony harmony = new Harmony("gluee.lbol.norobbery");
	}
	internal class WatermarkWrapper
	{
		[MethodImpl(MethodImplOptions.NoInlining)]
		internal static void ActivateWatermark()
		{
			API.ActivateWatermark();
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		internal IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}