Skip to content

Commit

Permalink
1.9.6 | Better Hints & WarningHints
Browse files Browse the repository at this point in the history
  • Loading branch information
Vretu-Dev committed Jan 10, 2025
1 parent 8305a24 commit c48a1da
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 81 deletions.
65 changes: 15 additions & 50 deletions UsefulHints/EventHandlers/Items/Hints.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
using System;
using System.Linq;
using System.Collections.Generic;
using Exiled.API.Enums;
using Exiled.API.Extensions;
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 InventorySystem.Items.MicroHID;
using CustomPlayerEffects;
using MEC;

namespace UsefulHints.EventHandlers.Items
Expand Down Expand Up @@ -57,59 +55,34 @@ private static void OnGrenadeHurting(HurtingEventArgs ev)
if (ev.DamageHandler.Type == DamageType.Explosion)
{
float RemainingHealth = ev.Player.Health - ev.Amount;

if (RemainingHealth > 0 && !ev.Attacker.IsHost)
{
ev.Attacker.ShowHint($"<color=white>{new string('\n', 5)}{string.Format(UsefulHints.Instance.Config.GrenadeDamageHint, Math.Round(ev.Amount))}</color>", 4);
}
}
}
// SCP 207 Handler
private static void OnPickingUpSCP207(PickingUpItemEventArgs ev)
{
if (ev.Pickup.Type == ItemType.SCP207)
{
CustomPlayerEffects.StatusEffectBase scp207Effect = ev.Player.ActiveEffects.FirstOrDefault(effect => effect.GetEffectType() == EffectType.Scp207);

if (scp207Effect != null)
{
ev.Player.ShowHint($"<color=#A60C0E>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.Scp207HintMessage, scp207Effect.Intensity)}</color>", 4);
}
}
if (ev.Pickup.Type == ItemType.AntiSCP207)
{
CustomPlayerEffects.StatusEffectBase antiscp207Effect = ev.Player.ActiveEffects.FirstOrDefault(effect => effect.GetEffectType() == EffectType.AntiScp207);
if (ev.Player.IsEffectActive<Scp207>() && ev.Pickup.Type != ItemType.AntiSCP207)
ev.Player.ShowHint($"<color=#A60C0E>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.Scp207HintMessage, ev.Player.GetEffect(EffectType.Scp207).Intensity)}</color>", 4);

if (antiscp207Effect != null)
{
ev.Player.ShowHint($"<color=#C53892>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.AntiScp207HintMessage, antiscp207Effect.Intensity)}</color>", 4);
}
}
if (ev.Player.IsEffectActive<AntiScp207>() && ev.Pickup.Type != ItemType.SCP207)
ev.Player.ShowHint($"<color=#C53892>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.AntiScp207HintMessage, ev.Player.GetEffect(EffectType.AntiScp207).Intensity)}</color>", 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($"<color=#A60C0E>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.Scp207HintMessage, scp207Effect.Intensity)}</color>", 2);
}
}
if (ev.Item.Type == ItemType.AntiSCP207)
if (ev.Item.Type == ItemType.SCP207 || ev.Item.Type == ItemType.AntiSCP207)
{
CustomPlayerEffects.StatusEffectBase antiscp207Effect = ev.Player.ActiveEffects.FirstOrDefault(effect => effect.GetEffectType() == EffectType.AntiScp207);
if (ev.Player.IsEffectActive<Scp207>() && ev.Item.Type != ItemType.AntiSCP207)
ev.Player.ShowHint($"<color=#A60C0E>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.Scp207HintMessage, ev.Player.GetEffect(EffectType.Scp207).Intensity)}</color>", 4);

if (antiscp207Effect != null)
{
ev.Player.ShowHint($"<color=#C53892>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.AntiScp207HintMessage, antiscp207Effect.Intensity)}</color>", 2);
}
if (ev.Player.IsEffectActive<AntiScp207>() && ev.Item.Type != ItemType.SCP207)
ev.Player.ShowHint($"<color=#C53892>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.AntiScp207HintMessage, ev.Player.GetEffect(EffectType.AntiScp207).Intensity)}</color>", 4);
}
}
}
Expand All @@ -129,8 +102,8 @@ private static void OnSCP1576Used(UsedItemEventArgs ev)
}

