0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:50:43 -05:00

Improved maxbotpatch to pass the map location being requested

This commit is contained in:
Dev 2024-05-31 22:00:29 +01:00
parent 43c8ba5418
commit 599b5ec520

View File

@ -1,3 +1,5 @@
using Comfort.Common;
using EFT;
using SPT.Common.Http;
using SPT.Reflection.Patching;
using SPT.Reflection.Utils;
@ -35,7 +37,10 @@ namespace SPT.SinglePlayer.Patches.RaidFix
[PatchPrefix]
private static void PatchPreFix(ref int maxCount)
{
if (int.TryParse(RequestHandler.GetJson("/singleplayer/settings/bot/maxCap"), out int parsedMaxCount))
var gameWorld = Singleton<GameWorld>.Instance;
var location = gameWorld.MainPlayer.Location;
if (int.TryParse(RequestHandler.GetJson($"/singleplayer/settings/bot/maxCap/{location ?? "default"}"), out int parsedMaxCount))
{
Logger.LogWarning($"Set max bot cap to: {parsedMaxCount}");
maxCount = parsedMaxCount;