Skip to content

Commit

Permalink
Add show hint on equip for SCP-207 and SCP-?207
Browse files Browse the repository at this point in the history
  • Loading branch information
Vretu-Dev committed Oct 20, 2024
1 parent 93d2bab commit 5c1f91b
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 17 deletions.
9 changes: 4 additions & 5 deletions UsefulHints/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; } = "<color=yellow>\u26A0</color> You are already affected by <color=#A60C0E>SCP-207</color>";
Expand All @@ -33,7 +32,7 @@ public class Config : IConfig
public string FriendlyFireWarning { get; set; } = "<size=27><color=yellow>\u26A0 Do not hurt your teammate</color></size>";
public string DamageTakenWarning { get; set; } = "<size=27><color=red>{0}</color> <color=yellow>(teammate) hit you</color></size>";
public bool ClassDAreTeammates { get; set; } = true;
public bool EnableCuffedWarning { get; set; } = true;
public bool EnableCuffedWarning { get; set; } = false;
public string CuffedAttackerWarning { get; set; } = "<size=27><color=yellow>\u26A0 Player is cuffed</color></size>";
public string CuffedPlayerWarning { get; set; } = "<size=27><color=red>{0}</color> <color=yellow>hit you when you were cuffed</color></size>";
[Description("Kill Counter:")]
Expand Down
54 changes: 42 additions & 12 deletions UsefulHints/EventHandlers/Items/Hints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -58,17 +60,17 @@ private static void OnPickingUpMicroHid(PickingUpItemEventArgs ev)

if (roundedEnergyPercentage < 5)
{
ev.Player.ShowHint($"<color=red>{string.Format(UsefulHints.Instance.Config.MicroLowEnergyMessage)}</color>", 4);
ev.Player.ShowHint($"<color=red>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.MicroHidLowEnergyMessage)}</color>", 4);
}
else
{
ev.Player.ShowHint($"<color=#4169E1>{string.Format(UsefulHints.Instance.Config.MicroEnergyMessage, roundedEnergyPercentage)}</color>", 4);
ev.Player.ShowHint($"<color=#4169E1>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.MicroHidEnergyMessage, roundedEnergyPercentage)}</color>", 4);
}
}
}
public static void OnEquipMicroHid(ChangingItemEventArgs ev)
{
if (UsefulHints.Instance.Config.ShowHintOnEquip)
if (UsefulHints.Instance.Config.ShowHintOnEquipItem)
{
if (ev.Item == null)
{
Expand All @@ -82,11 +84,11 @@ public static void OnEquipMicroHid(ChangingItemEventArgs ev)

if (roundedEnergyPercentage < 5)
{
ev.Player.ShowHint($"<color=red>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.MicroLowEnergyMessage)}</color>", 4);
ev.Player.ShowHint($"<color=red>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.MicroHidLowEnergyMessage)}</color>", 2);
}
else
{
ev.Player.ShowHint($"<color=#4169E1>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.MicroEnergyMessage, roundedEnergyPercentage)}</color>", 4);
ev.Player.ShowHint($"<color=#4169E1>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.MicroHidEnergyMessage, roundedEnergyPercentage)}</color>", 2);
}
}
}
Expand All @@ -100,7 +102,7 @@ private static void OnPickingUpSCP207(PickingUpItemEventArgs ev)

if (scp207Effect != null)
{
ev.Player.ShowHint($"<color=#A60C0E>{string.Format(UsefulHints.Instance.Config.Scp207HintMessage, scp207Effect.Intensity)}</color>", 4);
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)
Expand All @@ -109,7 +111,35 @@ private static void OnPickingUpSCP207(PickingUpItemEventArgs ev)

if (antiscp207Effect != null)
{
ev.Player.ShowHint($"<color=#2969AD>{string.Format(UsefulHints.Instance.Config.AntiScp207HintMessage, antiscp207Effect.Intensity)}</color>", 4);
ev.Player.ShowHint($"<color=#C53892>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.AntiScp207HintMessage, antiscp207Effect.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)
{
CustomPlayerEffects.StatusEffectBase antiscp207Effect = ev.Player.ActiveEffects.FirstOrDefault(effect => effect.GetEffectType() == EffectType.AntiScp207);

if (antiscp207Effect != null)
{
ev.Player.ShowHint($"<color=#C53892>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.AntiScp207HintMessage, antiscp207Effect.Intensity)}</color>", 2);
}
}
}
}
Expand Down Expand Up @@ -248,17 +278,17 @@ private static void OnPickingUpJailbird(PickingUpItemEventArgs ev)
int remainingCharges = maxCharges - jailbirdPickup.TotalCharges;
if (remainingCharges > 1)
{
ev.Player.ShowHint($"<color=#00B7EB>{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}</color>", 4);
ev.Player.ShowHint($"<color=#00B7EB>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}</color>", 4);
}
else
{
ev.Player.ShowHint($"<color=#C73804>{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}</color>", 4);
ev.Player.ShowHint($"<color=#C73804>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}</color>", 4);
}
}
}
public static void OnEquipJailbird(ChangingItemEventArgs ev)
{
if (UsefulHints.Instance.Config.ShowHintOnEquip)
if (UsefulHints.Instance.Config.ShowHintOnEquipItem)
{
if (ev.Item == null)
{
Expand All @@ -271,11 +301,11 @@ public static void OnEquipJailbird(ChangingItemEventArgs ev)

if (remainingCharges > 1)
{
ev.Player.ShowHint($"<color=#00B7EB>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}</color>", 4);
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>", 4);
ev.Player.ShowHint($"<color=#C73804>{new string('\n', 10)}{string.Format(UsefulHints.Instance.Config.JailbirdUseMessage, remainingCharges)}</color>", 2);
}
}
}
Expand Down

0 comments on commit 5c1f91b

Please sign in to comment.