Decompiled source of LethalInternship v0.18.3
plugins/Szumi57-LethalInternship/LethalInternship.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using BetterEmote.AssetScripts; using CSync.Extensions; using CSync.Lib; using CustomItemBehaviourLibrary.AbstractItems; using FasterItemDropship; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyInputUtils.Api; using LethalInternship.AI; using LethalInternship.AI.AIStates; using LethalInternship.Configs; using LethalInternship.Enums; using LethalInternship.Inputs; using LethalInternship.Managers; using LethalInternship.Managers.SaveInfos; using LethalInternship.NetcodePatcher; using LethalInternship.Patches.EnemiesPatches; using LethalInternship.Patches.GameEnginePatches; using LethalInternship.Patches.MapHazardsPatches; using LethalInternship.Patches.MapPatches; using LethalInternship.Patches.ModPatches.AdditionalNetworking; using LethalInternship.Patches.ModPatches.BetterEmotes; using LethalInternship.Patches.ModPatches.FasterItemDropship; using LethalInternship.Patches.ModPatches.LethalPhones; using LethalInternship.Patches.ModPatches.LethalProgression; using LethalInternship.Patches.ModPatches.ModelRplcmntAPI; using LethalInternship.Patches.ModPatches.MoreCompany; using LethalInternship.Patches.ModPatches.MoreEmotes; using LethalInternship.Patches.ModPatches.QuickBuy; using LethalInternship.Patches.ModPatches.ReservedItemSlotCore; using LethalInternship.Patches.ModPatches.ReviveCompany; using LethalInternship.Patches.ModPatches.ShowCapacity; using LethalInternship.Patches.ModPatches.TooManyEmotes; using LethalInternship.Patches.NpcPatches; using LethalInternship.Patches.ObjectsPatches; using LethalInternship.Patches.TerminalPatches; using LethalInternship.TerminalAdapter; using LethalInternship.TerminalAdapter.TerminalStates; using LethalInternship.Utils; using LethalLib.Modules; using Microsoft.CodeAnalysis; using ModelReplacement; using ModelReplacement.Monobehaviors; using ModelReplacement.Patches; using MoreCompany; using MoreCompany.Cosmetics; using MoreEmotes.Patch; using MoreEmotes.Scripts; using Newtonsoft.Json; using OPJosMod.ReviveCompany; using Scoops.misc; using Scoops.patch; using TMPro; using TooManyEmotes; using TooManyEmotes.Patches; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Animations.Rigging; using UnityEngine.InputSystem; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LethalInternship")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.18.3.0")] [assembly: AssemblyInformationalVersion("0.18.3")] [assembly: AssemblyProduct("LethalInternship")] [assembly: AssemblyTitle("LethalInternship")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.18.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } 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 LethalInternship { internal class Const { public const string CSYNC_GUID = "com.sigurd.csync"; public const string MORECOMPANY_GUID = "me.swipez.melonloader.morecompany"; public const string BETTER_EXP_GUID = "Swaggies.BetterEXP"; public const string MOREEMOTES_GUID = "MoreEmotes"; public const string BETTEREMOTES_GUID = "BetterEmotes"; public const string MODELREPLACEMENT_GUID = "meow.ModelReplacementAPI"; public const string LETHALPHONES_GUID = "LethalPhones"; public const string FASTERITEMDROPSHIP_GUID = "FlipMods.FasterItemDropship"; public const string SHOWCAPACITY_GUID = "Piggy.ShowCapacity"; public const string REVIVECOMPANY_GUID = "OpJosMod.ReviveCompany"; public const string TOOMANYEMOTES_GUID = "FlipMods.TooManyEmotes"; public const string RESERVEDITEMSLOTCORE_GUID = "FlipMods.ReservedItemSlotCore"; public const string LETHALPROGRESSION_GUID = "Stoneman.LethalProgression"; public const string QUICKBUYMENU_GUID = "QuickBuyMenu"; public const string CUSTOMITEMBEHAVIOURLIBRARY_GUID = "com.github.WhiteSpike.CustomItemBehaviourLibrary"; public const string ADDITIONALNETWORKING_DLLFILENAME = "AdditionalNetworking_Preloader.dll"; public static readonly float EPSILON = 0.01f; public static readonly bool DISABLE_ORIGINAL_GAME_DEBUG_LOGS = true; public static readonly ulong INTERN_ACTUAL_ID_OFFSET = 100000uL; public static readonly string ConfigSectionMain = "1. Internship program"; public static readonly string ConfigSectionNames = "2. Intern names"; public static readonly string ConfigSectionBehaviour = "3. Behaviour"; public static readonly string ConfigSectionTeleporters = "4. Teleporters"; public static readonly string ConfigSectionDebug = "5. Debug"; public static readonly int DEFAULT_MAX_INTERNS_AVAILABLE = 16; public static readonly int MIN_INTERNS_AVAILABLE = 1; public static readonly int MAX_INTERNS_AVAILABLE = 32; public static readonly int DEFAULT_PRICE_INTERN = 19; public static readonly int MIN_PRICE_INTERN = 0; public static readonly int MAX_PRICE_INTERN = 200; public static readonly int DEFAULT_INTERN_MAX_HEALTH = 51; public static readonly int MIN_INTERN_MAX_HEALTH = 1; public static readonly int MAX_INTERN_MAX_HEALTH = 200; public static readonly float DEFAULT_SIZE_SCALE_INTERN = 0.85f; public static readonly float MIN_SIZE_SCALE_INTERN = 0.3f; public static readonly float MAX_SIZE_SCALE_INTERN = 1f; public static readonly string DEFAULT_STRING_INTERNSHIP_PROGRAM_TITLE = "INTERNSHIP PROGRAM"; public static readonly string DEFAULT_STRING_INTERNSHIP_PROGRAM_SUBTITLE = "Need some help ? Try our new workforce, ready to assist you and gain experience"; public static EnumOptionInternNames DEFAULT_CONFIG_ENUM_INTERN_NAMES = EnumOptionInternNames.DefaultCustomList; public static readonly string DEFAULT_INTERN_NAME = "Intern #{0}"; public static readonly string[] DEFAULT_LIST_CUSTOM_INTERN_NAMES = new string[22] { "Amy Stake", "Claire Annette", "Clare Voyant", "Ella Font", "Felix Cited", "Gerry Atrick", "Harry Legg", "Justin Case", "Lee King", "Luke Atmey", "Manuel Labour", "Mia Moore", "Ophelia Pane", "Paige Turner", "Paul Atishon", "Polly Esther", "Robyn Banks", "Terry Aki", "Tim Burr", "Toby Lerone", "Uriel Lucky", "Zoltan Pepper" }; public static EnumOptionInternSuitChange DEFAULT_CONFIG_ENUM_INTERN_SUIT_CHANGE = EnumOptionInternSuitChange.Manual; public static readonly float INTERN_FOV = 90f; public static readonly int INTERN_ENTITIES_RANGE = 40; public static readonly float INTERN_OBJECT_AWARNESS = 3f; public static readonly float INTERN_OBJECT_RANGE = 15f; public static readonly float WAIT_TIME_FOR_GRAB_DROPPED_OBJECTS = 10f; public static readonly float COLLISION_RANGE = 2.8f; public static readonly float CLIMB_SPEED = 8f; public static readonly int INIT_RAGDOLL_ID = -2; public static readonly float AGENT_SPEED = 3.5f; public static readonly float AGENT_SPEED_CROUCH = 1.75f; public static readonly float BASE_MAX_SPEED = 0.9f; public static readonly float BASE_MIN_SPEED = 0.01f; public static readonly float BODY_TURNSPEED = 6f; public static readonly float CAMERA_TURNSPEED = 8f; public static readonly float DISTANCE_CLOSE_ENOUGH_TO_DESTINATION = 1f; public static readonly float DISTANCE_CHECK_FOR_HOLES = 2.5f; public static readonly float DISTANCE_ITEMS_TO_ENTRANCE = 6f; public static readonly int COMPANY_BUILDING_MOON_ID = 3; public static readonly float SHIP_EXPANDING_BOUNDS_DIFFERENCE = 10f; public static readonly bool DRAW_LINES = false; public static readonly bool SHOW_LOG_DEBUG_ONTRANSFORMPARENTCHANGED = false; public static readonly bool SPAWN_INTERN_WITH_EMOTE = false; public static readonly bool INVULNERABILITY = false; public static readonly bool INVINCIBILITY = false; public static readonly bool SPAWN_BUSH_WOLVES_FOR_DEBUG = false; public static readonly bool SPAWN_MINESHAFT_FOR_DEBUG = false; public static readonly bool TEST_MORE_THAN_X_PLAYER_BYPASS = false; public static readonly int PLAYER_MASK = 8; public static readonly string PLAYER_ANIMATION_WEIGHT_HOLDINGITEMSRIGHTHAND = "HoldingItemsRightHand"; public static readonly string PLAYER_ANIMATION_WEIGHT_HOLDINGITEMSBOTHHANDS = "HoldingItemsBothHands"; public static readonly string PLAYER_ANIMATION_WEIGHT_SPECIALANIMATIONS = "SpecialAnimations"; public static readonly string PLAYER_ANIMATION_WEIGHT_EMOTESNOARMS = "EmotesNoArms"; public static readonly string PLAYER_ANIMATION_BOOL_GRAB = "Grab"; public static readonly string PLAYER_ANIMATION_BOOL_GRABVALIDATED = "GrabValidated"; public static readonly string PLAYER_ANIMATION_BOOL_GRABINVALIDATED = "GrabInvalidated"; public static readonly string PLAYER_ANIMATION_BOOL_CANCELHOLDING = "cancelHolding"; public static readonly string PLAYER_ANIMATION_BOOL_WALKING = "Walking"; public static readonly string PLAYER_ANIMATION_BOOL_SPRINTING = "Sprinting"; public static readonly string PLAYER_ANIMATION_BOOL_SIDEWAYS = "Sideways"; public static readonly string PLAYER_ANIMATION_BOOL_ANIMATIONSPEED = "animationSpeed"; public static readonly string PLAYER_ANIMATION_BOOL_HINDEREDMOVEMENT = "hinderedMovement"; public static readonly string PLAYER_ANIMATION_BOOL_CROUCHING = "crouching"; public static readonly string PLAYER_ANIMATION_BOOL_FALLNOJUMP = "FallNoJump"; public static readonly string PLAYER_ANIMATION_BOOL_SHORTFALLLANDING = "ShortFallLanding"; public static readonly string PLAYER_ANIMATION_BOOL_LIMP = "Limp"; public static readonly string PLAYER_ANIMATION_TRIGGER_THROW = "Throw"; public static readonly string PLAYER_ANIMATION_TRIGGER_DAMAGE = "Damage"; public static readonly string PLAYER_ANIMATION_TRIGGER_SHORTFALLLANDING = "ShortFallLanding"; public static readonly string PLAYER_ANIMATION_FLOAT_ANIMATIONSPEED = "animationSpeed"; public static readonly string PLAYER_ANIMATION_FLOAT_TIREDAMOUNT = "tiredAmount"; public static readonly string MAPDOT_ANIMATION_BOOL_DEAD = "dead"; public static readonly float MIN_TIME_SPRINT_SEARCH_WANDER = 1f; public static readonly float MAX_TIME_SPRINT_SEARCH_WANDER = 3f; public static readonly float DISTANCE_START_RUNNING = 8f; public static readonly float DISTANCE_STOP_RUNNING = 7f; public static readonly float DISTANCE_CLOSE_ENOUGH_HOR = 5f; public static readonly float DISTANCE_CLOSE_ENOUGH_VER = 2f; public static readonly float DISTANCE_AWARENESS_HOR = 25f; public static readonly float DISTANCE_AWARENESS_VER = 50f; public static readonly float TIMER_LOOKING_AROUND = 6f; public static readonly float DISTANCE_STOP_SPRINT_LAST_KNOWN_POSITION = 2f; public static readonly float WAIT_TIME_TO_TELEPORT = 1f; public static readonly float DISTANCE_TO_ENTRANCE = 4f; public static readonly float MIN_TIME_FREEZE_LOOKING_AROUND = 0.5f; public static readonly float MAX_TIME_FREEZE_LOOKING_AROUND = 2f; public static readonly float TIMER_STUCK_TOO_MUCH = 2f; public static readonly float DISTANCE_TO_SHIP_BOUND_CLOSEST_POINT = 1f; public static readonly float DISTANCE_OF_DROPPED_OBJECT_SHIP_BOUND_CLOSEST_POINT = 2f; public static readonly Vector3 POS1_ENTRY_INTERN_CRUISER = new Vector3(-0.5f, -1f, -5.5f); public static readonly Vector3 POS2_ENTRY_INTERN_CRUISER = new Vector3(0.9f, -1f, -5.5f); public static readonly Vector3 FIRST_CORNER_INTERN_IN_CRUISER = new Vector3(-0.5f, -0.5f, -0.4f); public static readonly Vector3 SECOND_CORNER_INTERN_IN_CRUISER = new Vector3(0.9f, -0.5f, -2.5f); public static readonly float DISTANCE_FLEEING = 20f; public static readonly float DISTANCE_FLEEING_NO_LOS = 5f; public static readonly float DISTANCE_NPCBODY_FROM_LADDER = 2f; public static readonly float DISTANCE_NPCBODY_FROM_DOOR = 2.5f; public static readonly float TIMER_CHECK_DOOR = 0.9f; public static readonly string TOOLTIP_DROP_ITEM = "Drop your item : [{0}]"; public static readonly string TOOLTIP_TAKE_ITEM = "Take my item : [{0}]"; public static readonly string TOOLTIP_FOLLOW_ME = "Follow me: [{0}]"; public static readonly string TOOLTIP_GRAB_INTERNS = "Grab intern: [{0}]"; public static readonly string TOOLTIP_RELEASE_INTERNS = "Release grabbed interns : [{0}]"; public static readonly string TOOLTIP_CHANGE_SUIT_INTERNS = "Change suit : [{0}]"; public static readonly string TOOLTIP_MAKE_INTERN_LOOK = "Make interns look : [{0}]"; public static readonly string TOOLTIPS_ORDER_1 = "order 1 : [{0}]"; public static readonly int INDEX_HELP_TERMINALNODE = 13; public static readonly string STRING_OTHER_HELP = ">OTHER"; public static readonly int INDEX_AUDIO_BOUGHT_ITEM = 0; public static readonly int INDEX_AUDIO_ERROR = 1; public static readonly string STRING_BUY_COMMAND = "buy"; public static readonly string STRING_LAND_COMMAND = "land"; public static readonly string STRING_ABORT_COMMAND = "abort"; public static readonly string STRING_CONFIRM_COMMAND = "confirm"; public static readonly string STRING_CANCEL_COMMAND = "deny"; public static readonly string STRING_BACK_COMMAND = "back"; public static readonly string STRING_LANDING_STATUS_ALLOWED = "+ Allowed +"; public static readonly string STRING_LANDING_STATUS_ABORTED = "--Aborted--"; public static readonly string STRING_LANDING_STATUS_ABORTED_COMPANY_MOON = " (aborted on company building moon)"; public static readonly string STRING_INTERNSHIP_PROGRAM_HELP = ">{0}\n{1}\n\n"; public static readonly string TEXT_INFO_PAGE_IN_SPACE = "Remaining interns : {0}\r\nUnit price : ${1}\r\n\r\n----------------------------------------\r\n--> Interns scheduled on next moon : {2}\r\n----------------------------------------\r\n\r\nInterns landing status : {3}\r\n\r\n\r\nCommands :\r\n- Type 'Land' or 'Abort' to allow interns to drop on moons\r\n- Type 'buy' to order new intern, 'buy 2' to order 2 interns, etc"; public static readonly string TEXT_INFO_PAGE_INTERN_TO_DROPSHIP = "Interns waiting to land : {0}"; public static readonly string TEXT_INFO_PAGE_ON_MOON = "Remaining interns : {0}\r\nUnit price : ${1}\r\n\r\n{2}\r\n------------------------------\r\n--> Interns on this moon : {3}\r\n------------------------------\r\n\r\nInterns landing status : {4}\r\n\r\n\r\nCommands :\r\n - Type 'Land' or 'Abort' to allow interns to drop on moons\r\n - Type 'buy' to order new intern, 'buy 2' to order 2 interns, etc"; public static readonly string TEXT_CONFIRM_CANCEL_PURCHASE_MAXIMUM = "(max)"; public static readonly string TEXT_CONFIRM_CANCEL_PURCHASE = "You have requested to order interns. Amount {0}{1}\r\n\r\nTotal cost of items: ${2}\r\n\r\n\r\nPlease CONFIRM or DENY."; public static readonly string TEXT_ERROR_DEFAULT = "An error occured in the internship program"; public static readonly string TEXT_ERROR_NOT_ENOUGH_CREDITS = "You do not have enough credits to order an intern"; public static readonly string TEXT_NO_MORE_INTERNS_PURCHASABLE = "No more interns available"; public static readonly string TEXT_ERROR_SHIP_LEAVING = "You can not buy when the ship is leaving the moon"; } [BepInPlugin("Szumi57.LethalInternship", "LethalInternship", "0.18.3")] [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.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string ModGUID = "Szumi57.LethalInternship"; public static AssetBundle ModAssets; internal static EnemyType InternNPCPrefab; internal static int PluginIrlPlayersCount; internal static Config Config; internal static LethalInternshipInputs InputActionsInstance; internal static bool IsModReviveCompanyLoaded; internal static bool IsModTooManyEmotesLoaded; internal static bool IsModModelReplacementAPILoaded; internal static bool IsModCustomItemBehaviourLibraryLoaded; internal static bool IsModMoreCompanyLoaded; private static ManualLogSource Logger; private readonly Harmony _harmony = new Harmony("Szumi57.LethalInternship"); private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Config = new Config(((BaseUnityPlugin)this).Config); InputActionsInstance = new LethalInternshipInputs(); InitializeNetworkBehaviours(); string text = "internnpcmodassets"; ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), text)); if ((Object)(object)ModAssets == (Object)null) { Logger.LogError((object)"Failed to load custom assets."); return; } InternNPCPrefab = ModAssets.LoadAsset<EnemyType>("InternNPC"); if ((Object)(object)InternNPCPrefab == (Object)null) { Logger.LogError((object)"InternNPC prefab."); return; } foreach (Transform item in (from x in InternNPCPrefab.enemyPrefab.GetComponentsInChildren<Transform>() where (Object)(object)x.parent != (Object)null && ((Object)x.parent).name == "InternNPCObj" && ((Object)x).name != "TurnCompass" && ((Object)x).name != "CreatureSFX" && ((Object)x).name != "CreatureVoice" select x).ToList()) { Object.DestroyImmediate((Object)(object)((Component)item).gameObject); } byte[] value = MD5.Create().ComputeHash(Encoding.UTF8.GetBytes(Assembly.GetCallingAssembly().GetName().Name + ((Object)((Component)this).gameObject).name + text)); uint num = BitConverter.ToUInt32(value, 0); Type typeFromHandle = typeof(NetworkObject); FieldInfo field = typeFromHandle.GetField("GlobalObjectIdHash", BindingFlags.Instance | BindingFlags.NonPublic); NetworkObject component = InternNPCPrefab.enemyPrefab.GetComponent<NetworkObject>(); field.SetValue(component, num); NetworkPrefabs.RegisterNetworkPrefab(InternNPCPrefab.enemyPrefab); InitPluginManager(); PatchBaseGame(); PatchOtherMods(); Logger.LogInfo((object)"Plugin LethalInternship is loaded!"); } private void PatchBaseGame() { _harmony.PatchAll(typeof(DebugPatch)); _harmony.PatchAll(typeof(GameNetworkManagerPatch)); _harmony.PatchAll(typeof(HUDManagerPatch)); _harmony.PatchAll(typeof(NetworkSceneManagerPatch)); _harmony.PatchAll(typeof(NetworkObjectPatch)); _harmony.PatchAll(typeof(RoundManagerPatch)); _harmony.PatchAll(typeof(SoundManagerPatch)); _harmony.PatchAll(typeof(StartOfRoundPatch)); _harmony.PatchAll(typeof(EnemyAIPatch)); _harmony.PatchAll(typeof(PlayerControllerBPatch)); _harmony.PatchAll(typeof(BaboonBirdAIPatch)); _harmony.PatchAll(typeof(BlobAIPatch)); _harmony.PatchAll(typeof(BushWolfEnemyPatch)); _harmony.PatchAll(typeof(ButlerBeesEnemyAIPatch)); _harmony.PatchAll(typeof(ButlerEnemyAIPatch)); _harmony.PatchAll(typeof(CaveDwellerAIPatch)); _harmony.PatchAll(typeof(CentipedeAIPatch)); _harmony.PatchAll(typeof(CrawlerAIPatch)); _harmony.PatchAll(typeof(FlowermanAIPatch)); _harmony.PatchAll(typeof(FlowerSnakeEnemyPatch)); _harmony.PatchAll(typeof(ForestGiantAIPatch)); _harmony.PatchAll(typeof(JesterAIPatch)); _harmony.PatchAll(typeof(MaskedPlayerEnemyPatch)); _harmony.PatchAll(typeof(MouthDogAIPatch)); _harmony.PatchAll(typeof(RadMechMissilePatch)); _harmony.PatchAll(typeof(RedLocustBeesPatch)); _harmony.PatchAll(typeof(SandSpiderAIPatch)); _harmony.PatchAll(typeof(SandWormAIPatch)); _harmony.PatchAll(typeof(SpringManAIPatch)); _harmony.PatchAll(typeof(LandminePatch)); _harmony.PatchAll(typeof(QuicksandTriggerPatch)); _harmony.PatchAll(typeof(SpikeRoofTrapPatch)); _harmony.PatchAll(typeof(TurretPatch)); _harmony.PatchAll(typeof(DoorLockPatch)); _harmony.PatchAll(typeof(InteractTriggerPatch)); _harmony.PatchAll(typeof(ItemDropShipPatch)); _harmony.PatchAll(typeof(ManualCameraRendererPatch)); _harmony.PatchAll(typeof(ShipTeleporterPatch)); _harmony.PatchAll(typeof(VehicleControllerPatch)); _harmony.PatchAll(typeof(DeadBodyInfoPatch)); _harmony.PatchAll(typeof(GrabbableObjectPatch)); _harmony.PatchAll(typeof(RagdollGrabbableObjectPatch)); _harmony.PatchAll(typeof(ShotgunItemPatch)); _harmony.PatchAll(typeof(StunGrenadeItemPatch)); _harmony.PatchAll(typeof(TerminalPatch)); } private void PatchOtherMods() { //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Expected O, but got Unknown //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Expected O, but got Unknown //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Expected O, but got Unknown //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Expected O, but got Unknown //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Expected O, but got Unknown //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Expected O, but got Unknown //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Expected O, but got Unknown //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Expected O, but got Unknown //IL_0440: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Expected O, but got Unknown //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_0490: Expected O, but got Unknown //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Expected O, but got Unknown //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Expected O, but got Unknown //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Expected O, but got Unknown //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_057c: Expected O, but got Unknown //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: Expected O, but got Unknown IsModReviveCompanyLoaded = IsModLoaded("OpJosMod.ReviveCompany"); IsModTooManyEmotesLoaded = IsModLoaded("FlipMods.TooManyEmotes"); IsModModelReplacementAPILoaded = IsModLoaded("meow.ModelReplacementAPI"); IsModCustomItemBehaviourLibraryLoaded = IsModLoaded("com.github.WhiteSpike.CustomItemBehaviourLibrary"); IsModMoreCompanyLoaded = IsModLoaded("me.swipez.melonloader.morecompany"); bool flag = IsModLoaded("MoreEmotes"); bool flag2 = IsModLoaded("BetterEmotes"); bool flag3 = IsModLoaded("LethalPhones"); bool flag4 = IsModLoaded("FlipMods.FasterItemDropship"); bool flag5 = IsModLoaded("Piggy.ShowCapacity"); bool flag6 = IsModLoaded("FlipMods.ReservedItemSlotCore"); bool flag7 = IsModLoaded("Stoneman.LethalProgression"); bool flag8 = IsModLoaded("QuickBuyMenu"); List<string> list = new List<string>(); string[] files = Directory.GetFiles(Path.GetFullPath(Paths.PatcherPluginPath), "*.dll", SearchOption.AllDirectories); foreach (string path in files) { list.Add(Path.GetFileName(path)); } bool flag9 = IsPreLoaderLoaded("AdditionalNetworking_Preloader.dll", list); if (flag) { _harmony.PatchAll(typeof(MoreEmotesPatch)); } if (flag2) { _harmony.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("BetterEmote.Patches.EmotePatch"), "StartPostfix", (Type[])null, (Type[])null), new HarmonyMethod(typeof(BetterEmotesPatch), "StartPostfix_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _harmony.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("BetterEmote.Patches.EmotePatch"), "UpdatePrefix", (Type[])null, (Type[])null), new HarmonyMethod(typeof(BetterEmotesPatch), "UpdatePrefix_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _harmony.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("BetterEmote.Patches.EmotePatch"), "UpdatePostfix", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(BetterEmotesPatch), "UpdatePostfix_Transpiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null); _harmony.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("BetterEmote.Patches.EmotePatch"), "PerformEmotePrefix", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(BetterEmotesPatch), "PerformEmotePrefix_Transpiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null); } if (IsModTooManyEmotesLoaded) { _harmony.PatchAll(typeof(EmoteControllerPlayerPatch)); _harmony.PatchAll(typeof(ThirdPersonEmoteControllerPatch)); } if (IsModMoreCompanyLoaded) { _harmony.PatchAll(typeof(LookForPlayersForestGiantPatchPatch)); } if (IsModModelReplacementAPILoaded) { _harmony.PatchAll(typeof(BodyReplacementBasePatch)); _harmony.PatchAll(typeof(ModelReplacementPlayerControllerBPatchPatch)); _harmony.PatchAll(typeof(ModelReplacementAPIPatch)); } if (flag3) { _harmony.PatchAll(typeof(PlayerPhonePatchPatch)); _harmony.PatchAll(typeof(PhoneBehaviorPatch)); _harmony.PatchAll(typeof(PlayerPhonePatchLI)); } if (flag4) { _harmony.PatchAll(typeof(FasterItemDropshipPatch)); } if (flag9) { _harmony.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("AdditionalNetworking.Patches.Inventory.PlayerControllerBPatch"), "OnStart", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(AdditionalNetworkingPatch), "Start_Transpiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null); } if (flag5) { _harmony.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("ShowCapacity.Patches.PlayerControllerBPatch"), "Update_PreFix", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ShowCapacityPatch), "Update_PreFix_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } if (IsModReviveCompanyLoaded) { _harmony.PatchAll(typeof(ReviveCompanyGeneralUtilPatch)); _harmony.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("OPJosMod.ReviveCompany.Patches.PlayerControllerBPatch"), "setHoverTipAndCurrentInteractTriggerPatch", (Type[])null, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(ReviveCompanyPlayerControllerBPatchPatch), "SetHoverTipAndCurrentInteractTriggerPatch_Transpiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null); } if (flag6) { _harmony.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("ReservedItemSlotCore.Patches.PlayerPatcher"), "InitializePlayerControllerLate", (Type[])null, (Type[])null), new HarmonyMethod(typeof(PlayerPatcherPatch), "InitializePlayerControllerLate_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _harmony.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("ReservedItemSlotCore.Patches.PlayerPatcher"), "CheckForChangedInventorySize", (Type[])null, (Type[])null), new HarmonyMethod(typeof(PlayerPatcherPatch), "CheckForChangedInventorySize_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } if (flag7) { _harmony.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("LethalProgression.Skills.HPRegen"), "HPRegenUpdate", (Type[])null, (Type[])null), new HarmonyMethod(typeof(HPRegenPatch), "HPRegenUpdate_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _harmony.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("LethalProgression.Skills.Oxygen"), "EnteredWater", (Type[])null, (Type[])null), new HarmonyMethod(typeof(OxygenPatch), "EnteredWater_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _harmony.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("LethalProgression.Skills.Oxygen"), "LeftWater", (Type[])null, (Type[])null), new HarmonyMethod(typeof(OxygenPatch), "LeftWater_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _harmony.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("LethalProgression.Skills.Oxygen"), "ShouldDrown", (Type[])null, (Type[])null), new HarmonyMethod(typeof(OxygenPatch), "ShouldDrown_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); _harmony.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("LethalProgression.Skills.Oxygen"), "OxygenUpdate", (Type[])null, (Type[])null), new HarmonyMethod(typeof(OxygenPatch), "OxygenUpdate_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } if (flag8) { _harmony.Patch((MethodBase)AccessTools.Method(AccessTools.TypeByName("QuickBuyMenu.Plugin"), "RunQuickBuy", (Type[])null, (Type[])null), new HarmonyMethod(typeof(QuickBuyMenuPatch), "RunQuickBuy_Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private bool IsModLoaded(string modGUID) { bool flag = Chainloader.PluginInfos.ContainsKey(modGUID); if (flag) { LogInfo("Mod compatibility loaded for mod : GUID " + modGUID); } return flag; } private bool IsPreLoaderLoaded(string dllFileName, List<string> fileNames) { bool flag = fileNames.Contains(dllFileName); if (flag) { LogInfo("Mod compatibility loaded for preloader : " + dllFileName); } return flag; } private static void InitializeNetworkBehaviours() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { try { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } catch { } } } } private static void InitPluginManager() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown GameObject val = new GameObject("PluginManager"); val.AddComponent<PluginManager>(); PluginManager.Instance.InitManagers(); } internal static void LogDebug(string debugLog) { if (Config.EnableDebugLog.Value) { Logger.LogDebug((object)debugLog); } } internal static void LogInfo(string infoLog) { Logger.LogInfo((object)infoLog); } internal static void LogWarning(string warningLog) { Logger.LogWarning((object)warningLog); } internal static void LogError(string errorLog) { Logger.LogError((object)errorLog); } } public static class PluginInfo { public const string PLUGIN_GUID = "LethalInternship"; public const string PLUGIN_NAME = "LethalInternship"; public const string PLUGIN_VERSION = "0.18.3"; } } namespace LethalInternship.Utils { internal static class ComponentUtil { public static void ListAllComponents(GameObject gameObject) { if ((Object)(object)gameObject == (Object)null) { return; } Plugin.LogDebug(" "); Plugin.LogDebug(" List of components :"); Component[] componentsInChildren = gameObject.GetComponentsInChildren(typeof(Component)); Component[] array = componentsInChildren; foreach (Component val in array) { if (!((Object)(object)val == (Object)null)) { Plugin.LogDebug(((object)val).ToString()); } } } public static void SetFieldValue(object obj, string fieldName, object value) { Type type = obj.GetType(); FieldInfo field = type.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); field.SetValue(obj, value); } public static void SetPropertyValue(object obj, string propertyName, object value) { Type type = obj.GetType(); PropertyInfo property = type.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); property.SetValue(obj, value); } public static T GetCopyOf<T>(this Component comp, T other) where T : Component { Type type = ((object)comp).GetType(); if (type != ((object)other).GetType()) { return default(T); } BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; PropertyInfo[] properties = type.GetProperties(bindingAttr); PropertyInfo[] array = properties; foreach (PropertyInfo propertyInfo in array) { if (propertyInfo.CanWrite && propertyInfo.CanRead && !(propertyInfo.Name == "name")) { try { propertyInfo.SetValue(comp, propertyInfo.GetValue(other, null), null); } catch { } } } FieldInfo[] allFields = PropertiesAndFieldsUtils.GetAllFields(type); FieldInfo[] array2 = allFields; foreach (FieldInfo fieldInfo in array2) { if (!fieldInfo.IsStatic) { fieldInfo.SetValue(comp, fieldInfo.GetValue(other)); } } return (T)(object)((comp is T) ? comp : null); } public static T AddCopyOfComponent<T>(this GameObject go, T toAdd) where T : Component { return ((Component)(object)go.AddComponent<T>()).GetCopyOf(toAdd); } public static T CopyComponent<T>(T original, GameObject destination) where T : Component { Type type = ((object)original).GetType(); Component component = destination.GetComponent(type); T val = (T)(object)((component is T) ? component : null); if (!Object.op_Implicit((Object)(object)val)) { Component obj = destination.AddComponent(type); val = (T)(object)((obj is T) ? obj : null); } FieldInfo[] allFields = PropertiesAndFieldsUtils.GetAllFields(type); FieldInfo[] array = allFields; foreach (FieldInfo fieldInfo in array) { if (!fieldInfo.IsStatic) { fieldInfo.SetValue(val, fieldInfo.GetValue(original)); } } PropertyInfo[] properties = type.GetProperties(); PropertyInfo[] array2 = properties; foreach (PropertyInfo propertyInfo in array2) { if (propertyInfo.CanWrite && propertyInfo.CanWrite && !(propertyInfo.Name == "name")) { propertyInfo.SetValue(val, propertyInfo.GetValue(original, null), null); } } return val; } } internal static class DrawUtil { public static void DrawWhiteLine(LineRenderer? lr, Ray ray, float length) { //IL_0001: 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) DrawLine(lr, ray, length, Color.white); } public static void DrawLine(LineRenderer? lr, Ray ray, float length, Color color) { //IL_0003: 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_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_0019: 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_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) Vector3 origin = ((Ray)(ref ray)).origin; Vector3 origin2 = ((Ray)(ref ray)).origin; Vector3 direction = ((Ray)(ref ray)).direction; DrawLine(lr, origin, origin2 + ((Vector3)(ref direction)).normalized * length, color); } public static void DrawLine(LineRenderer? lr, Vector3 start, Vector3 end, Color color) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0020: 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_0045: 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 (!((Object)(object)lr == (Object)null)) { ((Renderer)lr).material = new Material(Shader.Find("Legacy Shaders/Particles/Alpha Blended Premultiply")); lr.startColor = color; lr.endColor = color; lr.startWidth = 0.1f; lr.endWidth = 0.1f; lr.SetPosition(0, start); lr.SetPosition(1, end); } } } internal class LineRendererUtil { private LineRenderer[] _listLineRenderers; private Transform _transformToParent; private int _index; public LineRendererUtil(int nbMaxLineRenderer, Transform transformToParent) { _listLineRenderers = (LineRenderer[])(object)new LineRenderer[nbMaxLineRenderer]; _transformToParent = transformToParent; } public LineRenderer? GetLineRenderer() { if (!Const.DRAW_LINES) { return null; } for (int i = 0; i < _listLineRenderers.Length; i++) { if ((Object)(object)_listLineRenderers[i] == (Object)null) { _listLineRenderers[i] = CreateLineRenderer(); return _listLineRenderers[i]; } } if (_index >= _listLineRenderers.Length) { _index = 0; } return _listLineRenderers[_index++]; } private LineRenderer CreateLineRenderer() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) LineRenderer lineRenderer = new GameObject().AddComponent<LineRenderer>(); return InitLineRenderer(ref lineRenderer); } private LineRenderer InitLineRenderer(ref LineRenderer lineRenderer) { //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) ((Component)lineRenderer).gameObject.transform.SetParent(((Component)_transformToParent).transform, false); ((Component)lineRenderer).gameObject.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity); return lineRenderer; } } internal static class PatchesUtil { public static readonly FieldInfo FieldInfoWasUnderwaterLastFrame = AccessTools.Field(typeof(PlayerControllerB), "wasUnderwaterLastFrame"); public static readonly FieldInfo FieldInfoPlayerClientId = AccessTools.Field(typeof(PlayerControllerB), "playerClientId"); public static readonly FieldInfo FieldInfoPreviousAnimationStateHash = AccessTools.Field(typeof(PlayerControllerB), "previousAnimationStateHash"); public static readonly FieldInfo FieldInfoCurrentAnimationStateHash = AccessTools.Field(typeof(PlayerControllerB), "currentAnimationStateHash"); public static readonly FieldInfo FieldInfoTargetPlayer = AccessTools.Field(typeof(BushWolfEnemy), "targetPlayer"); public static readonly FieldInfo FieldInfoDraggingPlayer = AccessTools.Field(typeof(BushWolfEnemy), "draggingPlayer"); public static readonly MethodInfo AllEntitiesCountMethod = SymbolExtensions.GetMethodInfo((Expression<Action>)(() => AllEntitiesCount())); public static readonly MethodInfo AreInternsScheduledToLandMethod = SymbolExtensions.GetMethodInfo((Expression<Action>)(() => AreInternsScheduledToLand())); public static readonly MethodInfo IsPlayerLocalOrInternOwnerLocalMethod = SymbolExtensions.GetMethodInfo(Expression.Lambda<Action>(Expression.Call(null, (MethodInfo)MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), Expression.New(typeof(PlayerControllerB))), Array.Empty<ParameterExpression>())); public static readonly MethodInfo IsColliderFromLocalOrInternOwnerLocalMethod = SymbolExtensions.GetMethodInfo(Expression.Lambda<Action>(Expression.Call(null, (MethodInfo)MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), Expression.New(typeof(Collider))), Array.Empty<ParameterExpression>())); public static readonly MethodInfo IndexBeginOfInternsMethod = SymbolExtensions.GetMethodInfo((Expression<Action>)(() => IndexBeginOfInterns())); public static readonly MethodInfo IsPlayerInternMethod = SymbolExtensions.GetMethodInfo(Expression.Lambda<Action>(Expression.Call(null, (MethodInfo)MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), Expression.New(typeof(PlayerControllerB))), Array.Empty<ParameterExpression>())); public static readonly MethodInfo IsIdPlayerInternMethod = SymbolExtensions.GetMethodInfo((Expression<Action>)(() => IsIdPlayerIntern(0))); public static readonly MethodInfo IsPlayerInternOwnerLocalMethod = SymbolExtensions.GetMethodInfo(Expression.Lambda<Action>(Expression.Call(null, (MethodInfo)MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), Expression.New(typeof(PlayerControllerB))), Array.Empty<ParameterExpression>())); public static readonly MethodInfo IsAnInternAiOwnerOfObjectMethod = SymbolExtensions.GetMethodInfo((Expression<Action>)(() => IsAnInternAiOwnerOfObject((GrabbableObject)new object()))); public static readonly MethodInfo DisableOriginalGameDebugLogsMethod = SymbolExtensions.GetMethodInfo((Expression<Action>)(() => DisableOriginalGameDebugLogs())); public static readonly MethodInfo IsPlayerInternControlledAndOwnerMethod = SymbolExtensions.GetMethodInfo(Expression.Lambda<Action>(Expression.Call(null, (MethodInfo)MethodBase.GetMethodFromHandle((RuntimeMethodHandle)/*OpCode not supported: LdMemberToken*/), Expression.New(typeof(PlayerControllerB))), Array.Empty<ParameterExpression>())); public static readonly MethodInfo UpdatePlayerAnimationServerRpcMethod = SymbolExtensions.GetMethodInfo((Expression<Action>)(() => UpdatePlayerAnimationServerRpc(0uL, 0, 0f))); public static readonly MethodInfo SyncJumpMethod = SymbolExtensions.GetMethodInfo((Expression<Action>)(() => SyncJump(0uL))); public static readonly MethodInfo SyncLandFromJumpMethod = SymbolExtensions.GetMethodInfo((Expression<Action>)(() => SyncLandFromJump(0uL, fallHard: false))); public static List<CodeInstruction> InsertIsPlayerInternInstructions(List<CodeInstruction> codes, ILGenerator generator, int startIndex, int indexToJumpTo) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown List<Label> labels = codes[startIndex].labels; List<Label> labels2 = codes[startIndex + indexToJumpTo].labels; Label label = generator.DefineLabel(); labels2.Add(label); if (labels.Count > 0) { codes.Insert(startIndex + 1, new CodeInstruction(codes[startIndex].opcode, codes[startIndex].operand)); codes[startIndex].opcode = OpCodes.Nop; codes[startIndex].operand = null; startIndex++; } List<CodeInstruction> collection = new List<CodeInstruction> { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)IsPlayerInternMethod), new CodeInstruction(OpCodes.Brtrue_S, (object)label) }; codes.InsertRange(startIndex, collection); return codes; } public static List<CodeInstruction> InsertLogOfFieldOfThis(string logWithZeroParameter, FieldInfo fieldInfo, Type fieldType) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); list.Add(new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(Plugin), "Logger"))); list.Add(new CodeInstruction(OpCodes.Ldstr, (object)logWithZeroParameter)); list.Add(new CodeInstruction(OpCodes.Ldarg_0, (object)null)); list.Add(new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo)); list.Add(new CodeInstruction(OpCodes.Box, (object)fieldType)); list.Add(new CodeInstruction(OpCodes.Call, (object)SymbolExtensions.GetMethodInfo((Expression<Action>)(() => string.Format(new string(new char[0]), new object()))))); list.Add(new CodeInstruction(OpCodes.Callvirt, (object)SymbolExtensions.GetMethodInfo((Expression<Action>)(() => Plugin.LogDebug(new string(new char[0])))))); return list; } public static List<CodeInstruction> InsertLogWithoutParameters(string log) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(); list.Add(new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(Plugin), "Logger"))); list.Add(new CodeInstruction(OpCodes.Ldstr, (object)log)); list.Add(new CodeInstruction(OpCodes.Callvirt, (object)SymbolExtensions.GetMethodInfo((Expression<Action>)(() => Plugin.LogDebug(new string(new char[0])))))); return list; } public static List<CodeInstruction> InsertIsBypass(List<CodeInstruction> codes, ILGenerator generator, int startIndex, int indexToJumpTo) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown List<Label> labels = codes[startIndex].labels; List<Label> labels2 = codes[startIndex + indexToJumpTo].labels; Label label = generator.DefineLabel(); labels2.Add(label); if (labels.Count > 0) { codes.Insert(startIndex + 1, new CodeInstruction(codes[startIndex].opcode, codes[startIndex].operand)); codes[startIndex].opcode = OpCodes.Nop; codes[startIndex].operand = null; startIndex++; } List<CodeInstruction> collection = new List<CodeInstruction> { new CodeInstruction(OpCodes.Call, (object)DisableOriginalGameDebugLogsMethod), new CodeInstruction(OpCodes.Brtrue_S, (object)label) }; codes.InsertRange(startIndex, collection); return codes; } public static bool IsGrabbableObjectEqualsToNull(GrabbableObject grabbableObject) { return (Object)(object)grabbableObject == (Object)null; } private static bool DisableOriginalGameDebugLogs() { return Const.DISABLE_ORIGINAL_GAME_DEBUG_LOGS; } private static bool AreInternsScheduledToLand() { return InternManager.Instance.AreInternsScheduledToLand(); } private static bool IsPlayerLocalOrInternOwnerLocal(PlayerControllerB player) { return InternManager.Instance.IsPlayerLocalOrInternOwnerLocal(player); } private static int IndexBeginOfInterns() { return InternManager.Instance.IndexBeginOfInterns; } private static int AllEntitiesCount() { return InternManager.Instance.AllEntitiesCount; } private static bool IsColliderFromLocalOrInternOwnerLocal(Collider collider) { return InternManager.Instance.IsColliderFromLocalOrInternOwnerLocal(collider); } private static bool IsPlayerIntern(PlayerControllerB player) { return InternManager.Instance.IsPlayerIntern(player); } private static bool IsIdPlayerIntern(int id) { return InternManager.Instance.IsIdPlayerIntern(id); } private static bool IsPlayerInternOwnerLocal(PlayerControllerB player) { return InternManager.Instance.IsPlayerInternOwnerLocal(player); } private static bool IsPlayerInternControlledAndOwner(PlayerControllerB player) { return InternManager.Instance.IsPlayerInternControlledAndOwner(player); } private static bool IsAnInternAiOwnerOfObject(GrabbableObject grabbableObject) { return InternManager.Instance.IsAnInternAiOwnerOfObject(grabbableObject); } private static void UpdatePlayerAnimationServerRpc(ulong playerClientId, int animationState, float animationSpeed) { InternManager.Instance.GetInternAI((int)playerClientId)?.UpdateInternAnimationServerRpc(animationState, animationSpeed); } private static void SyncJump(ulong playerClientId) { InternManager.Instance.GetInternAI((int)playerClientId)?.SyncJump(); } private static void SyncLandFromJump(ulong playerClientId, bool fallHard) { InternManager.Instance.GetInternAI((int)playerClientId)?.SyncLandFromJump(fallHard); } } internal static class PropertiesAndFieldsUtils { public static void ListNamesOfObjectsArray<T>(T[] array) { Type typeFromHandle = typeof(T); Plugin.LogDebug(" "); if (array == null) { Plugin.LogDebug($"Array of type {typeFromHandle} is null"); return; } if (array.Length == 0) { Plugin.LogDebug($"Array of type {typeFromHandle} is empty"); return; } PropertyInfo[] readablePropertiesOf = GetReadablePropertiesOf(typeFromHandle); Plugin.LogDebug($"- List of type : {typeFromHandle}"); for (int i = 0; i < array.Length; i++) { T val = array[i]; if (val != null) { Plugin.LogDebug($" Object {i}: \"{NameOfObject(val, readablePropertiesOf)}\""); } } } public static void ListPropertiesAndFieldsOfArray<T>(T[] array, bool hasToListProperties = true, bool hasToListFields = true) { Type typeFromHandle = typeof(T); if (array == null) { Plugin.LogDebug($"Array of type {typeFromHandle} is null"); return; } if (array.Length == 0) { Plugin.LogDebug($"Array of type {typeFromHandle} is empty"); return; } PropertyInfo[] readablePropertiesOf = GetReadablePropertiesOf(typeFromHandle); FieldInfo[] allFields = GetAllFields(typeFromHandle); for (int i = 0; i < array.Length; i++) { if (hasToListProperties) { LogProperties(array[i], typeFromHandle, readablePropertiesOf); } Plugin.LogDebug(" "); Plugin.LogDebug($"- Fields of \"{NameOfObject(array[i], readablePropertiesOf)}\" of type \"{typeFromHandle}\" :"); if (hasToListFields) { LogFields(array[i], typeFromHandle, allFields); } } } public static void ListPropertiesAndFields<T>(T obj, bool hasToListProperties = true, bool hasToListFields = true) { Type typeFromHandle = typeof(T); PropertyInfo[] readablePropertiesOf = GetReadablePropertiesOf(typeFromHandle); if (hasToListProperties) { LogProperties(obj, typeFromHandle, readablePropertiesOf); } Plugin.LogDebug(" "); Plugin.LogDebug($"- Fields of \"{NameOfObject(obj, readablePropertiesOf)}\" of type \"{typeFromHandle}\" :"); FieldInfo[] allFields = GetAllFields(typeFromHandle); if (hasToListFields) { LogFields(obj, typeFromHandle, allFields); } } public static NetworkObject? GetNetworkObjectByHash(uint hashID) { FieldInfo field = typeof(NetworkObject).GetField("GlobalObjectIdHash", BindingFlags.Instance | BindingFlags.NonPublic); if (field == null) { Plugin.LogError("GlobalObjectIdHash field is null."); return null; } NetworkObject[] array = Resources.FindObjectsOfTypeAll<NetworkObject>(); foreach (NetworkObject val in array) { uint num = (uint)field.GetValue(val); if (num == hashID) { return val; } } return null; } private static void LogProperties<T>(T obj, Type typeObj, PropertyInfo[] arrObjProperties) { if (obj == null) { Plugin.LogDebug($"Object of type {typeObj} is null"); return; } Plugin.LogDebug(" "); Plugin.LogDebug($"- Properties of \"{NameOfObject(obj, arrObjProperties)}\" of type \"{typeObj}\" :"); foreach (PropertyInfo propertyInfo in arrObjProperties) { Plugin.LogDebug($" {propertyInfo.Name} = {GetValueOfProperty(obj, propertyInfo)}"); } } private static string NameOfObject<T>(T obj, PropertyInfo[] propertyInfos) { object valueOfProperty = GetValueOfProperty(obj, propertyInfos.FirstOrDefault((PropertyInfo x) => x.Name == "name")); if (valueOfProperty != null) { return valueOfProperty.ToString(); } return "name null"; } private static void LogFields<T>(T obj, Type typeObj, FieldInfo[] arrObjFields) { if (obj == null) { Plugin.LogDebug($"Object of type {typeObj} is null"); return; } Plugin.LogDebug(" "); foreach (FieldInfo fieldInfo in arrObjFields) { Plugin.LogDebug($" {fieldInfo.Name} = {GetValueOfField(obj, fieldInfo)}"); } } public static FieldInfo[] GetAllFields(Type t) { if (t == null) { return new FieldInfo[0]; } BindingFlags bindingAttr = BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; return t.GetFields(bindingAttr).Concat(GetAllFields(t.BaseType)).ToArray(); } private static PropertyInfo[] GetReadablePropertiesOf(Type type) { return (from x in type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy) where x.CanRead select x).ToArray(); } private static object? GetValueOfProperty<T>(T obj, PropertyInfo propertyInfo) { if (propertyInfo == null) { return null; } if (!propertyInfo.GetAccessors(nonPublic: true)[0].IsStatic) { return propertyInfo.GetValue(obj, null); } return propertyInfo.GetValue(null); } private static object? GetValueOfField<T>(T obj, FieldInfo fieldInfo) { if (fieldInfo == null) { return null; } if (!fieldInfo.IsStatic) { return fieldInfo.GetValue(obj); } return fieldInfo.GetValue(null); } } internal class RayUtil { public static void RayCastAndDrawFromPointWithColor(LineRenderer? lr, Vector3 origin, Vector3 endPoint, Color color) { //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_0004: Unknown result type (might be due to invalid IL or missing references) //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_0010: 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_001a: Unknown result type (might be due to invalid IL or missing references) Ray ray = default(Ray); ((Ray)(ref ray))..ctor(origin, endPoint - origin); float length = Vector3.Distance(endPoint, origin); DrawUtil.DrawLine(lr, ray, length, color); } public static bool RayCastAndDraw(LineRenderer? lr, Vector3 origin, Vector3 directionOrigin, float angle, float length) { //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_000b: 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_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_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_002a: 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_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_005a: 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) Vector3 val = Vector3.Cross(directionOrigin, Vector3.up); if (val == Vector3.zero) { val = Vector3.right; } Ray val2 = default(Ray); ((Ray)(ref val2))..ctor(origin, Quaternion.AngleAxis(angle, val) * directionOrigin); if (Physics.Raycast(val2, length, StartOfRound.Instance.walkableSurfacesMask, (QueryTriggerInteraction)1)) { DrawUtil.DrawLine(lr, val2, length, Color.red); return true; } DrawUtil.DrawWhiteLine(lr, val2, length); return false; } public static bool RayCastForwardAndDraw(LineRenderer? lr, Vector3 origin, Vector3 directionForward, float length) { //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_0009: 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_001e: 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) Ray val = default(Ray); ((Ray)(ref val))..ctor(origin, directionForward); if (Physics.Raycast(val, length, StartOfRound.Instance.walkableSurfacesMask, (QueryTriggerInteraction)1)) { DrawUtil.DrawLine(lr, val, length, Color.red); return true; } DrawUtil.DrawWhiteLine(lr, val, length); return false; } public static bool RayCastDownAndDraw(LineRenderer? lr, Vector3 origin, Vector3 directionDown, float length) { //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_0009: 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_001e: 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) Ray val = default(Ray); ((Ray)(ref val))..ctor(origin, directionDown); if (Physics.Raycast(val, length, StartOfRound.Instance.walkableSurfacesMask, (QueryTriggerInteraction)1)) { DrawUtil.DrawLine(lr, val, length, Color.red); return true; } DrawUtil.DrawWhiteLine(lr, val, length); return false; } } internal static class TreesUtils { public static void PrintTransformTree(Transform[] tree, string? parent = null) { if (tree == null) { Plugin.LogDebug("Tree of transform is null"); return; } if (tree.Length == 0) { Plugin.LogDebug("Tree of transform is empty"); return; } if (Utility.IsNullOrWhiteSpace(parent)) { Transform? obj = tree.FirstOrDefault(); object obj2; if (obj == null) { obj2 = null; } else { Transform parent2 = obj.parent; if (parent2 == null) { obj2 = null; } else { Transform root = parent2.root; obj2 = ((root != null) ? ((Object)root).name : null); } } parent = (string?)obj2; } TransformTreeTraversal(tree, parent, 0); } private static void TransformTreeTraversal(Transform[] tree, string? parent, int depth) { StringBuilder stringBuilder = new StringBuilder(); foreach (Transform val in tree) { if ((string.IsNullOrWhiteSpace(parent) && ((Object)(object)val.parent == (Object)null || string.IsNullOrWhiteSpace(((Object)val.parent).name))) || ((Object)(object)val.parent != (Object)null && ((Object)val.parent).name == parent)) { for (int j = 1; j <= depth - 1; j++) { stringBuilder.Append("│ "); } if (depth > 0) { stringBuilder.Append("├──"); } Plugin.LogDebug(stringBuilder.ToString() + ((Object)val).name); stringBuilder.Clear(); TransformTreeTraversal(tree, ((Object)val).name, depth + 1); } } } public static void PrintComponentsTreeOfGameObject(GameObject gameObject) { if ((Object)(object)gameObject == (Object)null) { Plugin.LogDebug("GameObject is null"); return; } Component[] array = (from x in gameObject.GetComponentsInChildren(typeof(Component)) where (Object)(object)x != (Object)null select x).ToArray(); if (array.Length == 0) { Plugin.LogDebug("GameObject has no components"); } else { ComponentTreeTraversal(array); } } private static int ComponentTreeTraversal(Component[] tree, string? parent = null, int index = 0, int depth = 0, string lastTransformName = "") { StringBuilder stringBuilder = new StringBuilder(); for (int i = index; i < tree.Length; i++) { Component val = tree[i]; Transform val2 = (Transform)(object)((val is Transform) ? val : null); bool flag = (Object)(object)val2 != (Object)null; if ((Object)(object)val2 == (Object)null) { val2 = val.transform; } if (string.IsNullOrWhiteSpace(parent)) { Transform parent2 = val2.parent; if (string.IsNullOrWhiteSpace((parent2 != null) ? ((Object)parent2).name : null)) { Plugin.LogDebug((flag ? ((Object)val2).name : ((object)val).ToString()) ?? ""); } } if (string.IsNullOrWhiteSpace(parent)) { Transform parent3 = val2.parent; if (!string.IsNullOrWhiteSpace((parent3 != null) ? ((Object)parent3).name : null)) { parent = ((Object)val2.parent).name; } } if (parent == ((Object)val2).name) { for (int j = 1; j <= depth - 1; j++) { stringBuilder.Append("│ "); } if (depth > 0) { stringBuilder.Append("├──"); } Plugin.LogDebug($"{stringBuilder}{(flag ? ((Object)val2).name : ((object)val).ToString())}"); stringBuilder.Clear(); continue; } Transform parent4 = val2.parent; if (((parent4 != null) ? ((Object)parent4).name : null) == parent && flag) { for (int k = 1; k <= depth - 1; k++) { stringBuilder.Append("│ "); } if (depth > 0) { stringBuilder.Append("├──"); } if (!(((Object)val2).name == lastTransformName)) { lastTransformName = ((Object)val2).name; Plugin.LogDebug($"{stringBuilder}{((Object)val2).name}"); stringBuilder.Clear(); i = ComponentTreeTraversal(tree, ((Object)val2).name, i + 1, depth + 1, lastTransformName); index = i; } } } return index; } } } namespace LethalInternship.TerminalAdapter { internal class TerminalParser { public TerminalState TerminalState; public TerminalParser() { TerminalState = new WaitForMainCommandPage(this); } public TerminalNode? ParseCommand(string command, ref Terminal terminal) { if (string.IsNullOrWhiteSpace(command)) { return null; } command = TerminalPatch.RemovePunctuation_ReversePatch(terminal, command); if (string.IsNullOrWhiteSpace(command)) { return null; } string[] array = command.Split(" ", StringSplitOptions.RemoveEmptyEntries); if (array.Length == 0) { return null; } if (TerminalState.ParseCommandValid(array)) { TerminalNode val = TerminalState.DisplayNode(); if ((Object)(object)val != (Object)null) { val.displayText += "\n"; } return val; } TerminalState = new WaitForMainCommandPage(this); return null; } public bool IsMatchWord(string word, string match) { if (match.Contains(word)) { return match[0] == word[0]; } return false; } } internal abstract class TerminalState { protected TerminalParser terminalParser; protected Dictionary<EnumTerminalStates, TerminalNode> dictTerminalNodeByState; protected TerminalState(TerminalState oldState) : this(oldState.terminalParser) { dictTerminalNodeByState = oldState.dictTerminalNodeByState; } protected TerminalState(TerminalParser terminalParser) { if (terminalParser == null) { throw new NullReferenceException("TerminalParser is null."); } this.terminalParser = terminalParser; Plugin.LogDebug($"TerminalState new state : {GetTerminalState()}"); if (dictTerminalNodeByState == null) { dictTerminalNodeByState = new Dictionary<EnumTerminalStates, TerminalNode>(); } } public abstract EnumTerminalStates GetTerminalState(); public abstract bool ParseCommandValid(string[] words); public abstract TerminalNode? DisplayNode(); } } namespace LethalInternship.TerminalAdapter.TerminalStates { internal class ConfirmCancelPurchasePage : TerminalState { private static readonly EnumTerminalStates STATE = EnumTerminalStates.ConfirmCancelPurchase; private int NbOrdered; public override EnumTerminalStates GetTerminalState() { return STATE; } public ConfirmCancelPurchasePage(TerminalState oldState, int nbOrdered) : base(oldState) { int value = Plugin.Config.InternPrice.Value; if (value <= 0) { NbOrdered = nbOrdered; return; } int num = (int)Math.Floor((float)TerminalManager.Instance.GetTerminal().groupCredits / (float)value); NbOrdered = ((nbOrdered < num) ? nbOrdered : num); } public override bool ParseCommandValid(string[] words) { string text = words[0]; if (string.IsNullOrWhiteSpace(text)) { return false; } TerminalManager instance = TerminalManager.Instance; if (terminalParser.IsMatchWord(text, instance.CommandIntershipProgram) || terminalParser.IsMatchWord(text, Const.STRING_CANCEL_COMMAND) || terminalParser.IsMatchWord(text, Const.STRING_BACK_COMMAND)) { terminalParser.TerminalState = new InfoPage(this); return true; } if (terminalParser.IsMatchWord(text, Const.STRING_CONFIRM_COMMAND)) { InternManager instance2 = InternManager.Instance; int num = instance.GetTerminal().groupCredits - Plugin.Config.InternPrice.Value * NbOrdered; instance2.AddNewCommandOfInterns(NbOrdered); instance.GetTerminal().groupCredits = num; instance.UpdatePurchaseAndCreditsServerRpc(instance2.NbInternsOwned, instance2.NbInternsToDropShip, num); terminalParser.TerminalState = new InfoPage(this); return true; } return false; } public override TerminalNode? DisplayNode() { if (!dictTerminalNodeByState.TryGetValue(GetTerminalState(), out TerminalNode value)) { value = ScriptableObject.CreateInstance<TerminalNode>(); dictTerminalNodeByState[GetTerminalState()] = value; } value.clearPreviousText = true; int nbInternsPurchasable = InternManager.Instance.NbInternsPurchasable; string arg = string.Empty; if (NbOrdered > nbInternsPurchasable) { arg = Const.TEXT_CONFIRM_CANCEL_PURCHASE_MAXIMUM; NbOrdered = nbInternsPurchasable; } value.displayText = string.Format(Const.TEXT_CONFIRM_CANCEL_PURCHASE, NbOrdered, arg, Plugin.Config.InternPrice.Value * NbOrdered); return value; } } internal class ErrorPage : TerminalState { private static readonly EnumTerminalStates STATE; private readonly EnumErrorTypeTerminalPage enumErrorType; public override EnumTerminalStates GetTerminalState() { return STATE; } public ErrorPage(TerminalState newState, EnumErrorTypeTerminalPage enumErrorType) : base(newState) { this.enumErrorType = enumErrorType; } public override bool ParseCommandValid(string[] words) { terminalParser.TerminalState = new InfoPage(this); return true; } public override TerminalNode? DisplayNode() { if (!dictTerminalNodeByState.TryGetValue(GetTerminalState(), out TerminalNode value)) { value = ScriptableObject.CreateInstance<TerminalNode>(); dictTerminalNodeByState[GetTerminalState()] = value; } value.clearPreviousText = true; switch (enumErrorType) { case EnumErrorTypeTerminalPage.NotEnoughCredits: value.displayText = Const.TEXT_ERROR_NOT_ENOUGH_CREDITS; break; case EnumErrorTypeTerminalPage.NoMoreInterns: value.displayText = Const.TEXT_NO_MORE_INTERNS_PURCHASABLE; break; case EnumErrorTypeTerminalPage.ShipLeavingMoon: value.displayText = Const.TEXT_ERROR_SHIP_LEAVING; break; default: value.displayText = Const.TEXT_ERROR_DEFAULT; break; } TerminalManager.Instance.GetTerminal().terminalAudio.PlayOneShot(TerminalManager.Instance.GetTerminal().syncedAudios[Const.INDEX_AUDIO_ERROR]); return value; } } internal class InfoPage : TerminalState { private static readonly EnumTerminalStates STATE = EnumTerminalStates.Info; public override EnumTerminalStates GetTerminalState() { return STATE; } public InfoPage(TerminalState newState) : base(newState) { } public override bool ParseCommandValid(string[] words) { string text = words[0]; if (string.IsNullOrWhiteSpace(text)) { return false; } if (terminalParser.IsMatchWord(text, TerminalManager.Instance.CommandIntershipProgram) || terminalParser.IsMatchWord(text, Const.STRING_BACK_COMMAND)) { return true; } if (terminalParser.IsMatchWord(text, Const.STRING_BUY_COMMAND)) { return BuyCommandSetNextPage(words); } if (terminalParser.IsMatchWord(text, Const.STRING_LAND_COMMAND) || terminalParser.IsMatchWord(text, Const.STRING_ABORT_COMMAND)) { return LandingStatusCommand(text); } return false; } private bool BuyCommandSetNextPage(string[] words) { if (TerminalManager.Instance.GetTerminal().groupCredits < Plugin.Config.InternPrice.Value) { terminalParser.TerminalState = new ErrorPage(this, EnumErrorTypeTerminalPage.NotEnoughCredits); return true; } if (InternManager.Instance.NbInternsPurchasable <= 0) { terminalParser.TerminalState = new ErrorPage(this, EnumErrorTypeTerminalPage.NoMoreInterns); return true; } if (StartOfRound.Instance.shipIsLeaving) { terminalParser.TerminalState = new ErrorPage(this, EnumErrorTypeTerminalPage.ShipLeavingMoon); return true; } if (words.Length > 1) { string text = words[1]; if (!Utility.IsNullOrWhiteSpace(text) && int.TryParse(text, out var result) && result > 0) { terminalParser.TerminalState = new ConfirmCancelPurchasePage(this, result); } else { terminalParser.TerminalState = new ConfirmCancelPurchasePage(this, 1); } return true; } terminalParser.TerminalState = new ConfirmCancelPurchasePage(this, 1); return true; } private bool LandingStatusCommand(string command) { TerminalManager instance = TerminalManager.Instance; InternManager instance2 = InternManager.Instance; if (terminalParser.IsMatchWord(command, Const.STRING_LAND_COMMAND)) { instance2.LandingStatusAllowed = true; } else if (terminalParser.IsMatchWord(command, Const.STRING_ABORT_COMMAND)) { instance2.LandingStatusAllowed = false; } instance.SyncLandingStatusServerRpc(instance2.LandingStatusAllowed); return true; } public override TerminalNode? DisplayNode() { StartOfRound instance = StartOfRound.Instance; InternManager instance2 = InternManager.Instance; if (!dictTerminalNodeByState.TryGetValue(GetTerminalState(), out TerminalNode value)) { value = ScriptableObject.CreateInstance<TerminalNode>(); dictTerminalNodeByState[GetTerminalState()] = value; } value.clearPreviousText = true; string text = (instance2.LandingStatusAllowed ? Const.STRING_LANDING_STATUS_ALLOWED : Const.STRING_LANDING_STATUS_ABORTED); bool flag = instance.currentLevel.levelID == Const.COMPANY_BUILDING_MOON_ID; if (flag) { text += Const.STRING_LANDING_STATUS_ABORTED_COMPANY_MOON; } string displayText; if (instance.inShipPhase || instance.shipIsLeaving || flag) { displayText = string.Format(Const.TEXT_INFO_PAGE_IN_SPACE, instance2.NbInternsPurchasable, Plugin.Config.InternPrice.Value, instance2.NbInternsToDropShip, text); } else { string text2 = string.Empty; int nbInternsToDropShip = instance2.NbInternsToDropShip; int num = instance2.NbInternsOwned - nbInternsToDropShip; if (nbInternsToDropShip > 0 && !instance.shipIsLeaving) { text2 = string.Format(Const.TEXT_INFO_PAGE_INTERN_TO_DROPSHIP, nbInternsToDropShip); } displayText = string.Format(Const.TEXT_INFO_PAGE_ON_MOON, instance2.NbInternsPurchasable, Plugin.Config.InternPrice.Value, text2, num, text); } value.displayText = displayText; return value; } } internal class WaitForMainCommandPage : TerminalState { private static readonly EnumTerminalStates STATE = EnumTerminalStates.WaitForMainCommand; public override EnumTerminalStates GetTerminalState() { return STATE; } public WaitForMainCommandPage(TerminalParser terminalParser) : base(terminalParser) { } public WaitForMainCommandPage(TerminalState newState) : base(newState) { } public override bool ParseCommandValid(string[] words) { string text = words[0]; if (string.IsNullOrWhiteSpace(text) || !terminalParser.IsMatchWord(text, TerminalManager.Instance.CommandIntershipProgram)) { return false; } terminalParser.TerminalState = new InfoPage(this); return true; } public override TerminalNode? DisplayNode() { return null; } } } namespace LethalInternship.Patches.TerminalPatches { [HarmonyPatch(typeof(Terminal))] internal class TerminalPatch { [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start_Postfix(TerminalNodesList ___terminalNodes) { TerminalManager.Instance.AddTextToHelpTerminalNode(___terminalNodes); } [HarmonyPatch("ParsePlayerSentence")] [HarmonyPostfix] private static void ParsePlayerSentence_Postfix(ref Terminal __instance, ref TerminalNode __result) { string text = __instance.screenText.text.Substring(__instance.screenText.text.Length - __instance.textAdded); if ((Object)(object)__result != (Object)null && (Object)(object)__result != (Object)(object)__instance.terminalNodes.specialNodes[10] && (Object)(object)__result != (Object)(object)__instance.terminalNodes.specialNodes[11] && (Object)(object)__result != (Object)(object)__instance.terminalNodes.specialNodes[12] && text != Plugin.Config.GetTitleInternshipProgram()) { TerminalManager.Instance.ResetTerminalParser(); return; } TerminalNode val = TerminalManager.Instance.ParseLethalInternshipCommands(text, ref __instance); if ((Object)(object)val != (Object)null) { __result = val; } } [HarmonyPatch("ClearBoughtItems")] [HarmonyPostfix] private static void ClearBoughtItems_Postfix() { Plugin.LogDebug("ClearBoughtItems reset interns bought"); InternManager.Instance.UpdateInternsOrdered(0, 0); } [HarmonyPatch("ParseWord")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] public static TerminalKeyword ParseWord_ReversePatch(object instance, string playerWord, int specificityRequired) { throw new NotImplementedException("Stub LethalInternship.Patches.TerminalPatches.ParseWord_ReversePatch"); } [HarmonyPatch("ParseWordOverrideOptions")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] public static TerminalNode ParseWordOverrideOptions_ReversePatch(object instance, string playerWord, CompatibleNoun[] options) { throw new NotImplementedException("Stub LethalInternship.Patches.TerminalPatches.ParseWordOverrideOptions_ReversePatch"); } [HarmonyPatch("RemovePunctuation")] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] public static string RemovePunctuation_ReversePatch(object instance, string s) { throw new NotImplementedException("Stub LethalInternship.Patches.TerminalPatches.RemovePunctuation_ReversePatch"); } } } namespace LethalInternship.Patches.ObjectsPatches { [HarmonyPatch(typeof(DeadBodyInfo))] internal class DeadBodyInfoPatch { [HarmonyPatch("DetectIfSeenByLocalPlayer")] [HarmonyPrefix] private static bool DetectIfSeenByLocalPlayer_PreFix(DeadBodyInfo __instance) { InternAI internAI = InternManager.Instance.GetInternAI(__instance.playerObjectId); if ((Object)(object)internAI != (Object)null && internAI.RagdollInternBody != null && (Object)(object)internAI.RagdollInternBody.GetDeadBodyInfo() == (Object)(object)__instance) { return false; } return true; } [HarmonyPatch("Start")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> Start_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown int num = -1; List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count - 8; i++) { if (((object)list[i]).ToString().StartsWith("ldarg.0 NULL") && ((object)list[i + 3]).ToString().StartsWith("ldarg.0 NULL") && ((object)list[i + 8]).ToString() == "ldstr \"PlayerRagdoll\"") { num = i; break; } } if (num > -1) { List<Label> labels = list[num + 3].labels; Label label = generator.DefineLabel(); labels.Add(label); List<CodeInstruction> list2 = new List<CodeInstruction>(); list2.Add(new CodeInstruction(OpCodes.Ldarg_0, (object)null)); list2.Add(new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(DeadBodyInfo), "playerObjectId"))); list2.Add(new CodeInstruction(OpCodes.Call, (object)PatchesUtil.IsIdPlayerInternMethod)); list2.Add(new CodeInstruction(OpCodes.Brtrue_S, (object)label)); List<CodeInstruction> collection = list2; list.InsertRange(num, collection); num = -1; } else { Plugin.LogError("LethalInternship.Patches.ObjectsPatches.DeadBodyInfoPatch.Start_Transpiler remplace with correct tag if intern."); } return list.AsEnumerable(); } } [HarmonyPatch(typeof(GrabbableObject))] internal class GrabbableObjectPatch { [HarmonyPatch("SetControlTipsForItem")] [HarmonyPrefix] private static bool SetControlTipsForItem_PreFix(GrabbableObject __instance) { return InternManager.Instance.IsAnInternAiOwnerOfObject(__instance); } [HarmonyPatch("DiscardItem")] [HarmonyPrefix] private static bool DiscardItem_PreFix(GrabbableObject __instance) { PlayerControllerB playerHeldBy = __instance.playerHeldBy; if ((Object)(object)playerHeldBy == (Object)null || !InternManager.Instance.IsPlayerIntern(playerHeldBy)) { return true; } __instance.playerHeldBy.IsInspectingItem = false; __instance.playerHeldBy.activatingItem = false; __instance.playerHeldBy = null; return false; } [HarmonyPatch("SetScrapValue")] [HarmonyPrefix] private static bool SetScrapValue_PreFix(GrabbableObject __instance, int setValueTo) { RagdollGrabbableObject val = (RagdollGrabbableObject)(object)((__instance is RagdollGrabbableObject) ? __instance : null); if ((Object)(object)val == (Object)null) { return true; } InternAI internAI = InternManager.Instance.GetInternAI(val.bodyID.Value); if ((Object)(object)internAI == (Object)null) { if ((Object)(object)((Component)val).gameObject.GetComponentInChildren<ScanNodeProperties>() == (Object)null) { __instance.scrapValue = setValueTo; return false; } return true; } if (internAI.NpcController.Npc.isPlayerDead && (Object)(object)((Component)val).gameObject.GetComponentInChildren<ScanNodeProperties>() == (Object)null) { if ((Object)(object)((Component)val).gameObject.GetComponentInChildren<ScanNodeProperties>() == (Object)null) { __instance.scrapValue = setValueTo; return false; } return true; } return false; } [MethodImpl(MethodImplOptions.NoInlining)] [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] [HarmonyPatch("Update")] public static void GrabbableObject_Update_ReversePatch(RagdollGrabbableObject instance) { throw new NotImplementedException("Stub LethalInternship.Patches.NpcPatches.GrabbableObjectPatch.GrabbableObject_Update_ReversePatch"); } [HarmonyPatch("EquipItem")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> EquipItem_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown int num = -1; List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count - 3; i++) { if (((object)list[i]).ToString() == "call static HUDManager HUDManager::get_Instance()" && ((object)list[i + 1]).ToString() == "callvirt void HUDManager::ClearControlTips()" && ((object)list[i + 3]).ToString() == "callvirt virtual void GrabbableObject::SetControlTipsForItem()") { num = i; break; } } if (num > -1) { List<CodeInstruction> collection = new List<CodeInstruction> { new CodeInstruction(OpCodes.Ldarg_0, (object)null), new CodeInstruction(OpCodes.Call, (object)PatchesUtil.IsAnInternAiOwnerOfObjectMethod), new CodeInstruction(OpCodes.Brtrue_S, (object)list[num + 4].labels[0]) }; list.InsertRange(num, collection); num = -1; } else { Plugin.LogError("LethalInternship.Patches.ObjectsPatches.EquipItem_Transpiler could not remove check if holding player is intern"); } return list.AsEnumerable(); } } [HarmonyPatch(typeof(RagdollGrabbableObject))] internal class RagdollGrabbableObjectPatch { [HarmonyPatch("Update")] [HarmonyPrefix] private static bool Update_PreFix(RagdollGrabbableObject __instance, ref bool ___foundRagdollObject) { int value = __instance.bodyID.Value; if (value == Const.INIT_RAGDOLL_ID) { RagdollInternBody.Update_Patch(__instance); return false; } if (___foundRagdollObject && (Object)(object)StartOfRound.Instance.allPlayerScripts[value].deadBody != (Object)(object)__instance.ragdoll) { ___foundRagdollObject = false; } return true; } } [HarmonyPatch(typeof(ShotgunItem))] internal class ShotgunItemPatch { [HarmonyPatch("ShootGun")] [HarmonyPostfix] private static void ShootGun_PostFix(ShotgunItem __instance, Vector3 shotgunPosition, Vector3 shotgunForward) { //IL_0076: 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_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_009e: 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_00a1: 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_00b8: 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_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) ulong actualClientId = GameNetworkManager.Instance.localPlayerController.actualClientId; for (int i = InternManager.Instance.IndexBeginOfInterns; i < InternManager.Instance.AllEntitiesCount; i++) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i]; if (val.isPlayerDead || !val.isPlayerControlled || ((NetworkBehaviour)val).OwnerClientId != actualClientId) { continue; } InternAI internAIIfLocalIsOwner = InternManager.Instance.GetInternAIIfLocalIsOwner((int)val.playerClientId); if ((Object)(object)internAIIfLocalIsOwner == (Object)null) { continue; } int num = 0; float num2 = Vector3.Distance(((Component)val).transform.position, ((Component)__instance.shotgunRayPoint).transform.position); Vector3 val2 = val.playerCollider.ClosestPoint(shotgunPosition); if (Vector3.Angle(shotgunForward, val2 - shotgunPosition) < 30f && !Physics.Linecast(shotgunPosition, val2, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { if (num2 < 5f) { num = 100; } if (num2 < 15f) { num = 100; } else if (num2 < 23f) { num = 40; } else if (num2 < 30f) { num = 20; } Plugin.LogDebug($"Dealing {num} damage to intern {((Object)val).name} {val.playerClientId}, owner {((NetworkBehaviour)val).OwnerClientId}"); internAIIfLocalIsOwner.SyncDamageIntern(num, (CauseOfDeath)7, 0, fallDamage: false, __instance.shotgunRayPoint.forward * 30f); } } } } [HarmonyPatch(typeof(StunGrenadeItem))] internal class StunGrenadeItemPatch { [HarmonyPatch("SetControlTipForGrenade")] [HarmonyPrefix] private static bool SetControlTipForGrenade_PreFix(StunGrenadeItem __instance) { if (InternManager.Instance.IsAnInternAiOwnerOfObject((GrabbableObject)(object)__instance)) { return false; } return true; } [HarmonyPatch("StunExplosion")] [HarmonyPostfix] private static void StunExplosion_PostFix(Vector3 explosionPosition, bool isHeldItem, PlayerControllerB playerHeldBy) { } } } namespace LethalInternship.Patches.NpcPatches { [HarmonyPatch(typeof(EnemyAI))] internal class EnemyAIPatch { [HarmonyPatch("ChangeOwnershipOfEnemy")] [HarmonyPrefix] private static bool ChangeOwnershipOfEnemy_PreFix(ref ulong newOwnerClientId) { Plugin.LogDebug($"Try ChangeOwnershipOfEnemy newOwnerClientId : {(int)newOwnerClientId}"); if (newOwnerClientId > Const.INTERN_ACTUAL_ID_OFFSET) { InternAI internAI = InternManager.Instance.GetInternAI((int)(newOwnerClientId - Const.INTERN_ACTUAL_ID_OFFSET)); if ((Object)(object)internAI != (Object)null) { Plugin.LogDebug($"ChangeOwnershipOfEnemy not on intern but on intern owner : {((NetworkBehaviour)internAI).OwnerClientId}"); newOwnerClientId = ((NetworkBehaviour)internAI).OwnerClientId; } } return true; } [HarmonyPatch("MeetsStandardPlayerCollisionConditions")] [HarmonyTranspiler] public static IEnumerable<CodeInstruction> MeetsStandardPlayerCollisionConditions_Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown int num = -1; List<CodeInstruction> list = new List<CodeInstruction>(instructions); for (int i = 0; i < list.Count - 8; i++) { if (list[i].opcode == OpCodes.Brtrue && list[i + 1].opcode == OpCodes.Ldloc_0 && list[i + 2].opcode == OpCodes.Call && list[i + 3].opcode == OpCodes.Ldfld && list[i + 4].opcode == OpCodes.Call && list[i + 8].opcode == OpCodes.Ldarg_0) { num = i; break; } } if (num > -1) { List<CodeInstruction> collection = new List<CodeInstruction> { new CodeInstruction(OpCodes.Ldarg_1, (object)null), new CodeInstruction(OpCodes.Call, (object)PatchesUtil.IsColliderFromLocalOrInternOwnerLocalMethod), new CodeInstruction(OpCodes.Brtrue_S, (object)list[num + 8].labels.First()) }; list.InsertRange(num + 1, collection); } else { Plugin.LogError("LethalInternship.Patches.NpcPatches.EnemyAIPatch.MeetsStandardPlayerCollisionConditions_Transpiler could not insert instruction if is intern for \"component != GameNetworkManager.Instance.localPlayerController\"."); } return list.AsEnumerable(); } [HarmonyPatch("CheckLineOfSightForPlayer")] [HarmonyPostfix] private static void CheckLineOfSightForPlayer_PostFix(EnemyAI __instance, ref PlayerControllerB __result, float width, ref int range, int proximityAwareness) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 //IL_0066: 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_006c: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_016d: 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_017f: 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_01a7: 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_01ac: 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) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: 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_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = null; if (__instance.isOutside && !__instance.enemyType.canSeeThroughFog && (int)TimeOfDay.Instance.currentLevelWeather == 3) { range = Mathf.Clamp(range, 0, 30); } for (int i = InternManager.Instance.IndexBeginOfInterns; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { PlayerControllerB val2 = StartOfRound.Instance.allPlayerScripts[i]; if (!__instance.PlayerIsTargetable(val2, false, false)) { continue; } Vector3 position = ((Component)val2.gameplayCamera).transform.position; if (Vector3.Distance(position, __instance.eye.position) < (float)range && !Physics.Linecast(__instance.eye.position, position, StartOfRound.Instance.collidersAndRoomMaskAndDefault)) { Vector3 val3 = position - __instance.eye.position; if (Vector3.Angle(__instance.eye.forward, val3) < width || (proximityAwareness != -1 && Vector3.Distance(__instance.eye.position, position) < (float)proximityAwareness)) { val = val2; } } } if ((Object)(object)__result == (Object)null && (Object)(object)val == (Object)null) { return; } if ((Object)(object)__result == (Object)null && (Object)(object)val != (Object)null) { Plugin.LogDebug("intern found, no player found"); __result = val; } else if ((Object)(object)__result != (Object)null && (Object)(object)val == (Object)null) { Plugin.LogDebug("intern not found, player found"); } else if (!((Object)(object)__result == (Object)null) && !((Object)(object)val == (Object)null)) { Vector3 position2 = ((Component)__result.gameplayCamera).transform.position; Vector3 position3 = ((Component)val.gameplayCamera).transform.position; Vector3 val4 = (((Object)(object)__instance.eye == (Object)null) ? ((Component)__instance).transform.position : __instance.eye.position); Vector3 val5 = position3 - val4; float sqrMagnitude = ((Vector3)(ref val5)).sqrMagnitude; val5 = position2 - val4; if (sqrMagnitude < ((Vector3)(ref val5)).sqrMagnitude) { Plugin.LogDebug("intern closer"); __result = val; } else { Plugin.LogDebug("player closer"); } } } [HarmonyPatch("GetClosestPlayer")] [HarmonyPostfix] private static void GetClosestPlayer_PostFix(EnemyAI __instance, ref PlayerControllerB __result, bool requireLineOfSight, bool cannotBeInShip, bool cannotBeNearShip) { //IL_00ba: 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_0097: 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_0055: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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_019f: 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_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: 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_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: 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_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = null; for (int i = InternManager.Instance.IndexBeginOfInterns; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { PlayerControllerB val2 = StartOfRound.Instance.allPlayerScripts[i]; if (!__instance.PlayerIsTargetable(val2, cannotBeInShip, false)) { continue; } if (cannotBeNearShip) { if (val2.isInElevator) { continue; } bool flag = false; for (int j = 0; j < RoundManager.Instance.spawnDenialPoints.Length; j++) { if (Vector3.Distance(RoundManager.Instance.spawnDenialPoints[j].transform.position, ((Component)val2).transform.position) < 10f) { flag = true; break; } } if (flag) { continue; } } if (!requireLineOfSight || !Physics.Linecast(((Component)__instance).transform.position, ((Component)val2).transform.position, 256)) { __instance.tempDist = Vector3.Distance(((Component)__instance).transform.position, ((Component)val2).transform.position); if (__instance.tempDist < __instance.mostOptimalDistance) { __instance.mostOptimalDistance = __instance.tempDist; val = val2; } } } if ((Object)(object)__result == (Object)null && (Object)(object)val == (Object)null) { return; } if ((Object)(object)__result == (Object)null && (Object)(object)val != (Object)null) { __result = val; } else if ((!((Object)(object)__result != (Object)null) || !((Object)(object)val == (Object)null)) && !((Object)(object)__result == (Object)null) && !((Object)(object)val == (Object)null)) { Vector3 position = ((Component)__result.gameplayCamera).transform.position; Vector3 position2 = ((Component)val.gameplayCamera).transform.position; Vector3 val3 = (((Object)(object)__instance.eye == (Object)null) ? ((