using System;
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 GameNetcodeStuff;
using HarmonyLib;
using LobbyCompatibility.Attributes;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("coookies369.SnazzySuits")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2")]
[assembly: AssemblyProduct("SnazzySuits")]
[assembly: AssemblyTitle("coookies369.SnazzySuits")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.2.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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace SnazzySuits
{
[BepInPlugin("coookies369.SnazzySuits", "SnazzySuits", "1.0.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[LobbyCompatibility(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
[HarmonyPatch(typeof(StartOfRound))]
internal class StartOfRoundPatch
{
[HarmonyPatch("Start")]
[HarmonyPrefix]
[HarmonyPriority(0)]
private static void StartPatch(ref StartOfRound __instance)
{
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Expected O, but got Unknown
if (SuitsAdded)
{
return;
}
int count = __instance.unlockablesList.unlockables.Count;
for (int i = 0; i < count; i++)
{
UnlockableItem val = __instance.unlockablesList.unlockables[i];
if (val.unlockableName == "Clown")
{
val.headCostumeObject = (GameObject)MyCustomAssets.LoadAsset("assets/clown/clownnose.prefab");
((Component)val.headCostumeObject.transform.GetChild(0)).GetComponent<Renderer>().material = val.suitMaterial;
}
}
SuitsAdded = true;
}
}
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerControllerPatch
{
[HarmonyPatch("PlayFootstepSound")]
[HarmonyPrefix]
private static void ReplaceFootstepSound(PlayerControllerB __instance, ref bool __runOriginal)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
if (!(StartOfRound.Instance.unlockablesList.unlockables[__instance.currentSuitID].unlockableName != "Clown"))
{
bool num;
if (((NetworkBehaviour)__instance).IsOwner)
{
num = __instance.isSprinting;
}
else
{
AnimatorStateInfo currentAnimatorStateInfo = __instance.playerBodyAnimator.GetCurrentAnimatorStateInfo(0);
num = ((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsTag("Sprinting");
}
float num2 = (num ? 0.9f : 0.6f);
__instance.movementAudio.pitch = Random.Range(0.93f, 1.07f);
AudioClip val = ((__instance.previousFootstepClip == 0) ? ClownShoesHigh : ClownShoesLow);
__instance.movementAudio.PlayOneShot(val, num2);
__instance.previousFootstepClip = ((__instance.previousFootstepClip == 0) ? 1 : 0);
__runOriginal = false;
}
}
}
[HarmonyPatch(typeof(UnlockableSuit))]
internal class UnlockableSuitPatch
{
[HarmonyPatch("SwitchSuitForPlayer")]
[HarmonyPostfix]
private static void AdjustNosePosition(PlayerControllerB player, int suitID)
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)player && StartOfRound.Instance.unlockablesList.unlockables[suitID].unlockableName == "Clown")
{
player.headCostumeContainerLocal.GetChild(0).GetChild(0).localPosition = new Vector3(0.01f, -2.65f, 0.1f);
}
}
}
private readonly Harmony harmony = new Harmony("coookies369.SnazzySuits");
private static AssetBundle MyCustomAssets;
private static bool SuitsAdded;
private static AudioClip ClownShoesHigh;
private static AudioClip ClownShoesLow;
public static Plugin Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
private void Awake()
{
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
MyCustomAssets = AssetBundle.LoadFromFile(Path.Combine(directoryName, "snazzysuits"));
if ((Object)(object)MyCustomAssets == (Object)null)
{
Logger.LogError((object)"Failed to load custom assets.");
return;
}
ClownShoesHigh = (AudioClip)MyCustomAssets.LoadAsset("assets/clown/clownshoeshigh.wav");
ClownShoesLow = (AudioClip)MyCustomAssets.LoadAsset("assets/clown/clownshoeslow.wav");
harmony.PatchAll();
Logger.LogInfo((object)"coookies369.SnazzySuits v1.0.2 has loaded!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "coookies369.SnazzySuits";
public const string PLUGIN_NAME = "SnazzySuits";
public const string PLUGIN_VERSION = "1.0.2";
}
}