From 9c9aa6f5f2b1bbdfada1914d95bc26403e30ed81 Mon Sep 17 00:00:00 2001 From: Vretu-Dev Date: Fri, 18 Oct 2024 09:18:05 +0200 Subject: [PATCH 1/8] Add on equip hint for Jailbird and MicroHid --- UsefulHints/Config.cs | 2 + UsefulHints/EventHandlers/Items/Hints.cs | 58 +++++++++++++++++++++++- 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/UsefulHints/Config.cs b/UsefulHints/Config.cs index 80ef429..4e6ef1e 100644 --- a/UsefulHints/Config.cs +++ b/UsefulHints/Config.cs @@ -19,6 +19,8 @@ public class Config : IConfig public string JailbirdUseMessage { get; set; } = "Remaining charges: {0}"; public string MicroEnergyMessage { get; set; } = "Remaining energy: {0}%"; public string MicroLowEnergyMessage { get; set; } = "Low Energy"; + [Description("Show Jailbird and MicroHid Hint on equip (default only when pick it up)")] + public bool ShowHintOnEquip { get; set; } = false; public string Scp207HintMessage { get; set; } = "You have {0} doses of SCP-207"; public string AntiScp207HintMessage { get; set; } = "You have {0} doses of Anti SCP-207"; [Description("Item Warnings:")] diff --git a/UsefulHints/EventHandlers/Items/Hints.cs b/UsefulHints/EventHandlers/Items/Hints.cs index bf83770..7521c02 100644 --- a/UsefulHints/EventHandlers/Items/Hints.cs +++ b/UsefulHints/EventHandlers/Items/Hints.cs @@ -3,11 +3,12 @@ using System.Collections.Generic; using Exiled.API.Enums; using Exiled.API.Extensions; -using Exiled.API.Features.Pickups; +using JailbirdPickup = Exiled.API.Features.Pickups.JailbirdPickup; using Player = Exiled.API.Features.Player; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; using InventorySystem.Items.ThrowableProjectiles; +using InventorySystem.Items.Jailbird; using MEC; namespace UsefulHints.EventHandlers.Items @@ -19,6 +20,7 @@ public static class Hints public static void RegisterEvents() { Exiled.Events.Handlers.Player.PickingUpItem += OnPickingUpMicroHid; + Exiled.Events.Handlers.Player.ChangingItem += OnEquipMicroHid; Exiled.Events.Handlers.Player.PickingUpItem += OnPickingUpSCP207; Exiled.Events.Handlers.Player.UsedItem += OnSCP1576Used; Exiled.Events.Handlers.Player.ChangedItem += OnSCP1576ChangedItem; @@ -28,10 +30,12 @@ public static void RegisterEvents() Exiled.Events.Handlers.Map.ExplodingGrenade += OnSCP2176Grenade; Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingForPlayers; Exiled.Events.Handlers.Player.PickingUpItem += OnPickingUpJailbird; + Exiled.Events.Handlers.Player.ChangingItem += OnEquipJailbird; } public static void UnregisterEvents() { Exiled.Events.Handlers.Player.PickingUpItem -= OnPickingUpMicroHid; + Exiled.Events.Handlers.Player.ChangingItem -= OnEquipMicroHid; Exiled.Events.Handlers.Player.PickingUpItem -= OnPickingUpSCP207; Exiled.Events.Handlers.Player.UsedItem -= OnSCP1576Used; Exiled.Events.Handlers.Player.ChangedItem -= OnSCP1576ChangedItem; @@ -41,6 +45,7 @@ public static void UnregisterEvents() Exiled.Events.Handlers.Map.ExplodingGrenade -= OnSCP2176Grenade; Exiled.Events.Handlers.Server.WaitingForPlayers -= OnWaitingForPlayers; Exiled.Events.Handlers.Player.PickingUpItem -= OnPickingUpJailbird; + Exiled.Events.Handlers.Player.ChangingItem -= OnEquipJailbird; } private static void OnPickingUpMicroHid(PickingUpItemEventArgs ev) { @@ -64,6 +69,31 @@ private static void OnPickingUpMicroHid(PickingUpItemEventArgs ev) } } } + public static void OnEquipMicroHid(ChangingItemEventArgs ev) + { + if (UsefulHints.Instance.Config.ShowHintOnEquip) + { + if (ev.Item.Type == ItemType.MicroHID) + { + var microHidItem = ev.Item.Base as InventorySystem.Items.MicroHID.MicroHIDItem; + + if (microHidItem != null) + { + float energyPercentage = microHidItem.RemainingEnergy * 100; + float roundedEnergyPercentage = (float)Math.Round(energyPercentage, 1); + + if (roundedEnergyPercentage < 5) + { + ev.Player.ShowHint($"{string.Format(UsefulHints.Instance.Config.MicroLowEnergyMessage)}", 4); + } + else + { + ev.Player.ShowHint($"{string.Format(UsefulHints.Instance.Config.MicroEnergyMessage, roundedEnergyPercentage)}", 4); + } + } + } + } + } // SCP 207 Handler private static void OnPickingUpSCP207(PickingUpItemEventArgs ev) { @@ -229,5 +259,31 @@ private static void OnPickingUpJailbird(PickingUpItemEventArgs ev) } } } + private static void OnEquipJailbird(ChangingItemEventArgs ev) + { + if (UsefulHints.Instance.Config.ShowHintOnEquip) + { + if (ev.Item.Type == ItemType.Jailbird) + { + var jailbirdItem = ev.Item.Base as JailbirdItem; + + if (jailbirdItem != null) + { + int maxCharges = 5; + int remainingCharges = maxCharges - jailbirdItem.TotalChargesPerformed; + + if (remainingCharges > 1) + { + ev.Player.ShowHint($"{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}", 4); + } + else + { + ev.Player.ShowHint($"{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}", 4); + } + } + } + } + } + } } \ No newline at end of file From 30fb34c18e8ee6e51b352505e32f09ddb01646f7 Mon Sep 17 00:00:00 2001 From: Vretu-Dev Date: Fri, 18 Oct 2024 09:31:16 +0200 Subject: [PATCH 2/8] Add cuffed player warning --- UsefulHints/Config.cs | 2 ++ UsefulHints/EventHandlers/Modules/FFWarning.cs | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/UsefulHints/Config.cs b/UsefulHints/Config.cs index 4e6ef1e..fb0b621 100644 --- a/UsefulHints/Config.cs +++ b/UsefulHints/Config.cs @@ -33,6 +33,8 @@ public class Config : IConfig public string FriendlyFireWarning { get; set; } = "\u26A0 Do not hurt your teammate"; public string DamageTakenWarning { get; set; } = "{0} (teammate) hit you"; public bool ClassDAreTeammates { get; set; } = true; + public bool CuffedPlayerWarning { get; set; } = true; + public string CuffedWarning { get; set; } = "\u26A0 Player is cuffed"; [Description("Kill Counter:")] public bool EnableKillCounter { get; set; } = true; public string KillCountMessage { get; set; } = "{0} kills"; diff --git a/UsefulHints/EventHandlers/Modules/FFWarning.cs b/UsefulHints/EventHandlers/Modules/FFWarning.cs index df86a4e..1128dc5 100644 --- a/UsefulHints/EventHandlers/Modules/FFWarning.cs +++ b/UsefulHints/EventHandlers/Modules/FFWarning.cs @@ -33,8 +33,11 @@ private static void OnHurting(HurtingEventArgs ev) ev.Player.ShowHint(string.Format(UsefulHints.Instance.Config.DamageTakenWarning, ev.Attacker.Nickname), 2); } } + if (UsefulHints.Instance.Config.CuffedPlayerWarning && ev.Player.IsCuffed && ev.Attacker != ev.Player) + { + ev.Player.ShowHint(string.Format(UsefulHints.Instance.Config.CuffedWarning), 1); + } } } - } } \ No newline at end of file From bff5f1dbc3dd96e50aba6b4227585c0897f22774 Mon Sep 17 00:00:00 2001 From: Vretu-Dev Date: Fri, 18 Oct 2024 09:33:46 +0200 Subject: [PATCH 3/8] Bump V --- UsefulHints/UsefulHints.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UsefulHints/UsefulHints.cs b/UsefulHints/UsefulHints.cs index 6c5cb42..975f5a1 100644 --- a/UsefulHints/UsefulHints.cs +++ b/UsefulHints/UsefulHints.cs @@ -9,7 +9,7 @@ public class UsefulHints : Plugin public override string Name => "Useful Hints"; public override string Author => "Vretu"; public override string Prefix { get; } = "UH"; - public override Version Version => new Version(1, 7, 2); + public override Version Version => new Version(1, 7, 3); public override Version RequiredExiledVersion { get; } = new Version(8, 9, 8); public override PluginPriority Priority { get; } = PluginPriority.Low; public static UsefulHints Instance { get; private set; } From 7761e85016dfea88315d473196bef265dd9766b0 Mon Sep 17 00:00:00 2001 From: Vretu-Dev Date: Fri, 18 Oct 2024 10:06:39 +0200 Subject: [PATCH 4/8] Visual Changes --- UsefulHints/Config.cs | 8 ++++---- UsefulHints/EventHandlers/Items/Hints.cs | 1 - UsefulHints/EventHandlers/Modules/FFWarning.cs | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/UsefulHints/Config.cs b/UsefulHints/Config.cs index fb0b621..dd64a01 100644 --- a/UsefulHints/Config.cs +++ b/UsefulHints/Config.cs @@ -19,8 +19,8 @@ public class Config : IConfig public string JailbirdUseMessage { get; set; } = "Remaining charges: {0}"; public string MicroEnergyMessage { get; set; } = "Remaining energy: {0}%"; public string MicroLowEnergyMessage { get; set; } = "Low Energy"; - [Description("Show Jailbird and MicroHid Hint on equip (default only when pick it up)")] - public bool ShowHintOnEquip { get; set; } = false; + [Description("Jailbird and MicroHID hints on equip (default: only on pickup)")] + public bool ShowHintOnEquip { get; set; } = true; public string Scp207HintMessage { get; set; } = "You have {0} doses of SCP-207"; public string AntiScp207HintMessage { get; set; } = "You have {0} doses of Anti SCP-207"; [Description("Item Warnings:")] @@ -33,8 +33,8 @@ public class Config : IConfig public string FriendlyFireWarning { get; set; } = "\u26A0 Do not hurt your teammate"; public string DamageTakenWarning { get; set; } = "{0} (teammate) hit you"; public bool ClassDAreTeammates { get; set; } = true; - public bool CuffedPlayerWarning { get; set; } = true; - public string CuffedWarning { get; set; } = "\u26A0 Player is cuffed"; + public bool EnableCuffedWarning { get; set; } = true; + public string CuffedPlayerWarning { get; set; } = "\u26A0 Player is cuffed"; [Description("Kill Counter:")] public bool EnableKillCounter { get; set; } = true; public string KillCountMessage { get; set; } = "{0} kills"; diff --git a/UsefulHints/EventHandlers/Items/Hints.cs b/UsefulHints/EventHandlers/Items/Hints.cs index 7521c02..33ae4e6 100644 --- a/UsefulHints/EventHandlers/Items/Hints.cs +++ b/UsefulHints/EventHandlers/Items/Hints.cs @@ -284,6 +284,5 @@ private static void OnEquipJailbird(ChangingItemEventArgs ev) } } } - } } \ No newline at end of file diff --git a/UsefulHints/EventHandlers/Modules/FFWarning.cs b/UsefulHints/EventHandlers/Modules/FFWarning.cs index 1128dc5..c4aaf22 100644 --- a/UsefulHints/EventHandlers/Modules/FFWarning.cs +++ b/UsefulHints/EventHandlers/Modules/FFWarning.cs @@ -33,9 +33,9 @@ private static void OnHurting(HurtingEventArgs ev) ev.Player.ShowHint(string.Format(UsefulHints.Instance.Config.DamageTakenWarning, ev.Attacker.Nickname), 2); } } - if (UsefulHints.Instance.Config.CuffedPlayerWarning && ev.Player.IsCuffed && ev.Attacker != ev.Player) + if (UsefulHints.Instance.Config.EnableCuffedWarning && ev.Player.IsCuffed && ev.Attacker != ev.Player) { - ev.Player.ShowHint(string.Format(UsefulHints.Instance.Config.CuffedWarning), 1); + ev.Player.ShowHint(string.Format(UsefulHints.Instance.Config.CuffedPlayerWarning), 1); } } } From a6da005e89ece9c8de1d7f0573e18a955e591110 Mon Sep 17 00:00:00 2001 From: Vretu-Dev Date: Fri, 18 Oct 2024 16:43:11 +0200 Subject: [PATCH 5/8] Fixes --- UsefulHints/Config.cs | 3 +- UsefulHints/EventHandlers/Items/Hints.cs | 81 +++++++++---------- .../EventHandlers/Modules/FFWarning.cs | 3 +- 3 files changed, 42 insertions(+), 45 deletions(-) diff --git a/UsefulHints/Config.cs b/UsefulHints/Config.cs index dd64a01..9214c88 100644 --- a/UsefulHints/Config.cs +++ b/UsefulHints/Config.cs @@ -34,7 +34,8 @@ public class Config : IConfig public string DamageTakenWarning { get; set; } = "{0} (teammate) hit you"; public bool ClassDAreTeammates { get; set; } = true; public bool EnableCuffedWarning { get; set; } = true; - public string CuffedPlayerWarning { get; set; } = "\u26A0 Player is cuffed"; + public string CuffedAttackerWarning { get; set; } = "\u26A0 Player is cuffed"; + public string CuffedPlayerWarning { get; set; } = "{0} hit you when you were cuffed"; [Description("Kill Counter:")] public bool EnableKillCounter { get; set; } = true; public string KillCountMessage { get; set; } = "{0} kills"; diff --git a/UsefulHints/EventHandlers/Items/Hints.cs b/UsefulHints/EventHandlers/Items/Hints.cs index 33ae4e6..d4f8c5f 100644 --- a/UsefulHints/EventHandlers/Items/Hints.cs +++ b/UsefulHints/EventHandlers/Items/Hints.cs @@ -9,6 +9,7 @@ using Exiled.Events.EventArgs.Player; using InventorySystem.Items.ThrowableProjectiles; using InventorySystem.Items.Jailbird; +using InventorySystem.Items.MicroHID; using MEC; namespace UsefulHints.EventHandlers.Items @@ -49,23 +50,18 @@ public static void UnregisterEvents() } private static void OnPickingUpMicroHid(PickingUpItemEventArgs ev) { - if (ev.Pickup.Type == ItemType.MicroHID) + if (ev.Pickup.Base is MicroHIDPickup microHidPickup) { - var microHidPickup = ev.Pickup.Base as InventorySystem.Items.MicroHID.MicroHIDPickup; + float energyPercentage = microHidPickup.Energy * 100; + float roundedEnergyPercentage = (float)Math.Round(energyPercentage, 1); - if (microHidPickup != null) + if (roundedEnergyPercentage < 5) { - float energyPercentage = microHidPickup.Energy * 100; - float roundedEnergyPercentage = (float)Math.Round(energyPercentage, 1); - - if (roundedEnergyPercentage < 5) - { - ev.Player.ShowHint($"{string.Format(UsefulHints.Instance.Config.MicroLowEnergyMessage)}", 4); - } - else - { - ev.Player.ShowHint($"{string.Format(UsefulHints.Instance.Config.MicroEnergyMessage, roundedEnergyPercentage)}", 4); - } + ev.Player.ShowHint($"{string.Format(UsefulHints.Instance.Config.MicroLowEnergyMessage)}", 4); + } + else + { + ev.Player.ShowHint($"{string.Format(UsefulHints.Instance.Config.MicroEnergyMessage, roundedEnergyPercentage)}", 4); } } } @@ -73,23 +69,23 @@ public static void OnEquipMicroHid(ChangingItemEventArgs ev) { if (UsefulHints.Instance.Config.ShowHintOnEquip) { - if (ev.Item.Type == ItemType.MicroHID) + if (ev.Item == null) + { + return; + } + if (ev.Item.Base is MicroHIDItem microHidItem) { - var microHidItem = ev.Item.Base as InventorySystem.Items.MicroHID.MicroHIDItem; - if (microHidItem != null) - { - float energyPercentage = microHidItem.RemainingEnergy * 100; - float roundedEnergyPercentage = (float)Math.Round(energyPercentage, 1); + float energyPercentage = microHidItem.RemainingEnergy * 100; + float roundedEnergyPercentage = (float)Math.Round(energyPercentage, 1); - if (roundedEnergyPercentage < 5) - { - ev.Player.ShowHint($"{string.Format(UsefulHints.Instance.Config.MicroLowEnergyMessage)}", 4); - } - else - { - ev.Player.ShowHint($"{string.Format(UsefulHints.Instance.Config.MicroEnergyMessage, roundedEnergyPercentage)}", 4); - } + if (roundedEnergyPercentage < 5) + { + ev.Player.ShowHint($"{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.MicroLowEnergyMessage)}", 4); + } + else + { + ev.Player.ShowHint($"{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.MicroEnergyMessage, roundedEnergyPercentage)}", 4); } } } @@ -259,27 +255,26 @@ private static void OnPickingUpJailbird(PickingUpItemEventArgs ev) } } } - private static void OnEquipJailbird(ChangingItemEventArgs ev) + public static void OnEquipJailbird(ChangingItemEventArgs ev) { if (UsefulHints.Instance.Config.ShowHintOnEquip) { - if (ev.Item.Type == ItemType.Jailbird) + if (ev.Item == null) { - var jailbirdItem = ev.Item.Base as JailbirdItem; + return; + } + if (ev.Item.Base is JailbirdItem jailbirdItem) + { + int maxCharges = 5; + int remainingCharges = maxCharges - jailbirdItem.TotalChargesPerformed; - if (jailbirdItem != null) + if (remainingCharges > 1) { - int maxCharges = 5; - int remainingCharges = maxCharges - jailbirdItem.TotalChargesPerformed; - - if (remainingCharges > 1) - { - ev.Player.ShowHint($"{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}", 4); - } - else - { - ev.Player.ShowHint($"{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}", 4); - } + ev.Player.ShowHint($"{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}", 4); + } + else + { + ev.Player.ShowHint($"{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}", 4); } } } diff --git a/UsefulHints/EventHandlers/Modules/FFWarning.cs b/UsefulHints/EventHandlers/Modules/FFWarning.cs index c4aaf22..0ed50b2 100644 --- a/UsefulHints/EventHandlers/Modules/FFWarning.cs +++ b/UsefulHints/EventHandlers/Modules/FFWarning.cs @@ -35,7 +35,8 @@ private static void OnHurting(HurtingEventArgs ev) } if (UsefulHints.Instance.Config.EnableCuffedWarning && ev.Player.IsCuffed && ev.Attacker != ev.Player) { - ev.Player.ShowHint(string.Format(UsefulHints.Instance.Config.CuffedPlayerWarning), 1); + ev.Attacker.ShowHint(string.Format(UsefulHints.Instance.Config.CuffedAttackerWarning), 2); + ev.Player.ShowHint(string.Format(UsefulHints.Instance.Config.CuffedPlayerWarning, ev.Attacker.Nickname), 2); } } } From 93d2babad863315b6413932b88ac3889285f421b Mon Sep 17 00:00:00 2001 From: Vretu-Dev Date: Fri, 18 Oct 2024 21:22:03 +0200 Subject: [PATCH 6/8] Fix show handcuffed for SCPs --- UsefulHints/EventHandlers/Items/Hints.cs | 1 + UsefulHints/EventHandlers/Modules/FFWarning.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/UsefulHints/EventHandlers/Items/Hints.cs b/UsefulHints/EventHandlers/Items/Hints.cs index d4f8c5f..bef5ddc 100644 --- a/UsefulHints/EventHandlers/Items/Hints.cs +++ b/UsefulHints/EventHandlers/Items/Hints.cs @@ -48,6 +48,7 @@ public static void UnregisterEvents() Exiled.Events.Handlers.Player.PickingUpItem -= OnPickingUpJailbird; Exiled.Events.Handlers.Player.ChangingItem -= OnEquipJailbird; } + // MicroHid Handler private static void OnPickingUpMicroHid(PickingUpItemEventArgs ev) { if (ev.Pickup.Base is MicroHIDPickup microHidPickup) diff --git a/UsefulHints/EventHandlers/Modules/FFWarning.cs b/UsefulHints/EventHandlers/Modules/FFWarning.cs index 0ed50b2..d8caf47 100644 --- a/UsefulHints/EventHandlers/Modules/FFWarning.cs +++ b/UsefulHints/EventHandlers/Modules/FFWarning.cs @@ -15,7 +15,7 @@ public static void UnregisterEvents() } private static void OnHurting(HurtingEventArgs ev) { - if (ev.Attacker != null && ev.Player != null && ev.Attacker.Role != null && ev.Player.Role != null) + if (ev.Attacker != null && ev.Player != null && ev.Attacker.Role != null && ev.Player.Role != null && ev.Attacker.Role.Team != Team.SCPs && ev.Player.Role.Team != Team.SCPs) { if (ev.Attacker.Role.Side == ev.Player.Role.Side && ev.Attacker != ev.Player) { From 5c1f91b024b74a9131d84f73863d3edcb6b4add1 Mon Sep 17 00:00:00 2001 From: Vretu-Dev Date: Sun, 20 Oct 2024 21:56:11 +0200 Subject: [PATCH 7/8] Add show hint on equip for SCP-207 and SCP-?207 --- UsefulHints/Config.cs | 9 ++-- UsefulHints/EventHandlers/Items/Hints.cs | 54 ++++++++++++++++++------ 2 files changed, 46 insertions(+), 17 deletions(-) diff --git a/UsefulHints/Config.cs b/UsefulHints/Config.cs index 9214c88..4590887 100644 --- a/UsefulHints/Config.cs +++ b/UsefulHints/Config.cs @@ -17,12 +17,11 @@ public class Config : IConfig public string Scp2176TimeLeftMessage { get; set; } = "Remaining: {0}s"; public string Scp1576TimeLeftMessage { get; set; } = "Remaining: {0}s"; public string JailbirdUseMessage { get; set; } = "Remaining charges: {0}"; - public string MicroEnergyMessage { get; set; } = "Remaining energy: {0}%"; - public string MicroLowEnergyMessage { get; set; } = "Low Energy"; - [Description("Jailbird and MicroHID hints on equip (default: only on pickup)")] - public bool ShowHintOnEquip { get; set; } = true; + public string MicroHidEnergyMessage { get; set; } = "Remaining energy: {0}%"; + public string MicroHidLowEnergyMessage { get; set; } = "Low Energy"; public string Scp207HintMessage { get; set; } = "You have {0} doses of SCP-207"; public string AntiScp207HintMessage { get; set; } = "You have {0} doses of Anti SCP-207"; + public bool ShowHintOnEquipItem { get; set; } = false; [Description("Item Warnings:")] public bool EnableWarnings { get; set; } = true; public string Scp207Warning { get; set; } = "\u26A0 You are already affected by SCP-207"; @@ -33,7 +32,7 @@ public class Config : IConfig public string FriendlyFireWarning { get; set; } = "\u26A0 Do not hurt your teammate"; public string DamageTakenWarning { get; set; } = "{0} (teammate) hit you"; public bool ClassDAreTeammates { get; set; } = true; - public bool EnableCuffedWarning { get; set; } = true; + public bool EnableCuffedWarning { get; set; } = false; public string CuffedAttackerWarning { get; set; } = "\u26A0 Player is cuffed"; public string CuffedPlayerWarning { get; set; } = "{0} hit you when you were cuffed"; [Description("Kill Counter:")] diff --git a/UsefulHints/EventHandlers/Items/Hints.cs b/UsefulHints/EventHandlers/Items/Hints.cs index bef5ddc..e852fd3 100644 --- a/UsefulHints/EventHandlers/Items/Hints.cs +++ b/UsefulHints/EventHandlers/Items/Hints.cs @@ -23,6 +23,7 @@ public static void RegisterEvents() Exiled.Events.Handlers.Player.PickingUpItem += OnPickingUpMicroHid; Exiled.Events.Handlers.Player.ChangingItem += OnEquipMicroHid; Exiled.Events.Handlers.Player.PickingUpItem += OnPickingUpSCP207; + Exiled.Events.Handlers.Player.ChangingItem += OnEquipSCP207; Exiled.Events.Handlers.Player.UsedItem += OnSCP1576Used; Exiled.Events.Handlers.Player.ChangedItem += OnSCP1576ChangedItem; Exiled.Events.Handlers.Player.UsedItem += OnSCP268Used; @@ -38,6 +39,7 @@ public static void UnregisterEvents() Exiled.Events.Handlers.Player.PickingUpItem -= OnPickingUpMicroHid; Exiled.Events.Handlers.Player.ChangingItem -= OnEquipMicroHid; Exiled.Events.Handlers.Player.PickingUpItem -= OnPickingUpSCP207; + Exiled.Events.Handlers.Player.ChangingItem -= OnEquipSCP207; Exiled.Events.Handlers.Player.UsedItem -= OnSCP1576Used; Exiled.Events.Handlers.Player.ChangedItem -= OnSCP1576ChangedItem; Exiled.Events.Handlers.Player.UsedItem -= OnSCP268Used; @@ -58,17 +60,17 @@ private static void OnPickingUpMicroHid(PickingUpItemEventArgs ev) if (roundedEnergyPercentage < 5) { - ev.Player.ShowHint($"{string.Format(UsefulHints.Instance.Config.MicroLowEnergyMessage)}", 4); + ev.Player.ShowHint($"{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.MicroHidLowEnergyMessage)}", 4); } else { - ev.Player.ShowHint($"{string.Format(UsefulHints.Instance.Config.MicroEnergyMessage, roundedEnergyPercentage)}", 4); + ev.Player.ShowHint($"{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.MicroHidEnergyMessage, roundedEnergyPercentage)}", 4); } } } public static void OnEquipMicroHid(ChangingItemEventArgs ev) { - if (UsefulHints.Instance.Config.ShowHintOnEquip) + if (UsefulHints.Instance.Config.ShowHintOnEquipItem) { if (ev.Item == null) { @@ -82,11 +84,11 @@ public static void OnEquipMicroHid(ChangingItemEventArgs ev) if (roundedEnergyPercentage < 5) { - ev.Player.ShowHint($"{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.MicroLowEnergyMessage)}", 4); + ev.Player.ShowHint($"{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.MicroHidLowEnergyMessage)}", 2); } else { - ev.Player.ShowHint($"{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.MicroEnergyMessage, roundedEnergyPercentage)}", 4); + ev.Player.ShowHint($"{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.MicroHidEnergyMessage, roundedEnergyPercentage)}", 2); } } } @@ -100,7 +102,7 @@ private static void OnPickingUpSCP207(PickingUpItemEventArgs ev) if (scp207Effect != null) { - ev.Player.ShowHint($"{string.Format(UsefulHints.Instance.Config.Scp207HintMessage, scp207Effect.Intensity)}", 4); + ev.Player.ShowHint($"{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.Scp207HintMessage, scp207Effect.Intensity)}", 4); } } if (ev.Pickup.Type == ItemType.AntiSCP207) @@ -109,7 +111,35 @@ private static void OnPickingUpSCP207(PickingUpItemEventArgs ev) if (antiscp207Effect != null) { - ev.Player.ShowHint($"{string.Format(UsefulHints.Instance.Config.AntiScp207HintMessage, antiscp207Effect.Intensity)}", 4); + ev.Player.ShowHint($"{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.AntiScp207HintMessage, antiscp207Effect.Intensity)}", 4); + } + } + } + private static void OnEquipSCP207(ChangingItemEventArgs ev) + { + if (UsefulHints.Instance.Config.ShowHintOnEquipItem) + { + if (ev.Item == null) + { + return; + } + if (ev.Item.Type == ItemType.SCP207) + { + CustomPlayerEffects.StatusEffectBase scp207Effect = ev.Player.ActiveEffects.FirstOrDefault(effect => effect.GetEffectType() == EffectType.Scp207); + + if (scp207Effect != null) + { + ev.Player.ShowHint($"{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.Scp207HintMessage, scp207Effect.Intensity)}", 2); + } + } + if (ev.Item.Type == ItemType.AntiSCP207) + { + CustomPlayerEffects.StatusEffectBase antiscp207Effect = ev.Player.ActiveEffects.FirstOrDefault(effect => effect.GetEffectType() == EffectType.AntiScp207); + + if (antiscp207Effect != null) + { + ev.Player.ShowHint($"{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.AntiScp207HintMessage, antiscp207Effect.Intensity)}", 2); + } } } } @@ -248,17 +278,17 @@ private static void OnPickingUpJailbird(PickingUpItemEventArgs ev) int remainingCharges = maxCharges - jailbirdPickup.TotalCharges; if (remainingCharges > 1) { - ev.Player.ShowHint($"{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}", 4); + ev.Player.ShowHint($"{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}", 4); } else { - ev.Player.ShowHint($"{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}", 4); + ev.Player.ShowHint($"{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}", 4); } } } public static void OnEquipJailbird(ChangingItemEventArgs ev) { - if (UsefulHints.Instance.Config.ShowHintOnEquip) + if (UsefulHints.Instance.Config.ShowHintOnEquipItem) { if (ev.Item == null) { @@ -271,11 +301,11 @@ public static void OnEquipJailbird(ChangingItemEventArgs ev) if (remainingCharges > 1) { - ev.Player.ShowHint($"{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}", 4); + ev.Player.ShowHint($"{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}", 2); } else { - ev.Player.ShowHint($"{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}", 4); + ev.Player.ShowHint($"{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}", 2); } } } From 73adf8e15e21b0c4d3b94abe4f01a78264d67cb0 Mon Sep 17 00:00:00 2001 From: Vretu-Dev Date: Sun, 20 Oct 2024 22:01:40 +0200 Subject: [PATCH 8/8] Typo fix --- UsefulHints/Config.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UsefulHints/Config.cs b/UsefulHints/Config.cs index 4590887..8bda09c 100644 --- a/UsefulHints/Config.cs +++ b/UsefulHints/Config.cs @@ -9,7 +9,7 @@ public class Config : IConfig { public bool IsEnabled { get; set; } = true; public bool Debug { get; set; } = false; - [Description("Hints Settings:")] + [Description("Hint Settings:")] public bool EnableHints { get; set; } = true; public string Scp096LookMessage { get; set; } = "You looked at SCP-096!"; public float Scp268Duration { get; set; } = 15f;