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.Configuration;
using Microsoft.CodeAnalysis;
using On.RoR2;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("MithrixSurprise")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MithrixSurprise")]
[assembly: AssemblyTitle("MithrixSurprise")]
[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 MithrixSurprise
{
[BepInPlugin("com.Nuxlar.MithrixSurprise", "MithrixSurprise", "1.0.4")]
public class MithrixSurprise : BaseUnityPlugin
{
private ConfigEntry<float> probability;
private SpawnCard theBoi = Addressables.LoadAssetAsync<SpawnCard>((object)"RoR2/Base/Brother/cscBrother.asset").WaitForCompletion();
private ConfigFile RoRConfig { get; set; }
public void Awake()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_0046: 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_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: 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_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Expected O, but got Unknown
RoRConfig = new ConfigFile(Paths.ConfigPath + "\\MithrixSurprise.cfg", true);
probability = RoRConfig.Bind<float>("General", "Spawn Chance", 0.005f, "Mithrix spawn chance.");
ModSettingsManager.AddOption((BaseOption)new StepSliderOption(probability, new StepSliderConfig
{
min = 0.005f,
max = 1f,
increment = 0.005f
}));
ModSettingsManager.SetModDescription("Goodbye Moon Man");
PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(PurchaseInteraction_OnInteractionBegin);
}
private void PurchaseInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
{
if (self.CanBeAffordedByInteractor(activator))
{
if (Random.value < probability.Value)
{
SpawnTheBoi(((Component)activator).GetComponent<CharacterBody>());
}
orig.Invoke(self, activator);
}
else
{
orig.Invoke(self, activator);
}
}
private void SpawnTheBoi(CharacterBody activatorBody)
{
//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_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected O, but got Unknown
//IL_0040: 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_0056: Expected O, but got Unknown
SpawnCard val = theBoi;
Transform coreTransform = activatorBody.coreTransform;
DirectorPlacementRule val2 = new DirectorPlacementRule
{
spawnOnTarget = coreTransform,
placementMode = (PlacementMode)3
};
DirectorCore.GetMonsterSpawnDistance((MonsterSpawnDistance)2, ref val2.minDistance, ref val2.maxDistance);
GameObject val3 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(val, val2, RoR2Application.rng)
{
teamIndexOverride = (TeamIndex)2
});
val3.GetComponent<CharacterMaster>().isBoss = true;
if (Object.op_Implicit((Object)(object)val3))
{
NetworkServer.Spawn(val3);
}
}
}
}