using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Halcyonite;
using EntityStates.ShrineHalcyonite;
using HG;
using HG.Reflection;
using IL.EntityStates.Halcyonite;
using IL.RoR2;
using Logger;
using Microsoft.CodeAnalysis;
using MiscFixes.Modules;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates.Halcyonite;
using On.EntityStates.ShrineHalcyonite;
using On.RoR2;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Skills;
using RoR2BepInExPack.GameAssetPathsBetter;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.ResourceManagement.AsyncOperations;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HalcyonKnight")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+0e0cd2fdc4bc1f7c2e8190899d9e24c394596ca0")]
[assembly: AssemblyProduct("HalcyonKnight")]
[assembly: AssemblyTitle("HalcyonKnight")]
[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 Logger
{
internal static class Log
{
private static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void Debug(object data)
{
_logSource.LogDebug(data);
}
internal static void Error(object data)
{
_logSource.LogError(data);
}
internal static void Fatal(object data)
{
_logSource.LogFatal(data);
}
internal static void Info(object data)
{
_logSource.LogInfo(data);
}
internal static void Message(object data)
{
_logSource.LogMessage(data);
}
internal static void Warning(object data)
{
_logSource.LogWarning(data);
}
}
}
namespace HalcyonKnight
{
internal static class AntiFallOff
{
[CompilerGenerated]
private static class <>O
{
public static hook_OnEnter <0>__WhirlWindPersuitCycle_OnEnter;
public static hook_OnExit <1>__WhirlWindPersuitCycle_OnExit;
public static hook_OnEnter <2>__WhirlWindPersuitCycle_OnEnter;
public static hook_OnExit <3>__WhirlWindPersuitCycle_OnExit;
public static hook_UpdateLand <4>__WhirlWindPersuitCycle_UpdateLand;
}
[SystemInitializer(new Type[] { })]
private static void Init()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Expected O, but got Unknown
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Expected O, but got Unknown
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Expected O, but got Unknown
AssetReferenceT<GameObject> val = new AssetReferenceT<GameObject>(RoR2_DLC2_Halcyonite.HalcyoniteBody_prefab);
AsyncOperationHandle<GameObject> val2 = AssetAsyncReferenceManager<GameObject>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
val2.Completed += delegate(AsyncOperationHandle<GameObject> x)
{
UnityObjectExtensions.EnsureComponent<ForceWhirlWindState>(x.Result);
};
object obj = <>O.<0>__WhirlWindPersuitCycle_OnEnter;
if (obj == null)
{
hook_OnEnter val3 = WhirlWindPersuitCycle_OnEnter;
<>O.<0>__WhirlWindPersuitCycle_OnEnter = val3;
obj = (object)val3;
}
WhirlWindPersuitCycle.OnEnter += (hook_OnEnter)obj;
object obj2 = <>O.<1>__WhirlWindPersuitCycle_OnExit;
if (obj2 == null)
{
hook_OnExit val4 = WhirlWindPersuitCycle_OnExit;
<>O.<1>__WhirlWindPersuitCycle_OnExit = val4;
obj2 = (object)val4;
}
WhirlWindPersuitCycle.OnExit += (hook_OnExit)obj2;
object obj3 = <>O.<2>__WhirlWindPersuitCycle_OnEnter;
if (obj3 == null)
{
hook_OnEnter val5 = WhirlWindPersuitCycle_OnEnter;
<>O.<2>__WhirlWindPersuitCycle_OnEnter = val5;
obj3 = (object)val5;
}
WhirlwindWarmUp.OnEnter += (hook_OnEnter)obj3;
object obj4 = <>O.<3>__WhirlWindPersuitCycle_OnExit;
if (obj4 == null)
{
hook_OnExit val6 = WhirlWindPersuitCycle_OnExit;
<>O.<3>__WhirlWindPersuitCycle_OnExit = val6;
obj4 = (object)val6;
}
WhirlwindWarmUp.OnExit += (hook_OnExit)obj4;
object obj5 = <>O.<4>__WhirlWindPersuitCycle_UpdateLand;
if (obj5 == null)
{
hook_UpdateLand val7 = WhirlWindPersuitCycle_UpdateLand;
<>O.<4>__WhirlWindPersuitCycle_UpdateLand = val7;
obj5 = (object)val7;
}
WhirlWindPersuitCycle.UpdateLand += (hook_UpdateLand)obj5;
}
private static void WhirlWindPersuitCycle_UpdateLand(orig_UpdateLand orig, WhirlWindPersuitCycle self)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: 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_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
orig.Invoke(self);
RaycastHit val = default(RaycastHit);
if (!Physics.Raycast(new Ray(((EntityState)self).transform.position, Vector3.down), ref val, 200f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
{
((EntityState)self).outer.SetNextState((EntityState)new WhirlwindWarmUp());
}
}
private static void WhirlWindPersuitCycle_OnExit(orig_OnExit orig, WhirlwindWarmUp self)
{
orig.Invoke(self);
SetStunnable((EntityState)(object)self, stunnable: true);
}
private static void WhirlWindPersuitCycle_OnEnter(orig_OnEnter orig, WhirlwindWarmUp self)
{
orig.Invoke(self);
SetStunnable((EntityState)(object)self, stunnable: false);
}
private static void WhirlWindPersuitCycle_OnExit(orig_OnExit orig, WhirlWindPersuitCycle self)
{
orig.Invoke(self);
SetStunnable((EntityState)(object)self, stunnable: true);
}
private static void WhirlWindPersuitCycle_OnEnter(orig_OnEnter orig, WhirlWindPersuitCycle self)
{
orig.Invoke(self);
SetStunnable((EntityState)(object)self, stunnable: false);
}
private static void SetStunnable(EntityState self, bool stunnable)
{
SetStateOnHurt val = default(SetStateOnHurt);
if (self.TryGetComponent<SetStateOnHurt>(ref val))
{
val.canBeHitStunned = stunnable;
val.canBeStunned = stunnable;
}
}
}
public class ForceWhirlWindState : MonoBehaviour
{
private EntityStateMachine stateMachine;
private void Awake()
{
EntityStateMachine[] components = ((Component)this).GetComponents<EntityStateMachine>();
foreach (EntityStateMachine val in components)
{
if (val.customName == "Weapon")
{
stateMachine = val;
}
}
}
private void FixedUpdate()
{
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Expected O, but got Unknown
RaycastHit val = default(RaycastHit);
if (Object.op_Implicit((Object)(object)stateMachine) && !(stateMachine.state is WhirlwindWarmUp) && !(stateMachine.state is WhirlWindPersuitCycle) && !(stateMachine.nextState is WhirlwindWarmUp) && !(stateMachine.nextState is WhirlWindPersuitCycle) && !Physics.Raycast(new Ray(((Component)this).transform.position, Vector3.down), ref val, 200f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
{
stateMachine.SetInterruptState((EntityState)new WhirlwindWarmUp(), (InterruptPriority)6);
}
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal static class Options
{
public static bool IsEnabled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
public static void Init()
{
HalcyonKnight.ChangeShrineCredits = ((BaseUnityPlugin)HalcyonKnight.Instance).Config.Bind<bool>("General", "Increase credit cost", false, "Increase stage 1 shrine credit cost 0 -> 30 (for reference stage 2+ is 50)");
if (IsEnabled)
{
RiskOfOptionsConfig();
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void RiskOfOptionsConfig()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Expected O, but got Unknown
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(HalcyonKnight.ChangeShrineCredits), "Onyx.HalcyonKnight", "HalcyonKnight");
ModSettingsManager.SetModDescription("Options for HalcyonKnight", "Onyx.HalcyonKnight", "HalcyonKnight");
FileInfo fileInfo = null;
DirectoryInfo directoryInfo = new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
do
{
FileInfo[] files = directoryInfo.GetFiles("icon.png", SearchOption.TopDirectoryOnly);
if (files != null && files.Length != 0)
{
fileInfo = files[0];
break;
}
directoryInfo = directoryInfo.Parent;
}
while (directoryInfo != null && directoryInfo.Exists && !string.Equals(directoryInfo.Name, "plugins", StringComparison.OrdinalIgnoreCase));
if (fileInfo != null)
{
Texture2D val = new Texture2D(256, 256);
if (ImageConversion.LoadImage(val, File.ReadAllBytes(fileInfo.FullName)))
{
Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
((Object)val2).name = "HalcyonKnightIcon";
ModSettingsManager.SetModIcon(val2, "Onyx.HalcyonKnight", "HalcyonKnight");
}
}
}
}
[BepInPlugin("Onyx.HalcyonKnight", "HalcyonKnight", "1.1.5")]
public sealed class HalcyonKnight : BaseUnityPlugin
{
[CompilerGenerated]
private static class <>O
{
public static Manipulator <0>__MoreLasers;
public static hook_OnEnter <1>__TriLaser_OnEnter;
public static hook_OnBodyStart <2>__OnBodyStart;
public static hook_UpdateFindTarget <3>__UpdateFindTarget;
public static Func<HalcyoniteShrineInteractable, int> <4>__AdjustHalcScaling;
}
public const string PluginGUID = "Onyx.HalcyonKnight";
public const string PluginAuthor = "Onyx";
public const string PluginName = "HalcyonKnight";
public const string PluginVersion = "1.1.5";
public static HalcyonKnight Instance;
private static SpawnCard halcshrineCard;
public static ConfigEntry<bool> ChangeShrineCredits { get; set; }
public void Awake()
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: 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_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: 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)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_023d: Unknown result type (might be due to invalid IL or missing references)
//IL_0242: Unknown result type (might be due to invalid IL or missing references)
//IL_027b: Unknown result type (might be due to invalid IL or missing references)
//IL_0280: Unknown result type (might be due to invalid IL or missing references)
//IL_0286: Expected O, but got Unknown
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
//IL_02a7: Expected O, but got Unknown
//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
//IL_02c8: Expected O, but got Unknown
//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0300: Expected O, but got Unknown
//IL_0308: Unknown result type (might be due to invalid IL or missing references)
//IL_0312: Expected O, but got Unknown
//IL_031a: Unknown result type (might be due to invalid IL or missing references)
//IL_0324: Expected O, but got Unknown
//IL_032c: Unknown result type (might be due to invalid IL or missing references)
//IL_0336: Expected O, but got Unknown
//IL_02de: Unknown result type (might be due to invalid IL or missing references)
//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
//IL_02e9: Expected O, but got Unknown
Log.Init(((BaseUnityPlugin)this).Logger);
Instance = SingletonHelper.Assign<HalcyonKnight>(Instance, this);
Options.Init();
AssetReferenceT<EntityStateConfiguration> val = new AssetReferenceT<EntityStateConfiguration>(RoR2_DLC2_Halcyonite.EntityStates_HalcyoniteMonster_ChargeTriLaser_asset);
AsyncOperationHandle<EntityStateConfiguration> val2 = AssetAsyncReferenceManager<EntityStateConfiguration>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
val2.Completed += delegate(AsyncOperationHandle<EntityStateConfiguration> x)
{
Extensions.TryModifyFieldValue<float>(x.Result, "baseDuration", 1.5f);
};
val = new AssetReferenceT<EntityStateConfiguration>(RoR2_DLC2_Halcyonite.EntityStates_HalcyoniteMonster_TriLaser_asset);
val2 = AssetAsyncReferenceManager<EntityStateConfiguration>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
val2.Completed += delegate(AsyncOperationHandle<EntityStateConfiguration> x)
{
Extensions.TryModifyFieldValue<float>(x.Result, "blastRadius", 2f);
};
val = new AssetReferenceT<EntityStateConfiguration>(RoR2_DLC2_Halcyonite.EntityStates_HalcyoniteMonster_WhirlwindWarmUp_asset);
val2 = AssetAsyncReferenceManager<EntityStateConfiguration>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
val2.Completed += delegate(AsyncOperationHandle<EntityStateConfiguration> x)
{
Extensions.TryModifyFieldValue<float>(x.Result, "duration", 0.7f);
};
val = new AssetReferenceT<EntityStateConfiguration>(RoR2_DLC2_Halcyonite.EntityStates_HalcyoniteMonster_WhirlwindPersuitCycle_asset);
val2 = AssetAsyncReferenceManager<EntityStateConfiguration>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
val2.Completed += delegate(AsyncOperationHandle<EntityStateConfiguration> x)
{
Extensions.TryModifyFieldValue<float>(x.Result, "dashSpeedCoefficient", 40f);
Extensions.TryModifyFieldValue<float>(x.Result, "decelerateDuration", 0.5f);
Extensions.TryModifyFieldValue<float>(x.Result, "dashSafeExitDuration", 3f);
};
val = new AssetReferenceT<EntityStateConfiguration>(RoR2_DLC2_Halcyonite.EntityStates_HalcyoniteMonster_GoldenSwipe_asset);
val2 = AssetAsyncReferenceManager<EntityStateConfiguration>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
val2.Completed += delegate(AsyncOperationHandle<EntityStateConfiguration> x)
{
Extensions.TryModifyFieldValue<float>(x.Result, "pushAwayForce", 500f);
};
val = new AssetReferenceT<EntityStateConfiguration>(RoR2_DLC2_Halcyonite.EntityStates_HalcyoniteMonster_GoldenSlash_asset);
val2 = AssetAsyncReferenceManager<EntityStateConfiguration>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
val2.Completed += delegate(AsyncOperationHandle<EntityStateConfiguration> x)
{
Extensions.TryModifyFieldValue<float>(x.Result, "pushAwayForce", 500f);
Extensions.TryModifyFieldValue<float>(x.Result, "baseDuration", 1.1f);
};
AssetReferenceT<GameObject> val3 = new AssetReferenceT<GameObject>(RoR2_DLC2_Halcyonite.HalcyoniteMaster_prefab);
AsyncOperationHandle<GameObject> val4 = AssetAsyncReferenceManager<GameObject>.LoadAsset(val3, (AsyncReferenceHandleUnloadType)2);
val4.Completed += delegate(AsyncOperationHandle<GameObject> x)
{
//IL_0194: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
GameObject result3 = x.Result;
AISkillDriver[] components = result3.GetComponents<AISkillDriver>();
foreach (AISkillDriver val12 in components)
{
switch (val12.customName)
{
case "Golden Swipe":
val12.minDistance = 0f;
val12.movementType = (MovementType)3;
val12.moveInputScale = 0.5f;
val12.maxDistance = 15f;
val12.driverUpdateTimerOverride = 1.5f;
val12.aimVectorMaxSpeedOverride = 0f;
break;
case "Golden Slash":
val12.movementType = (MovementType)3;
val12.moveInputScale = 0.8f;
val12.maxDistance = 10f;
val12.driverUpdateTimerOverride = 2f;
break;
case "TriLaser":
val12.minDistance = 15f;
val12.moveInputScale = 0.7f;
val12.driverUpdateTimerOverride = 2.5f;
val12.movementType = (MovementType)2;
break;
case "WhirlwindRush":
val12.minDistance = 20f;
break;
case "Follow Target":
val12.minDistance = 5f;
break;
case "Follow Nodegraph":
val12.minDistance = 5f;
break;
}
}
AISkillDriver val13 = result3.AddComponent<AISkillDriver>();
val13.minDistance = 0f;
val13.maxDistance = float.MaxValue;
val13.movementType = (MovementType)3;
BaseAI val14 = default(BaseAI);
if (result3.TryGetComponent<BaseAI>(ref val14))
{
val14.prioritizePlayers = true;
}
};
val3 = new AssetReferenceT<GameObject>(RoR2_DLC2.ShrineHalcyonite_prefab);
val4 = AssetAsyncReferenceManager<GameObject>.LoadAsset(val3, (AsyncReferenceHandleUnloadType)2);
val4.Completed += delegate(AsyncOperationHandle<GameObject> x)
{
BossGroup val11 = UnityObjectExtensions.EnsureComponent<BossGroup>(x.Result);
x.Result.GetComponent<PurchaseInteraction>().setUnavailableOnTeleporterActivated = true;
};
AssetReferenceT<SkillDef> val5 = new AssetReferenceT<SkillDef>(RoR2_DLC2_Halcyonite.HalcyoniteMonsterWhirlwindRush_asset);
AsyncOperationHandle<SkillDef> val6 = AssetAsyncReferenceManager<SkillDef>.LoadAsset(val5, (AsyncReferenceHandleUnloadType)2);
val6.Completed += delegate(AsyncOperationHandle<SkillDef> x)
{
SkillDef result2 = x.Result;
result2.baseRechargeInterval = 15f;
};
val5 = new AssetReferenceT<SkillDef>(RoR2_DLC2_Halcyonite.HalcyoniteMonsterGoldenSlash_asset);
val6 = AssetAsyncReferenceManager<SkillDef>.LoadAsset(val5, (AsyncReferenceHandleUnloadType)2);
val6.Completed += delegate(AsyncOperationHandle<SkillDef> x)
{
SkillDef result = x.Result;
result.baseRechargeInterval = 7f;
};
object obj = <>O.<0>__MoreLasers;
if (obj == null)
{
Manipulator val7 = MoreLasers;
<>O.<0>__MoreLasers = val7;
obj = (object)val7;
}
TriLaser.FixedUpdate += (Manipulator)obj;
object obj2 = <>O.<1>__TriLaser_OnEnter;
if (obj2 == null)
{
hook_OnEnter val8 = TriLaser_OnEnter;
<>O.<1>__TriLaser_OnEnter = val8;
obj2 = (object)val8;
}
TriLaser.OnEnter += (hook_OnEnter)obj2;
object obj3 = <>O.<2>__OnBodyStart;
if (obj3 == null)
{
hook_OnBodyStart val9 = OnBodyStart;
<>O.<2>__OnBodyStart = val9;
obj3 = (object)val9;
}
CharacterMaster.OnBodyStart += (hook_OnBodyStart)obj3;
object obj4 = <>O.<3>__UpdateFindTarget;
if (obj4 == null)
{
hook_UpdateFindTarget val10 = UpdateFindTarget;
<>O.<3>__UpdateFindTarget = val10;
obj4 = (object)val10;
}
WhirlWindPersuitCycle.UpdateFindTarget += (hook_UpdateFindTarget)obj4;
HalcyoniteShrineInteractable.DrainConditionMet += new Manipulator(DrainConditionMet);
PurchaseInteraction.OnTeleporterBeginCharging += new hook_OnTeleporterBeginCharging(OnTeleporterBeginCharging);
ShrineHalcyoniteBaseState.OnEnter += new hook_OnEnter(ShrineHalcyoniteBaseState_OnEnter);
HalcyoniteShrineInteractable.CalculateCredits += new hook_CalculateCredits(HalcyoniteShrineInteractable_CalculateCredits);
OptionChangeShrineCredits(null, null);
ChangeShrineCredits.SettingChanged += OptionChangeShrineCredits;
}
private void OptionChangeShrineCredits(object sender, EventArgs e)
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
//IL_007f: 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_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_002f: 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)
if (ChangeShrineCredits.Value)
{
SceneDirector.GenerateInteractableCardSelection += new hook_GenerateInteractableCardSelection(GenerateInteractableCardSelection);
AssetReferenceT<SpawnCard> val = new AssetReferenceT<SpawnCard>(RoR2_DLC2.iscShrineHalcyoniteTier1_asset);
AsyncOperationHandle<SpawnCard> val2 = AssetAsyncReferenceManager<SpawnCard>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2);
val2.Completed += delegate(AsyncOperationHandle<SpawnCard> x)
{
x.Result.directorCreditCost = 30;
halcshrineCard = x.Result;
};
}
else
{
SceneDirector.GenerateInteractableCardSelection -= new hook_GenerateInteractableCardSelection(GenerateInteractableCardSelection);
AssetReferenceT<SpawnCard> val3 = new AssetReferenceT<SpawnCard>(RoR2_DLC2.iscShrineHalcyoniteTier1_asset);
AsyncOperationHandle<SpawnCard> val2 = AssetAsyncReferenceManager<SpawnCard>.LoadAsset(val3, (AsyncReferenceHandleUnloadType)2);
val2.Completed += delegate(AsyncOperationHandle<SpawnCard> x)
{
x.Result.directorCreditCost = 0;
halcshrineCard = x.Result;
};
}
}
private WeightedSelection<DirectorCard> GenerateInteractableCardSelection(orig_GenerateInteractableCardSelection orig, SceneDirector self)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//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_0032: Unknown result type (might be due to invalid IL or missing references)
WeightedSelection<DirectorCard> val = orig.Invoke(self);
for (int i = 0; i < val.Count; i++)
{
ChoiceInfo<DirectorCard> choice = val.GetChoice(i);
if ((Object)(object)choice.value.spawnCard == (Object)(object)halcshrineCard)
{
val.ModifyChoiceWeight(i, choice.weight * 2f);
}
}
return val;
}
private void ShrineHalcyoniteBaseState_OnEnter(orig_OnEnter orig, ShrineHalcyoniteBaseState self)
{
orig.Invoke(self);
Debug.Log((object)((EntityState)self).outer.state);
}
private void HalcyoniteShrineInteractable_CalculateCredits(orig_CalculateCredits orig, HalcyoniteShrineInteractable self)
{
orig.Invoke(self);
if (self.scaleMonsterCreditWithDifficultyCoefficient)
{
self.monsterCredit /= Math.Max(Run.instance.difficultyCoefficient / 2f, 1f);
}
}
private void OnTeleporterBeginCharging(orig_OnTeleporterBeginCharging orig, TeleporterInteraction self)
{
orig.Invoke(self);
if (!NetworkServer.active)
{
return;
}
ChildLocator val = default(ChildLocator);
Transform val2 = default(Transform);
foreach (PurchaseInteraction instances in InstanceTracker.GetInstancesList<PurchaseInteraction>())
{
if (((Object)instances).name == "ShrineHalcyonite(Clone)" && ((Component)instances).TryGetComponent<ChildLocator>(ref val))
{
if (val.TryFindChild("GoldSiphonNearbyBodyAttachment", ref val2))
{
((Component)val2).gameObject.SetActive(false);
}
if (val.TryFindChild("StormPortalIndicator", ref val2))
{
((Component)val2).gameObject.SetActive(false);
}
if (val.TryFindChild("RangeIndicator", ref val2))
{
((Component)val2).gameObject.SetActive(false);
}
if (val.TryFindChild("GoldshoresPortalIndicator", ref val2))
{
((Component)val2).gameObject.SetActive(false);
}
}
}
}
private void DrainConditionMet(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
float num2 = default(float);
int num = default(int);
if (val.TryGotoNext(new Func<Instruction, bool>[4]
{
(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(HalcyoniteShrineInteractable), "goldDrained"),
(Instruction x) => ILPatternMatchingExt.MatchConvR4(x),
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num2),
(Instruction x) => ILPatternMatchingExt.MatchDiv(x)
}) && val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num)
}))
{
val.Emit(OpCodes.Pop);
val.Emit(OpCodes.Ldarg_0);
val.EmitDelegate<Func<HalcyoniteShrineInteractable, int>>((Func<HalcyoniteShrineInteractable, int>)AdjustHalcScaling);
}
else
{
Log.Error(((MemberReference)il.Method).Name + " IL Hook failed!");
}
static int AdjustHalcScaling(HalcyoniteShrineInteractable self)
{
if (self.goldDrained > self.lowGoldCost && self.goldDrained < self.midGoldCost)
{
return (int)(0.7 + 0.06 * (double)Run.instance.ambientLevel);
}
if (self.goldDrained > self.midGoldCost && self.goldDrained < self.maxGoldCost)
{
return (int)(1.4 + 0.12 * (double)Run.instance.ambientLevel);
}
if (self.goldDrained >= self.maxGoldCost)
{
return (int)(2.1 + 0.18 * (double)Run.instance.ambientLevel);
}
return 0;
}
}
private static void UpdateFindTarget(orig_UpdateFindTarget orig, WhirlWindPersuitCycle self)
{
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)self.targetBody))
{
BaseAI[] aiComponents = ((EntityState)self).characterBody.master.AiComponents;
foreach (BaseAI val in aiComponents)
{
if (val.hasAimTarget)
{
self.targetBody = val.skillDriverEvaluation.target.characterBody;
Vector3 footPosition = self.targetBody.footPosition;
Vector3 val2 = ((EntityState)self).transform.position - self.targetBody.footPosition;
self.targetPos = footPosition + ((Vector3)(ref val2)).normalized * 2f;
self.findTargetTimeStamp = ((EntityState)self).fixedAge;
self.startForwardDirt = ((EntityState)self).characterDirection.forward;
break;
}
}
}
orig.Invoke(self);
RaycastHit val3 = default(RaycastHit);
if (!Object.op_Implicit((Object)(object)self.targetBody) && Physics.Raycast(new Ray(((EntityState)self).transform.position, Vector3.down), ref val3, 200f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1))
{
((EntityState)self).outer.SetNextStateToMain();
}
}
private static void OnBodyStart(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, body);
if (((Object)body).name == "HalcyoniteBody(Clone)")
{
body.modelLocator.modelTransform.GetChild(4).localScale = new Vector3(3f, 6f, 12f);
body.modelLocator.modelTransform.GetChild(7).localScale = new Vector3(15f, 1f, 10f);
body.baseMoveSpeed = 9f;
body.baseNameToken = "Halcyon Knight";
body.subtitleNameToken = "Forsaken Heir";
}
}
private static void TriLaser_OnEnter(orig_OnEnter orig, TriLaser self)
{
orig.Invoke(self);
self.targetTimeStamp = 0.1f;
self.fireCooldown = 0.3f;
}
private static void MoreLasers(ILContext il)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Expected O, but got Unknown
//IL_002c: 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)
ILCursor val = new ILCursor(il);
int num = 0;
int laserCount = 0;
while (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3]
{
(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(TriLaser), "timesFired"),
(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref laserCount),
(Instruction x) => !ILPatternMatchingExt.MatchAdd(x)
}))
{
int index = val.Index;
val.Index = index - 1;
val.Emit(OpCodes.Pop);
val.Emit(OpCodes.Ldc_I4, laserCount + 2);
num++;
}
if (num == 0)
{
Log.Error(((MemberReference)il.Method).Name + " IL Hook failed!");
}
}
}
}