using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("figgies.smorehats")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("figgies.smorehats")]
[assembly: AssemblyTitle("SmoreHats")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace SmoreHats
{
[BepInPlugin("figgies.smorehats", "smore hats", "1.1.0")]
public class Plugin : BaseUnityPlugin
{
private class Patcher
{
public static bool dummyPatched;
public static bool CreateHatOption(Customization customization, string name, Texture2D icon)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
string name2 = name;
if (Array.Exists(customization.hats, (CustomizationOption hat) => ((Object)hat).name == name2))
{
return false;
}
CustomizationOption val = ScriptableObject.CreateInstance<CustomizationOption>();
val.color = Color.white;
((Object)val).name = name2;
val.texture = (Texture)(object)icon;
val.type = (Type)50;
val.requiredAchievement = (ACHIEVEMENTTYPE)0;
customization.hats = CollectionExtensions.AddToArray<CustomizationOption>(customization.hats, val);
return true;
}
[HarmonyPatch(typeof(PassportManager), "Awake")]
[HarmonyPostfix]
public static void PassportManagerAwakePostfix(PassportManager __instance)
{
CreateHatOption(((Component)__instance).GetComponent<Customization>(), "Hat_Bald", customHatsIcons[0]);
CreateHatOption(((Component)__instance).GetComponent<Customization>(), "Hat_Tree", customHatsIcons[1]);
CreateHatOption(((Component)__instance).GetComponent<Customization>(), "Hat_Sprout", customHatsIcons[2]);
CreateHatOption(((Component)__instance).GetComponent<Customization>(), "Hat_Halo", customHatsIcons[3]);
CreateHatOption(((Component)__instance).GetComponent<Customization>(), "Hat_Horns", customHatsIcons[4]);
CreateHatOption(((Component)__instance).GetComponent<Customization>(), "Hat_Surskit", customHatsIcons[5]);
CreateHatOption(((Component)__instance).GetComponent<Customization>(), "Hat_Egg", customHatsIcons[6]);
CreateHatOption(((Component)__instance).GetComponent<Customization>(), "Hat_StickyNote", customHatsIcons[7]);
CreateHatOption(((Component)__instance).GetComponent<Customization>(), "Hat_FreddyFazbear", customHatsIcons[8]);
CreateHatOption(((Component)__instance).GetComponent<Customization>(), "Hat_Ralseis Hat", customHatsIcons[9]);
}
[HarmonyPatch(typeof(CharacterCustomization), "Awake")]
[HarmonyPostfix]
public static void CharacterCustomizationAwakePostfix(CharacterCustomization __instance)
{
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
//IL_023a: Unknown result type (might be due to invalid IL or missing references)
//IL_025a: Unknown result type (might be due to invalid IL or missing references)
//IL_0297: Unknown result type (might be due to invalid IL or missing references)
//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
//IL_0314: Unknown result type (might be due to invalid IL or missing references)
//IL_0334: Unknown result type (might be due to invalid IL or missing references)
//IL_0354: Unknown result type (might be due to invalid IL or missing references)
//IL_0391: Unknown result type (might be due to invalid IL or missing references)
//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
//IL_03d1: Unknown result type (might be due to invalid IL or missing references)
//IL_040e: Unknown result type (might be due to invalid IL or missing references)
//IL_042e: Unknown result type (might be due to invalid IL or missing references)
//IL_044e: Unknown result type (might be due to invalid IL or missing references)
//IL_048b: Unknown result type (might be due to invalid IL or missing references)
//IL_04ab: Unknown result type (might be due to invalid IL or missing references)
//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
//IL_0505: Unknown result type (might be due to invalid IL or missing references)
//IL_0525: Unknown result type (might be due to invalid IL or missing references)
//IL_0545: Unknown result type (might be due to invalid IL or missing references)
Transform child = ((Component)__instance).transform.GetChild(0).GetChild(0).GetChild(0)
.GetChild(2)
.GetChild(0)
.GetChild(0)
.GetChild(1)
.GetChild(1);
for (int i = 0; i < customHats.Count; i++)
{
GameObject val = Object.Instantiate<GameObject>(customHats[i]);
((Renderer)val.GetComponent<MeshRenderer>()).material.shader = Shader.Find("W/Character");
val.transform.SetParent(child);
if (((Object)val).name.Contains("bald"))
{
val.transform.localPosition = new Vector3(0f, 0.275f, 7.05f);
val.transform.localScale = new Vector3(0f, 0f, 0f);
val.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
}
else if (((Object)val).name.Contains("tree"))
{
val.transform.localPosition = new Vector3(0f, 0.25f, 7.25f);
val.transform.localScale = new Vector3(30f, 30f, 30f);
val.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
}
else if (((Object)val).name.Contains("sprout"))
{
val.transform.localPosition = new Vector3(0f, 0.25f, 7f);
val.transform.localScale = new Vector3(60f, 60f, 60f);
val.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
}
else if (((Object)val).name.Contains("halo"))
{
val.transform.localPosition = new Vector3(0f, 0.25f, 5.25f);
val.transform.localScale = new Vector3(100f, 100f, 100f);
val.transform.localRotation = Quaternion.Euler(0f, 0f, 90f);
}
else if (((Object)val).name.Contains("horns"))
{
val.transform.localPosition = new Vector3(0f, 0.25f, 5.5f);
val.transform.localScale = new Vector3(175f, 175f, 175f);
val.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
}
else if (((Object)val).name.Contains("surskit"))
{
val.transform.localPosition = new Vector3(0f, 0.275f, 7.05f);
val.transform.localScale = new Vector3(18f, 18f, 18f);
val.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
}
else if (((Object)val).name.Contains("egg hat"))
{
val.transform.localPosition = new Vector3(0f, 0.2f, 2.35f);
val.transform.localScale = new Vector3(300f, 300f, 300f);
val.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
}
else if (((Object)val).name.Contains("postitnote"))
{
val.transform.localPosition = new Vector3(0f, 0.275f, 1.55f);
val.transform.localScale = new Vector3(300f, 300f, 300f);
val.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
}
else if (((Object)val).name.Contains("tophat"))
{
val.transform.localPosition = new Vector3(0f, 0.275f, 7.3f);
val.transform.localScale = new Vector3(150f, 150f, 150f);
val.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
}
else if (((Object)val).name.Contains("ralseis hat"))
{
val.transform.localPosition = new Vector3(0f, 0.275f, 6.8f);
val.transform.localScale = new Vector3(150f, 150f, 150f);
val.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
}
val.SetActive(false);
__instance.refs.playerHats = CollectionExtensions.AddToArray<Renderer>(__instance.refs.playerHats, (Renderer)(object)val.GetComponent<MeshRenderer>());
}
}
}
public static AssetBundle assetBundle;
public static List<GameObject> customHats;
public static List<Texture2D> customHatsIcons;
public void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
new Harmony("figgies.smorehats").PatchAll(typeof(Patcher));
assetBundle = AssetBundle.LoadFromMemory(Resource1.smorehats);
customHats = new List<GameObject>();
customHatsIcons = new List<Texture2D>();
customHats.Add(assetBundle.LoadAsset<GameObject>("assets/bald.prefab"));
customHats.Add(assetBundle.LoadAsset<GameObject>("assets/tree.prefab"));
customHats.Add(assetBundle.LoadAsset<GameObject>("assets/sprout.prefab"));
customHats.Add(assetBundle.LoadAsset<GameObject>("assets/halo.prefab"));
customHats.Add(assetBundle.LoadAsset<GameObject>("assets/horns.prefab"));
customHats.Add(assetBundle.LoadAsset<GameObject>("assets/surskit.prefab"));
customHats.Add(assetBundle.LoadAsset<GameObject>("assets/postitnote.prefab"));
customHats.Add(assetBundle.LoadAsset<GameObject>("assets/egg hat.prefab"));
customHats.Add(assetBundle.LoadAsset<GameObject>("assets/tophat.prefab"));
customHats.Add(assetBundle.LoadAsset<GameObject>("assets/ralseis hat.prefab"));
customHatsIcons.Add(assetBundle.LoadAsset<Texture2D>("assets/bald.png"));
customHatsIcons.Add(assetBundle.LoadAsset<Texture2D>("assets/tree.png"));
customHatsIcons.Add(assetBundle.LoadAsset<Texture2D>("assets/sprout.png"));
customHatsIcons.Add(assetBundle.LoadAsset<Texture2D>("assets/halo.png"));
customHatsIcons.Add(assetBundle.LoadAsset<Texture2D>("assets/horns.png"));
customHatsIcons.Add(assetBundle.LoadAsset<Texture2D>("assets/surskit.png"));
customHatsIcons.Add(assetBundle.LoadAsset<Texture2D>("assets/post_it.png"));
customHatsIcons.Add(assetBundle.LoadAsset<Texture2D>("assets/egg.png"));
customHatsIcons.Add(assetBundle.LoadAsset<Texture2D>("assets/tophat.png"));
customHatsIcons.Add(assetBundle.LoadAsset<Texture2D>("assets/ralseis hat.png"));
}
}
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
internal class Resource1
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
ResourceManager resourceManager = new ResourceManager("SmoreHats.Resource1", typeof(Resource1).Assembly);
resourceMan = resourceManager;
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal static byte[] smorehats
{
get
{
object @object = ResourceManager.GetObject("smorehats", resourceCulture);
return (byte[])@object;
}
}
internal Resource1()
{
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}