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 GTFO.API;
using GameData;
using Globals;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using LevelGeneration;
using Localization;
using LogUtils;
using Microsoft.CodeAnalysis;
using Player;
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("WackyUplinks")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WackyUplinks")]
[assembly: AssemblyTitle("WackyUplinks")]
[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 WackyUplinks
{
internal class CorruptUplinkPatch
{
public static string globalRandomInt;
public static TerminalLogFileData globalData;
public static LG_ComputerTerminal targetTerminal;
private static string GetCodesString(TerminalUplinkPuzzleRound round, bool newLine = false)
{
string text = "";
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 = ((!newLine || (i + 1) % 3 != 0) ? (text + " - ") : (text + "\n"));
}
}
return text;
}
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
};
}
private static TerminalLogFileData CreateRandomLogFile()
{
//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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
return new TerminalLogFileData
{
FileName = "Err://" + Builder.SessionSeedRandom.Range(10000, 99999, "NO_TAG") + "-" + Builder.SessionSeedRandom.Range(10000, 99999, "NO_TAG"),
FileContent = StringToLocalized("<color=red>Er4@r dOw7L0a/di^g fIl3</color>")
};
}
private static WardenObjectiveEventData CreateEventData(eWardenObjectiveEventType eventType, float delay, uint soundID, eLocalZoneIndex localIndex)
{
//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_0007: 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_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
return new WardenObjectiveEventData
{
Type = eventType,
Delay = delay,
SoundID = soundID,
LocalIndex = localIndex
};
}
[HarmonyPatch(typeof(TerminalUplinkPuzzle), "SendLogsToCorruptedUplinkReceiver")]
[HarmonyPrefix]
private static bool CorruptUplink(TerminalUplinkPuzzle __instance, int roundIndex)
{
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Expected O, but got Unknown
if ((Object)(object)__instance.m_terminal.CorruptedUplinkReceiver != (Object)null)
{
string codesString = GetCodesString(__instance.m_rounds[roundIndex], newLine: true);
string text = Builder.SessionSeedRandom.Range(100, 999, "NO_TAG") + "-" + Convert.ToChar(Builder.SessionSeedRandom.Range(65, 91, "NO_TAG")) + Builder.SessionSeedRandom.Range(100, 999, "NO_TAG");
int num = 100;
int num2 = Builder.SessionSeedRandom.Range(1, 6, "NO_TAG");
globalRandomInt = text;
TerminalLogFileData val = new TerminalLogFileData
{
FileName = "KDS-UPLINK-KEYS_" + (roundIndex + 1).ToString("D2") + ".LOG",
FileContent = StringToLocalized("-------------------------------------------\n" + codesString + "\n-------------------------------------------")
};
globalData = val;
__instance.m_terminal.AddLine((TerminalLineType)4, "UPLOADING UPLINK FILES TO <color=orange>KDS-CLOUD-STORAGE</color> AS LOG FILES USING ALPHA-NUMERICAL KEY: <color=orange>#" + text + "</color>", 2f);
__instance.m_terminal.CorruptedUplinkReceiver.AddLine((TerminalLineType)0, "Refer to the <color=orange><u>Terminal Command List</u></color> for more information..\n", 0f);
if (roundIndex > 0)
{
for (int i = 1; i < 6; i++)
{
__instance.m_terminal.CorruptedUplinkReceiver.m_command.m_commandsPerEnum.Remove((TERM_Command)(byte)(num + i + (roundIndex - 2) * 5));
}
__instance.m_terminal.CorruptedUplinkReceiver.RemoveLocalLog("KDS-UPLINK-KEYS_" + roundIndex.ToString("D2") + ".LOG");
}
for (int j = 1; j < 6; j++)
{
if (j != num2)
{
__instance.m_terminal.CorruptedUplinkReceiver.m_command.AddCommand((TERM_Command)(byte)(num + j + (roundIndex - 1) * 5), "DOWNLOAD_FILES_#" + Builder.SessionSeedRandom.Range(100, 999, "NO_TAG") + "-" + Convert.ToChar(Builder.SessionSeedRandom.Range(65, 91, "NO_TAG")) + Builder.SessionSeedRandom.Range(100, 999, "NO_TAG"), StringToLocalized("Download Files from KDS-CLOUD-STORAGE"), (TERM_CommandRule)1, new List<WardenObjectiveEventData>());
}
else
{
__instance.m_terminal.CorruptedUplinkReceiver.m_command.AddCommand((TERM_Command)(byte)(num + j + (roundIndex - 1) * 5), "DOWNLOAD_FILES_#" + text, StringToLocalized("Download Files from KDS-CLOUD-STORAGE"), (TERM_CommandRule)1, new List<WardenObjectiveEventData>());
}
}
return false;
}
DebugLog.LogPrefixError((Object)(object)__instance, __instance.m_terminal.PublicName + " tried to send log file to its CorruptedUplinkReceiver terminal, but it was null!");
return false;
}
[HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "EvaluateInput")]
[HarmonyPrefix]
private static void OverrideInputEvaluation(LG_ComputerTerminalCommandInterpreter __instance, string inputString)
{
if (__instance.m_terminal.IsObjectiveType((TERM_WO_Type)3))
{
if (inputString == "DOWNLOAD_FILES_#" + globalRandomInt || inputString == "DOWNLOAD_FILES_#" + globalRandomInt + " ")
{
__instance.m_terminal.AddLocalLog(globalData, true);
__instance.m_terminal.AddLine((TerminalLineType)4, "DOWNLOADING FILES FROM <color=orange>KDS-CLOUD-STORAGE</color> AS LOG FILES\nPLEASE WAIT..", 10f);
}
else if (inputString.Contains("DOWNLOAD_FILES_#"))
{
__instance.m_terminal.AddLocalLog(CreateRandomLogFile(), true);
__instance.m_terminal.AddLine((TerminalLineType)4, "DOWNLOADING FILES FROM <color=orange>KDS-CLOUD-STORAGE</color> AS LOG FILES\nPLEASE WAIT..", 10f);
}
}
}
}
[BepInPlugin("com.Brandont.WackyUplinks", "WackyUplinks", "1.0.0")]
public class Loader : BasePlugin
{
public const string MODNAME = "WackyUplinks";
public const string AUTHOR = "Brandont";
public const string GUID = "com.Brandont.WackyUplinks";
public const string VERSION = "1.0.0";
public static ManualLogSource Logger;
public override void Load()
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
ClassInjector.RegisterTypeInIl2Cpp<PowerTerminal>();
Logger = ((BasePlugin)this).Log;
((BasePlugin)this).Log.LogMessage((object)"Loading WackyUplinks");
EventAPI.OnManagersSetup += delegate
{
PowerTerminal @object = ((Component)Global.Current).gameObject.AddComponent<PowerTerminal>();
LevelAPI.OnEnterLevel += @object.LevelStarted;
LevelAPI.OnLevelCleanup += @object.LevelCleanup;
};
Harmony val = new Harmony("WackyUplinks");
val.PatchAll(typeof(CorruptUplinkPatch));
((BasePlugin)this).Log.LogMessage((object)"Loaded WackyUplinks");
}
}
internal class PowerTerminal : MonoBehaviour
{
public LG_ComputerTerminal targetTerminal;
private static WardenObjectiveEventData CreateEventData(eWardenObjectiveEventType eventType, float delay, uint soundID, eLocalZoneIndex localIndex)
{
//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_0007: 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_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Expected O, but got Unknown
return new WardenObjectiveEventData
{
Type = eventType,
Delay = delay,
SoundID = soundID,
LocalIndex = localIndex
};
}
public void Update()
{
if (Input.GetKeyDown((KeyCode)120))
{
Debug.Log((Object)(object)PlayerManager.GetLocalPlayerAgent().AnimatorBody.avatar);
PlayerManager.GetLocalPlayerAgent().AnimatorBody.avatar = AssetAPI.GetLoadedAsset<Avatar>("Assets/CustomGear/StrikerAvatar.asset");
}
}
public void LevelStarted()
{
List<WardenObjectiveEventData> val = new List<WardenObjectiveEventData>();
val.Add(CreateEventData((eWardenObjectiveEventType)3, 0f, 0u, (eLocalZoneIndex)0));
val.Add(CreateEventData((eWardenObjectiveEventType)5, 0f, 1479064690u, (eLocalZoneIndex)0));
val.Add(CreateEventData((eWardenObjectiveEventType)1, 0f, 0u, (eLocalZoneIndex)6));
val.Add(CreateEventData((eWardenObjectiveEventType)1, 0f, 0u, (eLocalZoneIndex)7));
val.Add(CreateEventData((eWardenObjectiveEventType)1, 0f, 0u, (eLocalZoneIndex)4));
val.Add(CreateEventData((eWardenObjectiveEventType)5, 0f, 495957738u, (eLocalZoneIndex)0));
val.Add(CreateEventData((eWardenObjectiveEventType)10, 0f, 0u, (eLocalZoneIndex)0));
CorruptUplinkPatch.targetTerminal = Builder.Current.m_currentFloor.MainDimension.Layers[0].m_zones[5].TerminalsSpawnedInZone[0];
CorruptUplinkPatch.targetTerminal.m_command.AddCommand((TERM_Command)100, "SHUTOFF_POWER", CorruptUplinkPatch.StringToLocalized("<color=red>WARNING: ALL DOORS WILL BE OPENED</color>"), (TERM_CommandRule)1, val);
}
public void LevelCleanup()
{
}
}
}