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 Characters.Gear.Items;
using Data;
using HarmonyLib;
using Level;
using Level.Npc.FieldNpcs;
using Microsoft.CodeAnalysis;
using Services;
using Singletons;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Plugins.Singletons")]
[assembly: AssemblyCompany("FixNPCs")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Fix correlated randomness and make NPCs more random.")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1")]
[assembly: AssemblyProduct("FixNPCs")]
[assembly: AssemblyTitle("FixNPCs")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.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 FixNPCs
{
[HarmonyPatch]
public class FixNPCPatch
{
[HarmonyPostfix]
[HarmonyPatch(typeof(FogWolf), "Start")]
private static void FixSpokesmanRNG(ref FogWolf __instance)
{
__instance._random.Next();
}
[HarmonyPostfix]
[HarmonyPatch(typeof(FieldDruid), "Start")]
private static void FixDruidRNG(ref FieldDruid __instance)
{
__instance._random.Next();
}
[HarmonyPrefix]
[HarmonyPatch(typeof(MagicalSlime), "CPolymorphToRandomItem")]
private static void FixSlimeRNG(ref MagicalSlime __instance, ref Item targetItem)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected I4, but got Unknown
Chapter currentChapter = Singleton<Service>.Instance.levelManager.currentChapter;
Random random = new Random(Save.instance.randomSeed + -699075432 + currentChapter.type * 256 + currentChapter.stageIndex * 16 + currentChapter.currentStage.pathIndex);
random.Next();
targetItem = Singleton<Service>.Instance.levelManager.player.playerComponents.inventory.item.GetRandomItem(random);
}
}
[BepInPlugin("FixNPCs", "FixNPCs", "0.0.1")]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
Harmony.CreateAndPatchAll(typeof(FixNPCPatch), (string)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Mod FixNPCs is loaded!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "FixNPCs";
public const string PLUGIN_NAME = "FixNPCs";
public const string PLUGIN_VERSION = "0.0.1";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}