using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Costumes.Patches;
using HarmonyLib;
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("Poob")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Poob")]
[assembly: AssemblyCopyright("Copyright © Spookybuddy 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("28f2f16b-6471-4c7e-b0a4-007e3a2450d4")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Costumes
{
[BepInPlugin("EnemyHalloweenCostumes", "EnemyHalloweenCostumes", "1.0.0")]
public class CostumesModBase : BaseUnityPlugin
{
public const string modGUID = "EnemyHalloweenCostumes";
private const string modName = "EnemyHalloweenCostumes";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("EnemyHalloweenCostumes");
internal static CostumesModBase Instance;
internal static ManualLogSource mls;
internal static GameObject[] costumes;
public static ConfigEntry<bool> Lootbug;
public static ConfigEntry<bool> Tulipsnake;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("EnemyHalloweenCostumes");
string path = Directory.GetFiles(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "costumes.bundle")[0];
AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), path));
if ((Object)(object)val != (Object)null)
{
costumes = val.LoadAllAssets<GameObject>();
if (costumes == null || costumes.Length < 1)
{
mls.LogError((object)"Costumes failed to load from bundle!");
return;
}
for (int i = 0; i < costumes.Length; i++)
{
mls.LogInfo((object)("Found " + ((Object)costumes[i]).name));
}
Lootbug = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy Halloween Costumes", "Hoarding Bug Ghost", true, "The Hoarding Bugs put on their ghost costume.");
Tulipsnake = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy Halloween Costumes", "Tulipsnake Pumpkin", true, "The Tulipsnakes put on their pumpkin head costume.");
harmony.PatchAll(typeof(CostumesModBase));
harmony.PatchAll(typeof(LootbugPatch));
harmony.PatchAll(typeof(TulipPatch));
mls.LogInfo((object)"Spooky season is back!");
}
else
{
mls.LogError((object)"Costumes not found!");
}
}
}
}
namespace Costumes.Patches
{
[HarmonyPatch(typeof(HoarderBugAI))]
internal class LootbugPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void PutOnCostume(HoarderBugAI __instance)
{
if (CostumesModBase.Lootbug.Value)
{
Object.Instantiate<GameObject>(CostumesModBase.costumes[0], ((Component)__instance).transform.GetChild(2).GetChild(2).GetChild(0)
.GetChild(0)
.GetChild(2));
}
}
}
[HarmonyPatch(typeof(FlowerSnakeEnemy))]
internal class TulipPatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void PutOnCostume(FlowerSnakeEnemy __instance)
{
if (CostumesModBase.Tulipsnake.Value)
{
Object.Instantiate<GameObject>(CostumesModBase.costumes[1], ((Component)__instance).transform.GetChild(0).GetChild(0).GetChild(0)
.GetChild(0)
.GetChild(0)
.GetChild(0)
.GetChild(0));
}
}
}
}