using System;
using System.Diagnostics;
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 Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("com.github.Lokno.EasyAllBobble")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.2.0.0")]
[assembly: AssemblyInformationalVersion("0.2.0+28a07c32356fd24e35f58150b65388992ab50754")]
[assembly: AssemblyProduct("EasyAllBobble")]
[assembly: AssemblyTitle("com.github.Lokno.EasyAllBobble")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.2.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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace EasyAllBobble
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "com.github.Lokno.EasyAllBobble";
public const string PLUGIN_NAME = "EasyAllBobble";
public const string PLUGIN_VERSION = "0.2.0";
}
}
namespace EasyDeliveryCoPlugin
{
[BepInPlugin("com.github.Lokno.EasyAllBobble", "EasyAllBobble", "0.2.0")]
public class Plugin : BaseUnityPlugin
{
[HarmonyPatch]
public class DashPatch : HarmonyPatch
{
private static MethodInfo TargetMethod()
{
return typeof(CarDamage).GetMethod("Start", BindingFlags.Instance | BindingFlags.NonPublic);
}
private static void Postfix(CarDamage __instance)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
GameObject gameObject = ((Component)((Component)__instance).transform.Find("BobbleHead")).gameObject;
Object.Instantiate<GameObject>(gameObject, new Vector3(-1.0831f, 0.8019f, 0.0809f), Quaternion.Euler(0f, 117.1353f, 0f)).transform.parent = gameObject.transform.parent;
}
}
[HarmonyPatch]
public class DisableDisplayBobblePatch : HarmonyPatch
{
private static MethodInfo TargetMethod()
{
return typeof(SnowcatManager).GetMethod("SetDisplayBobble", BindingFlags.Instance | BindingFlags.NonPublic);
}
private static void Postfix(SnowcatManager __instance)
{
__instance.carDisplayBobble.gameObject.SetActive(false);
}
}
[HarmonyPatch]
public class SnowcatPatch : HarmonyPatch
{
private enum SnowCats
{
SD30 = 1,
SD66,
SD49,
SD11,
SD24,
SD02,
SD72,
SD55,
SD56,
SD08,
SD51,
SD19,
DD78
}
private static SnowCats[] order = new SnowCats[13]
{
SnowCats.SD24,
SnowCats.SD56,
SnowCats.DD78,
SnowCats.SD55,
SnowCats.SD30,
SnowCats.SD02,
SnowCats.SD19,
SnowCats.SD66,
SnowCats.SD08,
SnowCats.SD72,
SnowCats.SD51,
SnowCats.SD49,
SnowCats.SD11
};
private static MethodInfo TargetMethod()
{
return typeof(SnowcatManager).GetMethod("SetBobbles", BindingFlags.Instance | BindingFlags.NonPublic);
}
private static Transform CreateBobbles(SnowcatManager snowcatManager, GameObject displayBobble)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
Logger.LogInfo((object)"Creating bobbles...");
GameObject val = new GameObject("Bobbles");
val.transform.parent = snowcatManager.carDisplayBobble.transform.parent;
val.transform.localPosition = snowcatManager.carDisplayBobble.transform.localPosition;
val.transform.localRotation = Quaternion.Euler(0f, 0f, 0f);
val.transform.localScale = new Vector3(1f, 1f, 1f);
for (int i = 1; i <= order.Length; i++)
{
SnowCats snowCats = order[order.Length - i];
GameObject val2 = Object.Instantiate<GameObject>(displayBobble, val.transform);
int num = (int)snowCats;
((Object)val2).name = "Bobble" + num;
val2.transform.localPosition = new Vector3(-1.06f + (float)(i - 1) * 0.175f, 0f, (i < 5) ? (-0.05f) : 0f);
val2.transform.localRotation = Quaternion.Euler(0f, 180f, 0f);
val2.transform.localScale = new Vector3(0.1406f, 0.1406f, 0.1406f);
val2.SetActive(true);
if (snowCats != SnowCats.DD78)
{
Swing componentInChildren = val2.GetComponentInChildren<Swing>();
if ((Object)(object)componentInChildren != (Object)null)
{
componentInChildren.dampen = 0.98f + Random.Range(-0.004f, 0.004f);
if (snowCats == SnowCats.SD11)
{
componentInChildren.dampen = 0.991f;
}
componentInChildren.spring = 50f + Random.Range(-5f, 5f);
}
}
MeshRenderer[] componentsInChildren = val2.GetComponentsInChildren<MeshRenderer>();
for (int j = 0; j < componentsInChildren.Length; j++)
{
((Renderer)componentsInChildren[j]).material.SetTexture("_BaseMap", snowcatManager.npcTextures[(int)(snowCats - 1)]);
}
}
return val.transform;
}
private static void Postfix(SnowcatManager __instance)
{
if ((Object)(object)__instance != (Object)null && (Object)(object)__instance.carDisplayBobble != (Object)null)
{
Transform val = __instance.carDisplayBobble.transform.parent.Find("Bobbles");
if ((Object)(object)val == (Object)null)
{
val = CreateBobbles(__instance, __instance.carDisplayBobble);
}
for (int i = 0; i < val.childCount; i++)
{
Transform child = val.GetChild(i);
int num = int.Parse(((Object)child).name.Substring(6));
((Component)child).gameObject.SetActive(__instance.snowcatsActive[num - 1]);
}
__instance.carDisplayBobble.gameObject.SetActive(false);
}
}
}
internal static ManualLogSource Logger;
private void Awake()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin com.github.Lokno.EasyAllBobble is loaded!");
new Harmony("EasyAllBobble").PatchAll();
}
}
}