From 946ae3655f07e18e7506cad4a28d64c7d5f4bbf3 Mon Sep 17 00:00:00 2001 From: CWX Date: Fri, 12 Jul 2024 15:20:19 +0100 Subject: [PATCH] remove unneeded models and patches we no longer use --- .../SPT.Custom/Patches/ClampRagdollPatch.cs | 29 ----------- ...Patch.cs => DisableGamemodeButtonPatch.cs} | 2 +- .../Models/Healing/BodyPartHealth.cs | 48 ------------------- .../Models/Healing/EBodyPartEffect.cs | 12 ----- .../Models/Healing/PlayerHealth.cs | 29 ----------- .../Models/Progression/SaveProfileRequest.cs | 31 ------------ .../Models/RaidFix/SPTInsuredItemClass.cs | 11 ----- .../Utils/Progression/NotesJsonConverter.cs | 37 -------------- 8 files changed, 1 insertion(+), 198 deletions(-) delete mode 100644 project/SPT.Custom/Patches/ClampRagdollPatch.cs rename project/SPT.Custom/Patches/{DisablePvEPatch.cs => DisableGamemodeButtonPatch.cs} (91%) delete mode 100644 project/SPT.SinglePlayer/Models/Healing/BodyPartHealth.cs delete mode 100644 project/SPT.SinglePlayer/Models/Healing/EBodyPartEffect.cs delete mode 100644 project/SPT.SinglePlayer/Models/Healing/PlayerHealth.cs delete mode 100644 project/SPT.SinglePlayer/Models/Progression/SaveProfileRequest.cs delete mode 100644 project/SPT.SinglePlayer/Models/RaidFix/SPTInsuredItemClass.cs delete mode 100644 project/SPT.SinglePlayer/Utils/Progression/NotesJsonConverter.cs diff --git a/project/SPT.Custom/Patches/ClampRagdollPatch.cs b/project/SPT.Custom/Patches/ClampRagdollPatch.cs deleted file mode 100644 index d6e3db7..0000000 --- a/project/SPT.Custom/Patches/ClampRagdollPatch.cs +++ /dev/null @@ -1,29 +0,0 @@ -using SPT.Reflection.Patching; -using EFT.Interactive; -using HarmonyLib; -using System.Reflection; -using UnityEngine; - -namespace SPT.Custom.Patches -{ - /// - /// On death some bots have a habit of flying upwards. We have found this occurs when the velocity y and magnitude match - /// - public class ClampRagdollPatch : ModulePatch - { - protected override MethodBase GetTargetMethod() - { - return AccessTools.Method(typeof(Corpse), nameof(Corpse.method_16)); - } - - [PatchPrefix] - private static void PatchPreFix(ref Vector3 velocity) - { - if (velocity.magnitude == velocity.y && velocity.y > 5) - { - // Probably flying upwards - velocity.y = 1; - } - } - } -} diff --git a/project/SPT.Custom/Patches/DisablePvEPatch.cs b/project/SPT.Custom/Patches/DisableGamemodeButtonPatch.cs similarity index 91% rename from project/SPT.Custom/Patches/DisablePvEPatch.cs rename to project/SPT.Custom/Patches/DisableGamemodeButtonPatch.cs index 540190e..cdb5453 100644 --- a/project/SPT.Custom/Patches/DisablePvEPatch.cs +++ b/project/SPT.Custom/Patches/DisableGamemodeButtonPatch.cs @@ -7,7 +7,7 @@ using UnityEngine; namespace SPT.Custom.Patches { - public class DisablePvEPatch : ModulePatch + public class DisableGamemodeButtonPatch : ModulePatch { protected override MethodBase GetTargetMethod() { diff --git a/project/SPT.SinglePlayer/Models/Healing/BodyPartHealth.cs b/project/SPT.SinglePlayer/Models/Healing/BodyPartHealth.cs deleted file mode 100644 index b988c75..0000000 --- a/project/SPT.SinglePlayer/Models/Healing/BodyPartHealth.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.Collections.Generic; - -namespace SPT.SinglePlayer.Models.Healing -{ - public class BodyPartHealth - { - private readonly Dictionary _effects = new Dictionary(); - public float Maximum { get; private set; } - public float Current { get; private set; } - - public IReadOnlyDictionary Effects => _effects; - - public void Initialize(float current, float maximum) - { - Maximum = maximum; - Current = current; - } - - public void ChangeHealth(float diff) - { - Current += diff; - } - - public void AddEffect(EBodyPartEffect bodyPartEffect, float time = -1) - { - _effects[bodyPartEffect] = time; - } - - public void UpdateEffect(EBodyPartEffect bodyPartEffect, float time) - { - _effects[bodyPartEffect] = time; - } - - - public void RemoveAllEffects() - { - _effects.Clear(); - } - - public void RemoveEffect(EBodyPartEffect bodyPartEffect) - { - if (_effects.ContainsKey(bodyPartEffect)) - { - _effects.Remove(bodyPartEffect); - } - } - } -} diff --git a/project/SPT.SinglePlayer/Models/Healing/EBodyPartEffect.cs b/project/SPT.SinglePlayer/Models/Healing/EBodyPartEffect.cs deleted file mode 100644 index 80817a7..0000000 --- a/project/SPT.SinglePlayer/Models/Healing/EBodyPartEffect.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace SPT.SinglePlayer.Models.Healing -{ - public enum EBodyPartEffect - { - Fracture, - LightBleeding, - HeavyBleeding, - MildMusclePain, - SevereMusclePain, - Unknown - } -} \ No newline at end of file diff --git a/project/SPT.SinglePlayer/Models/Healing/PlayerHealth.cs b/project/SPT.SinglePlayer/Models/Healing/PlayerHealth.cs deleted file mode 100644 index 9a78d1d..0000000 --- a/project/SPT.SinglePlayer/Models/Healing/PlayerHealth.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Collections.Generic; - -namespace SPT.SinglePlayer.Models.Healing -{ - public class PlayerHealth - { - private readonly Dictionary _health; - public IReadOnlyDictionary Health => _health; - public bool IsAlive { get; set; } - public float Hydration { get; set; } - public float Energy { get; set; } - public float Temperature { get; set; } - - public PlayerHealth() - { - IsAlive = true; - _health = new Dictionary() - { - { EBodyPart.Head, new BodyPartHealth() }, - { EBodyPart.Chest, new BodyPartHealth() }, - { EBodyPart.Stomach, new BodyPartHealth() }, - { EBodyPart.LeftArm, new BodyPartHealth() }, - { EBodyPart.RightArm, new BodyPartHealth() }, - { EBodyPart.LeftLeg, new BodyPartHealth() }, - { EBodyPart.RightLeg, new BodyPartHealth() } - }; - } - } -} diff --git a/project/SPT.SinglePlayer/Models/Progression/SaveProfileRequest.cs b/project/SPT.SinglePlayer/Models/Progression/SaveProfileRequest.cs deleted file mode 100644 index ef0fcdb..0000000 --- a/project/SPT.SinglePlayer/Models/Progression/SaveProfileRequest.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Newtonsoft.Json; -using EFT; -using System.Collections.Generic; -using SPT.SinglePlayer.Models.Healing; -using SPT.SinglePlayer.Models.RaidFix; - -namespace SPT.SinglePlayer.Models.Progression -{ - public class SaveProfileRequest - { - [JsonProperty("exit")] - public string Exit; - - [JsonProperty("profile")] - public Profile Profile; - - [JsonProperty("isPlayerScav")] - public bool IsPlayerScav; - - [JsonProperty("health")] - public PlayerHealth Health; - - [JsonProperty("insurance")] - public List Insurance; - - public SaveProfileRequest() - { - Exit = "left"; - } - } -} diff --git a/project/SPT.SinglePlayer/Models/RaidFix/SPTInsuredItemClass.cs b/project/SPT.SinglePlayer/Models/RaidFix/SPTInsuredItemClass.cs deleted file mode 100644 index 836b00d..0000000 --- a/project/SPT.SinglePlayer/Models/RaidFix/SPTInsuredItemClass.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace SPT.SinglePlayer.Models.RaidFix -{ - public class SPTInsuredItemClass - { - public string id; - public float? durability = null; - public float? maxDurability = null; - public byte? hits = null; - public bool usedInQuest = false; - } -} diff --git a/project/SPT.SinglePlayer/Utils/Progression/NotesJsonConverter.cs b/project/SPT.SinglePlayer/Utils/Progression/NotesJsonConverter.cs deleted file mode 100644 index 48cd551..0000000 --- a/project/SPT.SinglePlayer/Utils/Progression/NotesJsonConverter.cs +++ /dev/null @@ -1,37 +0,0 @@ -using EFT; -using HarmonyLib; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Reflection; - -namespace SPT.SinglePlayer.Utils.Progression -{ - public class NotesJsonConverter : JsonConverter - { - private static Type _targetType; - - public NotesJsonConverter() - { - _targetType = typeof(AbstractGame).Assembly.GetTypes().First(t => - t.GetProperty("TransactionInProcess", BindingFlags.Instance | BindingFlags.Public) != null); - } - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - var valueToSerialize = Traverse.Create(_targetType).Field>("Notes").Value; - serializer.Serialize(writer, $"{{\"Notes\":{JsonConvert.SerializeObject(valueToSerialize)}}}"); - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - throw new NotImplementedException(); - } - - public override bool CanConvert(Type objectType) - { - return objectType == _targetType; - } - } -} \ No newline at end of file