using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using HG.Reflection;
using On.RoR2;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
[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("AirCells")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AirCells")]
[assembly: AssemblyTitle("AirCells")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
namespace InteractablesNullWard;
[Serializable]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.brynzananas.aircells", "Void Fields Air Cells", "1.0.0")]
public class Main : BaseUnityPlugin
{
public class ShrinkComponent : MonoBehaviour
{
private SphereZone sphereZone;
private void Start()
{
sphereZone = ((Component)this).GetComponent<SphereZone>();
}
private void FixedUpdate()
{
if (Object.op_Implicit((Object)(object)sphereZone) && sphereZone.radius > 0f)
{
SphereZone obj = sphereZone;
obj.radius -= Shrink.Value * Time.fixedDeltaTime;
}
}
}
public const string ModGuid = "com.brynzananas.aircells";
public const string ModName = "Void Fields Air Cells";
public const string ModVer = "1.0.0";
public static ConfigEntry<float> Radius;
public static ConfigEntry<float> Shrink;
public static PluginInfo PInfo { get; private set; }
public void Awake()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: 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_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Expected O, but got Unknown
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Expected O, but got Unknown
Radius = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Bubble Radius", 6f, "Control radius of the null ward");
Shrink = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Bubble Shrink", 0.2f, "Control speed of the null ward shrinking");
PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(PurchaseInteraction_OnInteractionBegin);
BarrelInteraction.OnInteractionBegin += new hook_OnInteractionBegin(BarrelInteraction_OnInteractionBegin);
SceneExitController.Begin += new hook_Begin(SceneExitController_Begin);
ScrapperController.BeginScrapping += new hook_BeginScrapping(ScrapperController_BeginScrapping);
if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"))
{
RiskOfOptionsIntegration.Init();
}
}
private void ScrapperController_BeginScrapping(orig_BeginScrapping orig, ScrapperController self, int intPickupIndex)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, intPickupIndex);
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == "arena")
{
addZone(((Component)self).gameObject);
}
}
private void SceneExitController_Begin(orig_Begin orig, SceneExitController self)
{
//IL_0009: 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)
orig.Invoke(self);
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == "arena")
{
addZone(((Component)self).gameObject);
}
}
private void BarrelInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, BarrelInteraction self, Interactor activator)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, activator);
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == "arena")
{
addZone(((Component)self).gameObject);
}
}
public void addZone(GameObject interactable)
{
//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_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)
if (!NetworkServer.active)
{
return;
}
Scene activeScene = SceneManager.GetActiveScene();
GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects();
foreach (GameObject val in rootGameObjects)
{
if (!Object.op_Implicit((Object)(object)val.GetComponent<FogDamageController>()))
{
continue;
}
if (Object.op_Implicit((Object)(object)interactable.GetComponent<SphereZone>()))
{
interactable.GetComponent<SphereZone>().radius = Radius.Value;
break;
}
GameObject val2 = Object.Instantiate<GameObject>(((Component)Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/NullSafeWard/NullSafeWard.prefab").WaitForCompletion().transform.Find("Indicator")).gameObject, interactable.transform);
if (!Object.op_Implicit((Object)(object)val2.GetComponent<NetworkIdentity>()))
{
val2.AddComponent<NetworkIdentity>();
}
NetworkServer.Spawn(val2);
SphereZone val3 = interactable.AddComponent<SphereZone>();
val3.radius = Radius.Value;
val3.isInverted = false;
val3.rangeIndicator = val2.transform;
val3.rangeIndicatorScaleVelocity = 0.2f;
val.GetComponent<FogDamageController>().AddSafeZone((IZone)(object)val3);
interactable.AddComponent<ShrinkComponent>();
break;
}
}
private void PurchaseInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator)
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, activator);
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == "arena")
{
addZone(((Component)self).gameObject);
}
}
}
public static class RiskOfOptionsIntegration
{
public const string RiskOfOptionsGUID = "com.rune580.riskofoptions";
[MethodImpl(MethodImplOptions.NoInlining)]
public static void Init()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(Main.Radius));
ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(Main.Shrink));
}
}