using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using MCMP_Patch.Patches;
using TooManyEmotes;
using TooManyEmotes.Networking;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("MCMP_Patch")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MCMP_Patch")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8a2b7984-d984-496c-b2dd-30d38fee4b73")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MCMP_Patch
{
internal class CustomLogging
{
private static ManualLogSource logger;
public static void InitLogger()
{
try
{
logger = Logger.CreateLogSource($"{((BaseUnityPlugin)Plugin.instance).Info.Metadata.Name}-{((BaseUnityPlugin)Plugin.instance).Info.Metadata.Version}");
}
catch
{
logger = Plugin.defaultLogger;
}
}
public static void Log(string message)
{
logger.LogInfo((object)message);
}
public static void LogError(string message)
{
logger.LogError((object)message);
}
public static void LogWarning(string message)
{
logger.LogWarning((object)message);
}
public static bool Assert(bool condition, string failMessage)
{
if (!condition)
{
LogWarning(failMessage);
}
return condition;
}
}
internal static class HelperTools
{
public static void AddChatMessage(string text)
{
HUDManager.Instance.AddTextToChatOnServer(text, -1);
}
}
[BepInPlugin("Vijuhas.MCMP_Patch", "MCMP_Patch", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony harmony = new Harmony("Vijuhas.MCMP_Patch");
public static Plugin instance;
public static ManualLogSource defaultLogger => ((BaseUnityPlugin)instance).Logger;
private void Awake()
{
if ((Object)(object)instance == (Object)null)
{
instance = this;
}
CustomLogging.InitLogger();
harmony.PatchAll(typeof(Plugin));
harmony.PatchAll(typeof(DominoPatch));
CustomLogging.Log("Vijuhas.MCMP_Patch has loaded successfully.");
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "Vijuhas.MCMP_Patch";
public const string PLUGIN_NAME = "MCMP_Patch";
public const string PLUGIN_VERSION = "1.0.2";
}
}
namespace MCMP_Patch.Patches
{
[HarmonyPatch(typeof(Terminal), "RunTerminalEvents")]
internal class InfiniteCreditsPatch
{
[HarmonyPostfix]
private static void Postfix(ref int ___groupCredits)
{
___groupCredits = 69420;
}
}
[HarmonyPatch(typeof(StartOfRound), "UnlockShipObject")]
internal class DominoPatch
{
private static readonly string emoteID = "dancin'_domino";
private static readonly int inverseTpUnlockableID = 19;
[HarmonyPostfix]
private static void Postfix(ref int unlockableID)
{
if (unlockableID != inverseTpUnlockableID)
{
return;
}
UnlockableEmote val = EmotesManager.allUnlockableEmotesDict[emoteID];
if (!SessionManager.IsEmoteUnlocked(val, ""))
{
if (!ConfigSync.instance.syncShareEverything)
{
SessionManager.UnlockEmoteLocal(val, false, "");
}
SyncManager.SendOnUnlockEmoteUpdate(val.emoteId, -1);
HelperTools.AddChatMessage("Domino emote unlocked!");
CustomLogging.Log("Inverse TP purchased: domino emote unlocked.");
}
}
}
}