var coroutine = Timing.RunCoroutine(Scp1576Timer(ev.Player));
activeCoroutines[ev.Player] = coroutine;
activeItems[ev.Player] = ev.Item.Type;
activeCoroutines.Add(ev.Player, coroutine);
activeItems.Add(ev.Player, ev.Item.Type);
}
}
private static void OnSCP1576ChangedItem(ChangedItemEventArgs ev)
Expand Down Expand Up @@ -246,37 +219,29 @@ private static void OnPickingUpJailbird(PickingUpItemEventArgs ev)
{
int maxCharges = 5;
int remainingCharges = maxCharges - jailbirdPickup.TotalCharges;

if (remainingCharges > 1)
{
ev.Player.ShowHint($"<color=#00B7EB>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}</color>", 4);
}
else
{
ev.Player.ShowHint($"<color=#C73804>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}</color>", 4);
}
}
}
private static void OnEquipJailbird(ChangingItemEventArgs ev)
{
if (UsefulHints.Instance.Config.ShowHintOnEquipItem)
{
if (ev.Item == null)
{
return;
}

if (ev.Item.Base is JailbirdItem jailbirdItem)
{
int maxCharges = 5;
int remainingCharges = maxCharges - jailbirdItem.TotalChargesPerformed;

if (remainingCharges > 1)
{
ev.Player.ShowHint($"<color=#00B7EB>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}</color>", 2);
}
else
{
ev.Player.ShowHint($"<color=#C73804>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}</color>", 2);
}
}
}
}
Expand Down
36 changes: 7 additions & 29 deletions UsefulHints/EventHandlers/Items/WarningHints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,16 @@ public static void UnregisterEvents()
}
private static void OnPickingUpWarning(PickingUpItemEventArgs ev)
{
if (ev.Pickup.Type == ItemType.SCP207)
if (ev.Pickup.Type == ItemType.SCP207 || ev.Pickup.Type == ItemType.AntiSCP207 || ev.Pickup.Type == ItemType.SCP1853)
{
if (ev.Player.IsEffectActive<AntiScp207>())
{
ev.Player.ShowHint(string.Format(UsefulHints.Instance.Config.AntiScp207Warning), 4);
}
if (ev.Player.IsEffectActive<Scp1853>())
{
ev.Player.ShowHint(string.Format(UsefulHints.Instance.Config.Scp1853Warning), 4);
}
}
if (ev.Pickup.Type == ItemType.AntiSCP207)
{
if (ev.Player.IsEffectActive<Scp207>())
{
if (ev.Player.IsEffectActive<Scp207>() && ev.Pickup.Type != ItemType.SCP207)
ev.Player.ShowHint(string.Format(UsefulHints.Instance.Config.Scp207Warning), 4);
}
if (ev.Player.IsEffectActive<Scp1853>())
{
ev.Player.ShowHint(string.Format(UsefulHints.Instance.Config.Scp1853Warning), 4);
}
}
if (ev.Pickup.Type == ItemType.SCP1853)
{
if (ev.Player.IsEffectActive<Scp207>())
{
ev.Player.ShowHint(string.Format(UsefulHints.Instance.Config.Scp207Warning), 4);
}
if (ev.Player.IsEffectActive<AntiScp207>())
{

if (ev.Player.IsEffectActive<AntiScp207>() && ev.Pickup.Type != ItemType.AntiSCP207)
ev.Player.ShowHint(string.Format(UsefulHints.Instance.Config.AntiScp207Warning), 4);
}

if (ev.Player.IsEffectActive<Scp1853>() && ev.Pickup.Type != ItemType.SCP1853)
ev.Player.ShowHint(string.Format(UsefulHints.Instance.Config.Scp1853Warning), 4);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion UsefulHints/UsefulHints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class UsefulHints : Plugin<Config>
public override string Name => "Useful Hints";
public override string Author => "Vretu";
public override string Prefix { get; } = "UH";
public override Version Version => new Version(1, 9, 5);
public override Version Version => new Version(1, 9, 6);
public override Version RequiredExiledVersion { get; } = new Version(9, 0, 0);
public override PluginPriority Priority { get; } = PluginPriority.Low;
public static UsefulHints Instance { get; private set; }
Expand Down
2 changes: 1 addition & 1 deletion UsefulHints/UsefulHints.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="ExMod.Exiled">
<Version>9.2.1</Version>
<Version>9.2.2</Version>
</PackageReference>
<PackageReference Include="Fody">
<Version>6.9.1</Version>
Expand Down

0 comments on commit c48a1da

Please sign in to comment.