using System;
using System.Collections.Generic;
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.Configuration;
using BepInEx.Logging;
using Goku.Cosmetics;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MoreCompany.Cosmetics;
using MoreCompany.Utils;
using UnityEngine;
[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("EliteMasterEric")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("New interesting cosmetics for Lethal Company")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("WackyCosmetics")]
[assembly: AssemblyTitle("WackyCosmetics")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace Goku
{
public static class PluginInfo
{
public const string PLUGIN_ID = "Goku";
public const string PLUGIN_NAME = "A Cosmetic that is Goku behind you";
public const string PLUGIN_VERSION = "1.0.0";
public const string PLUGIN_GUID = "com.decodinator.goku";
}
[BepInPlugin("com.decodinator.goku", "A Cosmetic that is Goku behind you", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public ManualLogSource PluginLogger;
public PluginConfig PluginConfig;
public static Plugin Instance { get; private set; }
private void Awake()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected O, but got Unknown
Instance = this;
PluginLogger = ((BaseUnityPlugin)this).Logger;
Harmony val = new Harmony("com.decodinator.goku");
val.PatchAll();
PluginLogger.LogInfo((object)"Plugin A Cosmetic that is Goku behind you (com.decodinator.goku) is loaded!");
LoadConfig();
LoadCosmetics();
}
private void LoadConfig()
{
PluginConfig = new PluginConfig();
PluginConfig.BindConfig(((BaseUnityPlugin)this).Config);
}
private void LoadCosmetics()
{
GokuCosmeticGeneric.LoadCosmeticsFromThisAssembly();
}
}
internal class PluginAssets
{
public static AssetBundle LoadBundleFromThisAssembly(string filename)
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
if (executingAssembly == null)
{
Plugin.Instance.PluginLogger.LogError((object)("Failed to get assembly reference while loading bundle: " + filename));
return null;
}
return BundleUtilities.LoadBundleFromInternalAssembly(filename, executingAssembly);
}
public static string[] ListEmbeddedResourcesInThisAssembly()
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
if (executingAssembly == null)
{
Plugin.Instance.PluginLogger.LogError((object)"Failed to get assembly reference while listing embedded resources.");
return null;
}
return executingAssembly.GetManifestResourceNames();
}
}
public class PluginConfig
{
public Dictionary<string, ConfigEntry<bool>> CosmeticConfigEntries;
public PluginConfig()
{
CosmeticConfigEntries = new Dictionary<string, ConfigEntry<bool>>();
}
public void BindConfig(ConfigFile config)
{
GokuCosmeticGeneric.GenerateCosmeticConfigEntries(config);
}
internal void GenerateCosmeticConfigEntry(ConfigFile config, GokuCosmeticGeneric cosmetic)
{
ConfigEntry<bool> value = config.Bind<bool>("Cosmetics", "EnableCosmetic_" + ((CosmeticGeneric)cosmetic).cosmeticId, true, "Enable the " + cosmetic.cosmeticName + " cosmetic.");
CosmeticConfigEntries.Add(((CosmeticGeneric)cosmetic).cosmeticId, value);
}
public bool IsCosmeticEnabled(GokuCosmeticGeneric cosmetic)
{
return CosmeticConfigEntries[((CosmeticGeneric)cosmetic).cosmeticId].Value;
}
}
}
namespace Goku.Cosmetics
{
public class GOKU : GokuCosmeticGeneric
{
private string iconPath = "assets/decodinator/goku/goku_icon.png";
public override string gameObjectPath => "assets/decodinator/goku/GOKU.prefab";
public override string cosmeticId => "decodinator.goku";
public override string textureIconPath => iconPath;
public override string cosmeticName => "Goku Powered Up";
public override string assetBundlePath => "cosmetic_goku";
public override CosmeticType cosmeticType => (CosmeticType)4;
}
public class GokuCosmeticGeneric : CosmeticGeneric
{
public virtual string cosmeticName { get; }
public virtual string assetBundlePath { get; }
public AssetBundle assetBundle { get; private set; }
public void LoadFromAssetBundle()
{
//IL_0130: 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)
if (!Plugin.Instance.PluginConfig.IsCosmeticEnabled(this))
{
Plugin.Instance.PluginLogger.LogInfo((object)("Skipped the goku cosmetic: " + ((CosmeticGeneric)this).cosmeticId + ":("));
return;
}
assetBundle = PluginAssets.LoadBundleFromThisAssembly(assetBundlePath);
if ((Object)(object)assetBundle == (Object)null)
{
Plugin.Instance.PluginLogger.LogError((object)("Failed to load cosmetic asset bundle: " + assetBundlePath));
return;
}
GameObject val = AssetBundleExtension.LoadPersistentAsset<GameObject>(assetBundle, ((CosmeticGeneric)this).gameObjectPath);
if ((Object)(object)val == (Object)null)
{
Plugin.Instance.PluginLogger.LogError((object)("Failed to load cosmetic prefab: " + ((CosmeticGeneric)this).gameObjectPath));
return;
}
Texture2D val2 = AssetBundleExtension.LoadPersistentAsset<Texture2D>(assetBundle, ((CosmeticGeneric)this).textureIconPath);
if ((Object)(object)val2 == (Object)null)
{
Plugin.Instance.PluginLogger.LogError((object)("Failed to load cosmetic icon: " + ((CosmeticGeneric)this).textureIconPath));
return;
}
CosmeticInstance val3 = val.AddComponent<CosmeticInstance>();
val3.cosmeticId = ((CosmeticGeneric)this).cosmeticId;
val3.icon = val2;
val3.cosmeticType = ((CosmeticGeneric)this).cosmeticType;
CosmeticRegistry.cosmeticInstances.Add(((CosmeticGeneric)this).cosmeticId, val3);
Plugin.Instance.PluginLogger.LogInfo((object)("Loaded the goku cosmetic: " + ((CosmeticGeneric)this).cosmeticId + ":D"));
}
public static void GenerateCosmeticConfigEntries(ConfigFile config)
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
if (executingAssembly == null)
{
Plugin.Instance.PluginLogger.LogError((object)"Failed to get assembly reference while generating config entries.");
return;
}
Plugin.Instance.PluginLogger.LogInfo((object)"Generating config entries for the goku cosmetics (which is unneeded but i don't feel like removing it lmfao.");
Type[] types = executingAssembly.GetTypes();
foreach (Type type in types)
{
if (!(type == null) && type.IsSubclassOf(typeof(GokuCosmeticGeneric)))
{
GokuCosmeticGeneric cosmetic = (GokuCosmeticGeneric)Activator.CreateInstance(type);
Plugin.Instance.PluginConfig.GenerateCosmeticConfigEntry(config, cosmetic);
}
}
}
public static void LoadCosmeticsFromThisAssembly()
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
if (executingAssembly == null)
{
Plugin.Instance.PluginLogger.LogError((object)"Failed to get assembly reference while loading cosmetics.");
return;
}
Plugin.Instance.PluginLogger.LogInfo((object)"Loading the goku cosmetics.");
Type[] types = executingAssembly.GetTypes();
foreach (Type type in types)
{
if (!(type == null) && type.IsSubclassOf(typeof(GokuCosmeticGeneric)))
{
GokuCosmeticGeneric gokuCosmeticGeneric = (GokuCosmeticGeneric)Activator.CreateInstance(type);
gokuCosmeticGeneric.LoadFromAssetBundle();
}
}
}
}
public class GOKU_UNPOWERED : GokuCosmeticGeneric
{
private string iconPath = "assets/decodinator/goku/goku_off_icon.png";
public override string gameObjectPath => "assets/decodinator/goku/GOKU_OFF.prefab";
public override string cosmeticId => "decodinator.goku_off";
public override string textureIconPath => iconPath;
public override string cosmeticName => "Goku";
public override string assetBundlePath => "cosmetic_goku_unpowered";
public override CosmeticType cosmeticType => (CosmeticType)4;
}
}