Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of lethalinsurance v1.2.0
LethalInsurance.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using LethalInsurance.Patches; using LethalTerminalExtender.Patches; using Microsoft.CodeAnalysis; using Unity.Netcode; 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(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")] [assembly: AssemblyCompany("LethalInsurance")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("My first plugin")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0+38c54c789d38bb97e8a9d793fcb9448ad88665ff")] [assembly: AssemblyProduct("LethalInsurance")] [assembly: AssemblyTitle("LethalInsurance")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] internal class <Module> { static <Module>() { } } 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 LethalInsurance { [BepInPlugin("us.domkalan.lethalinsurance", "Lethal Insurance", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string GUID = "us.domkalan.lethalinsurance"; public const string NAME = "Lethal Insurance"; public const string VERSION = "1.1.0"; public static Plugin instance; private void Awake() { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown instance = this; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalInsurance is loaded!"); LethalInsurance.Patches.LethalInsurance.Register(); Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } Harmony val = new Harmony("us.domkalan.lethalinsurance"); val.PatchAll(Assembly.GetExecutingAssembly()); } public void Log(LogType type, string contents) { ((BaseUnityPlugin)this).Logger.LogInfo((object)contents); } } public static class PluginInfo { public const string PLUGIN_GUID = "LethalInsurance"; public const string PLUGIN_NAME = "LethalInsurance"; public const string PLUGIN_VERSION = "1.1.0"; } } namespace LethalInsurance.Patches { [Serializable] public struct LethalInsuranceCoverage : INetworkSerializable { public bool quotaCoverage; public bool scrapCoverage; public bool employeeCoverage; public bool equipmentCoverage; public LethalInsuranceCoverage() { quotaCoverage = false; scrapCoverage = false; employeeCoverage = false; equipmentCoverage = false; } public unsafe void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) ((BufferSerializer<bool>*)(&serializer))->SerializeValue<bool>(ref quotaCoverage, default(ForPrimitives)); ((BufferSerializer<bool>*)(&serializer))->SerializeValue<bool>(ref scrapCoverage, default(ForPrimitives)); ((BufferSerializer<bool>*)(&serializer))->SerializeValue<bool>(ref employeeCoverage, default(ForPrimitives)); ((BufferSerializer<bool>*)(&serializer))->SerializeValue<bool>(ref equipmentCoverage, default(ForPrimitives)); } } public static class LethalInsurance { private static TerminalCustomCommand rootCommand; private static string confirmText = "\n\nPlease CONFIRM or DENY.\n"; private static GameObject networkObject; public static LethalInsuranceCoverage currentCoverage; public static Terminal terminalInstace; public static Action<bool, string> coverageServerRetrun; public static void Register() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) currentCoverage = new LethalInsuranceCoverage(); rootCommand = TerminalExtenderUtils.addQuickCommand("insurance", "Insurance offers coverage plans to give employees peace of mind.\n\n>QUOTA\nReimbursement for when you return to the company but are short on quota.\n\n>QUIT\nQuits the insurance application\n\n", true, (Action<Terminal, TerminalNode>)delegate(Terminal term, TerminalNode node) { if ((Object)(object)terminalInstace == (Object)null) { terminalInstace = term; } listenForMenuInput(); }); } private static void parseCommand(string command) { switch (command) { case "quota": promptQuotaInsurance(); break; case "scrap": promptScrapInsurance(); break; case "employee": promptEmployeeInsurance(); break; case "equipment": promptEquipmentInsurance(); break; case "help": TerminalExtenderUtils.displayNodeOnTerminal(rootCommand.node); listenForMenuInput(); break; case "more": TerminalExtenderUtils.writeToTerminal("Additional Coverage\n\n>EQUIPMENT\nReplaces any equipment that an employee \"accidentally\" left behind at a job site.\n\n>COVERAGE\nView current coverage information.\n\n>HELP\nShows the basic information how to use the insurance application.\n\n", true); listenForMenuInput(); break; case "quit": TerminalExtenderUtils.releaseOnSubmit(); TerminalExtenderUtils.cleanTerminalScreen(); TerminalExtenderUtils.setInputState(true); TerminalExtenderUtils.writeToTerminal("Goodbye.\n\n", false); break; default: TerminalExtenderUtils.writeToTerminal("Invalid command, please use HELP for more info.\n", true); TerminalExtenderUtils.setInputState(true); TerminalExtenderUtils.playAudioClip(1); break; } } private static void listenForMenuInput() { TerminalExtenderUtils.setInputState(true); TerminalExtenderUtils.setOnSubmit((Action<string>)delegate(string command) { parseCommand(command); }); } private static void displayConfirmOrDeny(Action callback) { TerminalExtenderUtils.setInputState(true); TerminalExtenderUtils.setOnSubmit((Action<string>)delegate(string command) { switch (command) { default: if (!(command == "true")) { TerminalExtenderUtils.writeToTerminal("Cancelled order.\n", false); listenForMenuInput(); return; } break; case "c": case "confirm": case "conf": case "buy": case "yes": break; } callback(); }); } private static void purchaseOnServer(int coveragePlan) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) coverageServerRetrun = delegate(bool success, string message) { if (!success) { TerminalExtenderUtils.playAudioClip(1); } TerminalExtenderUtils.writeToTerminal(message, false); coverageServerRetrun = null; }; LethalInsurance_NetworkUtil.Instance.purchaseCoverageServerRPC(0); } private static void promptQuotaInsurance() { TerminalExtenderUtils.writeToTerminal("Quota Coverage\nReimbursement for when you return to the company but are short on quota.\n\nTERMS:\n* Reimbursement can only be paid out on day 0 at the company headquarters.\n* Coverage is single use but can be purchased again.\n* Must have met at least 70% of quota to qualify for reimbursement.\n* Coverage must be bought before day 1.\n* Coverage is not refundable.\n\nTotal cost of coverage: $" + (double)getQuotaCoverageCost() + "." + confirmText, true); displayConfirmOrDeny(delegate { purchaseOnServer(0); }); } private static void promptScrapInsurance() { TerminalExtenderUtils.writeToTerminal("Scrap Coverage\nReplaces all lost scrap value in the event all employees do not return to the ship.\n\nTERMS:\n* Coverage is single use and will need to be purchased again afterwards.\n* Coverage is not refundable.\n\nTotal cost of coverage: $800." + confirmText, true); displayConfirmOrDeny(delegate { TerminalExtenderUtils.playAudioClip(0); TerminalExtenderUtils.writeToTerminal("Scrap coverage has been purchased!\n", false); listenForMenuInput(); }); } private static void promptEmployeeInsurance() { TerminalExtenderUtils.writeToTerminal("Employee Coverage\nReplaces damaged equipment in the event an employee becomes worm food or equivalent.\n\nTERMS:\n* Coverage will last 4 cycles and can be purchased again afterwards.\n* Covered equipment is limited to:\n * Walkie Talkies\n * Flashlights\n * Jetpacks\n * Shotguns\n* Employee body must be 100% non recoverable.* Coverage is not refundable.\n\nTotal cost of coverage: $800." + confirmText, true); displayConfirmOrDeny(delegate { TerminalExtenderUtils.playAudioClip(0); TerminalExtenderUtils.writeToTerminal("Employee coverage has been purchased!\n", false); listenForMenuInput(); }); } private static void promptEquipmentInsurance() { TerminalExtenderUtils.writeToTerminal("Equipment Coverage\nReplaces equipment that is left behind at the job site.\n\nTERMS:\n* Covered equipment is limited to:\n * Ladders\n * Radars\n * Shotguns\n* Coverage is not refundable.\n\nTotal cost of coverage: $800." + confirmText, true); displayConfirmOrDeny(delegate { TerminalExtenderUtils.playAudioClip(0); TerminalExtenderUtils.writeToTerminal("Equipment coverage has been purchased!\n", false); listenForMenuInput(); }); } public static int getQuotaCoverageCost() { int daysUntilDeadline = TimeOfDay.Instance.daysUntilDeadline; int profitQuota = TimeOfDay.Instance.profitQuota; double value = Math.Floor((float)profitQuota * 0.2f); int num = Convert.ToInt32(value); int num2 = num + 150; if (daysUntilDeadline <= 2) { num2 += 50; } return num2; } public static bool chargeTerminalBalance(int balance) { if ((Object)(object)terminalInstace == (Object)null) { Terminal val = Object.FindObjectOfType<Terminal>(); if ((Object)(object)val == (Object)null) { throw new Exception("Could not find terminal object!"); } terminalInstace = val; } if (terminalInstace.groupCredits < balance) { return false; } Terminal obj = terminalInstace; obj.groupCredits -= balance; terminalInstace.SyncGroupCreditsClientRpc(terminalInstace.groupCredits, terminalInstace.numberOfItemsInDropship); terminalInstace.PlayTerminalAudioClientRpc(0); return true; } public static void handleNetworkManagerFetch(NetworkManager netMan) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown if (!((Object)(object)networkObject != (Object)null)) { Plugin.instance.Log((LogType)3, "HOOKED TO NETWORK MANAGER"); AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lethalinsurance")); GameObject val2 = (GameObject)val.LoadAsset("LethalInsuranceNetwork"); val2.AddComponent<LethalInsurance_NetworkUtil>(); NetworkManager.Singleton.AddNetworkPrefab(val2); networkObject = val2; } } public static void handleGameRoundStart() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) Plugin.instance.Log((LogType)3, "HOOKED TO GAME ROUND START"); if (NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost) { GameObject val = Object.Instantiate<GameObject>(networkObject, Vector3.zero, Quaternion.identity); val.GetComponent<NetworkObject>().Spawn(false); } } public static void handleClientPurcahseReturn(bool status, string message) { if (coverageServerRetrun != null) { coverageServerRetrun(status, message); } } public static void handleClientPurchaseCoverage(ulong clientId, int coverage) { int daysUntilDeadline = TimeOfDay.Instance.daysUntilDeadline; switch (coverage) { case 0: { if (currentCoverage.quotaCoverage) { returnClientPurchase(clientId, purchaseResult: false, "You already have coverage for missed quota!"); return; } if (daysUntilDeadline < 2) { returnClientPurchase(clientId, purchaseResult: false, "Quota coverage must be purchased before day 1."); return; } int quotaCoverageCost = getQuotaCoverageCost(); if (!chargeTerminalBalance(quotaCoverageCost)) { returnClientPurchase(clientId, purchaseResult: false, "You do not have enough credits for quota coverage."); return; } currentCoverage.quotaCoverage = true; returnClientPurchase(clientId, purchaseResult: true, "Quota coverage has been purchased."); LethalInsurance_NetworkUtil.Instance.showMessageClientRPC("Quota insurance has been purchased!", isWarning: false); break; } } LethalInsurance_NetworkUtil.Instance.syncCoverageClientRPC(currentCoverage); } public static void returnClientPurchase(ulong clientId, bool purchaseResult, string message = "") { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) ClientRpcParams val = default(ClientRpcParams); val.Send = new ClientRpcSendParams { TargetClientIds = new ulong[1] { clientId } }; ClientRpcParams clientRpcParams = val; LethalInsurance_NetworkUtil.Instance.purchaseResultClientRPC(purchaseResult, message, clientRpcParams); } public static void handleFired() { Plugin.instance.Log((LogType)3, "All insurance coverages have been reset"); currentCoverage = new LethalInsuranceCoverage(); LethalInsurance_NetworkUtil.Instance.syncCoverageClientRPC(currentCoverage); } public static void handleEndOfRoundEvent() { Plugin.instance.Log((LogType)3, "END OF ROUND EVENT FIRED"); int daysUntilDeadline = TimeOfDay.Instance.daysUntilDeadline; string sceneName = StartOfRound.Instance.currentLevel.sceneName; Plugin.instance.Log((LogType)3, "LevelName: " + sceneName + ", DaysLeft: " + daysUntilDeadline); if (daysUntilDeadline > 0 || !(sceneName == "CompanyBuilding")) { return; } int profitQuota = TimeOfDay.Instance.profitQuota; int quotaFulfilled = TimeOfDay.Instance.quotaFulfilled; Plugin.instance.Log((LogType)3, "quotaTarget: " + profitQuota + ", QuotaGathered: " + quotaFulfilled); bool flag = quotaFulfilled < profitQuota; Plugin.instance.Log((LogType)3, "ShortOnQuota: " + flag + ", insurancePurchased: " + currentCoverage.quotaCoverage); if (flag && !currentCoverage.quotaCoverage) { handleFired(); return; } double num = (double)quotaFulfilled / (double)profitQuota * 100.0; Plugin.instance.Log((LogType)3, "ShortOnQuotaPercent: " + num); if (num < 70.0) { LethalInsurance_NetworkUtil.Instance.showMessageClientRPC("You did not meet the 70% minimum for quota coverage. You were short by " + num, isWarning: true); handleFired(); return; } GameObject val = GameObject.Find("/Environment/HangarShip"); List<GrabbableObject> source = (from item in val.GetComponentsInChildren<GrabbableObject>() where item.itemProperties.isScrap && !item.itemUsedUp select item).ToList(); int num2 = source.Sum((GrabbableObject scrap) => scrap.scrapValue); Plugin.instance.Log((LogType)3, "ShipScrapValue: " + num2 + ", quotaMet: " + quotaFulfilled + ", quotaTarget: " + profitQuota); if (flag && num2 <= 0) { int num3 = profitQuota - quotaFulfilled + 10; EndOfGameStats gameStats = StartOfRound.Instance.gameStats; gameStats.scrapValueCollected += num3; TimeOfDay instance = TimeOfDay.Instance; instance.quotaFulfilled += num3; currentCoverage.quotaCoverage = false; LethalInsurance_NetworkUtil.Instance.showMessageClientRPC("Insurance coverage for missed quota has paid out to the company.", isWarning: true); } } public static void handleEndGameLevelPulled() { if (!currentCoverage.quotaCoverage) { return; } int daysUntilDeadline = TimeOfDay.Instance.daysUntilDeadline; string sceneName = StartOfRound.Instance.currentLevel.sceneName; if (daysUntilDeadline <= 0 && sceneName == "CompanyBuilding") { int profitQuota = TimeOfDay.Instance.profitQuota; int quotaFulfilled = TimeOfDay.Instance.quotaFulfilled; double num = (double)quotaFulfilled / (double)profitQuota * 100.0; if (num < 70.0) { HUDManager.Instance.DisplayTip("Lethal Insurance", "Insurance will not payout, you have not met the 70% requirement.", false, false, "LC_Tip1"); } } else if (daysUntilDeadline <= 0 && sceneName != "CompanyBuilding") { HUDManager.Instance.DisplayTip("Lethal Insurance", "Insurance will not payout, you are not at the company building.", false, false, "LC_Tip1"); } } } public class LethalInsurance_NetworkUtil : NetworkBehaviour { public static LethalInsurance_NetworkUtil Instance { get; private set; } public override void OnNetworkSpawn() { if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer) { LethalInsurance_NetworkUtil instance = Instance; if (instance != null) { ((Component)instance).gameObject.GetComponent<NetworkObject>().Despawn(true); } } Instance = this; ((NetworkBehaviour)this).OnNetworkSpawn(); } [ServerRpc(RequireOwnership = false)] public void purchaseCoverageServerRPC(int coverage, ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(357156751u, serverRpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, coverage); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 357156751u, serverRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId)) { LethalInsurance.handleClientPurchaseCoverage(senderClientId, coverage); } } } [ClientRpc] public void syncCoverageClientRPC(LethalInsuranceCoverage coverage) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2598740894u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<LethalInsuranceCoverage>(ref coverage, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2598740894u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { LethalInsurance.currentCoverage = coverage; } } } [ClientRpc] public void showMessageClientRPC(string message, bool isWarning) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2774042143u, val, (RpcDelivery)0); bool flag = message != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(message, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isWarning, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2774042143u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { HUDManager.Instance.DisplayTip("Lethal Insurance", message, isWarning, false, "LC_Tip1"); } } [ClientRpc] public void showChatMessageClientRPC(string message) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2076360822u, val, (RpcDelivery)0); bool flag = message != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(message, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2076360822u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { HUDManager.Instance.AddChatMessage(message, "Insurance"); } } [ClientRpc] public void purchaseResultClientRPC(bool success, string message, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(961667302u, clientRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref success, default(ForPrimitives)); bool flag = message != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(message, false); } ((NetworkBehaviour)this).__endSendClientRpc(ref val, 961667302u, clientRpcParams, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { LethalInsurance.handleClientPurcahseReturn(success, message); } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_LethalInsurance_NetworkUtil() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(357156751u, new RpcReceiveHandler(__rpc_handler_357156751)); NetworkManager.__rpc_func_table.Add(2598740894u, new RpcReceiveHandler(__rpc_handler_2598740894)); NetworkManager.__rpc_func_table.Add(2774042143u, new RpcReceiveHandler(__rpc_handler_2774042143)); NetworkManager.__rpc_func_table.Add(2076360822u, new RpcReceiveHandler(__rpc_handler_2076360822)); NetworkManager.__rpc_func_table.Add(961667302u, new RpcReceiveHandler(__rpc_handler_961667302)); } private static void __rpc_handler_357156751(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int coverage = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref coverage); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((LethalInsurance_NetworkUtil)(object)target).purchaseCoverageServerRPC(coverage, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2598740894(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { LethalInsuranceCoverage coverage = default(LethalInsuranceCoverage); ((FastBufferReader)(ref reader)).ReadValueSafe<LethalInsuranceCoverage>(ref coverage, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)2; ((LethalInsurance_NetworkUtil)(object)target).syncCoverageClientRPC(coverage); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2774042143(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string message = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref message, false); } bool isWarning = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isWarning, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((LethalInsurance_NetworkUtil)(object)target).showMessageClientRPC(message, isWarning); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2076360822(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string message = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref message, false); } target.__rpc_exec_stage = (__RpcExecStage)2; ((LethalInsurance_NetworkUtil)(object)target).showChatMessageClientRPC(message); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_961667302(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool success = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref success, default(ForPrimitives)); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string message = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref message, false); } ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)2; ((LethalInsurance_NetworkUtil)(object)target).purchaseResultClientRPC(success, message, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "LethalInsurance_NetworkUtil"; } } [HarmonyPatch] public class LethalInsurance_Patches { [HarmonyPrefix] [HarmonyPatch(typeof(GameNetworkManager), "Start")] private static void RunNetworkHook(GameNetworkManager __instance) { NetworkManager component = ((Component)__instance).gameObject.GetComponent<NetworkManager>(); LethalInsurance.handleNetworkManagerFetch(component); } [HarmonyPrefix] [HarmonyPatch(typeof(StartOfRound), "EndGameServerRpc")] private static void RunEndGameHook(StartOfRound __instance) { LethalInsurance.handleEndOfRoundEvent(); } [HarmonyPrefix] [HarmonyPatch(typeof(StartOfRound), "Awake")] private static void RunGameAwake(StartOfRound __instance) { LethalInsurance.handleGameRoundStart(); } [HarmonyPrefix] [HarmonyPatch(typeof(StartMatchLever), "EndGame")] private static void PulledEndGameLevel() { LethalInsurance.handleEndGameLevelPulled(); } } }