using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Colossal.Logging;
using Game;
using Game.Common;
using Game.Modding;
using Game.Tools;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Entities;
using UnityEngine.InputSystem;
[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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Become_Ungovernable")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Toggle your ungovernability using Ctrl + U")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Become_Ungovernable")]
[assembly: AssemblyTitle("Become_Ungovernable")]
[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]
[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 Become_Ungovernable
{
public sealed class Mod : IMod
{
public const string ModName = "Become Ungovernable";
public static Mod Instance { get; private set; }
internal ILog Log { get; private set; }
public void OnCreateWorld(UpdateSystem updateSystem)
{
updateSystem.UpdateAfter<UngovernableSystem>((SystemUpdatePhase)22);
Log.Info((object)"OnCreateWorld for BecomeUngovernable");
}
public void OnDispose()
{
Instance = null;
}
public void OnLoad()
{
Instance = this;
Log = LogManager.GetLogger("Become Ungovernable", true);
Log.Info((object)"setting logging level to Debug");
Log.effectivenessLevel = Level.Debug;
Log.Info((object)"loading");
}
}
[BepInPlugin("Become_Ungovernable", "Become_Ungovernable", "1.0.0")]
[HarmonyPatch]
public class Plugin : BaseUnityPlugin
{
private Mod _mod;
private void Awake()
{
_mod = new Mod();
_mod.OnLoad();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Become_Ungovernable is loaded!");
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Become_Ungovernable");
}
[HarmonyPatch(typeof(SystemOrder), "Initialize")]
[HarmonyPostfix]
private static void InjectSystems(UpdateSystem updateSystem)
{
Mod.Instance.OnCreateWorld(updateSystem);
}
}
public class UngovernableSystem : GameSystemBase
{
protected override void OnCreate()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
//IL_0020: 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_0034: 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_0048: Unknown result type (might be due to invalid IL or missing references)
((GameSystemBase)this).OnCreate();
InputAction val = new InputAction("BecomeUngovernable-Hotkey", (InputActionType)0, (string)null, (string)null, (string)null, (string)null);
CompositeSyntax val2 = InputActionSetupExtensions.AddCompositeBinding(val, "ButtonWithOneModifier", (string)null, (string)null);
val2 = ((CompositeSyntax)(ref val2)).With("Modifier", "<Keyboard>/ctrl", (string)null, (string)null);
((CompositeSyntax)(ref val2)).With("Button", "<Keyboard>/u", (string)null, (string)null);
val.performed += BecomeUngovernable;
val.Enable();
}
protected override void OnUpdate()
{
}
private void BecomeUngovernable(CallbackContext context)
{
ToolSystem orCreateSystemManaged = ((ComponentSystemBase)this).World.GetOrCreateSystemManaged<ToolSystem>();
orCreateSystemManaged.ignoreErrors = !orCreateSystemManaged.ignoreErrors;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Become_Ungovernable";
public const string PLUGIN_NAME = "Become_Ungovernable";
public const string PLUGIN_VERSION = "1.0.0";
}
}