Remove need for Iteration count, should fix being kicked for AFK
This commit is contained in:
parent
6a3219e12b
commit
e22af4ef15
@ -16,6 +16,7 @@ namespace DumpLib
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Utils.LogInfo("[Dumpy] Starting Dumpy");
|
||||
|
||||
await Task.Factory.StartNew(async delegate
|
||||
@ -49,94 +50,83 @@ namespace DumpLib
|
||||
{
|
||||
try
|
||||
{
|
||||
// Although there are now no map iterations, use the iterations to "reset" the afk montior
|
||||
if (DataHelper.Iteration > 6)
|
||||
foreach (var map in DataHelper.ConfigSettings.MapNames)
|
||||
{
|
||||
DataHelper.Iteration = 1;
|
||||
// Set location in the RaidSettings object
|
||||
Utils.LogInfo($"[Dumpy] Setting LocalRaidSettings location to: {map}");
|
||||
DataHelper.LocalRaidSettings.GetType().GetField("location")
|
||||
.SetValue(DataHelper.LocalRaidSettings, map);
|
||||
|
||||
var controller = DataHelper.MainMenuController.GetValue(DataHelper.TarkovApp);
|
||||
if (controller != null)
|
||||
{
|
||||
controller.GetType().GetMethod("StopAfkMonitor").Invoke(controller, null);
|
||||
}
|
||||
// Set location in the RaidConfig object
|
||||
Utils.LogInfo($"[Dumpy] Setting RaidSettings location to: {map}");
|
||||
DataHelper.RaidSettings.GetType().GetProperty("SelectedLocation")
|
||||
.SetValue(DataHelper.RaidSettings, ReflectionHelper.CheckLocationID(map));
|
||||
|
||||
Utils.LogInfo($"[Dumpy] Restarting Loop in {DataHelper.ConfigSettings.SptTimings.AllIterationDelayMs}ms");
|
||||
await Task.Delay(DataHelper.ConfigSettings.SptTimings.AllIterationDelayMs);
|
||||
// "/client/raid/configuration"
|
||||
// Call server with new map name in RaidSettings
|
||||
Utils.LogInfo($"[Dumpy] Sending RaidConfig");
|
||||
await (Task)DataHelper.Session.GetType().GetMethod("SendRaidSettings")
|
||||
.Invoke(DataHelper.Session, new[] { DataHelper.RaidSettings });
|
||||
|
||||
// Artificial wait to hopefully keep BSG off our toes
|
||||
Utils.LogInfo("Waiting 10s");
|
||||
await Task.Delay(10000);
|
||||
|
||||
// "/client/match/local/start"
|
||||
// Call server with new map name in LocalRaidSettings
|
||||
Utils.LogInfo($"[Dumpy] Getting loot for {map}");
|
||||
var localRaidSettings = DataHelper.Session.GetType().GetMethod("LocalRaidStarted")
|
||||
.Invoke(DataHelper.Session, new[] { DataHelper.LocalRaidSettings });
|
||||
// Await the task
|
||||
await (Task)localRaidSettings;
|
||||
// Get the result
|
||||
var result = localRaidSettings.GetType().GetProperty("Result").GetValue(localRaidSettings);
|
||||
// get the string from the result
|
||||
var result2 = (string)result.GetType().GetField("serverId").GetValue(result);
|
||||
// set that to our LocalRaidSettings object
|
||||
DataHelper.LocalRaidSettings.GetType().GetField("serverId").SetValue(DataHelper.LocalRaidSettings, result2);
|
||||
|
||||
// Artificial wait to hopefully keep BSG off our toes
|
||||
Utils.LogInfo("Waiting 10s");
|
||||
await Task.Delay(10000);
|
||||
|
||||
// "/client/game/bot/generate"
|
||||
// Call server with bot wave data
|
||||
Utils.LogInfo($"[Dumpy] Getting Bot Data");
|
||||
await (Task)DataHelper.Session.GetType().GetMethod("LoadBots")
|
||||
.Invoke(DataHelper.Session, new[] { DataHelper.WaveSettings });
|
||||
|
||||
// Artificial wait to hopefully keep BSG off our toes
|
||||
Utils.LogInfo("Waiting 10s");
|
||||
await Task.Delay(10000);
|
||||
|
||||
var emptyArray = ReflectionHelper.CreateGenericMethod(typeof(Array).GetMethod("Empty"), TypeHelper.GetJsonTokenCreateType())
|
||||
.Invoke(null, null);
|
||||
Utils.LogInfo($"[Dumpy] Sending local raid ended");
|
||||
await (Task)DataHelper.Session.GetType().GetMethod("LocalRaidEnded")
|
||||
.Invoke(DataHelper.Session, new object[]
|
||||
{
|
||||
DataHelper.LocalRaidSettings,
|
||||
DataHelper.EndRaidClass,
|
||||
emptyArray,
|
||||
Activator.CreateInstance(ReflectionHelper.CreateGenericType(TypeHelper.GetDictionaryType(), typeof(string),
|
||||
emptyArray.GetType()))
|
||||
});
|
||||
|
||||
// after, reset LocalRaidSettings.serverId to null;
|
||||
DataHelper.LocalRaidSettings.GetType().GetField("serverId").SetValue(DataHelper.LocalRaidSettings, null);
|
||||
|
||||
await Task.Delay(DataHelper.ConfigSettings.SptTimings.SingleIterationDelayMs);
|
||||
}
|
||||
else
|
||||
|
||||
var controller = DataHelper.MainMenuController.GetValue(DataHelper.TarkovApp);
|
||||
if (controller != null)
|
||||
{
|
||||
Utils.LogInfo($"Dumpy iteration number: {DataHelper.Iteration}");
|
||||
foreach (var map in DataHelper.ConfigSettings.MapNames)
|
||||
{
|
||||
// Set location in the RaidSettings object
|
||||
Utils.LogInfo($"[Dumpy] Setting LocalRaidSettings location to: {map}");
|
||||
DataHelper.LocalRaidSettings.GetType().GetField("location")
|
||||
.SetValue(DataHelper.LocalRaidSettings, map);
|
||||
|
||||
// Set location in the RaidConfig object
|
||||
Utils.LogInfo($"[Dumpy] Setting RaidSettings location to: {map}");
|
||||
DataHelper.RaidSettings.GetType().GetProperty("SelectedLocation")
|
||||
.SetValue(DataHelper.RaidSettings, ReflectionHelper.CheckLocationID(map));
|
||||
|
||||
// "/client/raid/configuration"
|
||||
// Call server with new map name in RaidSettings
|
||||
Utils.LogInfo($"[Dumpy] Sending RaidConfig");
|
||||
await (Task)DataHelper.Session.GetType().GetMethod("SendRaidSettings")
|
||||
.Invoke(DataHelper.Session, new[] { DataHelper.RaidSettings });
|
||||
|
||||
// Artificial wait to hopefully keep BSG off our toes
|
||||
Utils.LogInfo("Waiting 10s");
|
||||
await Task.Delay(10000);
|
||||
|
||||
// "/client/match/local/start"
|
||||
// Call server with new map name in LocalRaidSettings
|
||||
Utils.LogInfo($"[Dumpy] Getting loot for {map}");
|
||||
var localRaidSettings = DataHelper.Session.GetType().GetMethod("LocalRaidStarted")
|
||||
.Invoke(DataHelper.Session, new[] { DataHelper.LocalRaidSettings });
|
||||
// Await the task
|
||||
await (Task)localRaidSettings;
|
||||
// Get the result
|
||||
var result = localRaidSettings.GetType().GetProperty("Result").GetValue(localRaidSettings);
|
||||
// get the string from the result
|
||||
var result2 = (string)result.GetType().GetField("serverId").GetValue(result);
|
||||
// set that to our LocalRaidSettings object
|
||||
DataHelper.LocalRaidSettings.GetType().GetField("serverId").SetValue(DataHelper.LocalRaidSettings, result2);
|
||||
|
||||
// Artificial wait to hopefully keep BSG off our toes
|
||||
Utils.LogInfo("Waiting 10s");
|
||||
await Task.Delay(10000);
|
||||
|
||||
// "/client/game/bot/generate"
|
||||
// Call server with bot wave data
|
||||
Utils.LogInfo($"[Dumpy] Getting Bot Data");
|
||||
await (Task)DataHelper.Session.GetType().GetMethod("LoadBots")
|
||||
.Invoke(DataHelper.Session, new[] { DataHelper.WaveSettings });
|
||||
|
||||
// Artificial wait to hopefully keep BSG off our toes
|
||||
Utils.LogInfo("Waiting 10s");
|
||||
await Task.Delay(10000);
|
||||
|
||||
var emptyArray = ReflectionHelper.CreateGenericMethod(typeof(Array).GetMethod("Empty"), TypeHelper.GetJsonTokenCreateType())
|
||||
.Invoke(null, null);
|
||||
Utils.LogInfo($"[Dumpy] Sending local raid ended");
|
||||
await (Task)DataHelper.Session.GetType().GetMethod("LocalRaidEnded")
|
||||
.Invoke(DataHelper.Session, new object[]
|
||||
{
|
||||
DataHelper.LocalRaidSettings,
|
||||
DataHelper.EndRaidClass,
|
||||
emptyArray,
|
||||
Activator.CreateInstance(ReflectionHelper.CreateGenericType(TypeHelper.GetDictionaryType(), typeof(string),
|
||||
emptyArray.GetType()))
|
||||
});
|
||||
|
||||
// after, reset LocalRaidSettings.serverId to null;
|
||||
DataHelper.LocalRaidSettings.GetType().GetField("serverId").SetValue(DataHelper.LocalRaidSettings, null);
|
||||
|
||||
await Task.Delay(DataHelper.ConfigSettings.SptTimings.SingleIterationDelayMs);
|
||||
}
|
||||
|
||||
DataHelper.Iteration++;
|
||||
controller.GetType().GetMethod("StopAfkMonitor").Invoke(controller, null);
|
||||
}
|
||||
|
||||
Utils.LogInfo($"[Dumpy] Restarting Loop in {DataHelper.ConfigSettings.SptTimings.AllIterationDelayMs}ms");
|
||||
await Task.Delay(DataHelper.ConfigSettings.SptTimings.AllIterationDelayMs);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -208,7 +198,8 @@ namespace DumpLib
|
||||
{
|
||||
if (reqParams != null)
|
||||
{
|
||||
File.WriteAllText($@"{path}req.{file}\\req.{file}_{time}_{DataHelper.ConfigSettings.Name}.json", JsonConvert.SerializeObject(reqParams));
|
||||
File.WriteAllText($@"{path}req.{file}\\req.{file}_{time}_{DataHelper.ConfigSettings.Name}.json",
|
||||
JsonConvert.SerializeObject(reqParams));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@ public static class DataHelper
|
||||
|
||||
public static SptConfigClass ConfigSettings = GetSptConfig();
|
||||
|
||||
public static int Iteration = 1;
|
||||
public static bool GotBackend = false;
|
||||
public static object WaveSettings = null;
|
||||
public static object LocalRaidSettings = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user