using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("ThicctentWarning")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ThicctentWarning")]
[assembly: AssemblyTitle("ThicctentWarning")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace ThicctentWarning;
[BepInPlugin("ThicctentWarning", "ThicctentWarning", "1.0.0")]
[ContentWarningPlugin("ThicctentWarning", "ThicctentWarning", true)]
public class Plugin : BaseUnityPlugin
{
internal static Mesh thiccMesh;
internal static Material thiccMaterial;
internal static ManualLogSource Logger;
private Harmony patch;
private void Awake()
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Assets.PopulateAssets();
Logger.LogInfo((object)"Plugin ThicctentWarning is loaded!");
thiccMesh = Assets.MainAssetBundle.LoadAsset<Mesh>("ThiccMesh");
thiccMaterial = Assets.MainAssetBundle.LoadAsset<Material>("ThiccMaterial");
patch = new Harmony("com.redbigz.ThicctentWarningPatch");
patch.PatchAll();
}
}
[HarmonyPatch]
internal class AddPlayerPatch
{
[HarmonyTargetMethod]
private static MethodInfo TargetMethod()
{
return AccessTools.Method(typeof(Player), "Start", (Type[])null, (Type[])null);
}
[HarmonyPostfix]
private static IEnumerator Postfix(IEnumerator result, Player __instance)
{
while (result.MoveNext())
{
yield return result.Current;
}
Plugin.Logger.LogInfo((object)"Player Instantiated!");
Plugin.Logger.LogInfo((object)((object)__instance.refs).ToString());
Plugin.Logger.LogInfo((object)((Object)__instance.refs.cameraPos).name);
SkinnedMeshRenderer component = ((Component)__instance.refs.cameraPos.parent.parent).gameObject.FindObject("CharacterModel").FindObject("BodyRenderer").GetComponent<SkinnedMeshRenderer>();
component.sharedMesh = Plugin.thiccMesh;
((Renderer)component).SetMaterialArray((Material[])(object)new Material[0]);
((Renderer)component).material = Plugin.thiccMaterial;
}
}
public static class Assets
{
public static string mainAssetBundleName = "thicctentwarning";
public static AssetBundle MainAssetBundle = null;
private static string GetAssemblyName()
{
return Assembly.GetExecutingAssembly().FullName.Split(',')[0];
}
public static void PopulateAssets()
{
if ((Object)(object)MainAssetBundle == (Object)null)
{
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName))
{
MainAssetBundle = AssetBundle.LoadFromStream(stream);
}
}
}
}
internal static class Util
{
public static GameObject FindObject(this GameObject parent, string name)
{
Transform[] componentsInChildren = parent.GetComponentsInChildren<Transform>(true);
foreach (Transform val in componentsInChildren)
{
if (((Object)val).name.StartsWith(name))
{
return ((Component)val).gameObject;
}
}
return null;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "ThicctentWarning";
public const string PLUGIN_NAME = "ThicctentWarning";
public const string PLUGIN_VERSION = "1.0.0";
}