11using System ;
2- using System . Linq ;
32using System . Collections . Generic ;
43using Exiled . API . Enums ;
5- using Exiled . API . Extensions ;
64using JailbirdPickup = Exiled . API . Features . Pickups . JailbirdPickup ;
75using Player = Exiled . API . Features . Player ;
86using Exiled . Events . EventArgs . Map ;
97using Exiled . Events . EventArgs . Player ;
108using InventorySystem . Items . ThrowableProjectiles ;
119using InventorySystem . Items . Jailbird ;
12- using InventorySystem . Items . MicroHID ;
10+ using CustomPlayerEffects ;
1311using MEC ;
1412
1513namespace UsefulHints . EventHandlers . Items
@@ -57,59 +55,34 @@ private static void OnGrenadeHurting(HurtingEventArgs ev)
5755 if ( ev . DamageHandler . Type == DamageType . Explosion )
5856 {
5957 float RemainingHealth = ev . Player . Health - ev . Amount ;
58+
6059 if ( RemainingHealth > 0 && ! ev . Attacker . IsHost )
61- {
6260 ev . Attacker . ShowHint ( $ "<color=white>{ new string ( '\n ' , 5 ) } { string . Format ( UsefulHints . Instance . Config . GrenadeDamageHint , Math . Round ( ev . Amount ) ) } </color>", 4 ) ;
63- }
6461 }
6562 }
6663 // SCP 207 Handler
6764 private static void OnPickingUpSCP207 ( PickingUpItemEventArgs ev )
6865 {
69- if ( ev . Pickup . Type == ItemType . SCP207 )
70- {
71- CustomPlayerEffects . StatusEffectBase scp207Effect = ev . Player . ActiveEffects . FirstOrDefault ( effect => effect . GetEffectType ( ) == EffectType . Scp207 ) ;
72-
73- if ( scp207Effect != null )
74- {
75- ev . Player . ShowHint ( $ "<color=#A60C0E>{ new string ( '\n ' , 10 ) } { string . Format ( UsefulHints . Instance . Config . Scp207HintMessage , scp207Effect . Intensity ) } </color>", 4 ) ;
76- }
77- }
78- if ( ev . Pickup . Type == ItemType . AntiSCP207 )
79- {
80- CustomPlayerEffects . StatusEffectBase antiscp207Effect = ev . Player . ActiveEffects . FirstOrDefault ( effect => effect . GetEffectType ( ) == EffectType . AntiScp207 ) ;
66+ if ( ev . Player . IsEffectActive < Scp207 > ( ) && ev . Pickup . Type != ItemType . AntiSCP207 )
67+ ev . Player . ShowHint ( $ "<color=#A60C0E>{ new string ( '\n ' , 10 ) } { string . Format ( UsefulHints . Instance . Config . Scp207HintMessage , ev . Player . GetEffect ( EffectType . Scp207 ) . Intensity ) } </color>", 4 ) ;
8168
82- if ( antiscp207Effect != null )
83- {
84- ev . Player . ShowHint ( $ "<color=#C53892>{ new string ( '\n ' , 10 ) } { string . Format ( UsefulHints . Instance . Config . AntiScp207HintMessage , antiscp207Effect . Intensity ) } </color>", 4 ) ;
85- }
86- }
69+ if ( ev . Player . IsEffectActive < AntiScp207 > ( ) && ev . Pickup . Type != ItemType . SCP207 )
70+ ev . Player . ShowHint ( $ "<color=#C53892>{ new string ( '\n ' , 10 ) } { string . Format ( UsefulHints . Instance . Config . AntiScp207HintMessage , ev . Player . GetEffect ( EffectType . AntiScp207 ) . Intensity ) } </color>", 4 ) ;
8771 }
8872 private static void OnEquipSCP207 ( ChangingItemEventArgs ev )
8973 {
9074 if ( UsefulHints . Instance . Config . ShowHintOnEquipItem )
9175 {
9276 if ( ev . Item == null )
93- {
9477 return ;
95- }
96- if ( ev . Item . Type == ItemType . SCP207 )
97- {
98- CustomPlayerEffects . StatusEffectBase scp207Effect = ev . Player . ActiveEffects . FirstOrDefault ( effect => effect . GetEffectType ( ) == EffectType . Scp207 ) ;
9978
100- if ( scp207Effect != null )
101- {
102- ev . Player . ShowHint ( $ "<color=#A60C0E>{ new string ( '\n ' , 10 ) } { string . Format ( UsefulHints . Instance . Config . Scp207HintMessage , scp207Effect . Intensity ) } </color>", 2 ) ;
103- }
104- }
105- if ( ev . Item . Type == ItemType . AntiSCP207 )
79+ if ( ev . Item . Type == ItemType . SCP207 || ev . Item . Type == ItemType . AntiSCP207 )
10680 {
107- CustomPlayerEffects . StatusEffectBase antiscp207Effect = ev . Player . ActiveEffects . FirstOrDefault ( effect => effect . GetEffectType ( ) == EffectType . AntiScp207 ) ;
81+ if ( ev . Player . IsEffectActive < Scp207 > ( ) && ev . Item . Type != ItemType . AntiSCP207 )
82+ ev . Player . ShowHint ( $ "<color=#A60C0E>{ new string ( '\n ' , 10 ) } { string . Format ( UsefulHints . Instance . Config . Scp207HintMessage , ev . Player . GetEffect ( EffectType . Scp207 ) . Intensity ) } </color>", 4 ) ;
10883
109- if ( antiscp207Effect != null )
110- {
111- ev . Player . ShowHint ( $ "<color=#C53892>{ new string ( '\n ' , 10 ) } { string . Format ( UsefulHints . Instance . Config . AntiScp207HintMessage , antiscp207Effect . Intensity ) } </color>", 2 ) ;
112- }
84+ if ( ev . Player . IsEffectActive < AntiScp207 > ( ) && ev . Item . Type != ItemType . SCP207 )
85+ ev . Player . ShowHint ( $ "<color=#C53892>{ new string ( '\n ' , 10 ) } { string . Format ( UsefulHints . Instance . Config . AntiScp207HintMessage , ev . Player . GetEffect ( EffectType . AntiScp207 ) . Intensity ) } </color>", 4 ) ;
11386 }
11487 }
11588 }
@@ -129,8 +102,8 @@ private static void OnSCP1576Used(UsedItemEventArgs ev)
129102 }
130103
131104 var coroutine = Timing . RunCoroutine ( Scp1576Timer ( ev . Player ) ) ;
132- activeCoroutines [ ev . Player ] = coroutine ;
133- activeItems [ ev . Player ] = ev . Item . Type ;
105+ activeCoroutines . Add ( ev . Player , coroutine ) ;
106+ activeItems . Add ( ev . Player , ev . Item . Type ) ;
134107 }
135108 }
136109 private static void OnSCP1576ChangedItem ( ChangedItemEventArgs ev )
@@ -246,37 +219,29 @@ private static void OnPickingUpJailbird(PickingUpItemEventArgs ev)
246219 {
247220 int maxCharges = 5 ;
248221 int remainingCharges = maxCharges - jailbirdPickup . TotalCharges ;
222+
249223 if ( remainingCharges > 1 )
250- {
251224 ev . Player . ShowHint ( $ "<color=#00B7EB>{ new string ( '\n ' , 10 ) } { string . Format ( UsefulHints . Instance . Config . JailbirdUseMessage , remainingCharges ) } </color>", 4 ) ;
252- }
253225 else
254- {
255226 ev . Player . ShowHint ( $ "<color=#C73804>{ new string ( '\n ' , 10 ) } { string . Format ( UsefulHints . Instance . Config . JailbirdUseMessage , remainingCharges ) } </color>", 4 ) ;
256- }
257227 }
258228 }
259229 private static void OnEquipJailbird ( ChangingItemEventArgs ev )
260230 {
261231 if ( UsefulHints . Instance . Config . ShowHintOnEquipItem )
262232 {
263233 if ( ev . Item == null )
264- {
265234 return ;
266- }
235+
267236 if ( ev . Item . Base is JailbirdItem jailbirdItem )
268237 {
269238 int maxCharges = 5 ;
270239 int remainingCharges = maxCharges - jailbirdItem . TotalChargesPerformed ;
271240
272241 if ( remainingCharges > 1 )
273- {
274242 ev . Player . ShowHint ( $ "<color=#00B7EB>{ new string ( '\n ' , 10 ) } { string . Format ( UsefulHints . Instance . Config . JailbirdUseMessage , remainingCharges ) } </color>", 2 ) ;
275- }
276243 else
277- {
278244 ev . Player . ShowHint ( $ "<color=#C73804>{ new string ( '\n ' , 10 ) } { string . Format ( UsefulHints . Instance . Config . JailbirdUseMessage , remainingCharges ) } </color>", 2 ) ;
279- }
280245 }
281246 }
282247 }
0 commit comments