diff --git a/project/SPT.Debugging/Patches/DumpyLibPatch.cs b/project/SPT.Debugging/Patches/DumpyLibPatch.cs new file mode 100644 index 0000000..0eaf122 --- /dev/null +++ b/project/SPT.Debugging/Patches/DumpyLibPatch.cs @@ -0,0 +1,114 @@ +using System; +using System.Reflection; +using Comfort.Common; +using EFT; +using EFT.Bots; +using EFT.UI; +using EFT.Weather; +using HarmonyLib; +using JsonType; +using SPT.Reflection.Patching; +using SPT.Reflection.Utils; +using UnityEngine; + +namespace SPT.Debugging.Patches; + +/// +/// Used to debug dumpLib issues https://dev.sp-tarkov.com/SPT/AssemblyTool/src/branch/master/DumpLib/DumpyTool.cs +/// +public class DumpyLibPatch : ModulePatch +{ + protected override MethodBase GetTargetMethod() + { + return AccessTools.Method(typeof(MenuScreen), nameof(MenuScreen.Awake)); + } + + [PatchPostfix] + public static void PatchPostfix(MenuScreen __instance) + { + // attach Monobehaviour so we can interact with UE + HookObject._object.AddComponent(); + } +} + +public class DumplyLibMono : MonoBehaviour +{ + public Class301 _session; + public TarkovApplication _tarkovApplication; + public FieldInfo _mainMenuController; + public WaveInfo _wavesSettings; + public LocalRaidSettings _localRaidSettings; + public RaidSettings _raidSettings; + public LocationSettingsClass _locationSettings; + public GClass1924 _endRaidClass; + public GClass1962 _completeProfile; + public GClass814 _parsedDataProfile; + // Class references are as of assembly 33420 - 02/11/2024 + + private void Start() + { + _session = ClientAppUtils.GetClientApp().Session as Class301; + _tarkovApplication = ClientAppUtils.GetMainApp(); + _mainMenuController = _tarkovApplication.GetType().GetField("mainMenuController"); // is null at this point so only get fieldinfo - TODO: fieldinfo came back as null + _wavesSettings = new WaveInfo(2, WildSpawnType.assault, BotDifficulty.normal); // imitate loading json of wave settings + _localRaidSettings = new LocalRaidSettings // this has changed from current repo json TODO: check dumped data for changes here + { + serverId = null, + location = "Interchange", + timeVariant = EDateTime.CURR, + mode = ELocalMode.TRAINING, + playerSide = ESideType.Pmc, + }; + _raidSettings = new RaidSettings // this has changed from current repo json TODO: check dumped data for changes here + { + KeyId = null, + LocationId = "Interchange", + SelectedDateTime = EDateTime.CURR, + MetabolismDisabled = false, + TimeAndWeatherSettings = new TimeAndWeatherSettings + { + IsRandomTime = false, + IsRandomWeather = false, + CloudinessType = ECloudinessType.Clear, + RainType = ERainType.NoRain, + WindType = EWindSpeed.Light, + FogType = EFogType.NoFog, + TimeFlowType = ETimeFlowType.x1, + HourOfDay = -1 + }, + BotSettings = new BotControllerSettings + { + IsScavWars = false, + BotAmount = EBotAmount.AsOnline + }, + WavesSettings = new WavesSettings + { + BotAmount = EBotAmount.AsOnline, + BotDifficulty = EBotDifficulty.AsOnline, + IsBosses = true, + IsTaggedAndCursed = false + }, + Side = ESideType.Pmc, + RaidMode = ERaidMode.Online, + PlayersSpawnPlace = EPlayersSpawnPlace.SamePlace + }; + _locationSettings = _session.LocationSettings; + _endRaidClass = new GClass1924 + { + profile = null, + result = ExitStatus.Left, + killerId = null, + killerAid = null, + exitName = null, + inSession = true, + favorite = false, + playTime = 33, + InsuredItems = new GClass1308[] {}, + ProfileId = "" + }; + _completeProfile = new GClass1962(_session.Profile, GClass1971.Instance); + + _parsedDataProfile = _completeProfile.ToUnparsedData(); + _endRaidClass.profile = _completeProfile.ToUnparsedData(); + } +} \ No newline at end of file diff --git a/project/SPT.Debugging/SPTDebuggingPlugin.cs b/project/SPT.Debugging/SPTDebuggingPlugin.cs index 19185c5..4433a26 100644 --- a/project/SPT.Debugging/SPTDebuggingPlugin.cs +++ b/project/SPT.Debugging/SPTDebuggingPlugin.cs @@ -25,8 +25,9 @@ namespace SPT.Debugging // new StaticLootDumper().Enable(); // new ExfilDumper().Enable(); - //new PMCBotSpawnLocationPatch().Enable(); + // new PMCBotSpawnLocationPatch().Enable(); new ReloadClientPatch().Enable(); + // new DumpyLibPatch().Enable(); } catch (Exception ex) {