using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using AmongusVenting;
using HarmonyLib;
using Libraries;
using MelonLoader;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonGame("ZeekerssRBLX", "Lethal Company")]
[assembly: MelonInfo(typeof(Class1), "AmongusVenting", "0.0.1", "imafrogowo", null)]
[assembly: AssemblyTitle("AmongusVenting")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AmongusVenting")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5b918d53-d13d-4c0a-b6a0-f1244fd726a9")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AmongusVenting
{
public class Class1 : MelonMod
{
public static GameObject Amongus;
public override void OnApplicationStart()
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Expected O, but got Unknown
MethodInfo method = typeof(Class1).GetMethod("SUSSYBAKAAAAAAAAA", AccessTools.all);
ConstructorInfo constructorInfo = AccessTools.Constructor(typeof(EnemyVent), (Type[])null, false);
((MelonBase)this).HarmonyInstance.Patch((MethodBase)constructorInfo, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
public override void OnApplicationLateStart()
{
AssetBundleLib assetBundleLib = new AssetBundleLib();
if (assetBundleLib.LoadBundle("AmongusVenting.audio source.asset"))
{
Amongus = assetBundleLib.Load<GameObject>("Audio Source.prefab");
}
else
{
MelonLogger.Error("Failed Loading Bundle: " + assetBundleLib.error);
}
}
private static bool SUSSYBAKAAAAAAAAA(ref EnemyVent __instance)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(Amongus);
AudioSource component = val.GetComponent<AudioSource>();
val.transform.SetParent(((Component)__instance.ventAudio).transform);
val.transform.localPosition = Vector3.zero;
__instance.ventAudio = component;
return true;
}
}
}
namespace Libraries
{
public class AssetBundleLib
{
public AssetBundle bundle = null;
public bool HasLoadedABundle = false;
public string error = "";
public bool LoadBundle(string resource)
{
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
if (HasLoadedABundle)
{
return true;
}
try
{
if (string.IsNullOrEmpty(resource))
{
error = "Null Or Empty Resource String!";
return false;
}
Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource);
if (manifestResourceStream != null && manifestResourceStream.Length > 0)
{
MemoryStream memoryStream = new MemoryStream((int)manifestResourceStream.Length);
manifestResourceStream.CopyTo(memoryStream);
if (memoryStream.Length > 0)
{
return LoadBundle(memoryStream.ToArray());
}
error = "Null memStream!";
}
else
{
error = "Null Stream!";
}
string resourcename = resource.Replace(resource.Substring(resource.LastIndexOf(".")), "").Substring(resource.LastIndexOf("."));
AssetBundle val = AssetBundle.GetAllLoadedAssetBundles().First((AssetBundle o) => ((Object)o).name == resourcename);
((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x20);
bundle = val;
return false;
}
catch (Exception ex)
{
error = ex.ToString();
return false;
}
}
public bool LoadBundle(byte[] resource)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
if (HasLoadedABundle)
{
return true;
}
try
{
AssetBundle val = AssetBundle.LoadFromMemory(resource);
if ((Object)(object)val != (Object)null)
{
((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x20);
bundle = val;
HasLoadedABundle = true;
return true;
}
HasLoadedABundle = true;
}
catch (Exception ex)
{
error = ex.ToString();
return false;
}
return false;
}
public T Load<T>(string str) where T : Object
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
try
{
if (HasLoadedABundle)
{
Object obj = bundle.LoadAsset(str, typeof(T));
T result = (T)(object)((obj is T) ? obj : null);
((Object)result).hideFlags = (HideFlags)(((Object)result).hideFlags | 0x20);
return result;
}
}
catch (Exception ex)
{
error = ex.ToString();
}
return default(T);
}
}
}