using System;
using System.Collections.Generic;
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.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Tomatobird.BuhCompany")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+9361d68d85852c51d6b0d602fcc22541c9fead92")]
[assembly: AssemblyProduct("BuhCompany")]
[assembly: AssemblyTitle("Tomatobird.BuhCompany")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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 BuhCompany
{
[BepInPlugin("Tomatobird.BuhCompany", "BuhCompany", "1.0.1")]
public class BuhCompany : BaseUnityPlugin
{
private Dictionary<int, Vector3[]> presets = new Dictionary<int, Vector3[]>();
public GameObject? buhPrefab;
public static Vector3[]? selectedVectors;
public static float buhAnimationSpeed = 1f;
public static BuhCompany Instance { get; private set; } = null;
internal static ManualLogSource Logger { get; private set; } = null;
private void Awake()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: 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)
//IL_003f: 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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Expected O, but got Unknown
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
presets.Add(0, (Vector3[])(object)new Vector3[3]
{
new Vector3(-27.8f, 10f, -23f),
new Vector3(357.1f, 270f, 0f),
new Vector3(13f, 13f, 13f)
});
presets.Add(1, (Vector3[])(object)new Vector3[3]
{
new Vector3(-27.4f, 19.1f, -8.4f),
new Vector3(357.1f, 270f, 0f),
new Vector3(13f, 13f, 13f)
});
presets.Add(2, (Vector3[])(object)new Vector3[3]
{
new Vector3(-25.6f, 55.16f, -23f),
new Vector3(357.1f, 270f, 0f),
new Vector3(50f, 50f, 50f)
});
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
string value = ((BaseUnityPlugin)this).Config.Bind<string>("General", "BuhPosition", "High", new ConfigDescription("Where buh should be displayed", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[4] { "Low", "Middle", "High", "Custom" }), Array.Empty<object>())).Value;
string value2 = ((BaseUnityPlugin)this).Config.Bind<string>("General", "CustomPosition", "-25.6, 55.16, -23", "Custom position value when Custom is selected from presets.").Value;
string value3 = ((BaseUnityPlugin)this).Config.Bind<string>("General", "CustomRotation", "357.1, 270, 0", "Custom rotation value when Custom is selected from presets.").Value;
string value4 = ((BaseUnityPlugin)this).Config.Bind<string>("General", "CustomScale", "50, 50, 50", "Custom scale value when Custom is selected from presets.").Value;
buhAnimationSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("General", "BuhAnimationSpeed", 1f, "Speed of the animation.").Value;
string[] array = new string[3] { value2, value3, value4 };
switch (value)
{
case "Low":
selectedVectors = presets[0];
break;
case "Middle":
selectedVectors = presets[1];
break;
case "High":
selectedVectors = presets[2];
break;
case "Custom":
selectedVectors = (Vector3[]?)(object)new Vector3[3]
{
ParseVector3FromString(value2),
ParseVector3FromString(value3),
ParseVector3FromString(value4)
};
break;
}
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "buh");
AssetBundle val = AssetBundle.LoadFromFile(text);
buhPrefab = val.LoadAsset<GameObject>("Assets/LethalCompany/Mods/buh/buhsquare.prefab");
if ((Object)(object)buhPrefab != (Object)null)
{
SceneManager.sceneLoaded += OnSceneLoaded;
SceneManager.sceneUnloaded += OnSceneUnloaded;
}
else
{
Logger.LogError((object)"Failed to load prefab.");
}
Logger.LogInfo((object)"Tomatobird.BuhCompany v1.0.1 has loaded!");
}
private static Vector3 ParseVector3FromString(string s)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
try
{
string[] array = s.Split(',');
return new Vector3(float.Parse(array[0].Trim()), float.Parse(array[1].Trim()), float.Parse(array[2].Trim()));
}
catch (IndexOutOfRangeException ex)
{
Logger.LogError((object)("Specified string could not be parsed for a Vector3. Please use the correct format. Example: '-14.6, 4.6, 0' " + ex.Message));
}
catch (ArgumentOutOfRangeException ex2)
{
Logger.LogError((object)("Specified string could not be parsed for a Vector3. Please use the correct format. Example: '-14.6, 4.6, 0' " + ex2.Message));
}
catch (ArgumentNullException ex3)
{
Logger.LogError((object)("ArgumentNullException while trying to parse Vector3. " + ex3.Message));
}
catch (FormatException ex4)
{
Logger.LogError((object)("FormatException while trying to parse Vector3. " + ex4.Message));
}
return default(Vector3);
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
if (!(((Scene)(ref scene)).name != "CompanyBuilding"))
{
Vector3 val = selectedVectors[0];
Quaternion identity = Quaternion.identity;
((Quaternion)(ref identity)).eulerAngles = selectedVectors[1];
GameObject val2 = Object.Instantiate<GameObject>(buhPrefab, val, identity);
val2.transform.localScale = selectedVectors[2];
val2.GetComponent<Animator>().speed = buhAnimationSpeed;
}
}
private void OnSceneUnloaded(Scene scene)
{
if (!(((Scene)(ref scene)).name != "CompanyBuilding"))
{
GameObject val = GameObject.Find("buhsquare(Clone)");
if ((Object)(object)val != (Object)null)
{
Object.Destroy((Object)(object)val);
}
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Tomatobird.BuhCompany";
public const string PLUGIN_NAME = "BuhCompany";
public const string PLUGIN_VERSION = "1.0.1";
}
}