Decompiled source of RoundValueInChat v1.0.1

BepInEx/Plugins/RoundValueInChat/RoundValueInChat.dll

Decompiled 2 weeks ago
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 RoundValueInChat.Patches;
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("RoundValueInChat")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RoundValueInChat")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("90f6f2c7-455d-4a94-807d-be70255ba28f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RoundValueInChat
{
	[BepInPlugin("Ryoryoman_RoundValueInChat", "RoundValueInChat", "1.0.0")]
	public class RoundValueInChatBase : BaseUnityPlugin
	{
		private const string modGUID = "Ryoryoman_RoundValueInChat";

		private const string modName = "RoundValueInChat";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Ryoryoman_RoundValueInChat");

		private static RoundValueInChatBase Instanse;

		public static ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instanse == (Object)null)
			{
				Instanse = this;
			}
			mls = Logger.CreateLogSource("Ryoryoman_RoundValueInChat");
			mls.LogInfo((object)"RoundValueInChat1.0.0loaded.");
			harmony.PatchAll(typeof(RoundValueInChatBase));
			harmony.PatchAll(typeof(RoundValueInChatPatch));
		}
	}
}
namespace RoundValueInChat.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class RoundValueInChatPatch
	{
		public static int previousRoundValue;

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void CheckBool()
		{
			if (!GameNetworkManager.Instance.isHostingGame)
			{
				RoundValueInChatBase.mls.LogInfo((object)"GameNetworkManager.Instance.isHostingGame is false");
			}
		}

		[HarmonyPatch("openingDoorsSequence")]
		[HarmonyPrefix]
		public static void MakeScrapList()
		{
			previousRoundValue = StartOfRound.Instance.GetValueOfAllScrap(true, false);
		}

		[HarmonyPatch("ShipHasLeft")]
		[HarmonyPostfix]
		public static void ChatRoundValuePatch()
		{
			int valueOfAllScrap = StartOfRound.Instance.GetValueOfAllScrap(false, true);
			if (RoundManager.Instance.currentLevel.sceneName != "CompanyBuilding")
			{
				int valueOfAllScrap2 = StartOfRound.Instance.GetValueOfAllScrap(true, true);
				if (!GameNetworkManager.Instance.isHostingGame)
				{
					valueOfAllScrap2 -= previousRoundValue;
					valueOfAllScrap -= previousRoundValue;
					HUDManager.Instance.AddTextToChatOnServer(string.Format("collectedScrap : " + valueOfAllScrap2 + " / " + valueOfAllScrap), -1);
				}
				else
				{
					HUDManager.Instance.AddTextToChatOnServer(string.Format("collectedScrap : " + valueOfAllScrap2 + " / " + valueOfAllScrap), -1);
				}
			}
			else
			{
				valueOfAllScrap = StartOfRound.Instance.GetValueOfAllScrap(false, false);
				HUDManager.Instance.AddTextToChatOnServer(string.Format("scrapSold : " + previousRoundValue + " -> " + valueOfAllScrap), -1);
			}
		}
	}
}