Notice: Wrestling Empire is now using Steam Workshop for official mod support. This page is going to remain accessible, but it's likely the content is not going to be kept up to date.
Decompiled source of ContractEditor v1.0.1
plugins/ContractEditor.dll
Decompiled a year agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("ContractEditor")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ContractEditor")] [assembly: AssemblyTitle("ContractEditor")] [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] internal sealed class IsReadOnlyAttribute : Attribute { } [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 ContractEditor { [BepInPlugin("GeeEm.WrestlingEmpire.ContractEditor", "ContractEditor", "1.0.1")] [HarmonyPatch] public class Plugin : BaseUnityPlugin { public struct ContractStruct { public int? salary { get; set; } public int? weeks { get; set; } public int? clause { get; set; } public ContractStruct() { salary = null; weeks = null; clause = null; } } public const string PluginGuid = "GeeEm.WrestlingEmpire.ContractEditor"; public const string PluginName = "ContractEditor"; public const string PluginVer = "1.0.1"; internal static ManualLogSource Log; internal static readonly Harmony Harmony = new Harmony("GeeEm.WrestlingEmpire.ContractEditor"); internal static string PluginPath; public static ConfigEntry<KeyCode> loadContractButton; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; PluginPath = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); loadContractButton = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "Load custom contract", (KeyCode)269, "Button that loads the custom contract"); } private void OnEnable() { Harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded ContractEditor!"); } private void OnDisable() { Harmony.UnpatchSelf(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Unloaded ContractEditor!"); } private void Update() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (!Input.GetKeyDown(loadContractButton.Value)) { return; } Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "Select_Char") { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading custom contract."); try { LoadCard(); return; } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)"Error while loading custom contract: "); ((BaseUnityPlugin)this).Logger.LogError((object)ex); return; } finally { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Done loading custom contract."); } } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Didn't load, not in the character select menu."); } public void LoadCard() { ContractStruct contractStruct = new ContractStruct(); string[] array = File.ReadAllLines(Path.Combine(PluginPath, "CustomContract.txt")); string[] array2 = array; foreach (string text in array2) { if (text.Trim().Length != 0) { if (text.ToLower().StartsWith("salary:")) { contractStruct.salary = int.Parse(text.Substring(7).Trim()); } else if (text.ToLower().StartsWith("weeks:")) { contractStruct.weeks = int.Parse(text.Substring(6).Trim()); } else if (text.ToLower().StartsWith("clause:")) { contractStruct.clause = int.Parse(text.Substring(7).Trim()); } } } if (contractStruct.weeks.HasValue) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("setting weeks " + contractStruct.weeks)); Characters.c[Characters.foc].contract = contractStruct.weeks.Value; } if (contractStruct.salary.HasValue) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("setting salary " + contractStruct.salary)); Characters.c[Characters.foc].salary = contractStruct.salary.Value; } if (contractStruct.clause.HasValue) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("setting clause " + contractStruct.clause)); Characters.c[Characters.foc].clause = contractStruct.clause.Value; } } } }