using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RoR2;
using RoR2.UI;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CollectiveCollection")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CollectiveCollection")]
[assembly: AssemblyTitle("CollectiveCollection")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
namespace CollectiveCollection
{
[BepInPlugin("veryrealbat.CollectiveCollection", "CollectiveCollection", "1.0.0")]
public class CollectiveCollection : BaseUnityPlugin
{
public const string PluginGUID = "veryrealbat.CollectiveCollection";
public const string PluginAuthor = "veryrealbat";
public const string PluginName = "CollectiveCollection";
public const string PluginVersion = "1.0.0";
internal static ManualLogSource? Logger { get; private set; }
public static CharacterMaster? LastEditedLemurian { get; set; }
private void Awake()
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
Logger.Sources.Remove((ILogSource)(object)((BaseUnityPlugin)this).Logger);
Logger = Logger.CreateLogSource("veryrealbat.CollectiveCollection");
new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID).PatchAll();
}
}
[HarmonyPatch]
internal static class Patches
{
[HarmonyPostfix]
[HarmonyPatch(typeof(AllyCardController), "UpdateInfo")]
private static void AllyCardController_UpdateInfo(AllyCardController __instance)
{
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)__instance.sourceMaster == (Object)null) && (!((Object)(object)__instance.sourceMaster.playerCharacterMasterController != (Object)null) || !Object.op_Implicit((Object)(object)__instance.sourceMaster.playerCharacterMasterController.networkUser)))
{
DevotedLemurianController component = ((Component)__instance.sourceMaster).gameObject.GetComponent<DevotedLemurianController>();
if (Object.op_Implicit((Object)(object)component) && ((Component)__instance.portraitIconImage).transform.childCount == 2)
{
GameObject gameObject = ((Component)__instance.portraitIconImage).gameObject.GetComponentInChildren(typeof(ContentSizeFitter)).gameObject;
GameObject obj = Object.Instantiate<GameObject>(gameObject, gameObject.transform.parent);
((Object)obj).name = "DevotedHeldItem";
obj.transform.localPosition = new Vector3(14.5804f, -13.5f, 0f);
Image component2 = obj.GetComponent<Image>();
component2.sprite = ItemCatalog.GetItemDef(component.DevotionItem).pickupIconSprite;
((Behaviour)component2).enabled = true;
CollectiveCollection.LastEditedLemurian = __instance.sourceMaster;
}
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(ScoreboardController), "Rebuild")]
private static void ScoreboardController_Rebuild(ScoreboardController __instance)
{
if ((Object)(object)CollectiveCollection.LastEditedLemurian == (Object)null)
{
CollectiveCollection.LastEditedLemurian = ((Component)Object.FindObjectsOfType<DevotedLemurianController>()[0]).gameObject.GetComponent<CharacterMaster>();
}
if ((Object)(object)CollectiveCollection.LastEditedLemurian != (Object)null)
{
Items.BoostHp.hidden = true;
Items.BoostDamage.hidden = true;
List<PlayerCharacterMasterController> list = PlayerCharacterMasterController.instances.Where((PlayerCharacterMasterController x) => ((Component)x).gameObject.activeInHierarchy && (Object)(object)x.master.GetBody() != (Object)null && Util.GetBestMasterName(x.master) != null).ToList();
UIElementAllocator<ScoreboardStrip> value = Traverse.Create((object)__instance).Field("stripAllocator").GetValue<UIElementAllocator<ScoreboardStrip>>();
int num = list.Count + 1;
value.AllocateElements(num);
value.elements[value.elements.Count - 1].SetMaster(CollectiveCollection.LastEditedLemurian);
}
}
}
}