using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Microsoft.CodeAnalysis;
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(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("WorseHackingMiniGame")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WorseHackingMiniGame")]
[assembly: AssemblyTitle("WorseHackingMiniGame")]
[assembly: AssemblyVersion("1.0.0.0")]
[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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 WorseHackingMiniGame
{
internal static class Logger
{
private static readonly ManualLogSource _Logger;
static Logger()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
_Logger = new ManualLogSource("cactus.WorseHackingMiniGame");
Logger.Sources.Add((ILogSource)(object)_Logger);
}
private static string Format(object msg)
{
return msg.ToString();
}
public static void Info(BepInExInfoLogInterpolatedStringHandler handler)
{
_Logger.LogInfo(handler);
}
public static void Info(string str)
{
_Logger.LogMessage((object)str);
}
public static void Info(object data)
{
_Logger.LogMessage((object)Format(data));
}
public static void Debug(BepInExDebugLogInterpolatedStringHandler handler)
{
_Logger.LogDebug(handler);
}
public static void Debug(string str)
{
_Logger.LogDebug((object)str);
}
public static void Debug(object data)
{
_Logger.LogDebug((object)Format(data));
}
public static void Error(BepInExErrorLogInterpolatedStringHandler handler)
{
_Logger.LogError(handler);
}
public static void Error(string str)
{
_Logger.LogError((object)str);
}
public static void Error(object data)
{
_Logger.LogError((object)Format(data));
}
public static void Fatal(BepInExFatalLogInterpolatedStringHandler handler)
{
_Logger.LogFatal(handler);
}
public static void Fatal(string str)
{
_Logger.LogFatal((object)str);
}
public static void Fatal(object data)
{
_Logger.LogFatal((object)Format(data));
}
public static void Warn(BepInExWarningLogInterpolatedStringHandler handler)
{
_Logger.LogWarning(handler);
}
public static void Warn(string str)
{
_Logger.LogWarning((object)str);
}
public static void Warn(object data)
{
_Logger.LogWarning((object)Format(data));
}
[Conditional("DEBUG")]
public static void DebugOnly(object data)
{
_Logger.LogDebug((object)Format(data));
}
}
[BepInPlugin("cactus.WorseHackingMiniGame", "WorseHackingMiniGame", "1.0.0")]
public class Plugin : BasePlugin
{
public static ConfigFile configFile;
public static ConfigEntry<bool> normalMode;
public static ConfigEntry<bool> movingSolution;
public Harmony m_Harmony;
public override void Load()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Expected O, but got Unknown
ManualLogSource log = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(17, 0, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin is loaded!");
}
log.LogInfo(val);
m_Harmony = new Harmony("cactus.WorseHackingMiniGame");
GetConfig();
m_Harmony.PatchAll();
}
public static void GetConfig()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
configFile = new ConfigFile(Path.Combine(Paths.ConfigPath, "cactus.WorseHackingMiniGame.cfg"), true);
normalMode = configFile.Bind<bool>("General", "Normal Hacks", false, "Set to true to enable normal set of hacking patterns");
movingSolution = configFile.Bind<bool>("General", "Moving Solution", true, "Set to false to disable moving solution area");
HarmonyPatches.normalMode = normalMode.Value;
HarmonyPatches.movingSolution = movingSolution.Value;
}
}
[HarmonyPatch]
internal class HarmonyPatches
{
private static int outWidth;
private static Color outColor;
private static float moveDelayTimer;
private static int direction;
public static bool normalMode;
public static bool movingSolution;
[HarmonyPatch(typeof(HackingMinigame_TimingGrid), "SetupGame")]
[HarmonyPostfix]
internal static void Hacking__Postfix(HackingMinigame_TimingGrid __instance)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
if (!normalMode)
{
__instance.m_colSelectorRow = new Color(0.1f, 0.01f, 0.9f, 1f);
__instance.m_colSelectorRowActive = new Color(0.1f, 0.7f, 0.1f, 1f);
__instance.m_colLevel0 = new Color(0.69f, 0.55f, 0f, 0.1f);
__instance.m_colLevel1 = new Color(0.69f, 0.42f, 0f, 0.1f);
__instance.m_colLevel2 = new Color(0.69f, 0.31f, 0.01f, 1f);
}
}
[HarmonyPatch(typeof(HackingMinigame_TimingGrid), "SetupGame")]
[HarmonyPrefix]
internal static void Hacking__Prefix(HackingMinigame_TimingGrid __instance)
{
if (!normalMode)
{
__instance.m_gridSizeX = 80;
}
}
[HarmonyPatch(typeof(HackingMinigame_TimingGrid), "UpdateGame")]
[HarmonyPrefix]
internal static void UpdateGame__Prefix(HackingMinigame_TimingGrid __instance)
{
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
if (!normalMode)
{
__instance.m_scaleSpeedMulti = 2.5f;
__instance.m_moveTimerDelay = 0.019f;
__instance.m_moveOffUp = 0.06f;
}
if (!movingSolution)
{
return;
}
if (moveDelayTimer == 0f)
{
moveDelayTimer = Clock.Time + 0.1f;
}
if (Clock.Time >= moveDelayTimer)
{
if (__instance.m_selectorRowEnd >= __instance.m_gridSizeX)
{
direction = 1;
}
else if (__instance.m_selectorRowStart <= 0)
{
direction = 0;
}
if (direction == 0)
{
__instance.m_selectorRowStart += 1;
}
else if (direction == 1)
{
__instance.m_selectorRowStart -= 1;
}
moveDelayTimer = 0f;
}
__instance.m_selectorRowEnd = __instance.m_selectorRowStart + outWidth;
for (int i = 0; i < __instance.m_gridSizeX; i++)
{
for (int j = 0; j < __instance.m_gridSizeY; j++)
{
if (__instance.IsInSelectorRadius(i))
{
((Il2CppArrayBase<MinigameBlock>)(object)((Il2CppArrayBase<Il2CppReferenceArray<MinigameBlock>>)(object)__instance.m_blockGrid)[i])[j].SetColor(__instance.m_colSelectorRow);
}
else
{
((Il2CppArrayBase<MinigameBlock>)(object)((Il2CppArrayBase<Il2CppReferenceArray<MinigameBlock>>)(object)__instance.m_blockGrid)[i])[j].SetColor(outColor);
}
}
}
}
[HarmonyPatch(typeof(HackingMinigame_TimingGrid), "UpdateGame")]
[HarmonyPostfix]
internal static void UpdateGame__Postfix(HackingMinigame_TimingGrid __instance)
{
if (!normalMode && __instance.m_puzzleDone && __instance.m_puzzleLevel < 5)
{
__instance.m_puzzleDone = false;
__instance.SetPuzzleLevel(__instance.m_puzzleLevel + 1, 0.8f, true);
}
}
[HarmonyPatch(typeof(HackingMinigame_TimingGrid), "SetPuzzleLevel")]
[HarmonyPrefix]
internal static bool PuzzleLevel__Prefix(HackingMinigame_TimingGrid __instance, int level, float pauseDelay = 0.8f, bool setSelector = true)
{
//IL_006d: 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)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
if (normalMode)
{
return true;
}
Color val = default(Color);
((Color)(ref val))..ctor(0.69f, 0.21f, 0.01f, 1f);
Color val2 = default(Color);
((Color)(ref val2))..ctor(0.69f, 0.01f, 0.01f, 1f);
__instance.m_puzzleLevel = level;
switch (level)
{
case 1:
if (setSelector)
{
__instance.SetSelectorRows(__instance.GetBoostedWidth(12), __instance.m_colLevel0);
}
__instance.SetPuzzleTargetHeight(12f);
break;
case 2:
if (setSelector)
{
__instance.SetSelectorRows(__instance.GetBoostedWidth(9), __instance.m_colLevel1);
}
__instance.SetPuzzleTargetHeight(9f);
break;
case 3:
if (setSelector)
{
__instance.SetSelectorRows(__instance.GetBoostedWidth(6), __instance.m_colLevel2);
}
__instance.SetPuzzleTargetHeight(6f);
break;
case 4:
if (setSelector)
{
__instance.SetSelectorRows(__instance.GetBoostedWidth(3), val);
}
__instance.SetPuzzleTargetHeight(3f);
break;
case 5:
if (setSelector)
{
__instance.SetSelectorRows(__instance.GetBoostedWidth(1), val2);
}
__instance.SetPuzzleTargetHeight(1f);
break;
}
__instance.GamePauseTimer = Clock.Time + pauseDelay;
__instance.m_movingRow = 0;
__instance.m_movingDir = 1;
return false;
}
[HarmonyPatch(typeof(HackingMinigame_TimingGrid), "SetSelectorRows")]
[HarmonyPostfix]
internal static void MoveRows__Postfix(HackingMinigame_TimingGrid __instance, int width, Color colNeutral)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
outWidth = width;
outColor = colNeutral;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "WorseHackingMiniGame";
public const string PLUGIN_NAME = "WorseHackingMiniGame";
public const string PLUGIN_VERSION = "1.0.0";
}
}