using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using SSSGame.UI;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("blacks7ar")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SummonReRoll")]
[assembly: AssemblyTitle("SummonReRoll")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace SummonReRoll;
[BepInPlugin("blacks7ar.SummonReRoll", "SummonReRoll", "1.0.0")]
public class Plugin : BasePlugin
{
[HarmonyPatch]
private static class Patches
{
[HarmonyPrefix]
[HarmonyPatch(typeof(SelectVillagerMenu), "_ShowPanels")]
private static void Activate_Postfix(SelectVillagerMenu __instance)
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Expected O, but got Unknown
try
{
if (!((Object)(object)__instance == (Object)null))
{
Transform val = FindChildByName(((Component)__instance).transform, "Reroll");
if (!((Object)(object)val == (Object)null))
{
((Component)val).gameObject.SetActive(true);
}
}
}
catch (Exception ex)
{
ManualLogSource rLogger = RLogger;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(41, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[AutoReroll] Failed to reroll villagers: ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
}
rLogger.LogError(val2);
}
}
}
private const string modGUID = "blacks7ar.SummonReRoll";
public const string modName = "SummonReRoll";
public const string modAuthor = "blacks7ar";
public const string modVersion = "1.0.0";
private static ManualLogSource RLogger;
public override void Load()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
RLogger = ((BasePlugin)this).Log;
RLogger.LogInfo((object)"Mod loaded!");
new Harmony("blacks7ar.SummonReRoll").PatchAll();
}
private static Transform FindChildByName(Transform parent, string name)
{
return ((IEnumerable<Transform>)((Component)parent).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform child) => ((Object)child).name == name));
}
}