using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using EmotesAPI;
using LethalEmotesAPI.ImportV2;
using Lethal_Company_SeregaPiratEmotesMod;
using Microsoft.CodeAnalysis;
using SeregaPiratEmotesLoader;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Lethal Company CustomEmotesAPI Template Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Lethal Company CustomEmotesAPI Template Mod")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("199912ba-43b6-4276-b420-7bfaa3eedbe5")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 Lethal_Company_SeregaPiratEmotesMod
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.zpydu.seregapiratemotes", "SeregaPiratEmotes", "1.5.4")]
public class SeregaPiratEmotesMod : BaseUnityPlugin
{
public const string PluginGUID = "com.zpydu.seregapiratemotes";
public const string PluginName = "SeregaPiratEmotes";
public const string PluginVersion = "1.5.4";
public static SeregaPiratEmotesMod instance;
public static PluginInfo PInfo { get; private set; }
public void Awake()
{
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Expected O, but got Unknown
instance = this;
PInfo = ((BaseUnityPlugin)this).Info;
Assets.LoadAssetBundlesFromFolder("assetbundles");
ImportAnimation(new string[1] { "Animations/apelsin.anim" }, new string[1] { "Music/apelsin.ogg" }, "Apelsin", 0.9f, looping: true, sync: true, cantMove: false, thirdPerson: false);
ImportAnimation(new string[1] { "Animations/malishka.anim" }, new string[1] { "Music/malishka.ogg" }, "Malishka", 0.9f, looping: true, sync: true, cantMove: false, thirdPerson: false);
ImportAnimation(new string[1] { "Animations/kachalka.anim" }, new string[1] { "Music/kachalka.ogg" }, "Kachalka", 0.9f, looping: true, sync: true, cantMove: false, thirdPerson: false);
ImportAnimation(new string[1] { "Animations/svoruyubabki.anim" }, new string[1] { "Music/svoruyubabki.ogg" }, "Svoruyu Babki", 0.9f, looping: true, sync: true, cantMove: false, thirdPerson: false);
ImportAnimation(new string[1] { "Animations/mybike.anim" }, new string[1] { "Music/mybike.ogg" }, "My bike", 0.9f, looping: true, sync: true, cantMove: false, thirdPerson: false);
ImportAnimation(new string[1] { "Animations/wibeman.anim" }, new string[1] { "Music/wibeman.ogg" }, "Wibeman", 0.9f, looping: true, sync: true, cantMove: false, thirdPerson: false);
ImportAnimation(new string[1] { "Animations/natalia.anim" }, new string[1] { "Music/natalia.ogg" }, "Natalia", 0.9f, looping: true, sync: true, cantMove: false, thirdPerson: false);
ImportAnimation(new string[1] { "Animations/shizoid.anim" }, new string[1] { "Music/schizoid2.ogg" }, "Shizoid", 0.9f, looping: true, sync: true, cantMove: false, thirdPerson: false);
ImportAnimation(new string[1] { "Animations/vorobei.anim" }, new string[1] { "Music/vorobei.ogg" }, "Vorobei", 0.9f, looping: false, sync: true, cantMove: false, thirdPerson: false);
ImportAnimation(new string[1] { "Animations/vor.anim" }, new string[1] { "Music/vor.ogg" }, "Vor", 0.9f, looping: true, sync: true, cantMove: false, thirdPerson: false);
ImportAnimation(new string[1] { "Animations/prazdnick.anim" }, new string[1] { "Music/prazdnick.ogg" }, "Prazdnick", 0.9f, looping: true, sync: true, cantMove: false, thirdPerson: false);
CustomEmotesAPI.animChanged += new AnimationChanged(CustomEmotesAPI_animChanged);
}
private void CustomEmotesAPI_animChanged(string newAnimation, BoneMapper mapper)
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
if (!newAnimation.StartsWith("com.zpydu.seregapiratemotes"))
{
return;
}
newAnimation = newAnimation.Split("__")[1];
string text = newAnimation;
string text2 = text;
if (!(text2 == "mybike"))
{
if (text2 == "wibeman")
{
SpawnProp("Props/DiskoBall/discoball_prop.prefab", mapper, new Vector3(0f, 3.5f, 0f));
}
}
else
{
SpawnProp("Props/Bike/BikeProp.prefab", mapper, Vector3.zero);
}
}
private void SpawnProp(string prefabPath, BoneMapper boneMapper, Vector3 pos)
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
int count = boneMapper.props.Count;
boneMapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>(prefabPath)));
boneMapper.props[count].transform.SetParent(boneMapper.mapperBody.transform);
boneMapper.props[count].transform.localEulerAngles = Vector3.zero;
boneMapper.props[count].transform.localPosition = pos;
}
private void ImportAnimation(string[] primaryClipsName, string[] primaryAudioClipsName, string customName, float volume, bool looping, bool sync, bool cantMove, bool thirdPerson)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
AnimationClip[] array = (AnimationClip[])(object)new AnimationClip[primaryClipsName.Length];
AudioClip[] array2 = (AudioClip[])(object)new AudioClip[primaryAudioClipsName.Length];
for (int i = 0; i < primaryClipsName.Length; i++)
{
array[i] = Assets.Load<AnimationClip>(primaryClipsName[i]);
array2[i] = Assets.Load<AudioClip>(primaryAudioClipsName[i]);
}
CustomEmoteParams val = new CustomEmoteParams();
val.displayName = customName;
val.primaryAnimationClips = array;
val.primaryAudioClips = array2;
val.lockType = (LockType)1;
val.audioLevel = volume;
val.syncAnim = sync;
val.syncAudio = sync;
val.audioLoops = looping;
val.willGetClaimedByDMCA = false;
val.stopWhenMove = cantMove;
val.thirdPerson = thirdPerson;
val.visible = true;
EmoteImporter.ImportEmote(val);
}
}
}
namespace SeregaPiratEmotesLoader
{
internal static class Assets
{
internal static readonly List<AssetBundle> AssetBundles = new List<AssetBundle>();
private static readonly Dictionary<string, int> AssetIndices = new Dictionary<string, int>();
internal static void LoadAssetBundlesFromFolder(string folderName)
{
folderName = Path.Combine(Path.GetDirectoryName(SeregaPiratEmotesMod.PInfo.Location), folderName);
string[] files = Directory.GetFiles(folderName);
foreach (string text in files)
{
AssetBundle val = AssetBundle.LoadFromFile(text);
int count = AssetBundles.Count;
AssetBundles.Add(val);
string[] allAssetNames = val.GetAllAssetNames();
foreach (string text2 in allAssetNames)
{
string text3 = text2.ToLowerInvariant();
if (text3.StartsWith("assets/"))
{
text3 = text3.Remove(0, "assets/".Length);
}
AssetIndices[text3] = count;
}
DebugClass.Log((object)("Loaded AssetBundle: " + Path.GetFileName(text)));
}
}
internal static T Load<T>(string assetName) where T : Object
{
try
{
assetName = assetName.ToLowerInvariant();
if (assetName.Contains(":"))
{
string[] array = assetName.Split(':');
assetName = array[1].ToLowerInvariant();
}
if (assetName.StartsWith("assets/"))
{
assetName = assetName.Remove(0, "assets/".Length);
}
int index = AssetIndices[assetName];
return AssetBundles[index].LoadAsset<T>("assets/" + assetName);
}
catch (Exception arg)
{
DebugClass.Log((object)$"Couldn't load asset [{assetName}] reason: {arg}");
return default(T);
}
}
}
}