using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RoR2;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.ResourceManagement.AsyncOperations;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.2.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class IsReadOnlyAttribute : Attribute
{
}
[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 Prototype
{
[BepInPlugin("prototype.stage4.balance", "Stage4Balance", "0.1.2")]
public class Stage4Balance : BaseUnityPlugin
{
private struct Asset<T>
{
private AsyncOperationHandle<T> handle;
public readonly T Value => handle.WaitForCompletion();
public Asset(string key)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
handle = Addressables.LoadAssetAsync<T>((object)key);
}
public static implicit operator T(Asset<T> asset)
{
return asset.Value;
}
}
public const string identifier = "prototype.stage4.balance";
public const string version = "0.1.2";
protected void Awake()
{
Asset<CharacterSpawnCard> boss = new Asset<CharacterSpawnCard>("RoR2/Base/Gravekeeper/cscGravekeeper.asset");
Asset<DirectorCardCategorySelection>[] monsters = new Asset<DirectorCardCategorySelection>[2]
{
new Asset<DirectorCardCategorySelection>("RoR2/Base/rootjungle/dccsRootJungleMonsters.asset"),
new Asset<DirectorCardCategorySelection>("RoR2/Base/rootjungle/dccsRootJungleMonstersDLC1.asset")
};
Asset<SkillDef> skill = new Asset<SkillDef>("RoR2/Base/RoboBallBoss/SuperFireDelayKnockup.asset");
Asset<DirectorCardCategorySelection>[] interactables = new Asset<DirectorCardCategorySelection>[2]
{
new Asset<DirectorCardCategorySelection>("RoR2/Base/shipgraveyard/dccsShipgraveyardInteractables.asset"),
new Asset<DirectorCardCategorySelection>("RoR2/Base/shipgraveyard/dccsShipgraveyardInteractablesDLC1.asset")
};
RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate
{
//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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Expected O, but got Unknown
Asset<DirectorCardCategorySelection>[] array = monsters;
foreach (DirectorCardCategorySelection val in array)
{
for (int j = 0; j < val.categories.Length; j++)
{
ref Category reference = ref val.categories[j];
if (reference.name == "Champions")
{
reference.cards = CollectionExtensions.AddToArray<DirectorCard>(reference.cards, new DirectorCard
{
selectionWeight = 1,
spawnCard = (SpawnCard)(object)(CharacterSpawnCard)boss
});
}
}
}
array = interactables;
foreach (DirectorCardCategorySelection val2 in array)
{
for (int k = 0; k < val2.categories.Length; k++)
{
ref Category reference2 = ref val2.categories[k];
switch (reference2.name)
{
case "Drones":
reference2.selectionWeight /= 1.5f;
break;
case "Shrines":
case "Misc":
reference2.selectionWeight /= 2f;
break;
}
}
}
skill.Value.beginSkillCooldownOnSkillEnd = true;
});
Harmony.CreateAndPatchAll(((object)this).GetType(), (string)null);
}
[HarmonyPatch(typeof(ClassicStageInfo), "Awake")]
[HarmonyPrefix]
private static void AdjustBonusCredit(ClassicStageInfo __instance)
{
SceneInfo component = ((Component)__instance).GetComponent<SceneInfo>();
SceneDef val = ((component != null) ? component.sceneDef : null);
BonusInteractibleCreditObject[] bonusInteractibleCreditObjects = __instance.bonusInteractibleCreditObjects;
if (bonusInteractibleCreditObjects != null && ((val != null) ? val.baseSceneName : null) == "dampcavesimple")
{
for (int i = 0; i < bonusInteractibleCreditObjects.Length; i++)
{
bonusInteractibleCreditObjects[i].points /= 2;
}
}
}
}
}