0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-12 17:30:43 -05:00

add dumplib testing patch, disabled by default

This commit is contained in:
CWX 2024-11-02 16:00:57 +00:00
parent b546b89a8d
commit 9d231b781f
2 changed files with 116 additions and 1 deletions

View File

@ -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;
/// <summary>
/// Used to debug dumpLib issues https://dev.sp-tarkov.com/SPT/AssemblyTool/src/branch/master/DumpLib/DumpyTool.cs
/// </summary>
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<DumplyLibMono>();
}
}
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();
}
}

View File

@ -25,8 +25,9 @@ namespace SPT.Debugging
// new StaticLootDumper().Enable(); // new StaticLootDumper().Enable();
// new ExfilDumper().Enable(); // new ExfilDumper().Enable();
//new PMCBotSpawnLocationPatch().Enable(); // new PMCBotSpawnLocationPatch().Enable();
new ReloadClientPatch().Enable(); new ReloadClientPatch().Enable();
// new DumpyLibPatch().Enable();
} }
catch (Exception ex) catch (Exception ex)
{ {