using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using DropThat.Drop.CharacterDropSystem.Managers;
using DropThat.Drop.CharacterDropSystem.Models;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("LocationManager")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LocationManager")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9a1f5bdc-28e9-4b77-a663-75c568c875fb")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
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 CLLCPatchTest
{
[BepInPlugin("com.nullpointercollection.CLLCPatchTest", "CLLCPatchTest", "1.0.0")]
public class CLLCPatchTest : BaseUnityPlugin
{
private const string ModName = "CLLCPatchTest";
private const string ModVersion = "1.0.0";
private const string ModGUID = "com.nullpointercollection.CLLCPatchTest";
private Harmony harmony = new Harmony("com.nullpointercollection.CLLCPatchTest");
public static ManualLogSource Log;
internal static bool DropThatInstalled { get; } = Chainloader.PluginInfos.ContainsKey("asharppen.valheim.drop_that");
internal static bool CLLCInstalled { get; } = Chainloader.PluginInfos.ContainsKey("org.bepinex.plugins.creaturelevelcontrol");
public void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
harmony.PatchAll(Assembly.GetExecutingAssembly());
}
}
[HarmonyPatch(typeof(CharacterDrop), "GenerateDropList")]
public class CGenList
{
[HarmonyAfter(new string[] { "org.bepinex.plugins.creaturelevelcontrol" })]
public static void Postfix(CharacterDrop __instance, ref List<KeyValuePair<GameObject, int>> __result)
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Invalid comparison between Unknown and I4
if (!CLLCPatchTest.CLLCInstalled || !__instance.m_character.m_boss)
{
return;
}
CharacterDropMobTemplate val = default(CharacterDropMobTemplate);
for (int i = 0; i < __result.Count; i++)
{
GameObject key = __result[i].Key;
if (!((Object)key).name.EndsWith("_TW") || (int)key.GetComponent<ItemDrop>().m_itemData.m_shared.m_itemType == 1)
{
continue;
}
bool flag = true;
if (CLLCPatchTest.DropThatInstalled && CharacterDropTemplateManager.TryGetTemplate(Utils.GetPrefabName(((Object)__instance.m_character).name), ref val))
{
foreach (CharacterDropDropTemplate value in val.Drops.Values)
{
if (value.PrefabName.Equals(((Object)key).name))
{
flag = false;
}
}
}
if (flag)
{
__result[i] = new KeyValuePair<GameObject, int>(key, 1);
}
}
}
}
}