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.Bootstrap;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using RoR2;
using RoR2.Skills;
using SneedHooks;
using UnityEngine;
using UnityEngine.AddressableAssets;
[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: AssemblyCompany("BlightReturnsRework")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BlightReturnsRework")]
[assembly: AssemblyTitle("BlightReturnsRework")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace R2API.Utils
{
[AttributeUsage(AttributeTargets.Assembly)]
public class ManualNetworkRegistrationAttribute : Attribute
{
}
}
namespace BlightReturnsRework
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.Moffein.BlightReturnsRework", "BlightReturnsRework", "1.0.0")]
public class BlightReturnsReworkPlugin : BaseUnityPlugin
{
public static float damageMultPerBuff = 0.05f;
public static PluginInfo pluginInfo;
private void Awake()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Expected O, but got Unknown
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Expected O, but got Unknown
pluginInfo = ((BaseUnityPlugin)this).Info;
Language.SetFolders += new hook_SetFolders(LoadLanguage.fixme);
if (Chainloader.PluginInfos.ContainsKey("com.Moffein.LinearDamage"))
{
ModifyFinalDamage.ModifyFinalDamageActions = (ModifyFinalDamageDelegate)Delegate.Combine((Delegate?)(object)ModifyFinalDamage.ModifyFinalDamageActions, (Delegate?)new ModifyFinalDamageDelegate(ModifyFinalDamage_Additive));
}
else
{
ModifyFinalDamage.ModifyFinalDamageActions = (ModifyFinalDamageDelegate)Delegate.Combine((Delegate?)(object)ModifyFinalDamage.ModifyFinalDamageActions, (Delegate?)new ModifyFinalDamageDelegate(ModifyFinalDamage));
}
DotController.AddDot += new hook_AddDot(ModifyBlight);
GlobalEventManager.ProcessHitEnemy += new Manipulator(GlobalEventManager_ProcessHitEnemy);
RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(OnLoadActions));
}
private void OnLoadActions()
{
//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)
Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Croco/CrocoPassiveBlight.asset").WaitForCompletion().skillDescriptionToken = "CROCO_PASSIVE_ALT_DESCRIPTION_RETURNSREWORK";
}
private void GlobalEventManager_ProcessHitEnemy(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
ILCursor val = new ILCursor(il);
if (val.TryGotoNext(new Func<Instruction, bool>[2]
{
(Instruction x) => ILPatternMatchingExt.MatchLdfld<DamageInfo>(x, "damageType"),
(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1048576)
}) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 5f)
}))
{
val.EmitDelegate<Func<float, float>>((Func<float, float>)((float x) => 10f));
}
}
private void ModifyFinalDamage(DamageModifierArgs damageModifierArgs, DamageInfo damageInfo, HealthComponent victim, CharacterBody victimBody)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Invalid comparison between Unknown and I4
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
int buffCount = victimBody.GetBuffCount(Buffs.Blight);
if (buffCount > 0)
{
damageModifierArgs.damageMultFinal *= 1f + damageMultPerBuff * (float)buffCount;
if ((int)damageInfo.dotIndex != 5)
{
damageInfo.damageColorIndex = (DamageColorIndex)9;
}
}
}
private void ModifyFinalDamage_Additive(DamageModifierArgs damageModifierArgs, DamageInfo damageInfo, HealthComponent victim, CharacterBody victimBody)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Invalid comparison between Unknown and I4
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
int buffCount = victimBody.GetBuffCount(Buffs.Blight);
if (buffCount > 0)
{
damageModifierArgs.damageMultAdd += damageMultPerBuff * (float)buffCount;
if ((int)damageInfo.dotIndex != 5)
{
damageInfo.damageColorIndex = (DamageColorIndex)9;
}
}
}
private void ModifyBlight(orig_AddDot orig, DotController self, GameObject attackerObject, float duration, DotIndex dotIndex, float damageMultiplier, uint? maxStacksFromAttacker, float? totalDamage, DotIndex? preUpgradeDotIndex)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Invalid comparison between Unknown and I4
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Invalid comparison between Unknown and I4
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Invalid comparison between Unknown and I4
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
if ((int)dotIndex == 5)
{
foreach (DotStack dotStack in self.dotStackList)
{
if ((Object)(object)dotStack.attackerObject == (Object)(object)attackerObject && dotStack.dotIndex == dotIndex)
{
damageMultiplier = 0f;
break;
}
}
}
orig.Invoke(self, attackerObject, duration, dotIndex, damageMultiplier, maxStacksFromAttacker, totalDamage, preUpgradeDotIndex);
if ((int)dotIndex != 5)
{
return;
}
for (int i = 0; i < self.dotStackList.Count; i++)
{
if ((int)self.dotStackList[i].dotIndex == 5)
{
self.dotStackList[i].timer = Mathf.Max(self.dotStackList[i].timer, duration);
}
}
}
}
internal class LoadLanguage
{
internal static string assemblyDir => Path.GetDirectoryName(BlightReturnsReworkPlugin.pluginInfo.Location);
internal static string languageRoot => Path.Combine(assemblyDir, "language");
internal static void fixme(orig_SetFolders orig, Language self, IEnumerable<string> newFolders)
{
if (Directory.Exists(languageRoot))
{
IEnumerable<string> second = Directory.EnumerateDirectories(Path.Combine(languageRoot), self.name);
orig.Invoke(self, newFolders.Union(second));
}
else
{
orig.Invoke(self, newFolders);
}
}
}
}