using System;
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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using On.RoR2.CharacterAI;
using RoR2;
using RoR2.CharacterAI;
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: AssemblyCompany("BetterJadeElephant")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BetterJadeElephant")]
[assembly: AssemblyTitle("BetterJadeElephant")]
[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 BetterJadeElephant
{
[BepInPlugin("prodzpod.BetterJadeElephant", "BetterJadeElephant", "1.0.0")]
public class Main : BaseUnityPlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static Action <>9__14_0;
public static Action <>9__14_1;
public static Func<TimedBuff, bool> <>9__14_7;
public static hook_UpdateBuffs <>9__14_2;
public static Func<Instruction, bool> <>9__14_8;
public static Manipulator <>9__14_3;
public static hook_RecalculateStats <>9__14_4;
public static hook_ManagedFixedUpdate <>9__14_5;
public static hook_GetVisibilityLevel_TeamIndex <>9__14_6;
internal void <Awake>b__14_0()
{
Equipment.GainArmor.cooldown = Cooldown.Value;
}
internal void <Awake>b__14_1()
{
if (Elephant > 0f)
{
Elephant -= Time.fixedDeltaTime;
}
}
internal void <Awake>b__14_2(orig_UpdateBuffs orig, CharacterBody self, float dt)
{
orig.Invoke(self, dt);
if (self.HasBuff(Buffs.ElephantArmorBoost))
{
Elephant = Mathf.Max(Elephant, self.timedBuffs.First((TimedBuff x) => x.buffIndex == Buffs.ElephantArmorBoost.buffIndex).timer);
}
}
internal bool <Awake>b__14_7(TimedBuff x)
{
//IL_0001: 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)
return x.buffIndex == Buffs.ElephantArmorBoost.buffIndex;
}
internal void <Awake>b__14_3(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
float num = default(float);
val.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num)
});
val.Emit(OpCodes.Pop);
val.Emit(OpCodes.Ldc_R4, Duration.Value);
}
internal bool <Awake>b__14_8(Instruction x)
{
float num = default(float);
return ILPatternMatchingExt.MatchLdcR4(x, ref num);
}
internal void <Awake>b__14_4(orig_RecalculateStats orig, CharacterBody self)
{
orig.Invoke(self);
if (self.HasBuff(Buffs.ElephantArmorBoost))
{
self.armor += Armor.Value - 500f;
}
}
internal void <Awake>b__14_5(orig_ManagedFixedUpdate orig, BaseAI self, float dt)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
<>c__DisplayClass14_0 CS$<>8__locals0 = new <>c__DisplayClass14_0
{
self = self
};
if (Elephant > 0f)
{
SphereSearch val = new SphereSearch
{
mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask,
origin = CS$<>8__locals0.self.body.corePosition,
radius = AggroRange.Value
};
val.RefreshCandidates();
val.FilterCandidatesByDistinctHurtBoxEntities();
HurtBox[] array = val.GetHurtBoxes().Where(delegate(HurtBox x)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
CharacterBody body = x.healthComponent.body;
int result;
if (Object.op_Implicit((Object)(object)body))
{
TeamMask enemyTeams = TeamMask.GetEnemyTeams(CS$<>8__locals0.self.body.teamComponent.teamIndex);
if (((TeamMask)(ref enemyTeams)).HasTeam(body.teamComponent.teamIndex))
{
result = (body.HasBuff(Buffs.ElephantArmorBoost) ? 1 : 0);
goto IL_0052;
}
}
result = 0;
goto IL_0052;
IL_0052:
return (byte)result != 0;
}).ToArray();
if (array.Length != 0)
{
CS$<>8__locals0.self.currentEnemy.gameObject = ((Component)array[0].healthComponent.body).gameObject;
}
}
orig.Invoke(CS$<>8__locals0.self, dt);
}
internal VisibilityLevel <Awake>b__14_6(orig_GetVisibilityLevel_TeamIndex orig, CharacterBody self, TeamIndex team)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: 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_0074: 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_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Expected O, but got Unknown
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
<>c__DisplayClass14_1 CS$<>8__locals0 = new <>c__DisplayClass14_1
{
self = self
};
VisibilityLevel result = orig.Invoke(CS$<>8__locals0.self, team);
if (Elephant > 0f && !CS$<>8__locals0.self.HasBuff(Buffs.ElephantArmorBoost) && CS$<>8__locals0.self.teamComponent.teamIndex != team)
{
SphereSearch val = new SphereSearch
{
mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask,
origin = CS$<>8__locals0.self.corePosition,
radius = AggroRange.Value
};
val.RefreshCandidates();
val.FilterCandidatesByDistinctHurtBoxEntities();
if (val.GetHurtBoxes().Any(delegate(HurtBox x)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
CharacterBody body = x.healthComponent.body;
if (!Object.op_Implicit((Object)(object)body))
{
return false;
}
return body.teamComponent.teamIndex == CS$<>8__locals0.self.teamComponent.teamIndex && body.HasBuff(Buffs.ElephantArmorBoost);
}))
{
return (VisibilityLevel)0;
}
}
return result;
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass14_0
{
public BaseAI self;
internal bool <Awake>b__9(HurtBox x)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
CharacterBody body = x.healthComponent.body;
int result;
if (Object.op_Implicit((Object)(object)body))
{
TeamMask enemyTeams = TeamMask.GetEnemyTeams(self.body.teamComponent.teamIndex);
if (((TeamMask)(ref enemyTeams)).HasTeam(body.teamComponent.teamIndex))
{
result = (body.HasBuff(Buffs.ElephantArmorBoost) ? 1 : 0);
goto IL_0052;
}
}
result = 0;
goto IL_0052;
IL_0052:
return (byte)result != 0;
}
}
[CompilerGenerated]
private sealed class <>c__DisplayClass14_1
{
public CharacterBody self;
internal bool <Awake>b__10(HurtBox x)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
CharacterBody body = x.healthComponent.body;
if (!Object.op_Implicit((Object)(object)body))
{
return false;
}
if (body.teamComponent.teamIndex != self.teamComponent.teamIndex)
{
return false;
}
return body.HasBuff(Buffs.ElephantArmorBoost);
}
}
public const string PluginGUID = "prodzpod.BetterJadeElephant";
public const string PluginAuthor = "prodzpod";
public const string PluginName = "BetterJadeElephant";
public const string PluginVersion = "1.0.0";
public static ManualLogSource Log;
internal static PluginInfo pluginInfo;
public static ConfigFile Config;
public static Harmony Harmony;
public static ConfigEntry<float> Cooldown;
public static ConfigEntry<float> Armor;
public static ConfigEntry<float> Duration;
public static ConfigEntry<float> AggroRange;
public static ConfigEntry<bool> CloakNearby;
public static float Elephant;
public void Awake()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Expected O, but got Unknown
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Expected O, but got Unknown
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Expected O, but got Unknown
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Expected O, but got Unknown
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Expected O, but got Unknown
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Expected O, but got Unknown
pluginInfo = ((BaseUnityPlugin)this).Info;
Log = ((BaseUnityPlugin)this).Logger;
Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "prodzpod.BetterJadeElephant.cfg"), true);
Harmony = new Harmony("prodzpod.BetterJadeElephant");
Cooldown = Config.Bind<float>("General", "Cooldown", 45f, "in seconds, default is vanilla");
Armor = Config.Bind<float>("General", "Armor", 500f, "in armor number, default is vanilla");
Duration = Config.Bind<float>("General", "Duration", 5f, "in seconds, default is vanilla");
AggroRange = Config.Bind<float>("General", "Aggro Range", 16f, "in meter, default is warbanner, set to 0 to disable");
CloakNearby = Config.Bind<bool>("General", "Cloak Nearby", true, "also cloaks nearby players");
RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
{
Equipment.GainArmor.cooldown = Cooldown.Value;
});
RoR2Application.onFixedUpdate += delegate
{
if (Elephant > 0f)
{
Elephant -= Time.fixedDeltaTime;
}
};
object obj = <>c.<>9__14_2;
if (obj == null)
{
hook_UpdateBuffs val = delegate(orig_UpdateBuffs orig, CharacterBody self, float dt)
{
orig.Invoke(self, dt);
if (self.HasBuff(Buffs.ElephantArmorBoost))
{
Elephant = Mathf.Max(Elephant, self.timedBuffs.First((TimedBuff x) => x.buffIndex == Buffs.ElephantArmorBoost.buffIndex).timer);
}
};
<>c.<>9__14_2 = val;
obj = (object)val;
}
CharacterBody.UpdateBuffs += (hook_UpdateBuffs)obj;
object obj2 = <>c.<>9__14_3;
if (obj2 == null)
{
Manipulator val2 = delegate(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
ILCursor val8 = new ILCursor(il);
float num = default(float);
val8.GotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num)
});
val8.Emit(OpCodes.Pop);
val8.Emit(OpCodes.Ldc_R4, Duration.Value);
};
<>c.<>9__14_3 = val2;
obj2 = (object)val2;
}
EquipmentSlot.FireGainArmor += (Manipulator)obj2;
object obj3 = <>c.<>9__14_4;
if (obj3 == null)
{
hook_RecalculateStats val3 = delegate(orig_RecalculateStats orig, CharacterBody self)
{
orig.Invoke(self);
if (self.HasBuff(Buffs.ElephantArmorBoost))
{
self.armor += Armor.Value - 500f;
}
};
<>c.<>9__14_4 = val3;
obj3 = (object)val3;
}
CharacterBody.RecalculateStats += (hook_RecalculateStats)obj3;
if (AggroRange.Value > 0f)
{
object obj4 = <>c.<>9__14_5;
if (obj4 == null)
{
hook_ManagedFixedUpdate val4 = delegate(orig_ManagedFixedUpdate orig, BaseAI self, float dt)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
if (Elephant > 0f)
{
SphereSearch val7 = new SphereSearch
{
mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask,
origin = self.body.corePosition,
radius = AggroRange.Value
};
val7.RefreshCandidates();
val7.FilterCandidatesByDistinctHurtBoxEntities();
HurtBox[] array = val7.GetHurtBoxes().Where(delegate(HurtBox x)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
CharacterBody body2 = x.healthComponent.body;
int result2;
if (Object.op_Implicit((Object)(object)body2))
{
TeamMask enemyTeams = TeamMask.GetEnemyTeams(self.body.teamComponent.teamIndex);
if (((TeamMask)(ref enemyTeams)).HasTeam(body2.teamComponent.teamIndex))
{
result2 = (body2.HasBuff(Buffs.ElephantArmorBoost) ? 1 : 0);
goto IL_0052;
}
}
result2 = 0;
goto IL_0052;
IL_0052:
return (byte)result2 != 0;
}).ToArray();
if (array.Length != 0)
{
self.currentEnemy.gameObject = ((Component)array[0].healthComponent.body).gameObject;
}
}
orig.Invoke(self, dt);
};
<>c.<>9__14_5 = val4;
obj4 = (object)val4;
}
BaseAI.ManagedFixedUpdate += (hook_ManagedFixedUpdate)obj4;
}
if (!CloakNearby.Value || !(AggroRange.Value > 0f))
{
return;
}
object obj5 = <>c.<>9__14_6;
if (obj5 == null)
{
hook_GetVisibilityLevel_TeamIndex val5 = delegate(orig_GetVisibilityLevel_TeamIndex orig, CharacterBody self, TeamIndex team)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: 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_0074: 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_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Expected O, but got Unknown
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
VisibilityLevel result = orig.Invoke(self, team);
if (Elephant > 0f && !self.HasBuff(Buffs.ElephantArmorBoost) && self.teamComponent.teamIndex != team)
{
SphereSearch val6 = new SphereSearch
{
mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask,
origin = self.corePosition,
radius = AggroRange.Value
};
val6.RefreshCandidates();
val6.FilterCandidatesByDistinctHurtBoxEntities();
if (val6.GetHurtBoxes().Any(delegate(HurtBox x)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
CharacterBody body = x.healthComponent.body;
if (!Object.op_Implicit((Object)(object)body))
{
return false;
}
return body.teamComponent.teamIndex == self.teamComponent.teamIndex && body.HasBuff(Buffs.ElephantArmorBoost);
}))
{
return (VisibilityLevel)0;
}
}
return result;
};
<>c.<>9__14_6 = val5;
obj5 = (object)val5;
}
CharacterBody.GetVisibilityLevel_TeamIndex += (hook_GetVisibilityLevel_TeamIndex)obj5;
}
}
}