using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
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("Lethal Jojo")]
[assembly: AssemblyDescription("Have a little slice of Jojo in your game")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Pandas Hell Hole")]
[assembly: AssemblyProduct("Lethal Jojo")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a5bd5351-ccfb-489c-a801-7ef518af007f")]
[assembly: AssemblyFileVersion("1.0.1")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.1.0")]
namespace LethalJojo;
public static class ModInfo
{
public const string NAME = "Lethal Jojo";
public const string ID = "dev.panda.lethaljojo";
public const string DESCRIPTION = "Have a little slice of Jojo in your game";
public const string COMPANY = "Pandas Hell Hole";
public const string URL = "https://github.com/LeCloutPanda/LethalJojo";
public const string AUTHOR = "LeCloutPanda";
public const string VERSION = "1.0.1";
}
[BepInPlugin("dev.panda.lethaljojo", "Lethal Jojo", "1.0.1")]
public class Mod : BaseUnityPlugin
{
private static StoneMaskPatch StoneMaskPatch;
private void Awake()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
((BaseUnityPlugin)this).Logger.LogMessage((object)"Loaded Lethal Jojo v1.0.1");
StoneMaskPatch = new StoneMaskPatch();
Harmony val = new Harmony("dev.panda.lethaljojo");
val.PatchAll();
}
}
public class StoneMaskPatch : MonoBehaviour
{
[HarmonyPatch(typeof(GrabbableObject), "Start")]
private static class ChangeMaskToStoneMask
{
[HarmonyPostfix]
public static void Postfix(GrabbableObject __instance)
{
HauntedMaskItem val = default(HauntedMaskItem);
((Component)__instance).TryGetComponent<HauntedMaskItem>(ref val);
if (!((Object)(object)val == (Object)null))
{
MeshFilter val2 = default(MeshFilter);
((Component)((Component)__instance).transform.FindChild("MaskMesh")).TryGetComponent<MeshFilter>(ref val2);
if ((Object)(object)val2 != (Object)null)
{
val2.mesh = _stoneMaskMesh;
}
MeshFilter val3 = default(MeshFilter);
((Component)((Component)__instance).transform.FindChild("MaskMesh").FindChild("ComedyMaskLOD1")).TryGetComponent<MeshFilter>(ref val3);
if ((Object)(object)val3 != (Object)null)
{
val3.mesh = _stoneMaskMesh;
}
}
}
}
[HarmonyPatch(typeof(HauntedMaskItem), "MaskClampToHeadAnimationEvent")]
private static class ChangeMaskPrefabModel
{
[HarmonyPostfix]
public static void Postfix(HauntedMaskItem __instance, Transform ___currentHeadMask)
{
MeshFilter val = default(MeshFilter);
((Component)___currentHeadMask.FindChild("ComedyMaskLOD1")).TryGetComponent<MeshFilter>(ref val);
if ((Object)(object)val != (Object)null)
{
val.mesh = _stoneMaskMesh;
}
MeshFilter val2 = default(MeshFilter);
((Component)___currentHeadMask.FindChild("Mesh")).TryGetComponent<MeshFilter>(ref val2);
if ((Object)(object)val2 != (Object)null)
{
val2.mesh = _stoneMaskMesh;
}
}
}
[HarmonyPatch(typeof(MaskedPlayerEnemy), "Awake")]
private static class ChangeEntityMasks
{
[HarmonyPrefix]
public static void Prefix(MaskedPlayerEnemy __instance)
{
GameObject[] maskTypes = __instance.maskTypes;
MeshFilter val2 = default(MeshFilter);
MeshFilter val3 = default(MeshFilter);
foreach (GameObject val in maskTypes)
{
((Component)val.transform.FindChild("ComedyMaskLOD1")).TryGetComponent<MeshFilter>(ref val2);
if ((Object)(object)val2 != (Object)null)
{
val2.mesh = _stoneMaskMesh;
}
((Component)val.transform.FindChild("Mesh")).TryGetComponent<MeshFilter>(ref val3);
if ((Object)(object)val3 != (Object)null)
{
val3.mesh = _stoneMaskMesh;
}
}
}
}
private static Mesh _stoneMaskMesh;
public StoneMaskPatch()
{
//IL_0064: Expected O, but got Unknown
Console.WriteLine("It isn't done.");
try
{
AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Paths.PluginPath, "PandasHellCrew-LethalJojo/LethalJojoAssetBundle"));
if ((Object)(object)val != (Object)null)
{
_stoneMaskMesh = val.LoadAsset<Mesh>("StoneMask_Model");
Console.WriteLine("Loaded mask from bundle.");
}
else
{
Console.WriteLine("Failed loading mask you numpty!");
}
}
catch (UnityException val2)
{
UnityException val3 = val2;
Console.WriteLine("It fucking died lmao ;)");
Console.WriteLine(((Exception)(object)val3).StackTrace);
}
Console.WriteLine("It is done.");
}
}