forked from dzarenafixers/BetterZombie
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEventHandlers.cs
More file actions
208 lines (192 loc) · 9.86 KB
/
Copy pathEventHandlers.cs
File metadata and controls
208 lines (192 loc) · 9.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
/// This file <BetterZombiePlugin.cs> its Privet just for GankMalp to Borksussy Owmer server
/// The file and plugin is secure with MIT lic and DZCP company portal
/// For that you cant take the codes or get the plugin files with out tell MONCEF50G and dzarenafixers
using System;
using System.Collections.Generic;
using System.Linq;
using Exiled.API.Enums;
using Exiled.API.Extensions;
using Exiled.API.Features;
using Exiled.API.Features.Roles;
using Exiled.Events.EventArgs.Player;
using Exiled.Events.EventArgs.Scp049;
using MEC;
using PlayerRoles;
using UnityEngine;
namespace MONCEF50G
{
public class EventHandlers
{
private readonly BetterZombiePlugin plugin;
private readonly HashSet<RoleTypeId> activeScps = new HashSet<RoleTypeId>();
private readonly Dictionary<Player, float> lastDecayTimes = new Dictionary<Player, float>();
/// This file <BetterZombiePlugin.cs> its Privet just for GankMalp to Borksussy Owmer server
/// The file and plugin is secure with MIT lic and DZCP company portal
/// For that you cant take the codes or get the plugin files with out tell MONCEF50G and dzarenafixers
public EventHandlers(BetterZombiePlugin plugin)
{
this.plugin = plugin;
}
public void OnRoundStarted()
{
activeScps.Clear();
lastDecayTimes.Clear();
// Detect active SCPs
foreach (Player player in Player.List.Where(p => p.IsScp))
{
activeScps.Add(player.Role.Type);
}
Log.Debug($"Active SCPs: {string.Join(", ", activeScps)}");
// Start decay coroutine for SCP-079 zombies
if (activeScps.Contains(RoleTypeId.Scp079))
Timing.RunCoroutine(ApplyDecay());
// Apply initial zombie modifications
foreach (Player zombie in Player.List.Where(p => p.Role.Type == RoleTypeId.Scp0492))
{
ApplyZombieModifications(zombie);
}
}
/// This file <BetterZombiePlugin.cs> its Privet just for GankMalp to Borksussy Owmer server
/// The file and plugin is secure with MIT lic and DZCP company portal
/// For that you cant take the codes or get the plugin files with out tell MONCEF50G and dzarenafixers
public void OnChangingRole(ChangingRoleEventArgs ev)
{
if (ev.NewRole == RoleTypeId.Scp0492)
{
Timing.CallDelayed(0.1f, () =>
{
if (ev.Player == null || !ev.Player.IsAlive) return;
ApplyZombieModifications(ev.Player);
});
}
else if (ev.Player != null && lastDecayTimes.ContainsKey(ev.Player))
{
lastDecayTimes.Remove(ev.Player);
}
}
/// This file <BetterZombiePlugin.cs> its Privet just for GankMalp to Borksussy Owmer server
/// The file and plugin is secure with MIT lic and DZCP company portal
/// For that you cant take the codes or get the plugin files with out tell MONCEF50G and dzarenafixers
public void OnHurting(HurtingEventArgs ev)
{
if (ev.Attacker == null || ev.Player == null || ev.Attacker.Role.Type != RoleTypeId.Scp0492) return;
// SCP-106: Slowness effect
if (activeScps.Contains(RoleTypeId.Scp106))
{
float distance = Vector3.Distance(ev.Attacker.Position, ev.Player.Position);
float slownessPercent = Mathf.Lerp(
plugin.Config.Scp106Config.MaxSlowness,
plugin.Config.Scp106Config.MinSlowness,
distance / plugin.Config.Scp106Config.MaxDistance
);
ev.Player.EnableEffect(EffectType.MovementBoost, -slownessPercent / 100f, true); // Fixed overload
Log.Debug($"Applied {slownessPercent}% slowness to {ev.Player.Nickname} at {distance}m");
}
// SCP-079: Tazed effect (replaced with Concussed)
if (activeScps.Contains(RoleTypeId.Scp079))
{
ev.Player.EnableEffect(EffectType.Concussed, plugin.Config.Scp079Config.TazedDuration, true); // Changed to Concussed
Log.Debug($"Applied {plugin.Config.Scp079Config.TazedDuration}s concussed to {ev.Player.Nickname}");
}
// SCP-096: Boost bloodlust speed
if (activeScps.Contains(RoleTypeId.Scp096))
{
var bloodlustEffect = ev.Attacker.GetEffect(EffectType.MovementBoost);
if (bloodlustEffect != null && bloodlustEffect.IsEnabled)
{
float baseSpeed = bloodlustEffect.Intensity * 100f;
float boostedSpeed = baseSpeed * plugin.Config.Scp096Config.BloodlustMultiplier;
ev.Attacker.EnableEffect(EffectType.MovementBoost, boostedSpeed / 100f, true); // Fixed overload
Log.Debug($"Boosted zombie {ev.Attacker.Nickname}'s bloodlust to {boostedSpeed}%");
}
}
}
/// This file <BetterZombiePlugin.cs> its Privet just for GankMalp to Borksussy Owmer server
/// The file and plugin is secure with MIT lic and DZCP company portal
/// For that you cant take the codes or get the plugin files with out tell MONCEF50G and dzarenafixers
public void OnDying(DyingEventArgs ev)
{
if (ev.Attacker == null || ev.Player == null || ev.Attacker.Role.Type != RoleTypeId.Scp0492) return;
// SCP-079: Prevent HP regen from kills
if (activeScps.Contains(RoleTypeId.Scp079))
{
ev.Attacker.Health = Mathf.Min(ev.Attacker.Health, ev.Attacker.MaxHealth);
Log.Debug($"Blocked HP regen for zombie {ev.Attacker.Nickname} on kill");
}
}
public void OnStartingRecall(StartingRecallEventArgs ev) // Changed from OnResurrecting
{
// SCP-079: Prevent infection
if (activeScps.Contains(RoleTypeId.Scp079))
{
ev.IsAllowed = false;
ev.Target.Kill(DamageType.Scp0492);
Log.Debug($"Blocked zombie infection by {ev.Player.Nickname} on {ev.Target.Nickname}");
}
// SCP-173: Grant Hume Shield on infection
if (activeScps.Contains(RoleTypeId.Scp173))
{
Timing.CallDelayed(0.1f, () =>
{
foreach (Player zombie in Player.List.Where(p => p.Role.Type == RoleTypeId.Scp0492))
{
zombie.HumeShield = Mathf.Min(
zombie.HumeShield + plugin.Config.Scp173Config.HumeShieldBonus,
zombie.MaxHumeShield
);
Log.Debug($"Added {plugin.Config.Scp173Config.HumeShieldBonus} HS to zombie {zombie.Nickname}");
}
});
}
}
/// This file <BetterZombiePlugin.cs> its Privet just for GankMalp to Borksussy Owmer server
/// The file and plugin is secure with MIT lic and DZCP company portal
/// For that you cant take the codes or get the plugin files with out tell MONCEF50G and dzarenafixers
private void ApplyZombieModifications(Player zombie)
{
if (zombie.Role.Type != RoleTypeId.Scp0492) return;
// SCP-049: Health bonus
if (activeScps.Contains(RoleTypeId.Scp049))
{
zombie.MaxHealth += plugin.Config.Scp049Config.HealthBonus;
zombie.Health += plugin.Config.Scp049Config.HealthBonus;
Log.Debug($"Applied {plugin.Config.Scp049Config.HealthBonus} health bonus to zombie {zombie.Nickname}");
}
// SCP-939: Chaos footstep sound
if (activeScps.Contains(RoleTypeId.Scp939) && plugin.Config.Scp939Config.UseChaosFootsteps)
{
Log.Warn("SCP-939 zombie footstep sound requires server-side audio modding outside EXILED API.");
}
// SCP-079: Track for decay
if (activeScps.Contains(RoleTypeId.Scp079))
{
lastDecayTimes[zombie] = Time.time;
}
}
/// This file <BetterZombiePlugin.cs> its Privet just for GankMalp to Borksussy Owmer server
/// The file and plugin is secure with MIT lic and DZCP company portal
/// For that you cant take the codes or get the plugin files with out tell MONCEF50G and dzarenafixers
private IEnumerator<float> ApplyDecay()
{
while (activeScps.Contains(RoleTypeId.Scp079))
{
foreach (var zombie in Player.List.Where(p => p.Role.Type == RoleTypeId.Scp0492))
{
if (!lastDecayTimes.ContainsKey(zombie))
lastDecayTimes[zombie] = Time.time;
float elapsed = Time.time - lastDecayTimes[zombie];
if (elapsed >= 1f)
{
zombie.Health = Mathf.Max(1f, zombie.Health - plugin.Config.Scp079Config.DecayRate);
lastDecayTimes[zombie] = Time.time;
Log.Debug($"Decayed zombie {zombie.Nickname} by {plugin.Config.Scp079Config.DecayRate} HP");
}
}
yield return Timing.WaitForSeconds(1f);
}
}
}
}
/// This file <BetterZombiePlugin.cs> its Privet just for GankMalp to Borksussy Owmer server
/// The file and plugin is secure with MIT lic and DZCP company portal
/// For that you cant take the codes or get the plugin files with out tell MONCEF50G and dzarenafixers