using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using LevelGeneration;
using Localization;
using LogUtils;
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("LongerCodes")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LongerCodes")]
[assembly: AssemblyTitle("LongerCodes")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
}
}
}
namespace LongerCodes
{
[BepInPlugin("com.Brandont.LongerCodes", "LongerCodes", "1.0.0")]
public class Loader : BasePlugin
{
public const string MODNAME = "LongerCodes";
public const string AUTHOR = "Brandont";
public const string GUID = "com.Brandont.LongerCodes";
public const string VERSION = "1.0.0";
public static ManualLogSource Logger;
public override void Load()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
Logger = ((BasePlugin)this).Log;
((BasePlugin)this).Log.LogMessage((object)"Loading LongerCodes");
Harmony val = new Harmony("LongerCodes");
val.PatchAll(typeof(SerialGeneratorPatch));
((BasePlugin)this).Log.LogMessage((object)"Loaded LongerCodes");
}
}
internal class SerialGeneratorPatch
{
public static LocalizedText StringToLocalized(string stringConvert)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
return new LocalizedText
{
Id = 0u,
UntranslatedText = stringConvert
};
}
[HarmonyPatch(typeof(TerminalUplinkPuzzle), "GetCodesString")]
[HarmonyPrefix]
private static bool ReturnNewString(ref string __result, TerminalUplinkPuzzleRound round, bool newLine = false)
{
string text = "\n";
for (int i = 0; i < ((Il2CppArrayBase<string>)(object)round.Codes).Length; i++)
{
text = text + "<color=orange>" + ((Il2CppArrayBase<string>)(object)round.Prefixes)[i] + "</color>:" + ((Il2CppArrayBase<string>)(object)round.Codes)[i];
if (i < ((Il2CppArrayBase<string>)(object)round.Codes).Length - 1)
{
text = (((i + 1) % 3 == 0) ? (text += "\n") : (text += " | "));
}
}
__result = text;
return false;
}
[HarmonyPatch(typeof(SerialGenerator), "Setup")]
[HarmonyPrefix]
private static void OverrideSerialGenerator()
{
SerialGenerator.m_codeWordPrefixes = Il2CppStringArray.op_Implicit(new string[84]
{
"A-01", "A-02", "A-03", "A-04", "A-05", "A-06", "A-07", "A-08", "A-09", "A-10",
"A-11", "A-12", "B-01", "B-02", "B-03", "B-04", "B-05", "B-06", "B-07", "B-08",
"B-09", "B-10", "B-11", "B-12", "C-01", "C-02", "C-03", "C-04", "C-05", "C-06",
"C-07", "C-08", "C-09", "C-10", "C-11", "C-12", "W-01", "W-02", "W-03", "W-04",
"W-05", "W-06", "W-07", "W-08", "W-09", "W-10", "W-11", "W-12", "X-01", "X-02",
"X-03", "X-04", "X-05", "X-06", "X-07", "X-08", "X-09", "X-10", "X-11", "X-12",
"Y-01", "Y-02", "Y-03", "Y-04", "Y-05", "Y-06", "Y-07", "Y-08", "Y-09", "Y-10",
"Y-11", "Y-12", "Z-01", "Z-02", "Z-03", "Z-04", "Z-05", "Z-06", "Z-07", "Z-08",
"Z-09", "Z-10", "Z-11", "Z-12"
});
SerialGenerator.m_codeWords = Il2CppStringArray.op_Implicit(new string[240]
{
"abacus", "abject", "ablaze", "abroad", "abrupt", "absorb", "abused", "accept", "access", "accuse",
"admire", "agreed", "alarms", "albeit", "alerts", "aligns", "beacon", "beaker", "beamed", "beaten",
"beauty", "bedlam", "before", "behind", "belfry", "bended", "berate", "beside", "bestir", "betide",
"bigger", "binged", "binned", "bisect", "bitten", "bladed", "blamed", "blazed", "blonde", "boated",
"bodily", "boiled", "bolted", "borrow", "bouncy", "choice", "choose", "chosen", "church", "circle",
"client", "closed", "closer", "coffee", "column", "combat", "coming", "common", "desert", "design",
"desire", "detail", "detect", "device", "differ", "dinner", "direct", "eighth", "either", "eleven",
"emerge", "empire", "employ", "enable", "ending", "energy", "engage", "engine", "enough", "ensure",
"entire", "entity", "finger", "finish", "fiscal", "flight", "flying", "follow", "forced", "forest",
"forget", "formal", "format", "former", "foster", "fought", "glowed", "gluten", "goggle", "gossip",
"graded", "grains", "grassy", "grater", "gravel", "grease", "greedy", "groove", "grudge", "guided",
"guitar", "gunner", "gurgle", "gabber", "harass", "hardly", "harmed", "hazard", "heated", "heaven",
"herbal", "hereby", "heroes", "herpes", "hinder", "hinged", "hissed", "hoarse", "instep", "inward",
"indent", "indium", "iodize", "infant", "influx", "jersey", "jetsam", "jigsaw", "jingle", "jogged",
"joiner", "joking", "jumble", "jumble", "jumped", "junker", "leader", "league", "leaves", "legacy",
"length", "lesson", "letter", "lights", "likely", "linked", "liquid", "listen", "little", "medium",
"member", "memory", "mental", "merely", "merger", "method", "middle", "miller", "mining", "minute",
"mirror", "mobile", "narrow", "nation", "native", "nature", "nearby", "nearly", "nights", "nobody",
"normal", "notice", "notion", "number", "packed", "palace", "parent", "partly", "patent", "people",
"period", "permit", "person", "phrase", "picked", "planet", "player", "raised", "random", "rarely",
"rather", "rating", "reader", "really", "reason", "recall", "recent", "sexual", "should", "signal",
"signed", "silent", "silver", "simple", "simply", "single", "sister", "slight", "smooth", "theory",
"thirty", "though", "threat", "thrown", "ticket", "timely", "timing", "tissue", "toward", "unique",
"useful", "vacant", "vacuum", "vigour", "walker", "wealth", "weekly", "weight", "winner", "winter"
});
}
[HarmonyPatch(typeof(SerialGenerator), "Setup")]
[HarmonyPostfix]
private static void IPV6Uplinks()
{
SerialGenerator.m_ips = Il2CppStringArray.op_Implicit(new string[99]);
for (int i = 0; i < ((Il2CppArrayBase<string>)(object)SerialGenerator.m_ips).Length; i++)
{
int num = 2001;
string text = ReturnRandomChar().ToString() + ReturnRandomChar() + Builder.SessionSeedRandom.Range(1, 9, "NO_TAG");
string text2 = Builder.SessionSeedRandom.Range(10, 99, "NO_TAG").ToString() + ReturnRandomChar() + Builder.SessionSeedRandom.Range(1, 9, "NO_TAG");
string text3 = Builder.SessionSeedRandom.Range(10, 99, "NO_TAG").ToString() + ReturnRandomChar() + ReturnRandomChar();
string text4 = ReturnRandomChar().ToString() + Builder.SessionSeedRandom.Range(10, 99, "NO_TAG");
((Il2CppArrayBase<string>)(object)SerialGenerator.m_ips)[i] = num + ":0:" + text + ":" + text2 + ":" + text3 + ":" + text4;
}
}
[HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "TerminalCorruptedUplinkConnect")]
[HarmonyPrefix]
private static bool NoUpperCase(LG_ComputerTerminalCommandInterpreter __instance, string param1, string param2)
{
if ((Object)(object)__instance.m_terminal.CorruptedUplinkReceiver == (Object)null)
{
DebugLog.LogPrefixError((Object)(object)__instance, "TerminalCorruptedUplinkConnect() critical failure because terminal does not have a CorruptedUplinkReceiver.");
return false;
}
if (LG_ComputerTerminalManager.OngoingUplinkConnectionTerminalId != 0 && LG_ComputerTerminalManager.OngoingUplinkConnectionTerminalId != __instance.m_terminal.SyncID)
{
__instance.AddOngoingUplinkOutput();
return false;
}
LG_ComputerTerminalManager.OngoingUplinkConnectionTerminalId = __instance.m_terminal.SyncID;
Debug.Log(Object.op_Implicit("TerminalCorruptedUplinkConnect, param1: " + param1 + " TerminalUplink: " + ((Object)__instance.m_terminal.UplinkPuzzle).ToString()));
if (param1 == __instance.m_terminal.UplinkPuzzle.TerminalUplinkIP)
{
if (__instance.m_terminal.CorruptedUplinkReceiver.m_command.HasRegisteredCommand((TERM_Command)27))
{
__instance.AddUplinkCorruptedOutput();
}
else
{
__instance.AddUplinkCorruptedOutput();
__instance.AddOutput("", true);
__instance.AddOutput((TerminalLineType)4, "Sending connection request to " + __instance.m_terminal.CorruptedUplinkReceiver.PublicName, 3f, (TerminalSoundType)0, (TerminalSoundType)0);
__instance.AddOutput((TerminalLineType)0, "Connection request sent. Waiting for confirmation.", 0.6f, (TerminalSoundType)0, (TerminalSoundType)0);
__instance.AddOutput("", true);
__instance.AddOutput((TerminalLineType)0, "Please <color=green>'CONFIRM'</color> connection on " + __instance.m_terminal.CorruptedUplinkReceiver.PublicName, 0.8f, (TerminalSoundType)0, (TerminalSoundType)0);
__instance.m_terminal.CorruptedUplinkReceiver.m_command.AddCommand((TERM_Command)27, "CONFIRM", StringToLocalized("Confirm an established Uplink connection with this terminal and another."), (TERM_CommandRule)2);
__instance.m_terminal.CorruptedUplinkReceiver.m_command.AddOutput((TerminalLineType)0, "Connection request from " + __instance.m_terminal.PublicName + ". Please type <color=green>CONFIRM</color> to continue.", 0f, (TerminalSoundType)0, (TerminalSoundType)0);
}
}
else
{
__instance.AddUplinkWrongAddressError(param1);
}
return false;
}
private static char ReturnRandomChar()
{
return Convert.ToChar(Builder.SessionSeedRandom.Range(97, 122, "NO_TAG"));
}
}
}