using System;
using System.Collections;
using System.Diagnostics;
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 BepInEx.Bootstrap;
using BepInEx.Logging;
using EmotesAPI;
using HG.Reflection;
using RoR2.ContentManagement;
using TurboEdition;
using TurboEditionX.Modules;
using TurboEditionZ;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Turbo Edition X")]
[assembly: AssemblyDescription("Turbo Edition Xtra Mod X-Compat")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Turbo Edition X")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: AssemblyFileVersion("0.0.1")]
[assembly: OptIn]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
[module: UnverifiableCode]
namespace TurboEditionZ
{
public class TEXLog
{
public static ManualLogSource logger;
public static bool outputAlways;
public TEXLog(ManualLogSource logger_)
{
logger = logger_;
}
public static void LogD(object data, bool alwaysLog = false, [CallerLineNumber] int i = 0, [CallerMemberName] string member = "")
{
if (logger != null && (outputAlways || alwaysLog))
{
logger.LogDebug((object)logString(data, i, member));
}
}
public static void LogE(object data, bool alwaysLog = false, [CallerLineNumber] int i = 0, [CallerMemberName] string member = "")
{
if (logger != null && (outputAlways || alwaysLog))
{
logger.LogError((object)logString(data, i, member));
}
}
public static void LogF(object data, bool alwaysLog = false, [CallerLineNumber] int i = 0, [CallerMemberName] string member = "")
{
if (logger != null && (outputAlways || alwaysLog))
{
logger.LogFatal((object)logString(data, i, member));
}
}
public static void LogI(object data, bool alwaysLog = false, [CallerLineNumber] int i = 0, [CallerMemberName] string member = "")
{
if (logger != null && (outputAlways || alwaysLog))
{
logger.LogInfo((object)logString(data, i, member));
}
}
public static void LogM(object data, bool alwaysLog = false, [CallerLineNumber] int i = 0, [CallerMemberName] string member = "")
{
if (logger != null && (outputAlways || alwaysLog))
{
logger.LogMessage((object)logString(data, i, member));
}
}
public static void LogW(object data, bool alwaysLog = false, [CallerLineNumber] int i = 0, [CallerMemberName] string member = "")
{
if (logger != null && (outputAlways || alwaysLog))
{
logger.LogWarning((object)logString(data, i, member));
}
}
private static string logString(object data, [CallerLineNumber] int i = 0, [CallerMemberName] string member = "")
{
return $"{data} :: Line: {i}, Method {member}";
}
}
}
namespace TurboEditionX
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.Anreol.TurboEditionX", "TurboEditionX", "0.0.1")]
public class TurboEditionXUnityPlugin : BaseUnityPlugin
{
internal const string ModVer = "0.0.1";
internal const string ModIdentifier = "TurboEditionX";
internal const string ModGuid = "com.Anreol.TurboEditionX";
public static TurboEditionXUnityPlugin instance;
public static PluginInfo pluginInfo;
public void Awake()
{
pluginInfo = ((BaseUnityPlugin)this).Info;
new TEXLog(((BaseUnityPlugin)this).Logger);
TEXLog.outputAlways = true;
if (!Chainloader.PluginInfos.ContainsKey("com.Anreol.TurboEdition"))
{
Object.Destroy((Object)(object)this);
}
if (Chainloader.PluginInfos.ContainsKey("com.weliveinasociety.CustomEmotesAPI"))
{
EmoteSupport.Enable();
}
Chainloader.PluginInfos.ContainsKey("com.DestroyedClone.AncientScepter");
}
}
}
namespace TurboEditionX.Modules
{
public static class EmoteSupport
{
public static void Enable()
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected O, but got Unknown
Version version = new Version("2.2.4");
if (((BaseUnityPlugin)CustomEmotesAPI.instance).Info.Metadata.Version < version)
{
TEXLog.LogW($"Using a CustomEmotesAPI version lower than what TurboEditionX was made for! Issues might arise.\nExpected version: CustomEmotesAPI {version} or higher.", alwaysLog: false, 17, "Enable");
}
TEContent.onFinalizeAsync = (FinalizeAsyncDelegate)Delegate.Combine((Delegate?)(object)TEContent.onFinalizeAsync, (Delegate?)new FinalizeAsyncDelegate(SetupSkeletons));
}
private static IEnumerator SetupSkeletons(FinalizeAsyncArgs args)
{
TEXLog.LogW("Importing Grenadier's humanoid skeleton to CustomEmotesAPI...", alwaysLog: false, 24, "SetupSkeletons");
GameObject val = Assets.mainAssetBundle.LoadAsset<GameObject>("GrenadierHumanoidSkeleton");
if ((Object)(object)val == (Object)null)
{
TEXLog.LogE("Couldn't load Grenadier's humanoid skeleton. What went wrong?!", alwaysLog: false, 28, "SetupSkeletons");
}
else
{
CustomEmotesAPI.ImportArmature(Survivors.Grenadier.bodyPrefab, val, 0, true);
CustomEmotesAPI.CreateNameTokenSpritePair(Survivors.Grenadier.displayNameToken, Assets.mainAssetBundle.LoadAsset<Sprite>("texGrenadierUnlockIcon"));
CustomEmotesAPI.animChanged += new AnimationChanged(GrenadierAnimChanged);
}
yield return null;
}
private static void GrenadierAnimChanged(string newAnimation, BoneMapper mapper)
{
if (((Object)((Component)mapper).transform).name == "GrenadierHumanoidSkeleton")
{
ChildLocator component = ((Component)((Component)mapper).transform.parent).GetComponent<ChildLocator>();
if (newAnimation != "none")
{
((Component)component.FindChild("DemoGrenadeLauncherGrip")).gameObject.SetActive(false);
((Component)component.FindChild("DemoGrenadeLauncherCylinder")).gameObject.SetActive(false);
}
else
{
((Component)component.FindChild("DemoGrenadeLauncherGrip")).gameObject.SetActive(true);
((Component)component.FindChild("DemoGrenadeLauncherCylinder")).gameObject.SetActive(true);
}
}
}
}
}