mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 09:50:43 -05:00
- Update GClass references - Fix incorrect method in InsuranceScreenPatch (Makes insurance screen actually show) - Fix incorrect method in Scav offline raid screen patch (Makes "Ready" from the practice screen start the raid) - Update hollowed.dll with one provided by Chomp Co-authored-by: DrakiaXYZ <565558+TheDgtl@users.noreply.github.com> Reviewed-on: SPT-AKI/Modules#47 Co-authored-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com> Co-committed-by: DrakiaXYZ <drakiaxyz@noreply.dev.sp-tarkov.com>
49 lines
1.4 KiB
C#
49 lines
1.4 KiB
C#
using System.Linq;
|
|
using System.Reflection;
|
|
using Aki.Reflection.Patching;
|
|
using Comfort.Common;
|
|
using EFT;
|
|
using HarmonyLib;
|
|
|
|
namespace Aki.SinglePlayer.Patches.RaidFix
|
|
{
|
|
/// <summary>
|
|
/// Patch to remove the Labs Access Card from player inventory upon entering Labs
|
|
/// </summary>
|
|
public class LabsKeycardRemovalPatch : ModulePatch
|
|
{
|
|
private const string LabsAccessCardTemplateId = "5c94bbff86f7747ee735c08f";
|
|
|
|
protected override MethodBase GetTargetMethod()
|
|
{
|
|
return typeof(GameWorld).GetMethod(nameof(GameWorld.OnGameStarted));
|
|
}
|
|
|
|
[PatchPostfix]
|
|
private static void PatchPostfix()
|
|
{
|
|
var gameWorld = Singleton<GameWorld>.Instance;
|
|
var player = gameWorld?.MainPlayer;
|
|
|
|
if (gameWorld == null || player == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (gameWorld.MainPlayer.Location.ToLower() != "laboratory")
|
|
{
|
|
return;
|
|
}
|
|
|
|
var accessCardItem = player.Profile.Inventory.AllRealPlayerItems.FirstOrDefault(x => x.TemplateId == LabsAccessCardTemplateId);
|
|
|
|
if (accessCardItem == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var inventoryController = Traverse.Create(player).Field<InventoryControllerClass>("_inventoryController").Value;
|
|
GClass2768.Remove(accessCardItem, inventoryController, false, true);
|
|
}
|
|
}
|
|
} |