0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 05:10:45 -05:00
Co-authored-by: Dev <dev@dev.sp-tarkov.com>
Co-authored-by: Kaeno <kaeno@noreply.dev.sp-tarkov.com>
Reviewed-on: SPT/Modules#137
This commit is contained in:
chomp 2024-06-07 18:25:19 +00:00
parent b6aeea95a2
commit 6897879c69
14 changed files with 32 additions and 47 deletions

View File

@ -22,7 +22,7 @@ git config --local user.email "USERNAME@SOMETHING.com"
``` ```
## Requirements ## Requirements
- Escape From Tarkov 30268 - Escape From Tarkov 30473
- Visual Studio Code -OR- Visual Studio 2022 - Visual Studio Code -OR- Visual Studio 2022
- .NET 6 SDK - .NET 6 SDK
- [PowerShell v7](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows) - [PowerShell v7](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows)

View File

@ -6,7 +6,7 @@ using EFT.Vehicle;
using HarmonyLib; using HarmonyLib;
using System; using System;
using System.Reflection; using System.Reflection;
using BTRDialog = EFT.UI.TraderDialogScreen.GClass3152; using BTRDialog = EFT.UI.TraderDialogScreen.GClass3156;
namespace SPT.Custom.BTR.Patches namespace SPT.Custom.BTR.Patches
{ {

View File

@ -31,7 +31,7 @@ namespace SPT.Custom.Patches
var player = Singleton<GameWorld>.Instance.MainPlayer; var player = Singleton<GameWorld>.Instance.MainPlayer;
if (profileId == player?.Profile.Id) if (profileId == player?.Profile.Id)
{ {
GClass3126.Instance.CloseAllScreensForced(); GClass3130.Instance.CloseAllScreensForced();
} }
return true; return true;

View File

@ -18,7 +18,7 @@ namespace SPT.Custom.Patches
protected override MethodBase GetTargetMethod() protected override MethodBase GetTargetMethod()
{ {
return AccessTools.Method(typeof(ProfileEndpointFactoryAbstractClass), nameof(ProfileEndpointFactoryAbstractClass.method_19)); return AccessTools.Method(typeof(ProfileEndpointFactoryAbstractClass), nameof(ProfileEndpointFactoryAbstractClass.method_26));
} }
[PatchPrefix] [PatchPrefix]

View File

@ -9,11 +9,11 @@ namespace SPT.Custom.Patches
{ {
protected override MethodBase GetTargetMethod() protected override MethodBase GetTargetMethod()
{ {
return AccessTools.Method(typeof(Class1492), nameof(Class1492.method_0)); return AccessTools.Method(typeof(Class1496), nameof(Class1496.method_0));
} }
[PatchPostfix] [PatchPostfix]
private static void PatchPostfix(Class1492 __instance, bool successful) private static void PatchPostfix(Class1496 __instance, bool successful)
{ {
if (!successful) if (!successful)
{ {

View File

@ -15,15 +15,17 @@ namespace SPT.Custom.Patches
[PatchPrefix] [PatchPrefix]
private static void PatchPrefix(BotOwner bot) private static void PatchPrefix(BotOwner bot)
{ {
if (bot.SpawnProfileData.SpawnParams != null if (bot.Profile.Info.Settings.Role == WildSpawnType.pmcBEAR || bot.Profile.Info.Settings.Role == WildSpawnType.pmcUSEC)
&& (bot.Profile.Info.Settings.Role != WildSpawnType.pmcBEAR || bot.Profile.Info.Settings.Role != WildSpawnType.pmcUSEC))
{ {
return; if (bot.SpawnProfileData.SpawnParams == null)
{
bot.SpawnProfileData.SpawnParams = new BotSpawnParams();
}
if (bot.SpawnProfileData.SpawnParams.ShallBeGroup == null)
{
bot.SpawnProfileData.SpawnParams.ShallBeGroup = new ShallBeGroupParams(false, false);
}
} }
// Add SpawnParams to PMC bots that are missing them
bot.SpawnProfileData.SpawnParams = new BotSpawnParams();
bot.SpawnProfileData.SpawnParams.ShallBeGroup = new ShallBeGroupParams(false, false);
} }
} }
} }

View File

@ -17,8 +17,8 @@ namespace SPT.Custom.Patches
public RagfairFeePatch() public RagfairFeePatch()
{ {
// Remember to update prefix parameter if below lines are broken // Remember to update prefix parameter if below lines are broken
_ = nameof(GClass3086.IsAllSelectedItemSame); _ = nameof(GClass3090.IsAllSelectedItemSame);
_ = nameof(GClass3086.AutoSelectSimilar); _ = nameof(GClass3090.AutoSelectSimilar);
} }
protected override MethodBase GetTargetMethod() protected override MethodBase GetTargetMethod()
@ -34,14 +34,14 @@ namespace SPT.Custom.Patches
/// <param name="___double_0">RequirementsPrice</param> /// <param name="___double_0">RequirementsPrice</param>
/// <param name="___bool_0">SellInOnePiece</param> /// <param name="___bool_0">SellInOnePiece</param>
[PatchPrefix] [PatchPrefix]
private static void PatchPrefix(ref Item ___item_0, ref GClass3086 ___gclass3086_0, ref double ___double_0, ref bool ___bool_0) private static void PatchPrefix(ref Item ___item_0, ref GClass3090 ___gclass3090_0, ref double ___double_0, ref bool ___bool_0)
{ {
RequestHandler.PutJson("/client/ragfair/offerfees", new RequestHandler.PutJson("/client/ragfair/offerfees", new
{ {
id = ___item_0.Id, id = ___item_0.Id,
tpl = ___item_0.TemplateId, tpl = ___item_0.TemplateId,
count = ___gclass3086_0.OfferItemCount, count = ___gclass3090_0.OfferItemCount,
fee = Mathf.CeilToInt((float)GClass2102.CalculateTaxPrice(___item_0, ___gclass3086_0.OfferItemCount, ___double_0, ___bool_0)) fee = Mathf.CeilToInt((float)GClass2104.CalculateTaxPrice(___item_0, ___gclass3090_0.OfferItemCount, ___double_0, ___bool_0))
}.ToJson()); }.ToJson());
} }
} }

View File

@ -5,7 +5,7 @@ using EFT;
using EFT.UI; using EFT.UI;
using HarmonyLib; using HarmonyLib;
using System.Reflection; using System.Reflection;
using DialogControlClass = GClass1970; using DialogControlClass = GClass1972;
namespace SPT.Debugging.Patches namespace SPT.Debugging.Patches
{ {

View File

@ -20,7 +20,7 @@ namespace SPT.Debugging.Patches
public SptSpawnHelper() public SptSpawnHelper()
{ {
IEnumerable<ISpawnPoint> locationSpawnPoints = GClass2945.CreateFromScene(); IEnumerable<ISpawnPoint> locationSpawnPoints = GClass2948.CreateFromScene();
var playerSpawns = locationSpawnPoints.Where(x => x.Categories.HasFlag(ESpawnCategoryMask.Player)).ToList(); var playerSpawns = locationSpawnPoints.Where(x => x.Categories.HasFlag(ESpawnCategoryMask.Player)).ToList();
this.playerSpawnPoints = locationSpawnPoints.Where(x => x.Categories.HasFlag(ESpawnCategoryMask.Player)).ToList(); this.playerSpawnPoints = locationSpawnPoints.Where(x => x.Categories.HasFlag(ESpawnCategoryMask.Player)).ToList();

View File

@ -124,7 +124,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode
.Single(field => field.FieldType == typeof(MatchmakerPlayerControllerClass)) .Single(field => field.FieldType == typeof(MatchmakerPlayerControllerClass))
?.GetValue(menuController) as MatchmakerPlayerControllerClass; ?.GetValue(menuController) as MatchmakerPlayerControllerClass;
var gclass = new MatchmakerOfflineRaidScreen.GClass3177(profile?.Info, ref raidSettings, matchmakerPlayersController, ESessionMode.Regular); var gclass = new MatchmakerOfflineRaidScreen.GClass3181(profile?.Info, ref raidSettings, matchmakerPlayersController, ESessionMode.Regular);
gclass.OnShowNextScreen += LoadOfflineRaidNextScreen; gclass.OnShowNextScreen += LoadOfflineRaidNextScreen;

View File

@ -13,7 +13,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode
protected override MethodBase GetTargetMethod() protected override MethodBase GetTargetMethod()
{ {
// Correct Gclass has sessionCounters // Correct Gclass has sessionCounters
return AccessTools.Method(typeof(GClass1800), nameof(GClass1800.OnEnemyKill)); return AccessTools.Method(typeof(GClass1801), nameof(GClass1801.OnEnemyKill));
} }
[PatchPrefix] [PatchPrefix]

View File

@ -22,33 +22,16 @@ namespace SPT.SinglePlayer.Patches.ScavMode
protected override MethodBase GetTargetMethod() protected override MethodBase GetTargetMethod()
{ {
// We want to find a type that contains `SellAllFromSavage` but doesn't extend from `IBackendStatus` _sendOperationMethod = AccessTools.Method(typeof(ProfileEndpointFactoryAbstractClass), nameof(ProfileEndpointFactoryAbstractClass.SendOperationRightNow));
Type targetType = PatchConstants.EftTypes.SingleCustom(IsTargetType);
Logger.LogDebug($"{this.GetType().Name} Type: {targetType?.Name}"); // NEEDS FIXING
return AccessTools.Method(typeof(ProfileEndpointFactoryAbstractClass), nameof(ProfileEndpointFactoryAbstractClass.SellAllFromSavage));
// So we can call "SendOperationRightNow" without directly referencing a GClass
_sendOperationMethod = AccessTools.Method(targetType, "SendOperationRightNow");
return AccessTools.Method(targetType, TargetMethodName);
}
private bool IsTargetType(Type type)
{
// Isn't an interface, isn't part of the dummy class, and contains our target method
if (!type.IsInterface
&& type.DeclaringType != typeof(BackendDummyClass)
&& type.GetMethod(TargetMethodName) != null)
{
return true;
}
return false;
} }
[PatchPrefix] [PatchPrefix]
private static bool PatchPrefix(object __instance, ref Task<IResult> __result, string playerId, string petId) private static bool PatchPrefix(ProfileEndpointFactoryAbstractClass __instance, ref Task<IResult> __result, string playerId, string petId)
{ {
// Build request with additional information // Build request with additional information
OwnerInfo fromOwner = new OwnerInfo OwnerInfo fromOwner = new OwnerInfo
{ {

View File

@ -10,9 +10,9 @@ using System.Linq;
using System.Reflection; using System.Reflection;
using UnityEngine; using UnityEngine;
using static BackendConfigSettingsClass; using static BackendConfigSettingsClass;
using TraderServiceClass = GClass1804; using TraderServiceClass = GClass1805;
using QuestDictClass = GClass2144<string>; using QuestDictClass = GClass2146<string>;
using StandingListClass = GClass2146<float>; using StandingListClass = GClass2148<float>;
namespace SPT.SinglePlayer.Utils.TraderServices namespace SPT.SinglePlayer.Utils.TraderServices
{ {

Binary file not shown.