

using System;
using System.CodeDom.Compiler;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using CellMenu;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("AwesomePluginForRacc")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AwesomePluginForRacc")]
[assembly: AssemblyTitle("AwesomePluginForRacc")]
[assembly: TargetPlatform("Windows7.0")]
[assembly: SupportedOSPlatform("Windows7.0")]
[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 AwesomePluginForRacc
{
[BepInPlugin("AwesomePluginForRacc.GUID", "AwesomePluginForRacc", "1.0.0")]
internal class EntryPoint : BasePlugin
{
private Harmony _Harmony;
public override void Load()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
_Harmony = new Harmony("AwesomePluginForRacc.Harmony");
_Harmony.PatchAll(typeof(Patch));
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(32, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin has loaded with ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_Harmony.GetPatchedMethods().Count());
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" patches!");
}
Logger.Info(val);
}
public override bool Unload()
{
_Harmony.UnpatchSelf();
return ((BasePlugin)this).Unload();
}
}
internal static class Logger
{
private static readonly ManualLogSource _Logger;
static Logger()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Expected O, but got Unknown
_Logger = new ManualLogSource("AwesomePluginForRacc");
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)
{
}
}
internal class Patch
{
internal static GameObject customText;
[HarmonyPatch(typeof(CM_PageExpeditionSuccess), "OnEnable")]
public static void Postfix(CM_PageExpeditionSuccess __instance)
{
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
Logger.Info("Doing shit");
if ((Object)(object)((Component)__instance.m_header).gameObject == (Object)null)
{
Logger.Error("This shit should not be null WHYYYYYY");
}
if ((Object)(object)customText == (Object)null)
{
customText = Object.Instantiate<GameObject>(((Component)__instance.m_header).gameObject, __instance.m_header.transform.GetParent());
}
((Object)customText).name = "Based";
((Behaviour)customText.GetComponent<TMP_Localizer>()).enabled = false;
customText.transform.localPosition = new Vector3(700f, 600f, -10f);
((TMP_Text)customText.GetComponent<TextMeshPro>()).fontSizeMax = 76.8f;
((TMP_Text)customText.GetComponent<TextMeshPro>()).text = "INTRUDER :)";
((Graphic)customText.GetComponent<TextMeshPro>()).color = new Color(0f, 0.15f, 1f, 1f);
}
}
[GeneratedCode("VersionInfoGenerator", "2.1.3+git35c0c2a-master")]
[CompilerGenerated]
internal static class VersionInfo
{
public const string RootNamespace = "AwesomePluginForRacc";
public const string Version = "1.0.0";
public const string VersionPrerelease = null;
public const string VersionMetadata = null;
public const string SemVer = "1.0.0";
public const string GitRevShort = null;
public const string GitRevLong = null;
public const string GitBranch = null;
public const string GitTag = null;
public const int GitCommitsSinceTag = 0;
public const bool GitIsDirty = false;
}
}using System;
using System.CodeDom.Compiler;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
[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("Intruder")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Intruder")]
[assembly: AssemblyTitle("Intruder")]
[assembly: TargetPlatform("Windows7.0")]
[assembly: SupportedOSPlatform("Windows7.0")]
[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 Intruder
{
[BepInPlugin("Intruder.GUID", "Intruder", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal class EntryPoint : BasePlugin
{
private Harmony _Harmony = null;
public override void Load()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
_Harmony = new Harmony("Intruder.Harmony");
_Harmony.PatchAll();
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(32, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin has loaded with ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_Harmony.GetPatchedMethods().Count());
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" patches!");
}
Logger.Info(val);
}
public override bool Unload()
{
_Harmony.UnpatchSelf();
return ((BasePlugin)this).Unload();
}
}
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("Intruder");
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));
}
}
[HarmonyPatch(typeof(PUI_Watermark), "UpdateWatermark")]
public class Watermark
{
public static void Postfix(PUI_Watermark __instance)
{
string text = "4.6.2+gitf831086-dirty-main".Remove("x.x.x".Length);
((TMP_Text)__instance.m_watermarkText).SetText("<color=red>MODDED</color> <color=orange>" + text + "</color>\n" + string.Empty + "<color=#26d9d9>INTRUDER</color><color=white>:</color> <color=#26d9d9>PROTOCOL</color> <color=white>(</color><color=#26d9d9>Racc</color><color=white>)</color>", true);
}
}
[GeneratedCode("VersionInfoGenerator", "2.1.3+git35c0c2a-master")]
[CompilerGenerated]
internal static class VersionInfo
{
public const string RootNamespace = "Intruder";
public const string Version = "1.0.0";
public const string VersionPrerelease = null;
public const string VersionMetadata = null;
public const string SemVer = "1.0.0";
public const string GitRevShort = null;
public const string GitRevLong = null;
public const string GitBranch = null;
public const string GitTag = null;
public const int GitCommitsSinceTag = 0;
public const bool GitIsDirty = false;
}
}using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AIGraph;
using Agents;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using EOSExt.DimensionWarp.Definition;
using ExtraObjectiveSetup.BaseClasses;
using ExtraObjectiveSetup.ExtendedWardenEvents;
using ExtraObjectiveSetup.Utils;
using GameData;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppSystem.Collections.Generic;
using LevelGeneration;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Inas07.EOSExt.DimensionWarp")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Inas07.EOSExt.DimensionWarp")]
[assembly: AssemblyTitle("Inas07.EOSExt.DimensionWarp")]
[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 EOSExt.DimensionWarp
{
public class DimensionWarpManager : GenericExpeditionDefinitionManager<DimensionWarpDefinition>
{
public enum WardenEvents_Warp
{
WarpTeam = 160,
WarpRange,
WarpItemsInZone
}
private readonly ImmutableList<Vector3> lookDirs = new List<Vector3>
{
Vector3.forward,
Vector3.back,
Vector3.left,
Vector3.right
}.ToImmutableList();
public static DimensionWarpManager Current { get; private set; }
protected override string DEFINITION_NAME => "DimensionWarp";
public AIG_NodeCluster GetNodeFromDimensionPosition(eDimensionIndex dimensionIndex, Vector3 position)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: 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)
AIG_GeomorphNodeVolume val = default(AIG_GeomorphNodeVolume);
AIG_VoxelNodePillar val2 = default(AIG_VoxelNodePillar);
AIG_INode val3 = default(AIG_INode);
AIG_NodeCluster result = default(AIG_NodeCluster);
if (!AIG_GeomorphNodeVolume.TryGetGeomorphVolume(0, dimensionIndex, position, ref val) || !((AIG_NodeVolume)val).m_voxelNodeVolume.TryGetPillar(position, ref val2) || !val2.TryGetVoxelNode(position.y, ref val3) || !AIG_NodeCluster.TryGetNodeCluster(val3.ClusterID, ref result))
{
EOSLogger.Error("GetNodeFromDimensionPosition: Position is not valid, try again inside an area.");
return null;
}
return result;
}
public DimensionWarpDefinition GetWarpDefinition(string worldEventObjectFilter)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Invalid comparison between Unknown and I4
if ((int)GameStateManager.CurrentStateName != 10 || !base.definitions.ContainsKey(RundownManager.ActiveExpedition.LevelLayoutData))
{
EOSLogger.Error($"GetWarpPositions: Didn't find config with MainLevelLayout {RundownManager.ActiveExpedition.LevelLayoutData}");
return null;
}
DimensionWarpDefinition dimensionWarpDefinition = base.definitions[RundownManager.ActiveExpedition.LevelLayoutData].Definitions.Find((DimensionWarpDefinition def) => def.WorldEventObjectFilter == worldEventObjectFilter);
if (dimensionWarpDefinition == null)
{
EOSLogger.Error($"GetWarpPositions: Didn't find config for {worldEventObjectFilter} with MainLevelLayout {RundownManager.ActiveExpedition.LevelLayoutData}");
return new DimensionWarpDefinition();
}
return dimensionWarpDefinition;
}
public void WarpItem(ItemInLevel item, eDimensionIndex warpToDim, Vector3 warpToPosition)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Invalid comparison between Unknown and I4
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: 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_003a: Unknown result type (might be due to invalid IL or missing references)
if (SNet.IsMaster && (int)GameStateManager.CurrentStateName == 10 && (Object)(object)item != (Object)null)
{
AIG_NodeCluster nodeFromDimensionPosition = GetNodeFromDimensionPosition(warpToDim, warpToPosition);
if (nodeFromDimensionPosition != null)
{
item.GetSyncComponent().AttemptPickupInteraction((ePickupItemInteractionType)1, (SNet_Player)null, ((Item)item).pItemData.custom, warpToPosition, Quaternion.identity, nodeFromDimensionPosition.CourseNode, true, true);
}
else
{
EOSLogger.Error("WarpTeam: cannot find course node for item to warp");
}
}
}
public void WarpItemsInZone(eDimensionIndex dimensionIndex, LG_LayerType layer, eLocalZoneIndex localIndex, string worldEventObjectFilter)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Invalid comparison between Unknown and I4
//IL_00a3: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
if (!SNet.IsMaster || (int)GameStateManager.CurrentStateName != 10)
{
return;
}
if ((Object)(object)PlayerManager.GetLocalPlayerAgent() == (Object)null)
{
EOSLogger.Error("WarpItemsInZone: master - LocalPlayerAgent is null???");
return;
}
DimensionWarpDefinition warpDefinition = GetWarpDefinition(worldEventObjectFilter);
if (warpDefinition == null)
{
EOSLogger.Error("WarpItemsInZone: worldEventObjectFilter '" + worldEventObjectFilter + "' is not defined");
return;
}
List<PositionAndLookDir> locations = warpDefinition.Locations;
if (locations.Count < 1)
{
EOSLogger.Error("WarpItemsInZone: no warp position found");
return;
}
int num = 0;
Enumerator<IWarpableObject> enumerator = Dimension.WarpableObjects.GetEnumerator();
while (enumerator.MoveNext())
{
ItemInLevel val = ((Il2CppObjectBase)enumerator.Current).TryCast<ItemInLevel>();
if ((Object)(object)val != (Object)null)
{
AIG_CourseNode courseNode = val.CourseNode;
if (val.internalSync.GetCurrentState().placement.droppedOnFloor && courseNode.m_dimension.DimensionIndex == dimensionIndex && courseNode.LayerType == layer && courseNode.m_zone.LocalIndex == localIndex && (!warpDefinition.OnWarp.WarpItemsInZone_OnlyWarpWarpable || val.CanWarp))
{
Vector3 warpToPosition = locations[num].Position.ToVector3();
WarpItem(val, dimensionIndex, warpToPosition);
}
num = (num + 1) % locations.Count;
}
}
}
internal void WarpItemsInZone(WardenObjectiveEventData e)
{
//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_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: 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)
//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)
eDimensionIndex dimensionIndex = e.DimensionIndex;
LG_LayerType layer = e.Layer;
eLocalZoneIndex localIndex = e.LocalIndex;
string worldEventObjectFilter = e.WorldEventObjectFilter;
WarpItemsInZone(dimensionIndex, layer, localIndex, worldEventObjectFilter);
}
public void WarpRange(Vector3 rangeOrigin, float range, string worldEventObjectFilter)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: 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_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
if ((int)GameStateManager.CurrentStateName != 10)
{
return;
}
PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
if ((Object)(object)localPlayerAgent == (Object)null)
{
EOSLogger.Error("WarpTeam: LocalPlayerAgent is null");
return;
}
DimensionWarpDefinition warpDefinition = GetWarpDefinition(worldEventObjectFilter);
if (warpDefinition == null)
{
EOSLogger.Error("WarpItemsInZone: worldEventObjectFilter '" + worldEventObjectFilter + "' is not defined");
return;
}
List<PositionAndLookDir> locations = warpDefinition.Locations;
if (locations.Count < 1)
{
EOSLogger.Error("WarpAlivePlayersInRange: no warp locations found");
return;
}
int index = localPlayerAgent.PlayerSlotIndex % locations.Count;
Vector3 val = locations[index].Position.ToVector3();
int index2 = locations[index].LookDir % lookDirs.Count;
Vector3 val2 = lookDirs[index2];
int num = 0;
List<SentryGunInstance> list = new List<SentryGunInstance>();
Enumerator<IWarpableObject> enumerator = Dimension.WarpableObjects.GetEnumerator();
Vector3 val4;
while (enumerator.MoveNext())
{
IWarpableObject current = enumerator.Current;
SentryGunInstance val3 = ((Il2CppObjectBase)current).TryCast<SentryGunInstance>();
if ((Object)(object)val3 != (Object)null)
{
if (!((ItemEquippable)val3).LocallyPlaced || !((Agent)((Item)val3).Owner).Alive)
{
continue;
}
val4 = rangeOrigin - ((Agent)((Item)val3).Owner).Position;
if (((Vector3)(ref val4)).magnitude < range)
{
val4 = rangeOrigin - ((Component)val3).transform.position;
if (((Vector3)(ref val4)).magnitude < range || warpDefinition.OnWarp.WarpRange_WarpDeployedSentryOutsideRange)
{
list.Add(val3);
}
}
}
else
{
if (!SNet.IsMaster)
{
continue;
}
ItemInLevel val5 = ((Il2CppObjectBase)current).TryCast<ItemInLevel>();
if ((Object)(object)val5 != (Object)null)
{
val4 = ((Component)val5).transform.position - rangeOrigin;
if (((Vector3)(ref val4)).magnitude < range)
{
Vector3 warpToPosition = locations[num].Position.ToVector3();
WarpItem(val5, warpDefinition.DimensionIndex, warpToPosition);
num = (num + 1) % locations.Count;
}
}
}
}
list.ForEach(delegate(SentryGunInstance sentryGun)
{
sentryGun.m_sync.WantItemAction(((Item)sentryGun).Owner, (SyncedItemAction_New)0);
});
if (((Agent)localPlayerAgent).Alive)
{
val4 = rangeOrigin - ((Agent)localPlayerAgent).Position;
if (((Vector3)(ref val4)).magnitude < range && !localPlayerAgent.TryWarpTo(warpDefinition.DimensionIndex, val, val2, true))
{
EOSLogger.Error($"WarpAlivePlayersInRange: TryWarpTo failed, Position: {val}");
}
}
}
internal void WarpRange(WardenObjectiveEventData e)
{
//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_0016: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = e.Position;
float fogTransitionDuration = e.FogTransitionDuration;
string worldEventObjectFilter = e.WorldEventObjectFilter;
WarpRange(position, fogTransitionDuration, worldEventObjectFilter);
}
public void WarpTeam(string worldEventObjectFilter)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: 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_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
if ((int)GameStateManager.CurrentStateName != 10)
{
return;
}
PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
if ((Object)(object)localPlayerAgent == (Object)null)
{
EOSLogger.Error("WarpTeam: LocalPlayerAgent is null");
return;
}
DimensionWarpDefinition warpDefinition = GetWarpDefinition(worldEventObjectFilter);
if (warpDefinition == null)
{
EOSLogger.Error("WarpTeam: worldEventObjectFilter '" + worldEventObjectFilter + "' is not defined");
return;
}
List<PositionAndLookDir> locations = warpDefinition.Locations;
if (locations.Count < 1)
{
EOSLogger.Error("WarpTeam: no warp locations found");
return;
}
int num = localPlayerAgent.PlayerSlotIndex % locations.Count;
Vector3 val = locations[num].Position.ToVector3();
int index = locations[num].LookDir % lookDirs.Count;
Vector3 val2 = lookDirs[index];
int num2 = 0;
List<SentryGunInstance> list = new List<SentryGunInstance>();
Enumerator<IWarpableObject> enumerator = Dimension.WarpableObjects.GetEnumerator();
while (enumerator.MoveNext())
{
IWarpableObject current = enumerator.Current;
SentryGunInstance val3 = ((Il2CppObjectBase)current).TryCast<SentryGunInstance>();
if ((Object)(object)val3 != (Object)null)
{
if (((ItemEquippable)val3).LocallyPlaced)
{
list.Add(val3);
}
}
else if (SNet.IsMaster && warpDefinition.OnWarp.WarpTeam_WarpAllWarpableBigPickupItems)
{
ItemInLevel val4 = ((Il2CppObjectBase)current).TryCast<ItemInLevel>();
if ((Object)(object)val4 != (Object)null && val4.CanWarp && val4.internalSync.GetCurrentState().placement.droppedOnFloor)
{
Vector3 warpToPosition = locations[num2].Position.ToVector3();
WarpItem(val4, warpDefinition.DimensionIndex, warpToPosition);
EOSLogger.Warning(((Item)val4).PublicName ?? "");
num2 = (num2 + 1) % locations.Count;
}
}
}
list.ForEach(delegate(SentryGunInstance sentryGun)
{
sentryGun.m_sync.WantItemAction(((Item)sentryGun).Owner, (SyncedItemAction_New)0);
});
if (!localPlayerAgent.TryWarpTo(warpDefinition.DimensionIndex, val, val2, true))
{
EOSLogger.Error($"WarpTeam: TryWarpTo failed. Position: {val}, playerSlotIndex: {localPlayerAgent.PlayerSlotIndex}, warpLocationIndex: {num}");
}
}
internal void WarpTeam(WardenObjectiveEventData e)
{
WarpTeam(e.WorldEventObjectFilter);
}
private DimensionWarpManager()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: 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)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
EOSWardenEventManager.Current.AddEventDefinition(WardenEvents_Warp.WarpTeam.ToString(), 160u, (Action<WardenObjectiveEventData>)WarpTeam);
EOSWardenEventManager.Current.AddEventDefinition(WardenEvents_Warp.WarpRange.ToString(), 161u, (Action<WardenObjectiveEventData>)WarpRange);
EOSWardenEventManager.Current.AddEventDefinition(WardenEvents_Warp.WarpItemsInZone.ToString(), 162u, (Action<WardenObjectiveEventData>)WarpItemsInZone);
}
static DimensionWarpManager()
{
Current = new DimensionWarpManager();
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Inas.EOSExt.DimensionWarp", "EOSExt.DimensionWarp", "1.0.1")]
public class EntryPoint : BasePlugin
{
public const string AUTHOR = "Inas";
public const string PLUGIN_NAME = "EOSExt.DimensionWarp";
public const string VERSION = "1.0.1";
private Harmony m_Harmony;
public override void Load()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
SetupManagers();
m_Harmony = new Harmony("EOSExt.DimensionWarp");
m_Harmony.PatchAll();
EOSLogger.Log("ExtraObjectiveSetup.DimensionWarp loaded.");
}
private void SetupManagers()
{
((GenericExpeditionDefinitionManager<DimensionWarpDefinition>)DimensionWarpManager.Current).Init();
}
}
}
namespace EOSExt.DimensionWarp.Definition
{
public class PositionAndLookDir
{
public Vec3 Position { get; set; } = new Vec3();
public int LookDir { get; set; }
}
public class OnWarp
{
public bool WarpTeam_WarpAllWarpableBigPickupItems { get; set; } = true;
public bool WarpRange_WarpDeployedSentryOutsideRange { get; set; } = true;
public bool WarpItemsInZone_OnlyWarpWarpable { get; set; } = true;
}
public class DimensionWarpDefinition
{
public string WorldEventObjectFilter { get; set; } = string.Empty;
public eDimensionIndex DimensionIndex { get; set; }
public OnWarp OnWarp { get; set; } = new OnWarp();
public List<PositionAndLookDir> Locations { get; set; } = new List<PositionAndLookDir>();
}
}using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AIGraph;
using AK;
using AWO.Modules.WEE.Replicators;
using Agents;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Unity.IL2CPP;
using CellMenu;
using EOSExt.EMP.Definition;
using EOSExt.EMP.EMPComponent;
using EOSExt.EMP.Impl;
using EOSExt.EMP.Impl.Handlers;
using EOSExt.EMP.Impl.PersistentEMP;
using ExtraObjectiveSetup;
using ExtraObjectiveSetup.BaseClasses;
using ExtraObjectiveSetup.ExtendedWardenEvents;
using ExtraObjectiveSetup.Utils;
using FloLib.Networks.Replications;
using GTFO.API;
using GTFO.API.Utilities;
using GameData;
using Gear;
using HarmonyLib;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using LevelGeneration;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Inas07.EOSExt.EMP")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ddd2035f35992c9bbb9b48fa0cdce1d8a583a3b2")]
[assembly: AssemblyProduct("Inas07.EOSExt.EMP")]
[assembly: AssemblyTitle("Inas07.EOSExt.EMP")]
[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 EOSExt.EMP
{
public static class AWOUtil
{
public const string PLUGIN_GUID = "GTFO.AWO";
public static bool IsLoaded { get; private set; }
static AWOUtil()
{
IsLoaded = ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.TryGetValue("GTFO.AWO", out var _);
EOSLogger.Debug("=============================================");
EOSLogger.Debug($"EOSExt.EMP: AWO Loaded? {IsLoaded}");
EOSLogger.Debug("=============================================");
}
internal static void SetupZoneLightReplicator(LG_Zone zone)
{
ZoneLightReplicator zoneReplicator = ((Component)zone).gameObject.GetComponent<ZoneLightReplicator>();
if ((Object)(object)zoneReplicator == (Object)null)
{
EOSLogger.Error($"For Zone_{zone.Alias}: AWO is loaded but we cannot find its ZoneLightReplicator");
return;
}
zoneReplicator.OnLightsChanged += delegate
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
LightWorker[] lightsInZone = zoneReplicator.LightsInZone;
for (int i = 0; i < lightsInZone.Length; i++)
{
LG_Light light = lightsInZone[i].Light;
EMPLightHandler handler = EMPLightHandler.GetHandler(light);
if (handler != null)
{
handler.SetOriginalColor(light.m_color);
handler.SetOriginalIntensity(light.m_intensity);
}
}
};
}
}
public class EMPManager : GenericExpeditionDefinitionManager<pEMPDefinition>
{
private Dictionary<uint, pEMP> _pEMPs { get; } = new Dictionary<uint, pEMP>();
public IEnumerable<pEMP> pEMPs => _pEMPs.Values;
protected override string DEFINITION_NAME => "PersistentEMP";
public static EMPManager Current { get; }
public PlayerAgent Player
{
get
{
if (!SNet.HasLocalPlayer || !SNet.LocalPlayer.HasPlayerAgent)
{
return null;
}
return ((Il2CppObjectBase)SNet.LocalPlayer.PlayerAgent).Cast<PlayerAgent>();
}
}
internal List<EMPShock> ActiveEMPs { get; } = new List<EMPShock>();
internal void SetupHUDAndFlashlight()
{
if ((Object)(object)Player == (Object)null)
{
EOSLogger.Error($"{"SetupHUDAndFlashlight": LocalPlayerAgent is not set!}");
return;
}
if (EMPPlayerHudHandler.Instance == null)
{
((Component)Player).gameObject.AddComponent<EMPController>().AssignHandler(new EMPPlayerHudHandler());
EOSLogger.Log("pEMP: PlayerHud setup completed");
}
if (EMPPlayerFlashLightHandler.Instance == null)
{
((Component)Player).gameObject.AddComponent<EMPController>().AssignHandler(new EMPPlayerFlashLightHandler());
EOSLogger.Log("pEMP: PlayerFlashlight setup completed");
}
}
internal void SetupAmmoWeaponHandlers(InventorySlot slot)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Invalid comparison between Unknown and I4
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
if (slot - 1 <= 1)
{
SetupAmmoWeaponHandlerForSlot(slot);
}
static void SetupAmmoWeaponHandlerForSlot(InventorySlot slot)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
BackpackItem val = default(BackpackItem);
if (PlayerBackpackManager.LocalBackpack.TryGetBackpackItem(slot, ref val))
{
if (!((Object)(object)((Component)val.Instance).gameObject.GetComponent<EMPController>() != (Object)null))
{
((Component)val.Instance).gameObject.AddComponent<EMPController>().AssignHandler(new EMPGunSightHandler());
EOSLogger.Log($"pEMP: Backpack {slot} setup completed");
}
}
else
{
EOSLogger.Warning($"Couldn't get item for slot {slot}!");
}
}
}
internal void SetupToolHandler()
{
BackpackItem val = default(BackpackItem);
if (PlayerBackpackManager.LocalBackpack.TryGetBackpackItem((InventorySlot)3, ref val))
{
if (!((Object)(object)((Component)val.Instance).gameObject.GetComponent<EMPController>() != (Object)null) && (Object)(object)((Component)val.Instance).GetComponent<EnemyScanner>() != (Object)null)
{
((Component)val.Instance).gameObject.AddComponent<EMPController>().AssignHandler(new EMPBioTrackerHandler());
EOSLogger.Log($"pEMP: Backpack {3} setup completed");
}
}
else
{
EOSLogger.Warning($"Couldn't get item for slot {3}!");
}
}
public void TogglepEMPState(uint pEMPIndex, bool enabled)
{
if (!_pEMPs.ContainsKey(pEMPIndex))
{
EOSLogger.Error($"TogglepEMPState: pEMPIndex {pEMPIndex} not defined");
}
else
{
ActiveState newState = (enabled ? ActiveState.ENABLED : ActiveState.DISABLED);
_pEMPs[pEMPIndex].ChangeToState(newState);
}
}
public void TogglepEMPState(WardenObjectiveEventData e)
{
uint count = (uint)e.Count;
bool enabled = e.Enabled;
TogglepEMPState(count, enabled);
}
private void pEMPInit()
{
LevelAPI.OnBuildStart += delegate
{
pEMPClear();
InitializepEMPs();
};
LevelAPI.OnLevelCleanup += pEMPClear;
}
private void pEMPClear()
{
foreach (pEMP value in _pEMPs.Values)
{
value.Destroy();
}
_pEMPs.Clear();
}
private void InitializepEMPs()
{
if (!base.definitions.ContainsKey(base.CurrentMainLevelLayout))
{
return;
}
GenericExpeditionDefinition<pEMPDefinition> val = base.definitions[base.CurrentMainLevelLayout];
if (val == null || val.Definitions.Count < 1)
{
return;
}
foreach (pEMPDefinition definition in val.Definitions)
{
pEMP pEMP = new pEMP(definition);
_pEMPs[definition.pEMPIndex] = pEMP;
uint num = EOSNetworking.AllotReplicatorID();
if (num == 0)
{
EOSLogger.Error("SetuppEMPReplicators: replicator ID depleted, cannot set up!");
continue;
}
pEMP.SetupReplicator(num);
EOSLogger.Debug($"pEMP_{definition.pEMPIndex} initialized");
}
}
internal void SetLocalPlayerAgent(PlayerAgent localPlayerAgent)
{
if ((Object)(object)PlayerpEMPComponent.Current == (Object)null)
{
((Component)localPlayerAgent).gameObject.AddComponent<PlayerpEMPComponent>();
}
}
public void ActivateEMPShock(Vector3 position, float range, float duration)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: 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)
if (!GameStateManager.IsInExpedition)
{
EOSLogger.Error("Tried to activate an EMP when not in level, this shouldn't happen!");
return;
}
float endTime = Clock.Time + duration;
EMPShock eMPShock = new EMPShock(position, range, endTime);
foreach (EMPHandler allHandler in EMPHandler.AllHandlers)
{
if (Vector3.Distance(position, allHandler.position) < range)
{
allHandler.AddAffectedBy(eMPShock);
}
}
ActiveEMPs.Add(eMPShock);
}
internal void RemoveInactiveEMPs()
{
float time = Clock.Time;
ActiveEMPs.RemoveAll((EMPShock emp) => emp.endTime < time);
}
public bool IsPlayerMapEMPD()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: 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_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Player == (Object)null || !GameStateManager.IsInExpedition)
{
return false;
}
Vector3 position = ((Agent)Player).Position;
foreach (EMPShock activeEMP in ActiveEMPs)
{
if (Vector3.Distance(position, activeEMP.position) < activeEMP.range)
{
return true;
}
}
foreach (pEMP pEMP in pEMPs)
{
if (pEMP.State == ActiveState.ENABLED && pEMP.ItemToDisable.Map && Vector3.Distance(position, pEMP.position) < pEMP.range)
{
EOSLogger.Warning("MapEMPD: by pEMP");
return true;
}
}
return false;
}
protected override void FileChanged(LiveEditEventArgs e)
{
base.FileChanged(e);
if (!base.definitions.TryGetValue(base.CurrentMainLevelLayout, out var value))
{
return;
}
foreach (pEMPDefinition definition in value.Definitions)
{
EOSLogger.Warning(definition.ItemToDisable.ToString());
}
}
public override void Init()
{
EMPWardenEvents.Init();
Events.InventoryWielded = (Action<InventorySlot>)Delegate.Combine(Events.InventoryWielded, new Action<InventorySlot>(SetupAmmoWeaponHandlers));
pEMPInit();
}
private EMPManager()
{
}
static EMPManager()
{
Current = new EMPManager();
ClassInjector.RegisterTypeInIl2Cpp<EMPController>();
ClassInjector.RegisterTypeInIl2Cpp<PlayerpEMPComponent>();
}
}
internal static class EMPWardenEvents
{
public enum EMPEvents
{
Instant_Shock = 300,
Toggle_PEMP_State
}
internal static void InstantShock(WardenObjectiveEventData e)
{
//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_001a: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = e.Position;
float fogTransitionDuration = e.FogTransitionDuration;
float duration = e.Duration;
EMPManager.Current.ActivateEMPShock(position, fogTransitionDuration, duration);
}
internal static void TogglepEMPState(WardenObjectiveEventData e)
{
EMPManager.Current.TogglepEMPState(e);
}
internal static void Init()
{
EOSWardenEventManager.Current.AddEventDefinition(EMPEvents.Instant_Shock.ToString(), 300u, (Action<WardenObjectiveEventData>)InstantShock);
EOSWardenEventManager.Current.AddEventDefinition(EMPEvents.Toggle_PEMP_State.ToString(), 301u, (Action<WardenObjectiveEventData>)TogglepEMPState);
}
}
public static class Events
{
public static Action<GearPartFlashlight> FlashLightWielded;
public static Action<InventorySlot> InventoryWielded;
public static Action EnterGSInLevel;
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Inas.EOSExt.EMP", "EOSExt.EMP", "1.1.7")]
public class EntryPoint : BasePlugin
{
public const string AUTHOR = "Inas";
public const string PLUGIN_NAME = "EOSExt.EMP";
public const string VERSION = "1.1.7";
private Harmony m_Harmony;
public override void Load()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
m_Harmony = new Harmony("EOSExt.EMP");
m_Harmony.PatchAll();
SetupManagers();
}
private void SetupManagers()
{
((GenericExpeditionDefinitionManager<pEMPDefinition>)EMPManager.Current).Init();
}
}
}
namespace EOSExt.EMP.Patches
{
[HarmonyPatch]
[HarmonyWrapSafe]
internal class Inject_CM_PageMap
{
[HarmonyPostfix]
[HarmonyPatch(typeof(CM_PageMap), "UpdatePlayerData")]
private static void Post_CM_PageMap_OnEnable()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Invalid comparison between Unknown and I4
CM_PageMap pageMap = MainMenuGuiLayer.Current.PageMap;
if (!((Object)(object)pageMap == (Object)null) && RundownManager.ActiveExpedition != null && (int)GameStateManager.CurrentStateName == 10 && EMPManager.Current.IsPlayerMapEMPD())
{
pageMap.SetMapVisualsIsActive(false);
pageMap.SetMapDisconnetedTextIsActive(true);
}
}
}
[HarmonyPatch(typeof(EnemyScanner))]
internal static class Inject_EnemyScanner
{
[HarmonyPrefix]
[HarmonyWrapSafe]
[HarmonyPatch("UpdateDetectedEnemies")]
internal static bool Pre_UpdateDetectedEnemies()
{
EMPBioTrackerHandler instance = EMPBioTrackerHandler.Instance;
if (instance == null)
{
return true;
}
return !instance.IsEMPed();
}
[HarmonyPrefix]
[HarmonyWrapSafe]
[HarmonyPatch("UpdateTagProgress")]
internal static bool Pre_UpdateTagProgress(EnemyScanner __instance)
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
if (EMPBioTrackerHandler.Instance == null)
{
return true;
}
if (EMPBioTrackerHandler.Instance.IsEMPed())
{
((ItemEquippable)__instance).Sound.Post(EVENTS.BIOTRACKER_TOOL_LOOP_STOP, true);
__instance.m_screen.SetStatusText("ERROR");
((ProgressBarBase)__instance.m_progressBar).SetProgress(1f);
__instance.m_screen.SetGuixColor(Color.yellow);
return false;
}
__instance.m_screen.SetStatusText("Ready to tag");
__instance.m_screen.SetGuixColor(Color.red);
return true;
}
}
[HarmonyPatch]
internal static class Inject_LG_Light
{
[HarmonyPrefix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(LG_Light), "Start")]
internal static void Pre_Start(LG_Light __instance)
{
((Component)__instance).gameObject.AddComponent<EMPController>().AssignHandler(new EMPLightHandler());
}
[HarmonyPostfix]
[HarmonyPatch(typeof(LG_BuildZoneLightsJob), "Build")]
private static void Post_ApplyColorScheme(bool __result, LG_BuildZoneLightsJob __instance)
{
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
if (!__result)
{
return;
}
LG_Zone zone = __instance.m_zone;
if ((Object)(object)zone == (Object)null)
{
return;
}
if (AWOUtil.IsLoaded)
{
AWOUtil.SetupZoneLightReplicator(zone);
}
Enumerator<AIG_CourseNode> enumerator = zone.m_courseNodes.GetEnumerator();
while (enumerator.MoveNext())
{
foreach (LG_Light componentsInChild in ((Component)enumerator.Current.m_area).GetComponentsInChildren<LG_Light>(false))
{
EMPLightHandler handler = EMPLightHandler.GetHandler(componentsInChild);
if (handler != null)
{
handler.SetOriginalColor(componentsInChild.m_color);
handler.SetOriginalIntensity(componentsInChild.m_intensity);
}
}
}
}
}
[HarmonyPatch]
internal static class Inject_PlayerAgent
{
[HarmonyPostfix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(PlayerAgent), "Setup")]
internal static void Post_Setup(PlayerAgent __instance)
{
if (((Agent)__instance).IsLocallyOwned)
{
EMPManager.Current.SetLocalPlayerAgent(__instance);
}
}
}
[HarmonyPatch]
internal static class Inject_PlayerHUD
{
[HarmonyPrefix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(PlayerGuiLayer), "UpdateGUIElementsVisibility")]
private static bool Pre_UpdateGUIElementsVisibility()
{
if (EMPPlayerHudHandler.Instance != null && EMPPlayerHudHandler.Instance.IsEMPed())
{
return false;
}
return true;
}
[HarmonyPrefix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(CellSettingsApply), "ApplyPlayerGhostOpacity")]
private static void Pre_ApplyPlayerGhostOpacity(ref float value)
{
if (EMPPlayerHudHandler.Instance != null && EMPPlayerHudHandler.Instance.IsEMPed())
{
value = 0f;
}
}
[HarmonyPrefix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(CellSettingsApply), "ApplyHUDAlwaysShowTeammateInfo")]
private static void Pre_ApplyHUDAlwaysShowTeammateInfo(ref bool value)
{
if (EMPPlayerHudHandler.Instance != null && EMPPlayerHudHandler.Instance.IsEMPed())
{
value = false;
}
}
}
[HarmonyPatch]
internal static class Inject_Events
{
[HarmonyPostfix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(PlayerInventoryBase), "OnItemEquippableFlashlightWielded")]
internal static void Post_OnItemEquippableFlashlightWielded(GearPartFlashlight flashlight)
{
Events.FlashLightWielded?.Invoke(flashlight);
}
[HarmonyPostfix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(PlayerInventoryLocal), "DoWieldItem")]
internal static void Post_DoWieldItem(PlayerInventoryLocal __instance)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
Events.InventoryWielded?.Invoke(((PlayerInventoryBase)__instance).WieldedSlot);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GS_InLevel), "Enter")]
private static void Post_SetupGear(GS_InLevel __instance)
{
Events.EnterGSInLevel?.Invoke();
}
}
[HarmonyPatch(typeof(PlayerSync))]
internal static class Inject_PlayerSync
{
[HarmonyPrefix]
[HarmonyWrapSafe]
[HarmonyPatch("WantsToSetFlashlightEnabled")]
internal static void Pre_WantsToSetFlashlightEnabled(PlayerSync __instance, ref bool enable)
{
if (EMPPlayerFlashLightHandler.Instance != null && EMPPlayerFlashLightHandler.Instance.IsEMPed())
{
enable = false;
}
}
}
[HarmonyPatch(typeof(SentryGunInstance))]
internal static class Inject_SentryGunInstance
{
[HarmonyPostfix]
[HarmonyWrapSafe]
[HarmonyPatch("Setup")]
internal static void Post_Setup(SentryGunInstance __instance)
{
((Component)__instance).gameObject.AddComponent<EMPController>().AssignHandler(new EMPSentryHandler());
}
}
}
namespace EOSExt.EMP.EMPComponent
{
public class PlayerpEMPComponent : MonoBehaviour
{
private float nextUpdateTime = float.NaN;
public const float UPDATE_INTERVAL = 0.2f;
public static PlayerpEMPComponent Current
{
get
{
if (!SNet.HasLocalPlayer || !SNet.LocalPlayer.HasPlayerAgent)
{
return null;
}
return ((Component)((Il2CppObjectBase)SNet.LocalPlayer.PlayerAgent).Cast<PlayerAgent>()).GetComponent<PlayerpEMPComponent>();
}
}
public PlayerAgent player => ((Component)this).gameObject.GetComponent<PlayerAgent>();
private void CheckSetup()
{
if (!((Object)(object)EMPManager.Current.Player == (Object)null))
{
EMPManager.Current.SetupHUDAndFlashlight();
EMPManager.Current.SetupToolHandler();
}
}
private void Update()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
if ((int)GameStateManager.CurrentStateName != 10 || (!float.IsNaN(nextUpdateTime) && Clock.Time < nextUpdateTime))
{
return;
}
nextUpdateTime = Clock.Time + 0.2f;
CheckSetup();
EMPManager.Current.RemoveInactiveEMPs();
if ((Object)(object)player == (Object)null)
{
return;
}
foreach (pEMP pEMP in EMPManager.Current.pEMPs)
{
ItemToDisable itemToDisable = pEMP.ItemToDisable;
if (pEMP.State == ActiveState.ENABLED && pEMP.InRange(((Agent)player).Position))
{
if (itemToDisable.BioTracker)
{
EMPBioTrackerHandler.Instance?.AddAffectedBy(pEMP);
}
if (itemToDisable.PlayerFlashLight)
{
EMPPlayerFlashLightHandler.Instance?.AddAffectedBy(pEMP);
}
if (itemToDisable.PlayerHUD)
{
EMPPlayerHudHandler.Instance?.AddAffectedBy(pEMP);
}
if (itemToDisable.Sentry)
{
EMPSentryHandler.Instance?.AddAffectedBy(pEMP);
}
if (!itemToDisable.GunSight)
{
continue;
}
foreach (EMPGunSightHandler instance in EMPGunSightHandler.Instances)
{
instance.AddAffectedBy(pEMP);
}
continue;
}
EMPBioTrackerHandler.Instance?.RemoveAffectedBy(pEMP);
EMPPlayerFlashLightHandler.Instance?.RemoveAffectedBy(pEMP);
EMPPlayerHudHandler.Instance?.RemoveAffectedBy(pEMP);
EMPSentryHandler.Instance?.RemoveAffectedBy(pEMP);
foreach (EMPGunSightHandler instance2 in EMPGunSightHandler.Instances)
{
instance2.RemoveAffectedBy(pEMP);
}
}
}
private void OnDestroy()
{
}
static PlayerpEMPComponent()
{
}
}
}
namespace EOSExt.EMP.Impl
{
public sealed class EMPController : MonoBehaviour
{
private bool _hasHandler;
private bool _setup;
private float next_remove_time = float.NaN;
private const float UPDATE_INTERVAL = 1f;
public EMPHandler Handler { get; private set; }
public float endTime { get; private set; }
public Vector3 Position => ((Component)this).transform.position;
private void Update()
{
if (_hasHandler)
{
float time = Clock.Time;
Handler.Tick();
if (float.IsNaN(next_remove_time) || next_remove_time < time)
{
Handler.RemoveEndedEMPs();
next_remove_time = time + 1f;
}
}
}
[HideFromIl2Cpp]
public void AssignHandler(EMPHandler handler)
{
if (Handler != null)
{
EOSLogger.Warning("Tried to assign a handler to a controller that already had one!");
return;
}
Handler = handler;
Handler.Setup(((Component)this).gameObject, this);
_hasHandler = true;
_setup = true;
}
[HideFromIl2Cpp]
public void ForceState(EMPState state)
{
if (Handler != null)
{
Handler.ForceState(state);
}
}
private void OnDestroy()
{
Handler.OnDespawn();
Handler = null;
}
}
public abstract class EMPHandler
{
protected enum DeviceState
{
On,
Off,
Unknown
}
private static long next_handler_id = 0L;
protected DeviceState _deviceState;
protected float stateTimer;
protected float delayTimer;
private bool _destroyed;
protected static Dictionary<long, EMPHandler> Handlers { get; } = new Dictionary<long, EMPHandler>();
public static IEnumerable<EMPHandler> AllHandlers => Handlers.Values;
protected long HandlerId { get; private set; }
public EMPState State { get; protected set; }
protected HashSet<EMPShock> AffectedBy { get; } = new HashSet<EMPShock>();
public GameObject go { get; protected set; }
public Vector3 position
{
get
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
GameObject obj = go;
if (obj == null)
{
return Vector3.zero;
}
return obj.transform.position;
}
}
protected virtual float FlickerDuration => 0.2f;
protected virtual float OnToOffMinDelay => 0f;
protected virtual float OnToOffMaxDelay => 0.75f;
protected virtual float OffToOnMinDelay => 0.85f;
protected virtual float OffToOnMaxDelay => 1.5f;
protected virtual bool IsDeviceOnPlayer => false;
public virtual bool IsEMPed()
{
foreach (EMPShock item in AffectedBy)
{
if (Clock.Time < item.endTime)
{
return true;
}
}
return false;
}
public virtual void Setup(GameObject gameObject, EMPController controller)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
go = gameObject;
foreach (EMPShock activeEMP in EMPManager.Current.ActiveEMPs)
{
if (Vector3.Distance(go.transform.position, activeEMP.position) < activeEMP.range)
{
AddAffectedBy(activeEMP);
}
}
HandlerId = next_handler_id++;
if (Handlers.ContainsKey(HandlerId))
{
EOSLogger.Warning("What the hell we got a duplicate EMPHandler ID!?");
}
Handlers[HandlerId] = this;
}
public virtual void OnDespawn()
{
_destroyed = true;
AffectedBy.Clear();
Handlers.Remove(HandlerId);
go = null;
}
public void AddAffectedBy(EMPShock empShock)
{
AffectedBy.Add(empShock);
}
public void RemoveAffectedBy(EMPShock empShock)
{
AffectedBy.Remove(empShock);
}
internal void RemoveEndedEMPs()
{
float time = Clock.Time;
AffectedBy.RemoveWhere((EMPShock emp) => emp.endTime < time);
}
public void ForceState(EMPState state)
{
if (State != state)
{
State = state;
delayTimer = Clock.Time - 1f;
stateTimer = Clock.Time - 1f;
switch (state)
{
case EMPState.Off:
_deviceState = DeviceState.Off;
DeviceOff();
break;
default:
_deviceState = DeviceState.Unknown;
break;
case EMPState.On:
_deviceState = DeviceState.On;
DeviceOn();
break;
}
}
}
public void Tick()
{
if (_destroyed)
{
return;
}
bool flag = IsEMPed();
if (flag && State == EMPState.On)
{
float randomDelay = Random.GetRandomDelay(OnToOffMinDelay, OnToOffMaxDelay);
State = EMPState.FlickerOff;
delayTimer = Clock.Time + randomDelay;
stateTimer = Clock.Time + randomDelay + FlickerDuration;
}
if (!flag && State == EMPState.Off)
{
float randomDelay2 = Random.GetRandomDelay(OffToOnMinDelay, OffToOnMaxDelay);
State = EMPState.FlickerOn;
delayTimer = Clock.Time + randomDelay2;
stateTimer = Clock.Time + randomDelay2 + FlickerDuration;
}
switch (State)
{
case EMPState.On:
if (_deviceState != 0)
{
DeviceOn();
_deviceState = DeviceState.On;
}
break;
case EMPState.FlickerOff:
if (!(Clock.Time < delayTimer))
{
if (Clock.Time < stateTimer)
{
FlickerDevice();
}
else
{
State = EMPState.Off;
}
}
break;
case EMPState.Off:
if (_deviceState != DeviceState.Off)
{
DeviceOff();
_deviceState = DeviceState.Off;
}
break;
case EMPState.FlickerOn:
if (!(Clock.Time < delayTimer))
{
if (Clock.Time < stateTimer)
{
FlickerDevice();
}
else
{
State = EMPState.On;
}
}
break;
}
OnTick(flag);
}
protected virtual void OnTick(bool isEMPD)
{
}
protected abstract void FlickerDevice();
protected abstract void DeviceOn();
protected abstract void DeviceOff();
}
public class EMPShock
{
public static readonly ItemToDisable DISABLE_NOTHING = new ItemToDisable
{
BioTracker = false,
PlayerFlashLight = false,
PlayerHUD = false,
Sentry = false,
EnvLight = false,
GunSight = false,
Map = false
};
public virtual ActiveState State
{
get
{
if (!(RemainingTime > 0f))
{
return ActiveState.DISABLED;
}
return ActiveState.ENABLED;
}
}
public Vector3 position { get; protected set; }
public float range { get; protected set; }
public float endTime { get; protected set; }
public virtual float RemainingTime => endTime - Clock.Time;
public virtual ItemToDisable ItemToDisable => new ItemToDisable();
public EMPShock(Vector3 position, float range, float endTime)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
this.position = position;
this.range = range;
this.endTime = endTime;
}
public bool InRange(Vector3 position)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
return Vector3.Distance(position, this.position) < range;
}
public override bool Equals(object obj)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
if (obj is EMPShock eMPShock && position == eMPShock.position)
{
return range == eMPShock.range;
}
return false;
}
public override int GetHashCode()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
return HashCode.Combine<ActiveState, Vector3, float, float, float, ItemToDisable>(State, position, range, endTime, RemainingTime, ItemToDisable);
}
}
public enum EMPState
{
On,
FlickerOff,
Off,
FlickerOn
}
internal static class Random
{
internal static System.Random _rand { get; private set; } = new System.Random();
internal static float GetRandomDelay(float min, float max)
{
return min + GetRandom01() * (max - min);
}
internal static float GetRandom01()
{
return (float)_rand.NextDouble();
}
internal static int GetRandomRange(int min, int maxPlusOne)
{
return _rand.Next(min, maxPlusOne);
}
internal static int Index(int length)
{
return _rand.Next(0, length);
}
internal static bool FlickerUtil(int oneInX = 2)
{
return Index(oneInX) == 0;
}
}
}
namespace EOSExt.EMP.Impl.PersistentEMP
{
public enum ActiveState
{
DISABLED,
ENABLED
}
public class pEMP : EMPShock
{
private uint replicatorID;
public pEMPDefinition def { get; private set; }
public StateReplicator<pEMPState> StateReplicator { get; private set; }
public override ActiveState State
{
get
{
if (StateReplicator == null)
{
return ActiveState.DISABLED;
}
return StateReplicator.State.status;
}
}
public override float RemainingTime => base.endTime;
public override ItemToDisable ItemToDisable => def?.ItemToDisable ?? EMPShock.DISABLE_NOTHING;
private void OnStateChanged(pEMPState oldState, pEMPState newState, bool isRecall)
{
if (isRecall)
{
ChangeToStateUnsynced(newState.status);
}
}
private void ChangeToStateUnsynced(ActiveState newState)
{
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
EOSLogger.Debug($"pEMP_{def.pEMPIndex} Change state: {State} -> {newState}");
switch (newState)
{
case ActiveState.DISABLED:
base.endTime = float.NegativeInfinity;
break;
case ActiveState.ENABLED:
base.endTime = float.PositiveInfinity;
break;
default:
throw new NotImplementedException();
}
if (!ItemToDisable.EnvLight)
{
return;
}
foreach (EMPLightHandler instance in EMPLightHandler.Instances)
{
switch (newState)
{
case ActiveState.DISABLED:
instance.RemoveAffectedBy(this);
break;
case ActiveState.ENABLED:
if (InRange(instance.position))
{
instance.AddAffectedBy(this);
}
else
{
instance.RemoveAffectedBy(this);
}
break;
default:
throw new NotImplementedException();
}
}
}
public void ChangeToState(ActiveState newState)
{
ChangeToStateUnsynced(newState);
if (SNet.IsMaster)
{
StateReplicator?.SetState(new pEMPState
{
status = newState
});
}
}
internal void SetupReplicator(uint replicatorID)
{
this.replicatorID = replicatorID;
StateReplicator = StateReplicator<pEMPState>.Create(replicatorID, new pEMPState
{
status = ActiveState.DISABLED
}, (LifeTimeType)1, (IStateReplicatorHolder<pEMPState>)null);
StateReplicator.OnStateChanged += OnStateChanged;
}
public pEMP(pEMPDefinition def)
: base(def.Position.ToVector3(), def.Range, float.NegativeInfinity)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
this.def = new pEMPDefinition(def);
}
internal void Destroy()
{
base.endTime = float.NegativeInfinity;
StateReplicator = null;
def = null;
}
public override bool Equals(object obj)
{
if (obj is pEMP pEMP2 && def.Equals(pEMP2.def))
{
return replicatorID == pEMP2.replicatorID;
}
return false;
}
public override int GetHashCode()
{
return HashCode.Combine(def, replicatorID);
}
}
public struct pEMPState
{
public ActiveState status;
public pEMPState()
{
status = ActiveState.DISABLED;
}
public pEMPState(ActiveState status)
{
this.status = status;
}
public pEMPState(pEMPState o)
{
status = o.status;
}
}
}
namespace EOSExt.EMP.Impl.Handlers
{
public class EMPBioTrackerHandler : EMPHandler
{
private EnemyScanner _scanner;
public static EMPBioTrackerHandler Instance { get; private set; }
static EMPBioTrackerHandler()
{
}
public override void Setup(GameObject gameObject, EMPController controller)
{
if (Instance != null)
{
EOSLogger.Warning("EMP: re-setup EMPBioTrackerHandler");
Instance.OnDespawn();
}
base.Setup(gameObject, controller);
_scanner = gameObject.GetComponent<EnemyScanner>();
if ((Object)(object)_scanner == (Object)null)
{
EOSLogger.Error("Couldn't get bio-tracker component!");
}
Instance = this;
}
public override void OnDespawn()
{
base.OnDespawn();
Instance = null;
}
protected override void DeviceOff()
{
((ItemEquippable)_scanner).Sound.Post(EVENTS.BIOTRACKER_TOOL_LOOP_STOP, true);
_scanner.m_graphics.m_display.enabled = false;
}
protected override void DeviceOn()
{
_scanner.m_graphics.m_display.enabled = true;
}
protected override void FlickerDevice()
{
((Behaviour)_scanner).enabled = Random.FlickerUtil();
}
}
public class EMPGunSightHandler : EMPHandler
{
private static List<EMPGunSightHandler> handlers;
public GameObject[] _sightPictures;
public static IEnumerable<EMPGunSightHandler> Instances => handlers;
static EMPGunSightHandler()
{
handlers = new List<EMPGunSightHandler>();
LevelAPI.OnLevelCleanup += Clear;
LevelAPI.OnBuildStart += Clear;
}
private void SetupGunSights()
{
Il2CppArrayBase<Renderer> componentsInChildren = base.go.GetComponentsInChildren<Renderer>(true);
if (componentsInChildren != null)
{
_sightPictures = (from x in (IEnumerable<Renderer>)componentsInChildren
where (Object)(object)x.sharedMaterial != (Object)null && (Object)(object)x.sharedMaterial.shader != (Object)null
where ((Object)x.sharedMaterial.shader).name.Contains("HolographicSight")
select ((Component)x).gameObject).ToArray();
}
if (_sightPictures == null || _sightPictures.Length < 1)
{
EOSLogger.Error("Unable to find sight on " + ((Object)base.go).name + "!");
}
}
public override void Setup(GameObject gameObject, EMPController controller)
{
base.Setup(gameObject, controller);
SetupGunSights();
handlers.Add(this);
}
protected override void DeviceOff()
{
ForEachSights(delegate(GameObject x)
{
x.SetActive(false);
});
}
protected override void DeviceOn()
{
ForEachSights(delegate(GameObject x)
{
x.SetActive(true);
});
}
protected override void FlickerDevice()
{
ForEachSights(delegate(GameObject x)
{
x.SetActive(Random.FlickerUtil());
});
}
private void ForEachSights(Action<GameObject> action)
{
GameObject[] sightPictures = _sightPictures;
foreach (GameObject val in sightPictures)
{
if ((Object)(object)val != (Object)null)
{
action?.Invoke(val);
}
}
}
private static void Clear()
{
handlers.Clear();
}
}
public class EMPLightHandler : EMPHandler
{
private static Dictionary<IntPtr, EMPLightHandler> handlers;
private LG_Light _light;
private float _originalIntensity;
private Color _originalColor;
public static IEnumerable<EMPLightHandler> Instances => handlers.Values;
internal static EMPLightHandler GetHandler(LG_Light light)
{
if (!handlers.TryGetValue(((Il2CppObjectBase)light).Pointer, out var value))
{
return null;
}
return value;
}
private static void Clear()
{
handlers.Clear();
}
static EMPLightHandler()
{
handlers = new Dictionary<IntPtr, EMPLightHandler>();
LevelAPI.OnBuildStart += Clear;
LevelAPI.OnLevelCleanup += Clear;
}
public override void Setup(GameObject gameObject, EMPController controller)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: 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)
base.Setup(gameObject, controller);
_light = gameObject.GetComponent<LG_Light>();
if ((Object)(object)_light == (Object)null)
{
EOSLogger.Warning("No Light!");
}
else
{
_originalIntensity = _light.GetIntensity();
_originalColor = new Color(_light.m_color.r, _light.m_color.g, _light.m_color.b, _light.m_color.a);
base.State = EMPState.On;
}
handlers[((Il2CppObjectBase)_light).Pointer] = this;
}
public void SetOriginalColor(Color color)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
_originalColor = color;
}
public void SetOriginalIntensity(float intensity)
{
_originalIntensity = intensity;
}
protected override void OnTick(bool isEMPD)
{
base.OnTick(isEMPD);
}
protected override void FlickerDevice()
{
if (!((Object)(object)_light == (Object)null))
{
_light.ChangeIntensity(Random.GetRandom01() * _originalIntensity);
}
}
protected override void DeviceOn()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)_light == (Object)null))
{
_light.ChangeIntensity(_originalIntensity);
_light.ChangeColor(_originalColor);
}
}
protected override void DeviceOff()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)_light == (Object)null))
{
_light.ChangeIntensity(0f);
_light.ChangeColor(Color.black);
}
}
}
public class EMPPlayerFlashLightHandler : EMPHandler
{
private PlayerInventoryBase _inventory;
private float _originalIntensity;
private bool _originalFlashlightState;
public static EMPPlayerFlashLightHandler Instance { get; private set; }
protected override bool IsDeviceOnPlayer => true;
private bool FlashlightEnabled => _inventory.FlashlightEnabled;
static EMPPlayerFlashLightHandler()
{
}
public override void Setup(GameObject gameObject, EMPController controller)
{
if (Instance != null)
{
EOSLogger.Warning("EMP: re-setup EMPPlayerFlashLightHandler");
Instance.OnDespawn();
}
base.Setup(gameObject, controller);
_inventory = gameObject.GetComponent<PlayerAgent>().Inventory;
if ((Object)(object)_inventory == (Object)null)
{
EOSLogger.Warning("Player inventory was null!");
}
else
{
base.State = EMPState.On;
Events.FlashLightWielded = (Action<GearPartFlashlight>)Delegate.Combine(Events.FlashLightWielded, new Action<GearPartFlashlight>(InventoryEvents_ItemWielded));
}
Instance = this;
}
public override void OnDespawn()
{
base.OnDespawn();
Events.FlashLightWielded = (Action<GearPartFlashlight>)Delegate.Remove(Events.FlashLightWielded, new Action<GearPartFlashlight>(Instance.InventoryEvents_ItemWielded));
Instance = null;
}
private void InventoryEvents_ItemWielded(GearPartFlashlight flashlight)
{
_originalIntensity = GameDataBlockBase<FlashlightSettingsDataBlock>.GetBlock(flashlight.m_settingsID).intensity;
}
protected override void DeviceOff()
{
_originalFlashlightState = FlashlightEnabled;
if (_originalFlashlightState)
{
_inventory.Owner.Sync.WantsToSetFlashlightEnabled(false, false);
}
}
protected override void DeviceOn()
{
if (_originalFlashlightState != FlashlightEnabled)
{
_inventory.Owner.Sync.WantsToSetFlashlightEnabled(_originalFlashlightState, false);
}
_inventory.m_flashlight.intensity = _originalIntensity;
}
protected override void FlickerDevice()
{
if (FlashlightEnabled)
{
_inventory.m_flashlight.intensity = Random.GetRandom01() * _originalIntensity;
}
}
}
public class EMPPlayerHudHandler : EMPHandler
{
private readonly List<RectTransformComp> _targets = new List<RectTransformComp>();
public static EMPPlayerHudHandler Instance { get; private set; }
static EMPPlayerHudHandler()
{
}
public override void Setup(GameObject gameObject, EMPController controller)
{
if (Instance != null)
{
EOSLogger.Warning("EMP: re-setup EMPPlayerHudHandler");
Instance.OnDespawn();
}
_targets.Clear();
base.Setup(gameObject, controller);
_targets.Add((RectTransformComp)(object)GuiManager.PlayerLayer.m_compass);
_targets.Add((RectTransformComp)(object)GuiManager.PlayerLayer.m_wardenObjective);
_targets.Add((RectTransformComp)(object)GuiManager.PlayerLayer.Inventory);
_targets.Add((RectTransformComp)(object)GuiManager.PlayerLayer.m_playerStatus);
Instance = this;
}
public override void OnDespawn()
{
base.OnDespawn();
_targets.Clear();
Instance = null;
}
private void ForAllComponents(bool enabled)
{
foreach (RectTransformComp target in _targets)
{
((Component)target).gameObject.SetActive(enabled);
}
}
private void ForPlayerNavMarker(bool enabled)
{
Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
while (enumerator.MoveNext())
{
PlayerAgent current = enumerator.Current;
if (!((Agent)current).IsLocallyOwned)
{
current.NavMarker.SetMarkerVisible(enabled);
}
}
}
private void ForPlayerGhostOpacity(bool enabled)
{
CellSettingsApply.ApplyPlayerGhostOpacity(enabled ? CellSettingsManager.SettingsData.HUD.Player_GhostOpacity.Value : 0f);
}
protected override void OnTick(bool isEMPD)
{
base.OnTick(isEMPD);
if (base.State == EMPState.Off)
{
DeviceOff();
}
else if (base.State == EMPState.On)
{
DeviceOn();
}
}
protected override void DeviceOff()
{
ForAllComponents(enabled: false);
ForPlayerNavMarker(enabled: false);
ForPlayerGhostOpacity(enabled: false);
}
protected override void DeviceOn()
{
ForAllComponents(enabled: true);
ForPlayerNavMarker(enabled: true);
ForPlayerGhostOpacity(enabled: true);
}
protected override void FlickerDevice()
{
bool enabled = Random.FlickerUtil();
ForAllComponents(enabled);
ForPlayerNavMarker(enabled);
ForPlayerGhostOpacity(enabled);
}
}
public class EMPSentryHandler : EMPHandler
{
private static Color _offColor;
private SentryGunInstance _sentry;
private SentryGunInstance_ScannerVisuals_Plane _visuals;
public static EMPSentryHandler Instance { get; private set; }
static EMPSentryHandler()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: 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)
_offColor = new Color
{
r = 0f,
g = 0f,
b = 0f,
a = 0f
};
}
public override void Setup(GameObject gameObject, EMPController controller)
{
if (Instance != null)
{
EOSLogger.Warning("EMP: re-setup EMPSentryHandler");
Instance.OnDespawn();
}
base.Setup(gameObject, controller);
_sentry = gameObject.GetComponent<SentryGunInstance>();
_visuals = gameObject.GetComponent<SentryGunInstance_ScannerVisuals_Plane>();
if ((Object)(object)_sentry == (Object)null || (Object)(object)_visuals == (Object)null)
{
EOSLogger.Error($"Missing components on Sentry! Has Sentry?: {(Object)(object)_sentry == (Object)null}, Has Visuals?: {(Object)(object)_visuals == (Object)null}");
}
Instance = this;
}
public override void OnDespawn()
{
base.OnDespawn();
Instance = null;
}
protected override void DeviceOff()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
_visuals.m_scannerPlane.SetColor(_offColor);
_visuals.UpdateLightProps(_offColor, false);
_sentry.m_isSetup = false;
_sentry.m_isScanning = false;
_sentry.m_isFiring = false;
((ItemEquippable)_sentry).Sound.Post(EVENTS.SENTRYGUN_STOP_ALL_LOOPS, true);
}
protected override void DeviceOn()
{
_sentry.m_isSetup = true;
_sentry.m_visuals.SetVisualStatus((eSentryGunStatus)0, true);
_sentry.m_isScanning = false;
_sentry.m_startScanTimer = Clock.Time + _sentry.m_initialScanDelay;
((ItemEquippable)_sentry).Sound.Post(EVENTS.SENTRYGUN_LOW_AMMO_WARNING, true);
}
protected override void FlickerDevice()
{
int randomRange = Random.GetRandomRange(0, 3);
_sentry.StopFiring();
switch (randomRange)
{
case 0:
_visuals.SetVisualStatus((eSentryGunStatus)4, true);
break;
case 1:
_visuals.SetVisualStatus((eSentryGunStatus)1, true);
break;
case 2:
_visuals.SetVisualStatus((eSentryGunStatus)2, true);
break;
}
}
}
}
namespace EOSExt.EMP.Definition
{
public class ItemToDisable
{
public bool BioTracker { get; set; } = true;
public bool PlayerHUD { get; set; } = true;
public bool PlayerFlashLight { get; set; } = true;
public bool EnvLight { get; set; } = true;
public bool GunSight { get; set; } = true;
public bool Sentry { get; set; } = true;
public bool Map { get; set; } = true;
public override bool Equals(object obj)
{
if (obj is ItemToDisable itemToDisable && BioTracker == itemToDisable.BioTracker && PlayerHUD == itemToDisable.PlayerHUD && PlayerFlashLight == itemToDisable.PlayerFlashLight && EnvLight == itemToDisable.EnvLight && GunSight == itemToDisable.GunSight && Sentry == itemToDisable.Sentry)
{
return Map == itemToDisable.Map;
}
return false;
}
public override int GetHashCode()
{
return HashCode.Combine(BioTracker, PlayerHUD, PlayerFlashLight, EnvLight, GunSight, Sentry, Map);
}
public override string ToString()
{
return $"ItemToDisable:\nBioTracker: {BioTracker}, PlayerHUD: {PlayerHUD}, PlayerFlashLight: {PlayerFlashLight},\nEnvLight: {EnvLight}, GunSight: {GunSight}, Sentry: {Sentry}, Map: {Map}";
}
}
public class pEMPDefinition
{
public uint pEMPIndex { get; set; }
public Vec3 Position { get; set; } = new Vec3();
public float Range { get; set; }
public ItemToDisable ItemToDisable { get; set; } = new ItemToDisable();
public pEMPDefinition()
{
}//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
public pEMPDefinition(pEMPDefinition other)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
pEMPIndex = other.pEMPIndex;
Position = new Vec3
{
x = other.Position.x,
y = other.Position.y,
z = other.Position.z
};
Range = other.Range;
ItemToDisable = new ItemToDisable
{
BioTracker = other.ItemToDisable.BioTracker,
PlayerHUD = other.ItemToDisable.PlayerHUD,
PlayerFlashLight = other.ItemToDisable.PlayerFlashLight,
EnvLight = other.ItemToDisable.EnvLight,
GunSight = other.ItemToDisable.GunSight,
Sentry = other.ItemToDisable.Sentry,
Map = other.ItemToDisable.Map
};
}
public override bool Equals(object obj)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
if (obj is pEMPDefinition pEMPDefinition2 && pEMPIndex == pEMPDefinition2.pEMPIndex && Position.ToVector3() == pEMPDefinition2.Position.ToVector3() && Range == pEMPDefinition2.Range)
{
return ItemToDisable.Equals(pEMPDefinition2.ItemToDisable);
}
return false;
}
public override int GetHashCode()
{
return HashCode.Combine<uint, Vec3, float, ItemToDisable>(pEMPIndex, Position, Range, ItemToDisable);
}
}
}using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Agents;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using EOSExt.EnvTemperature.Components;
using EOSExt.EnvTemperature.Definitions;
using EOSExt.EnvTemperature.Patches;
using ExtraObjectiveSetup.BaseClasses;
using ExtraObjectiveSetup.Utils;
using FloLib.Infos;
using GTFO.API;
using GTFO.API.Utilities;
using GameData;
using GameEvent;
using Gear;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppSystem.Collections.Generic;
using LevelGeneration;
using Localization;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Inas07.EOSExt.EnvTemperature")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+7f4e29e917e7c3fa1b2e4e673d8939879ebca660")]
[assembly: AssemblyProduct("Inas07.EOSExt.EnvTemperature")]
[assembly: AssemblyTitle("Inas07.EOSExt.EnvTemperature")]
[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.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 EOSExt.EnvTemperature
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Inas.EOSExt.EnvTemperature", "EOSExt.EnvTemperature", "1.0.4")]
public class EntryPoint : BasePlugin
{
public const string AUTHOR = "Inas";
public const string PLUGIN_NAME = "EOSExt.EnvTemperature";
public const string VERSION = "1.0.4";
private Harmony m_Harmony;
public override void Load()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
SetupManagers();
m_Harmony = new Harmony("EOSExt.EnvTemperature");
m_Harmony.PatchAll();
EOSLogger.Log("ExtraObjectiveSetup.EnvTemperature loaded.");
}
private void SetupManagers()
{
((GenericDefinitionManager<TemperatureDefinition>)TemperatureDefinitionManager.Current).Init();
}
}
public class TemperatureDefinitionManager : GenericDefinitionManager<TemperatureDefinition>
{
public static readonly TemperatureZoneDefinition DEFAULT_ZONE_DEF;
public const float MIN_TEMP = 0.005f;
public const float MAX_TEMP = 1f;
public static TemperatureDefinitionManager Current { get; }
protected override string DEFINITION_NAME => "EnvTemperature";
private Dictionary<(eDimensionIndex dimensionIndex, LG_LayerType layerType, eLocalZoneIndex localIndex), TemperatureZoneDefinition> zoneDefs { get; } = new Dictionary<(eDimensionIndex, LG_LayerType, eLocalZoneIndex), TemperatureZoneDefinition>();
protected override void AddDefinitions(GenericDefinition<TemperatureDefinition> definition)
{
List<TemperatureSetting> settings = definition.Definition.Settings;
if (settings.Count > 0)
{
settings.Sort((TemperatureSetting t1, TemperatureSetting t2) => t1.Temperature.CompareTo(t2.Temperature));
bool flag = true;
if (settings[0].Temperature < 0f)
{
EOSLogger.Error($"Found negative temperature: '{settings[0].Temperature}'");
flag = false;
}
if (settings[settings.Count - 1].Temperature > 1f)
{
EOSLogger.Error($"Found temperature greater than 1: '{settings[settings.Count - 1].Temperature}'");
flag = false;
}
if (!flag)
{
EOSLogger.Error($"Found invalid temperature for MainLevelLayout '{definition.ID}'. Correct it first to make it effective");
return;
}
if (settings[0].Temperature != 0f)
{
List<TemperatureSetting> list = new List<TemperatureSetting>();
TemperatureSetting item = new TemperatureSetting(settings[0])
{
Temperature = 0f
};
list.Add(item);
list.AddRange(settings);
definition.Definition.Settings = list;
settings.Clear();
settings = list;
}
}
foreach (TemperatureZoneDefinition zone in definition.Definition.Zones)
{
zone.Temperature_Downlimit = Math.Clamp(zone.Temperature_Downlimit, 0.005f, 1f);
zone.Temperature_Uplimit = Math.Clamp(zone.Temperature_Uplimit, 0.005f, 1f);
if (zone.Temperature_Downlimit > zone.Temperature_Uplimit)
{
EOSLogger.Error($"Invalid Temperature_Down/Up-limit setting! Downlimit == {zone.Temperature_Downlimit}, Uplimit == {zone.Temperature_Uplimit}");
float temperature_Downlimit = zone.Temperature_Downlimit;
zone.Temperature_Downlimit = zone.Temperature_Uplimit;
zone.Temperature_Uplimit = temperature_Downlimit;
}
if (!(zone.Temperature_Downlimit <= zone.Temperature_Normal) || !(zone.Temperature_Normal <= zone.Temperature_Uplimit))
{
EOSLogger.Error($"Invalid Temperature_Normal setting! Temperature_Normal == {zone.Temperature_Normal} not in limit range [{zone.Temperature_Downlimit}, {zone.Temperature_Uplimit}] !");
zone.Temperature_Normal = Math.Clamp(zone.Temperature_Normal, zone.Temperature_Downlimit, zone.Temperature_Uplimit);
}
zone.FluctuationIntensity = Math.Abs(zone.FluctuationIntensity);
}
base.AddDefinitions(definition);
}
protected override void FileChanged(LiveEditEventArgs e)
{
base.FileChanged(e);
Clear();
OnBuildDone();
if (PlayerTemperatureManager.TryGetCurrentManager(out var mgr) && base.definitions.TryGetValue(RundownManager.ActiveExpedition.LevelLayoutData, out var value))
{
mgr.UpdateTemperatureDefinition(value.Definition);
mgr.UpdateGUIText();
}
}
private void OnBuildDone()
{
if (!base.definitions.TryGetValue(RundownManager.ActiveExpedition.LevelLayoutData, out var value))
{
return;
}
value.Definition.Zones.ForEach(delegate(TemperatureZoneDefinition def)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
if (zoneDefs.ContainsKey((((GlobalZoneIndex)def).DimensionIndex, ((GlobalZoneIndex)def).LayerType, ((GlobalZoneIndex)def).LocalIndex)))
{
EOSLogger.Warning($"TemperatureDefinitionManager: duplicate definition found: {(((GlobalZoneIndex)def).DimensionIndex, ((GlobalZoneIndex)def).LayerType, ((GlobalZoneIndex)def).LocalIndex)}");
}
zoneDefs[(((GlobalZoneIndex)def).DimensionIndex, ((GlobalZoneIndex)def).LayerType, ((GlobalZoneIndex)def).LocalIndex)] = def;
});
}
private void Clear()
{
zoneDefs.Clear();
}
public bool TryGetZoneDefinition(eDimensionIndex dimensionIndex, LG_LayerType layerType, eLocalZoneIndex localIndex, out TemperatureZoneDefinition def)
{
//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_0008: Unknown result type (might be due to invalid IL or missing references)
return zoneDefs.TryGetValue((dimensionIndex, layerType, localIndex), out def);
}
public bool TryGetLevelTemperatureSettings(out List<TemperatureSetting> settings)
{
if (base.definitions.TryGetValue(RundownManager.ActiveExpedition.LevelLayoutData, out var value))
{
settings = value.Definition.Settings;
if (settings != null)
{
return settings.Count > 0;
}
return false;
}
settings = null;
return false;
}
private TemperatureDefinitionManager()
{
LevelAPI.OnBuildDone += OnBuildDone;
LevelAPI.OnBuildStart += Clear;
LevelAPI.OnLevelCleanup += Clear;
}
static TemperatureDefinitionManager()
{
Current = new TemperatureDefinitionManager();
DEFAULT_ZONE_DEF = new TemperatureZoneDefinition
{
FluctuationIntensity = 0.0025f
};
}
}
}
namespace EOSExt.EnvTemperature.Patches
{
[HarmonyPatch]
internal static class Patch_BulletWeapon
{
private static TemperatureSetting? m_curSetting;
private static Dictionary<uint, float> DefaultReloadTimes;
[HarmonyPostfix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(BulletWeaponArchetype), "OnWield")]
public static void Post_OnWield(BulletWeaponArchetype __instance)
{
uint persistentID = ((GameDataBlockBase<ArchetypeDataBlock>)(object)__instance.m_archetypeData).persistentID;
if (!DefaultReloadTimes.ContainsKey(persistentID))
{
DefaultReloadTimes[persistentID] = __instance.m_archetypeData.DefaultReloadTime;
}
TemperatureSetting curSetting = m_curSetting;
if (curSetting != null && curSetting.SlowDownMultiplier_Reload > 0f)
{
__instance.m_archetypeData.DefaultReloadTime = DefaultReloadTimes[persistentID] * curSetting.SlowDownMultiplier_Reload;
EOSLogger.Debug("Temperature: Slowing down reload!");
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(BulletWeaponArchetype), "Update")]
private static void Post_Update(BulletWeaponArchetype __instance)
{
TemperatureSetting currentTemperatureSetting = PlayerTemperatureManager.GetCurrentTemperatureSetting();
if (m_curSetting == currentTemperatureSetting)
{
return;
}
uint persistentID = ((GameDataBlockBase<ArchetypeDataBlock>)(object)__instance.m_archetypeData).persistentID;
if (DefaultReloadTimes.ContainsKey(persistentID))
{
float num = DefaultReloadTimes[persistentID];
if (currentTemperatureSetting == null || currentTemperatureSetting.SlowDownMultiplier_Reload <= 0f)
{
__instance.m_archetypeData.DefaultReloadTime = num;
}
else
{
__instance.m_archetypeData.DefaultReloadTime = num * currentTemperatureSetting.SlowDownMultiplier_Reload;
}
}
m_curSetting = currentTemperatureSetting;
}
[HarmonyPrefix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(BulletWeaponArchetype), "OnUnWield")]
private static void Pre_OnUnWield(BulletWeaponArchetype __instance)
{
uint persistentID = ((GameDataBlockBase<ArchetypeDataBlock>)(object)__instance.m_archetypeData).persistentID;
if (DefaultReloadTimes.ContainsKey(persistentID))
{
float defaultReloadTime = DefaultReloadTimes[persistentID];
__instance.m_archetypeData.DefaultReloadTime = defaultReloadTime;
}
}
private static void Clear()
{
DefaultReloadTimes.Clear();
}
static Patch_BulletWeapon()
{
m_curSetting = null;
DefaultReloadTimes = new Dictionary<uint, float>();
LevelAPI.OnBuildStart += Clear;
LevelAPI.OnLevelCleanup += Clear;
}
}
[HarmonyPatch]
internal static class Patch_MWS_ChargeUp_Enter
{
private static float DefaultChargeTime = 1f;
[HarmonyPostfix]
[HarmonyPatch(typeof(MWS_ChargeUp), "Enter")]
private static void Postfix_Enter(MWS_ChargeUp __instance)
{
DefaultChargeTime = __instance.m_maxDamageTime;
TemperatureSetting currentTemperatureSetting = PlayerTemperatureManager.GetCurrentTemperatureSetting();
if (currentTemperatureSetting != null && currentTemperatureSetting.SlowDownMultiplier_Melee > 0f)
{
__instance.m_maxDamageTime *= currentTemperatureSetting.SlowDownMultiplier_Melee;
}
}
[HarmonyPrefix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(MWS_ChargeUp), "Exit")]
private static void Pre_Exit(MWS_ChargeUp __instance)
{
__instance.m_maxDamageTime = DefaultChargeTime;
}
}
[HarmonyPatch]
internal static class Patch_Dam_PlayerDamageBase
{
internal static bool s_disableDialog;
[HarmonyPrefix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(Dam_PlayerDamageLocal), "ReceiveFallDamage")]
private static bool Pre_ReceiveFallDamage(Dam_PlayerDamageLocal __instance, pMiniDamageData data)
{
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
float num = ((UFloat16)(ref data.damage)).Get(((Dam_SyncedDamageBase)__instance).HealthMax);
((Dam_PlayerDamageBase)__instance).m_nextRegen = Clock.Time + ((Dam_PlayerDamageBase)__instance).Owner.PlayerData.healthRegenStartDelayAfterDamage;
if (((Agent)((Dam_PlayerDamageBase)__instance).Owner).IsLocallyOwned)
{
DramaManager.CurrentState.OnLocalDamage(num);
GameEventManager.PostEvent((eGameEvent)13, ((Dam_PlayerDamageBase)__instance).Owner, num, "", (Dictionary<string, string>)null);
}
else
{
DramaManager.CurrentState.OnTeammatesDamage(num);
}
if (((Dam_PlayerDamageBase)__instance).IgnoreAllDamage)
{
return false;
}
if (SNet.IsMaster)
{
if (((Dam_SyncedDamageBase)__instance).RegisterDamage(num))
{
((Dam_SyncedDamageBase)__instance).SendSetDead(true);
}
else
{
((Dam_SyncedDamageBase)__instance).SendSetHealth(((Dam_SyncedDamageBase)__instance).Health);
}
}
__instance.Hitreact(((UFloat16)(ref data.damage)).Get(((Dam_SyncedDamageBase)__instance).HealthMax), Vector3.zero, true, !s_disableDialog, false);
return false;
}
}
[HarmonyPatch]
internal static class Patch_PlayerAgent
{
[HarmonyPostfix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(PlayerAgent), "Setup")]
private static void Post_Setup(PlayerAgent __instance)
{
if (((Agent)__instance).IsLocallyOwned && !((Object)(object)((Component)__instance).gameObject.GetComponent<PlayerTemperatureManager>() != (Object)null))
{
((Component)__instance).gameObject.AddComponent<PlayerTemperatureManager>().Setup();
}
}
}
[HarmonyPatch]
internal static class Patches_PLOC
{
private const float MIN_MOD = 0.1f;
private static float s_moveSpeedMult = 1f;
[HarmonyPrefix]
[HarmonyPatch(typeof(PLOC_Base), "GetHorizontalVelocityFromInput")]
private static void Pre_GetHorizontalVelocityFromInput(ref float moveSpeed)
{
moveSpeed *= s_moveSpeedMult;
}
internal static void SetMoveSpeedModifier(float m)
{
s_moveSpeedMult = Math.Max(0.1f, m);
}
internal static void ResetMoveSpeedModifier()
{
s_moveSpeedMult = 1f;
}
}
}
namespace EOSExt.EnvTemperature.Definitions
{
public class TemperatureSetting
{
public float Temperature { get; set; } = 1f;
public float Damage { get; set; } = -1f;
public float DamageTick { get; set; }
public float SlowDownMultiplier_Reload { get; set; } = -1f;
public float SlowDownMultiplier_Melee { get; set; } = -1f;
public float SlowDownMultiplier_Move { get; set; } = -1f;
public TemperatureSetting()
{
}
public TemperatureSetting(TemperatureSetting o)
{
Temperature = o.Temperature;
Damage = o.Damage;
DamageTick = o.DamageTick;
SlowDownMultiplier_Reload = o.SlowDownMultiplier_Reload;
SlowDownMultiplier_Melee = o.SlowDownMultiplier_Melee;
SlowDownMultiplier_Move = o.SlowDownMultiplier_Move;
}
}
public class TemperatureZoneDefinition : GlobalZoneIndex
{
public float Temperature_Downlimit { get; set; } = 0.005f;
public float Temperature_Normal { get; set; } = 0.5f;
public float Temperature_Uplimit { get; set; } = 1f;
public float FluctuationIntensity { get; set; }
}
public class TemperatureDefinition
{
public float StartTemperature { get; set; } = 0.5f;
public float JumpActionHeatGained { get; set; }
public float SprintActionHeatGained { get; set; }
public float CrouchActionHeatGained { get; set; }
public float StandingActionHeatGained { get; set; }
public float LadderClimbingActionHeatGained { get; set; }
public List<TemperatureZoneDefinition> Zones { get; set; } = new List<TemperatureZoneDefinition>
{
new TemperatureZoneDefinition()
};
public List<TemperatureSetting> Settings { get; set; } = new List<TemperatureSetting>
{
new TemperatureSetting()
};
}
}
namespace EOSExt.EnvTemperature.Components
{
public class PlayerTemperatureManager : MonoBehaviour
{
public const float DEFAULT_PLAYER_TEMPERATURE = 0.5f;
public const float TEMPERATURE_SETTING_UPDATE_TIME = 1f;
public const float TEMPERATURE_FLUCTUATE_TIME = 1f;
private float m_tempSettingLastUpdateTime;
private float m_lastDamageTime;
private float m_tempFluctuateTime;
private bool m_ShowDamageWarning = true;
private TextMeshPro m_TemperatureText;
private const string DEFAULT_GUI_TEXT = "SUIT TEMP: <color=orange>{0}</color>";
private string m_GUIText = "SUIT TEMP: <color=orange>{0}</color>";
private readonly Color m_lowTempColor = new Color(0f, 0.5f, 0.5f);
private readonly Color m_midTempColor = new Color(1f, 0.64f, 0f);
private readonly Color m_highTempColor = new Color(1f, 0.07f, 0.576f);
public PlayerAgent PlayerAgent { get; private set; }
public TemperatureDefinition? TemperatureDef { get; private set; }
public TemperatureSetting? TemperatureSetting { get; private set; }
public float PlayerTemperature { get; private set; } = 0.5f;
internal void Setup()
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Invalid comparison between Unknown and I4
TemperatureDef = null;
PlayerAgent = ((Component)this).gameObject.GetComponent<PlayerAgent>();
LevelAPI.OnBuildDone += OnBuildDone;
LevelAPI.OnEnterLevel += OnEnterLevel;
EOSLogger.Warning($"GameState: {GameStateManager.CurrentStateName}");
if ((int)GameStateManager.CurrentStateName == 15)
{
OnBuildDone();
OnEnterLevel();
}
}
private void OnDestroy()
{
Object.Destroy((Object)(object)m_TemperatureText);
LevelAPI.OnBuildDone -= OnBuildDone;
LevelAPI.OnEnterLevel -= OnEnterLevel;
}
private void SetupGUI()
{
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)m_TemperatureText == (Object)null)
{
m_TemperatureText = Object.Instantiate<TextMeshPro>(GuiManager.PlayerLayer.m_objectiveTimer.m_titleText);
m_TemperatureText.transform.SetParent(((Component)GuiManager.PlayerLayer.m_playerStatus).gameObject.transform, false);
((Component)m_TemperatureText).GetComponent<RectTransform>().anchoredPosition = new Vector2(-5f, 8f);
((Component)m_TemperatureText).gameObject.transform.localPosition = new Vector3(268.2203f, 25.3799f, 0f);
((Component)m_TemperatureText).gameObject.transform.localScale = new Vector3(0.75f, 0.75f, 0.75f);
}
((Component)m_TemperatureText).gameObject.SetActive(TemperatureDef != null);
}
internal void UpdateGUIText()
{
TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("EnvTemperature.Text");
m_GUIText = ((block != null) ? Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID) : "SUIT TEMP: <color=orange>{0}</color>");
}
private void UpdateGui()
{
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
if (TemperatureDef != null)
{
((Component)m_TemperatureText).gameObject.SetActive(true);
((TMP_Text)m_TemperatureText).SetText(string.Format(m_GUIText, (PlayerTemperature * 100f).ToString("N0")), true);
if (PlayerTemperature > 0.5f)
{
((Graphic)m_TemperatureText).color = Color.Lerp(m_midTempColor, m_highTempColor, (PlayerTemperature - 0.5f) * 2f);
}
else
{
((Graphic)m_TemperatureText).color = Color.Lerp(m_lowTempColor, m_midTempColor, PlayerTemperature * 2f);
}
((TMP_Text)m_TemperatureText).ForceMeshUpdate(false, false);
}
else
{
((Component)m_TemperatureText).gameObject.SetActive(false);
}
}
private void UpdateMoveSpeed()
{
if (TemperatureSetting == null || TemperatureSetting.SlowDownMultiplier_Move <= 0f)
{
Patches_PLOC.ResetMoveSpeedModifier();
}
else
{
Patches_PLOC.SetMoveSpeedModifier(TemperatureSetting.SlowDownMultiplier_Move);
}
}
private void ResetMoveSpeed()
{
Patches_PLOC.ResetMoveSpeedModifier();
}
public void UpdateTemperatureDefinition(TemperatureDefinition def)
{
TemperatureDef = def;
TemperatureSetting = null;
PlayerTemperature = def?.StartTemperature ?? 0.5f;
}
private void OnBuildDone()
{
UpdateTemperatureDefinition(((GenericDefinitionManager<TemperatureDefinition>)TemperatureDefinitionManager.Current).GetDefinition(RundownManager.ActiveExpedition.LevelLayoutData)?.Definition ?? null);
}
private void OnEnterLevel()
{
PlayerTemperature = ((TemperatureDef != null) ? TemperatureDef.StartTemperature : 0.5f);
UpdateGUIText();
SetupGUI();
ResetMoveSpeed();
}
private void DealDamage()
{
if (TemperatureSetting != null && !(TemperatureSetting.Damage < 0f) && !(Time.time - m_lastDamageTime < TemperatureSetting.DamageTick))
{
Patch_Dam_PlayerDamageBase.s_disableDialog = true;
((Dam_SyncedDamageBase)PlayerAgent.Damage).FallDamage(TemperatureSetting.Damage);
Patch_Dam_PlayerDamageBase.s_disableDialog = false;
m_lastDamageTime = Time.time;
}
}
private void UpdateTemperatureSettings()
{
if (Time.time - m_tempSettingLastUpdateTime < 1f)
{
return;
}
if (!TemperatureDefinitionManager.Current.TryGetLevelTemperatureSettings(out var settings))
{
TemperatureSetting = null;
return;
}
int num = 0;
int num2 = settings.Count - 1;
float playerTemperature = PlayerTemperature;
while (num < num2)
{
int num3 = (num + num2) / 2;
float temperature = settings[num3].Temperature;
float num4 = ((num3 + 1 < settings.Count) ? settings[num3 + 1].Temperature : 1f);
if (temperature <= playerTemperature && playerTemperature < num4)
{
break;
}
if (playerTemperature < temperature)
{
num2 = num3 - 1;
}
else
{
num = num3 + 1;
}
}
TemperatureSetting = settings[Math.Clamp((num + num2) / 2, 0, settings.Count - 1)];
m_tempSettingLastUpdateTime = Time.time;
}
private void Update()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Expected I4, but got Unknown
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
if ((int)GameStateManager.CurrentStateName != 10 || TemperatureDef == null || (Object)(object)PlayerAgent == (Object)null)
{
return;
}
Vector3 lastMoveDelta = PlayerAgent.Locomotion.LastMoveDelta;
float num = ((Vector3)(ref lastMoveDelta)).magnitude / Clock.FixedDelta;
float num2 = (PlayerAgent.PlayerData.walkMoveSpeed + PlayerAgent.PlayerData.runMoveSpeed) * 0.5f;
float num3 = 0f;
PLOC_State currentStateEnum = PlayerAgent.Locomotion.m_currentStateEnum;
switch ((int)currentStateEnum)
{
case 0:
num3 = TemperatureDef.StandingActionHeatGained * Time.deltaTime;
break;
case 1:
num3 = ((!(num <= num2)) ? ((TemperatureDef.CrouchActionHeatGained + TemperatureDef.SprintActionHeatGained) * Time.deltaTime) : (TemperatureDef.CrouchActionHeatGained * Time.deltaTime));
break;
case 2:
num3 = TemperatureDef.SprintActionHeatGained * Time.deltaTime;
break;
case 3:
num3 = ((!(num <= num2)) ? ((TemperatureDef.JumpActionHeatGained + TemperatureDef.SprintActionHeatGained) * Time.deltaTime) : (TemperatureDef.JumpActionHeatGained * Time.deltaTime));
break;
case 7:
num3 = 0f;
break;
case 8:
num3 = TemperatureDef.LadderClimbingActionHeatGained * Time.deltaTime;
break;
}
float num4 = TemperatureDef.StartTemperature;
LG_Zone zone = ((Agent)PlayerAgent).CourseNode.m_zone;
float min = 0.005f;
float max = 1f;
if (TemperatureDefinitionManager.Current.TryGetZoneDefinition(zone.DimensionIndex, zone.Layer.m_type, zone.LocalIndex, out var def))
{
num4 = def.Temperature_Normal;
min = def.Temperature_Downlimit;
max = def.Temperature_Uplimit;
}
else
{
def = TemperatureDefinitionManager.DEFAULT_ZONE_DEF;
}
if ((double)Math.Abs(num3) < 1E-05)
{
if (Time.time - m_tempFluctuateTime > 1f)
{
float num5 = def.FluctuationIntensity * Random.RandomRange(0f, 1f);
if (PlayerTemperature > num4)
{
PlayerTemperature -= num5;
}
else
{
PlayerTemperature += num5;
}
m_tempFluctuateTime = Time.time;
}
}
else
{
m_tempFluctuateTime = Time.time;
}
PlayerTemperature += num3;
PlayerTemperature = Math.Clamp(PlayerTemperature, min, max);
UpdateTemperatureSettings();
TemperatureSetting? temperatureSetting = TemperatureSetting;
if (temperatureSetting != null && temperatureSetting.Damage > 0f)
{
DealDamage();
}
UpdateGui();
UpdateMoveSpeed();
}
public static bool TryGetCurrentManager(out PlayerTemperatureManager mgr)
{
mgr = null;
LocalPlayerAgent val = default(LocalPlayerAgent);
if (!LocalPlayer.TryGetLocalAgent(ref val))
{
EOSLogger.Debug("Temperature: cannot get localplayeragent");
return false;
}
mgr = ((Component)val).gameObject.GetComponent<PlayerTemperatureManager>();
if ((Object)(object)mgr == (Object)null)
{
EOSLogger.Error("LocalPlayerAgent does not have `PlayerTemperatureManager`!");
return false;
}
return true;
}
public static TemperatureSetting? GetCurrentTemperatureSetting()
{
if (!TryGetCurrentManager(out var mgr))
{
return null;
}
return mgr.TemperatureSetting;
}
static PlayerTemperatureManager()
{
ClassInjector.RegisterTypeInIl2Cpp<PlayerTemperatureManager>();
}
}
}using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.Json.Serialization;
using AIGraph;
using AK;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using ChainedPuzzles;
using EOSExt.Reactor.Component;
using EOSExt.Reactor.Definition;
using EOSExt.Reactor.Managers;
using ExtraObjectiveSetup.BaseClasses;
using ExtraObjectiveSetup.BaseClasses.CustomTerminalDefinition;
using ExtraObjectiveSetup.ExtendedWardenEvents;
using ExtraObjectiveSetup.Instances;
using ExtraObjectiveSetup.Utils;
using GTFO.API;
using GTFO.API.Extensions;
using GameData;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using LevelGeneration;
using Localization;
using Microsoft.CodeAnalysis;
using SNetwork;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Inas07.EOSExt.Reactor")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f482d476223f2755edf5596e77619b51d0c530e4")]
[assembly: AssemblyProduct("Inas07.EOSExt.Reactor")]
[assembly: AssemblyTitle("Inas07.EOSExt.Reactor")]
[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 EOSExt.Reactor
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Inas.EOSExt.Reactor", "EOSExt.Reactor", "1.0.7")]
public class EntryPoint : BasePlugin
{
public const string AUTHOR = "Inas";
public const string PLUGIN_NAME = "EOSExt.Reactor";
public const string VERSION = "1.0.7";
private Harmony m_Harmony;
public override void Load()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
m_Harmony = new Harmony("EOSExt.Reactor");
m_Harmony.PatchAll();
SetupManagers();
SetupExtraWardenEventDefinitions();
ClassInjector.RegisterTypeInIl2Cpp<OverrideReactorComp>();
EOSLogger.Log("ExtraObjectiveSetup.Reactor loaded.");
}
private void SetupManagers()
{
((InstanceDefinitionManager<ReactorShutdownDefinition>)ReactorShutdownObjectiveManager.Current).Init();
((InstanceDefinitionManager<ReactorStartupOverride>)ReactorStartupOverrideManager.Current).Init();
}
private void SetupExtraWardenEventDefinitions()
{
EOSWardenEventManager.Current.AddEventDefinition(WardenEvents.EventType.ReactorStartup.ToString(), 150u, (Action<WardenObjectiveEventData>)WardenEvents.ReactorStartup);
EOSWardenEventManager.Current.AddEventDefinition(WardenEvents.EventType.CompleteCurrentVerify.ToString(), 151u, (Action<WardenObjectiveEventData>)WardenEvents.CompleteCurrentVerify);
}
}
}
namespace EOSExt.Reactor.Patches
{
[HarmonyPatch]
internal class CommandInterpreter_ReactorVerify
{
[HarmonyPrefix]
[HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "ReactorVerify")]
private static bool Pre_LG_ComputerTerminalCommandInterpreter_ReactorVerify(LG_ComputerTerminalCommandInterpreter __instance, string param1)
{
LG_WardenObjective_Reactor connectedReactor = __instance.m_terminal.ConnectedReactor;
if ((Object)(object)connectedReactor == (Object)null)
{
EOSLogger.Error("ReactorVerify: connected reactor is null - bug detected");
return true;
}
if (connectedReactor.m_isWardenObjective)
{
return true;
}
if (connectedReactor.ReadyForVerification && param1 == connectedReactor.CurrentStateOverrideCode)
{
__instance.m_terminal.ChangeState((TERM_State)7);
}
else
{
__instance.AddOutput("", true);
__instance.AddOutput((TerminalLineType)3, Text.Get(2195342028u), 4f, (TerminalSoundType)0, (TerminalSoundType)0);
__instance.AddOutput("", true);
}
return false;
}
}
[HarmonyPatch]
internal class OnTerminalStartupSequenceVerify
{
[HarmonyPostfix]
[HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnTerminalStartupSequenceVerify")]
private static void Post_ExecuteEventsOnEndOnClientSide(LG_WardenObjective_Reactor __instance)
{
if (!SNet.IsMaster)
{
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)3, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null);
}
}
}
[HarmonyPatch]
internal class Reactor_OnBuildDone
{
[HarmonyPostfix]
[HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnBuildDone")]
private static void Post_LG_WardenObjective_Reactor_OnBuildDone(LG_WardenObjective_Reactor __instance)
{
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Invalid comparison between Unknown and I4
uint num = ((InstanceManager<LG_WardenObjective_Reactor>)ReactorInstanceManager.Current).Register(__instance);
if (__instance.m_isWardenObjective)
{
ReactorStartupOverride definition = ((InstanceDefinitionManager<ReactorStartupOverride>)ReactorStartupOverrideManager.Current).GetDefinition(__instance.SpawnNode.m_dimension.DimensionIndex, __instance.SpawnNode.LayerType, __instance.SpawnNode.m_zone.LocalIndex, num);
if (definition == null)
{
return;
}
WardenObjectiveDataBlock val = default(WardenObjectiveDataBlock);
if (!WardenObjectiveManager.TryGetWardenObjectiveDataForLayer(__instance.SpawnNode.LayerType, __instance.WardenObjectiveChainIndex, ref val) || val == null)
{
EOSLogger.Error("Failed to get WardenObjectiveData for this reactor");
return;
}
if ((int)val.Type != 1)
{
EOSLogger.Error($"Reactor Instance {(((InstanceManager<LG_WardenObjective_Reactor>)ReactorInstanceManager.Current).GetGlobalZoneIndex(__instance), num)} is not setup as vanilla ReactorStartup, cannot override");
return;
}
definition.ObjectiveDB = val;
ReactorStartupOverrideManager.Current.Build(__instance, definition);
}
else
{
ReactorShutdownDefinition definition2 = ((InstanceDefinitionManager<ReactorShutdownDefinition>)ReactorShutdownObjectiveManager.Current).GetDefinition(__instance.SpawnNode.m_dimension.DimensionIndex, __instance.SpawnNode.LayerType, __instance.SpawnNode.m_zone.LocalIndex, num);
if (definition2 != null)
{
ReactorShutdownObjectiveManager.Current.Build(__instance, definition2);
EOSLogger.Debug($"Reactor Shutdown Instance {(((InstanceManager<LG_WardenObjective_Reactor>)ReactorInstanceManager.Current).GetGlobalZoneIndex(__instance), num)}: custom setup complete");
}
}
if ((Object)(object)__instance.m_terminal != (Object)null)
{
TerminalInstanceManager.Current.RegisterReactorTerminal(__instance);
}
}
}
[HarmonyPatch]
internal class Reactor_OnStateChange
{
private static void Startup_OnStateChange(LG_WardenObjective_Reactor reactor, pReactorState oldState, pReactorState newState, bool isDropinState)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
if (isDropinState)
{
return;
}
uint zoneInstanceIndex = ((InstanceManager<LG_WardenObjective_Reactor>)ReactorInstanceManager.Current).GetZoneInstanceIndex(reactor);
ReactorStartupOverride definition = ((InstanceDefinitionManager<ReactorStartupOverride>)ReactorStartupOverrideManager.Current).GetDefinition(reactor.SpawnNode.m_dimension.DimensionIndex, reactor.OriginLayer, reactor.SpawnNode.m_zone.LocalIndex, zoneInstanceIndex);
if (definition != null && (int)oldState.status == 0 && (Object)(object)reactor.m_chainedPuzzleToStartSequence != (Object)null)
{
definition.EventsOnActive.ForEach(delegate(WardenObjectiveEventData e)
{
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f);
});
}
}
private static void Shutdown_OnStateChange(LG_WardenObjective_Reactor reactor, pReactorState oldState, pReactorState newState, bool isDropinState, ReactorShutdownDefinition def)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//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_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Expected I4, but got Unknown
eReactorStatus status = newState.status;
switch (status - 6)
{
case 0:
GuiManager.PlayerLayer.m_wardenIntel.ShowSubObjectiveMessage("", Text.Get(1080u), false, 200f, 8f, (Action)null);
reactor.m_progressUpdateEnabled = true;
reactor.m_currentDuration = 15f;
reactor.m_lightCollection.SetMode(false);
reactor.m_sound.Stop();
def.EventsOnActive.ForEach(delegate(WardenObjectiveEventData e)
{
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f);
});
break;
case 1:
GuiManager.PlayerLayer.m_wardenIntel.ShowSubObjectiveMessage("", Text.Get(1081u), false, 200f, 8f, (Action)null);
reactor.m_progressUpdateEnabled = false;
reactor.ReadyForVerification = true;
break;
case 2:
reactor.m_progressUpdateEnabled = false;
if ((Object)(object)def.ChainedPuzzleOnVerificationInstance != (Object)null)
{
GuiManager.PlayerLayer.m_wardenIntel.ShowSubObjectiveMessage("", Text.Get(1082u), false, 200f, 8f, (Action)null);
def.ChainedPuzzleOnVerificationInstance.AttemptInteract((eChainedPuzzleInteraction)0);
}
def.EventsOnShutdownPuzzleStarts.ForEach(delegate(WardenObjectiveEventData e)
{
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f);
});
break;
case 3:
reactor.m_progressUpdateEnabled = false;
reactor.m_objectiveCompleteTimer = Clock.Time + 5f;
def.EventsOnComplete.ForEach(delegate(WardenObjectiveEventData e)
{
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, (eWardenObjectiveEventTrigger)0, true, 0f);
});
break;
}
}
[HarmonyPrefix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateChange")]
private static bool Pre_LG_WardenObjective_Reactor_OnStateChange(LG_WardenObjective_Reactor __instance, pReactorState oldState, pReactorState newState, bool isDropinState)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: 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_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
if (__instance.m_isWardenObjective)
{
if (ReactorInstanceManager.Current.IsStartupReactor(__instance))
{
Startup_OnStateChange(__instance, oldState, newState, isDropinState);
}
return true;
}
if (oldState.stateCount != newState.stateCount)
{
__instance.OnStateCountUpdate(newState.stateCount);
}
if (oldState.stateProgress != newState.stateProgress)
{
__instance.OnStateProgressUpdate(newState.stateProgress);
}
if (oldState.status == newState.status)
{
return false;
}
__instance.ReadyForVerification = false;
if (ReactorInstanceManager.Current.IsShutdownReactor(__instance))
{
uint zoneInstanceIndex = ((InstanceManager<LG_WardenObjective_Reactor>)ReactorInstanceManager.Current).GetZoneInstanceIndex(__instance);
(eDimensionIndex, LG_LayerType, eLocalZoneIndex) globalZoneIndex = ((InstanceManager<LG_WardenObjective_Reactor>)ReactorInstanceManager.Current).GetGlobalZoneIndex(__instance);
ReactorShutdownDefinition definition = ((InstanceDefinitionManager<ReactorShutdownDefinition>)ReactorShutdownObjectiveManager.Current).GetDefinition(globalZoneIndex, zoneInstanceIndex);
if (definition == null)
{
EOSLogger.Error("Reactor_OnStateChange: found built custom reactor but its definition is missing, what happened?");
return false;
}
Shutdown_OnStateChange(__instance, oldState, newState, isDropinState, definition);
__instance.m_currentState = newState;
return false;
}
EOSLogger.Error("Reactor_OnStateChange: found built custom reactor but it's not a shutdown reactor, what happened?");
return false;
}
}
[HarmonyPatch]
internal class Reactor_OnStateCountUpdate
{
[HarmonyPrefix]
[HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateCountUpdate")]
private static bool Pre_LG_WardenObjective_Reactor_OnStateCountUpdate(LG_WardenObjective_Reactor __instance, int count)
{
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Expected O, but got Unknown
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Expected O, but got Unknown
if (__instance.m_isWardenObjective)
{
return true;
}
uint zoneInstanceIndex = ((InstanceManager<LG_WardenObjective_Reactor>)ReactorInstanceManager.Current).GetZoneInstanceIndex(__instance);
(eDimensionIndex, LG_LayerType, eLocalZoneIndex) globalZoneIndex = ((InstanceManager<LG_WardenObjective_Reactor>)ReactorInstanceManager.Current).GetGlobalZoneIndex(__instance);
if (ReactorInstanceManager.Current.IsStartupReactor(__instance))
{
return true;
}
if (ReactorInstanceManager.Current.IsShutdownReactor(__instance))
{
ReactorShutdownDefinition definition = ((InstanceDefinitionManager<ReactorShutdownDefinition>)ReactorShutdownObjectiveManager.Current).GetDefinition(globalZoneIndex, zoneInstanceIndex);
if (definition == null)
{
EOSLogger.Error("Reactor_OnStateCountUpdate: found built custom reactor but its definition is missing, what happened?");
return true;
}
__instance.m_currentWaveCount = count;
if (definition.PutVerificationCodeOnTerminal)
{
LG_ComputerTerminal instance = ((InstanceManager<LG_ComputerTerminal>)(object)TerminalInstanceManager.Current).GetInstance(((GlobalZoneIndex)definition.VerificationCodeTerminal).GlobalZoneIndexTuple(), definition.VerificationCodeTerminal.InstanceIndex);
__instance.m_currentWaveData = new ReactorWaveData
{
HasVerificationTerminal = (definition.PutVerificationCodeOnTerminal && (Object)(object)instance != (Object)null),
VerificationTerminalSerial = (((Object)(object)instance != (Object)null) ? instance.ItemKey : string.Empty),
Warmup = 1f,
WarmupFail = 1f,
Wave = 1f,
Verify = 1f,
VerifyFail = 1f
};
}
else
{
__instance.m_currentWaveData = new ReactorWaveData
{
HasVerificationTerminal = false,
VerificationTerminalSerial = string.Empty,
Warmup = 1f,
WarmupFail = 1f,
Wave = 1f,
Verify = 1f,
VerifyFail = 1f
};
}
if (__instance.m_overrideCodes != null && !string.IsNullOrEmpty(((Il2CppArrayBase<string>)(object)__instance.m_overrideCodes)[0]))
{
__instance.CurrentStateOverrideCode = ((Il2CppArrayBase<string>)(object)__instance.m_overrideCodes)[0];
}
else
{
EOSLogger.Error("Reactor_OnStateCountUpdate: code is not built?");
}
return false;
}
EOSLogger.Error("Reactor_OnStateCountUpdate: found built custom reactor but it's neither a startup nor shutdown reactor, what happen?");
return true;
}
}
[HarmonyPatch]
internal class Reactor_Update
{
private static bool _checked;
private static TextDataBlock shutdownVerification_GUIText;
[HarmonyPrefix]
[HarmonyPatch(typeof(LG_WardenObjective_Reactor), "Update")]
private static bool Pre_LG_WardenObjective_Reactor_Update(LG_WardenObjective_Reactor __instance)
{
//IL_0009: 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_0014: Invalid comparison between Unknown and I4
if (__instance.m_isWardenObjective || (int)__instance.m_currentState.status != 7)
{
return true;
}
if (!_checked)
{
shutdownVerification_GUIText = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.ExtraObjectiveSetup_ReactorShutdown.SecurityVerificationRequired");
_checked = true;
}
string empty = string.Empty;
empty = ((!__instance.m_currentWaveData.HasVerificationTerminal) ? string.Format(Text.Get(1107u), "<color=orange>" + __instance.CurrentStateOverrideCode + "</color>") : string.Format((shutdownVerification_GUIText != null) ? Text.Get(((GameDataBlockBase<TextDataBlock>)(object)shutdownVerification_GUIText).persistentID) : "SECURITY VERIFICATION REQUIRED. USE COMMAND <color=orange>REACTOR_VERIFY</color> AND FIND CODE ON <color=orange>{0}</color>.", __instance.m_currentWaveData.VerificationTerminalSerial));
__instance.SetGUIMessage(true, empty, (ePUIMessageStyle)3, false, "", "");
return false;
}
}
[HarmonyPatch]
internal class Reactor_CommandInterpreter
{
private static bool Handle_ReactorShutdown(LG_ComputerTerminalCommandInterpreter __instance)
{
LG_WardenObjective_Reactor connectedReactor = __instance.m_terminal.ConnectedReactor;
uint zoneInstanceIndex = ((InstanceManager<LG_WardenObjective_Reactor>)ReactorInstanceManager.Current).GetZoneInstanceIndex(connectedReactor);
(eDimensionIndex, LG_LayerType, eLocalZoneIndex) globalZoneIndex = ((InstanceManager<LG_WardenObjective_Reactor>)ReactorInstanceManager.Current).GetGlobalZoneIndex(connectedReactor);
ReactorShutdownDefinition definition = ((InstanceDefinitionManager<ReactorShutdownDefinition>)ReactorShutdownObjectiveManager.Current).GetDefinition(globalZoneIndex, zoneInstanceIndex);
if (definition == null)
{
EOSLogger.Error("ReactorVerify: found built custom reactor shutdown but its definition is missing, what happened?");
return true;
}
__instance.AddOutput((TerminalLineType)3, Text.Get(3436726297u), 4f, (TerminalSoundType)0, (TerminalSoundType)0);
if ((Object)(object)definition.ChainedPuzzleToActiveInstance != (Object)null)
{
__instance.AddOutput(Text.Get(2277987284u), true);
if (SNet.IsMaster)
{
definition.ChainedPuzzleToActiveInstance.AttemptInteract((eChainedPuzzleInteraction)0);
}
}
else
{
connectedReactor.AttemptInteract((eReactorInteraction)6, 0f);
}
return false;
}
private static bool Handle_ReactorStartup_SpecialCommand(LG_ComputerTerminalCommandInterpreter __instance, TERM_Command cmd)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
LG_WardenObjective_Reactor connectedReactor = __instance.m_terminal.ConnectedReactor;
if (__instance.m_terminal.CommandIsHidden(cmd))
{
return true;
}
_ = __instance.m_terminal.ItemKey;
OverrideReactorComp component = ((Component)connectedReactor).gameObject.GetComponent<OverrideReactorComp>();
if ((Object)(object)component == (Object)null)
{
return true;
}
if (!connectedReactor.ReadyForVerification)
{
__instance.AddOutput("", true);
__instance.AddOutput((TerminalLineType)3, ReactorStartupOverrideManager.NotReadyForVerificationOutputText, 4f, (TerminalSoundType)0, (TerminalSoundType)0);
__instance.AddOutput("", true);
return false;
}
if (component.IsCorrectTerminal(__instance.m_terminal))
{
EOSLogger.Log("Reactor Verify Correct!");
if (SNet.IsMaster)
{
if (connectedReactor.m_currentWaveCount == connectedReactor.m_waveCountMax)
{
connectedReactor.AttemptInteract((eReactorInteraction)5, 0f);
}
else
{
connectedReactor.AttemptInteract((eReactorInteraction)3, 0f);
}
}
else
{
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(connectedReactor.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)3, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null);
}
__instance.AddOutput(ReactorStartupOverrideManager.CorrectTerminalOutputText, true);
}
else
{
EOSLogger.Log("Reactor Verify Incorrect!");
__instance.AddOutput("", true);
__instance.AddOutput((TerminalLineType)3, ReactorStartupOverrideManager.IncorrectTerminalOutputText, 4f, (TerminalSoundType)0, (TerminalSoundType)0);
__instance.AddOutput("", true);
}
return false;
}
[HarmonyPrefix]
[HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "ReceiveCommand")]
private static bool Pre_ReceiveCommand(LG_ComputerTerminalCommandInterpreter __instance, TERM_Command cmd, string inputLine, string param1, string param2)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Invalid comparison between Unknown and I4
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
LG_WardenObjective_Reactor connectedReactor = __instance.m_terminal.ConnectedReactor;
if ((Object)(object)connectedReactor == (Object)null)
{
return true;
}
if ((int)cmd == 23 && !connectedReactor.m_isWardenObjective)
{
return Handle_ReactorShutdown(__instance);
}
if ((int)cmd == 42)
{
return Handle_ReactorStartup_SpecialCommand(__instance, cmd);
}
return true;
}
}
}
namespace EOSExt.Reactor.Patches.Shutdown
{
[HarmonyPatch]
internal class Reactor_OnReactorShutdownVerifyChaosDone
{
[HarmonyPrefix]
[HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "OnReactorShutdownVerifyChaosDone")]
private static bool Pre_LG_ComputerTerminalCommandInterpreter_OnReactorShutdownVerifyChaosDone(LG_ComputerTerminalCommandInterpreter __instance)
{
LG_WardenObjective_Reactor connectedReactor = __instance.m_terminal.ConnectedReactor;
if ((Object)(object)connectedReactor == (Object)null || connectedReactor.m_isWardenObjective)
{
return true;
}
(eDimensionIndex, LG_LayerType, eLocalZoneIndex) globalZoneIndex = ((InstanceManager<LG_WardenObjective_Reactor>)ReactorInstanceManager.Current).GetGlobalZoneIndex(connectedReactor);
uint zoneInstanceIndex = ((InstanceManager<LG_WardenObjective_Reactor>)ReactorInstanceManager.Current).GetZoneInstanceIndex(connectedReactor);
ReactorShutdownDefinition definition = ((InstanceDefinitionManager<ReactorShutdownDefinition>)ReactorShutdownObjectiveManager.Current).GetDefinition(globalZoneIndex, zoneInstanceIndex);
if (definition == null)
{
EOSLogger.Error("OnReactorShutdownVerifyChaosDone: found built custom reactor shutdown but its definition is missing, what happened?");
return false;
}
connectedReactor.AttemptInteract((eReactorInteraction)(((Object)(object)definition.ChainedPuzzleOnVerificationInstance != (Object)null) ? 8 : 9), 0f);
return false;
}
}
}
namespace EOSExt.Reactor.Managers
{
public sealed class ReactorInstanceManager : InstanceManager<LG_WardenObjective_Reactor>
{
private HashSet<IntPtr> startupReactor = new HashSet<IntPtr>();
private HashSet<IntPtr> shutdownReactor = new HashSet<IntPtr>();
public static ReactorInstanceManager Current { get; private set; }
public override (eDimensionIndex, LG_LayerType, eLocalZoneIndex) GetGlobalZoneIndex(LG_WardenObjective_Reactor instance)
{
//IL_000b: 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_0026: Unknown result type (might be due to invalid IL or missing references)
return (instance.SpawnNode.m_dimension.DimensionIndex, instance.SpawnNode.LayerType, instance.SpawnNode.m_zone.LocalIndex);
}
public void MarkAsStartupReactor(LG_WardenObjective_Reactor reactor)
{
if (shutdownReactor.Contains(((Il2CppObjectBase)reactor).Pointer))
{
throw new ArgumentException("Invalid: cannot mark a reactor both as startup and shutdown reactor");
}
startupReactor.Add(((Il2CppObjectBase)reactor).Pointer);
}
public void MarkAsShutdownReactor(LG_WardenObjective_Reactor reactor)
{
if (startupReactor.Contains(((Il2CppObjectBase)reactor).Pointer))
{
throw new ArgumentException("Invalid: cannot mark a reactor both as startup and shutdown reactor");
}
shutdownReactor.Add(((Il2CppObjectBase)reactor).Pointer);
}
public bool IsStartupReactor(LG_WardenObjective_Reactor reactor)
{
return startupReactor.Contains(((Il2CppObjectBase)reactor).Pointer);
}
public bool IsShutdownReactor(LG_WardenObjective_Reactor reactor)
{
return shutdownReactor.Contains(((Il2CppObjectBase)reactor).Pointer);
}
private void Clear()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: 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_0063: Unknown result type (might be due to invalid IL or missing references)
foreach (IntPtr item in startupReactor)
{
LG_WardenObjective_Reactor val = new LG_WardenObjective_Reactor(item);
if ((int)val != 0)
{
CellSoundPlayer sound = val.m_sound;
if (sound != null)
{
sound.Recycle();
}
}
}
foreach (IntPtr item2 in shutdownReactor)
{
LG_WardenObjective_Reactor val2 = new LG_WardenObjective_Reactor(item2);
if ((int)val2 != 0)
{
CellSoundPlayer sound2 = val2.m_sound;
if (sound2 != null)
{
sound2.Recycle();
}
}
}
startupReactor.Clear();
shutdownReactor.Clear();
}
public void SetupReactorTerminal(LG_WardenObjective_Reactor reactor, TerminalDefinition reactorTerminalData)
{
reactor.SpawnNode.m_zone.TerminalsSpawnedInZone.Add(reactor.m_terminal);
if (reactorTerminalData != null)
{
reactorTerminalData.LocalLogFiles?.ForEach(delegate(TerminalLogFileData log)
{
reactor.m_terminal.AddLocalLog(log, true);
});
reactorTerminalData.UniqueCommands?.ForEach(delegate(CustomCommand cmd)
{
EOSTerminalUtils.AddUniqueCommand(reactor.m_terminal, cmd);
});
EOSTerminalUtils.BuildPassword(reactor.m_terminal, reactorTerminalData.PasswordData);
}
}
public static LG_WardenObjective_Reactor FindVanillaReactor(LG_LayerType layer, int count)
{
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
if (count < 0)
{
EOSLogger.Error($"FindVanillaReactor: Count should be non-negative, but got {count}!");
return null;
}
LG_WardenObjective_Reactor val = null;
int num = count;
Enumerator<LayerChainIndex, iWardenObjectiveItem> enumerator = WardenObjectiveManager.Current.m_wardenObjectiveItem.GetEnumerator();
while (enumerator.MoveNext())
{
KeyValuePair<LayerChainIndex, iWardenObjectiveItem> current = enumerator.Current;
if (current.Key.Layer != layer)
{
continue;
}
iWardenObjectiveItem value = current.Value;
val = ((value != null) ? ((Il2CppObjectBase)value).TryCast<LG_WardenObjective_Reactor>() : null);
if (!((Object)(object)val == (Object)null))
{
if (num <= 0)
{
break;
}
val = null;
num--;
}
}
if ((Object)(object)val == (Object)null)
{
EOSLogger.Error($"FindVanillaReactor: reactor not found with index(Count) {num} in {layer}!");
}
return val;
}
private ReactorInstanceManager()
{
LevelAPI.OnLevelCleanup += Clear;
}
static ReactorInstanceManager()
{
Current = new ReactorInstanceManager();
}
}
internal class ReactorStartupOverrideManager : InstanceDefinitionManager<ReactorStartupOverride>
{
private List<ReactorStartupOverride> builtOverride = new List<ReactorStartupOverride>();
public static uint SpecialCmdVerifyTextID { get; private set; }
public static uint MainTerminalTextID { get; private set; }
public static uint CooldownCommandDescTextID { get; private set; }
public static uint InfiniteWaveVerifyTextID { get; private set; }
public static uint NotReadyForVerificationOutputTextID { get; private set; }
public static uint IncorrectTerminalOutputTextID { get; private set; }
public static uint CorrectTerminalOutputTextID { get; private set; }
public static string CoolDownCommandDesc
{
get
{
if (CooldownCommandDescTextID == 0)
{
return "Confirm Reactor Startup Cooling Protocol";
}
return Text.Get(CooldownCommandDescTextID);
}
}
public static string MainTerminalText
{
get
{
if (MainTerminalTextID == 0)
{
return "Main Terminal";
}
return Text.Get(MainTerminalTextID);
}
}
public static string SpecialCmdVerifyText
{
get
{
if (SpecialCmdVerifyTextID == 0)
{
return "REACTOR COOLING REQUIRED ({0}/{1})\nMANUAL OVERRIDE REQUIRED. USE COMMAND <color=orange>REACTOR_COOLDOWN</color> AT {2}";
}
return Text.Get(SpecialCmdVerifyTextID);
}
}
public static string InfiniteWaveVerifyText
{
get
{
if (InfiniteWaveVerifyTextID == 0)
{
return "VERIFICATION ({0}/{1}).";
}
return Text.Get(InfiniteWaveVerifyTextID);
}
}
public static string NotReadyForVerificationOutputText
{
get
{
if (NotReadyForVerificationOutputTextID == 0)
{
return "<color=red>Reactor intensive test in progress, cannot initate cooldown</color>";
}
return Text.Get(NotReadyForVerificationOutputTextID);
}
}
public static string CorrectTerminalOutputText
{
get
{
if (CorrectTerminalOutputTextID == 0)
{
return "<color=red>Reactor stage cooldown completed</color>";
}
return Text.Get(CorrectTerminalOutputTextID);
}
}
public static string IncorrectTerminalOutputText
{
get
{
if (IncorrectTerminalOutputTextID == 0)
{
return "<color=red>Incorrect terminal, cannot initate cooldown</color>";
}
return Text.Get(IncorrectTerminalOutputTextID);
}
}
public static ReactorStartupOverrideManager Current { get; private set; }
protected override string DEFINITION_NAME => "ReactorStartup";
public static void FetchOverrideTextDB()
{
SpecialCmdVerifyTextID = GameDataBlockBase<TextDataBlock>.GetBlockID("InGame.WardenObjective_Reactor.MeltdownVerification");
MainTerminalTextID = GameDataBlockBase<TextDataBlock>.GetBlockID("InGame.WardenObjective_Reactor.MeltdownMainTerminalName");
CooldownCommandDescTextID = GameDataBlockBase<TextDataBlock>.GetBlockID("InGame.WardenObjective_Reactor.MeltdownCoolDown.CommandDesc");
InfiniteWaveVerifyTextID = GameDataBlockBase<TextDataBlock>.GetBlockID("InGame.WardenObjective_Reactor.Verification.InfiniteWave");
NotReadyForVerificationOutputTextID = GameDataBlockBase<TextDataBlock>.GetBlockID("InGame.WardenObjective_Reactor.MeltdownCoolDown.Not_ReadyForVerification_Output");
IncorrectTerminalOutputTextID = GameDataBlockBase<TextDataBlock>.GetBlockID("InGame.WardenObjective_Reactor.MeltdownCoolDown.IncorrectTerminal_Output");
CorrectTerminalOutputTextID = GameDataBlockBase<TextDataBlock>.GetBlockID("InGame.WardenObjective_Reactor.MeltdownCoolDown.CorrectTerminal_Output");
}
protected override void AddDefinitions(InstanceDefinitionsForLevel<ReactorStartupOverride> definitions)
{
definitions.Definitions.ForEach(delegate(ReactorStartupOverride def)
{
def.Overrides.Sort((WaveOverride o1, WaveOverride o2) => o1.WaveIndex.CompareTo(o2.WaveIndex));
});
base.AddDefinitions(definitions);
}
internal void Build(LG_WardenObjective_Reactor reactor, ReactorStartupOverride def)
{
if (!reactor.m_isWardenObjective)
{
EOSLogger.Error($"ReactorStartup: Reactor Override for reactor {((GlobalZoneIndex)def).GlobalZoneIndexTuple()}, Instance_{((BaseInstanceDefinition)def).InstanceIndex} is not setup by vanilla, won't override");
return;
}
OverrideReactorComp overrideReactorComp = ((Component)reactor).gameObject.AddComponent<OverrideReactorComp>();
overrideReactorComp.ChainedReactor = reactor;
overrideReactorComp.overrideData = def;
overrideReactorComp.UsingLightEffect = false;
overrideReactorComp.Init();
ReactorInstanceManager.Current.MarkAsStartupReactor(reactor);
ReactorInstanceManager.Current.SetupReactorTerminal(reactor, def.ReactorTerminal);
def.ChainedPuzzleToActiveInstance = reactor.m_chainedPuzzleToStartSequence;
_ = (Object)(object)def.ChainedPuzzleToActiveInstance != (Object)null;
builtOverride.Add(def);
EOSLogger.Debug($"ReactorStartup: {((GlobalZoneIndex)def).GlobalZoneIndexTuple()}, Instance_{((BaseInstanceDefinition)def).InstanceIndex}, override completed");
}
private void OnLevelCleanup()
{
builtOverride.ForEach(delegate(ReactorStartupOverride def)
{
def.ChainedPuzzleToActiveInstance = null;
});
builtOverride.Clear();
}
private ReactorStartupOverrideManager()
{
LevelAPI.OnLevelCleanup += OnLevelCleanup;
LevelAPI.OnBuildStart += OnLevelCleanup;
}
static ReactorStartupOverrideManager()
{
SpecialCmdVerifyTextID = 0u;
MainTerminalTextID = 0u;
CooldownCommandDescTextID = 0u;
InfiniteWaveVerifyTextID = 0u;
NotReadyForVerificationOutputTextID = 0u;
IncorrectTerminalOutputTextID = 0u;
CorrectTerminalOutputTextID = 0u;
Current = new ReactorStartupOverrideManager();
EventAPI.OnExpeditionStarted += FetchOverrideTextDB;
}
}
internal class ReactorShutdownObjectiveManager : InstanceDefinitionManager<ReactorShutdownDefinition>
{
private List<ReactorShutdownDefinition> builtShutdownPuzzles = new List<ReactorShutdownDefinition>();
public static ReactorShutdownObjectiveManager Current { get; private set; }
protected override string DEFINITION_NAME => "ReactorShutdown";
private void GenericObjectiveSetup(LG_WardenObjective_Reactor reactor, TerminalDefinition reactorTerminalData)
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
reactor.m_serialNumber = SerialGenerator.GetUniqueSerialNo();
reactor.m_itemKey = "REACTOR_" + reactor.m_serialNumber;
reactor.m_terminalItem = GOUtil.GetInterfaceFromComp<iTerminalItem>(reactor.m_terminalItemComp);
reactor.m_terminalItem.Setup(reactor.m_itemKey, (AIG_CourseNode)null);
reactor.m_terminalItem.FloorItemStatus = EnumUtil.GetRandomValue<eFloorInventoryObjectStatus>();
reactor.m_overrideCodes = Il2CppStringArray.op_Implicit(new string[1] { SerialGenerator.GetCodeWord() });
reactor.m_terminalItem.OnWantDetailedInfo = Func<List<string>, List<string>>.op_Implicit((Func<List<string>, List<string>>)delegate(List<string> defaultDetails)
{
List<string> list = new List<string> { "----------------------------------------------------------------", "MAIN POWER REACTOR" };
Enumerator<string> enumerator = defaultDetails.GetEnumerator();
while (enumerator.MoveNext())
{
string current = enumerator.Current;
list.Add(current);
}
list.Add("----------------------------------------------------------------");
return ListExtensions.ToIl2Cpp<string>(list);
});
reactor.m_terminal = GOUtil.SpawnChildAndGetComp<LG_ComputerTerminal>(reactor.m_terminalPrefab, reactor.m_terminalAlign);
reactor.m_terminal.Setup((TerminalStartStateData)null, (TerminalPlacementData)null);
reactor.m_terminal.ConnectedReactor = reactor;
ReactorInstanceManager.Current.SetupReactorTerminal(reactor, reactorTerminalData);
}
private void OnLateBuildJob(LG_WardenObjective_Reactor reactor, BaseReactorDefinition reactorDefinition)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
reactor.m_stateReplicator = SNet_StateReplicator<pReactorState, pReactorInteraction>.Create(new iSNet_StateReplicatorProvider<pReactorState, pReactorInteraction>(((Il2CppObjectBase)reactor).Pointer), (eSNetReplicatorLifeTime)1, default(pReactorState), (SNet_ChannelType)2);
GenericObjectiveSetup(reactor, reactorDefinition.ReactorTerminal);
reactor.m_sound = new CellSoundPlayer(reactor.m_terminalAlign.position);
reactor.m_sound.Post(EVENTS.REACTOR_POWER_LEVEL_1_LOOP, true);
reactor.m_sound.SetRTPCValue(GAME_PARAMETERS.REACTOR_POWER, 100f);
reactor.m_terminal.m_command.SetupReactorCommands(false, true);
}
internal void Build(LG_WardenObjective_Reactor reactor, ReactorShutdownDefinition def)
{
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Expected O, but got Unknown
//IL_019d: Expected O, but got Unknown
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0273: Unknown result type (might be due to invalid IL or missing references)
//IL_02f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0315: Unknown result type (might be due to invalid IL or missing references)
if (reactor.m_isWardenObjective)
{
EOSLogger.Error($"ReactorShutdown: Reactor definition for reactor {((GlobalZoneIndex)def).GlobalZoneIndexTuple()}, Instance_{((BaseInstanceDefinition)def).InstanceIndex} is already setup by vanilla, won't build.");
return;
}
OnLateBuildJob(reactor, def);
reactor.m_lightCollection = LG_LightCollection.Create(reactor.m_reactorArea.m_courseNode, reactor.m_terminalAlign.position, (LG_LightCollectionSorting)1, float.MaxValue);
reactor.m_lightCollection.SetMode(true);
if (def.PutVerificationCodeOnTerminal)
{
LG_ComputerTerminal instance = ((InstanceManager<LG_ComputerTerminal>)(object)TerminalInstanceManager.Current).GetInstance(((GlobalZoneIndex)def.VerificationCodeTerminal).GlobalZoneIndexTuple(), def.VerificationCodeTerminal.InstanceIndex);
if ((Object)(object)instance == (Object)null)
{
EOSLogger.Error($"ReactorShutdown: PutVerificationCodeOnTerminal is specified but could NOT find terminal {def.VerificationCodeTerminal}, will show verification code upon shutdown initiation");
}
else
{
string fileName = "reactor_ver" + SerialGenerator.GetCodeWordPrefix() + ".log";
TerminalLogFileData val = new TerminalLogFileData
{
FileName = fileName,
FileContent = new LocalizedText
{
UntranslatedText = string.Format(Text.Get(182408469u), ((Il2CppArrayBase<string>)(object)reactor.m_overrideCodes)[0].ToUpperInvariant()),
Id = 0u
}
};
instance.AddLocalLog(val, true);
instance.m_command.ClearOutputQueueAndScreenBuffer();
instance.m_command.AddInitialTerminalOutput();
}
}
if (reactor.SpawnNode != null && reactor.m_terminalItem != null)
{
reactor.m_terminalItem.SpawnNode = reactor.SpawnNode;
reactor.m_terminalItem.FloorItemLocation = reactor.SpawnNode.m_zone.NavInfo.GetFormattedText((LG_NavInfoFormat)7);
}
if (def.ChainedPuzzleToActive != 0)
{
ChainedPuzzleDataBlock block = GameDataBlockBase<ChainedPuzzleDataBlock>.GetBlock(def.ChainedPuzzleToActive);
if (block == null)
{
EOSLogger.Error("ReactorShutdown: ChainedPuzzleToActive is specified but could not find its ChainedPuzzleDatablock definition!");
}
else
{
_ = ((Component)reactor).transform.position;
def.ChainedPuzzleToActiveInstance = ChainedPuzzleManager.CreatePuzzleInstance(block, reactor.SpawnNode.m_area, reactor.m_chainedPuzzleAlign.position, ((Component)reactor).transform);
ChainedPuzzleInstance chainedPuzzleToActiveInstance = def.ChainedPuzzleToActiveInstance;
chainedPuzzleToActiveInstance.OnPuzzleSolved += Action.op_Implicit((Action)delegate
{
if (SNet.IsMaster)
{
reactor.AttemptInteract((eReactorInteraction)6, 0f);
}
});
}
}
else
{
EOSLogger.Debug("ReactorShutdown: Reactor has no ChainedPuzzleToActive, will start shutdown sequence on shutdown command initiation.");
}
if (def.ChainedPuzzleOnVerification != 0)
{
ChainedPuzzleDataBlock block2 = GameDataBlockBase<ChainedPuzzleDataBlock>.GetBlock(def.ChainedPuzzleOnVerification);
if (block2 == null)
{
EOSLogger.Error("ReactorShutdown: ChainedPuzzleOnVerification is specified but could not find its ChainedPuzzleDatablock definition! Will complete shutdown on verification");
}
_ = ((Component)reactor).transform.position;
def.ChainedPuzzleOnVerificationInstance = ChainedPuzzleManager.CreatePuzzleInstance(block2, reactor.SpawnNode.m_area, reactor.m_chainedPuzzleAlign.position, ((Component)reactor).transform);
ChainedPuzzleInstance chainedPuzzleOnVerificationInstance = def.ChainedPuzzleOnVerificationInstance;
chainedPuzzleOnVerificationInstance.OnPuzzleSolved += Action.op_Implicit((Action)delegate
{
if (SNet.IsMaster)
{
reactor.AttemptInteract((eReactorInteraction)9, 0f);
}
});
}
else
{
EOSLogger.Debug("ReactorShutdown: ChainedPuzzleOnVerification unspecified, will complete shutdown on verification.");
}
LG_ComputerTerminal terminal = reactor.m_terminal;
iLG_SpawnedInNodeHandler val2 = ((terminal != null) ? ((Component)terminal).GetComponent<iLG_SpawnedInNodeHandler>() : null);
if (val2 != null)
{
val2.SpawnNode = reactor.SpawnNode;
}
reactor.SetLightsEnabled(reactor.m_lightsWhenOff, false);
reactor.SetLightsEnabled(reactor.m_lightsWhenOn, true);
builtShutdownPuzzles.Add(def);
ReactorInstanceManager.Current.MarkAsShutdownReactor(reactor);
EOSLogger.Debug($"ReactorShutdown: {((GlobalZoneIndex)def).GlobalZoneIndexTuple()}, Instance_{((BaseInstanceDefinition)def).InstanceIndex}, custom setup completed");
}
private void OnLevelCleanup()
{
builtShutdownPuzzles.ForEach(delegate(ReactorShutdownDefinition def)
{
ChainedPuzzleInstance chainedPuzzleOnVerificationInstance = (def.ChainedPuzzleToActiveInstance = null);
def.ChainedPuzzleOnVerificationInstance = chainedPuzzleOnVerificationInstance;
});
builtShutdownPuzzles.Clear();
}
private ReactorShutdownObjectiveManager()
{
LevelAPI.OnLevelCleanup += OnLevelCleanup;
LevelAPI.OnBuildStart += OnLevelCleanup;
}
static ReactorShutdownObjectiveManager()
{
Current = new ReactorShutdownObjectiveManager();
}
}
}
namespace EOSExt.Reactor.Definition
{
public enum EOSReactorVerificationType
{
NORMAL,
BY_SPECIAL_COMMAND,
BY_WARDEN_EVENT
}
public class WaveOverride
{
public int WaveIndex { get; set; } = -1;
public EOSReactorVerificationType VerificationType { get; set; }
public bool HideVerificationTimer { get; set; }
public bool ChangeVerifyZone { get; set; }
public BaseInstanceDefinition VerifyZone { get; set; } = new BaseInstanceDefinition();
public bool UseCustomVerifyText { get; set; }
public LocalizedText VerifySequenceText { get; set; }
[JsonIgnore]
public LG_ComputerTerminal VerifyTerminal { get; set; }
}
public class ReactorStartupOverride : BaseReactorDefinition
{
public bool StartupOnDrop { get; set; }
[JsonIgnore]
public WardenObjectiveDataBlock ObjectiveDB { get; set; }
public List<WaveOverride> Overrides { get; set; } = new List<WaveOverride>
{
new WaveOverride()
};
}
internal class WardenEvents
{
public enum EventType
{
ReactorStartup = 150,
CompleteCurrentVerify
}
internal static void ReactorStartup(WardenObjectiveEventData e)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Invalid comparison between Unknown and I4
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
if (!SNet.IsMaster)
{
return;
}
LG_WardenObjective_Reactor val = ReactorInstanceManager.FindVanillaReactor(e.Layer, e.Count);
WardenObjectiveDataBlock val2 = default(WardenObjectiveDataBlock);
if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(e.Layer, ref val2) || val2 == null)
{
EOSLogger.Error("CompleteCurrentReactorWave: Cannot get WardenObjectiveDataBlock");
return;
}
if ((int)val2.Type != 1)
{
EOSLogger.Error($"CompleteCurrentReactorWave: {e.Layer} is not ReactorStartup. CompleteCurrentReactorWave is invalid.");
return;
}
if ((Object)(object)val == (Object)null)
{
EOSLogger.Error($"ReactorStartup: Cannot find reactor in {e.Layer}.");
return;
}
if ((int)val.m_currentState.status == 0)
{
if (SNet.IsMaster)
{
val.AttemptInteract((eReactorInteraction)0, 0f);
}
val.m_terminal.TrySyncSetCommandHidden((TERM_Command)21);
}
EOSLogger.Debug($"ReactorStartup: Current reactor wave for {e.Layer} completed");
}
internal static void CompleteCurrentVerify(WardenObjectiveEventData e)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Invalid comparison between Unknown and I4
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
WardenObjectiveDataBlock val = default(WardenObjectiveDataBlock);
if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(e.Layer, ref val) || val == null)
{
EOSLogger.Error("CompleteCurrentReactorWave: Cannot get WardenObjectiveDataBlock");
return;
}
if ((int)val.Type != 1)
{
EOSLogger.Error($"CompleteCurrentReactorWave: {e.Layer} is not ReactorStartup. CompleteCurrentReactorWave is invalid.");
return;
}
LG_WardenObjective_Reactor val2 = ReactorInstanceManager.FindVanillaReactor(e.Layer, e.Count);
if ((Object)(object)val2 == (Object)null)
{
EOSLogger.Error($"CompleteCurrentReactorWave: Cannot find reactor in {e.Layer}.");
return;
}
if (SNet.IsMaster)
{
if (val2.m_currentWaveCount == val2.m_waveCountMax)
{
val2.AttemptInteract((eReactorInteraction)5, 0f);
}
else
{
val2.AttemptInteract((eReactorInteraction)3, 0f);
}
}
else
{
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(val2.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)3, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null);
}
EOSLogger.Debug($"CompleteCurrentReactorWave: Current reactor verify for {e.Layer} completed");
}
}
public class BaseReactorDefinition : BaseInstanceDefinition
{
[JsonPropertyOrder(-9)]
public TerminalDefinition ReactorTerminal { get; set; } = new TerminalDefinition();
[JsonPropertyOrder(-9)]
public List<WardenObjectiveEventData> EventsOnActive { get; set; } = new List<WardenObjectiveEventData>();
[JsonIgnore]
public ChainedPuzzleInstance ChainedPuzzleToActiveInstance { get; set; }
}
public class ReactorShutdownDefinition : BaseReactorDefinition
{
[JsonPropertyOrder(-9)]
public uint ChainedPuzzleToActive { get; set; }
public bool PutVerificationCodeOnTerminal { get; set; }
public BaseInstanceDefinition VerificationCodeTerminal { get; set; } = new BaseInstanceDefinition();
public uint ChainedPuzzleOnVerification { get; set; }
[JsonIgnore]
public ChainedPuzzleInstance ChainedPuzzleOnVerificationInstance { get; set; }
public List<WardenObjectiveEventData> EventsOnShutdownPuzzleStarts { get; set; } = new List<WardenObjectiveEventData>();
public List<WardenObjectiveEventData> EventsOnComplete { get; set; } = new List<WardenObjectiveEventData>();
}
}
namespace EOSExt.Reactor.Component
{
public class OverrideReactorComp : MonoBehaviour
{
private static Color LowTemperature;
private static Color HighTemperature;
private LG_Light[] _lights;
private float _updateTimer;
private List<WaveOverride> WaveData = new List<WaveOverride>();
public LG_WardenObjective_Reactor ChainedReactor { get; internal set; }
public ReactorStartupOverride overrideData { get; internal set; }
public bool UsingLightEffect { get; set; } = true;
public WardenObjectiveDataBlock ObjectiveData => overrideData?.ObjectiveDB;
public void Init()
{
if ((Object)(object)ChainedReactor == (Object)null || overrideData == null)
{
EOSLogger.Error("ReactorOverride not properly initialized!");
return;
}
foreach (WaveOverride @override in overrideData.Overrides)
{
int waveIndex = @override.WaveIndex;
for (int i = ((WaveData.Count > 0) ? WaveData.Last().WaveIndex : (-1)) + 1; i < waveIndex; i++)
{
WaveData.Add(new WaveOverride
{
WaveIndex = i
});
}
WaveData.Add(@override);
}
for (int j = ((WaveData.Count > 0) ? WaveData.Last().WaveIndex : (-1)) + 1; j < ChainedReactor.m_waveCountMax; j++)
{
WaveData.Add(new WaveOverride
{
WaveIndex = j
});
}
if (WaveData.Count != ObjectiveData.ReactorWaves.Count)
{
EOSLogger.Error($"WaveData.Count({WaveData.Count}) != ObjectiveData.ReactorWaves.Count({ObjectiveData.ReactorWaves.Count})");
}
LevelAPI.OnEnterLevel += OnEnterLevel;
}
private void OnEnterLevel()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Invalid comparison between Unknown and I4
LG_WardenObjective_Reactor chainedReactor = ChainedReactor;
LG_ComputerTerminal terminal = ChainedReactor.m_terminal;
if ((int)ObjectiveData.Type != 1)
{
EOSLogger.Error("Only Reactor Startup is supported");
((Behaviour)this).enabled = false;
return;
}
if (UsingLightEffect)
{
_lights = ((IEnumerable<LG_Light>)chainedReactor.SpawnNode.m_lightsInNode).Where((LG_Light x) => (int)x.m_category == 3).ToArray();
chainedReactor.m_lightCollection.RemoveLights(Il2CppReferenceArray<LG_Light>.op_Implicit(_lights));
}
if (overrideData.StartupOnDrop && SNet.IsMaster)
{
chainedReactor.AttemptInteract((eReactorInteraction)0, 0f);
terminal.TrySyncSetCommandHidden((TERM_Command)21);
}
SetupVerifyZoneOverrides();
SetupWaves();
}
private void SetupVerifyZoneOverrides()
{
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
//IL_03db: Unknown result type (might be due to invalid IL or missing references)
//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
//IL_0411: Unknown result type (might be due to invalid IL or missing references)
//IL_041d: Expected O, but got Unknown
//IL_041f: Expected O, but got Unknown
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
LG_Zone val = default(LG_Zone);
foreach (WaveOverride waveDatum in WaveData)
{
if (!waveDatum.ChangeVerifyZone)
{
continue;
}
if (waveDatum.VerificationType == EOSReactorVerificationType.BY_WARDEN_EVENT)
{
EOSLogger.Error($"VerifyZoneOverrides: Wave_{waveDatum.WaveIndex} - Verification Type is {2}, which doesn't work with VerifyZoneOverride");
continue;
}
BaseInstanceDefinition verifyZone = waveDatum.VerifyZone;
if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(((GlobalZoneIndex)verifyZone).DimensionIndex, ((GlobalZoneIndex)verifyZone).LayerType, ((GlobalZoneIndex)verifyZone).LocalIndex, ref val) || (Object)(object)val == (Object)null)
{
EOSLogger.Error($"VerifyZoneOverrides: Wave_{waveDatum.WaveIndex} - Cannot find target zone {((GlobalZoneIndex)verifyZone).GlobalZoneIndexTuple()}.");
continue;
}
if (val.TerminalsSpawnedInZone == null || val.TerminalsSpawnedInZone.Count <= 0)
{
EOSLogger.Error($"VerifyZoneOverrides: No spawned terminal found in target zone {((GlobalZoneIndex)verifyZone).GlobalZoneIndexTuple()}.");
continue;
}
LG_ComputerTerminal val2 = null;
if (verifyZone.InstanceIndex >= 0)
{
val2 = ((InstanceManager<LG_ComputerTerminal>)(object)TerminalInstanceManager.Current).GetInstance(((GlobalZoneIndex)verifyZone).GlobalZoneIndexTuple(), verifyZone.InstanceIndex);
}
else
{
List<LG_ComputerTerminal> instancesInZone = ((InstanceManager<LG_ComputerTerminal>)(object)TerminalInstanceManager.Current).GetInstancesInZone(((GlobalZoneIndex)verifyZone).GlobalZoneIndexTuple());
int index = Builder.SessionSeedRandom.Range(0, instancesInZone.Count, "NO_TAG");
val2 = instancesInZone[index];
}
if ((Object)(object)val2 == (Object)null)
{
EOSLogger.Error($"VerifyZoneOverride: cannot find target terminal with Terminal Instance Index: {waveDatum}");
}
waveDatum.VerifyTerminal = val2;
ReactorWaveData waveData = ObjectiveData.ReactorWaves[waveDatum.WaveIndex];
TerminalLogFileData val3 = null;
if (waveData.VerifyInOtherZone)
{
List<LG_ComputerTerminal> list = EOSTerminalUtils.FindTerminal(ChainedReactor.SpawnNode.m_dimension.DimensionIndex, ChainedReactor.SpawnNode.LayerType, waveData.ZoneForVerification, (Predicate<LG_ComputerTerminal>)((LG_ComputerTerminal x) => x.ItemKey == waveData.VerificationTerminalSerial));
if (list == null || list.Count < 1)
{
EOSLogger.Error($"Wave_{waveDatum.WaveIndex}: cannot find vanilla verification terminal in {(ChainedReactor.SpawnNode.m_dimension.DimensionIndex, ChainedReactor.SpawnNode.LayerType, waveData.ZoneForVerification)}, unable to override");
continue;
}
LG_ComputerTerminal val4 = list[0];
if ((Object)(object)val4 == (Object)null)
{
EOSLogger.Error($"VerifyZoneOverrides: Wave_{waveDatum.WaveIndex} - Cannot find log terminal");
continue;
}
string text = waveData.VerificationTerminalFileName.ToUpperInvariant();
val3 = EOSTerminalUtils.GetLocalLog(val4, text);
if (val3 == null)
{
EOSLogger.Error("VerifyZoneOverrides: Cannot find vanilla-generated reactor verify log on terminal...");
continue;
}
val4.RemoveLocalLog(text);
EOSTerminalUtils.ResetInitialOutput(val4);
}
else
{
waveData.VerificationTerminalFileName = "reactor_ver" + SerialGenerator.GetCodeWordPrefix() + ".log";
val3 = new TerminalLogFileData
{
FileName = waveData.VerificationTerminalFileName,
FileContent = new LocalizedText
{
UntranslatedText = string.Format(Text.Get(182408469u), ((Il2CppArrayBase<string>)(object)ChainedReactor.m_overrideCodes)[waveDatum.WaveIndex].ToUpper()),
Id = 0u
}
};
EOSLogger.Debug($"VerifyZoneOverrides: Wave_{waveDatum.WaveIndex} - Log generated.");
}
waveData.HasVerificationTerminal = true;
waveData.VerificationTerminalSerial = val2.ItemKey;
val2.AddLocalLog(val3, true);
EOSTerminalUtils.ResetInitialOutput(val2);
EOSLogger.Debug($"VerifyZoneOverrides: Wave_{waveDatum.WaveIndex} verification overriden");
}
}
private void SetupWaves()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
LG_WardenObjective_Reactor chainedReactor = ChainedReactor;
eDimensionIndex dimensionIndex = chainedReactor.SpawnNode.m_dimension.DimensionIndex;
LG_LayerType layerType = chainedReactor.SpawnNode.LayerType;
int num = 0;
for (int i = 0; i < WaveData.Count; i++)
{
ReactorWaveData reactorWave = ObjectiveData.ReactorWaves[i];
WaveOverride waveOverride = WaveData[i];
switch (waveOverride.VerificationType)
{
case EOSReactorVerificationType.BY_SPECIAL_COMMAND:
if (!reactorWave.HasVerificationTerminal)
{
waveOverride.VerifyTerminal = ChainedReactor.m_terminal;
AddVerifyCommand(ChainedReactor.m_terminal);
}
else
{
LG_ComputerTerminal val = waveOverride.VerifyTerminal;
if ((Object)(object)val == (Object)null)
{
val = EOSTerminalUtils.FindTerminal(dimensionIndex, layerType, reactorWave.ZoneForVerification, (Predicate<LG_ComputerTerminal>)((LG_ComputerTerminal terminal) => terminal.ItemKey.Equals(reactorWave.VerificationTerminalSerial, StringComparison.InvariantCultureIgnoreCase)))?[0];
if ((Object)(object)val == (Object)null)
{
EOSLogger.Error($"SetupWaves: cannot find verify terminal for Wave_{i}, skipped");
break;
}
waveOverride.VerifyTerminal = val;
}
val.ConnectedReactor = chainedReactor;
val.RemoveLocalLog(reactorWave.VerificationTerminalFileName.ToUpperInvariant());
AddVerifyCommand(val);
EOSTerminalUtils.ResetInitialOutput(val);
}
num++;
EOSLogger.Debug($"WaveOverride: Setup as Wave Verification {1} for Wave_{i}");
break;
default:
EOSLogger.Error($"Unimplemented Verification Type {waveOverride.VerificationType}");
break;
case EOSReactorVerificationType.NORMAL:
case EOSReactorVerificationType.BY_WARDEN_EVENT:
break;
}
}
if (num == ObjectiveData.ReactorWaves.Count)
{
ChainedReactor.m_terminal.TrySyncSetCommandHidden((TERM_Command)22);
}
}
private void AddVerifyCommand(LG_ComputerTerminal terminal)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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_0041: Expected O, but got Unknown
LG_ComputerTerminalCommandInterpreter command = terminal.m_command;
if (command.HasRegisteredCommand((TERM_Command)42))
{
EOSLogger.Debug("TERM_Command.UniqueCommand5 already registered. If this terminal is specified as objective terminal for 2 waves and the number of commands in 'UniqueCommands' on this terminal isn't more than 4, simply ignore this message.");
return;
}
command.AddCommand((TERM_Command)42, "REACTOR_COOLDOWN", new LocalizedText
{
UntranslatedText = ReactorStartupOverrideManager.CoolDownCommandDesc,
Id = 0u
}, (TERM_CommandRule)0);
terminal.TrySyncSetCommandRule((TERM_Command)42, (TERM_CommandRule)0);
}
public bool IsCorrectTerminal(LG_ComputerTerminal terminal)
{
int num = ChainedReactor.m_currentWaveCount - 1;
if (num >= 0)
{
EOSLogger.Debug($"Index: {num}");
EOSLogger.Debug("Comp Terminal Key1: " + terminal.ItemKey);
EOSLogger.Debug("Comp Terminal Key2: " + (((Object)(object)WaveData[num].VerifyTerminal != (Object)null) ? WaveData[num].VerifyTerminal.ItemKey : "empty"));
if (WaveData[num].VerifyTerminal.ItemKey != null && WaveData[num].VerifyTerminal.ItemKey.Equals(terminal.ItemKey, StringComparison.InvariantCultureIgnoreCase))
{
return true;
}
}
return false;
}
public void SetIdle()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: 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)
if (!((Object)(object)ChainedReactor == (Object)null))
{
pReactorState val = default(pReactorState);
val.status = (eReactorStatus)0;
val.stateCount = 0;
val.stateProgress = 0f;
val.verifyFailed = false;
pReactorState state = val;
ChainedReactor.m_stateReplicator.State = state;
}
}
private void OnDestroy()
{
LevelAPI.OnEnterLevel -= OnEnterLevel;
ChainedReactor = null;
overrideData = null;
}
private void LateUpdate()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
if ((int)GameStateManager.CurrentStateName == 10)
{
eReactorStatus status = ChainedReactor.m_currentState.status;
if (UsingLightEffect)
{
UpdateLight(status, ChainedReactor.m_currentWaveProgress);
}
UpdateGUIText(status);
}
}
private void UpdateGUIText(eReactorStatus status)
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Invalid comparison between Unknown and I4
int num = ChainedReactor.m_currentWaveCount - 1;
if (num < 0 || num >= ChainedReactor.m_waveCountMax)
{
return;
}
WaveOverride waveOverride = WaveData[num];
string format = string.Empty;
if (waveOverride.UseCustomVerifyText)
{
format = ((waveOverride.VerifySequenceText.Id != 0) ? Text.Get(waveOverride.VerifySequenceText.Id) : waveOverride.VerifySequenceText.UntranslatedText);
}
if ((int)status != 4)
{
return;
}
switch (waveOverride.VerificationType)
{
case EOSReactorVerificationType.NORMAL:
if (ChainedReactor.m_currentWaveData.HasVerificationTerminal)
{
if (!waveOverride.UseCustomVerifyText)
{
format = Text.Get(1103u);
}
ChainedReactor.SetGUIMessage(true, string.Format(format, ChainedReactor.m_currentWaveCount, ChainedReactor.m_waveCountMax, "<color=orange>" + ChainedReactor.m_currentWaveData.VerificationTerminalSerial + "</color>"), (ePUIMessageStyle)3, !waveOverride.HideVerificationTimer, "<size=125%>" + Text.Get(1104u), "</size>");
}
else
{
if (!waveOverride.UseCustomVerifyText)
{
format = Text.Get(1105u);
}
ChainedReactor.SetGUIMessage(true, string.Format(format, ChainedReactor.m_currentWaveCount, ChainedReactor.m_waveCountMax, "<color=orange>" + ChainedReactor.CurrentStateOverrideCode + "</color>"), (ePUIMessageStyle)3, !waveOverride.HideVerificationTimer, "<size=125%>" + Text.Get(1104u), "</size>");
}
break;
case EOSReactorVerificationType.BY_SPECIAL_COMMAND:
{
string text = (ChainedReactor.m_currentWaveData.HasVerificationTerminal ? ChainedReactor.m_currentWaveData.VerificationTerminalSerial : ReactorStartupOverrideManager.MainTerminalText);
if (!waveOverride.UseCustomVerifyText)
{
format = ReactorStartupOverrideManager.SpecialCmdVerifyText;
}
ChainedReactor.SetGUIMessage(true, string.Format(format, ChainedReactor.m_currentWaveCount, ChainedReactor.m_waveCountMax, "<color=orange>" + text + "</color>"), (ePUIMessageStyle)3, !waveOverride.HideVerificationTimer, "<size=125%>" + Text.Get(1104u), "</size>");
break;
}
case EOSReactorVerificationType.BY_WARDEN_EVENT:
if (!waveOverride.UseCustomVerifyText)
{
format = ReactorStartupOverrideManager.InfiniteWaveVerifyText;
}
ChainedReactor.SetGUIMessage(true, string.Format(format, ChainedReactor.m_currentWaveCount, ChainedReactor.m_waveCountMax), (ePUIMessageStyle)3, !waveOverride.HideVerificationTimer, "<size=125%>" + Text.Get(1104u), "</size>");
break;
}
}
private void UpdateLight(eReactorStatus status, float progress)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected I4, but got Unknown
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: 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_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
if (!(_updateTimer > Clock.Time))
{
_updateTimer = Clock.Time + 0.15f;
switch (status - 1)
{
case 0:
SetLightColor(Color.black);
break;
case 1:
SetLightColor(Color.Lerp(LowTemperature, HighTemperature, progress));
break;
case 2:
SetLightColor(Color.Lerp(HighTemperature, LowTemperature, progress));
break;
case 3:
SetLightColor(LowTemperature);
break;
case 4:
SetLightColor(LowTemperature);
break;
}
}
}
private void SetLightColor(Color color)
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
if (UsingLightEffect && _lights != null)
{
for (int i = 0; i < _lights.Length; i++)
{
_lights[i].ChangeColor(color);
}
}
}
static OverrideReactorComp()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: 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_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
LowTemperature = ColorExt.Hex("#23E4F2") * 2.5f;
HighTemperature = ColorExt.Hex("#F63838") * 12f;
}
}
}using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using EOSExt.SecDoor.Definition;
using ExtraObjectiveSetup.BaseClasses;
using ExtraObjectiveSetup.Utils;
using GTFO.API;
using GameData;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppSystem;
using Il2CppSystem.Text;
using LevelGeneration;
using Localization;
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("Inas07.EOSExt.SecDoor")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Inas07.EOSExt.SecDoor")]
[assembly: AssemblyTitle("Inas07.EOSExt.SecDoor")]
[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 EOSExt.SecDoor
{
public class InteractGlitchManager : MonoBehaviour
{
private const string HEX_CHARPOOL = "0123456789ABCDEF";
private const string ERR_CHARPOOL = "$#/-01";
private Random Random = new Random();
private float _Timer;
private uint START_SECURITY_SCAN_SEQUENCE_TEXT_ID;
private uint HOLD_TEXT_ID;
private uint SCAN_UNKNOWN_TEXT_DB;
public static InteractGlitchManager Current { get; }
internal bool Enabled { get; set; }
internal bool CanInteract { get; set; }
private StringBuilder _StrBuilder { get; } = new StringBuilder();
internal GlitchMode Mode { get; set; }
private Dictionary<IntPtr, LG_SecurityDoor> DoorLocks { get; } = new Dictionary<IntPtr, LG_SecurityDoor>();
private void Update()
{
if (Enabled && !(_Timer > Clock.Time) && GuiManager.InteractionLayer != null && Mode != 0)
{
switch (Mode)
{
case GlitchMode.Style1:
GuiManager.InteractionLayer.SetInteractPrompt(GetFormat1(), CanInteract ? Text.Format(HOLD_TEXT_ID, (Object[])(object)new Object[1] { Object.op_Implicit(InputMapper.GetBindingName((InputAction)6)) }) : string.Empty, (ePUIMessageStyle)0);
GuiManager.InteractionLayer.InteractPromptVisible = true;
_Timer = Clock.Time + 0.05f;
break;
case GlitchMode.Style2:
{
string format = GetFormat2(Text.Get(START_SECURITY_SCAN_SEQUENCE_TEXT_ID));
string format2 = GetFormat2(Text.Get(SCAN_UNKNOWN_TEXT_DB));
GuiManager.InteractionLayer.SetInteractPrompt(format + "<color=red>" + format2 + "</color>", CanInteract ? Text.Format(HOLD_TEXT_ID, (Object[])(object)new Object[1] { Object.op_Implicit(InputMapper.GetBindingName((InputAction)6)) }) : string.Empty, (ePUIMessageStyle)0);
GuiManager.InteractionLayer.InteractPromptVisible = true;
_Timer = Clock.Time + 0.075f;
break;
}
}
}
}
private string GetFormat1()
{
return "<color=red>://Decryption E_RR at: [" + GetRandomHex() + GetRandomHex() + "-" + GetRandomHex() + GetRandomHex() + "-" + GetRandomHex() + GetRandomHex() + "-" + GetRandomHex() + GetRandomHex() + "]</color>";
}
private string GetFormat2(string baseMessage)
{
_StrBuilder.Clear();
foreach (char c in baseMessage)
{
if (Random.NextDouble() > 0.009999999776482582 || c == ':')
{
_StrBuilder.Append(c);
}
else
{
_StrBuilder.Append("$#/-01"[Random.Next(0, "$#/-01".Length)]);
}
}
return _StrBuilder.ToString();
}
private string GetRandomHex()
{
return string.Format("{0}{1}", "0123456789ABCDEF"[Random.Next(0, "0123456789ABCDEF".Length)], "0123456789ABCDEF"[Random.Next(0, "0123456789ABCDEF".Length)]);
}
internal void RegisterDoorLocks(LG_SecurityDoor_Locks locks)
{
DoorLocks[((Il2CppObjectBase)locks.m_intCustomMessage).Pointer] = locks.m_door;
DoorLocks[((Il2CppObjectBase)locks.m_intOpenDoor).Pointer] = locks.m_door;
}
public GlitchMode GetGlitchMode(Interact_Base interact)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: 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_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: 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)
if (!DoorLocks.TryGetValue(((Il2CppObjectBase)interact).Pointer, out var value))
{
return GlitchMode.None;
}
eDimensionIndex dimensionIndex = value.Gate.DimensionIndex;
LG_LayerType linksToLayerType = value.LinksToLayerType;
eLocalZoneIndex localIndex = value.LinkedToZoneData.LocalIndex;
return ((ZoneDefinitionManager<SecDoorIntTextOverride>)SecDoorIntTextOverrideManager.Current).GetDefinition(dimensionIndex, linksToLayerType, localIndex)?.GlitchMode ?? GlitchMode.None;
}
private void Clear()
{
DoorLocks.Clear();
}
private InteractGlitchManager()
{
START_SECURITY_SCAN_SEQUENCE_TEXT_ID = ((GameDataBlockBase<TextDataBlock>)(object)GameDataBlockBase<TextDataBlock>.GetBlock("InGame.InteractionPrompt.SecurityDoor.StartSecurityScanSequence"))?.persistentID ?? 0;
HOLD_TEXT_ID = ((GameDataBlockBase<TextDataBlock>)(object)GameDataBlockBase<TextDataBlock>.GetBlock("InGame.InteractionPrompt.Hold_X"))?.persistentID ?? 0;
SCAN_UNKNOWN_TEXT_DB = ((GameDataBlockBase<TextDataBlock>)(object)GameDataBlockBase<TextDataBlock>.GetBlock("InGame.InteractionPrompt.SecurityDoor.StartSecurityScanSequence_ScanUnknown"))?.persistentID ?? 0;
LevelAPI.OnBuildStart += Clear;
LevelAPI.OnLevelCleanup += Clear;
}
static InteractGlitchManager()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
ClassInjector.RegisterTypeInIl2Cpp<InteractGlitchManager>();
GameObject val = new GameObject("CONST_InteractGlitchManager");
Object.DontDestroyOnLoad((Object)(object)val);
Current = val.AddComponent<InteractGlitchManager>();
}
}
public class SecDoorIntTextOverrideManager : ZoneDefinitionManager<SecDoorIntTextOverride>
{
public static SecDoorIntTextOverrideManager Current { get; }
protected override string DEFINITION_NAME => "SecDoorIntText";
private SecDoorIntTextOverrideManager()
{
}
static SecDoorIntTextOverrideManager()
{
Current = new SecDoorIntTextOverrideManager();
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Inas.EOSExt.SecDoor", "EOSExt.SecDoor", "1.0.0")]
public class EntryPoint : BasePlugin
{
public const string AUTHOR = "Inas";
public const string PLUGIN_NAME = "EOSExt.SecDoor";
public const string VERSION = "1.0.0";
private Harmony m_Harmony;
public override void Load()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
SetupManagers();
m_Harmony = new Harmony("EOSExt.SecDoor");
m_Harmony.PatchAll();
EOSLogger.Log("ExtraObjectiveSetup.SecDoor loaded.");
}
private void SetupManagers()
{
((ZoneDefinitionManager<SecDoorIntTextOverride>)SecDoorIntTextOverrideManager.Current).Init();
}
}
}
namespace EOSExt.SecDoor.Patches
{
[HarmonyPatch]
internal class CustomizeSecDoorInteractionText
{
[HarmonyPostfix]
[HarmonyPatch(typeof(LG_SecurityDoor), "Setup")]
private static void Post_Customize_SecDoor_Interaction_Text(LG_SecurityDoor __instance)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: 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_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
eDimensionIndex dimensionIndex = __instance.Gate.DimensionIndex;
LG_LayerType linksToLayerType = __instance.LinksToLayerType;
eLocalZoneIndex localIndex = __instance.LinkedToZoneData.LocalIndex;
SecDoorIntTextOverride def = ((ZoneDefinitionManager<SecDoorIntTextOverride>)SecDoorIntTextOverrideManager.Current).GetDefinition(dimensionIndex, linksToLayerType, localIndex);
LG_SecurityDoor_Locks obj = ((Il2CppObjectBase)__instance.m_locks).Cast<LG_SecurityDoor_Locks>();
Interact_Timed intOpenDoor = ((obj != null) ? obj.m_intOpenDoor : null);
if ((Object)(object)intOpenDoor == (Object)null || def == null || def.GlitchMode != 0)
{
return;
}
__instance.m_sync.OnDoorStateChange += Action<pDoorState, bool>.op_Implicit((Action<pDoorState, bool>)delegate
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
string text = (string.IsNullOrEmpty(LocalizedText.op_Implicit(def.TextToReplace)) ? intOpenDoor.InteractionMessage : LocalizedText.op_Implicit(def.TextToReplace));
StringBuilder val = new StringBuilder();
if (!string.IsNullOrEmpty(LocalizedText.op_Implicit(def.Prefix)))
{
val.Append(LocalizedText.op_Implicit(def.Prefix)).AppendLine();
}
val.Append(text);
if (!string.IsNullOrEmpty(LocalizedText.op_Implicit(def.Postfix)))
{
val.AppendLine().Append(LocalizedText.op_Implicit(def.Postfix));
}
intOpenDoor.InteractionMessage = ((Object)val).ToString();
EOSLogger.Debug($"SecDoorIntTextOverride: Override IntText. {((GlobalZoneIndex)def).LocalIndex}, {((GlobalZoneIndex)def).LayerType}, {((GlobalZoneIndex)def).DimensionIndex}");
});
}
}
[HarmonyPatch]
internal class InteractGlitch
{
[HarmonyPostfix]
[HarmonyPatch(typeof(Interact_Timed), "OnSelectedChange")]
private static void Post_Interact_Timed_OnSelectedChange(Interact_Timed __instance, bool selected)
{
Handle((Interact_Base)(object)__instance, selected, canInteract: true);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Interact_MessageOnScreen), "OnSelectedChange")]
private static void Post_Interact_MessageOnScreen_OnSelectedChange(Interact_MessageOnScreen __instance, bool selected)
{
Handle((Interact_Base)(object)__instance, selected, canInteract: false);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(LG_SecurityDoor_Locks), "Setup", new Type[] { typeof(LG_SecurityDoor) })]
private static void Post_LG_SecurityDoor_Locks_Setup(LG_SecurityDoor_Locks __instance, LG_SecurityDoor door)
{
InteractGlitchManager.Current.RegisterDoorLocks(__instance);
}
private static void Handle(Interact_Base interact, bool selected, bool canInteract)
{
if (selected)
{
if (!((Object)(object)interact == (Object)null))
{
switch (InteractGlitchManager.Current.GetGlitchMode(interact))
{
case GlitchMode.Style1:
InteractGlitchManager.Current.Enabled = true;
InteractGlitchManager.Current.CanInteract = canInteract;
InteractGlitchManager.Current.Mode = GlitchMode.Style1;
GuiManager.InteractionLayer.InteractPromptVisible = false;
break;
case GlitchMode.Style2:
InteractGlitchManager.Current.Enabled = true;
InteractGlitchManager.Current.CanInteract = canInteract;
InteractGlitchManager.Current.Mode = GlitchMode.Style2;
GuiManager.InteractionLayer.InteractPromptVisible = false;
break;
}
}
}
else
{
InteractGlitchManager.Current.Enabled = false;
}
}
}
}
namespace EOSExt.SecDoor.Definition
{
public enum GlitchMode
{
None,
Style1,
Style2
}
public class SecDoorIntTextOverride : GlobalZoneIndex
{
public LocalizedText Prefix { get; set; } = null;
public LocalizedText Postfix { get; set; } = null;
public LocalizedText TextToReplace { get; set; } = null;
public GlitchMode GlitchMode { get; set; } = GlitchMode.None;
}
}using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AIGraph;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Unity.IL2CPP;
using ChainedPuzzles;
using EOSExt.ExtraDoor;
using EOSExt.SecurityDoorTerminal.Definition;
using ExtraObjectiveSetup;
using ExtraObjectiveSetup.BaseClasses;
using ExtraObjectiveSetup.BaseClasses.CustomTerminalDefinition;
using ExtraObjectiveSetup.ExtendedWardenEvents;
using ExtraObjectiveSetup.Utils;
using GTFO.API;
using GTFO.API.Extensions;
using GameData;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppSystem;
using LevelGeneration;
using Localization;
using Microsoft.CodeAnalysis;
using Player;
using SecDoorTerminalInterface;
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("Inas07.EOSExt.SecurityDoorTerminal")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+3d85c1a0a8e16d4a4f23de04978fc55ad957e373")]
[assembly: AssemblyProduct("Inas07.EOSExt.SecurityDoorTerminal")]
[assembly: AssemblyTitle("Inas07.EOSExt.SecurityDoorTerminal")]
[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 EOSExt.SecurityDoorTerminal
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Inas.EOSExt.SecurityDoorTerminal", "EOSExt.SecurityDoorTerminal", "1.1.2")]
public class EntryPoint : BasePlugin
{
public const string AUTHOR = "Inas";
public const string PLUGIN_NAME = "EOSExt.SecurityDoorTerminal";
public const string VERSION = "1.1.2";
public override void Load()
{
SetupManagers();
EOSLogger.Log("ExtraObjectiveSetup.SecurityDoorTerminal loaded.");
}
private void SetupManagers()
{
((ZoneDefinitionManager<SecurityDoorTerminalDefinition>)SecurityDoorTerminalManager.Current).Init();
}
}
public static class ExtraDoorUtils
{
public const string PLUGIN_NAME = "Inas.EOSExt.ExtraDoor";
public static bool PluginLoaded => ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.ContainsKey("Inas.EOSExt.ExtraDoor");
public static LG_SecurityDoor GetFCDoor(string worldEventObjectFilter)
{
if (!PluginLoaded)
{
EOSLogger.Error("ExtraDoorUtils: plugin not loaded");
return null;
}
return DoGetFCDoor(worldEventObjectFilter);
}
private static LG_SecurityDoor DoGetFCDoor(string worldEventObjectFilter)
{
return ForceConnectManager.Current.GetFCDoor(worldEventObjectFilter);
}
}
public sealed class SecurityDoorTerminalManager : ZoneDefinitionManager<SecurityDoorTerminalDefinition>
{
private enum SDTWardenEvents
{
ADD_OVERRIDE_COMMAND = 1000
}
private const string OVERRIDE_COMMAND = "ACCESS_OVERRIDE";
private List<(SecDoorTerminal sdt, SecurityDoorTerminalDefinition def)> levelSDTs = new List<(SecDoorTerminal, SecurityDoorTerminalDefinition)>();
public static SecurityDoorTerminalManager Current { get; private set; }
protected override string DEFINITION_NAME => "SecDoorTerminal";
public bool TryGetZoneEntranceSecDoor(LG_Zone zone, out LG_SecurityDoor door)
{
if ((Object)(object)zone == (Object)null)
{
door = null;
return false;
}
if ((Object)(object)zone.m_sourceGate == (Object)null)
{
door = null;
return false;
}
if (zone.m_sourceGate.SpawnedDoor == null)
{
door = null;
return false;
}
door = ((Il2CppObjectBase)zone.m_sourceGate.SpawnedDoor).TryCast<LG_SecurityDoor>();
return (Object)(object)door != (Object)null;
}
protected override void AddDefinitions(ZoneDefinitionsForLevel<SecurityDoorTerminalDefinition> definitions)
{
base.Sort(definitions);
base.AddDefinitions(definitions);
}
private void AddOverrideCommandWithAlarmText(SecDoorTerminal sdt)
{
if (sdt.CmdProcessor.HasRegisteredCommand((TERM_Command)254))
{
return;
}
string text = "<color=orange>" + Text.Get(841u) + "</color>";
if ((Object)(object)sdt.LinkedDoorLocks.ChainedPuzzleToSolve != (Object)null && sdt.LinkedDoorLocks.ChainedPuzzleToSolve.Data.TriggerAlarmOnActivate)
{
string format = Text.Get(840u);
ChainedPuzzleInstance chainedPuzzleToSolve = sdt.LinkedDoorLocks.ChainedPuzzleToSolve;
text = "<color=orange>" + string.Format(format, (chainedPuzzleToSolve != null) ? chainedPuzzleToSolve.Data.PublicAlarmName : null) + "</color>";
int num = text.IndexOf('[');
if (num >= 0 && num < text.Length)
{
text = text.Insert(num, "\n");
}
}
sdt.AddOverrideCommand("ACCESS_OVERRIDE", text, (Action<LG_ComputerTerminalCommandInterpreter>)null);
}
private unsafe void BuildSDT_UniqueCommands(SecDoorTerminal sdt, SecurityDoorTerminalDefinition def)
{
//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_0042: Expected O, but got Unknown
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Invalid comparison between Unknown and I4
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
TerminalPlacementData val = new TerminalPlacementData
{
UniqueCommands = ListExtensions.ToIl2Cpp<CustomTerminalCommand>(def.TerminalSettings.UniqueCommands.ConvertAll((CustomCommand x) => x.ToVanillaDataType()))
};
((LG_FactoryJob)new LG_TerminalUniqueCommandsSetupJob(sdt.ComputerTerminal, val)).Build();
TERM_Command val2 = default(TERM_Command);
string text = default(string);
string text2 = default(string);
ChainedPuzzleInstance val3 = default(ChainedPuzzleInstance);
foreach (CustomCommand uniqueCommand in def.TerminalSettings.UniqueCommands)
{
if (!sdt.ComputerTerminal.m_command.TryGetCommand(uniqueCommand.Command, ref val2, ref text, ref text2) || (int)sdt.ComputerTerminal.GetCommandRule(val2) != 0)
{
continue;
}
for (int i = 0; i < uniqueCommand.CommandEvents.Count; i++)
{
if (sdt.ComputerTerminal.TryGetChainPuzzleForCommand(val2, i, ref val3))
{
ChainedPuzzleInstance obj = val3;
obj.OnPuzzleSolved += Action.op_Implicit(new Action(val3, (nint)(delegate*<ChainedPuzzleInstance, void>)(&EOSUtils.ResetProgress)));
}
}
}
}
private void BuildLevelSDTs_UniqueCommands()
{
levelSDTs.ForEach(delegate((SecDoorTerminal sdt, SecurityDoorTerminalDefinition def) tp)
{
BuildSDT_UniqueCommands(tp.sdt, tp.def);
});
}
private void BuildLevelSDTs_Passwords()
{
levelSDTs.ForEach(delegate((SecDoorTerminal sdt, SecurityDoorTerminalDefinition def) tp)
{
EOSTerminalUtils.BuildPassword(tp.sdt.ComputerTerminal, tp.def.TerminalSettings.PasswordData);
});
}
private void WardenEvent_AddOverrideCommand(WardenObjectiveEventData e)
{
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
Predicate<(SecDoorTerminal, SecurityDoorTerminalDefinition)> predicate = null;
predicate = ((e.WorldEventObjectFilter == null || e.WorldEventObjectFilter.Length <= 0) ? ((Predicate<(SecDoorTerminal, SecurityDoorTerminalDefinition)>)delegate((SecDoorTerminal sdt, SecurityDoorTerminalDefinition def) tp)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
AIG_CourseNode courseNode = ((LG_ZoneExpander)tp.sdt.LinkedDoor.Gate).m_linksTo.m_courseNode;
return courseNode.m_dimension.DimensionIndex == e.DimensionIndex && courseNode.LayerType == e.Layer && courseNode.m_zone.LocalIndex == e.LocalIndex;
}) : ((Predicate<(SecDoorTerminal, SecurityDoorTerminalDefinition)>)(((SecDoorTerminal sdt, SecurityDoorTerminalDefinition def) tp) => e.WorldEventObjectFilter.Equals(tp.def.FCDoorWorldEventObjectFilter))));
int num = levelSDTs.FindIndex(predicate);
if (num == -1)
{
if (e.WorldEventObjectFilter != null && e.WorldEventObjectFilter.Length > 0)
{
EOSLogger.Error("SDT_AddOverrideCommand: SDT not found on ExtraDoor(WorldEventObjectFilter) '" + e.WorldEventObjectFilter + "'");
return;
}
EOSLogger.Error($"SDT_AddOverrideCommand: SDT not found on door to {(e.DimensionIndex, e.Layer, e.LocalIndex)}");
return;
}
SecDoorTerminal item = levelSDTs[num].sdt;
AddOverrideCommandWithAlarmText(item);
if (e.WorldEventObjectFilter != null && e.WorldEventObjectFilter.Length > 0)
{
EOSLogger.Debug("SDT_AddOverrideCommand: added for ExtraDoor(WorldEventObjectFilter) '" + e.WorldEventObjectFilter + "'");
return;
}
EOSLogger.Debug($"SDT_AddOverrideCommand: added for SDT {(e.DimensionIndex, e.Layer, e.LocalIndex)}");
}
private SecDoorTerminal BuildSDT_Instantiation(SecurityDoorTerminalDefinition def)
{
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Expected O, but got Unknown
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_023c: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_024a: Unknown result type (might be due to invalid IL or missing references)
//IL_024c: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0291: Expected I4, but got Unknown
LG_SecurityDoor door = null;
if (def.FCDoorWorldEventObjectFilter != null && def.FCDoorWorldEventObjectFilter.Length > 0)
{
door = ExtraDoorUtils.GetFCDoor(def.FCDoorWorldEventObjectFilter);
if ((Object)(object)door == (Object)null)
{
EOSLogger.Error("SecDoorTerminal: cannot find ExtraDoor with name '" + def.FCDoorWorldEventObjectFilter + "'");
return null;
}
}
else
{
var (val, val2, val3) = ((GlobalZoneIndex)def).GlobalZoneIndexTuple();
LG_Zone val4 = default(LG_Zone);
if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(val, val2, val3, ref val4) || (Object)(object)val4 == (Object)null)
{
EOSLogger.Error($"SecDoorTerminal: Cannot find target zone {((GlobalZoneIndex)def).GlobalZoneIndexTuple()}");
return null;
}
if (!TryGetZoneEntranceSecDoor(val4, out door) || (Object)(object)door == (Object)null)
{
EOSLogger.Error($"SecDoorTerminal: Cannot find spawned sec-door for zone {((GlobalZoneIndex)def).GlobalZoneIndexTuple()}");
return null;
}
}
SecDoorTerminal sdt = SecDoorTerminal.Place(door, new TerminalStartStateData
{
StartingState = (TERM_State)0
}, (TerminalPlacementData)null);
sdt.BioscanScanSolvedBehaviour = def.StateSettings.OnPuzzleSolved;
if (sdt == null)
{
EOSLogger.Error("SecDoorTerminal: Build failed - Can only attach SDT to regular security door");
return null;
}
((LG_ZoneExpander)door.Gate).m_linksFrom.m_zone.TerminalsSpawnedInZone.Add(sdt.ComputerTerminal);
sdt.BioscanScanSolvedBehaviour = def.StateSettings.OnPuzzleSolved;
def.TerminalSettings.LocalLogFiles.ForEach(delegate(TerminalLogFileData log)
{
sdt.ComputerTerminal.AddLocalLog(log, true);
});
eDoorStatus status = sdt.LinkedDoor.m_sync.GetCurrentSyncState().status;
eDoorStatus val5 = status;
switch (val5 - 1)
{
case 2:
if (def.StateSettings.LockedStateSetting.AccessibleWhenLocked)
{
sdt.LinkedDoorLocks.m_gateKeyItemNeeded.keyPickupCore.m_interact.OnPickedUpByPlayer += Action<PlayerAgent>.op_Implicit((Action<PlayerAgent>)delegate
{
sdt.SetTerminalActive(false);
});
sdt.SetTerminalActive(def.StateSettings.LockedStateSetting.AccessibleWhenLocked);
List<string> list4 = new List<string> { string.Format("<color=orange>" + Text.Get(849u) + "</color>", sdt.LinkedDoorLocks.m_gateKeyItemNeeded.PublicName) };
sdt.ComputerTerminal.m_command.AddOutput(ListExtensions.ToIl2Cpp<string>(list4));
}
break;
case 5:
sdt.SetTerminalActive(def.StateSettings.LockedStateSetting.AccessibleWhenLocked);
if (def.StateSettings.LockedStateSetting.AccessibleWhenLocked)
{
List<string> list2 = new List<string> { string.Format("<color=orange>" + Text.Get(842u) + "</color>", sdt.LinkedDoorLocks.m_powerGeneratorNeeded.PublicName) };
sdt.ComputerTerminal.m_command.AddOutput(ListExtensions.ToIl2Cpp<string>(list2));
}
break;
case 14:
sdt.SetTerminalActive(def.StateSettings.LockedStateSetting.AccessibleWhenLocked);
if (def.StateSettings.LockedStateSetting.AccessibleWhenLocked)
{
List<string> list = new List<string> { string.Format("<color=orange>" + Text.Get(843u) + "</color>", sdt.LinkedDoorLocks.m_bulkheadDCNeeded.PublicName) };
sdt.ComputerTerminal.m_command.AddOutput(ListExtensions.ToIl2Cpp<string>(list));
}
break;
case 6:
sdt.SetTerminalActive(def.StateSettings.LockedStateSetting.AccessibleWhenLocked);
if (def.StateSettings.LockedStateSetting.AccessibleWhenLocked)
{
List<string> list3 = new List<string> { sdt.LinkedDoorLocks.m_intCustomMessage.m_message };
sdt.ComputerTerminal.m_command.AddOutput(ListExtensions.ToIl2Cpp<string>(list3));
}
else
{
sdt.SetCustomMessageActive(true);
}
break;
case 0:
case 3:
case 4:
case 8:
if (def.StateSettings.OverrideCommandAccessibility != OverrideCmdAccess.ADDED_BY_WARDEN_EVENT)
{
AddOverrideCommandWithAlarmText(sdt);
}
sdt.SetTerminalActive(def.StateSettings.LockedStateSetting.AccessibleWhenUnlocked);
break;
}
sdt.LinkedDoor.m_sync.OnDoorStateChange += Action<pDoorState, bool>.op_Implicit((Action<pDoorState, bool>)delegate(pDoorState state, bool isDropin)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: 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_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Expected I4, but got Unknown
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Invalid comparison between Unknown and I4
eDoorStatus status3 = state.status;
eDoorStatus val7 = status3;
switch (val7 - 3)
{
case 0:
case 3:
case 4:
case 12:
sdt.SetTerminalActive(def.StateSettings.LockedStateSetting.AccessibleWhenLocked);
if ((int)state.status == 7)
{
sdt.SetCustomMessageActive(true);
}
break;
case 1:
case 2:
case 6:
sdt.SetTerminalActive(def.StateSettings.LockedStateSetting.AccessibleWhenUnlocked);
break;
case 5:
case 7:
case 8:
case 9:
case 10:
case 11:
break;
}
});
switch (def.StateSettings.OverrideCommandAccessibility)
{
case OverrideCmdAccess.ALWAYS:
AddOverrideCommandWithAlarmText(sdt);
break;
case OverrideCmdAccess.ON_UNLOCK:
sdt.LinkedDoor.m_sync.OnDoorStateChange += Action<pDoorState, bool>.op_Implicit((Action<pDoorState, bool>)delegate(pDoorState state, bool isDropin)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: 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_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Invalid comparison between Unknown and I4
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Invalid comparison between Unknown and I4
eDoorStatus status2 = state.status;
eDoorStatus val6 = status2;
if (val6 - 4 <= 1 || (int)val6 == 9)
{
AddOverrideCommandWithAlarmText(sdt);
}
});
break;
}
return sdt;
}
public override void Init()
{
base.Init();
}
private void BuildLevelSDTs_Instantiation()
{
if (!base.definitions.ContainsKey(RundownManager.ActiveExpedition.LevelLayoutData))
{
return;
}
foreach (SecurityDoorTerminalDefinition definition in base.definitions[RundownManager.ActiveExpedition.LevelLayoutData].Definitions)
{
SecDoorTerminal val = BuildSDT_Instantiation(definition);
if (val != null)
{
levelSDTs.Add((val, definition));
}
}
}
private void OnLevelCleanup()
{
levelSDTs.Clear();
}
private SecurityDoorTerminalManager()
{
EOSWardenEventManager.Current.AddEventDefinition(SDTWardenEvents.ADD_OVERRIDE_COMMAND.ToString(), 1000u, (Action<WardenObjectiveEventData>)WardenEvent_AddOverrideCommand);
BatchBuildManager.Current.Add_OnBatchDone((BatchName)75, (Action)BuildLevelSDTs_Instantiation);
BatchBuildManager.Current.Add_OnBatchDone((BatchName)76, (Action)BuildLevelSDTs_Passwords);
LevelAPI.OnBuildDone += BuildLevelSDTs_UniqueCommands;
LevelAPI.OnLevelCleanup += OnLevelCleanup;
}
static SecurityDoorTerminalManager()
{
Current = new SecurityDoorTerminalManager();
}
}
}
namespace EOSExt.SecurityDoorTerminal.Definition
{
public enum OverrideCmdAccess
{
ALWAYS,
ON_UNLOCK,
ADDED_BY_WARDEN_EVENT
}
public class SDTStateSetting_Locked
{
public bool AccessibleWhenLocked { get; set; } = false;
public bool AccessibleWhenUnlocked { get; set; } = true;
}
public class SDTStateSetting
{
public SDTStateSetting_Locked LockedStateSetting { get; set; } = new SDTStateSetting_Locked();
public OverrideCmdAccess OverrideCommandAccessibility { get; set; } = OverrideCmdAccess.ON_UNLOCK;
public CPSolvedBehaviour OnPuzzleSolved { get; set; } = (CPSolvedBehaviour)1;
}
public class SecurityDoorTerminalDefinition : GlobalZoneIndex
{
public string FCDoorWorldEventObjectFilter { get; set; } = string.Empty;
public SDTStateSetting StateSettings { get; set; } = new SDTStateSetting();
public TerminalDefinition TerminalSettings { get; set; } = new TerminalDefinition();
}
}using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AIGraph;
using AK;
using Agents;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using GTFO.API;
using GameData;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using LevelGeneration;
using Localization;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
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("Inas07.ExtraSurvivalWaveSettings")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+f860d163ea0804b5e6a649ce59cb6a83a10794da")]
[assembly: AssemblyProduct("Inas07.ExtraSurvivalWaveSettings")]
[assembly: AssemblyTitle("Inas07.ExtraSurvivalWaveSettings")]
[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 ExtraSurvivalWaveSettings
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Inas.ExtraSurvivalWaveSettings", "ExtraSurvivalWaveSettings", "1.1.4")]
public class EntryPoint : BasePlugin
{
public const string AUTHOR = "Inas";
public const string PLUGIN_NAME = "ExtraSurvivalWaveSettings";
public const string VERSION = "1.1.4";
private Harmony m_Harmony;
public override void Load()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
m_Harmony = new Harmony("ExtraSurvivalWaveSettings");
m_Harmony.PatchAll();
}
}
public class SurvivalWaveManager
{
public static readonly SurvivalWaveManager Current;
private ConcurrentDictionary<string, List<ushort>> WaveEventsMap = new ConcurrentDictionary<string, List<ushort>>();
public Dictionary<uint, (SurvivalWaveSpawnType, int)> LateSpawnTypeOverrideMap = new Dictionary<uint, (SurvivalWaveSpawnType, int)>();
public void SpawnWave(WardenObjectiveEventData e)
{
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Invalid comparison between Unknown and I4
//IL_0338: Unknown result type (might be due to invalid IL or missing references)
//IL_0340: Unknown result type (might be due to invalid IL or missing references)
//IL_0342: Unknown result type (might be due to invalid IL or missing references)
//IL_034b: Unknown result type (might be due to invalid IL or missing references)
//IL_0359: Unknown result type (might be due to invalid IL or missing references)
//IL_035f: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Invalid comparison between Unknown and I4
//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Invalid comparison between Unknown and I4
//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Invalid comparison between Unknown and I4
//IL_045c: Unknown result type (might be due to invalid IL or missing references)
//IL_045f: Invalid comparison between Unknown and I4
//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
//IL_04e6: Invalid comparison between Unknown and I4
//IL_0482: Unknown result type (might be due to invalid IL or missing references)
//IL_049d: Unknown result type (might be due to invalid IL or missing references)
//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
//IL_058c: Unknown result type (might be due to invalid IL or missing references)
//IL_058f: Invalid comparison between Unknown and I4
//IL_050c: Unknown result type (might be due to invalid IL or missing references)
//IL_0527: Unknown result type (might be due to invalid IL or missing references)
//IL_0542: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_02df: Unknown result type (might be due to invalid IL or missing references)
//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Invalid comparison between Unknown and I4
//IL_0643: Unknown result type (might be due to invalid IL or missing references)
//IL_0646: Invalid comparison between Unknown and I4
//IL_05b5: Unknown result type (might be due to invalid IL or missing references)
//IL_05d0: Unknown result type (might be due to invalid IL or missing references)
//IL_05eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0625: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Invalid comparison between Unknown and I4
//IL_066c: Unknown result type (might be due to invalid IL or missing references)
//IL_0687: Unknown result type (might be due to invalid IL or missing references)
//IL_06a2: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Invalid comparison between Unknown and I4
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Invalid comparison between Unknown and I4
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
if (!SNet.IsMaster)
{
return;
}
PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent();
if ((Object)(object)localPlayerAgent == (Object)null)
{
ESWSLogger.Error("SpawnWave: LocalPlayerAgent is null, wtf?");
return;
}
GenericEnemyWaveData enemyWaveData = e.EnemyWaveData;
if (enemyWaveData.WaveSettings == 0 || enemyWaveData.WavePopulation == 0)
{
ESWSLogger.Error("SpawnWave: WaveSettings or WavePopulation is 0");
return;
}
SurvivalWaveSettingsDataBlock block = GameDataBlockBase<SurvivalWaveSettingsDataBlock>.GetBlock(enemyWaveData.WaveSettings);
SurvivalWavePopulationDataBlock block2 = GameDataBlockBase<SurvivalWavePopulationDataBlock>.GetBlock(enemyWaveData.WavePopulation);
if (block == null || block2 == null)
{
return;
}
AIG_CourseNode val = ((Agent)localPlayerAgent).CourseNode;
SurvivalWaveSpawnType val2 = (SurvivalWaveSpawnType)0;
Vector3 val3 = Vector3.zero;
string worldEventObjectFilterSpawnPoint = enemyWaveData.WorldEventObjectFilterSpawnPoint;
if (worldEventObjectFilterSpawnPoint != null && worldEventObjectFilterSpawnPoint.Length > 0)
{
val2 = block.m_survivalWaveSpawnType;
}
else if (block.m_overrideWaveSpawnType)
{
LG_Zone val4 = default(LG_Zone);
if ((int)block.m_survivalWaveSpawnType != 1 && (int)block.m_survivalWaveSpawnType != 2 && (int)block.m_survivalWaveSpawnType != 3 && (int)block.m_survivalWaveSpawnType != 4)
{
val2 = block.m_survivalWaveSpawnType;
}
else if (Builder.CurrentFloor.TryGetZoneByLocalIndex(e.DimensionIndex, e.Layer, e.LocalIndex, ref val4) && (Object)(object)val4 != (Object)null)
{
val = val4.m_courseNodes[0];
val2 = (SurvivalWaveSpawnType)1;
if ((int)block.m_survivalWaveSpawnType == 2 || (int)block.m_survivalWaveSpawnType == 3)
{
if (e.Count < val4.m_courseNodes.Count)
{
val = val4.m_courseNodes[e.Count];
val2 = (SurvivalWaveSpawnType)2;
if ((int)block.m_survivalWaveSpawnType == 3)
{
val3 = e.Position;
val2 = (SurvivalWaveSpawnType)3;
}
else if ((int)block.m_survivalWaveSpawnType == 4)
{
val2 = (SurvivalWaveSpawnType)4;
}
}
else
{
ESWSLogger.Error($"SpawnWave: SpawnType {block.m_survivalWaveSpawnType} is specified but cannot find AREA_{(ushort)(65 + e.Count)} in ({e.DimensionIndex}, {e.Layer}, {e.LocalIndex}), falling back to SpawnType: InSuppliedCourseNodeZone");
}
}
}
else
{
ESWSLogger.Error($"SpawnWave: Failed to find zone with GlobalIndex ({e.DimensionIndex}, {e.Layer}, {e.LocalIndex}), falling back to default spawn type");
}
}
Mastermind current = Mastermind.Current;
AIG_CourseNode obj = val;
uint waveSettings = enemyWaveData.WaveSettings;
uint wavePopulation = enemyWaveData.WavePopulation;
SurvivalWaveSpawnType val5 = val2;
float spawnDelay = enemyWaveData.SpawnDelay;
Vector3 val6 = val3;
float num = enemyWaveData.AreaDistance;
string worldEventObjectFilterSpawnPoint2 = enemyWaveData.WorldEventObjectFilterSpawnPoint;
ushort num2 = default(ushort);
if (!current.TriggerSurvivalWave(obj, waveSettings, wavePopulation, ref num2, val5, spawnDelay, num, val6, true, false, default(Vector3), worldEventObjectFilterSpawnPoint2))
{
ESWSLogger.Error("SpawnWave: Critical ERROR! Failed spawning enemy wave");
return;
}
WardenObjectiveManager.RegisterSurvivalWaveID(num2);
ESWSLogger.Log($"SpawnWave: Enemy wave spawned ({val2}) with eventID {num2}");
if (enemyWaveData.TriggerAlarm)
{
WardenObjectiveManager.Current.m_sound.UpdatePosition(val.Position);
WardenObjectiveManager.Current.m_sound.Post(EVENTS.APEX_PUZZLE_START_ALARM, true);
ESWSLogger.Debug("SpawnWave: Trigger Alarm (prolly bugged when there're multiple alarms)");
}
if (!string.IsNullOrEmpty(LocalizedText.op_Implicit(enemyWaveData.IntelMessage)))
{
GuiManager.PlayerLayer.m_wardenIntel.ShowSubObjectiveMessage("", LocalizedText.op_Implicit(enemyWaveData.IntelMessage), false, 200f, 8f, (Action)null);
}
if ((int)val2 == 1)
{
ESWSLogger.Log($"Spawning in: ({e.DimensionIndex}, {e.Layer}, {e.LocalIndex})");
}
else if ((int)val2 == 2)
{
ESWSLogger.Log($"Spawning in: ({e.DimensionIndex}, {e.Layer}, {e.LocalIndex}, AREA_{(ushort)(65 + e.Count)})");
}
else if ((int)val2 == 3)
{
ESWSLogger.Log($"Spawning in: ({e.DimensionIndex}, {e.Layer}, {e.LocalIndex}, AREA_{(ushort)(65 + e.Count)}), position: {e.Position}");
}
else if ((int)val2 == 4)
{
ESWSLogger.Log($"Spawning closest to: ({e.DimensionIndex}, {e.Layer}, {e.LocalIndex}, AREA_{(ushort)(65 + e.Count)})");
LateSpawnTypeOverrideMap.Add(num2, ((SurvivalWaveSpawnType)4, val.NodeID));
}
string worldEventObjectFilter = e.WorldEventObjectFilter;
if (!string.IsNullOrEmpty(worldEventObjectFilter))
{
if (!WaveEventsMap.ContainsKey(worldEventObjectFilter))
{
WaveEventsMap[worldEventObjectFilter] = new List<ushort>();
}
WaveEventsMap[worldEventObjectFilter].Add(num2);
ESWSLogger.Debug($"SpawnWave: Registered wave with filter {worldEventObjectFilter}, number of waves assigned: {WaveEventsMap[worldEventObjectFilter].Count}");
}
}
public void StopNamedWaves(string waveName)
{
if (string.IsNullOrEmpty(waveName))
{
return;
}
if (!WaveEventsMap.Remove(waveName, out var value))
{
ESWSLogger.Error("Wave Filter " + waveName + " is unregistered, cannot stop wave.");
return;
}
ESWSLogger.Debug($"StopNamedWaves: Stopping waves with name {waveName}, wave count: {value.Count}");
value.ForEach(delegate(ushort eventID)
{
LateSpawnTypeOverrideMap.Remove(eventID);
MastermindEvent val = default(MastermindEvent);
if (Mastermind.Current.TryGetEvent(eventID, ref val))
{
val.StopEvent();
}
else
{
ESWSLogger.Error($"Wave with ID {eventID}: cannot find event. Are you debugging a level?");
}
});
}
public static AIG_CourseNode GetNodeAtDistanceFromPlayerToSupplied(AIG_CourseNode dest_node, int area_distance)
{
AIG_CourseNode result = dest_node;
int num = int.MaxValue;
AIG_CourseNode[] array = null;
Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
while (enumerator.MoveNext())
{
PlayerAgent current = enumerator.Current;
if (IsNodeReachable(current.m_courseNode, dest_node, out var pathToNode) && pathToNode.Length < num)
{
array = pathToNode;
num = pathToNode.Length;
}
}
if (array != null)
{
if (array.Length > area_distance)
{
result = array[area_distance];
}
}
else
{
ESWSLogger.Error("GetNodeAtDistanceFromPlayerToSupplied: No path from any player to supplied node!");
}
return result;
}
internal static bool IsNodeReachable(AIG_CourseNode source, AIG_CourseNode target, out AIG_CourseNode[] pathToNode)
{
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Invalid comparison between Unknown and I4
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Invalid comparison between Unknown and I4
pathToNode = null;
if (source == null || target == null)
{
return false;
}
if (source.NodeID == target.NodeID)
{
pathToNode = Array.Empty<AIG_CourseNode>();
return true;
}
AIG_SearchID.IncrementSearchID();
ushort searchID = AIG_SearchID.SearchID;
Queue<(AIG_CourseNode, AIG_CourseNode[])> queue = new Queue<(AIG_CourseNode, AIG_CourseNode[])>();
queue.Enqueue((source, Array.Empty<AIG_CourseNode>()));
while (queue.Count > 0)
{
var (val, array) = queue.Dequeue();
((AIG_CourseGraphMember)val).m_searchID = searchID;
AIG_CourseNode[] array2 = array;
int num = 0;
AIG_CourseNode[] array3 = (AIG_CourseNode[])(object)new AIG_CourseNode[1 + array2.Length];
ReadOnlySpan<AIG_CourseNode> readOnlySpan = new ReadOnlySpan<AIG_CourseNode>(array2);
readOnlySpan.CopyTo(new Span<AIG_CourseNode>(array3).Slice(num, readOnlySpan.Length));
num += readOnlySpan.Length;
array3[num] = val;
AIG_CourseNode[] array4 = array3;
Enumerator<AIG_CoursePortal> enumerator = val.m_portals.GetEnumerator();
while (enumerator.MoveNext())
{
AIG_CoursePortal current = enumerator.Current;
LG_Gate gate = current.Gate;
object obj;
if (gate == null)
{
obj = null;
}
else
{
iLG_Door_Core spawnedDoor = gate.SpawnedDoor;
obj = ((spawnedDoor != null) ? ((Il2CppObjectBase)spawnedDoor).TryCast<LG_SecurityDoor>() : null);
}
LG_SecurityDoor val2 = (LG_SecurityDoor)obj;
if ((Object)(object)val2 != (Object)null && (int)val2.LastStatus != 10 && (int)val2.LastStatus != 16)
{
continue;
}
AIG_CourseNode oppositeNode = current.GetOppositeNode(val);
if (((AIG_CourseGraphMember)oppositeNode).m_searchID != searchID)
{
if (oppositeNode.NodeID == target.NodeID)
{
pathToNode = array4;
return true;
}
queue.Enqueue((oppositeNode, array4));
}
}
}
return false;
}
internal void OnStopAllWave()
{
Clear();
}
public void Clear()
{
WaveEventsMap.Clear();
LateSpawnTypeOverrideMap.Clear();
}
private SurvivalWaveManager()
{
}
static SurvivalWaveManager()
{
Current = new SurvivalWaveManager();
LevelAPI.OnLevelCleanup += Current.Clear;
}
}
internal static class ESWSLogger
{
private static ManualLogSource logger = Logger.CreateLogSource("ExtraSurvivalWaveSettings");
public static void Log(string format, params object[] args)
{
Log(string.Format(format, args));
}
public static void Log(string str)
{
if (logger != null)
{
logger.Log((LogLevel)8, (object)str);
}
}
public static void Warning(string format, params object[] args)
{
Warning(string.Format(format, args));
}
public static void Warning(string str)
{
if (logger != null)
{
logger.Log((LogLevel)4, (object)str);
}
}
public static void Error(string format, params object[] args)
{
Error(string.Format(format, args));
}
public static void Error(string str)
{
if (logger != null)
{
logger.Log((LogLevel)2, (object)str);
}
}
public static void Debug(string format, params object[] args)
{
Debug(string.Format(format, args));
}
public static void Debug(string str)
{
if (logger != null)
{
logger.Log((LogLevel)32, (object)str);
}
}
}
[HarmonyPatch]
internal class Patch_CheckAndExecuteEventsOnTrigger
{
[CompilerGenerated]
private sealed class <Handle>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public WardenObjectiveEventData e;
public float currentDuration;
private float <delay>5__1;
private string <line>5__2;
private eWardenObjectiveEventType <>s__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Handle>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<line>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Expected O, but got Unknown
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_0198: Invalid comparison between Unknown and I4
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Invalid comparison between Unknown and I4
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<delay>5__1 = Mathf.Max(e.Delay - currentDuration, 0f);
if (<delay>5__1 > 0f)
{
<>2__current = (object)new WaitForSeconds(<delay>5__1);
<>1__state = 1;
return true;
}
break;
case 1:
<>1__state = -1;
break;
}
if (e.Condition.ConditionIndex >= 0 && WorldEventManager.GetCondition(e.Condition.ConditionIndex) != e.Condition.IsTrue)
{
return false;
}
WardenObjectiveManager.DisplayWardenIntel(e.Layer, e.WardenIntel);
if (e.DialogueID != 0)
{
PlayerDialogManager.WantToStartDialog(e.DialogueID, -1, false, false);
}
if (e.SoundID != 0)
{
WardenObjectiveManager.Current.m_sound.Post(e.SoundID, true);
<line>5__2 = ((Object)e.SoundSubtitle).ToString();
if (!string.IsNullOrWhiteSpace(<line>5__2))
{
GuiManager.PlayerLayer.ShowMultiLineSubtitle(<line>5__2);
}
<line>5__2 = null;
}
eWardenObjectiveEventType type = e.Type;
<>s__3 = type;
eWardenObjectiveEventType val = <>s__3;
if ((int)val != 9)
{
if ((int)val == 10)
{
if (string.IsNullOrEmpty(e.WorldEventObjectFilter))
{
WardenObjectiveManager.StopAlarms();
WardenObjectiveManager.StopAllWardenObjectiveEnemyWaves();
WardenObjectiveManager.Current.m_sound.Post(EVENTS.ALARM_AMBIENT_STOP, true);
SurvivalWaveManager.Current.OnStopAllWave();
}
else
{
SurvivalWaveManager.Current.StopNamedWaves(e.WorldEventObjectFilter);
}
}
}
else
{
SurvivalWaveManager.Current.SpawnWave(e);
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(WardenObjectiveManager), "CheckAndExecuteEventsOnTrigger", new Type[]
{
typeof(WardenObjectiveEventData),
typeof(eWardenObjectiveEventTrigger),
typeof(bool),
typeof(float)
})]
private static bool Pre_CheckAndExecuteEventsOnTrigger(WardenObjectiveEventData eventToTrigger, eWardenObjectiveEventTrigger trigger, bool ignoreTrigger, float currentDuration)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: 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_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Invalid comparison between Unknown and I4
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Invalid comparison between Unknown and I4
if (eventToTrigger == null || (!ignoreTrigger && eventToTrigger.Trigger != trigger) || ((double)currentDuration != 0.0 && eventToTrigger.Delay <= currentDuration))
{
return true;
}
bool flag = false;
eWardenObjectiveEventType type = eventToTrigger.Type;
eWardenObjectiveEventType val = type;
if ((int)val != 9)
{
if ((int)val == 10)
{
flag = true;
WorldEventManager.m_worldEventEventCoroutines.Add(CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(Handle(eventToTrigger, 0f)), (Action)null));
}
}
else
{
flag = true;
WorldEventManager.m_worldEventEventCoroutines.Add(CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(Handle(eventToTrigger, 0f)), (Action)null));
}
return !flag;
}
[IteratorStateMachine(typeof(<Handle>d__1))]
internal static IEnumerator Handle(WardenObjectiveEventData e, float currentDuration)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Handle>d__1(0)
{
e = e,
currentDuration = currentDuration
};
}
}
}using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.Json.Serialization;
using AssetShards;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using ChainedPuzzles;
using ExtraObjectiveSetup.BaseClasses;
using ExtraObjectiveSetup.Expedition.Gears;
using ExtraObjectiveSetup.Utils;
using FirstPersonItem;
using GTFO.API;
using GTFO.API.Utilities;
using GameData;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Microsoft.CodeAnalysis;
using ThermalSights.Definition;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Inas07.ThermalSights")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Inas07.ThermalSights")]
[assembly: AssemblyTitle("Inas07.ThermalSights")]
[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 ThermalSights
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Inas.ThermalSights", "ThermalSights", "1.0.0")]
public class EntryPoint : BasePlugin
{
public const string AUTHOR = "Inas";
public const string PLUGIN_NAME = "ThermalSights";
public const string VERSION = "1.0.0";
private Harmony m_Harmony;
public override void Load()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
SetupManagers();
m_Harmony = new Harmony("ThermalSights");
m_Harmony.PatchAll();
EOSLogger.Log("ThermalSights loaded.");
}
private void SetupManagers()
{
AssetShardManager.OnStartupAssetsLoaded += Action.op_Implicit((Action)delegate
{
((GenericDefinitionManager<TSADefinition>)TSAManager.Current).Init();
});
}
}
public class TSAManager : GenericDefinitionManager<TSADefinition>
{
public class PuzzleVisualWrapper
{
public GameObject GO { get; set; }
public Renderer Renderer { get; set; }
public float Intensity { get; set; }
public float BehindWallIntensity { get; set; }
public void SetIntensity(float t)
{
if (GO.active)
{
if (Intensity > 0f)
{
Renderer.material.SetFloat("_Intensity", Intensity * t);
}
if (BehindWallIntensity > 0f)
{
Renderer.material.SetFloat("_BehindWallIntensity", BehindWallIntensity * t);
}
}
}
}
private const bool OUTPUT_THERMAL_SHADER_SETTINGS_ON_WIELD = false;
public static TSAManager Current { get; }
protected override string DEFINITION_NAME => "ThermalSight";
private Dictionary<uint, Renderer[]> InLevelGearThermals { get; } = new Dictionary<uint, Renderer[]>();
private HashSet<uint> ModifiedInLevelGearThermals { get; } = new HashSet<uint>();
private HashSet<uint> ThermalOfflineGears { get; } = new HashSet<uint>();
public uint CurrentGearPID { get; private set; }
private List<PuzzleVisualWrapper> PuzzleVisuals { get; } = new List<PuzzleVisualWrapper>();
protected override void FileChanged(LiveEditEventArgs e)
{
base.FileChanged(e);
InitThermalOfflineGears();
CleanupInLevelGearThermals(keepCurrentGear: true);
TrySetThermalSightRenderer(CurrentGearPID);
}
public override void Init()
{
InitThermalOfflineGears();
}
private void InitThermalOfflineGears()
{
ThermalOfflineGears.Clear();
foreach (PlayerOfflineGearDataBlock allBlock in GameDataBlockBase<PlayerOfflineGearDataBlock>.GetAllBlocks())
{
if (((GameDataBlockBase<PlayerOfflineGearDataBlock>)(object)allBlock).name.ToLowerInvariant().EndsWith("_t"))
{
ThermalOfflineGears.Add(((GameDataBlockBase<PlayerOfflineGearDataBlock>)(object)allBlock).persistentID);
}
}
EOSLogger.Debug($"Found OfflineGear with thermal sight, count: {ThermalOfflineGears.Count}");
}
private bool TryGetInLevelGearThermalRenderersFromItem(ItemEquippable item, uint gearPID, out Renderer[] renderers)
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
renderers = null;
if (item.GearIDRange == null)
{
return false;
}
if (gearPID == 0)
{
gearPID = ExpeditionGearManager.GetOfflineGearPID(item.GearIDRange);
}
if (gearPID == 0 || !IsGearWithThermal(gearPID))
{
return false;
}
bool flag = false;
if (!InLevelGearThermals.ContainsKey(gearPID))
{
flag = true;
}
else
{
try
{
_ = ((Component)InLevelGearThermals[gearPID][0]).gameObject.transform.position;
flag = false;
}
catch
{
ModifiedInLevelGearThermals.Remove(gearPID);
flag = true;
}
}
if (flag)
{
renderers = (from x in ((IEnumerable<Renderer>)((Component)item).GetComponentsInChildren<Renderer>(true))?.Where((Renderer x) => (Object)(object)x.sharedMaterial != (Object)null && (Object)(object)x.sharedMaterial.shader != (Object)null)
where ((Object)x.sharedMaterial.shader).name.ToLower().Contains("Thermal".ToLower())
select x).ToArray() ?? null;
if (renderers != null)
{
if (renderers.Length != 1)
{
EOSLogger.Warning(((Item)item).PublicName + " contains more than 1 thermal renderers!");
}
InLevelGearThermals[gearPID] = renderers;
return true;
}
EOSLogger.Debug(((Item)item).PublicName + ": thermal renderer not found");
return false;
}
renderers = InLevelGearThermals[gearPID];
return true;
}
internal bool TrySetThermalSightRenderer(uint gearPID = 0u)
{
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Expected O, but got Unknown
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Expected O, but got Unknown
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
if (gearPID == 0)
{
gearPID = CurrentGearPID;
}
if (!IsGearWithThermal(gearPID))
{
return false;
}
if (ModifiedInLevelGearThermals.Contains(gearPID))
{
return true;
}
if (base.definitions.TryGetValue(gearPID, out var value) && InLevelGearThermals.TryGetValue(gearPID, out var value2))
{
TSShader shader = value.Definition.Shader;
Renderer[] array = value2;
foreach (Renderer val in array)
{
PropertyInfo[] properties = shader.GetType().GetProperties();
foreach (PropertyInfo propertyInfo in properties)
{
Type type = Nullable.GetUnderlyingType(propertyInfo.PropertyType) ?? propertyInfo.PropertyType;
string text = "_" + propertyInfo.Name;
if (type == typeof(float))
{
val.material.SetFloat(text, (float)propertyInfo.GetValue(shader));
}
else if (type == typeof(EOSColor))
{
EOSColor val2 = (EOSColor)propertyInfo.GetValue(shader);
val.material.SetVector(text, Color.op_Implicit(val2.ToUnityColor()));
}
else if (type == typeof(bool))
{
bool flag = (bool)propertyInfo.GetValue(shader);
val.material.SetFloat(text, flag ? 1f : 0f);
}
else if (type == typeof(Vec4))
{
Vec4 val3 = (Vec4)propertyInfo.GetValue(shader);
val.material.SetVector(text, val3.ToVector4());
}
}
}
ModifiedInLevelGearThermals.Add(gearPID);
return true;
}
return false;
}
internal void OnPlayerItemWielded(FirstPersonItemHolder fpsItemHolder, ItemEquippable item)
{
if (item.GearIDRange == null)
{
CurrentGearPID = 0u;
return;
}
CurrentGearPID = ExpeditionGearManager.GetOfflineGearPID(item.GearIDRange);
TryGetInLevelGearThermalRenderersFromItem(item, CurrentGearPID, out var _);
TrySetThermalSightRenderer(CurrentGearPID);
}
public bool IsGearWithThermal(uint gearPID)
{
return ThermalOfflineGears.Contains(gearPID);
}
private void CleanupInLevelGearThermals(bool keepCurrentGear = false)
{
if (!keepCurrentGear || !InLevelGearThermals.ContainsKey(CurrentGearPID))
{
InLevelGearThermals.Clear();
}
else
{
Renderer[] value = InLevelGearThermals[CurrentGearPID];
InLevelGearThermals.Clear();
InLevelGearThermals[CurrentGearPID] = value;
}
ModifiedInLevelGearThermals.Clear();
}
internal void SetCurrentThermalSightSettings(float t)
{
if (InLevelGearThermals.TryGetValue(CurrentGearPID, out var value) && base.definitions.TryGetValue(CurrentGearPID, out var value2))
{
Renderer[] array = value;
foreach (Renderer obj in array)
{
float zoom = value2.Definition.Shader.Zoom;
float offAimPixelZoom = value2.Definition.OffAimPixelZoom;
float num = Mathf.Lerp(zoom, offAimPixelZoom, t);
obj.material.SetFloat("_Zoom", num);
}
}
}
private void Clear()
{
CurrentGearPID = 0u;
CleanupInLevelGearThermals();
CleanupPuzzleVisuals();
}
private TSAManager()
{
LevelAPI.OnBuildStart += Clear;
LevelAPI.OnLevelCleanup += Clear;
}
static TSAManager()
{
Current = new TSAManager();
}
public void RegisterPuzzleVisual(CP_Bioscan_Core core)
{
Il2CppArrayBase<Renderer> componentsInChildren = ((Component)core).gameObject.GetComponentsInChildren<Renderer>(true);
if (componentsInChildren == null)
{
return;
}
foreach (Renderer item2 in ((IEnumerable<Renderer>)componentsInChildren).Where((Renderer comp) => ((Object)((Component)comp).gameObject).name.Equals("Zone")).ToList())
{
GameObject gameObject = ((Component)item2).gameObject;
float @float = item2.material.GetFloat("_Intensity");
float float2 = item2.material.GetFloat("_BehindWallIntensity");
PuzzleVisualWrapper item = new PuzzleVisualWrapper
{
GO = gameObject,
Renderer = item2,
Intensity = @float,
BehindWallIntensity = float2
};
PuzzleVisuals.Add(item);
}
}
public void RegisterPuzzleVisual(PuzzleVisualWrapper wrapper)
{
PuzzleVisuals.Add(wrapper);
}
internal void SetPuzzleVisualsIntensity(float t)
{
PuzzleVisuals.ForEach(delegate(PuzzleVisualWrapper v)
{
v.SetIntensity(t);
});
}
private void CleanupPuzzleVisuals()
{
PuzzleVisuals.Clear();
}
}
}
namespace ThermalSights.Patches
{
internal static class CP_Bioscan_Core_Setup
{
[HarmonyPostfix]
[HarmonyPatch(typeof(CP_Bioscan_Core), "Setup")]
private static void Post_CaptureBioscanVisual(CP_Bioscan_Core __instance)
{
TSAManager.Current.RegisterPuzzleVisual(__instance);
}
}
[HarmonyPatch]
internal static class FirstPersonItemHolder_SetWieldedItem
{
public static event Action<FirstPersonItemHolder, ItemEquippable> OnItemWielded;
[HarmonyPostfix]
[HarmonyPatch(typeof(FirstPersonItemHolder), "SetWieldedItem")]
private static void Post_SetWieldedItem(FirstPersonItemHolder __instance, ItemEquippable item)
{
TSAManager.Current.OnPlayerItemWielded(__instance, item);
TSAManager.Current.SetPuzzleVisualsIntensity(1f);
TSAManager.Current.SetCurrentThermalSightSettings(1f);
FirstPersonItemHolder_SetWieldedItem.OnItemWielded?.Invoke(__instance, item);
}
}
[HarmonyPatch]
internal static class FPIS_Aim_Update
{
public static event Action<FPIS_Aim, float> OnAimUpdate;
[HarmonyPostfix]
[HarmonyPatch(typeof(FPIS_Aim), "Update")]
private static void Post_Aim_Update(FPIS_Aim __instance)
{
if (!((Object)(object)((FPItemState)__instance).Holder.WieldedItem == (Object)null))
{
float num = 1f - FirstPersonItemHolder.m_transitionDelta;
if (!TSAManager.Current.IsGearWithThermal(TSAManager.Current.CurrentGearPID))
{
num = Math.Max(0.05f, num);
}
else
{
TSAManager.Current.SetCurrentThermalSightSettings(num);
}
TSAManager.Current.SetPuzzleVisualsIntensity(num);
FPIS_Aim_Update.OnAimUpdate?.Invoke(__instance, num);
}
}
}
}
namespace ThermalSights.Definition
{
public class TSADefinition
{
public float OffAimPixelZoom { get; set; } = 1f;
public TSShader Shader { get; set; } = new TSShader();
}
public class TSShader
{
[JsonPropertyName("DistanceFalloff")]
[Range(0.0, 1.0)]
public float HeatFalloff { get; set; } = 0.01f;
[Range(0.0, 1.0)]
public float FogFalloff { get; set; } = 0.1f;
[JsonPropertyName("PixelZoom")]
[Range(0.0, 1.0)]
public float Zoom { get; set; } = 0.8f;
[JsonPropertyName("AspectRatioAdjust")]
[Range(0.0, 2.0)]
public float RatioAdjust { get; set; } = 1f;
[Range(0.0, 1.0)]
public float DistortionCenter { get; set; } = 0.5f;
public float DistortionScale { get; set; } = 1f;
public float DistortionSpeed { get; set; } = 1f;
public float DistortionSignalSpeed { get; set; } = 0.025f;
[Range(0.0, 1.0)]
public float DistortionMin { get; set; } = 0.01f;
[Range(0.0, 1.0)]
public float DistortionMax { get; set; } = 0.4f;
[JsonPropertyName("AmbientTemperature")]
[Range(0.0, 1.0)]
public float AmbientTemp { get; set; } = 0.15f;
[JsonPropertyName("BackgroundTemperature")]
[Range(0.0, 1.0)]
public float BackgroundTemp { get; set; } = 0.05f;
[Range(0.0, 10.0)]
public float AlbedoColorFactor { get; set; } = 0.5f;
[Range(0.0, 10.0)]
public float AmbientColorFactor { get; set; } = 5f;
public float OcclusionHeat { get; set; } = 0.5f;
public float BodyOcclusionHeat { get; set; } = 2.5f;
[Range(0.0, 1.0)]
public float ScreenIntensity { get; set; } = 0.2f;
[Range(0.0, 1.0)]
public float OffAngleFade { get; set; } = 0.95f;
[Range(0.0, 1.0)]
public float Noise { get; set; } = 0.1f;
[JsonPropertyName("MinShadowEnemyDistortion")]
[Range(0.0, 1.0)]
public float DistortionMinShadowEnemies { get; set; } = 0.2f;
[JsonPropertyName("MaxShadowEnemyDistortion")]
[Range(0.0, 1.0)]
public float DistortionMaxShadowEnemies { get; set; } = 1f;
[Range(0.0, 1.0)]
public float DistortionSignalSpeedShadowEnemies { get; set; } = 1f;
public float ShadowEnemyFresnel { get; set; } = 10f;
[Range(0.0, 1.0)]
public float ShadowEnemyHeat { get; set; } = 0.1f;
public EOSColor ReticuleColorA { get; set; } = new EOSColor
{
r = 1f,
g = 1f,
b = 1f,
a = 1f
};
public EOSColor ReticuleColorB { get; set; } = new EOSColor
{
r = 1f,
g = 1f,
b = 1f,
a = 1f
};
public EOSColor ReticuleColorC { get; set; } = new EOSColor
{
r = 1f,
g = 1f,
b = 1f,
a = 1f
};
[Range(0.0, 20.0)]
public float SightDirt { get; set; }
public bool LitGlass { get; set; }
public bool ClipBorders { get; set; } = true;
public Vec4 AxisX { get; set; } = new Vec4();
public Vec4 AxisY { get; set; } = new Vec4();
public Vec4 AxisZ { get; set; } = new Vec4();
public bool Flip { get; set; } = true;
[JsonPropertyName("Distance1")]
[Range(0.0, 100.0)]
public float ProjDist1 { get; set; } = 100f;
[JsonPropertyName("Distance2")]
[Range(0.0, 100.0)]
public float ProjDist2 { get; set; } = 66f;
[JsonPropertyName("Distance3")]
[Range(0.0, 100.0)]
public float ProjDist3 { get; set; } = 33f;
[JsonPropertyName("Size1")]
[Range(0.0, 3.0)]
public float ProjSize1 { get; set; } = 1f;
[JsonPropertyName("Size2")]
[Range(0.0, 3.0)]
public float ProjSize2 { get; set; } = 1f;
[JsonPropertyName("Size3")]
[Range(0.0, 3.0)]
public float ProjSize3 { get; set; } = 1f;
[JsonPropertyName("Zeroing")]
[Range(-1.0, 1.0)]
public float ZeroOffset { get; set; }
}
}using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using AIGraph;
using AK;
using Agents;
using AssetShards;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using BoosterImplants;
using CellMenu;
using ChainedPuzzles;
using EOSExt.Reactor.Managers;
using Enemies;
using ExtraObjectiveSetup;
using ExtraObjectiveSetup.BaseClasses;
using ExtraObjectiveSetup.ExtendedWardenEvents;
using ExtraObjectiveSetup.Instances;
using ExtraObjectiveSetup.JSON;
using ExtraObjectiveSetup.Utils;
using FloLib.Infos;
using FloLib.Networks.Replications;
using GTFO.API;
using GTFO.API.Utilities;
using GameData;
using GameEvent;
using Gear;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using LEGACY.ExtraEvents;
using LEGACY.ExtraEvents.Patches;
using LEGACY.LegacyOverride;
using LEGACY.LegacyOverride.DummyVisual;
using LEGACY.LegacyOverride.DummyVisual.VisualGOAnimation;
using LEGACY.LegacyOverride.DummyVisual.VisualGOAnimation.AnimationConfig;
using LEGACY.LegacyOverride.DummyVisual.VisualSequenceType;
using LEGACY.LegacyOverride.ElevatorCargo;
using LEGACY.LegacyOverride.EnemyTagger;
using LEGACY.LegacyOverride.EventScan;
using LEGACY.LegacyOverride.ExpeditionIntelNotification;
using LEGACY.LegacyOverride.ExpeditionSuccessPage;
using LEGACY.LegacyOverride.FogBeacon;
using LEGACY.LegacyOverride.ForceFail;
using LEGACY.LegacyOverride.Music;
using LEGACY.LegacyOverride.ResourceStations;
using LEGACY.LegacyOverride.Restart;
using LEGACY.Utils;
using LEGACY.VanillaFix;
using LevelGeneration;
using Localization;
using MTFO.API;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using ScanPosOverride.Managers;
using TMPro;
using ThermalSights;
using UnityEngine;
using UnityEngine.UI;
[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("LEGACY")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LEGACY")]
[assembly: AssemblyTitle("LEGACY")]
[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;
}
}
}
[HarmonyPatch(typeof(PUI_Watermark), "UpdateWatermark")]
internal static class Patch_WatermarkUpdateWatermark
{
private static void Postfix(PUI_Watermark __instance)
{
string text = "4.6.2+git44e73d7-dirty-main".Remove("x.x.x".Length);
((TMP_Text)__instance.m_watermarkText).SetText("<color=red>MODDED</color> <color=orange>" + text + "</color>\n<color=#33ff99>SURVIVAL</color>", true);
}
}
namespace LEGACY
{
internal static class Assets
{
public static GameObject CircleSensor { get; private set; }
public static GameObject MovableSensor { get; private set; }
public static GameObject OBSVisual { get; private set; }
public static GameObject ObjectiveMarker { get; private set; }
public static GameObject EventScan { get; private set; }
internal static GameObject DummyScan { get; private set; }
internal static GameObject DummySensor { get; private set; }
internal static GameObject AmmoStation { get; private set; }
internal static GameObject MediStation { get; private set; }
internal static GameObject ToolStation { get; private set; }
internal static GameObject RestartPage { get; private set; }
public static void Init()
{
CircleSensor = AssetAPI.GetLoadedAsset<GameObject>("Assets/SecuritySensor/CircleSensor.prefab");
MovableSensor = AssetAPI.GetLoadedAsset<GameObject>("Assets/SecuritySensor/MovableSensor.prefab");
OBSVisual = AssetAPI.GetLoadedAsset<GameObject>("Assets/SecuritySensor/OBSVisual.prefab");
ObjectiveMarker = AssetAPI.GetLoadedAsset<GameObject>("Assets/SecuritySensor/ObjectiveMarker.prefab");
EventScan = AssetAPI.GetLoadedAsset<GameObject>("Assets/EventObjects/EventScan.prefab");
DummyScan = AssetAPI.GetLoadedAsset<GameObject>("Assets/DummyVisual/DummyScan.prefab");
DummySensor = AssetAPI.GetLoadedAsset<GameObject>("Assets/DummyVisual/DummySensor.prefab");
AmmoStation = AssetAPI.GetLoadedAsset<GameObject>("Assets/Misc/AmmoStation.prefab");
MediStation = AssetAPI.GetLoadedAsset<GameObject>("Assets/Misc/MediStation.prefab");
ToolStation = AssetAPI.GetLoadedAsset<GameObject>("Assets/Misc/ToolStation.prefab");
RestartPage = AssetAPI.GetLoadedAsset<GameObject>("Assets/Misc/CM_PageRestart_CellUI.prefab");
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Inas.LEGACY", "LEGACY", "4.4.5")]
public class EntryPoint : BasePlugin
{
public const string AUTHOR = "Inas";
public const string RUNDOWN_NAME = "LEGACY";
public const string VERSION = "4.4.5";
public const bool TESTING = false;
public const string TEST_STRING = "TESTING";
private Harmony m_Harmony;
public override void Load()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
m_Harmony = new Harmony("LEGACY");
m_Harmony.PatchAll();
LegacyOverrideManagers.Init();
LegacyExtraEvents.Init();
LEGACY.VanillaFix.Debugger.Current.Init();
AssetAPI.OnAssetBundlesLoaded += Assets.Init;
EventAPI.OnManagersSetup += delegate
{
AssetShardManager.OnStartupAssetsLoaded += Action.op_Implicit((Action)MainMenuGuiLayer.Current.PageRundownNew.SetupCustomTutorialButton);
};
}
}
}
namespace LEGACY.Reactor
{
[HarmonyPatch]
internal class Patch_ReactorShutdown
{
[HarmonyPostfix]
[HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateChange")]
private static void Post_OnStateChange(LG_WardenObjective_Reactor __instance, pReactorState oldState, pReactorState newState)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Invalid comparison between Unknown and I4
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Expected I4, but got Unknown
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)__instance == (Object)null || oldState.status == newState.status)
{
return;
}
WardenObjectiveDataBlock val = null;
if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref val) || val == null)
{
LegacyLogger.Error("Patch_ReactorShutdown: ");
LegacyLogger.Error("Failed to get warden objective");
}
else if ((int)val.Type == 2 && !val.OnActivateOnSolveItem)
{
eWardenObjectiveEventTrigger val2 = (eWardenObjectiveEventTrigger)0;
eReactorStatus status = newState.status;
eReactorStatus val3 = status;
switch (val3 - 7)
{
default:
return;
case 0:
val2 = (eWardenObjectiveEventTrigger)1;
break;
case 1:
val2 = (eWardenObjectiveEventTrigger)2;
break;
case 2:
val2 = (eWardenObjectiveEventTrigger)3;
break;
}
LG_LayerType layerType = __instance.SpawnNode.LayerType;
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(val.EventsOnActivate, val2, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null);
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnBuildDone")]
private static void Pre_OnBuildDone_ChainedPuzzleMidObjectiveFix(LG_WardenObjective_Reactor __instance)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
WardenObjectiveDataBlock val = null;
if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref val) || val == null)
{
LegacyLogger.Error("Patch_ReactorShutdown: Failed to get warden objective");
}
else if (val.ChainedPuzzleMidObjective != 0)
{
__instance.m_chainedPuzzleAlignMidObjective = __instance.m_chainedPuzzleAlign;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(LG_WardenObjective_Reactor), "Update")]
private static bool Pre_Update(LG_WardenObjective_Reactor __instance)
{
//IL_0002: 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_000d: Invalid comparison between Unknown and I4
if ((int)__instance.m_currentState.status != 7)
{
return true;
}
if (!__instance.m_currentWaveData.HasVerificationTerminal)
{
return true;
}
__instance.SetGUIMessage(true, Text.Format(3000u, (Object[])(object)new Object[1] { Object.op_Implicit("<color=orange>" + __instance.m_currentWaveData.VerificationTerminalSerial + "</color>") }), (ePUIMessageStyle)3, false, "", "");
return false;
}
}
[HarmonyPatch]
internal class Patch_ReactorStartup_ExtraEventsExecution
{
[HarmonyPostfix]
[HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateChange")]
private static void Post_ExecuteOnNoneEventsOnDefenseStart(LG_WardenObjective_Reactor __instance, pReactorState oldState, pReactorState newState)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: 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_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: 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_001c: Invalid comparison between Unknown and I4
if (oldState.status != newState.status && (int)newState.status == 3)
{
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)0, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnBuildDone")]
private static void Post_OnBuildDone(LG_WardenObjective_Reactor __instance)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Invalid comparison between Unknown and I4
WardenObjectiveDataBlock db = default(WardenObjectiveDataBlock);
if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref db) || db == null)
{
LegacyLogger.Error("Patch_ReactorStartup_ExtraEventsExecution: ");
LegacyLogger.Error("Failed to get warden objective");
}
else if ((int)db.Type == 1 && !db.OnActivateOnSolveItem)
{
ChainedPuzzleInstance chainedPuzzleToStartSequence = __instance.m_chainedPuzzleToStartSequence;
chainedPuzzleToStartSequence.OnPuzzleSolved += Action.op_Implicit((Action)delegate
{
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(db.EventsOnActivate, (eWardenObjectiveEventTrigger)0, true, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null);
});
}
}
}
[HarmonyPatch]
internal class Patch_ReactorStartup_OverwriteGUIBehaviour
{
private static HashSet<uint> ForceDisableLevels;
[HarmonyPrefix]
[HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateChange")]
private static bool Pre_HideReactorMessageForInfiniteWave(LG_WardenObjective_Reactor __instance, pReactorState oldState, pReactorState newState)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: 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_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Invalid comparison between Unknown and I4
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Invalid comparison between Unknown and I4
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Invalid comparison between Unknown and I4
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Expected I4, but got Unknown
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_0310: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
if (oldState.status == newState.status)
{
return true;
}
if ((int)newState.status != 2 && (int)newState.status != 3 && (int)newState.status != 4)
{
return true;
}
if (ForceDisable())
{
if (oldState.stateCount != newState.stateCount)
{
__instance.OnStateCountUpdate(newState.stateCount);
}
if (oldState.stateProgress != newState.stateProgress)
{
__instance.OnStateProgressUpdate(newState.stateProgress);
}
__instance.ReadyForVerification = false;
eReactorStatus status = newState.status;
eReactorStatus val = status;
switch (val - 2)
{
case 0:
{
WardenObjectiveDataBlock val2 = null;
if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref val2) || val2 == null)
{
LegacyLogger.Error("Patch_ReactorStartup_OverwriteGUIBehaviour: ");
LegacyLogger.Error("Failed to get warden objective datablock");
break;
}
__instance.m_lightCollection.SetMode(val2.LightsOnDuringIntro);
__instance.m_lightCollection.ResetUpdateValues(true);
__instance.lcReset = true;
__instance.m_lightsBlinking = false;
__instance.m_spawnEnemies = false;
__instance.m_progressUpdateEnabled = true;
__instance.m_alarmCountdownPlayed = false;
__instance.m_currentDuration = ((!newState.verifyFailed) ? __instance.m_currentWaveData.Warmup : __instance.m_currentWaveData.WarmupFail);
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)1, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null);
if (__instance.m_currentWaveCount == 1)
{
Debug.LogError(Object.op_Implicit("Reactor IDLE START"));
__instance.m_sound.Post(EVENTS.REACTOR_POWER_LEVEL_1_LOOP, true);
__instance.m_sound.SetRTPCValue(GAME_PARAMETERS.REACTOR_POWER, 0f);
}
else
{
Debug.LogError(Object.op_Implicit("Reactor REACTOR_POWER_DOWN"));
__instance.m_sound.Post(EVENTS.REACTOR_POWER_LEVEL_2_TO_1_TRANSITION, true);
__instance.m_sound.SetRTPCValue(GAME_PARAMETERS.REACTOR_POWER, 0f);
}
break;
}
case 1:
__instance.m_lightCollection.ResetUpdateValues(true);
__instance.lcReset = true;
__instance.m_spawnEnemies = true;
__instance.m_currentEnemyWaveIndex = 0;
__instance.m_alarmCountdownPlayed = false;
__instance.m_progressUpdateEnabled = true;
__instance.m_currentDuration = __instance.m_currentWaveData.Wave;
__instance.m_sound.Post(EVENTS.REACTOR_POWER_LEVEL_1_TO_3_TRANSITION, true);
break;
case 2:
__instance.m_lightCollection.ResetUpdateValues(false);
__instance.lcReset = true;
__instance.m_spawnEnemies = false;
__instance.m_progressUpdateEnabled = true;
__instance.ReadyForVerification = true;
Debug.Log(Object.op_Implicit("Wait for verify! newState.verifyFailed? " + newState.verifyFailed));
__instance.m_currentDuration = ((!newState.verifyFailed) ? __instance.m_currentWaveData.Verify : __instance.m_currentWaveData.VerifyFail);
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)2, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null);
break;
}
__instance.m_currentState = newState;
return false;
}
return true;
}
private static bool ForceDisable()
{
return ForceDisableLevels.Contains(RundownManager.ActiveExpedition.LevelLayoutData);
}
static Patch_ReactorStartup_OverwriteGUIBehaviour()
{
ForceDisableLevels = new HashSet<uint>();
LevelLayoutDataBlock block = GameDataBlockBase<LevelLayoutDataBlock>.GetBlock("Legacy_L3E2_L1");
if (block != null)
{
ForceDisableLevels.Add(((GameDataBlockBase<LevelLayoutDataBlock>)(object)block).persistentID);
}
block = GameDataBlockBase<LevelLayoutDataBlock>.GetBlock("Legacy_L1E1_L1");
if (block != null)
{
ForceDisableLevels.Add(((GameDataBlockBase<LevelLayoutDataBlock>)(object)block).persistentID);
}
}
}
}
namespace LEGACY.HardcodedBehaviours
{
[HarmonyPatch]
internal class Patch_PickupItem_Hardcoded
{
[HarmonyPrefix]
[HarmonyPatch(typeof(LG_Distribute_PickupItemsPerZone), "Build")]
private static void Pre_LG_Distribute_PickupItemsPerZone(LG_Distribute_PickupItemsPerZone __instance)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Invalid comparison between Unknown and I4
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Invalid comparison between Unknown and I4
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Invalid comparison between Unknown and I4
LevelLayoutDataBlock block = GameDataBlockBase<LevelLayoutDataBlock>.GetBlock("LAYOUT_O4_1_L1");
if (block == null || RundownManager.ActiveExpedition.LevelLayoutData != ((GameDataBlockBase<LevelLayoutDataBlock>)(object)block).persistentID)
{
return;
}
eLocalZoneIndex localIndex = __instance.m_zone.LocalIndex;
eLocalZoneIndex val = localIndex;
if ((int)val != 1)
{
if ((int)val == 5)
{
__instance.m_zonePlacementWeights.Start = 0f;
__instance.m_zonePlacementWeights.Middle = 0f;
__instance.m_zonePlacementWeights.End = 100000f;
}
return;
}
ePickupItemType pickupType = __instance.m_pickupType;
ePickupItemType val2 = pickupType;
if ((int)val2 == 1)
{
__instance.m_zonePlacementWeights.Start = 100000f;
__instance.m_zonePlacementWeights.Middle = 0f;
__instance.m_zonePlacementWeights.End = 0f;
}
}
}
}
namespace LEGACY.VanillaFix
{
[HarmonyPatch]
internal class Patch_FixScoutFreeze
{
[HarmonyPrefix]
[HarmonyPatch(typeof(ES_ScoutScream), "CommonUpdate")]
private static bool Prefix_Debug(ES_ScoutScream __instance)
{
if (((AgentAI)((ES_Base)__instance).m_ai).Target == null)
{
return false;
}
return true;
}
}
[HarmonyPatch]
internal class Patch_LG_SecurityDoor_Fix_EventsOnUnlockDoor_Powergenerator
{
[HarmonyPrefix]
[HarmonyPatch(typeof(LG_SecurityDoor), "OnSyncDoorStatusChange")]
private static void Pre_OnSyncDoorStatusChange(LG_SecurityDoor __instance, pDoorState state, bool isRecall)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: 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_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Invalid comparison between Unknown and I4
//IL_001a: 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_0025: Invalid comparison between Unknown and I4
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Invalid comparison between Unknown and I4
eDoorStatus status = state.status;
eDoorStatus val = status;
if ((val - 4 <= 1 || (int)val == 9) && (int)__instance.m_lastState.status == 6 && !isRecall)
{
WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.LinkedToZoneData.EventsOnUnlockDoor, (eWardenObjectiveEventTrigger)0, true, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null);
}
}
}
[HarmonyPatch]
internal class Patch_LockSecurityDoor_FixCustomText
{
[HarmonyPostfix]
[HarmonyPatch(typeof(LG_SecurityDoor_Locks), "Setup", new Type[] { typeof(LG_SecurityDoor) })]
private static void Post_LG_SecurityDoor_Locks_Setup(LG_SecurityDoor door, LG_SecurityDoor_Locks __instance)
{
LocalizedText customText = door.LinkedToZoneData.ProgressionPuzzleToEnter.CustomText;
__instance.m_lockedWithNoKeyInteractionText = customText;
}
}
[HarmonyPatch]
internal class Debugger
{
public static Debugger Current { get; private set; } = new Debugger();
public bool DEBUGGING { get; private set; } = false;
private Debugger()
{
}
internal void Init()
{
if (DEBUGGING)
{
}
}
private void f1(int k, out string v)
{
if (k < 2)
{
v = "2";
}
v = null;
}
private void f2(int k, ref string v)
{
if (k < 2)
{
v = "2";
}
}
}
}
namespace LEGACY.Utils
{
public delegate float EasingFunction(float t, float b, float c, float d);
public delegate bool BoolCheck();
internal static class CoroutineEase
{
[CompilerGenerated]
private sealed class <DoEaseLocalPos>d__1 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Transform trans;
public Vector3 sourcePos;
public Vector3 targetPos;
public float startTime;
public float duration;
public EasingFunction ease;
public Action onDone;
public BoolCheck checkAbort;
private bool <doAbort>5__1;
private float <t>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DoEaseLocalPos>d__1(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<doAbort>5__1 = false;
break;
case 1:
<>1__state = -1;
break;
}
if (Clock.Time < startTime + duration && !<doAbort>5__1)
{
<doAbort>5__1 = checkAbort != null && checkAbort();
<t>5__2 = ease(Clock.Time - startTime, 0f, 1f, duration);
trans.localPosition = Vector3.Lerp(sourcePos, targetPos, <t>5__2);
<>2__current = null;
<>1__state = 1;
return true;
}
trans.localPosition = targetPos;
if (!<doAbort>5__1 && onDone != null)
{
onDone();
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <DoEaseLocalRot>d__2 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Transform trans;
public Vector3 sourceEuler;
public Vector3 targetEuler;
public float startTime;
public float duration;
public EasingFunction ease;
public Action onDone;
public BoolCheck checkAbort;
private bool <doAbort>5__1;
private float <t>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DoEaseLocalRot>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<doAbort>5__1 = false;
break;
case 1:
<>1__state = -1;
break;
}
if (Clock.Time < startTime + duration && !<doAbort>5__1)
{
<doAbort>5__1 = checkAbort != null && checkAbort();
<t>5__2 = ease(Clock.Time - startTime, 0f, 1f, duration);
trans.localEulerAngles = Vector3.Lerp(sourceEuler, targetEuler, <t>5__2);
<>2__current = null;
<>1__state = 1;
return true;
}
trans.localEulerAngles = targetEuler;
if (!<doAbort>5__1 && onDone != null)
{
onDone();
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <DoEaseLocalScale>d__0 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Transform trans;
public Vector3 startScale;
public Vector3 targetScale;
public float startTime;
public float duration;
public EasingFunction ease;
public Action onDone;
public BoolCheck checkAbort;
private bool <doAbort>5__1;
private float <t>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DoEaseLocalScale>d__0(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<doAbort>5__1 = false;
break;
case 1:
<>1__state = -1;
break;
}
if (Clock.Time < startTime + duration && !<doAbort>5__1)
{
<doAbort>5__1 = checkAbort != null && checkAbort();
<t>5__2 = ease(Clock.Time - startTime, 0f, 1f, duration);
trans.localScale = Vector3.Lerp(startScale, targetScale, <t>5__2);
<>2__current = null;
<>1__state = 1;
return true;
}
trans.localScale = targetScale;
if (!<doAbort>5__1 && onDone != null)
{
onDone();
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[IteratorStateMachine(typeof(<DoEaseLocalScale>d__0))]
private static IEnumerator DoEaseLocalScale(Transform trans, Vector3 startScale, Vector3 targetScale, float startTime, float duration, EasingFunction ease, Action onDone, BoolCheck checkAbort)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: 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)
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DoEaseLocalScale>d__0(0)
{
trans = trans,
startScale = startScale,
targetScale = targetScale,
startTime = startTime,
duration = duration,
ease = ease,
onDone = onDone,
checkAbort = checkAbort
};
}
[IteratorStateMachine(typeof(<DoEaseLocalPos>d__1))]
private static IEnumerator DoEaseLocalPos(Transform trans, Vector3 sourcePos, Vector3 targetPos, float startTime, float duration, EasingFunction ease, Action onDone, BoolCheck checkAbort)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: 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)
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DoEaseLocalPos>d__1(0)
{
trans = trans,
sourcePos = sourcePos,
targetPos = targetPos,
startTime = startTime,
duration = duration,
ease = ease,
onDone = onDone,
checkAbort = checkAbort
};
}
[IteratorStateMachine(typeof(<DoEaseLocalRot>d__2))]
private static IEnumerator DoEaseLocalRot(Transform trans, Vector3 sourceEuler, Vector3 targetEuler, float startTime, float duration, EasingFunction ease, Action onDone, BoolCheck checkAbort)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: 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)
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DoEaseLocalRot>d__2(0)
{
trans = trans,
sourceEuler = sourceEuler,
targetEuler = targetEuler,
startTime = startTime,
duration = duration,
ease = ease,
onDone = onDone,
checkAbort = checkAbort
};
}
internal static Coroutine EaseLocalScale(Transform trans, Vector3 startScale, Vector3 targetScale, float duration, EasingFunction ease = null, Action onDone = null, BoolCheck checkAbort = null)
{
//IL_0015: 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)
EasingFunction ease2 = ease ?? new EasingFunction(Easing.EaseOutExpo);
return CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoEaseLocalScale(trans, startScale, targetScale, Clock.Time, duration, ease2, onDone, checkAbort)), (Action)null);
}
internal static Coroutine EaseLocalPos(Transform trans, Vector3 sourcePos, Vector3 targetPos, float duration, EasingFunction ease = null, Action onDone = null, BoolCheck checkAbort = null)
{
//IL_0015: 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)
EasingFunction ease2 = ease ?? new EasingFunction(Easing.EaseOutExpo);
return CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoEaseLocalPos(trans, sourcePos, targetPos, Clock.Time, duration, ease2, onDone, checkAbort)), (Action)null);
}
internal static Coroutine EaseLocalRot(Transform trans, Vector3 sourceEuler, Vector3 targetEuler, float duration, EasingFunction ease = null, Action onDone = null, BoolCheck checkAbort = null)
{
//IL_0015: 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)
EasingFunction ease2 = ease ?? new EasingFunction(Easing.EaseOutExpo);
return CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoEaseLocalRot(trans, sourceEuler, targetEuler, Clock.Time, duration, ease2, onDone, checkAbort)), (Action)null);
}
}
public static class GOExtensions
{
public static GameObject GetChild(this GameObject go, string childName, bool substrSearch = false, bool recursiveSearch = true)
{
if (((Object)go).name.Equals(childName) || (substrSearch && ((Object)go).name.Contains(childName)))
{
return go;
}
for (int i = 0; i < go.transform.childCount; i++)
{
GameObject gameObject = ((Component)go.transform.GetChild(i)).gameObject;
GameObject val = null;
if (recursiveSearch)
{
val = gameObject.GetChild(childName, substrSearch);
}
else if (((Object)gameObject).name.Equals(childName) || (substrSearch && ((Object)gameObject).name.Contains(childName)))
{
val = gameObject;
}
if ((Object)(object)val != (Object)null)
{
return val;
}
}
return null;
}
}
public static class Helper
{
private static void ResetChild(iChainedPuzzleCore ICore)
{
CP_Bioscan_Core val = ((Il2CppObjectBase)ICore).TryCast<CP_Bioscan_Core>();
if ((Object)(object)val != (Object)null)
{
CP_Holopath_Spline val2 = ((Il2CppObjectBase)val.m_spline).Cast<CP_Holopath_Spline>();
CP_PlayerScanner val3 = ((Il2CppObjectBase)val.PlayerScanner).Cast<CP_PlayerScanner>();
val3.ResetScanProgression(0f);
val.Deactivate();
return;
}
CP_Cluster_Core val4 = ((Il2CppObjectBase)ICore).TryCast<CP_Cluster_Core>();
if ((Object)(object)val4 == (Object)null)
{
LegacyLogger.Error("ResetChild: found iChainedPuzzleCore that is neither CP_Bioscan_Core nor CP_Cluster_Core...");
return;
}
CP_Holopath_Spline val5 = ((Il2CppObjectBase)val4.m_spline).Cast<CP_Holopath_Spline>();
foreach (iChainedPuzzleCore item in (Il2CppArrayBase<iChainedPuzzleCore>)(object)val4.m_childCores)
{
ResetChild(item);
}
val4.Deactivate();
}
public static void ResetChainedPuzzle(ChainedPuzzleInstance chainedPuzzleInstance)
{
//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)
//IL_0027: Expected O, but got Unknown
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
if (chainedPuzzleInstance.Data.DisableSurvivalWaveOnComplete)
{
chainedPuzzleInstance.m_sound = new CellSoundPlayer(chainedPuzzleInstance.m_parent.position);
}
foreach (iChainedPuzzleCore item in (Il2CppArrayBase<iChainedPuzzleCore>)(object)chainedPuzzleInstance.m_chainedPuzzleCores)
{
ResetChild(item);
}
if (SNet.IsMaster)
{
pChainedPuzzleState state = chainedPuzzleInstance.m_stateReplicator.State;
pChainedPuzzleState val = default(pChainedPuzzleState);
val.status = (eChainedPuzzleStatus)0;
val.currentSurvivalWave_EventID = state.currentSurvivalWave_EventID;
val.isSolved = false;
val.isActive = false;
pChainedPuzzleState val2 = val;
chainedPuzzleInstance.m_stateReplicator.InteractWithState(val2, new pChainedPuzzleInteraction
{
type = (eChainedPuzzleInteraction)2
});
}
}
public static List<T> ToManagedList<T>(this List<T> il2cppList)
{
List<T> list = new List<T>();
Enumerator<T> enumerator = il2cppList.GetEnumerator();
while (enumerator.MoveNext())
{
T current = enumerator.Current;
list.Add(current);
}
return list;
}
public static bool TryGetComponent<T>(this GameObject obj, out T comp)
{
comp = obj.GetComponent<T>();
return comp != null;
}
public static bool IsPlayerInLevel(PlayerAgent player)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Invalid comparison between Unknown and I4
return (int)player.Owner.Load<pGameState>().gameState == 10;
}
public static ChainedPuzzleInstance GetChainedPuzzleForCommandOnTerminal(LG_ComputerTerminal terminal, string command)
{
//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_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected I4, but got Unknown
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Invalid comparison between Unknown and I4
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Invalid comparison between Unknown and I4
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Invalid comparison between Unknown and I4
//IL_0218: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Invalid comparison between Unknown and I4
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Invalid comparison between Unknown and I4
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Invalid comparison between Unknown and I4
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
uint num = 0u;
if (terminal.SpawnNode.m_dimension.IsMainDimension)
{
LG_LayerType layerType = terminal.SpawnNode.LayerType;
LG_LayerType val = layerType;
switch ((int)val)
{
case 0:
num = RundownManager.ActiveExpedition.LevelLayoutData;
break;
case 1:
num = RundownManager.ActiveExpedition.SecondaryLayout;
break;
case 2:
num = RundownManager.ActiveExpedition.ThirdLayout;
break;
default:
LegacyLogger.Error("Unimplemented layer type.");
return null;
}
}
else
{
num = terminal.SpawnNode.m_dimension.DimensionData.LevelLayoutData;
}
LevelLayoutDataBlock block = GameDataBlockBase<LevelLayoutDataBlock>.GetBlock(num);
List<CustomTerminalCommand> val2 = null;
List<LG_ComputerTerminal> terminalsSpawnedInZone = terminal.SpawnNode.m_zone.TerminalsSpawnedInZone;
int num2 = terminalsSpawnedInZone.IndexOf(terminal);
ExpeditionZoneData val3 = null;
Enumerator<ExpeditionZoneData> enumerator = block.Zones.GetEnumerator();
while (enumerator.MoveNext())
{
ExpeditionZoneData current = enumerator.Current;
if (current.LocalIndex == terminal.SpawnNode.m_zone.LocalIndex)
{
val3 = current;
break;
}
}
if (val3 == null)
{
LegacyLogger.Error("Cannot find target zone data.");
return null;
}
if (val3.TerminalPlacements.Count != terminalsSpawnedInZone.Count)
{
LegacyLogger.Error("The numbers of terminal placement and spawn, skipped for the zone terminal.");
return null;
}
val2 = val3.TerminalPlacements[num2].UniqueCommands;
if (val2.Count == 0)
{
return null;
}
List<WardenObjectiveEventData> val4 = null;
TERM_Command val5 = (TERM_Command)0;
Enumerator<CustomTerminalCommand> enumerator2 = val2.GetEnumerator();
string text = default(string);
string text2 = default(string);
while (enumerator2.MoveNext())
{
CustomTerminalCommand current2 = enumerator2.Current;
if (current2.Command == command)
{
val4 = current2.CommandEvents;
if (!terminal.m_command.TryGetCommand(current2.Command, ref val5, ref text, ref text2))
{
LegacyLogger.Error("Cannot get TERM_COMMAND for command {0} on the specified terminal.");
}
break;
}
}
if (val4 == null || (int)val5 == 0)
{
return null;
}
if ((int)val5 != 38 && (int)val5 != 39 && (int)val5 != 40 && (int)val5 != 41 && (int)val5 != 42)
{
return null;
}
ChainedPuzzleInstance val6 = null;
for (int i = 0; i < val4.Count && (val4[i].ChainPuzzle == 0 || !terminal.TryGetChainPuzzleForCommand(val5, i, ref val6) || !((Object)(object)val6 != (Object)null)); i++)
{
}
return val6;
}
public static bool TryGetZoneEntranceSecDoor(LG_Zone zone, out LG_SecurityDoor door)
{
if ((Object)(object)zone == (Object)null)
{
door = null;
return false;
}
if ((Object)(object)zone.m_sourceGate == (Object)null)
{
door = null;
return false;
}
if (zone.m_sourceGate.SpawnedDoor == null)
{
door = null;
return false;
}
door = ((Il2CppObjectBase)zone.m_sourceGate.SpawnedDoor).TryCast<LG_SecurityDoor>();
return (Object)(object)door != (Object)null;
}
internal static bool isSecDoorToZoneOpened(LG_Zone zone14)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Invalid comparison between Unknown and I4
LG_SecurityDoor door = null;
if (!TryGetZoneEntranceSecDoor(zone14, out door) || (Object)(object)door == (Object)null)
{
return false;
}
return (int)door.m_sync.GetCurrentSyncState().status == 10;
}
public static List<T> cast<T>(List<T> list)
{
List<T> list2 = new List<T>();
Enumerator<T> enumerator = list.GetEnumerator();
while (enumerator.MoveNext())
{
T current = enumerator.Current;
list2.Add(current);
}
return list2;
}
private static eDimensionIndex GetCurrentDimensionIndex()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: 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)
if (PlayerManager.PlayerAgentsInLevel.Count <= 0)
{
throw new Exception("? You don't have any player agent in level? How could that happen?");
}
return ((Agent)PlayerManager.PlayerAgentsInLevel[0]).DimensionIndex;
}
public static void GetMinLayerAndLocalIndex(out LG_LayerType MinLayer, out eLocalZoneIndex MinLocalIndex)
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Invalid comparison between I4 and Unknown
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Invalid comparison between I4 and Unknown
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected I4, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Expected I4, but got Unknown
MinLayer = (LG_LayerType)2;
MinLocalIndex = (eLocalZoneIndex)20;
Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
while (enumerator.MoveNext())
{
PlayerAgent current = enumerator.Current;
if (IsPlayerInLevel(current))
{
if ((int)MinLayer > (int)current.m_courseNode.LayerType)
{
MinLayer = (LG_LayerType)(int)current.m_courseNode.LayerType;
MinLocalIndex = (eLocalZoneIndex)20;
}
if ((int)MinLocalIndex >= (int)current.m_courseNode.m_zone.LocalIndex)
{
MinLocalIndex = (eLocalZoneIndex)(int)current.m_courseNode.m_zone.LocalIndex;
}
}
}
}
public static void GetMaxLayerAndLocalIndex(out LG_LayerType MaxLayer, out eLocalZoneIndex MaxLocalIndex)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Invalid comparison between I4 and Unknown
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Invalid comparison between I4 and Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected I4, but got Unknown
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Expected I4, but got Unknown
MaxLayer = (LG_LayerType)0;
MaxLocalIndex = (eLocalZoneIndex)0;
Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
while (enumerator.MoveNext())
{
PlayerAgent current = enumerator.Current;
if (IsPlayerInLevel(current))
{
if ((int)MaxLayer < (int)current.m_courseNode.LayerType)
{
MaxLayer = (LG_LayerType)(int)current.m_courseNode.LayerType;
MaxLocalIndex = (eLocalZoneIndex)0;
}
if ((int)MaxLocalIndex < (int)current.m_courseNode.m_zone.LocalIndex)
{
MaxLocalIndex = (eLocalZoneIndex)(int)current.m_courseNode.m_zone.LocalIndex;
}
}
}
}
public static int GetMinAreaIndex(LG_Zone zone)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: 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_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)zone == (Object)null)
{
return -1;
}
LG_LayerType type = zone.m_layer.m_type;
eLocalZoneIndex localIndex = zone.LocalIndex;
eDimensionIndex currentDimensionIndex = GetCurrentDimensionIndex();
int num = zone.m_areas.Count;
Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
while (enumerator.MoveNext())
{
PlayerAgent current = enumerator.Current;
if (current.m_courseNode.LayerType != type || current.m_courseNode.m_zone.LocalIndex != localIndex)
{
continue;
}
int i = 0;
for (List<LG_Area> areas = zone.m_areas; i < areas.Count; i++)
{
if (((Object)((Component)areas[i]).gameObject).GetInstanceID() == ((Object)((Component)current.m_courseNode.m_area).gameObject).GetInstanceID())
{
if (num > i)
{
num = i;
}
break;
}
}
}
return num;
}
public static LG_ComputerTerminal FindTerminal(eDimensionIndex dimensionIndex, LG_LayerType layerType, eLocalZoneIndex localIndex, int terminalIndex)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
LG_Zone val = null;
if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(dimensionIndex, layerType, localIndex, ref val) || (Object)(object)val == (Object)null)
{
LegacyLogger.Error($"FindTerminal: Didn't find LG_Zone {dimensionIndex}, {layerType}, {localIndex}");
return null;
}
if (val.TerminalsSpawnedInZone == null || terminalIndex >= val.TerminalsSpawnedInZone.Count)
{
LegacyLogger.Error($"FindTerminal: Invalid terminal index {terminalIndex} - {((val.TerminalsSpawnedInZone != null) ? val.TerminalsSpawnedInZone.Count : 0)} terminals are spawned in {dimensionIndex}, {layerType}, {localIndex}");
return null;
}
return (terminalIndex < 0) ? null : val.TerminalsSpawnedInZone[terminalIndex];
}
public static AIG_NodeCluster GetNodeFromDimensionPosition(eDimensionIndex dimensionIndex, Vector3 position)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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)
AIG_GeomorphNodeVolume val = default(AIG_GeomorphNodeVolume);
AIG_VoxelNodePillar val2 = default(AIG_VoxelNodePillar);
AIG_INode val3 = default(AIG_INode);
AIG_NodeCluster result = default(AIG_NodeCluster);
if (!AIG_GeomorphNodeVolume.TryGetGeomorphVolume(0, dimensionIndex, position, ref val) || !((AIG_NodeVolume)val).m_voxelNodeVolume.TryGetPillar(position, ref val2) || !val2.TryGetVoxelNode(position.y, ref val3) || !AIG_NodeCluster.TryGetNodeCluster(val3.ClusterID, ref result))
{
LegacyLogger.Error("TryWarpTo : Position is not valid, try again inside an area.");
return null;
}
return result;
}
}
internal static class Json
{
static Json()
{
}
public static T Deserialize<T>(string json)
{
return EOSJson.Deserialize<T>(json);
}
public static object Deserialize(Type type, string json)
{
return EOSJson.Deserialize(type, json);
}
public static string Serialize<T>(T value)
{
return EOSJson.Serialize<T>(value);
}
public static void Load<T>(string filePath, out T config) where T : new()
{
config = Deserialize<T>(File.ReadAllText(filePath));
}
}
internal static class LegacyLogger
{
private static ManualLogSource logger = Logger.CreateLogSource("LEGACYCore");
public static void Log(string format, params object[] args)
{
Log(string.Format(format, args));
}
public static void Log(string str)
{
if (logger != null)
{
logger.Log((LogLevel)8, (object)str);
}
}
public static void Warning(string format, params object[] args)
{
Warning(string.Format(format, args));
}
public static void Warning(string str)
{
if (logger != null)
{
logger.Log((LogLevel)4, (object)str);
}
}
public static void Error(string format, params object[] args)
{
Error(string.Format(format, args));
}
public static void Error(string str)
{
if (logger != null)
{
logger.Log((LogLevel)2, (object)str);
}
}
public static void Debug(string format, params object[] args)
{
Debug(string.Format(format, args));
}
public static void Debug(string str)
{
if (logger != null)
{
logger.Log((LogLevel)32, (object)str);
}
}
}
public class SpawnHibernateEnemiesEvent
{
public eWardenObjectiveEventTrigger Trigger { get; set; } = (eWardenObjectiveEventTrigger)0;
public int Type { get; set; } = 170;
public eDimensionIndex DimensionIndex { get; set; } = (eDimensionIndex)0;
public LG_LayerType Layer { get; set; } = (LG_LayerType)0;
public eLocalZoneIndex LocalIndex { get; set; } = (eLocalZoneIndex)0;
public string WorldEventObjectFilter { get; set; } = "RANDOM";
public uint EnemyID { get; set; }
public int Count { get; set; } = 1;
public float Delay { get; set; } = 0f;
public float Duration { get; set; } = 2f;
}
public class WeightedAreaSelector
{
private static readonly Dictionary<LG_Zone, WeightedAreaSelector> dict;
private WeightedRandomBag<LG_Area> weightedRandomBag;
public static WeightedAreaSelector Get(LG_Zone zone)
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Expected I4, but got Unknown
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
if (!dict.ContainsKey(zone))
{
WeightedAreaSelector weightedAreaSelector = new WeightedAreaSelector();
Enumerator<LG_Area> enumerator = zone.m_areas.GetEnumerator();
while (enumerator.MoveNext())
{
LG_Area current = enumerator.Current;
float num = 0f;
LG_AreaSize size = current.m_size;
LG_AreaSize val = size;
switch (val - 1)
{
case 4:
num = 7f;
break;
case 0:
num = 20f;
break;
case 1:
num = 30f;
break;
case 2:
num = 35f;
break;
case 3:
num = 45f;
break;
default:
LegacyLogger.Error($"Unhandled LG_AreaSize: {current.m_size}. Won't build.");
return null;
}
weightedAreaSelector.AddEntry(current, num);
}
dict.Add(zone, weightedAreaSelector);
}
return dict[zone];
}
public static WeightedAreaSelector Get(eDimensionIndex eDimensionIndex, LG_LayerType layerType, eLocalZoneIndex localIndex)
{
//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_0008: Unknown result type (might be due to invalid IL or missing references)
LG_Zone val = default(LG_Zone);
if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(eDimensionIndex, layerType, localIndex, ref val) || !Object.op_Implicit((Object)(object)val))
{
return null;
}
return Get(val);
}
private WeightedAreaSelector()
{
weightedRandomBag = new WeightedRandomBag<LG_Area>();
}
private void AddEntry(LG_Area area, float weight)
{
weightedRandomBag.AddEntry(area, weight);
}
public LG_Area GetRandom()
{
return weightedRandomBag.GetRandom();
}
private static void OnBuildDone()
{
}
private static void Clear()
{
dict.Clear();
}
static WeightedAreaSelector()
{
dict = new Dictionary<LG_Zone, WeightedAreaSelector>();
LevelAPI.OnLevelCleanup += dict.Clear;
}
}
public class WeightedRandomBag<T>
{
private struct Entry
{
public double accumulatedWeight;
public T item;
}
private List<Entry> entries = new List<Entry>();
private double accumulatedWeight;
private Random rand = new Random();
public void AddEntry(T item, double weight)
{
if (weight <= 0.0)
{
LegacyLogger.Error("AddEntry: no non-positive weight pls.");
return;
}
accumulatedWeight += weight;
entries.Add(new Entry
{
item = item,
accumulatedWeight = accumulatedWeight
});
}
public T GetRandom()
{
double num = rand.NextDouble() * accumulatedWeight;
foreach (Entry entry in entries)
{
if (entry.accumulatedWeight >= num)
{
return entry.item;
}
}
return default(T);
}
}
}
namespace LEGACY.LegacyOverride
{
internal class NavMarkerManager
{
private Dictionary<string, GameObject> markerVisuals = new Dictionary<string, GameObject>();
private Dictionary<string, NavMarker> navMarkers = new Dictionary<string, NavMarker>();
private List<GameObject> arbitraryNavMarkers = new List<GameObject>();
public static NavMarkerManager Current { get; private set; } = new NavMarkerManager();
private GameObject InstantiateMarkerVisual()
{
//IL_0019: 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_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(Assets.ObjectiveMarker);
float num = 0.16216217f;
Transform transform = val.transform;
transform.localPosition += Vector3.up * num;
return val;
}
public void EnableMarkerAt(string markerName, GameObject target, float scale)
{
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
if (navMarkers.ContainsKey(markerName))
{
navMarkers[markerName].SetVisible(true);
}
else
{
NavMarker val = GuiManager.NavMarkerLayer.PrepareGenericMarker(target);
if ((Object)(object)val != (Object)null)
{
val.SetColor(new Color(0.855f, 0.482f, 0.976f));
val.SetStyle((eNavMarkerStyle)14);
val.SetVisible(true);
navMarkers[markerName] = val;
}
else
{
LegacyLogger.Error("EnableMarkerAt: got null nav marker");
}
}
GameObject val2 = null;
if (markerVisuals.ContainsKey(markerName))
{
val2 = markerVisuals[markerName];
}
else
{
val2 = InstantiateMarkerVisual();
val2.transform.localScale = new Vector3(scale, scale, scale);
val2.transform.SetPositionAndRotation(target.transform.position, Quaternion.identity);
markerVisuals[markerName] = val2;
}
CoroutineManager.BlinkIn(val2, 0f);
LegacyLogger.Debug("EnableMarker: marker " + markerName + " enabled");
}
public void EnableArbitraryMarkerAt(string markerName, Vector3 Position)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
if (navMarkers.ContainsKey(markerName))
{
navMarkers[markerName].SetVisible(true);
}
else
{
GameObject val = new GameObject(markerName);
val.transform.SetPositionAndRotation(Position, Quaternion.identity);
arbitraryNavMarkers.Add(val);
NavMarker val2 = GuiManager.NavMarkerLayer.PrepareGenericMarker(val);
if ((Object)(object)val2 != (Object)null)
{
val2.SetColor(new Color(0.855f, 0.482f, 0.976f));
val2.SetStyle((eNavMarkerStyle)14);
val2.SetVisible(true);
navMarkers[markerName] = val2;
}
else
{
LegacyLogger.Error("EnableMarkerAt: got null nav marker");
}
}
LegacyLogger.Debug("EnableMarker: marker " + markerName + " enabled");
}
internal (GameObject markerVisual, NavMarker navMakrer) GetMarkerVisuals(string markerName)
{
GameObject value;
NavMarker value2;
return (markerVisuals.TryGetValue(markerName, out value) && navMarkers.TryGetValue(markerName, out value2)) ? (value, value2) : (null, null);
}
public void DisableMakrer(string markerName)
{
if (navMarkers.ContainsKey(markerName))
{
navMarkers[markerName].SetVisible(false);
}
if (markerVisuals.ContainsKey(markerName))
{
GameObject val = markerVisuals[markerName];
if (val.active)
{
CoroutineManager.BlinkOut(val, 0f);
}
LegacyLogger.Debug("DisableMakrer: marker " + markerName + " disabled");
}
}
public void Clear()
{
foreach (GameObject value in markerVisuals.Values)
{
Object.Destroy((Object)(object)value);
}
arbitraryNavMarkers.ForEach((Action<GameObject>)Object.Destroy);
markerVisuals.Clear();
navMarkers.Clear();
arbitraryNavMarkers.Clear();
}
private NavMarkerManager()
{
LevelAPI.OnBuildStart += Clear;
LevelAPI.OnLevelCleanup += Clear;
}
}
internal static class LegacyOverrideManagers
{
internal static readonly string LEGACY_CONFIG_PATH = Path.Combine(MTFOPathAPI.CustomPath, "LegacyOverride");
internal static void Init()
{
ElevatorCargoOverrideManager.Current.Init();
BigPickupFogBeaconSettingManager.Current.Init();
EnemyTaggerSettingManager.Current.Init();
ForceFailManager.Current.Init();
((GenericExpeditionDefinitionManager<ExpeditionIntel>)ExpeditionIntelNotifier.Current).Init();
((GenericExpeditionDefinitionManager<EventScanDefinition>)EventScanManager.Current).Init();
((GenericExpeditionDefinitionManager<VisualGroupDefinition>)VisualManager.Current).Init();
((GenericExpeditionDefinitionManager<MusicOverride>)MusicStateOverrider.Current).Init();
((ZoneDefinitionManager<LevelSpawnedFogBeaconDefinition>)LevelSpawnedFogBeaconManager.Current).Init();
((GenericExpeditionDefinitionManager<SuccessPageCustomization>)SuccessPageCustomizationManager.Current).Init();
((GenericExpeditionDefinitionManager<ResourceStationDefinition>)ResourceStationManager.Current).Init();
}
}
}
namespace LEGACY.LegacyOverride.Restart
{
public static class CM_PageRestart
{
internal static TextMeshPro Text { get; private set; }
internal static GameObject Reconnecting { get; private set; }
public static GameObject Page { get; private set; }
internal static void Setup()
{
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Assets.RestartPage == (Object)null)
{
return;
}
if ((Object)(object)Page != (Object)null)
{
LegacyLogger.Warning("Duplicate setup for CM_PageRestart!");
try
{
Object.Destroy((Object)(object)Page);
}
finally
{
Page = null;
}
}
Transform transform = ((Component)((GuiLayer)GuiManager.Current.m_mainMenuLayer).GuiLayerBase).transform;
Page = Object.Instantiate<GameObject>(Assets.RestartPage, transform.position, transform.rotation, transform);
CM_PageBase component = Page.GetComponent<CM_PageBase>();
GameObject gameObject = ((Component)component.m_movingContentHolder).gameObject;
Reconnecting = gameObject.GetChild("Reconnecting");
GameObject gameObject2 = ((Component)GuiManager.Current.m_mainMenuLayer.PageMap.m_mapDisconnected.transform.GetChild(0)).gameObject;
gameObject2 = Object.Instantiate<GameObject>(gameObject2, Reconnecting.transform);
Text = gameObject2.GetComponent<TextMeshPro>();
((Graphic)Text).color = new Color(0f, 1f, 72f / 85f, 1f);
((TMP_Text)Text).SetText("RECONNECTING", true);
((TMP_Text)Text).ForceMeshUpdate(false, false);
Page.GetComponent<CM_PageBase>().Setup(GuiManager.Current.m_mainMenuLayer);
}
public static void SetPageActive(bool active)
{
Page.GetComponent<CM_PageBase>().SetPageActive(active);
}
}
}
namespace LEGACY.LegacyOverride.ResourceStations
{
public sealed class ToolStation : ResourceStation
{
public override string ItemKey => $"Tool_Station_{base.SerialNumber}";
protected override void SetupInteraction()
{
base.SetupInteraction();
TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.InteractionPrompt.ToolStation");
Interact.InteractionMessage = ((block == null) ? "TOOL STATION" : Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID));
}
protected override void Replenish(PlayerAgent player)
{
PlayerBackpack backpack = PlayerBackpackManager.GetBackpack(player.Owner);
PlayerAmmoStorage ammoStorage = backpack.AmmoStorage;
float num = Math.Max(0f, Math.Min(def.SupplyUplimit.Tool - ammoStorage.ClassAmmo.RelInPack, def.SupplyEfficiency.Tool));
player.GiveAmmoRel((PlayerAgent)null, 0f, 0f, num);
player.Sound.Post(EVENTS.AMMOPACK_APPLY, true);
}
public static ToolStation Instantiate(ResourceStationDefinition def)
{
if (def.StationType != StationType.TOOL)
{
LegacyLogger.Error($"Trying to instantiate MediStation with def with 'StationType': {def.StationType}!");
return null;
}
GameObject gO = Object.Instantiate<GameObject>(Assets.ToolStation);
return new ToolStation(def, gO);
}
private ToolStation(ResourceStationDefinition def, GameObject GO)
: base(def, GO)
{
}
static ToolStation()
{
}
}
public sealed class MediStation : ResourceStation
{
public const float VANILLA_MAX_HEALTH = 25f;
public override string ItemKey => $"Health_Station_{base.SerialNumber}";
protected override void SetupInteraction()
{
base.SetupInteraction();
TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.InteractionPrompt.MediStation");
Interact.InteractionMessage = ((block == null) ? "HEALTH STATION" : Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID));
}
protected override void Replenish(PlayerAgent player)
{
float health = ((Dam_SyncedDamageBase)player.Damage).Health;
float num = def.SupplyUplimit.Medi * 25f;
if (!(health >= num))
{
player.GiveHealth((PlayerAgent)null, Math.Min(def.SupplyEfficiency.Medi, (num - health) / 25f));
player.Sound.Post(EVENTS.MEDPACK_APPLY, true);
}
}
public static MediStation Instantiate(ResourceStationDefinition def)
{
if (def.StationType != 0)
{
LegacyLogger.Error($"Trying to instantiate MediStation with def with 'StationType': {def.StationType}!");
return null;
}
GameObject gO = Object.Instantiate<GameObject>(Assets.MediStation);
return new MediStation(def, gO);
}
private MediStation(ResourceStationDefinition def, GameObject GO)
: base(def, GO)
{
}
static MediStation()
{
}
}
public abstract class ResourceStation
{
[CompilerGenerated]
private sealed class <BlinkMarker>d__61 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public ResourceStation <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <BlinkMarker>d__61(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
<>4__this.StationMarkerGO.SetActive(!<>4__this.StationMarkerGO.active);
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 1;
return true;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public const int UNLIMITED_USE_TIME = int.MaxValue;
private Coroutine m_blinkMarkerCoroutine = null;
public virtual GameObject GameObject { get; protected set; }
public GameObject InteractGO
{
get
{
GameObject gameObject = GameObject;
return ((gameObject != null) ? ((Component)gameObject.transform.GetChild(3)).gameObject : null) ?? null;
}
}
public GameObject StationMarkerGO
{
get
{
GameObject gameObject = GameObject;
return ((gameObject != null) ? ((Component)gameObject.transform.GetChild(2)).gameObject : null) ?? null;
}
}
public virtual Interact_Timed Interact { get; protected set; }
public virtual ResourceStationDefinition def { get; protected set; }
public RSTimer Timer { get; protected set; }
public StateReplicator<RSStateStruct> StateReplicator { get; protected set; }
public RSStateStruct State => StateReplicator?.State ?? new RSStateStruct();
public LG_GenericTerminalItem TerminalItem { get; protected set; }
public AIG_CourseNode SpawnNode
{
get
{
return TerminalItem.SpawnNode;
}
set
{
TerminalItem.SpawnNode = value;
}
}
protected int SerialNumber { get; private set; }
public virtual string ItemKey => $"Resource_Station_{SerialNumber}";
public bool Enabled => State.Enabled;
protected virtual bool InCooldown => State.RemainingUseTime <= 0 && State.CurrentCooldownTime > 0f;
public virtual bool HasUnlimitedUseTime => def.AllowedUseTimePerCooldown == int.MaxValue;
public virtual void Destroy()
{
if (m_blinkMarkerCoroutine != null)
{
CoroutineManager.StopCoroutine(m_blinkMarkerCoroutine);
m_blinkMarkerCoroutine = null;
}
Object.Destroy((Object)(object)GameObject);
StateReplicator?.Unload();
Interact = null;
def = null;
StateReplicator = null;
}
protected virtual bool CanInteract()
{
return Enabled && !InCooldown;
}
protected abstract void Replenish(PlayerAgent player);
protected virtual void SetInteractionText()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
string text = Text.Format(827u, (Object[])(object)new Object[1] { Object.op_Implicit(InputMapper.GetBindingName(((Interact_Base)Interact).InputAction)) });
TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.OnAdditionalInteractionText.ResourceStation");
string text2 = ((block == null) ? "TO REPLENISH" : Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID));
string text3 = (HasUnlimitedUseTime ? string.Empty : $"({State.RemainingUseTime}/{def.AllowedUseTimePerCooldown})");
GuiManager.InteractionLayer.SetInteractPrompt(Interact.InteractionMessage, text + text2 + text3, (ePUIMessageStyle)0);
}
protected virtual void OnTriggerInteraction(PlayerAgent player)
{
RSStateStruct state = State;
int num = (HasUnlimitedUseTime ? int.MaxValue : Math.Max(state.RemainingUseTime - 1, 0));
int num2 = player.Owner.PlayerSlotIndex();
if (num2 < 0 || num2 >= ((Il2CppArrayBase<SNet_Slot>)(object)SNet.Slots.PlayerSlots).Count)
{
LegacyLogger.Error($"ResourceStation_OnTriggerInteraction: player {player.PlayerName} has invalid slot index: {num2}");
}
else
{
StateReplicator?.SetState(new RSStateStruct
{
LastInteractedPlayer = num2,
RemainingUseTime = num,
CurrentCooldownTime = ((num == 0) ? def.CooldownTime : 0f),
Enabled = true
});
}
}
protected virtual void OnInteractionSelected(PlayerAgent agent, bool selected)
{
if (selected)
{
SetInteractionText();
}
}
protected virtual void SetupInteraction()
{
Interact.InteractDuration = def.InteractDuration;
Interact_Timed interact = Interact;
interact.ExternalPlayerCanInteract += Func<PlayerAgent, bool>.op_Implicit((Func<PlayerAgent, bool>)((PlayerAgent _) => CanInteract()));
Interact_Timed interact2 = Interact;
interact2.OnInteractionSelected += Action<PlayerAgent, bool>.op_Implicit((Action<PlayerAgent, bool>)OnInteractionSelected);
Interact_Timed interact3 = Interact;
interact3.OnInteractionTriggered += Action<PlayerAgent>.op_Implicit((Action<PlayerAgent>)OnTriggerInteraction);
}
protected virtual void SetupTerminalItem()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
LG_Zone val = default(LG_Zone);
if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(((GlobalZoneIndex)def).DimensionIndex, ((GlobalZoneIndex)def).LayerType, ((GlobalZoneIndex)def).LocalIndex, ref val) || (Object)(object)val == (Object)null)
{
LegacyLogger.Error("ResourceStation: Cannot find spawn node!");
return;
}
if (def.AreaIndex < 0 || def.AreaIndex >= val.m_areas.Count)
{
LegacyLogger.Error("ResourceStation: Cannot find spawn node - Area index is invalid!");
return;
}
TerminalItem.Setup(ItemKey, val.m_areas[def.AreaIndex].m_courseNode);
if (SpawnNode != null)
{
TerminalItem.FloorItemLocation = SpawnNode.m_zone.NavInfo.GetFormattedText((LG_NavInfoFormat)7);
}
TerminalItem.FloorItemStatus = (eFloorInventoryObjectStatus)0;
}
protected virtual void OnStateChanged(RSStateStruct oldState, RSStateStruct newState, bool isRecall)
{
if (isRecall)
{
return;
}
int lastInteractedPlayer = newState.LastInteractedPlayer;
if (lastInteractedPlayer < 0 || lastInteractedPlayer >= ((Il2CppArrayBase<SNet_Slot>)(object)SNet.Slots.PlayerSlots).Count)
{
return;
}
if (((Interact_Base)Interact).IsSelected)
{
SetInteractionText();
}
if (!SNet.IsMaster)
{
return;
}
LegacyLogger.Warning($"ResourceStation OnStateChanged: replenish for player {lastInteractedPlayer}, remaining use time: {newState.RemainingUseTime}");
if (oldState.RemainingUseTime > 0)
{
SNet_Player playerInSlot = SNet.Slots.GetPlayerInSlot(lastInteractedPlayer);
if ((Object)(object)playerInSlot != (Object)null)
{
Replenish(((Il2CppObjectBase)playerInSlot.m_playerAgent).Cast<PlayerAgent>());
}
else
{
LegacyLogger.Error($"playerSlot_{lastInteractedPlayer} has no player agent!");
}
}
if (newState.RemainingUseTime == 0)
{
LegacyLogger.Warning("ResourceStation OnStateChanged: cooldown timer starts!");
OnCoolDownStart();
}
}
protected virtual void OnCoolDownStart()
{
Timer.StartTimer(def.CooldownTime);
if (m_blinkMarkerCoroutine == null)
{
m_blinkMarkerCoroutine = CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(BlinkMarker()), (Action)null);
}
}
protected virtual void OnCoolDownTimerProgress(float progress)
{
}
protected virtual void OnCoolDownEnd()
{
LegacyLogger.Warning("ResourceStation OnCoolDownEnd");
if (m_blinkMarkerCoroutine != null)
{
CoroutineManager.StopCoroutine(m_blinkMarkerCoroutine);
m_blinkMarkerCoroutine = null;
StationMarkerGO.SetActive(true);
}
if (SNet.IsMaster)
{
LegacyLogger.Warning("ResourceStation OnCoolDownEnd: master reset state!");
StateReplicator.SetState(new RSStateStruct
{
LastInteractedPlayer = -1,
RemainingUseTime = def.AllowedUseTimePerCooldown,
CurrentCooldownTime = 0f,
Enabled = true
});
}
}
protected virtual void SetupReplicator()
{
if (StateReplicator == null)
{
uint num = EOSNetworking.AllotReplicatorID();
if (num == 0)
{
LegacyLogger.Error("ResourceStation: replicatorID depleted, cannot setup replicator!");
return;
}
StateReplicator = StateReplicator<RSStateStruct>.Create(num, new RSStateStruct
{
RemainingUseTime = def.AllowedUseTimePerCooldown,
CurrentCooldownTime = -1f,
Enabled = true
}, (LifeTimeType)1, (IStateReplicatorHolder<RSStateStruct>)null);
StateReplicator.OnStateChanged += OnStateChanged;
}
}
protected virtual void SetupRSTimer()
{
if ((Object)(object)Timer == (Object)null)
{
Timer = RSTimer.Instantiate(OnCoolDownTimerProgress, OnCoolDownEnd);
}
}
[IteratorStateMachine(typeof(<BlinkMarker>d__61))]
private IEnumerator BlinkMarker()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <BlinkMarker>d__61(0)
{
<>4__this = this
};
}
protected ResourceStation(ResourceStationDefinition def, GameObject GO)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
this.def = def;
GameObject = GO;
GameObject.transform.SetPositionAndRotation(def.Position.ToVector3(), def.Rotation.ToQuaternion());
Interact = InteractGO.GetComponent<Interact_Timed>();
SerialNumber = SerialGenerator.GetUniqueSerialNo();
if ((Object)(object)Interact == (Object)null)
{
LegacyLogger.Error("ResourceStation: Interact Comp not found!");
}
else
{
SetupInteraction();
}
TerminalItem = GO.GetComponent<LG_GenericTerminalItem>();
if ((Object)(object)TerminalItem == (Object)null)
{
LegacyLogger.Error("ResourceStation: TerminalItem not found!");
}
else
{
SetupTerminalItem();
}
SetupReplicator();
SetupRSTimer();
}
static ResourceStation()
{
}
}
public sealed class AmmoStation : ResourceStation
{
public override string ItemKey => $"Ammunition_Station_{base.SerialNumber}";
protected override void SetupInteraction()
{
base.SetupInteraction();
TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.InteractionPrompt.AmmoStation");
Interact.InteractionMessage = ((block == null) ? "AMMUNITION STATION" : Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID));
}
public static AmmoStation Instantiate(ResourceStationDefinition def)
{
if (def.StationType != StationType.AMMO)
{
LegacyLogger.Error($"Trying to instantiate AmmoStation with def with 'StationType': {def.StationType}!");
return null;
}
GameObject gO = Object.Instantiate<GameObject>(Assets.AmmoStation);
return new AmmoStation(def, gO);
}
protected override void Replenish(PlayerAgent player)
{
PlayerBackpack backpack = PlayerBackpackManager.GetBackpack(player.Owner);
PlayerAmmoStorage ammoStorage = backpack.AmmoStorage;
float num = Math.Max(0f, Math.Min(def.SupplyUplimit.AmmoStandard - ammoStorage.StandardAmmo.RelInPack, def.SupplyEfficiency.AmmoStandard));
float num2 = Math.Max(0f, Math.Min(def.SupplyUplimit.AmmoSpecial - ammoStorage.SpecialAmmo.RelInPack, def.SupplyEfficiency.AmmoSpecial));
player.GiveAmmoRel((PlayerAgent)null, num, num2, 0f);
player.Sound.Post(EVENTS.AMMOPACK_APPLY, true);
}
private AmmoStation(ResourceStationDefinition def, GameObject GO)
: base(def, GO)
{
}
static AmmoStation()
{
}
}
public enum StationType
{
MEDI,
AMMO,
TOOL
}
public class SupplyUplimit
{
public float Medi { get; set; } = 0.6f;
public float AmmoStandard { get; set; } = 1f;
public float AmmoSpecial { get; set; } = 1f;
public float Tool { get; set; } = 0f;
}
public class SupplyEfficiency
{
public float Medi { get; set; } = 0.2f;
public float AmmoStandard { get; set; } = 0.15f;
public float AmmoSpecial { get; set; } = 0.15f;
public float Tool { get; set; } = 0f;
}
public class ResourceStationDefinition : GlobalZoneIndex
{
public int AreaIndex { get; set; } = 0;
public string WorldEventObjectFilter { get; set; } = string.Empty;
public StationType StationType { get; set; } = StationType.AMMO;
public Vec3 Position { get; set; } = new Vec3();
public Vec3 Rotation { get; set; } = new Vec3();
public float InteractDuration { get; set; } = 2.5f;
public SupplyEfficiency SupplyEfficiency { get; set; } = new SupplyEfficiency();
public SupplyUplimit SupplyUplimit { get; set; } = new SupplyUplimit();
public int AllowedUseTimePerCooldown { get; set; } = int.MaxValue;
public float CooldownTime { get; set; } = 3f;
}
public class ResourceStationManager : GenericExpeditionDefinitionManager<ResourceStationDefinition>
{
public static ResourceStationManager Current { get; private set; }
protected override string DEFINITION_NAME => "ResourceStation";
private Dictionary<string, ResourceStation> Stations { get; } = new Dictionary<string, ResourceStation>();
private void Build(ResourceStationDefinition def)
{
if (Stations.ContainsKey(def.WorldEventObjectFilter))
{
LegacyLogger.Error("ResourceStationManager: WorldEventObjectFilter '" + def.WorldEventObjectFilter + "' is already used");
return;
}
ResourceStation resourceStation = null;
switch (def.StationType)
{
case StationType.MEDI:
resourceStation = MediStation.Instantiate(def);
break;
case StationType.AMMO:
resourceStation = AmmoStation.Instantiate(def);
break;
case StationType.TOOL:
resourceStation = ToolStation.Instantiate(def);
break;
default:
LegacyLogger.Error($"ResourceStation {def.StationType} is unimplemented");
return;
}
if (resourceStation != null)
{
Stations[def.WorldEventObjectFilter] = resourceStation;
LegacyLogger.Debug("ResourceStation '" + def.WorldEventObjectFilter + "' instantiated");
}
}
private void BuildStations()
{
if (base.definitions.TryGetValue(base.CurrentMainLevelLayout, out var value))
{
value.Definitions.ForEach(Build);
}
}
private void Clear()
{
foreach (ResourceStation value in Stations.Values)
{
value.Destroy();
}
Stations.Clear();
}
private ResourceStationManager()
{
LevelAPI.OnBuildStart += delegate
{
Clear();
};
LevelAPI.OnLevelCleanup += Clear;
LevelAPI.OnBuildDone += BuildStations;
}
static ResourceStationManager()
{
Current = new ResourceStationManager();
}
}
public struct RSStateStruct
{
public int LastInteractedPlayer;
public int RemainingUseTime;
public float CurrentCooldownTime;
public bool Enabled;
public RSStateStruct()
{
LastInteractedPlayer = 0;
RemainingUseTime = 0;
CurrentCooldownTime = 0f;
Enabled = false;
}
}
public class RSTimer : MonoBehaviour
{
private float startTime = 0f;
private float endTime = 0f;
private bool hasOnGoingTimer = false;
private Action<float> OnProgress;
private Action OnTimerEnd;
public float RemainingTime => hasOnGoingTimer ? Math.Max(endTime - Clock.Time, 0f) : 0f;
private static List<GameObject> TimerGOs { get; }
private void Update()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
if ((int)GameStateManager.CurrentStateName == 10 && hasOnGoingTimer)
{
float time = Clock.Time;
if (OnProgress != null)
{
OnProgress((time - startTime) / (endTime - startTime));
}
if (!(time < endTime))
{
endTime = 0f;
hasOnGoingTimer = false;
OnTimerEnd?.Invoke();
}
}
}
public void StartTimer(float time)
{
if (time <= 0f)
{
LegacyLogger.Error("StartTimer: time is not positive!");
return;
}
if (hasOnGoingTimer)
{
LegacyLogger.Error("StartTimer: this timer is yet ended!");
return;
}
startTime = Clock.Time;
endTime = startTime + time;
hasOnGoingTimer = true;
}
private void OnDestroy()
{
endTime = 0f;
hasOnGoingTimer = false;
OnTimerEnd = null;
}
public static RSTimer Instantiate(Action<float> onProgress, Action actionOnEnd)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
GameObject val = new GameObject();
RSTimer rSTimer = val.AddComponent<RSTimer>();
rSTimer.OnProgress = onProgress;
rSTimer.OnTimerEnd = actionOnEnd;
TimerGOs.Add(val);
return rSTimer;
}
public static void DestroyAll()
{
TimerGOs.ForEach((Action<GameObject>)Object.Destroy);
TimerGOs.Clear();
}
private RSTimer()
{
}
static RSTimer()
{
TimerGOs = new List<GameObject>();
ClassInjector.RegisterTypeInIl2Cpp<RSTimer>();
LevelAPI.OnBuildStart += DestroyAll;
LevelAPI.OnLevelCleanup += DestroyAll;
}
}
}
namespace LEGACY.LegacyOverride.Patches
{
[HarmonyPatch]
internal static class ExpeditionSuccessPage
{
[HarmonyPostfix]
[HarmonyPatch(typeof(CM_PageExpeditionSuccess), "OnEnable")]
private static void Post_CM_PageExpeditionSuccess_OnEnable(CM_PageExpeditionSuccess __instance)
{
if (!((Object)(object)__instance == (Object)null))
{
SuccessPageCustomization currentCustomization = SuccessPageCustomizationManager.Current.CurrentCustomization;
if (currentCustomization != null)
{
((TMP_Text)__instance.m_header).SetText(LocalizedText.op_Implicit(currentCustomization.PageHeader), true);
__instance.m_overrideSuccessMusic = currentCustomization.OverrideSuccessMusic;
LegacyLogger.Warning("Post_CM_PageExpeditionSuccess_OnEnable: " + ((Object)currentCustomization.PageHeader).ToString());
}
}
}
}
[HarmonyPatch]
internal class GUIManager_RestartPage
{
[HarmonyPostfix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(GuiManager), "Setup")]
private static void Post_Setup(GuiManager __instance)
{
LevelAPI.OnBuildStart += delegate
{
CM_PageRestart.Setup();
};
}
}
[HarmonyPatch]
internal static class LevelSpawnFogBeacon_BugFix
{
[HarmonyPostfix]
[HarmonyPatch(typeof(HeavyFogRepellerGlobalState), "AttemptInteract")]
private static void Post_HeavyFogRepellerGlobalState_AttemptInteract(HeavyFogRepellerGlobalState __instance)
{
LevelSpawnedFogBeaconSettings lSFBDef = LevelSpawnedFogBeaconManager.Current.GetLSFBDef(__instance);
if (lSFBDef != null)
{
__instance.m_repellerSphere.Range = lSFBDef.Range;
}
}
}
[HarmonyPatch]
internal class RundownSelectionCustomization
{
[CompilerGenerated]
private sealed class <reverseReveal>d__7 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public CM_PageRundown_New p;
public bool hosting;
public Transform guixSurfaceTransform;
private float <arrowScale>5__1;
private float <tierMarkerDelay>5__2;
private int <k>5__3;
private int <m>5__4;
private int <l>5__5;
private int <j>5__6;
private int <i>5__7;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <reverseReveal>d__7(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Expected O, but got Unknown
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Expected O, but got Unknown
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: Unknown result type (might be due to invalid IL or missing references)
//IL_02a0: Expected O, but got Unknown
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_0356: Unknown result type (might be due to invalid IL or missing references)
//IL_036a: Unknown result type (might be due to invalid IL or missing references)
//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
//IL_03cd: Expected O, but got Unknown
//IL_040f: Unknown result type (might be due to invalid IL or missing references)
//IL_0419: Expected O, but got Unknown
//IL_0459: Unknown result type (might be due to invalid IL or missing references)
//IL_046e: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Expected O, but got Unknown
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_024f: Unknown result type (might be due to invalid IL or missing references)
//IL_0325: Unknown result type (might be due to invalid IL or missing references)
//IL_032f: Expected O, but got Unknown
//IL_04ca: Unknown result type (might be due to invalid IL or missing references)
//IL_04d4: Expected O, but got Unknown
//IL_05aa: Unknown result type (might be due to invalid IL or missing references)
//IL_05b4: Expected O, but got Unknown
//IL_068c: Unknown result type (might be due to invalid IL or missing references)
//IL_0696: Expected O, but got Unknown
//IL_076e: Unknown result type (might be due to invalid IL or missing references)
//IL_0778: Expected O, but got Unknown
//IL_0850: Unknown result type (might be due to invalid IL or missing references)
//IL_085a: Expected O, but got Unknown
//IL_0932: Unknown result type (might be due to invalid IL or missing references)
//IL_093c: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<arrowScale>5__1 = p.m_tierSpacing * 5f * p.m_tierSpaceToArrowScale;
if (hosting)
{
CoroutineManager.BlinkIn(p.m_buttonConnect, 0f, (Transform)null);
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 1;
return true;
}
goto IL_0147;
case 1:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.24f);
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
((RectTransformComp)p.m_buttonConnect).SetVisible(false);
goto IL_0147;
case 3:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 4;
return true;
case 4:
<>1__state = -1;
CM_PageBase.PostSound(EVENTS.MENU_SURFACE_LEVEL_SHRINK, "");
CoroutineEase.EaseLocalScale(p.m_textRundownHeader.transform, Vector3.one, new Vector3(0.6f, 0.6f, 0.6f), 0.2f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null);
<>2__current = CoroutineEase.EaseLocalScale(guixSurfaceTransform, Vector3.one, new Vector3(0.2f, 0.2f, 0.2f), 0.2f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null);
<>1__state = 5;
return true;
case 5:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.1f);
<>1__state = 6;
return true;
case 6:
<>1__state = -1;
CoroutineEase.EaseLocalPos(p.m_textRundownHeader.transform, p.m_textRundownHeader.transform.localPosition, p.m_rundownHeaderPos, 0.2f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null);
CoroutineManager.BlinkIn(p.m_rundownIntelButton, 0f, (Transform)null);
<>2__current = (object)new WaitForSeconds(0.2f);
<>1__state = 7;
return true;
case 7:
<>1__state = -1;
CM_PageBase.PostSound(EVENTS.MENU_SURFACE_LEVEL_TURN, "");
<>2__current = CoroutineEase.EaseLocalRot(guixSurfaceTransform, Vector3.zero, new Vector3(70f, 0f, 0f), 0.3f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null);
<>1__state = 8;
return true;
case 8:
<>1__state = -1;
p.m_verticalArrow.SetActive(true);
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 9;
return true;
case 9:
<>1__state = -1;
CoroutineManager.BlinkIn(((Component)p.m_tierMarkerSectorSummary).gameObject, 0f);
CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_5, "");
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 10;
return true;
case 10:
<>1__state = -1;
CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_SPINE_START, "");
CoroutineEase.EaseLocalScale(p.m_verticalArrow.transform, new Vector3(1f, 0f, 1f), new Vector3(1f, <arrowScale>5__1, 1f), 4.3f, (EasingFunction)Easing.LinearTween, (Action)delegate
{
CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_SPINE_STOP, "");
}, (BoolCheck)null);
<tierMarkerDelay>5__2 = 0.6f;
<>2__current = (object)new WaitForSeconds(0.2f);
<>1__state = 11;
return true;
case 11:
<>1__state = -1;
CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_3, "");
((Component)p.m_guix_Tier3).gameObject.SetActive(true);
<k>5__3 = 0;
while (<k>5__3 < p.m_expIconsTier3.Count)
{
CoroutineManager.BlinkIn(((Component)p.m_expIconsTier3[<k>5__3]).gameObject, (float)<k>5__3 * 0.1f);
<k>5__3++;
}
if (p.m_expIconsTier3.Count > 0)
{
p.m_tierMarker3.SetVisible(true, <tierMarkerDelay>5__2);
}
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 12;
return true;
case 12:
<>1__state = -1;
CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_5, "");
((Component)p.m_guix_Tier5).gameObject.SetActive(true);
<m>5__4 = 0;
while (<m>5__4 < p.m_expIconsTier5.Count)
{
CoroutineManager.BlinkIn(((Component)p.m_expIconsTier5[<m>5__4]).gameObject, (float)<m>5__4 * 0.1f);
<m>5__4++;
}
if (p.m_expIconsTier5.Count > 0)
{
p.m_tierMarker5.SetVisible(true, <tierMarkerDelay>5__2);
}
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 13;
return true;
case 13:
<>1__state = -1;
CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_4, "");
((Component)p.m_guix_Tier4).gameObject.SetActive(true);
<l>5__5 = 0;
while (<l>5__5 < p.m_expIconsTier4.Count)
{
CoroutineManager.BlinkIn(((Component)p.m_expIconsTier4[<l>5__5]).gameObject, (float)<l>5__5 * 0.1f);
<l>5__5++;
}
if (p.m_expIconsTier4.Count > 0)
{
p.m_tierMarker4.SetVisible(true, <tierMarkerDelay>5__2);
}
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 14;
return true;
case 14:
<>1__state = -1;
CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_2, "");
((Component)p.m_guix_Tier2).gameObject.SetActive(true);
<j>5__6 = 0;
while (<j>5__6 < p.m_expIconsTier2.Count)
{
CoroutineManager.BlinkIn(((Component)p.m_expIconsTier2[<j>5__6]).gameObject, (float)<j>5__6 * 0.1f);
<j>5__6++;
}
if (p.m_expIconsTier2.Count > 0)
{
p.m_tierMarker2.SetVisible(true, <tierMarkerDelay>5__2);
}
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 15;
return true;
case 15:
<>1__state = -1;
CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_1, "");
((Component)p.m_guix_Tier1).gameObject.SetActive(true);
<i>5__7 = 0;
while (<i>5__7 < p.m_expIconsTier1.Count)
{
CoroutineManager.BlinkIn(((Component)p.m_expIconsTier1[<i>5__7]).gameObject, (float)<i>5__7 * 0.1f);
<i>5__7++;
}
if (p.m_expIconsTier1.Count > 0)
{
p.m_tierMarker1.SetVisible(true, <tierMarkerDelay>5__2);
}
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 16;
return true;
case 16:
{
<>1__state = -1;
((Component)p.m_joinOnServerIdText).gameObject.SetActive(true);
Coroutineusing System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using AIGraph;
using AssetShards;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using CellMenu;
using GTFO.API.Utilities;
using GameData;
using Gear;
using Globals;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppJsonNet;
using Il2CppJsonNet.Linq;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using InheritanceDataBlocks.API;
using InjectLib.JsonNETInjection;
using InjectLib.JsonNETInjection.Converter;
using InjectLib.JsonNETInjection.Supports;
using LevelGeneration;
using Localization;
using MTFO.Ext.PartialData.DTO;
using MTFO.Ext.PartialData.DataBlockTypes;
using MTFO.Ext.PartialData.Interops;
using MTFO.Ext.PartialData.JsonConverters;
using MTFO.Ext.PartialData.JsonConverters.InjectLibConverters;
using MTFO.Ext.PartialData.Utils;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("MTFO.Ext.PartialData")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0+67a2b88cf3460538f6357bb0cf086a2882daf652")]
[assembly: AssemblyProduct("MTFO.Ext.PartialData")]
[assembly: AssemblyTitle("MTFO.Ext.PartialData")]
[assembly: TargetPlatform("Windows7.0")]
[assembly: SupportedOSPlatform("Windows7.0")]
[assembly: AssemblyVersion("0.1.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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace MTFO.Ext.PartialData
{
[BepInPlugin("MTFO.Extension.PartialBlocks", "MTFO pDataBlock", "1.5.2")]
[BepInProcess("GTFO.exe")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal class EntryPoint : BasePlugin
{
public static bool LogAddBlock = false;
public static bool LogEditBlock = true;
public static bool LogOfflineGearLink = false;
public static bool LogInjectLibLink = false;
public static bool LogDebugs = false;
private bool once;
public override void Load()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Expected O, but got Unknown
//IL_0045: Expected O, but got Unknown
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Expected O, but got Unknown
//IL_007a: Expected O, but got Unknown
//IL_0094: 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)
//IL_00af: Expected O, but got Unknown
//IL_00af: Expected O, but got Unknown
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Expected O, but got Unknown
//IL_00e4: Expected O, but got Unknown
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Expected O, but got Unknown
//IL_0119: Expected O, but got Unknown
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Expected O, but got Unknown
//IL_014e: Expected O, but got Unknown
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
Logger.LogInstance = ((BasePlugin)this).Log;
InheritanceInterop.Setup();
InjectLibInterop.Setup();
MTFOInterop.Setup();
LogDebugs = ((BasePlugin)this).Config.Bind<bool>(new ConfigDefinition("Logging", "Log Debug Messages"), false, new ConfigDescription("Using Debug Log Messages?", (AcceptableValueBase)null, Array.Empty<object>())).Value;
LogAddBlock = ((BasePlugin)this).Config.Bind<bool>(new ConfigDefinition("Logging", "Log AddBlock"), false, new ConfigDescription("Using Log Message for AddBlock?", (AcceptableValueBase)null, Array.Empty<object>())).Value;
LogEditBlock = ((BasePlugin)this).Config.Bind<bool>(new ConfigDefinition("Logging", "Log EditBlock"), true, new ConfigDescription("Using Log Message for Editing Block (Mostly by LiveEdit)?", (AcceptableValueBase)null, Array.Empty<object>())).Value;
LogOfflineGearLink = ((BasePlugin)this).Config.Bind<bool>(new ConfigDefinition("Logging", "Log OfflineGear Links"), false, new ConfigDescription("Using Log Message for Linking GUID for OfflineGearJSON?", (AcceptableValueBase)null, Array.Empty<object>())).Value;
LogInjectLibLink = ((BasePlugin)this).Config.Bind<bool>(new ConfigDefinition("Logging", "Log InjectLib Links"), false, new ConfigDescription("Using Log Message for Linking GUID for InjectLib?", (AcceptableValueBase)null, Array.Empty<object>())).Value;
PartialDataManager.CanLiveEdit = ((BasePlugin)this).Config.Bind<bool>(new ConfigDefinition("Developer", "UseLiveEdit"), false, new ConfigDescription("Using Live Edit?", (AcceptableValueBase)null, Array.Empty<object>())).Value;
if (!DataBlockTypeManager.Initialize())
{
Logger.Error("Unable to Initialize DataBlockTypeCache");
return;
}
if (!PartialDataManager.Initialize())
{
Logger.Error("Unable to Initialize PartialData");
return;
}
PersistentIDManager.DumpToFile(Path.Combine(PartialDataManager.PartialDataPath, "_persistentID.json"));
AssetShardManager.OnStartupAssetsLoaded += Action.op_Implicit((Action)OnAssetLoaded);
new Harmony("MTFO.pBlock.Harmony").PatchAll();
}
private void OnAssetLoaded()
{
if (!once)
{
once = true;
PartialDataManager.LoadPartialData();
PartialDataManager.WriteAllFile(Path.Combine(MTFOInterop.GameDataPath, "CompiledPartialData"));
TextDBUtil.RefreshTranslation();
}
}
}
public static class LocalizedTextManager
{
public static Dictionary<LocalizedText, (uint, string)> _lookup = new Dictionary<LocalizedText, (uint, string)>();
public static void Register(LocalizedText localizedText, uint id, string unlocalized)
{
_lookup[localizedText] = (id, unlocalized);
}
public static void Get(LocalizedText localizedText)
{
}
}
internal class PartialDataCache
{
public string Name => DataBlockType.GetShortName();
public IDataBlockType DataBlockType { get; private set; }
public Queue<string> JsonsToRead { get; private set; } = new Queue<string>();
private PartialDataCache()
{
}
public PartialDataCache(IDataBlockType dbTypeCache)
{
DataBlockType = dbTypeCache;
}
}
public class PartialDataManager
{
[CompilerGenerated]
private static class <>O
{
public static LiveEditEventHandler <0>__Listener_FileChanged1;
}
private static List<DataBlockDefinition> _Config;
private static readonly List<string> _AddedFileList = new List<string>();
private static readonly List<PartialDataCache> _DataCache = new List<PartialDataCache>();
public static string PartialDataPath { get; private set; }
public static string ConfigPath { get; private set; }
public static bool Initialized { get; private set; } = false;
public static bool CanLiveEdit { get; set; } = false;
public static PersistentIDConverter IDConverter { get; private set; } = new PersistentIDConverter();
internal static bool Initialize()
{
if (Initialized)
{
return false;
}
if (!MTFOInterop.IsLoaded)
{
return false;
}
PartialDataPath = Path.GetFullPath(Path.Combine(MTFOInterop.GameDataPath, "PartialData"));
if (!Directory.Exists(PartialDataPath))
{
Logger.Error("Unable to setup PartialData::PartialData folder is missing");
return false;
}
ConfigPath = Path.GetFullPath(Path.Combine(PartialDataPath, "_config.json"));
if (!File.Exists(ConfigPath))
{
Logger.Error("Unable to setup PartialData::Config File (_config.json) is missing");
return false;
}
_AddedFileList.Clear();
_DataCache.Clear();
_Config = JSON.Deserialize<List<DataBlockDefinition>>(File.ReadAllText(ConfigPath));
Initialized = true;
ReadAndAssignIDs();
return true;
}
private static void ReadAndAssignIDs()
{
foreach (DataBlockDefinition item in _Config)
{
DataBlockTypeManager.SetIDBuffer(item.TypeName, item.StartFromID, item.IncrementMode);
}
foreach (string item2 in from f in Directory.GetFiles(PartialDataPath, "*.json", SearchOption.AllDirectories)
orderby f
select f)
{
if (Path.GetFileName(item2).StartsWith("_"))
{
Logger.Debug(item2 + " have discard prefix (_) excluding from loader!");
continue;
}
if (!File.Exists(item2))
{
Logger.Error("File (" + item2 + ") is not exist somehow?");
continue;
}
if (_AddedFileList.Contains(item2))
{
Logger.Error("File (" + item2 + ") has loaded multiple times!");
continue;
}
_AddedFileList.Add(item2);
AssignPersistentID(item2);
Logger.Debug(" - " + item2);
}
}
private static void AssignPersistentID(string file)
{
using JsonDocument jsonDocument = JsonDocument.Parse(File.ReadAllText(file), new JsonDocumentOptions
{
CommentHandling = JsonCommentHandling.Skip,
AllowTrailingCommas = true
});
JsonElement rootElement = jsonDocument.RootElement;
switch (rootElement.ValueKind)
{
case JsonValueKind.Array:
{
foreach (JsonElement item in rootElement.EnumerateArray())
{
Read(item, assignID: true, file);
}
break;
}
case JsonValueKind.Object:
Read(rootElement, assignID: true, file);
break;
}
}
private static void ReadChangedFile(string content, string debugName)
{
using JsonDocument jsonDocument = JsonDocument.Parse(content, new JsonDocumentOptions
{
CommentHandling = JsonCommentHandling.Skip,
AllowTrailingCommas = true
});
JsonElement rootElement = jsonDocument.RootElement;
switch (rootElement.ValueKind)
{
case JsonValueKind.Array:
{
foreach (JsonElement item in rootElement.EnumerateArray())
{
Read(item, assignID: false, debugName);
}
break;
}
case JsonValueKind.Object:
Read(rootElement, assignID: false, debugName);
break;
}
}
private static void ReadChangedFile(string file)
{
ReadChangedFile(File.ReadAllText(file), file);
}
private static void Read(JsonElement objNode, bool assignID, string debugName)
{
if (!objNode.TryGetProperty("persistentID", out var value))
{
Logger.Error("persistentID field is missing: " + debugName);
return;
}
if (!objNode.TryGetProperty("datablock", out var value2))
{
Logger.Error("datablock field is missing: " + debugName);
return;
}
if (assignID && value.ValueKind == JsonValueKind.String)
{
if (!DataBlockTypeManager.TryGetNextID(value2.GetString(), out var id))
{
Logger.Error($"datablock field is not valid: {debugName} {objNode}");
return;
}
PersistentIDManager.TryAssignId(value.GetString(), id);
}
string datablockName = DataBlockTypeManager.GetBlockName(value2.GetString());
if (!DataBlockTypeManager.TryFindCache(datablockName, out var cache))
{
Logger.Error($"datablock field is not valid: {debugName} {objNode}");
return;
}
PartialDataCache partialDataCache = _DataCache.FirstOrDefault((PartialDataCache x) => x.Name.Equals(datablockName));
if (partialDataCache == null)
{
partialDataCache = new PartialDataCache(cache);
_DataCache.Add(partialDataCache);
}
partialDataCache.JsonsToRead.Enqueue(objNode.ToString());
cache.CacheInheritance(objNode, value);
}
internal static void LoadPartialData()
{
//IL_002f: 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_003a: Expected O, but got Unknown
if (!Initialized)
{
return;
}
if (CanLiveEdit)
{
LiveEditListener obj = LiveEdit.CreateListener(PartialDataPath, "*.json", true);
object obj2 = <>O.<0>__Listener_FileChanged1;
if (obj2 == null)
{
LiveEditEventHandler val = Listener_FileChanged1;
<>O.<0>__Listener_FileChanged1 = val;
obj2 = (object)val;
}
obj.FileChanged += (LiveEditEventHandler)obj2;
}
AddAllCache();
}
private static void Listener_FileChanged1(LiveEditEventArgs e)
{
Logger.Warning("LiveEdit File Changed: " + e.FullPath);
LiveEdit.TryReadFileContent(e.FullPath, (Action<string>)delegate(string content)
{
ReadChangedFile(content, e.FullPath);
AddAllCache(isLiveEdit: true);
});
}
internal static void WriteAllFile(string path)
{
if (!Directory.Exists(path))
{
return;
}
foreach (PartialDataCache item in _DataCache)
{
string fullPath = Path.GetFullPath(Path.Combine(path, "GameData_" + item.DataBlockType.GetFullName() + "_bin.json"));
item.DataBlockType.DoSaveToDisk(fullPath);
}
}
private static void AddAllCache(bool isLiveEdit = false)
{
foreach (PartialDataCache item in _DataCache)
{
bool flag = false;
while (item.JsonsToRead.Count > 0)
{
string json = item.JsonsToRead.Dequeue();
item.DataBlockType.AddJsonBlock(json);
flag = true;
}
item.DataBlockType.ApplyInheritance();
if (flag && isLiveEdit)
{
item.DataBlockType.OnChanged();
}
}
}
public static uint GetID(string guid)
{
if (!Initialized)
{
return 0u;
}
return PersistentIDManager.GetId(guid);
}
}
public class PartialDataPack
{
private readonly List<string> _AddedFiles = new List<string>();
private readonly List<PartialDataCache> _DataCaches = new List<PartialDataCache>();
public string Namespace { get; private set; } = string.Empty;
public bool CheckFileChange { get; set; } = true;
public PartialDataPack()
{
}
public PartialDataPack(string namespaceString)
: this()
{
Namespace = namespaceString;
}
public string GetGUIDFormat(string guid)
{
if (!string.IsNullOrEmpty(Namespace))
{
guid = Namespace + "." + guid;
}
return guid;
}
public void ClearPack()
{
_AddedFiles.Clear();
_DataCaches.Clear();
}
public void ReadPack(string packPath)
{
foreach (string item in from f in Directory.GetFiles(packPath, "*.json", SearchOption.AllDirectories)
orderby f
select f)
{
if (Path.GetFileName(item).StartsWith("_"))
{
Logger.Log(item + " have discard prefix (_) excluding from loader!");
continue;
}
if (!File.Exists(item))
{
Logger.Error("File (" + item + ") is not exist somehow?");
continue;
}
if (_AddedFiles.Contains(item))
{
Logger.Error("File (" + item + ") has loaded multiple times!");
continue;
}
_AddedFiles.Add(item);
AllocateGUIDFromFile(item);
Logger.Log(" - " + item);
}
_ = CheckFileChange;
}
public void AddToGame()
{
foreach (PartialDataCache dataCache in _DataCaches)
{
while (dataCache.JsonsToRead.Count > 0)
{
string json = dataCache.JsonsToRead.Dequeue();
dataCache.DataBlockType.AddJsonBlock(json);
}
}
}
public void WriteGameDataFile(string path)
{
if (!Directory.Exists(path))
{
return;
}
foreach (PartialDataCache dataCache in _DataCaches)
{
string fullPath = Path.GetFullPath(Path.Combine(path, "GameData_" + dataCache.DataBlockType.GetFullName() + "_bin.json"));
dataCache.DataBlockType.DoSaveToDisk(fullPath);
}
}
private void AllocateGUIDFromFile(string file)
{
using JsonDocument jsonDocument = JsonDocument.Parse(File.ReadAllText(file), new JsonDocumentOptions
{
CommentHandling = JsonCommentHandling.Skip,
AllowTrailingCommas = true
});
JsonElement rootElement = jsonDocument.RootElement;
switch (rootElement.ValueKind)
{
case JsonValueKind.Array:
{
foreach (JsonElement item in rootElement.EnumerateArray())
{
Read(item, assignID: true, file);
}
break;
}
case JsonValueKind.Object:
Read(rootElement, assignID: true, file);
break;
}
}
private void ReadChangedFile(string file)
{
using JsonDocument jsonDocument = JsonDocument.Parse(File.ReadAllText(file), new JsonDocumentOptions
{
CommentHandling = JsonCommentHandling.Skip,
AllowTrailingCommas = true
});
JsonElement rootElement = jsonDocument.RootElement;
switch (rootElement.ValueKind)
{
case JsonValueKind.Array:
{
foreach (JsonElement item in rootElement.EnumerateArray())
{
Read(item, assignID: false, file);
}
break;
}
case JsonValueKind.Object:
Read(rootElement, assignID: false, file);
break;
}
}
private void OnDatablockChanged()
{
foreach (PartialDataCache dataCache in _DataCaches)
{
bool flag = false;
while (dataCache.JsonsToRead.Count > 0)
{
if (dataCache.Name.Equals("Rundown"))
{
dataCache.JsonsToRead.Clear();
Logger.Error("Editing Rundown DataBlock will leads to crash, Ignored");
}
else
{
string json = dataCache.JsonsToRead.Dequeue();
dataCache.DataBlockType.AddJsonBlock(json);
flag = true;
}
}
if (flag)
{
dataCache.DataBlockType.OnChanged();
}
}
}
private void Read(JsonElement objNode, bool assignID, string debugName)
{
if (!objNode.TryGetProperty("persistentID", out var value))
{
Logger.Error("persistentID field is missing: " + debugName);
return;
}
if (!objNode.TryGetProperty("datablock", out var value2))
{
Logger.Error("datablock field is missing: " + debugName);
return;
}
if (assignID && value.ValueKind == JsonValueKind.String)
{
if (!DataBlockTypeManager.TryGetNextID(value2.GetString(), out var id))
{
Logger.Error($"datablock field is not valid: {debugName} {objNode}");
return;
}
PersistentIDManager.TryAssignId(value.GetString(), id);
}
string datablockName = DataBlockTypeManager.GetBlockName(value2.GetString());
if (!DataBlockTypeManager.TryFindCache(datablockName, out var cache))
{
Logger.Error($"datablock field is not valid: {debugName} {objNode}");
return;
}
PartialDataCache partialDataCache = _DataCaches.FirstOrDefault((PartialDataCache x) => x.Name.Equals(datablockName));
if (partialDataCache == null)
{
partialDataCache = new PartialDataCache(cache);
_DataCaches.Add(partialDataCache);
}
string text = objNode.ToString();
if (partialDataCache.DataBlockType.GetShortName() == "PlayerOfflineGear")
{
if (!objNode.TryGetProperty("GearJSON", out var value3))
{
Logger.Warning("GearJSON field is missing, Ignore Stuff: " + debugName);
}
else if (value3.ValueKind == JsonValueKind.String)
{
string @string = value3.GetString();
if (GearJSONUtil.TryProcessGUID(@string, Namespace, out var processedJson))
{
@string = @string.Replace("\"", "\\\"");
processedJson = processedJson.Replace("\"", "\\\"");
text = text.Replace(@string, processedJson);
Logger.Warning(text);
}
}
}
partialDataCache.JsonsToRead.Enqueue(text);
}
}
public static class PersistentIDManager
{
private static readonly Dictionary<string, uint> _GUIDDict = new Dictionary<string, uint>();
public static bool TryAssignId(string guid, uint id)
{
if (_GUIDDict.ContainsKey(guid))
{
Logger.Error("GUID is already used: " + guid);
return false;
}
_GUIDDict.Add(guid, id);
return true;
}
public static uint GetId(string guid)
{
if (!_GUIDDict.TryGetValue(guid, out var value))
{
Logger.Error("GUID is Missing: " + guid);
return 0u;
}
return value;
}
public static bool TryGetId(string guid, out uint id)
{
if (_GUIDDict.TryGetValue(guid, out id))
{
return true;
}
id = 0u;
return false;
}
public static void DumpToFile(string path)
{
string text = "[\n\t//AUTO-GENERATED PERSISTENT ID LIST\n";
foreach (KeyValuePair<string, uint> item in _GUIDDict)
{
text = text + "\t{ \"GUID\": \"" + item.Key + "\", \"ID\": " + item.Value + " },\n";
}
if (text.Length > 2)
{
string text2 = text;
text = text2.Substring(0, text2.Length - 2);
}
text += "\n]";
File.WriteAllText(path, text);
}
}
}
namespace MTFO.Ext.PartialData.Utils
{
public static class GearJSONUtil
{
private const string COMP_CHARS = "abcdefghijklmnopqrst";
public static bool TryProcessGUID(string gearjson, string namespaceStr, out string processedJson)
{
string text = gearjson;
bool flag = false;
using JsonDocument jsonDocument = JsonDocument.Parse(gearjson);
if (!jsonDocument.RootElement.TryGetProperty("Packet", out var value))
{
processedJson = string.Empty;
return false;
}
if (!value.TryGetProperty("Comps", out var value2))
{
processedJson = string.Empty;
return false;
}
string text2 = "abcdefghijklmnopqrst";
for (int i = 0; i < text2.Length; i++)
{
if (value2.TryGetProperty(text2[i].ToString(), out var value3) && value3.TryGetProperty("v", out var value4) && value4.ValueKind == JsonValueKind.String)
{
string @string = value4.GetString();
Logger.Warning("Found String id: " + @string);
uint id = PersistentIDManager.GetId(@string);
if (id != 0)
{
text = new Regex("(\"v\")\\s*:\\s*(\"" + @string + "\")").Replace(text, $"\"v\":{id}");
flag = true;
}
}
}
if (flag)
{
Logger.Warning(gearjson);
Logger.Warning(text);
processedJson = text;
return true;
}
processedJson = string.Empty;
return false;
}
}
public class IDBuffer
{
public uint CurrentID { get; set; } = 65535u;
public IncrementMode IncrementMode { get; set; }
public uint GetNext()
{
if (IncrementMode == IncrementMode.Increment)
{
return CurrentID++;
}
if (IncrementMode == IncrementMode.Decrement)
{
return CurrentID--;
}
return 0u;
}
}
public enum IncrementMode
{
Decrement,
Increment
}
internal static class JSON
{
public static readonly JsonSerializerOptions Setting;
public static readonly JsonSerializerOptions SettingWithoutInjectLib;
static JSON()
{
Setting = CreateSetting();
SettingWithoutInjectLib = CreateSetting();
}
private static JsonSerializerOptions CreateSetting()
{
return new JsonSerializerOptions
{
ReadCommentHandling = JsonCommentHandling.Skip,
IncludeFields = true,
AllowTrailingCommas = true,
WriteIndented = true,
Converters =
{
(JsonConverter)new Il2CppListConverterFactory(),
(JsonConverter)new ColorConverter(),
(JsonConverter)new JsonStringEnumConverter(),
(JsonConverter)new LanguageDataConverter(),
(JsonConverter)new PersistentIDConverter(),
(JsonConverter)new LocalizedTextConverter()
}
};
}
public static T Deserialize<T>(string json, bool includeInjectLib = true)
{
return JsonSerializer.Deserialize<T>(json, includeInjectLib ? Setting : SettingWithoutInjectLib);
}
public static object Deserialize(string json, Type type)
{
return JsonSerializer.Deserialize(json, type, Setting);
}
}
internal static class Logger
{
public static ManualLogSource LogInstance;
public static void Log(string format, params object[] args)
{
Log(string.Format(format, args));
}
public static void Log(string str)
{
ManualLogSource logInstance = LogInstance;
if (logInstance != null)
{
logInstance.Log((LogLevel)8, (object)str);
}
}
public static void Warning(string format, params object[] args)
{
Warning(string.Format(format, args));
}
public static void Warning(string str)
{
ManualLogSource logInstance = LogInstance;
if (logInstance != null)
{
logInstance.Log((LogLevel)4, (object)str);
}
}
public static void Error(string format, params object[] args)
{
Error(string.Format(format, args));
}
public static void Error(string str)
{
ManualLogSource logInstance = LogInstance;
if (logInstance != null)
{
logInstance.Log((LogLevel)2, (object)str);
}
}
public static void Debug(string format, params object[] args)
{
Debug(string.Format(format, args));
}
public static void Debug(string str)
{
if (EntryPoint.LogDebugs)
{
ManualLogSource logInstance = LogInstance;
if (logInstance != null)
{
logInstance.Log((LogLevel)32, (object)str);
}
}
}
}
internal static class TextDBUtil
{
public static void RefreshTranslation()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
Language currentLanguage = Text.TextLocalizationService.CurrentLanguage;
GameDataTextLocalizationService val = ((Il2CppObjectBase)Text.TextLocalizationService).Cast<GameDataTextLocalizationService>();
val.m_textDataBlocks = null;
val.m_texts.Clear();
TextDataBlock[] array = Il2CppArrayBase<TextDataBlock>.op_Implicit(GameDataBlockBase<TextDataBlock>.GetAllBlocks());
val.m_textDataBlocks = Il2CppReferenceArray<TextDataBlock>.op_Implicit(array);
int num = array.Length;
for (int i = 0; i < num; i++)
{
TextDataBlock val2 = array[i];
string text = val2.GetTextSafe(currentLanguage);
if (string.IsNullOrWhiteSpace(text))
{
text = val2.English;
}
val.m_texts[((GameDataBlockBase<TextDataBlock>)(object)val2).persistentID] = text;
}
Text.TextLocalizationService.SetCurrentLanguage(Text.TextLocalizationService.CurrentLanguage);
Text.UpdateAllTexts();
}
public static void FixNullLanguageData(Language currentLanguage)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Expected O, but got Unknown
if (!Enum.IsDefined<Language>(currentLanguage) || (int)currentLanguage == 1)
{
return;
}
PropertyInfo propertyInfo = AccessTools.Property(typeof(TextDataBlock), ((object)(Language)(ref currentLanguage)).ToString());
if (propertyInfo == null)
{
return;
}
foreach (TextDataBlock allBlock in GameDataBlockBase<TextDataBlock>.GetAllBlocks())
{
if (propertyInfo.GetValue(allBlock) == null)
{
propertyInfo.SetValue(allBlock, (object?)new LanguageData(""));
}
}
}
public static string GetTextSafe(this TextDataBlock textDB, Language language)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected I4, but got Unknown
LanguageData val = (LanguageData)((language - 1) switch
{
0 => null,
1 => textDB.French,
2 => textDB.Italian,
3 => textDB.German,
4 => textDB.Spanish,
5 => textDB.Russian,
6 => textDB.Portuguese_Brazil,
7 => textDB.Polish,
8 => textDB.Japanese,
9 => textDB.Korean,
10 => textDB.Chinese_Traditional,
11 => textDB.Chinese_Simplified,
_ => null,
});
if (val == null)
{
return textDB.English;
}
return val.Translation;
}
}
}
namespace MTFO.Ext.PartialData.JsonConverters
{
internal class ColorConverter : JsonConverter<Color>
{
public override bool HandleNull => false;
public override Color Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
Color result = default(Color);
switch (reader.TokenType)
{
case JsonTokenType.StartObject:
while (reader.Read())
{
if (reader.TokenType == JsonTokenType.EndObject)
{
return result;
}
if (reader.TokenType != JsonTokenType.PropertyName)
{
throw new JsonException("Expected PropertyName token");
}
string? @string = reader.GetString();
reader.Read();
switch (@string.ToLower())
{
case "r":
result.r = reader.GetSingle();
break;
case "g":
result.g = reader.GetSingle();
break;
case "b":
result.b = reader.GetSingle();
break;
case "a":
result.a = reader.GetSingle();
break;
}
}
throw new JsonException("Expected EndObject token");
case JsonTokenType.String:
{
string text = reader.GetString().Trim();
if (ColorUtility.TryParseHtmlString(text, ref result))
{
return result;
}
throw new JsonException("Color format is not right: " + text);
}
default:
throw new JsonException($"ColorJson type: {reader.TokenType} is not implemented!");
}
}
public override void Write(Utf8JsonWriter writer, Color value, JsonSerializerOptions options)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
JsonSerializer.Serialize<Color>(writer, value, options);
}
}
internal class Il2CppListConverter<T> : JsonConverter<List<T>>
{
public override bool HandleNull => false;
public override List<T> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
List<T> val = new List<T>();
if (reader.TokenType == JsonTokenType.StartArray)
{
foreach (T item in JsonSerializer.Deserialize<List<T>>(ref reader, options))
{
val.Add(item);
}
return val;
}
return null;
}
public override void Write(Utf8JsonWriter writer, List<T> value, JsonSerializerOptions options)
{
writer.WriteStartArray();
Enumerator<T> enumerator = value.GetEnumerator();
while (enumerator.MoveNext())
{
T current = enumerator.Current;
JsonSerializer.Serialize(writer, current, options);
}
writer.WriteEndArray();
}
}
internal class Il2CppListConverterFactory : JsonConverterFactory
{
public override bool CanConvert(Type typeToConvert)
{
if (!typeToConvert.IsGenericType)
{
return false;
}
if (typeToConvert.GetGenericTypeDefinition() != typeof(List<>))
{
return false;
}
return true;
}
public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options)
{
Type type = typeToConvert.GetGenericArguments()[0];
return (JsonConverter)Activator.CreateInstance(typeof(Il2CppListConverter<>).MakeGenericType(type), BindingFlags.Instance | BindingFlags.Public, null, null, null);
}
}
internal class InjectLibConnectorWrapper : JsonConverterFactory
{
private static readonly InjectLibConnector _Connector = new InjectLibConnector();
public override bool CanConvert(Type typeToConvert)
{
Type baseType = typeToConvert.BaseType;
if (!baseType.IsGenericType)
{
return ((JsonConverter)(object)_Connector).CanConvert(typeToConvert);
}
if (baseType.GetGenericTypeDefinition() == typeof(GameDataBlockBase<>))
{
return false;
}
return ((JsonConverter)(object)_Connector).CanConvert(typeToConvert);
}
public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options)
{
return ((JsonConverterFactory)(object)_Connector).CreateConverter(typeToConvert, options);
}
}
internal class LanguageDataConverter : JsonConverter<LanguageData>
{
public override bool HandleNull => false;
public override LanguageData Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
LanguageData val = new LanguageData();
switch (reader.TokenType)
{
case JsonTokenType.StartObject:
while (reader.Read())
{
if (reader.TokenType == JsonTokenType.EndObject)
{
return val;
}
if (reader.TokenType != JsonTokenType.PropertyName)
{
throw new JsonException("Expected PropertyName token");
}
string? @string = reader.GetString();
reader.Read();
string text = @string.ToLower();
if (!(text == "translation"))
{
if (text == "shouldtranslate")
{
val.ShouldTranslate = reader.GetBoolean();
}
}
else
{
val.Translation = reader.GetString();
}
}
throw new JsonException("Expected EndObject token");
case JsonTokenType.String:
val.Translation = reader.GetString();
val.ShouldTranslate = false;
return val;
default:
throw new JsonException($"LangaugeDataJson type: {reader.TokenType} is not implemented!");
}
}
public override void Write(Utf8JsonWriter writer, LanguageData value, JsonSerializerOptions options)
{
JsonSerializer.Serialize<LanguageData>(writer, value, options);
}
}
internal class LocalizedTextConverter : JsonConverter<LocalizedText>
{
public override bool HandleNull => false;
public override LocalizedText Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Expected O, but got Unknown
switch (reader.TokenType)
{
case JsonTokenType.String:
{
string @string = reader.GetString();
if (!PersistentIDManager.TryGetId(@string, out var id))
{
return new LocalizedText
{
Id = 0u,
UntranslatedText = @string
};
}
return new LocalizedText
{
Id = id,
UntranslatedText = null
};
}
case JsonTokenType.Number:
return new LocalizedText
{
Id = reader.GetUInt32(),
UntranslatedText = null
};
default:
throw new JsonException($"LocalizedTextJson type: {reader.TokenType} is not implemented!");
}
}
public override void Write(Utf8JsonWriter writer, LocalizedText value, JsonSerializerOptions options)
{
JsonSerializer.Serialize<LocalizedText>(writer, value, options);
}
}
public class PersistentIDConverter : JsonConverter<uint>
{
public override uint Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.String)
{
return PersistentIDManager.GetId(reader.GetString());
}
if (reader.TokenType == JsonTokenType.Number)
{
return reader.GetUInt32();
}
throw new JsonException("TOKEN IS NOT VALID!");
}
public override void Write(Utf8JsonWriter writer, uint value, JsonSerializerOptions options)
{
writer.WriteNumberValue(value);
}
}
internal class Vector2Converter : JsonConverter<Vector2>
{
public override Vector2 Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
return JsonSerializer.Deserialize<Vector2>(ref reader);
}
public override void Write(Utf8JsonWriter writer, Vector2 value, JsonSerializerOptions options)
{
//IL_000c: 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)
writer.WriteStartObject();
writer.WriteNumber("x", value.x);
writer.WriteNumber("y", value.y);
writer.WriteEndObject();
}
}
}
namespace MTFO.Ext.PartialData.JsonConverters.InjectLibConverters
{
internal class Il2CppLocalizedTextConverter : Il2CppJsonReferenceTypeConverter<LocalizedText>
{
protected override LocalizedText Read(JToken jToken, LocalizedText existingValue, JsonSerializer serializer)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Expected O, but got Unknown
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Invalid comparison between Unknown and I4
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Invalid comparison between Unknown and I4
LocalizedText val = new LocalizedText();
JTokenType type = jToken.Type;
if ((int)type != 6)
{
if ((int)type == 8)
{
string text = (string)jToken;
if (PersistentIDManager.TryGetId(text, out var id))
{
val.Id = id;
val.UntranslatedText = null;
if (EntryPoint.LogInjectLibLink)
{
Logger.Log($"InjectLib_PData: Linked GUID: '{text}' to TextDB: '{id}'");
}
}
else
{
val.Id = 0u;
val.UntranslatedText = text;
}
}
}
else
{
val.Id = (uint)jToken;
val.UntranslatedText = null;
}
return val;
}
protected override void Write(JsonWriter writer, LocalizedText value, JsonSerializer serializer)
{
if (value == (LocalizedText)null)
{
writer.WriteNull();
}
else if (value.Id == 0)
{
writer.WriteValue(value.UntranslatedText);
}
else
{
writer.WriteValue(value.Id);
}
}
}
internal class Il2CppPersistentIDConverter : Il2CppJsonUnmanagedTypeConverter<uint>
{
protected override uint Read(JToken jToken, uint existingValue, JsonSerializer serializer)
{
//IL_0003: 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)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Invalid comparison between Unknown and I4
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Invalid comparison between Unknown and I4
uint result = 0u;
JTokenType type = jToken.Type;
if ((int)type != 6)
{
if ((int)type == 8)
{
string text = (string)jToken;
if (PersistentIDManager.TryGetId(text, out var id))
{
result = id;
if (EntryPoint.LogInjectLibLink)
{
Logger.Log($"InjectLib_PData: Linked GUID: '{text}' to persistentID: '{id}'");
}
}
else
{
Logger.Error("InjectLib_PData: Unable to find persistent id from GUID: " + text);
}
}
}
else
{
result = (uint)jToken;
}
return result;
}
protected override void Write(JsonWriter writer, uint value, JsonSerializer serializer)
{
writer.WriteValue(value);
}
protected override Object ToIl2CppObject(uint value)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
UInt32 val = default(UInt32);
val.m_value = value;
return ((UInt32)(ref val)).BoxIl2CppObject();
}
}
}
namespace MTFO.Ext.PartialData.Interops
{
internal class InheritanceConnector<T> where T : GameDataBlockBase<T>
{
private struct InheritanceCache
{
public uint id;
public List<string> propertyNames;
public uint parentID;
public string parentStr;
}
private readonly Queue<InheritanceCache> _caches;
private static bool HasInheritance => InheritanceInterop.IsLoaded;
public InheritanceConnector()
{
if (HasInheritance)
{
_caches = new Queue<InheritanceCache>();
}
}
public void CacheInheritance(JsonElement objNode, JsonElement idNode)
{
if (!HasInheritance)
{
return;
}
uint id = ((idNode.ValueKind == JsonValueKind.String) ? PersistentIDManager.GetId(idNode.GetString()) : idNode.GetUInt32());
RemoveInheritance_Internal(id);
if (!objNode.TryGetProperty("parentID", out var value))
{
return;
}
InheritanceCache inheritanceCache = default(InheritanceCache);
inheritanceCache.propertyNames = new List<string>();
inheritanceCache.parentID = 0u;
inheritanceCache.parentStr = "";
inheritanceCache.id = id;
InheritanceCache item = inheritanceCache;
if (value.ValueKind == JsonValueKind.String)
{
item.parentStr = value.GetString();
}
else
{
item.parentID = value.GetUInt32();
}
foreach (JsonProperty item2 in objNode.EnumerateObject())
{
if (!item2.NameEquals("parentID") && !item2.NameEquals("datablock"))
{
item.propertyNames.Add(item2.Name);
}
}
_caches.Enqueue(item);
}
private static void RemoveInheritance_Internal(uint id)
{
InheritanceAPI<T>.GetRoot().RemoveNode(id);
}
public void AddInheritance(T data)
{
if (HasInheritance && _caches.TryPeek(out var result) && ((GameDataBlockBase<T>)data).persistentID == result.id)
{
AddInheritance_Internal(data, _caches.Dequeue());
}
}
private static void AddInheritance_Internal(T data, InheritanceCache cache)
{
Type typeFromHandle = typeof(T);
uint num = ((cache.parentID != 0) ? cache.parentID : PersistentIDManager.GetId(cache.parentStr));
List<PropertyInfo> list = new List<PropertyInfo>(cache.propertyNames.Count - 2);
foreach (string propertyName in cache.propertyNames)
{
PropertyInfo propertyInfo = InheritanceAPI<T>.CacheProperty(typeFromHandle, propertyName);
if (propertyInfo != null)
{
list.Add(propertyInfo);
}
}
InheritanceAPI<T>.AddNode(cache.id, data, list, num);
}
public void ApplyAllInheritance()
{
if (HasInheritance)
{
ApplyAllInheritance_Internal();
}
}
public static void ApplyAllInheritance_Internal()
{
InheritanceAPI<T>.ApplyAllInheritance();
}
}
internal static class InheritanceInterop
{
public const string PLUGIN_GUID = "Dinorush.InheritanceDataBlocks";
public static bool IsLoaded { get; private set; }
internal static void Setup()
{
if (((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.ContainsKey("Dinorush.InheritanceDataBlocks"))
{
IsLoaded = true;
}
}
}
internal static class InjectLibInterop
{
public const string PLUGIN_GUID = "GTFO.InjectLib";
public static JsonConverter InjectLibConnector { get; private set; }
public static bool IsLoaded { get; private set; }
internal static void Setup()
{
if (((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.TryGetValue("GTFO.InjectLib", out var _))
{
try
{
IsLoaded = true;
SetupInjectLibSupports();
}
catch (Exception value2)
{
Logger.Error($"Exception thrown while reading data from GTFO.InjectLib: {value2}");
}
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void SetupInjectLibSupports()
{
JsonInjector.SetConverter<uint>((Il2CppJsonUnmanagedTypeConverter<uint>)new Il2CppPersistentIDConverter());
JsonInjector.SetConverter<LocalizedText>((Il2CppJsonReferenceTypeConverter<LocalizedText>)new Il2CppLocalizedTextConverter());
JSON.Setting.Converters.Add(new InjectLibConnectorWrapper());
}
}
internal static class MTFOInterop
{
public const string MTFOGUID = "com.dak.MTFO";
public static string GameDataPath { get; private set; } = string.Empty;
public static string CustomPath { get; private set; } = string.Empty;
public static bool HasCustomContent { get; private set; } = false;
public static bool IsLoaded { get; private set; } = false;
internal static void Setup()
{
if (!((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.TryGetValue("com.dak.MTFO", out var info))
{
return;
}
try
{
Type obj = (AppDomain.CurrentDomain.GetAssemblies().First((Assembly a) => !a.IsDynamic && a.Location == info.Location) ?? throw new Exception("Assembly is Missing!")).GetTypes().First((Type t) => t.Name == "ConfigManager") ?? throw new Exception("Unable to Find ConfigManager Class");
FieldInfo field = obj.GetField("GameDataPath", BindingFlags.Static | BindingFlags.Public);
FieldInfo field2 = obj.GetField("CustomPath", BindingFlags.Static | BindingFlags.Public);
FieldInfo? field3 = obj.GetField("HasCustomContent", BindingFlags.Static | BindingFlags.Public);
if ((object)field == null)
{
throw new Exception("Unable to Find Field: GameDataPath");
}
if ((object)field2 == null)
{
throw new Exception("Unable to Find Field: CustomPath");
}
if ((object)field3 == null)
{
throw new Exception("Unable to Find Field: HasCustomContent");
}
GameDataPath = (string)field.GetValue(null);
CustomPath = (string)field2.GetValue(null);
HasCustomContent = (bool)field3.GetValue(null);
IsLoaded = true;
}
catch (Exception value)
{
Console.WriteLine($"Exception thrown while reading path from Data Dumper (MTFO):\n{value}");
}
}
}
}
namespace MTFO.Ext.PartialData.Injects
{
[HarmonyPatch(typeof(GearManager))]
internal class Inject_GearManager
{
private const string COMP_CHARS = "abcdefghijklmnopqrst";
[HarmonyPrefix]
[HarmonyWrapSafe]
[HarmonyPatch("LoadOfflineGearDatas")]
private static void Pre_LoadOfflineGearDatas()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Invalid comparison between Unknown and I4
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Invalid comparison between Unknown and I4
foreach (PlayerOfflineGearDataBlock allBlock in GameDataBlockBase<PlayerOfflineGearDataBlock>.GetAllBlocks())
{
if (!((GameDataBlockBase<PlayerOfflineGearDataBlock>)(object)allBlock).internalEnabled || string.IsNullOrEmpty(allBlock.GearJSON) || ((int)allBlock.Type != 1 && (int)allBlock.Type != 2))
{
continue;
}
string text = allBlock.GearJSON;
bool flag = false;
using JsonDocument jsonDocument = JsonDocument.Parse(allBlock.GearJSON);
if (!jsonDocument.RootElement.TryGetProperty("Packet", out var value) || !value.TryGetProperty("Comps", out var value2))
{
continue;
}
string text2 = "abcdefghijklmnopqrst";
for (int i = 0; i < text2.Length; i++)
{
if (value2.TryGetProperty(text2[i].ToString(), out var value3) && value3.TryGetProperty("v", out var value4) && value4.ValueKind == JsonValueKind.String)
{
string @string = value4.GetString();
if (EntryPoint.LogOfflineGearLink)
{
Logger.Warning("Found String id: " + @string);
}
uint id = PersistentIDManager.GetId(@string);
if (id != 0)
{
text = new Regex("(\"v\")\\s*:\\s*(\"" + @string + "\")").Replace(text, $"\"v\":{id}");
flag = true;
}
}
}
if (flag)
{
if (EntryPoint.LogOfflineGearLink)
{
Logger.Warning(allBlock.GearJSON);
Logger.Warning(text);
}
allBlock.GearJSON = text;
}
}
}
}
[HarmonyPatch(typeof(CellSettingsApply), "ApplyLanguage")]
internal static class Inject_OnChangeLanguage
{
private static void Prefix(int value)
{
TextDBUtil.FixNullLanguageData((Language)value);
}
}
}
namespace MTFO.Ext.PartialData.DTO
{
internal class DataBlockDefinition
{
public string TypeName { get; set; } = "DataBlock?";
public uint StartFromID { get; set; } = 65535u;
public IncrementMode IncrementMode { get; set; }
}
internal class DatapackConfig
{
public string PackName { get; set; } = string.Empty;
public string Author { get; set; } = string.Empty;
public string Namespace { get; set; } = string.Empty;
}
}
namespace MTFO.Ext.PartialData.DataBlockTypes
{
internal static class DataBlockTypeManager
{
private static readonly List<IDataBlockType> _DataBlockCache = new List<IDataBlockType>();
private static readonly List<IDBuffer> _DataBlockIdBuffers = new List<IDBuffer>();
public static bool Initialize()
{
try
{
List<Type> list = new List<Type>();
Type[] typesFromAssembly = AccessTools.GetTypesFromAssembly(typeof(GameDataBlockBase<>).Assembly);
foreach (Type type in typesFromAssembly)
{
if (!(type == null) && !string.IsNullOrEmpty(type.Namespace) && type.Namespace.Equals("GameData"))
{
Type baseType = type.BaseType;
if (!(baseType == null) && baseType.Name.Equals("GameDataBlockBase`1"))
{
list.Add(type);
}
}
}
Type typeFromHandle = typeof(DataBlockTypeWrapper<>);
foreach (Type item in list)
{
IDataBlockType dataBlockType = (IDataBlockType)Activator.CreateInstance(typeFromHandle.MakeGenericType(item));
AssignForceChangeMethod(dataBlockType);
_DataBlockCache.Add(dataBlockType);
_DataBlockIdBuffers.Add(new IDBuffer());
}
return true;
}
catch (Exception value)
{
Logger.Error($"Can't make cache from Modules-ASM.dll!: {value}");
return false;
}
}
public static void AssignForceChangeMethod(IDataBlockType blockTypeCache)
{
switch (blockTypeCache.GetShortName().ToLower())
{
case "rundown":
blockTypeCache.RegisterOnChangeEvent(delegate
{
CM_PageRundown_New pageRundownNew = MainMenuGuiLayer.Current.PageRundownNew;
pageRundownNew.m_dataIsSetup = false;
try
{
clearIcon(pageRundownNew.m_expIconsTier1);
clearIcon(pageRundownNew.m_expIconsTier2);
clearIcon(pageRundownNew.m_expIconsTier3);
clearIcon(pageRundownNew.m_expIconsTier4);
clearIcon(pageRundownNew.m_expIconsTier5);
clearIcon(pageRundownNew.m_expIconsTierExt);
}
catch (Exception value)
{
Logger.Error($"{value}");
}
pageRundownNew.m_currentRundownData = GameDataBlockBase<RundownDataBlock>.GetBlock(Global.RundownIdToLoad);
if (pageRundownNew.m_currentRundownData != null)
{
pageRundownNew.PlaceRundown(pageRundownNew.m_currentRundownData);
pageRundownNew.m_dataIsSetup = true;
}
});
break;
case "fogsettings":
blockTypeCache.RegisterOnChangeEvent(delegate
{
if (Builder.CurrentFloor.IsBuilt)
{
pEnvironmentState state = EnvironmentStateManager.Current.m_stateReplicator.State;
EnvironmentStateManager.Current.UpdateFogSettingsForState(state);
}
});
break;
case "lightsettings":
blockTypeCache.RegisterOnChangeEvent(delegate
{
if (Builder.CurrentFloor.IsBuilt)
{
Enumerator<LG_Zone> enumerator2 = Builder.CurrentFloor.allZones.GetEnumerator();
while (enumerator2.MoveNext())
{
LG_Zone current2 = enumerator2.Current;
Enumerator<AIG_CourseNode> enumerator3 = current2.m_courseNodes.GetEnumerator();
while (enumerator3.MoveNext())
{
AIG_CourseNode current3 = enumerator3.Current;
LG_BuildZoneLightsJob.ApplyLightSettings(0u, current3.m_lightsInNode, current2.m_lightSettings, false);
}
}
}
});
break;
case "text":
blockTypeCache.RegisterOnChangeEvent(delegate
{
TextDBUtil.RefreshTranslation();
});
break;
}
static void clearIcon(List<CM_ExpeditionIcon_New> tier)
{
if (tier != null)
{
Enumerator<CM_ExpeditionIcon_New> enumerator = tier.GetEnumerator();
while (enumerator.MoveNext())
{
CM_ExpeditionIcon_New current = enumerator.Current;
if ((Object)(object)((Component)current).gameObject != (Object)null)
{
Object.Destroy((Object)(object)((Component)current).gameObject);
}
}
}
}
}
public static bool TryFindCache(string blockTypeName, out IDataBlockType cache)
{
int index = GetIndex(blockTypeName);
if (index != -1)
{
cache = _DataBlockCache[index];
return true;
}
cache = null;
return false;
}
public static bool TryGetNextID(string blockTypeName, out uint id)
{
int index = GetIndex(blockTypeName);
if (index != -1)
{
id = _DataBlockIdBuffers[index].GetNext();
return true;
}
id = 0u;
return false;
}
public static void SetIDBuffer(string blockTypeName, uint id)
{
int index = GetIndex(blockTypeName);
if (index != -1)
{
_DataBlockIdBuffers[index].CurrentID = id;
}
}
public static void SetIDBuffer(string blockTypeName, uint id, IncrementMode mode)
{
int index = GetIndex(blockTypeName);
if (index != -1)
{
IDBuffer iDBuffer = _DataBlockIdBuffers[index];
iDBuffer.CurrentID = id;
iDBuffer.IncrementMode = mode;
}
}
private static int GetIndex(string blockTypeName)
{
blockTypeName = GetBlockName(blockTypeName);
return _DataBlockCache.FindIndex((IDataBlockType x) => x.GetShortName().Equals(blockTypeName, StringComparison.OrdinalIgnoreCase));
}
public static string GetBlockName(string blockTypeName)
{
blockTypeName = blockTypeName.Trim();
if (blockTypeName.EndsWith("DataBlock"))
{
string text = blockTypeName;
blockTypeName = text.Substring(0, text.Length - 9);
}
return blockTypeName;
}
}
internal class DataBlockTypeWrapper<T> : IDataBlockType where T : GameDataBlockBase<T>
{
public Action OnForceChange;
public string FullName { get; private set; }
public string ShortenName { get; private set; }
public InheritanceConnector<T> InheritanceConnector { get; private set; } = new InheritanceConnector<T>();
public DataBlockTypeWrapper()
{
FullName = typeof(T).Name.Trim();
ShortenName = FullName.Replace("DataBlock", "");
}
public void OnChanged()
{
OnForceChange?.Invoke();
}
public void AddBlock(T block)
{
T block2 = GameDataBlockBase<T>.GetBlock(((GameDataBlockBase<T>)block).persistentID);
InheritanceConnector.AddInheritance(block);
if (block2 != null)
{
InheritanceConnector.ApplyAllInheritance();
CopyProperties(block, block2);
if (EntryPoint.LogEditBlock)
{
Logger.Log($"Replaced Block: {((GameDataBlockBase<T>)block2).persistentID}, {((GameDataBlockBase<T>)block2).name}");
}
}
else
{
GameDataBlockBase<T>.AddBlock(block, -1);
if (EntryPoint.LogAddBlock)
{
Logger.Log($"Added Block: {((GameDataBlockBase<T>)block).persistentID}, {((GameDataBlockBase<T>)block).name}");
}
}
}
public void AddJsonBlock(string json)
{
try
{
switch (JsonDocument.Parse(json, new JsonDocumentOptions
{
CommentHandling = JsonCommentHandling.Skip
}).RootElement.ValueKind)
{
case JsonValueKind.Array:
{
T[] array = (T[])JSON.Deserialize(json, typeof(T).MakeArrayType());
foreach (T block2 in array)
{
AddBlock(block2);
}
break;
}
case JsonValueKind.Object:
{
T block = (T)JSON.Deserialize(json, typeof(T));
AddBlock(block);
break;
}
}
}
catch (Exception value)
{
Logger.Error($"Error While Adding Block: {value}");
}
}
public void DoSaveToDisk(string fullPath)
{
string filePathFull = GameDataBlockBase<T>.m_filePathFull;
GameDataBlockBase<T>.m_filePathFull = fullPath;
GameDataBlockBase<T>.DoSaveToDisk(false, false, true);
GameDataBlockBase<T>.m_filePathFull = filePathFull;
}
private static object CopyProperties(object source, object target)
{
PropertyInfo[] properties = source.GetType().GetProperties();
foreach (PropertyInfo sourceProp in properties)
{
Type propertyType = sourceProp.PropertyType;
PropertyInfo propertyInfo = target.GetType().GetProperties().FirstOrDefault((PropertyInfo x) => x.Name == sourceProp.Name && x.PropertyType == sourceProp.PropertyType && x.CanWrite);
if (propertyInfo != null && !sourceProp.Name.Contains("_k__BackingField"))
{
if (propertyType == typeof(IntPtr))
{
Logger.Error("Pointer has detected on CopyProperties!!!!");
}
else
{
propertyInfo.SetValue(target, sourceProp.GetValue(source));
}
}
}
return target;
}
public string GetShortName()
{
return ShortenName;
}
public string GetFullName()
{
return FullName;
}
public void RegisterOnChangeEvent(Action onChanged)
{
OnForceChange = (Action)Delegate.Combine(OnForceChange, onChanged);
}
public void CacheInheritance(JsonElement objNode, JsonElement idNode)
{
InheritanceConnector.CacheInheritance(objNode, idNode);
}
public void ApplyInheritance()
{
InheritanceConnector.ApplyAllInheritance();
}
}
internal interface IDataBlockType
{
string GetShortName();
string GetFullName();
void DoSaveToDisk(string fullPath);
void AddJsonBlock(string json);
void OnChanged();
void RegisterOnChangeEvent(Action onChanged);
void CacheInheritance(JsonElement objNode, JsonElement idNode);
void ApplyInheritance();
}
}using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AIGraph;
using Agents;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using ChainedPuzzles;
using GTFO.API;
using GameData;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using LevelGeneration;
using Localization;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using SecDoorTerminalInterface.Inject;
using TMPro;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("SecDoorTerminalInterface")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+git6952937-master")]
[assembly: AssemblyProduct("SecDoorTerminalInterface")]
[assembly: AssemblyTitle("SecDoorTerminalInterface")]
[assembly: TargetPlatform("Windows7.0")]
[assembly: SupportedOSPlatform("Windows7.0")]
[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 SecDoorTerminalInterface
{
internal static class Assets
{
public static GameObject SecDoorTerminalPrefab;
public static void Init()
{
SecDoorTerminalPrefab = AssetAPI.GetLoadedAsset<GameObject>("Assets/Modding/SecDoorTerminal/Terminal_SecDoor.prefab");
}
}
public struct CommandDescriptor
{
public TERM_Command Type;
public string Command;
public string Description;
public TERM_CommandRule Rule;
}
public enum CPSolvedBehaviour
{
OpenDoor,
AddOpenCommand,
Nothing
}
[BepInPlugin("SecDoorTerminalInterface", "SecDoorTerminalInterface", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
internal class EntryPoint : BasePlugin
{
private Harmony _Harmony;
public override void Load()
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
AssetAPI.OnAssetBundlesLoaded += AssetAPI_OnAssetBundlesLoaded;
_Harmony = new Harmony("SecDoorTerminalInterface.Harmony");
_Harmony.PatchAll();
}
private void AssetAPI_OnAssetBundlesLoaded()
{
Assets.Init();
}
}
internal static class Logger
{
private static readonly ManualLogSource _Logger;
static Logger()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Expected O, but got Unknown
_Logger = new ManualLogSource("SecDoorTerminalInterface");
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)
{
}
}
public sealed class SecDoorTerminal
{
public const TERM_Command COMMAND_OPEN = 255;
public const TERM_Command COMMAND_OVERRIDE = 254;
private LocalizedText _GCTextHolder;
private Vector3 _SavedIntOpenDoorPos;
private Vector3 _SavedIntUseKeyPos;
private Vector3 _SavedIntCustomMessagePos;
private Vector3 _SavedIntHackPos;
private SDT_StateBehaviour _StateBehaviour;
private static readonly Vector3 BEGONE = Vector3.one * 10000f;
public string OpenCommandName { get; set; } = "OPEN_LINKED";
public string OpenCommandDescription { get; set; } = "Open the linked security door";
public LG_SecurityDoor LinkedDoor { get; private set; }
public LG_SecurityDoor_Locks LinkedDoorLocks { get; private set; }
public LG_ComputerTerminal ComputerTerminal { get; private set; }
public LG_ComputerTerminalCommandInterpreter CmdProcessor { get; private set; }
public Interact_ComputerTerminal Interaction { get; private set; }
public TextMeshPro IdleText { get; private set; }
public SpriteRenderer IdleIcon { get; private set; }
public AIG_CourseNode SpawnNode => ComputerTerminal.m_terminalItem.SpawnNode;
public bool IsTerminalActive { get; private set; } = true;
public CPSolvedBehaviour BioscanScanSolvedBehaviour { get; set; } = CPSolvedBehaviour.AddOpenCommand;
public SDT_StateBehaviour StateBehaviour
{
get
{
return _StateBehaviour;
}
set
{
_StateBehaviour?.SetContext(null);
_StateBehaviour = value;
_StateBehaviour?.SetContext(this);
}
}
public event Action<TERM_Command, string, string, string> OnCmdUsed;
private void Setup_CommandModule()
{
Inject_Terminal_ReceiveCmd.OnCmdUsed_LevelInstanced += OnReceiveCommand;
}
private void OnReceiveCommand(LG_ComputerTerminalCommandInterpreter interpreter, TERM_Command cmd, string inputLine, string param1, string param2)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
if (interpreter.m_terminal.m_syncID == ComputerTerminal.m_syncID)
{
this.OnCmdUsed?.Invoke(cmd, inputLine, param1, param2);
}
}
public void AddCommand(CommandDescriptor descriptor, Action<LG_ComputerTerminalCommandInterpreter> onCommandUsed = null)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Expected O, but got Unknown
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected O, but got Unknown
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
if (CmdProcessor.HasRegisteredCommand(descriptor.Type))
{
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(33, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Command Type: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<TERM_Command>(descriptor.Type);
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is Already Added!!");
}
Logger.Error(val);
return;
}
_GCTextHolder = new LocalizedText
{
UntranslatedText = descriptor.Description,
Id = 0u
};
CmdProcessor.AddCommand(descriptor.Type, descriptor.Command, _GCTextHolder, descriptor.Rule);
OnCmdUsed += delegate(TERM_Command cmdType, string cmdStr, string param1, string param2)
{
//IL_0000: 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)
if (cmdType == descriptor.Type)
{
onCommandUsed?.Invoke(CmdProcessor);
}
};
}
public void AddOverrideCommand(string cmd, string helpText, Action<LG_ComputerTerminalCommandInterpreter> onCommandUsed = null)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
CommandDescriptor commandDescriptor = default(CommandDescriptor);
commandDescriptor.Type = (TERM_Command)254;
commandDescriptor.Command = cmd;
commandDescriptor.Description = helpText;
commandDescriptor.Rule = (TERM_CommandRule)1;
CommandDescriptor descriptor = commandDescriptor;
AddCommand(descriptor, delegate(LG_ComputerTerminalCommandInterpreter interpreter)
{
onCommandUsed?.Invoke(CmdProcessor);
interpreter.AddOutput((TerminalLineType)0, "Desired Action: <color=orange>OVERRIDE</color>", 0.5f, (TerminalSoundType)0, (TerminalSoundType)0);
interpreter.AddOutput((TerminalLineType)4, "Decrypting Authorize ID..", 0.85f, (TerminalSoundType)0, (TerminalSoundType)0);
interpreter.AddOutput((TerminalLineType)2, "Sending..", 1.2f, (TerminalSoundType)0, (TerminalSoundType)0);
interpreter.AddOutput((TerminalLineType)5, "<color=orange>OVERRIDE</color> Action sent!", 0.65f, (TerminalSoundType)0, (TerminalSoundType)0);
SetEndOfQueue(delegate
{
if (SNet.IsMaster)
{
LinkedDoorLocks.m_intOpenDoor.OnInteractionTriggered.Invoke(PlayerManager.GetLocalPlayerAgent());
}
});
});
}
public void AddOpenCommand(string cmd, string helpText, Action<LG_ComputerTerminalCommandInterpreter> onCommandUsed = null)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
CommandDescriptor commandDescriptor = default(CommandDescriptor);
commandDescriptor.Type = (TERM_Command)255;
commandDescriptor.Command = cmd;
commandDescriptor.Description = helpText;
commandDescriptor.Rule = (TERM_CommandRule)1;
CommandDescriptor descriptor = commandDescriptor;
AddCommand(descriptor, delegate(LG_ComputerTerminalCommandInterpreter interpreter)
{
onCommandUsed?.Invoke(interpreter);
interpreter.AddOutput((TerminalLineType)0, "Desired Action: <color=orange>OPEN</color>", 0.5f, (TerminalSoundType)0, (TerminalSoundType)0);
interpreter.AddOutput((TerminalLineType)4, "Decrypting Authorize ID..", 0.85f, (TerminalSoundType)0, (TerminalSoundType)0);
interpreter.AddOutput((TerminalLineType)2, "Sending..", 1.2f, (TerminalSoundType)0, (TerminalSoundType)0);
interpreter.AddOutput((TerminalLineType)5, "<color=orange>OVERRIDE</color> Action sent!", 0.65f, (TerminalSoundType)0, (TerminalSoundType)0);
SetEndOfQueue(delegate
{
if (SNet.IsMaster)
{
LinkedDoorLocks.m_intOpenDoor.OnInteractionTriggered.Invoke(PlayerManager.GetLocalPlayerAgent());
}
});
});
}
public void SetEndOfQueue(Action onEndOfQueue)
{
CmdProcessor.OnEndOfQueue = Action.op_Implicit(onEndOfQueue);
}
private void Setup()
{
Setup_GraphicModule();
Setup_DoorInteractModule();
Setup_DoorStateModule();
Setup_CommandModule();
}
public void SetTerminalActive(bool active)
{
IsTerminalActive = active;
((Behaviour)ComputerTerminal).enabled = active;
Interact_ComputerTerminal componentInChildren = ((Component)ComputerTerminal).GetComponentInChildren<Interact_ComputerTerminal>(true);
if ((Object)(object)componentInChildren != (Object)null)
{
((Behaviour)componentInChildren).enabled = active;
((Interact_Base)componentInChildren).SetActive(active);
}
if (!active)
{
PlayerAgent localInteractionSource = ComputerTerminal.m_localInteractionSource;
if ((Object)(object)localInteractionSource != (Object)null && localInteractionSource.FPItemHolder.InTerminalTrigger)
{
ComputerTerminal.ExitFPSView();
}
if (SNet.IsMaster)
{
ComputerTerminal.ChangeState((TERM_State)0);
}
}
}
public void SetSpawnNode(AIG_CourseNode node)
{
ComputerTerminal.m_terminalItem.SpawnNode = node;
}
public void SetLocationTextToSpawnZone()
{
SetLocationText(SpawnNode.m_zone.NavInfo.GetFormattedText((LG_NavInfoFormat)7));
}
public void SetLocationText(string text)
{
ComputerTerminal.m_terminalItem.FloorItemLocation = text;
}
private SecDoorTerminal()
{
}
public void SetOpenInteractActive(bool active)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
Interact_Timed intOpenDoor = LinkedDoorLocks.m_intOpenDoor;
((Component)intOpenDoor).transform.position = (active ? _SavedIntOpenDoorPos : BEGONE);
((Interact_Base)intOpenDoor).SetActive(active);
}
public void SetUseKeyInteractActive(bool active)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
Interact_RequireKeyItem intUseKeyItem = LinkedDoorLocks.m_intUseKeyItem;
((Component)intUseKeyItem).transform.position = (active ? _SavedIntUseKeyPos : BEGONE);
((Interact_Base)intUseKeyItem).SetActive(active);
}
public void SetHackingInteractActive(bool active)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
Interact_Hack intHack = LinkedDoorLocks.m_intHack;
((Component)intHack).transform.position = (active ? _SavedIntHackPos : BEGONE);
((Interact_Base)intHack).SetActive(active);
}
public void SetCustomMessageActive(bool active)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
Interact_MessageOnScreen intCustomMessage = LinkedDoorLocks.m_intCustomMessage;
((Component)intCustomMessage).transform.position = (active ? _SavedIntCustomMessagePos : BEGONE);
((Interact_Base)intCustomMessage).SetActive(active);
}
public void OpenOrStartChainPuzzle()
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
ChainedPuzzleInstance chainedPuzzleToSolve = LinkedDoorLocks.ChainedPuzzleToSolve;
if ((Object)(object)chainedPuzzleToSolve != (Object)null && !chainedPuzzleToSolve.IsSolved)
{
LinkedDoor.m_sync.AttemptDoorInteraction((eDoorInteractionType)4, 0f, 0f, default(Vector3), (Agent)null);
}
else
{
LinkedDoor.m_sync.AttemptDoorInteraction((eDoorInteractionType)0, 0f, 0f, default(Vector3), (Agent)null);
}
}
public void ForceOpenDoor(float delay)
{
if (delay > 0f)
{
CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(OpenDoorWithDelay(delay)), (Action)null);
}
else
{
ForceOpenDoor();
}
}
private IEnumerator OpenDoorWithDelay(float delay)
{
yield return (object)new WaitForSeconds(delay);
LinkedDoor.m_sync.AttemptDoorInteraction((eDoorInteractionType)0, 0f, 0f, default(Vector3), (Agent)null);
}
public void ForceOpenDoor()
{
//IL_0018: 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)
LinkedDoor.m_sync.AttemptDoorInteraction((eDoorInteractionType)0, 0f, 0f, default(Vector3), (Agent)null);
}
private void Setup_DoorInteractModule()
{
//IL_0011: 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_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
_SavedIntOpenDoorPos = ((Component)LinkedDoorLocks.m_intOpenDoor).transform.position;
_SavedIntUseKeyPos = ((Component)LinkedDoorLocks.m_intUseKeyItem).transform.position;
_SavedIntCustomMessagePos = ((Component)LinkedDoorLocks.m_intCustomMessage).transform.position;
_SavedIntHackPos = ((Component)LinkedDoorLocks.m_intHack).transform.position;
}
private void Setup_DoorStateModule()
{
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
StateBehaviour = new SDT_StateBehaviour();
LinkedDoor.m_sync.OnDoorStateChange += Action<pDoorState, bool>.op_Implicit((Action<pDoorState, bool>)OnStateChange);
LinkedDoorLocks.OnChainedPuzzleSolved += Action.op_Implicit((Action)OnChainedPuzzleSolved);
OnStateChange(LinkedDoor.m_sync.GetCurrentSyncState(), isRecall: false);
}
private void OnChainedPuzzleSolved()
{
switch (BioscanScanSolvedBehaviour)
{
case CPSolvedBehaviour.OpenDoor:
if (SNet.IsMaster)
{
ForceOpenDoor(0.25f);
}
break;
case CPSolvedBehaviour.AddOpenCommand:
CmdProcessor.AddOutput((TerminalLineType)5, "Bioscan Sequence Completed - <color=orange>" + OpenCommandName + "</color> Command is now accessible!", 0f, (TerminalSoundType)0, (TerminalSoundType)0);
AddOpenCommand(OpenCommandName, OpenCommandDescription);
break;
}
}
private void OnStateChange(pDoorState state, bool isRecall)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: 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_003a: Unknown result type (might be due to invalid IL or missing references)
if (StateBehaviour != null)
{
ActiveEnemyWaveData activeEnemyWaveData = LinkedDoor.ActiveEnemyWaveData;
bool isBloodyDoor = activeEnemyWaveData != null && activeEnemyWaveData.HasActiveEnemyWave;
SecDoorState secDoorState = default(SecDoorState);
secDoorState.Status = state.status;
secDoorState.State = state;
secDoorState.IsBloodyDoor = isBloodyDoor;
SecDoorState state2 = secDoorState;
StateBehaviour.UpdateInteractionState(state2, isRecall);
StateBehaviour.UpdateGraphicState(state2, isRecall);
}
}
private void Setup_GraphicModule()
{
CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(ForceScreenOffOnDeactive()), (Action)null);
}
private IEnumerator ForceScreenOffOnDeactive()
{
while (true)
{
if (IsTerminalActive)
{
((Behaviour)ComputerTerminal.m_text).enabled = true;
}
else
{
((Behaviour)ComputerTerminal.m_text).enabled = false;
ComputerTerminal.m_loginScreen.SetActive(true);
ComputerTerminal.m_interfaceScreen.SetActive(true);
}
yield return null;
}
}
public void SetIdleIconColor(Color color)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
IdleIcon.color = color;
}
public void SetIdleText(string text)
{
((TMP_Text)IdleText).text = text;
}
public void SetIdleTextFontSize(float size)
{
((TMP_Text)IdleText).fontSize = size;
}
public static SecDoorTerminal Place(LG_SecurityDoor secDoor, TerminalStartStateData startData = null, TerminalPlacementData placementData = null)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
if ((int)secDoor.m_securityDoorType != 0)
{
return null;
}
Transform val = CustomExtensions.FindChildRecursive(((Component)secDoor).transform, "InteractionInterface", true);
if ((Object)(object)val == (Object)null)
{
return null;
}
((Component)val).gameObject.SetActiveRecursively(false);
((Component)val).gameObject.SetActive(true);
GameObject obj = Object.Instantiate<GameObject>(Assets.SecDoorTerminalPrefab, val);
obj.transform.localPosition = (((int)secDoor.Gate.Type == 0) ? new Vector3(0f, -0.006f, 0f) : new Vector3(0f, -0.026f, 0f));
obj.transform.localRotation = Quaternion.identity;
obj.transform.localScale = Vector3.one;
iTerminalItem componentInChildren = obj.GetComponentInChildren<iTerminalItem>();
if (componentInChildren != null && TryGetSecDoorSpawnedNode(secDoor, out var spawnedNode))
{
componentInChildren.SpawnNode = spawnedNode;
}
LG_ComputerTerminal component = obj.GetComponent<LG_ComputerTerminal>();
component.Setup(startData, placementData);
MeshFilter[] array = Il2CppArrayBase<MeshFilter>.op_Implicit(((Component)secDoor).GetComponentsInChildren<MeshFilter>(true));
foreach (MeshFilter val2 in array)
{
if (!((Object)(object)val2.sharedMesh == (Object)null))
{
string name = ((Object)val2.sharedMesh).name;
if (!string.IsNullOrEmpty(name) && name.Equals("g_security_door_display"))
{
Transform transform = ((Component)val2).gameObject.transform;
transform.localPosition += BEGONE;
}
}
}
SecDoorTerminal secDoorTerminal = new SecDoorTerminal();
secDoorTerminal.LinkedDoor = secDoor;
secDoorTerminal.LinkedDoorLocks = ((Il2CppObjectBase)secDoor.m_locks).Cast<LG_SecurityDoor_Locks>();
secDoorTerminal.ComputerTerminal = component;
secDoorTerminal.CmdProcessor = component.m_command;
secDoorTerminal.Interaction = ((Component)component).GetComponentInChildren<Interact_ComputerTerminal>(true);
secDoorTerminal.IdleIcon = component.m_loginScreen.GetComponent<SpriteRenderer>();
secDoorTerminal.IdleText = component.m_loginScreen.GetComponentInChildren<TextMeshPro>();
secDoorTerminal.Setup();
return secDoorTerminal;
}
private static bool TryGetSecDoorSpawnedNode(LG_SecurityDoor secDoor, out AIG_CourseNode spawnedNode)
{
if ((Object)(object)secDoor == (Object)null)
{
spawnedNode = null;
return false;
}
if ((Object)(object)secDoor.Gate == (Object)null)
{
spawnedNode = null;
return false;
}
if ((Object)(object)((LG_ZoneExpander)secDoor.Gate).m_linksFrom == (Object)null)
{
spawnedNode = null;
return false;
}
spawnedNode = ((LG_ZoneExpander)secDoor.Gate).m_linksFrom.m_courseNode;
return spawnedNode != null;
}
}
public class SDT_StateBehaviour
{
public SecDoorTerminal Context { get; private set; }
internal void SetContext(SecDoorTerminal secDoorTerminal)
{
Context = secDoorTerminal;
}
public virtual void UpdateInteractionState(SecDoorState state, bool isRecall)
{
//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_0051: Expected I4, but got Unknown
eDoorStatus status = state.Status;
switch ((int)status)
{
case 0:
case 1:
case 2:
case 4:
case 5:
case 7:
case 9:
case 12:
case 13:
case 14:
Context.SetTerminalActive(active: true);
Context.SetOpenInteractActive(active: false);
Context.SetHackingInteractActive(active: false);
Context.SetUseKeyInteractActive(active: false);
Context.SetCustomMessageActive(active: false);
break;
case 3:
Context.SetTerminalActive(active: false);
Context.SetOpenInteractActive(active: false);
Context.SetHackingInteractActive(active: false);
Context.SetUseKeyInteractActive(active: true);
Context.SetCustomMessageActive(active: false);
break;
case 6:
case 15:
Context.SetTerminalActive(active: false);
Context.SetOpenInteractActive(active: false);
Context.SetHackingInteractActive(active: false);
Context.SetUseKeyInteractActive(active: false);
Context.SetCustomMessageActive(active: true);
break;
case 8:
case 10:
case 11:
case 16:
Context.SetTerminalActive(active: false);
Context.SetOpenInteractActive(active: false);
Context.SetHackingInteractActive(active: false);
Context.SetUseKeyInteractActive(active: false);
Context.SetCustomMessageActive(active: false);
break;
}
}
public virtual void UpdateGraphicState(SecDoorState state, bool isRecall)
{
//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_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Expected I4, but got Unknown
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: 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_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
eDoorStatus status = state.Status;
string text;
Color? val;
switch (status - 1)
{
case 14:
text = "::<color=orange>Bulkhead Override</color> Required::";
val = Color.yellow;
break;
case 2:
text = "::<color=orange>Keycard</color> Required::";
val = Color.red;
break;
case 4:
text = "<color=orange>BIOSCAN Protocol</color> pending...";
val = Color.cyan;
break;
case 3:
text = "<color=orange>BIOSCAN Protocol</color> pending...";
val = Color.red;
break;
case 5:
text = "BOOT ERR://Power Level - <color=red>LOW</color>";
val = ColorExt.Hex("#FFA500");
break;
case 6:
text = "<color=orange>LOCKDOWN Protocol</color> engaged!";
val = Color.red;
break;
case 7:
if (Context.LinkedDoorLocks.ChainedPuzzleToSolve.Data.TriggerAlarmOnActivate)
{
text = "<color=red>BIOSCAN Protocol</color> processing!";
val = Color.red;
}
else
{
text = "<color=blue>BIOSCAN Protocol</color> processing!";
val = Color.cyan;
}
break;
case 9:
case 15:
text = "::DOOR OVERRIDING::";
val = Color.cyan;
break;
case 0:
text = "::DOOR LOCKING::";
val = Color.cyan;
break;
default:
text = "Waiting...";
val = Color.green;
break;
}
if (val.HasValue)
{
Context.SetIdleIconColor(val.Value);
}
if (text != null)
{
Context.SetIdleText(text);
}
}
}
public struct SecDoorState
{
public eDoorStatus Status;
public pDoorState State;
public bool IsBloodyDoor;
}
[GeneratedCode("VersionInfoGenerator", "2.1.3+git35c0c2a-master")]
[CompilerGenerated]
internal static class VersionInfo
{
public const string RootNamespace = "SecDoorTerminalInterface";
public const string Version = "1.0.0";
public const string VersionPrerelease = null;
public const string VersionMetadata = "git6952937-master";
public const string SemVer = "1.0.0+git6952937-master";
public const string GitRevShort = "6952937";
public const string GitRevLong = "69529374dcbe6b589a13bfc0c363675c5cd3e803";
public const string GitBranch = "master";
public const string GitTag = null;
public const int GitCommitsSinceTag = 0;
public const bool GitIsDirty = false;
}
}
namespace SecDoorTerminalInterface.Inject
{
[HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "ReceiveCommand")]
internal class Inject_Terminal_ReceiveCmd
{
public static event Action<LG_ComputerTerminalCommandInterpreter, TERM_Command, string, string, string> OnCmdUsed_LevelInstanced;
static Inject_Terminal_ReceiveCmd()
{
LevelAPI.OnLevelCleanup += delegate
{
Inject_Terminal_ReceiveCmd.OnCmdUsed_LevelInstanced = null;
};
}
private static void Prefix(LG_ComputerTerminalCommandInterpreter __instance, TERM_Command cmd, string inputLine, string param1, string param2)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
Inject_Terminal_ReceiveCmd.OnCmdUsed_LevelInstanced?.Invoke(__instance, cmd, inputLine, param1, param2);
}
}
}