using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using MineTurtle.Patches;
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("MineTurtle")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MineTurtle")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f2a601db-57fb-4eda-ac4d-f6d93020e834")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MineTurtle
{
[BepInPlugin("Ex.MineTurtle", "Ex MineTurtle Replacer Mod", "1.0.0")]
public class MineTurtleBase : BaseUnityPlugin
{
private const string modGUID = "Ex.MineTurtle";
private const string modName = "Ex MineTurtle Replacer Mod";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("Ex.MineTurtle");
private static MineTurtleBase Instance;
internal ManualLogSource mls;
public static GameObject newMineModel;
public static AudioClip newMineHello;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Ex.MineTurtle");
mls.LogInfo((object)"MineTurtle mod has initiated");
string location = ((BaseUnityPlugin)Instance).Info.Location;
string text = "MineTurtle.dll";
string text2 = location.TrimEnd(text.ToCharArray());
string text3 = text2 + "mineturtleprops";
AssetBundle val = AssetBundle.LoadFromFile(text3);
if ((Object)(object)val == (Object)null)
{
mls.LogError((object)"Failed to load assets!");
return;
}
newMineModel = val.LoadAsset<GameObject>("Assets/MineTurtle.prefab");
newMineHello = val.LoadAsset<AudioClip>("Assets/MineHello.mp3");
harmony.PatchAll(typeof(MineTurtleBase));
harmony.PatchAll(typeof(LandminePatch));
mls.LogInfo((object)"MineTurtle replacer mod has loaded.");
}
}
}
namespace MineTurtle.Patches
{
[HarmonyPatch(typeof(Landmine))]
internal class LandminePatch
{
[HarmonyPatch("Start")]
[HarmonyPostfix]
public static void MineTurtlePatch(Landmine __instance, ref AudioClip ___mineTrigger)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
Transform child = ((Component)__instance).transform.GetChild(0);
((Renderer)((Component)__instance).GetComponent<MeshRenderer>()).enabled = false;
Debug.Log((object)("MineTurtle Instance " + (object)child));
GameObject val = Object.Instantiate<GameObject>(MineTurtleBase.newMineModel);
Debug.Log((object)("MineTurtle Instance " + (object)val));
val.transform.SetParent(child);
val.transform.localPosition = Vector3.zero;
val.transform.localRotation = Quaternion.identity;
val.transform.localScale = Vector3.one;
Vector3 localScale = child.localScale;
((Vector3)(ref localScale)).Set(0.01f, 0.01f, 0.01f);
child.localScale = localScale;
Vector3 localPosition = child.localPosition;
((Vector3)(ref localPosition)).Set(1.5f, -1.5f, 0.3f);
child.localPosition = localPosition;
___mineTrigger = MineTurtleBase.newMineHello;
}
}
}