From 00a880e49cef581d6a74ed64899e464cb0105ff0 Mon Sep 17 00:00:00 2001 From: Lacyway Date: Sat, 24 Aug 2024 10:35:20 +0000 Subject: [PATCH] Add RemoveClothingItemExternalObtainLabelPatch (!163) Needs to be tested, I am in the process of updating my client to the latest version. If you cannot test right now I'll do it once I am done. Co-authored-by: Lacyway <20912169+Lacyway@users.noreply.github.com> Reviewed-on: https://dev.sp-tarkov.com/SPT/Modules/pulls/163 Co-authored-by: Lacyway Co-committed-by: Lacyway --- ...oveClothingItemExternalObtainLabelPatch.cs | 20 +++++++++++++++++++ .../SPT.SinglePlayer/SPTSingleplayerPlugin.cs | 3 ++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 project/SPT.SinglePlayer/Patches/MainMenu/RemoveClothingItemExternalObtainLabelPatch.cs diff --git a/project/SPT.SinglePlayer/Patches/MainMenu/RemoveClothingItemExternalObtainLabelPatch.cs b/project/SPT.SinglePlayer/Patches/MainMenu/RemoveClothingItemExternalObtainLabelPatch.cs new file mode 100644 index 0000000..251026e --- /dev/null +++ b/project/SPT.SinglePlayer/Patches/MainMenu/RemoveClothingItemExternalObtainLabelPatch.cs @@ -0,0 +1,20 @@ +using EFT.UI; +using SPT.Reflection.Patching; +using System.Reflection; + +namespace SPT.SinglePlayer.Patches.MainMenu +{ + internal class RemoveClothingItemExternalObtainLabelPatch : ModulePatch + { + protected override MethodBase GetTargetMethod() + { + return typeof(ClothingItem).GetMethod(nameof(ClothingItem.Init)); + } + + [PatchPrefix] + private static void Prefix(ref ClothingItem.GClass3338 offer) + { + offer.Offer.ExternalObtain = false; + } + } +} diff --git a/project/SPT.SinglePlayer/SPTSingleplayerPlugin.cs b/project/SPT.SinglePlayer/SPTSingleplayerPlugin.cs index 6386cd3..d7847bb 100644 --- a/project/SPT.SinglePlayer/SPTSingleplayerPlugin.cs +++ b/project/SPT.SinglePlayer/SPTSingleplayerPlugin.cs @@ -62,7 +62,8 @@ namespace SPT.SinglePlayer new InsuranceScreenPatch().Enable(); new FixQuestAchieveControllersPatch().Enable(); new RemoveStashUpgradeLabelPatch().Enable(); - } + new RemoveClothingItemExternalObtainLabelPatch().Enable(); + } catch (Exception ex) { Logger.LogError($"A PATCH IN {GetType().Name} FAILED. SUBSEQUENT PATCHES HAVE NOT LOADED");