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.Logging;
using HarmonyLib;
using ItsAEggNotABomb.Plugins;
using UnityEngine;
using UnityEngine.PlayerLoop;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("It'sAEggNotABomb")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("It'sAEggNotABomb")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2034058d-39a0-4a51-8517-4da1cee3aa07")]
[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 ItsAEggNotABomb
{
[BepInPlugin("Ryoryoman_EggMaster", "EggMaster", "1.0.0")]
public class EggMasterBase : BaseUnityPlugin
{
private const string modGUID = "Ryoryoman_EggMaster";
private const string modName = "EggMaster";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("Ryoryoman_EggMaster");
public static EggMasterBase Instance;
public static ManualLogSource mls;
private AssetBundle myAssets;
public static Texture2D bombTex;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Ryoryoman_EggMaster");
mls.LogInfo((object)"EggMaster1.0.0loaded.");
harmony.PatchAll(typeof(EggMasterBase));
harmony.PatchAll(typeof(SwitchExplode));
harmony.PatchAll(typeof(NoticeExplode));
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string text = Path.Combine(directoryName, "eggbundle");
myAssets = AssetBundle.LoadFromFile(text);
if ((Object)(object)myAssets == (Object)null)
{
mls.LogError((object)"Failed to load AssetBundle!");
return;
}
mls.LogInfo((object)"AssetBundle loaded successfully.");
bombTex = myAssets.LoadAsset<Texture2D>("BombTex");
if ((Object)(object)bombTex == (Object)null)
{
mls.LogError((object)"Slider prefab not found in AssetBundle.");
}
}
}
}
namespace ItsAEggNotABomb.Plugins
{
[HarmonyPatch(typeof(StunGrenadeItem))]
internal class NoticeExplode
{
private static Texture2D defaultTex;
private static MeshRenderer renderer;
private static Material mat;
[HarmonyPatch("SetExplodeOnThrowClientRpc")]
[HarmonyPostfix]
public static void NoticeExplodePatch(bool explode, StunGrenadeItem __instance)
{
renderer = ((Component)__instance).gameObject.GetComponent<MeshRenderer>();
mat = ((Renderer)renderer).material;
if ((Object)(object)defaultTex == (Object)null && (Object)(object)mat.mainTexture != (Object)null)
{
Texture mainTexture = mat.mainTexture;
defaultTex = (Texture2D)(object)((mainTexture is Texture2D) ? mainTexture : null);
}
if (explode)
{
mat.mainTexture = (Texture)(object)EggMasterBase.bombTex;
}
else
{
mat.mainTexture = (Texture)(object)defaultTex;
}
}
}
[HarmonyPatch(typeof(Update))]
internal class SwitchExplode
{
}
}