0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-12 15:10:44 -05:00

Merge master into 310-dev in prep for merge into master (#5)

This synchronizes 310-dev with the later changes in master, resulting in
a clean merge of 310-dev into master

Supersedes #4 as that PR was missing a variable used elsewhere in the
codebase (Sorry Archangel!)
This commit is contained in:
Chomp 2024-11-27 09:19:54 +00:00 committed by GitHub
commit ed418d2884
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 60 additions and 9 deletions

View File

@ -13,6 +13,7 @@ SPT.Debugging | Debug utilities (disabled in release builds)
SPT.Reflection | Reflection utilities used across the project
SPT.SinglePlayer | Simulating online game while offline
## Privacy
SPT is an open source project. Your commit credentials as author of a commit will be visible by anyone. Please make sure you understand this before submitting a PR.
Feel free to use a "fake" username and email on your commits by using the following commands:
@ -21,6 +22,7 @@ git config --local user.name "USERNAME"
git config --local user.email "USERNAME@SOMETHING.com"
```
## Requirements
- Escape From Tarkov 33420
- Visual Studio Code -OR- Visual Studio 2022

View File

@ -7,7 +7,8 @@ namespace SPT.Core.Utils
public static class ValidationUtil
{
public static string _crashHandler = "0";
private static bool _hasRun = false;
public static bool Validate()
{
const string c0 = @"Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\EscapeFromTarkov";
@ -29,11 +30,15 @@ namespace SPT.Core.Utils
new FileInfo(Path.Combine(v2, "UnityCrashHandler64.exe"))
};
_crashHandler = Gfs(v2, "UnityCrashHandler64.exe")?.Length.ToString() ?? "0";
ServerLog.Debug("SPT.Core", _crashHandler);
ServerLog.Debug("SPT.Core", Gfs(v2, "Uninstall.exe")?.Length.ToString() ?? "0");
ServerLog.Debug("SPT.Core", Gfs(v2, "Register.bat")?.Length.ToString() ?? "0");
if (!_hasRun)
{
_crashHandler = Gfs(v2, "UnityCrashHandler64.exe")?.Length.ToString() ?? "0";
ServerLog.Debug("SPT.Core", _crashHandler);
ServerLog.Debug("SPT.Core", Gfs(v2, "Uninstall.exe")?.Length.ToString() ?? "0");
ServerLog.Debug("SPT.Core", Gfs(v2, "Register.bat")?.Length.ToString() ?? "0");
_hasRun = true;
}
v0 = v4.Length - 1;
foreach (var value in v4)

View File

@ -1,4 +1,5 @@
using EFT;
using System.Collections.Generic;
namespace SPT.Custom.CustomAI
{
@ -33,5 +34,44 @@ namespace SPT.Custom.CustomAI
var nicknameContainsPScvCharacter = botOwner.Profile.Info.Nickname?.Contains("(");
return nicknameContainsPScvCharacter.HasValue && nicknameContainsPScvCharacter.Value && role == WildSpawnType.assault;
}
public static List<BotOwner> GetAllMembers(this BotsGroup group)
{
List<BotOwner> members = new List<BotOwner>();
if (group != null)
{
for (int m = 0; m < group.MembersCount; m++)
{
members.Add(group.Member(m));
}
}
return members;
}
/// <summary>
/// Returns true if the player is found in the collection by searching for matching player Id's
/// </summary>
/// <param name="players"></param>
/// <param name="playerToCheck"></param>
/// <returns></returns>
public static bool ContainsPlayer(this IEnumerable<IPlayer> players, IPlayer playerToCheck)
{
if (playerToCheck == null)
{
return false;
}
foreach (IPlayer player in players)
{
if (player != null && player.Id == playerToCheck.Id)
{
return true;
}
}
return false;
}
}
}

View File

@ -95,9 +95,12 @@ namespace SPT.Custom.Patches
path = BundleManager.GetBundlePath(bundleInfo);
// only download when connected externally
if (await BundleManager.ShouldReaquire(bundleInfo))
if (await BundleManager.ShouldAcquire(bundleInfo))
{
VFS.DeleteFile(BundleManager.GetBundleFilePath(bundleInfo));
if (VFS.Exists(BundleManager.GetBundleFilePath(bundleInfo)))
{
VFS.DeleteFile(BundleManager.GetBundleFilePath(bundleInfo));
}
await BundleManager.DownloadBundle(bundleInfo);
}

View File

@ -51,7 +51,8 @@ namespace SPT.Custom.Utils
await VFS.WriteFileAsync(filepath, data);
}
public static async Task<bool> ShouldReaquire(BundleItem bundle)
// Handles both the check for initially acquiring and also re-acquiring a file.
public static async Task<bool> ShouldAcquire(BundleItem bundle)
{
// read cache
var filepath = GetBundleFilePath(bundle);