mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 01:50:45 -05:00
Feature: new-remapper (!143)
Co-authored-by: Dev <dev@dev.sp-tarkov.com> Reviewed-on: SPT/Modules#143
This commit is contained in:
parent
f10742586c
commit
ffde317c59
@ -1,5 +1,5 @@
|
||||
using HarmonyLib;
|
||||
using SPT.Reflection.Patching;
|
||||
using SPT.Reflection.Utils;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
@ -9,10 +9,7 @@ namespace SPT.Core.Patches
|
||||
{
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
var targetInterface = PatchConstants.EftTypes.SingleCustom(x => x == typeof(IConnectionHandler) && x.IsInterface);
|
||||
var typeThatMatches = PatchConstants.EftTypes.SingleCustom(x => targetInterface.IsAssignableFrom(x) && x.IsAbstract && !x.IsInterface);
|
||||
|
||||
return typeThatMatches.GetMethods(BindingFlags.Public | BindingFlags.Instance).SingleCustom(x => x.ReturnType == typeof(Uri));
|
||||
return AccessTools.Method(typeof(UriParamsClass), nameof(UriParamsClass.method_0));
|
||||
}
|
||||
|
||||
// This is a pass through postfix and behaves a little differently than usual
|
||||
|
@ -8,7 +8,7 @@ namespace SPT.Custom.BTR
|
||||
{
|
||||
public override bool IsStatic => false;
|
||||
|
||||
public override void AddPenalty(GInterface106 player)
|
||||
public override void AddPenalty(IPlayerOwner player)
|
||||
{
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ namespace SPT.Custom.BTR
|
||||
{
|
||||
}
|
||||
|
||||
public override void ProceedDamage(GInterface106 player, BodyPartCollider bodyPart)
|
||||
public override void ProceedDamage(IPlayerOwner player, BodyPartCollider bodyPart)
|
||||
{
|
||||
bodyPart.ApplyInstantKill(new DamageInfo()
|
||||
{
|
||||
@ -31,7 +31,7 @@ namespace SPT.Custom.BTR
|
||||
});
|
||||
}
|
||||
|
||||
public override void RemovePenalty(GInterface106 player)
|
||||
public override void RemovePenalty(IPlayerOwner player)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ using EFT.Vehicle;
|
||||
using HarmonyLib;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using BTRDialog = EFT.UI.TraderDialogScreen.GClass3157;
|
||||
using BTRDialog = EFT.UI.TraderDialogScreen.BTRDialogClass;
|
||||
|
||||
namespace SPT.Custom.BTR.Patches
|
||||
{
|
||||
|
@ -1,5 +1,4 @@
|
||||
using SPT.PrePatch;
|
||||
using EFT;
|
||||
using EFT;
|
||||
|
||||
namespace SPT.Custom.CustomAI
|
||||
{
|
||||
|
@ -3,7 +3,6 @@ using EFT;
|
||||
using System;
|
||||
using Comfort.Common;
|
||||
using System.Reflection;
|
||||
using SPT.PrePatch;
|
||||
using SPT.Custom.CustomAI;
|
||||
using HarmonyLib;
|
||||
|
||||
|
@ -31,7 +31,7 @@ namespace SPT.Custom.Patches
|
||||
var player = Singleton<GameWorld>.Instance.MainPlayer;
|
||||
if (profileId == player?.Profile.Id)
|
||||
{
|
||||
GClass3131.Instance.CloseAllScreensForced();
|
||||
CurrentScreenSingleton.Instance.CloseAllScreensForced();
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -22,6 +22,13 @@ namespace SPT.Custom.Patches
|
||||
[PatchPrefix]
|
||||
private static bool PatchPrefix(ref bool __result, BotsGroup __instance, IPlayer requester)
|
||||
{
|
||||
if (requester == null)
|
||||
{
|
||||
__result = false;
|
||||
|
||||
return false; // Skip original
|
||||
}
|
||||
|
||||
if (__instance.InitialBotType == WildSpawnType.peacefullZryachiyEvent
|
||||
|| __instance.InitialBotType == WildSpawnType.shooterBTR
|
||||
|| __instance.InitialBotType == WildSpawnType.gifter
|
||||
|
@ -2,6 +2,8 @@ using SPT.Reflection.Patching;
|
||||
using SPT.Reflection.Utils;
|
||||
using System.Reflection;
|
||||
using EFT;
|
||||
using HarmonyLib;
|
||||
using System.Linq;
|
||||
|
||||
namespace SPT.Custom.Patches
|
||||
{
|
||||
|
@ -1,5 +1,4 @@
|
||||
using SPT.PrePatch;
|
||||
using SPT.Reflection.Patching;
|
||||
using SPT.Reflection.Patching;
|
||||
using SPT.Reflection.Utils;
|
||||
using EFT;
|
||||
using System;
|
||||
|
@ -17,8 +17,8 @@ namespace SPT.Custom.Patches
|
||||
public RagfairFeePatch()
|
||||
{
|
||||
// Remember to update prefix parameter if below lines are broken
|
||||
_ = nameof(GClass3091.IsAllSelectedItemSame);
|
||||
_ = nameof(GClass3091.AutoSelectSimilar);
|
||||
_ = nameof(RagfairOfferSellHelperClass.IsAllSelectedItemSame);
|
||||
_ = nameof(RagfairOfferSellHelperClass.AutoSelectSimilar);
|
||||
}
|
||||
|
||||
protected override MethodBase GetTargetMethod()
|
||||
@ -34,14 +34,14 @@ namespace SPT.Custom.Patches
|
||||
/// <param name="___double_0">RequirementsPrice</param>
|
||||
/// <param name="___bool_0">SellInOnePiece</param>
|
||||
[PatchPrefix]
|
||||
private static void PatchPrefix(ref Item ___item_0, ref GClass3091 ___gclass3091_0, ref double ___double_0, ref bool ___bool_0)
|
||||
private static void PatchPrefix(ref Item ___item_0, ref RagfairOfferSellHelperClass ___ragfairOfferSellHelperClass, ref double ___double_0, ref bool ___bool_0)
|
||||
{
|
||||
RequestHandler.PutJson("/client/ragfair/offerfees", new
|
||||
{
|
||||
id = ___item_0.Id,
|
||||
tpl = ___item_0.TemplateId,
|
||||
count = ___gclass3091_0.OfferItemCount,
|
||||
fee = Mathf.CeilToInt((float)GClass2105.CalculateTaxPrice(___item_0, ___gclass3091_0.OfferItemCount, ___double_0, ___bool_0))
|
||||
count = ___ragfairOfferSellHelperClass.OfferItemCount,
|
||||
fee = Mathf.CeilToInt((float)FleaTaxCalculatorAbstractClass.CalculateTaxPrice(___item_0, ___ragfairOfferSellHelperClass.OfferItemCount, ___double_0, ___bool_0))
|
||||
}.ToJson());
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@ using EFT;
|
||||
using EFT.UI;
|
||||
using HarmonyLib;
|
||||
using System.Reflection;
|
||||
using DialogControlClass = GClass1973;
|
||||
|
||||
namespace SPT.Debugging.Patches
|
||||
{
|
||||
@ -20,7 +19,7 @@ namespace SPT.Debugging.Patches
|
||||
[PatchPostfix]
|
||||
internal static void PatchPostfix()
|
||||
{
|
||||
ConsoleScreen.Processor.RegisterCommandGroup<DialogControlClass>();
|
||||
ConsoleScreen.Processor.RegisterCommandGroup<TraderDialogInteractionScreenClass>();
|
||||
ConsoleScreen.Processor.RegisterCommand("btr_deliver_items", new System.Action(BtrDeliverItemsCommand));
|
||||
}
|
||||
|
||||
@ -36,7 +35,7 @@ namespace SPT.Debugging.Patches
|
||||
{
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
return AccessTools.Method(typeof(DialogControlClass), nameof(DialogControlClass.ShowDialogScreen));
|
||||
return AccessTools.Method(typeof(TraderDialogInteractionScreenClass), nameof(TraderDialogInteractionScreenClass.ShowDialogScreen));
|
||||
}
|
||||
|
||||
[PatchPrefix]
|
||||
|
@ -9,7 +9,6 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using ExitSettingsClass = GClass1234;
|
||||
|
||||
namespace SPT.Debugging.Patches
|
||||
{
|
||||
@ -23,7 +22,7 @@ namespace SPT.Debugging.Patches
|
||||
}
|
||||
|
||||
[PatchPostfix]
|
||||
public static void PatchPreFix(ExitSettingsClass[] settings)
|
||||
public static void PatchPreFix(LocationExitClass[] settings)
|
||||
{
|
||||
var gameWorld = Singleton<GameWorld>.Instance;
|
||||
string mapName = gameWorld.MainPlayer.Location.ToLower();
|
||||
@ -37,7 +36,7 @@ namespace SPT.Debugging.Patches
|
||||
|
||||
foreach (var exfil in pmcExfilPoints.Concat(scavExfilPoints))
|
||||
{
|
||||
ExitSettingsClass exitSettings = settings.FirstOrDefault(x => x.Name == exfil.Settings.Name);
|
||||
LocationExitClass exitSettings = settings.FirstOrDefault(x => x.Name == exfil.Settings.Name);
|
||||
exfils.Add(new SPTExfilData(exfil, exitSettings));
|
||||
}
|
||||
|
||||
@ -73,7 +72,7 @@ namespace SPT.Debugging.Patches
|
||||
public string RequirementTip = "";
|
||||
public string Side = "";
|
||||
|
||||
public SPTExfilData(ExfiltrationPoint point, ExitSettingsClass settings)
|
||||
public SPTExfilData(ExfiltrationPoint point, LocationExitClass settings)
|
||||
{
|
||||
// PMC and shared extracts, prioritize settings over the map data to match base behaviour
|
||||
if (settings != null && (!(point is ScavExfiltrationPoint) || point is SharedExfiltrationPoint))
|
||||
|
@ -20,7 +20,7 @@ namespace SPT.Debugging.Patches
|
||||
|
||||
public SptSpawnHelper()
|
||||
{
|
||||
IEnumerable<ISpawnPoint> locationSpawnPoints = GClass2949.CreateFromScene();
|
||||
IEnumerable<ISpawnPoint> locationSpawnPoints = SpawnPointManagerClass.CreateFromScene();
|
||||
|
||||
var playerSpawns = locationSpawnPoints.Where(x => x.Categories.HasFlag(ESpawnCategoryMask.Player)).ToList();
|
||||
this.playerSpawnPoints = locationSpawnPoints.Where(x => x.Categories.HasFlag(ESpawnCategoryMask.Player)).ToList();
|
||||
@ -61,7 +61,7 @@ namespace SPT.Debugging.Patches
|
||||
}
|
||||
|
||||
[PatchPrefix]
|
||||
public static bool PatchPrefix(GClass1483 __instance, GClass591 data)
|
||||
public static bool PatchPrefix(GClass1483 __instance, BotCreationDataClass data)
|
||||
{
|
||||
var firstBotRole = data.Profiles[0].Info.Settings.Role;
|
||||
if (firstBotRole != WildSpawnType.pmcBEAR || firstBotRole != WildSpawnType.pmcUSEC)
|
||||
|
@ -120,14 +120,14 @@ namespace SPT.SinglePlayer.Models.Progression
|
||||
/// <summary>
|
||||
/// Set all brdige mines to desire state
|
||||
/// </summary>
|
||||
/// <param name="active">What state mines should be</param>
|
||||
private void SetBridgeMinesStatus(bool active)
|
||||
/// <param name="desiredMineState">What state should bridge mines be set to</param>
|
||||
private void SetBridgeMinesStatus(bool desiredMineState)
|
||||
{
|
||||
|
||||
// Find mines with opposite state of what we want
|
||||
foreach (var mine in _bridgeMines.Where(mine => mine.gameObject.activeSelf == !active && mine.transform.parent.gameObject.name == "Directional_mines_LHZONE"))
|
||||
var mines = _bridgeMines.Where(mine => mine.gameObject.activeSelf == !desiredMineState && mine.transform.parent.gameObject.name == "Directional_mines_LHZONE");
|
||||
foreach (var mine in mines)
|
||||
{
|
||||
mine.gameObject.SetActive(active);
|
||||
mine.gameObject.SetActive(desiredMineState);
|
||||
}
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@ namespace SPT.SinglePlayer.Models.Progression
|
||||
/// </summary>
|
||||
private void SetupZryachiyAndFollowerHostility()
|
||||
{
|
||||
// only process non-players (ai)
|
||||
// Only process non-players (ai)
|
||||
foreach (var aiBot in _gameWorld.AllAlivePlayersList.Where(x => !x.IsYourPlayer))
|
||||
{
|
||||
// Bots that die on mounted guns get stuck in AllAlivePlayersList, need to check health
|
||||
@ -150,16 +150,7 @@ namespace SPT.SinglePlayer.Models.Progression
|
||||
if (aiBot.AIData.BotOwner.IsRole(WildSpawnType.bossZryachiy) || aiBot.AIData.BotOwner.IsRole(WildSpawnType.followerZryachiy))
|
||||
{
|
||||
// Subscribe to bots OnDeath event
|
||||
aiBot.OnPlayerDeadOrUnspawn += player1 =>
|
||||
{
|
||||
// If player kills zryachiy or follower, force aggressor state
|
||||
// Also set players Lk standing to negative (allows access to quest chain (Making Amends))
|
||||
if (player1?.KillerId == _player?.ProfileId)
|
||||
{
|
||||
_aggressor = true;
|
||||
_player?.Profile.TradersInfo[_lightKeeperTid].SetStanding(-0.01);
|
||||
}
|
||||
};
|
||||
aiBot.OnPlayerDeadOrUnspawn += OnZryachiyOrFollowerDeath;
|
||||
|
||||
// Save bot to list for later access
|
||||
if (!_zryachiyAndFollowers.Contains(aiBot))
|
||||
@ -170,6 +161,22 @@ namespace SPT.SinglePlayer.Models.Progression
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set aggression + standing loss when Zryachiy/follower is killed by player
|
||||
/// </summary>
|
||||
/// <param name="player">The player who killed Zryachiy/follower.</param>
|
||||
private void OnZryachiyOrFollowerDeath(Player player)
|
||||
{
|
||||
// Check if zryachiy/follower was killed by player
|
||||
if (player?.KillerId == _player?.ProfileId)
|
||||
{
|
||||
// If player kills zryachiy or follower, force aggressor state
|
||||
// Also set players Lk standing to negative (allows access to quest chain (Making Amends))
|
||||
_aggressor = true;
|
||||
_player?.Profile.TradersInfo[_lightKeeperTid].SetStanding(-0.01);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disable door + set transmitter to 'red'
|
||||
/// </summary>
|
||||
|
@ -44,7 +44,7 @@ namespace SPT.SinglePlayer.Patches.RaidFix
|
||||
/// BotsPresets.GetNewProfile()
|
||||
/// </summary>
|
||||
[PatchPrefix]
|
||||
private static bool PatchPrefix(ref Task<Profile> __result, BotsPresets __instance, List<Profile> ___list_0, GClass591 data, ref bool withDelete)
|
||||
private static bool PatchPrefix(ref Task<Profile> __result, BotsPresets __instance, List<Profile> ___list_0, BotCreationDataClass data, ref bool withDelete)
|
||||
{
|
||||
/*
|
||||
When client wants new bot and GetNewProfile() return null (if not more available templates or they don't satisfy by Role and Difficulty condition)
|
||||
|
@ -124,7 +124,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode
|
||||
.Single(field => field.FieldType == typeof(MatchmakerPlayerControllerClass))
|
||||
?.GetValue(menuController) as MatchmakerPlayerControllerClass;
|
||||
|
||||
var gclass = new MatchmakerOfflineRaidScreen.GClass3182(profile?.Info, ref raidSettings, matchmakerPlayersController, ESessionMode.Regular);
|
||||
var gclass = new MatchmakerOfflineRaidScreen.CreateRaidSettingsForProfileClass(profile?.Info, ref raidSettings, matchmakerPlayersController, ESessionMode.Regular);
|
||||
|
||||
gclass.OnShowNextScreen += LoadOfflineRaidNextScreen;
|
||||
|
||||
|
@ -13,7 +13,7 @@ namespace SPT.SinglePlayer.Patches.ScavMode
|
||||
protected override MethodBase GetTargetMethod()
|
||||
{
|
||||
// Correct Gclass has sessionCounters
|
||||
return AccessTools.Method(typeof(GClass1802), nameof(GClass1802.OnEnemyKill));
|
||||
return AccessTools.Method(typeof(LocationStatisticsCollectorAbstractClass), nameof(LocationStatisticsCollectorAbstractClass.OnEnemyKill));
|
||||
}
|
||||
|
||||
[PatchPrefix]
|
||||
|
@ -10,8 +10,6 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
using static BackendConfigSettingsClass;
|
||||
using TraderServiceClass = GClass1806;
|
||||
using QuestDictClass = GClass2147<string>;
|
||||
using StandingListClass = GClass2149<float>;
|
||||
|
||||
namespace SPT.SinglePlayer.Utils.TraderServices
|
||||
@ -86,7 +84,7 @@ namespace SPT.SinglePlayer.Utils.TraderServices
|
||||
// Only populate trader services that don't exist yet
|
||||
if (!servicesData.ContainsKey(traderServiceModel.ServiceType))
|
||||
{
|
||||
TraderServiceClass traderService = new TraderServiceClass
|
||||
TraderServicesClass traderService = new TraderServicesClass
|
||||
{
|
||||
TraderId = traderId,
|
||||
ServiceType = serviceType,
|
||||
@ -110,12 +108,12 @@ namespace SPT.SinglePlayer.Utils.TraderServices
|
||||
serviceData.TraderServiceRequirements.Standings.AddRange(traderServiceModel.Requirements.Standings);
|
||||
|
||||
// BSG has a bug in their code, we _need_ to initialize this if Standings isn't null
|
||||
serviceData.TraderServiceRequirements.CompletedQuests = new QuestDictClass();
|
||||
serviceData.TraderServiceRequirements.CompletedQuests = new QuestDictionaryClass<string>();
|
||||
}
|
||||
|
||||
if (traderServiceModel.Requirements.CompletedQuests != null)
|
||||
{
|
||||
serviceData.TraderServiceRequirements.CompletedQuests = new QuestDictClass();
|
||||
serviceData.TraderServiceRequirements.CompletedQuests = new QuestDictionaryClass<string>();
|
||||
serviceData.TraderServiceRequirements.CompletedQuests.Concat(traderServiceModel.Requirements.CompletedQuests);
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user